X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=e27c2fe2977c461dcbb632e7476db27808804c5f;hb=d3dcda30c8cbee75c0c8f500f4ab552bde513036;hp=64b6d5d6f1f574f3b73808c789ae70243da959e5;hpb=11dfb84f7dbbecf8c979dc6287993868cb205f93;p=quassel.git diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 64b6d5d6..e27c2fe2 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -87,6 +87,7 @@ #include "legacysystemtray.h" #include "msgprocessorstatuswidget.h" #include "nicklistwidget.h" +#include "passwordchangedlg.h" #include "qtuiapplication.h" #include "qtuimessageprocessor.h" #include "qtuisettings.h" @@ -103,15 +104,17 @@ # ifdef HAVE_PHONON # include "phononnotificationbackend.h" # endif -# ifdef HAVE_LIBSNORE -# include "snorenotificationbackend.h" -# endif # include "systraynotificationbackend.h" # include "taskbarnotificationbackend.h" #else /* HAVE_KDE */ # include "knotificationbackend.h" #endif /* HAVE_KDE */ + +#ifdef HAVE_LIBSNORE +# include "snorenotificationbackend.h" +#endif + #ifdef HAVE_SSL # include "sslinfodlg.h" #endif @@ -150,6 +153,11 @@ # include "settingspages/shortcutssettingspage.h" #endif +#ifdef HAVE_SONNET +# include "settingspages/sonnetsettingspage.h" +#endif + + MainWin::MainWin(QWidget *parent) #ifdef HAVE_KDE : KMainWindow(parent), _kHelpMenu(new KHelpMenu(this)), @@ -223,18 +231,18 @@ void MainWin::init() # ifdef HAVE_PHONON QtUi::registerNotificationBackend(new PhononNotificationBackend(this)); # endif -# ifdef HAVE_LIBSNORE - QtUi::registerNotificationBackend(new SnoreNotificationBackend(this)); -# elif !defined(QT_NO_SYSTEMTRAYICON) - QtUi::registerNotificationBackend(new SystrayNotificationBackend(this)); -# endif - QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this)); - #else /* HAVE_KDE */ QtUi::registerNotificationBackend(new KNotificationBackend(this)); #endif /* HAVE_KDE */ + +#ifdef HAVE_LIBSNORE + QtUi::registerNotificationBackend(new SnoreNotificationBackend(this)); +#elif !defined(QT_NO_SYSTEMTRAYICON) && !defined(HAVE_KDE) + QtUi::registerNotificationBackend(new SystrayNotificationBackend(this)); +#endif + #ifdef HAVE_INDICATEQT QtUi::registerNotificationBackend(new IndicatorNotificationBackend(this)); #endif @@ -360,6 +368,8 @@ void MainWin::setupActions() this, SLOT(showCoreConnectionDlg()))); coll->addAction("DisconnectCore", new Action(QIcon::fromTheme("network-disconnect"), tr("&Disconnect from Core"), coll, Client::instance(), SLOT(disconnectFromCore()))); + coll->addAction("ChangePassword", new Action(QIcon::fromTheme("dialog-password"), tr("Change &Password..."), coll, + this, SLOT(showPasswordChangeDlg()))); coll->addAction("CoreInfo", new Action(QIcon::fromTheme("help-about"), tr("Core &Info..."), coll, this, SLOT(showCoreInfoDlg()))); coll->addAction("ConfigureNetworks", new Action(QIcon::fromTheme("configure"), tr("Configure &Networks..."), coll, @@ -411,10 +421,6 @@ void MainWin::setupActions() #endif coll->addAction("ConfigureQuassel", configureQuasselAct); - QAction *changePasswordAct = new Action(QIcon::fromTheme("dialog-password"), tr("&Change password..."), coll, - this, SLOT(showChangePasswordDialog())); - coll->addAction("ChangePassword", changePasswordAct); - // Help QAction *aboutQuasselAct = new Action(QIcon(":/icons/quassel.png"), tr("&About Quassel"), coll, this, SLOT(showAboutDlg())); @@ -517,7 +523,7 @@ void MainWin::setupMenus() _fileMenu = menuBar()->addMenu(tr("&File")); static const QStringList coreActions = QStringList() - << "ConnectCore" << "DisconnectCore" << "CoreInfo"; + << "ConnectCore" << "DisconnectCore" << "ChangePassword" << "CoreInfo"; QAction *coreAction; foreach(QString actionName, coreActions) { @@ -557,7 +563,6 @@ void MainWin::setupMenus() #else _settingsMenu->addAction(coll->action("ConfigureShortcuts")); #endif - _settingsMenu->addAction(coll->action("ChangePassword")); _settingsMenu->addAction(coll->action("ConfigureQuassel")); @@ -738,12 +743,19 @@ void MainWin::changeActiveBufferView(int bufferViewId) nextBufferView(); // fallback } -void MainWin::showChangePasswordDialog() + +void MainWin::showPasswordChangeDlg() { - bool ok; - QString newPassword = QInputDialog::getText(this, tr("Set new password"), tr("New password:"), QLineEdit::Password, QString(), &ok); - if (ok && !newPassword.isEmpty()) { - emit changePassword(newPassword); + if((Client::coreFeatures() & Quassel::PasswordChange)) { + PasswordChangeDlg dlg(this); + dlg.exec(); + } + else { + QMessageBox box(QMessageBox::Warning, tr("Feature Not Supported"), + tr("Your Quassel Core does not support this feature"), + QMessageBox::Ok, this); + box.setInformativeText(tr("You need a Quassel Core v0.12.0 or newer in order to be able to remotely change your password.")); + box.exec(); } } @@ -872,6 +884,8 @@ void MainWin::setupNickWidget() // attach the NickListWidget to the BufferModel and the default selection _nickListWidget->setModel(Client::bufferModel()); _nickListWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel()); + + _nickListWidget->setVisible(false); } @@ -1070,6 +1084,7 @@ void MainWin::setConnectedState() coll->action("ConnectCore")->setEnabled(false); coll->action("DisconnectCore")->setEnabled(true); + coll->action("ChangePassword")->setEnabled(true); coll->action("CoreInfo")->setEnabled(true); foreach(QAction *action, _fileMenu->actions()) { @@ -1086,18 +1101,6 @@ void MainWin::setConnectedState() connect(Client::backlogManager(), SIGNAL(messagesProcessed(const QString &)), this, SLOT(showStatusBarMessage(const QString &))); } - disconnect(this, SIGNAL(changePassword(QString)), Client::instance(), SLOT(changePassword(QString))); - if (Client::internalCore()) { - coll->action("ChangePassword")->setVisible(false); - } - else if((Client::coreFeatures() & Quassel::PasswordChange)) { - connect(this, SIGNAL(changePassword(QString)), Client::instance(), SLOT(changePassword(QString))); - coll->action("ChangePassword")->setEnabled(true); - } - else { - coll->action("ChangePassword")->setEnabled(false); - } - // _viewMenu->setEnabled(true); if (!Client::internalCore()) statusBar()->showMessage(tr("Connected to core.")); @@ -1135,7 +1138,7 @@ void MainWin::loadLayout() _layoutLoaded = true; return; } - + _nickListWidget->setVisible(true); restoreState(state, accountId); int bufferViewId = s.value(QString("ActiveBufferView-%1").arg(accountId), -1).toInt(); if (bufferViewId >= 0) @@ -1205,6 +1208,7 @@ void MainWin::setDisconnectedState() _msgProcessorStatusWidget->setProgress(0, 0); updateIcon(); systemTray()->setState(SystemTray::Passive); + _nickListWidget->setVisible(false); } @@ -1368,6 +1372,9 @@ void MainWin::showSettingsDlg() dlg->registerSettingsPage(new BufferViewSettingsPage(dlg)); dlg->registerSettingsPage(new InputWidgetSettingsPage(dlg)); dlg->registerSettingsPage(new TopicWidgetSettingsPage(dlg)); +#ifdef HAVE_SONNET + dlg->registerSettingsPage(new SonnetSettingsPage(dlg)); +#endif dlg->registerSettingsPage(new HighlightSettingsPage(dlg)); dlg->registerSettingsPage(new NotificationsSettingsPage(dlg)); dlg->registerSettingsPage(new BacklogSettingsPage(dlg));