#include "quassel.h"
#include "signalproxy.h"
#include "util.h"
+#include "clientauthhandler.h"
#include <stdio.h>
#include <stdlib.h>
p->attachSlot(SIGNAL(networkCreated(NetworkId)), this, SLOT(coreNetworkCreated(NetworkId)));
p->attachSlot(SIGNAL(networkRemoved(NetworkId)), this, SLOT(coreNetworkRemoved(NetworkId)));
+ p->attachSignal(this, SIGNAL(clientChangePassword(QString)));
+
//connect(mainUi(), SIGNAL(connectToCore(const QVariantMap &)), this, SLOT(connectToCore(const QVariantMap &)));
connect(mainUi(), SIGNAL(disconnectFromCore()), this, SLOT(disconnectFromCore()));
connect(this, SIGNAL(connected()), mainUi(), SLOT(connectedToCore()));
bufferSyncer()->requestMarkBufferAsRead(id);
}
+void Client::changePassword(QString newPassword) {
+ CoreAccount account = currentCoreAccount();
+ account.setPassword(newPassword);
+ coreAccountModel()->createOrUpdateAccount(account);
+ emit clientChangePassword(newPassword);
+}
+
#if QT_VERSION < 0x050000
void Client::logMessage(QtMsgType type, const char *msg)
*/
void bufferMarkedAsRead(BufferId id);
+ void clientChangePassword(QString password);
+
public slots:
void disconnectFromCore();
void markBufferAsRead(BufferId id);
+ void changePassword(QString newPassword);
+
private slots:
void setSyncedToCore();
void setDisconnectedFromCore();
SessionThread *session = new SessionThread(uid, restore, this);
_sessions[uid] = session;
session->start();
+ connect(session, SIGNAL(passwordChangeRequested(UserId, QString)), _storage, SLOT(updateUser(UserId, QString)));
return session;
}
void socketError(QAbstractSocket::SocketError err, const QString &errorString);
void setupClientSession(RemotePeer *, UserId);
+ void changeUserPass(const QString &username);
+
private:
Core();
~Core();
void unregisterStorageBackend(Storage *);
bool selectBackend(const QString &backend);
void createUser();
- void changeUserPass(const QString &username);
void saveBackendSettings(const QString &backend, const QVariantMap &settings);
QVariantMap promptForSettings(const Storage *storage);
p->attachSlot(SIGNAL(createNetwork(const NetworkInfo &, const QStringList &)), this, SLOT(createNetwork(const NetworkInfo &, const QStringList &)));
p->attachSlot(SIGNAL(removeNetwork(NetworkId)), this, SLOT(removeNetwork(NetworkId)));
+ p->attachSlot(SIGNAL(clientChangePassword(QString)), this, SLOT(changePassword(QString)));
+
loadSettings();
initScriptEngine();
net->userInputHandler()->issueAway(msg, false /* no force away */);
}
}
+
+void CoreSession::changePassword(QString password)
+{
+ emit passwordChangeRequested(_user, password);
+}
//! Marks us away (or unaway) on all networks
void globalAway(const QString &msg = QString());
+ void changePassword(QString password);
+
signals:
void initialized();
void sessionState(const Protocol::SessionState &sessionState);
void networkRemoved(NetworkId);
void networkDisconnected(NetworkId);
+ void passwordChangeRequested(UserId user, QString password);
+
protected:
virtual void customEvent(QEvent *event);
void SessionThread::run()
{
_session = new CoreSession(user(), _restoreState);
+ connect(_session, SIGNAL(passwordChangeRequested(UserId, QString)), SIGNAL(passwordChangeRequested(UserId, QString)));
connect(this, SIGNAL(addRemoteClient(RemotePeer*)), _session, SLOT(addClient(RemotePeer*)));
connect(this, SIGNAL(addInternalClient(InternalPeer*)), _session, SLOT(addClient(InternalPeer*)));
connect(_session, SIGNAL(sessionState(Protocol::SessionState)), Core::instance(), SIGNAL(sessionState(Protocol::SessionState)));
void addRemoteClient(RemotePeer *peer);
void addInternalClient(InternalPeer *peer);
+ void passwordChangeRequested(UserId user, QString newPassword);
+
private:
CoreSession *_session;
UserId _user;
#include <QMessageBox>
#include <QStatusBar>
#include <QToolBar>
+#include <QInputDialog>
#ifdef HAVE_KDE4
# include <KHelpMenu>
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);
#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()));
#else
_settingsMenu->addAction(coll->action("ConfigureShortcuts"));
#endif
+ _settingsMenu->addAction(coll->action("ChangePassword"));
_settingsMenu->addAction(coll->action("ConfigureQuassel"));
+
_helpMenu = menuBar()->addMenu(tr("&Help"));
_helpMenu->addAction(coll->action("AboutQuassel"));
nextBufferView(); // fallback
}
+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);
+ }
+}
+
void MainWin::changeActiveBufferView(bool backwards)
{
void changeActiveBufferView(bool backwards);
void changeActiveBufferView(int bufferViewId);
+ void showChangePasswordDialog();
+
signals:
void connectToCore(const QVariantMap &connInfo);
void disconnectFromCore();
+ void changePassword(QString newPassword);
private:
#ifdef HAVE_KDE