This action fits better in the File menu than under Settings, so
move it there.
Also, to increase discoverability, we now show the option even if
the core is too old to support the feature. A popup message informing
the user is shown in that case.
Additionally, the changed password is now saved client-side (if the
account is setup to remember the password), thus avoiding having to
re-enter the new password on next launch.
CoreAccount account = currentCoreAccount();
account.setPassword(newPassword);
coreAccountModel()->createOrUpdateAccount(account);
CoreAccount account = currentCoreAccount();
account.setPassword(newPassword);
coreAccountModel()->createOrUpdateAccount(account);
+ coreAccountModel()->save();
emit clientChangePassword(newPassword);
}
emit clientChangePassword(newPassword);
}
connect(Client::coreConnection(), SIGNAL(handleSslErrors(const QSslSocket *, bool *, bool *)), SLOT(handleSslErrors(const QSslSocket *, bool *, bool *)));
#endif
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);
// Setup Dock Areas
setDockNestingEnabled(true);
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
this, SLOT(showCoreConnectionDlg())));
coll->addAction("DisconnectCore", new Action(QIcon::fromTheme("network-disconnect"), tr("&Disconnect from Core"), coll,
Client::instance(), SLOT(disconnectFromCore())));
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(showChangePasswordDialog())));
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,
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,
#endif
coll->addAction("ConfigureQuassel", configureQuasselAct);
#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()));
// Help
QAction *aboutQuasselAct = new Action(QIcon(":/icons/quassel.png"), tr("&About Quassel"), coll,
this, SLOT(showAboutDlg()));
_fileMenu = menuBar()->addMenu(tr("&File"));
static const QStringList coreActions = QStringList()
_fileMenu = menuBar()->addMenu(tr("&File"));
static const QStringList coreActions = QStringList()
- << "ConnectCore" << "DisconnectCore" << "CoreInfo";
+ << "ConnectCore" << "DisconnectCore" << "ChangePassword" << "CoreInfo";
QAction *coreAction;
foreach(QString actionName, coreActions) {
QAction *coreAction;
foreach(QString actionName, coreActions) {
#else
_settingsMenu->addAction(coll->action("ConfigureShortcuts"));
#endif
#else
_settingsMenu->addAction(coll->action("ConfigureShortcuts"));
#endif
- _settingsMenu->addAction(coll->action("ChangePassword"));
_settingsMenu->addAction(coll->action("ConfigureQuassel"));
_settingsMenu->addAction(coll->action("ConfigureQuassel"));
nextBufferView(); // fallback
}
nextBufferView(); // fallback
}
void MainWin::showChangePasswordDialog()
{
void MainWin::showChangePasswordDialog()
{
- 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)) {
+ bool ok;
+ QString newPassword = QInputDialog::getText(this, tr("Set Core Password"), tr("New password for your Quassel Core:"), QLineEdit::Password, QString(), &ok);
+ if (ok && !newPassword.isEmpty()) {
+ emit changePassword(newPassword);
+ }
+ }
+ else {
+ QMessageBox box(QMessageBox::Warning, tr("Feature Not Supported"),
+ tr("<b>Your Quassel Core does not support this feature</b>"),
+ 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();
coll->action("ConnectCore")->setEnabled(false);
coll->action("DisconnectCore")->setEnabled(true);
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()) {
coll->action("CoreInfo")->setEnabled(true);
foreach(QAction *action, _fileMenu->actions()) {
connect(Client::backlogManager(), SIGNAL(messagesProcessed(const QString &)), this, SLOT(showStatusBarMessage(const QString &)));
}
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."));
// _viewMenu->setEnabled(true);
if (!Client::internalCore())
statusBar()->showMessage(tr("Connected to core."));