X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fcoreconnectdlg.cpp;fp=src%2Fqtui%2Fcoreconnectdlg.cpp;h=10ee20f979818b4421c4dde03a0f80b3d584d59f;hp=0000000000000000000000000000000000000000;hb=bf86381e85cd97ef04a9dc45c2b1a063035391fa;hpb=aa1d373fe6a71c692586ff5898ce20c75682d5d0 diff --git a/src/qtui/coreconnectdlg.cpp b/src/qtui/coreconnectdlg.cpp new file mode 100644 index 00000000..10ee20f9 --- /dev/null +++ b/src/qtui/coreconnectdlg.cpp @@ -0,0 +1,62 @@ +/*************************************************************************** + * Copyright (C) 2009 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include + +#include "coreconnectdlg.h" + +#include "iconloader.h" +#include "clientsettings.h" +#include "coreaccountsettingspage.h" + +CoreConnectDlg::CoreConnectDlg(QWidget *parent) : QDialog(parent) { + _settingsPage = new CoreAccountSettingsPage(this); + _settingsPage->setStandAlone(true); + _settingsPage->load(); + + CoreAccountSettings s; + AccountId lastAccount = s.lastAccount(); + if(lastAccount.isValid()) + _settingsPage->setSelectedAccount(lastAccount); + + setWindowTitle(tr("Connect to Core")); + setWindowIcon(SmallIcon("network-disconnect")); + + QVBoxLayout *layout = new QVBoxLayout(this); + layout->addWidget(_settingsPage); + + QDialogButtonBox *buttonBox = new QDialogButtonBox(this); + buttonBox->setStandardButtons(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + layout->addWidget(buttonBox); + + connect(_settingsPage, SIGNAL(connectToCore(AccountId)), SLOT(accept())); + connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), SLOT(reject())); +} + +AccountId CoreConnectDlg::selectedAccount() const { + return _settingsPage->selectedAccount(); +} + +void CoreConnectDlg::accept() { + _settingsPage->save(); + QDialog::accept(); +}