X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=8f022cac586dcd01e898843b4f08035d7d617802;hb=d0e9b7a1d5e73041ade519189eea012500440ba9;hp=6d8aa6bb47af1838d4354de3b31bf9a9df24d005;hpb=8379f6f725cf8ed2fdad1a19bd10743436c2d086;p=quassel.git diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 6d8aa6bb..8f022cac 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" @@ -197,8 +198,6 @@ void MainWin::init() connect(Client::coreConnection(), SIGNAL(handleSslErrors(const QSslSocket *, bool *, bool *)), SLOT(handleSslErrors(const QSslSocket *, bool *, bool *))); #endif - connect(this, SIGNAL(changePassword(QString)), Client::instance(), SLOT(changePassword(QString))); - // Setup Dock Areas setDockNestingEnabled(true); setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); @@ -362,6 +361,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, @@ -413,10 +414,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())); @@ -519,7 +516,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) { @@ -559,7 +556,6 @@ void MainWin::setupMenus() #else _settingsMenu->addAction(coll->action("ConfigureShortcuts")); #endif - _settingsMenu->addAction(coll->action("ChangePassword")); _settingsMenu->addAction(coll->action("ConfigureQuassel")); @@ -740,12 +736,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(); } } @@ -1072,6 +1075,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()) { @@ -1188,6 +1192,7 @@ void MainWin::setDisconnectedState() coll->action("ConnectCore")->setEnabled(true); coll->action("DisconnectCore")->setEnabled(false); coll->action("CoreInfo")->setEnabled(false); + coll->action("ChangePassword")->setEnabled(false); //_viewMenu->setEnabled(false); statusBar()->showMessage(tr("Not connected to core.")); if (_msgProcessorStatusWidget)