Adapt the wizard to CoreConnection and make it work again.
disconnectFromCore();
return;
} else if(msg["MsgType"] == "CoreSetupAck") {
- //emit coreSetupSuccess();
+ emit coreSetupSuccess();
} else if(msg["MsgType"] == "CoreSetupReject") {
- //emit coreSetupFailed(msg["Error"].toString());
+ emit coreSetupFailed(msg["Error"].toString());
} else if(msg["MsgType"] == "ClientLoginReject") {
loginFailed(msg["Error"].toString());
} else if(msg["MsgType"] == "ClientLoginAck") {
_coreMsgBuffer.clear();
}
+void CoreConnection::loginToCore(const QString &user, const QString &password, bool remember) {
+ _account.setUser(user);
+ _account.setPassword(password);
+ _account.setStorePassword(remember);
+ loginToCore();
+}
+
void CoreConnection::loginToCore(const QString &prevError) {
emit connectionMsg(tr("Logging in..."));
if(currentAccount().user().isEmpty() || currentAccount().password().isEmpty() || !prevError.isEmpty()) {
emit synchronized();
}
}
+
+void CoreConnection::doCoreSetup(const QVariant &setupData) {
+ QVariantMap setup;
+ setup["MsgType"] = "CoreSetupData";
+ setup["SetupData"] = setupData;
+ SignalProxy::writeDataToDevice(_socket, setup);
+}
void progressTextChanged(const QString &);
void startCoreSetup(const QVariantList &);
+ void coreSetupSuccess();
+ void coreSetupFailed(const QString &error);
+
void startInternalCore();
void connectToInternalCore(SignalProxy *proxy);
void resetConnection();
void connectionReady();
- //void doCoreSetup(const QVariant &setupData);
+ void loginToCore(const QString &user, const QString &password, bool remember); // for config wizard
void loginToCore(const QString &previousError = QString());
void loginSuccess();
void loginFailed(const QString &errorMessage);
+ void doCoreSetup(const QVariant &setupData);
+
void updateProgress(int value, int maximum);
void setProgressText(const QString &text);
void setProgressValue(int value);
QString _coreInfoString(const QVariantMap &);
inline CoreAccountModel *accountModel() const;
+
+ friend class CoreConfigWizard;
};
Q_DECLARE_METATYPE(CoreConnection::ConnectionState)
#include <QSpinBox>
#include "coreconfigwizard.h"
+#include "coreconnection.h"
#include "iconloader.h"
-CoreConfigWizard::CoreConfigWizard(const QList<QVariant> &backends, QWidget *parent) : QWizard(parent) {
- foreach(QVariant v, backends) _backends[v.toMap()["DisplayName"].toString()] = v;
+CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QList<QVariant> &backends, QWidget *parent)
+ : QWizard(parent),
+ _connection(connection)
+{
+ setModal(true);
+ setAttribute(Qt::WA_DeleteOnClose);
+
+ foreach(const QVariant &v, backends)
+ _backends[v.toMap()["DisplayName"].toString()] = v;
+
setPage(IntroPage, new CoreConfigWizardPages::IntroPage(this));
setPage(AdminUserPage, new CoreConfigWizardPages::AdminUserPage(this));
setPage(StorageSelectionPage, new CoreConfigWizardPages::StorageSelectionPage(_backends, this));
syncPage = new CoreConfigWizardPages::SyncPage(this);
- connect(syncPage, SIGNAL(setupCore(const QString &, const QVariantMap &)), this, SLOT(prepareCoreSetup(const QString &, const QVariantMap &)));
+ connect(syncPage, SIGNAL(setupCore(const QString &, const QVariantMap &)), SLOT(prepareCoreSetup(const QString &, const QVariantMap &)));
setPage(SyncPage, syncPage);
syncRelayPage = new CoreConfigWizardPages::SyncRelayPage(this);
connect(syncRelayPage, SIGNAL(startOver()), this, SLOT(startOver()));
setWindowTitle(tr("Core Configuration Wizard"));
setPixmap(QWizard::LogoPixmap, DesktopIcon("quassel"));
+
+ connect(connection, SIGNAL(coreSetupSuccess()), SLOT(coreSetupSuccess()));
+ connect(connection, SIGNAL(coreSetupFailed(QString)), SLOT(coreSetupFailed(QString)));
+ //connect(connection, SIGNAL(loginSuccess()), SLOT(loginSuccess()));
+ connect(connection, SIGNAL(synchronized()), SLOT(syncFinished()));
+ connect(this, SIGNAL(rejected()), connection, SLOT(disconnectFromCore()));
}
QHash<QString, QVariant> CoreConfigWizard::backends() const {
foo["AdminPasswd"] = field("adminUser.password").toString();
foo["Backend"] = backend;
foo["ConnectionProperties"] = properties;
- emit setupCore(foo);
+ coreConnection()->doCoreSetup(foo);
}
void CoreConfigWizard::coreSetupSuccess() {
syncPage->setStatus(tr("Your core has been successfully configured. Logging you in..."));
syncPage->setError(false);
syncRelayPage->setMode(CoreConfigWizardPages::SyncRelayPage::Error);
- QVariantMap loginData;
- loginData["User"] = field("adminUser.user");
- loginData["Password"] = field("adminUser.password");
- loginData["RememberPasswd"] = field("adminUser.rememberPasswd");
- emit loginToCore(loginData);
+ coreConnection()->loginToCore(field("adminUser.user").toString(), field("adminUser.password").toString(), field("adminUser.rememberPasswd").toBool());
}
void CoreConfigWizard::coreSetupFailed(const QString &error) {
}
void CoreConfigWizard::syncFinished() {
- // TODO: display identities and networks settings if appropriate!
- // accept();
+ accept();
}
namespace CoreConfigWizardPages {
QWidget *widget = _connectionBox->findChild<QWidget *>(key);
QVariant def;
if(defaults.contains(key)) {
- def = defaults[key];
+ def = defaults[key];
}
switch(def.type()) {
case QVariant::Int:
- {
- QSpinBox *spinbox = qobject_cast<QSpinBox *>(widget);
- Q_ASSERT(spinbox);
- def = QVariant(spinbox->value());
- }
- break;
+ {
+ QSpinBox *spinbox = qobject_cast<QSpinBox *>(widget);
+ Q_ASSERT(spinbox);
+ def = QVariant(spinbox->value());
+ }
+ break;
default:
- {
- QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget);
- Q_ASSERT(lineEdit);
- def = QVariant(lineEdit->text());
- }
+ {
+ QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget);
+ Q_ASSERT(lineEdit);
+ def = QVariant(lineEdit->text());
+ }
}
properties[key] = def;
}
QWidget *widget = 0;
QVariant def;
if(defaults.contains(key)) {
- def = defaults[key];
+ def = defaults[key];
}
switch(def.type()) {
case QVariant::Int:
- {
- QSpinBox *spinbox = new QSpinBox(propertyBox);
- spinbox->setMaximum(64000);
- spinbox->setValue(def.toInt());
- widget = spinbox;
- }
- break;
+ {
+ QSpinBox *spinbox = new QSpinBox(propertyBox);
+ spinbox->setMaximum(64000);
+ spinbox->setValue(def.toInt());
+ widget = spinbox;
+ }
+ break;
default:
- {
- QLineEdit *lineEdit = new QLineEdit(def.toString(), propertyBox);
- if(key.toLower().contains("password")) {
- lineEdit->setEchoMode(QLineEdit::Password);
- }
- widget = lineEdit;
- }
+ {
+ QLineEdit *lineEdit = new QLineEdit(def.toString(), propertyBox);
+ if(key.toLower().contains("password")) {
+ lineEdit->setEchoMode(QLineEdit::Password);
+ }
+ widget = lineEdit;
+ }
}
widget->setObjectName(key);
formlayout->addRow(key + ":", widget);
#include "ui_coreconfigwizardstorageselectionpage.h"
#include "ui_coreconfigwizardsyncpage.h"
+class CoreConnection;
+
namespace CoreConfigWizardPages {
class SyncPage;
class SyncRelayPage;
ConclusionPage
};
- CoreConfigWizard(const QList<QVariant> &backends, QWidget *parent = 0);
+ CoreConfigWizard(CoreConnection *connection, const QList<QVariant> &backends, QWidget *parent = 0);
QHash<QString, QVariant> backends() const;
+ inline CoreConnection *coreConnection() const { return _connection; }
+
signals:
void setupCore(const QVariant &setupData);
- void loginToCore(const QVariantMap &loginData);
+ void loginToCore(const QString &user, const QString &password, bool rememberPassword);
public slots:
void loginSuccess();
QHash<QString, QVariant> _backends;
CoreConfigWizardPages::SyncPage *syncPage;
CoreConfigWizardPages::SyncRelayPage *syncRelayPage;
+
+ CoreConnection *_connection;
};
namespace CoreConfigWizardPages {
#include "clientbufferviewconfig.h"
#include "clientbufferviewmanager.h"
#include "clientignorelistmanager.h"
+#include "coreconfigwizard.h"
#include "coreconnectdlg.h"
#include "coreconnection.h"
#include "coreconnectionstatuswidget.h"
SLOT(messagesInserted(const QModelIndex &, int, int)));
connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showChannelList(NetworkId)), SLOT(showChannelList(NetworkId)));
connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString)));
+
+ connect(Client::coreConnection(), SIGNAL(startCoreSetup(QVariantList)), SLOT(showCoreConfigWizard(QVariantList)));
connect(Client::coreConnection(), SIGNAL(connectionErrorPopup(QString)), SLOT(handleCoreConnectionError(QString)));
connect(Client::coreConnection(), SIGNAL(userAuthenticationRequired(CoreAccount *, bool *, QString)), SLOT(userAuthenticationRequired(CoreAccount *, bool *, QString)));
connect(Client::coreConnection(), SIGNAL(handleNoSslInClient(bool*)), SLOT(handleNoSslInClient(bool *)));
}
}
+void MainWin::showCoreConfigWizard(const QVariantList &backends) {
+ CoreConfigWizard *wizard = new CoreConfigWizard(Client::coreConnection(), backends, this);
+
+ wizard->show();
+}
+
void MainWin::showChannelList(NetworkId netId) {
ChannelListDlg *channelListDlg = new ChannelListDlg();
void showAboutDlg();
void showChannelList(NetworkId netId = NetworkId());
void showCoreConnectionDlg();
+ void showCoreConfigWizard(const QVariantList &);
void showCoreInfoDlg();
void showAwayLog();
void showSettingsDlg();
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>CoreConfigWizardAdminUserPage</class>
- <widget class="QWidget" name="CoreConfigWizardAdminUserPage" >
- <property name="geometry" >
+ <widget class="QWidget" name="CoreConfigWizardAdminUserPage">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<height>273</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QVBoxLayout" >
+ <layout class="QVBoxLayout">
<item>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
<string>Username:</string>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="user" />
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="user"/>
</item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
<string>Password:</string>
</property>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QLineEdit" name="password" >
- <property name="echoMode" >
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="password">
+ <property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_4" >
- <property name="text" >
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
<string>Repeat password:</string>
</property>
</widget>
</item>
- <item row="2" column="1" >
- <widget class="QLineEdit" name="password2" >
- <property name="echoMode" >
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="password2">
+ <property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
- <item row="3" column="1" >
- <widget class="QCheckBox" name="rememberPasswd" >
- <property name="text" >
+ <item row="3" column="1">
+ <widget class="QCheckBox" name="rememberPasswd">
+ <property name="text">
<string>Remember password</string>
</property>
</widget>
</layout>
</item>
<item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu Sans'; font-size:8pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Lucida Grande'; font-size:13pt;"><span style=" font-size:10pt; font-weight:600;">Note: </span><span style=" font-size:10pt;">Adding more users and changing your username/password is not possible via Quassel's interface yet.</span></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Lucida Grande'; font-size:10pt;">If you need to do these things have a look at the manageusers.py script which is located in the /scripts directory.</p></body></html></string>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string><b>Note:</b> Adding more users and changing your username/password is not possible via Quassel's client interface yet.
+If you need to do these things, please run "<tt><nobr>quasselcore --help</nobr></tt>".</string>
</property>
- <property name="alignment" >
+ <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
- <property name="wordWrap" >
+ <property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>405</width>
<height>51</height>