Example #1
0
void StartMenu::on_hostPushButton_clicked()
{
    this->hide();
	HostDialog hDialog;
    hDialog.setModal(true);
    hDialog.exec();
}
Example #2
0
void SettingsDialog::hostButton_clicked()
{
    HostDialog *host = new HostDialog(this);

    if (host->exec() == QDialog::Accepted) {
	QString hostname = host->getHostName();
	QString hostspec = host->getHostSpecification();
	int sts, flags = host->getContextFlags();

	if (hostspec == QString::null || hostspec.length() == 0) {
	    hostspec.append(tr("Hostname not specified\n"));
	    QMessageBox::warning(this, pmProgname, hostspec,
		    QMessageBox::Ok|QMessageBox::Default|QMessageBox::Escape,
		    Qt::NoButton, Qt::NoButton);
	} else if ((sts = liveGroup->use(PM_CONTEXT_HOST, hostspec, flags)) < 0) {
	    hostspec.prepend(tr("Cannot connect to host: "));
	    hostspec.append(tr("\n"));
	    hostspec.append(tr(pmErrStr(sts)));
	    QMessageBox::warning(this, pmProgname, hostspec,
		    QMessageBox::Ok|QMessageBox::Default|QMessageBox::Escape,
		    Qt::NoButton, Qt::NoButton);
	} else {
	    console->post(PmChart::DebugUi,
			"OpenViewDialog::newHost: %s (flags=0x%x)",
			(const char *)hostspec.toAscii(), flags);
	    setupHostComboBox(hostname);
	    if (globalSettings.savedHosts.contains(hostname) == false) {
		globalSettings.savedHostsModified = true;
		globalSettings.savedHosts << hostname;
		setupSavedHostsList();
		writeSettings();
	    }
	}
    }
    delete host;
}