- */
- connect(ui.newAccount, SIGNAL(clicked()), this, SLOT(createAccount()));
- connect(ui.delAccount, SIGNAL(clicked()), this, SLOT(removeAccount()));
- connect(ui.buttonBox1, SIGNAL(accepted()), this, SLOT(doConnect()));
- connect(ui.hostEdit, SIGNAL(textChanged(const QString &)), this, SLOT(checkInputValid()));
- connect(ui.userEdit, SIGNAL(textChanged(const QString &)), this, SLOT(checkInputValid()));
- connect(ui.internalCore, SIGNAL(toggled(bool)), this, SLOT(checkInputValid()));
- connect(ui.internalCore, SIGNAL(toggled(bool)), ui.hostEdit, SLOT(setDisabled(bool)));
- connect(ui.internalCore, SIGNAL(toggled(bool)), ui.port, SLOT(setDisabled(bool)));
- connect(ui.accountList, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(accountChanged(const QString &)));
- connect(ui.autoConnect, SIGNAL(clicked(bool)), this, SLOT(autoConnectToggled(bool)));
-
- connect(Client::instance(), SIGNAL(coreConnectionMsg(const QString &)), ui.connectionStatus, SLOT(setText(const QString &)));
- connect(Client::instance(), SIGNAL(coreConnectionProgress(uint, uint)), this, SLOT(updateProgressBar(uint, uint)));
- connect(Client::instance(), SIGNAL(coreConnectionError(QString)), this, SLOT(coreConnectionError(QString)));
- connect(Client::instance(), SIGNAL(connected()), this, SLOT(coreConnected()));
-
- AccountSettings s;
- ui.accountList->addItems(s.knownAccounts());
- curacc = s.lastAccount();
- if(!ui.accountList->count()) {
- //if(doAutoConnect) reject();
-
- setAccountEditEnabled(false);
- QString newacc = QInputDialog::getText(this, tr("Create Account"), tr(
- "In order to connect to a Quassel Core, you need to create an account.<br>"
- "Please enter a name for this account now:"), QLineEdit::Normal, tr("Default"));
- if(!newacc.isEmpty()) {
- ui.accountList->addItem(newacc);
- ui.hostEdit->setText("localhost");
- ui.port->setValue(DEFAULT_PORT);
- ui.internalCore->setChecked(false);
- setAccountEditEnabled(true);
- }
- /*
- // FIXME We create a default account here that just connects to the internal core
- curacc = "Default";
- ui.accountList->addItem("Default");
- ui.internalCore->setChecked(true);
- ui.userEdit->setText("Default");
- ui.passwdEdit->setText("password");
- ui.rememberPasswd->setChecked(true);
- accountChanged(curacc);
- ui.passwdEdit->setText("password");
- ui.accountList->setCurrentIndex(0);
- ui.autoConnect->setChecked(true);
- autoConnectToggled(true);
- */
- } else {
- if(!curacc.isEmpty()) {
- //if(doAutoConnect) { qDebug() << "auto";
- // AccountSettings s;
- // int idx = ui.accountList->findText(s.autoConnectAccount());
- // if(idx < 0) reject();
- // else {
- // ui.accountList->setCurrentIndex(idx);
- // doConnect();
- // }
- //} else {
- int idx = ui.accountList->findText(curacc);
- ui.accountList->setCurrentIndex(idx);
- //}
- }
+ if(currentItem) ui.accountList->setCurrentItem(currentItem);
+ else ui.accountList->setCurrentRow(0);
+
+ setAccountWidgetStates();
+
+ ui.accountButtonBox->button(QDialogButtonBox::Ok)->setFocus();
+ //ui.accountButtonBox->button(QDialogButtonBox::Ok)->setAutoDefault(true);
+
+ connect(clientSyncer, SIGNAL(socketStateChanged(QAbstractSocket::SocketState)),this, SLOT(initPhaseSocketState(QAbstractSocket::SocketState)));
+ connect(clientSyncer, SIGNAL(connectionError(const QString &)), this, SLOT(initPhaseError(const QString &)));
+ connect(clientSyncer, SIGNAL(connectionMsg(const QString &)), this, SLOT(initPhaseMsg(const QString &)));
+ connect(clientSyncer, SIGNAL(encrypted(bool)), this, SLOT(encrypted(bool)));
+ connect(clientSyncer, SIGNAL(startLogin()), this, SLOT(startLogin()));
+ connect(clientSyncer, SIGNAL(loginFailed(const QString &)), this, SLOT(loginFailed(const QString &)));
+ connect(clientSyncer, SIGNAL(loginSuccess()), this, SLOT(startSync()));
+ connect(clientSyncer, SIGNAL(startCoreSetup(const QVariantList &)), this, SLOT(startCoreConfig(const QVariantList &)));
+ connect(clientSyncer, SIGNAL(sessionProgress(quint32, quint32)), this, SLOT(coreSessionProgress(quint32, quint32)));
+ connect(clientSyncer, SIGNAL(networksProgress(quint32, quint32)), this, SLOT(coreNetworksProgress(quint32, quint32)));
+ connect(clientSyncer, SIGNAL(channelsProgress(quint32, quint32)), this, SLOT(coreChannelsProgress(quint32, quint32)));
+ connect(clientSyncer, SIGNAL(ircUsersProgress(quint32, quint32)), this, SLOT(coreIrcUsersProgress(quint32, quint32)));
+ connect(clientSyncer, SIGNAL(syncFinished()), this, SLOT(syncFinished()));
+
+ connect(ui.user, SIGNAL(textChanged(const QString &)), this, SLOT(setLoginWidgetStates()));
+ connect(ui.password, SIGNAL(textChanged(const QString &)), this, SLOT(setLoginWidgetStates()));
+
+ connect(ui.loginButtonBox, SIGNAL(rejected()), this, SLOT(restartPhaseNull()));
+ connect(ui.syncButtonBox->button(QDialogButtonBox::Abort), SIGNAL(clicked()), this, SLOT(restartPhaseNull()));
+
+ if(autoconnect && ui.accountList->count() && autoConnectAccount.isValid()
+ && autoConnectAccount == ui.accountList->currentItem()->data(Qt::UserRole).value<AccountId>()) {
+ doingAutoConnect = true;
+ on_accountButtonBox_accepted();