1 /***************************************************************************
2 * Copyright (C) 2005-09 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef CORECONNECTDLG_H
22 #define CORECONNECTDLG_H
24 #include <QAbstractSocket>
28 #include "ui_coreconnectdlg.h"
29 #include "ui_coreaccounteditdlg.h"
32 class CoreConfigWizard;
34 class CoreConnectDlg : public QDialog {
38 CoreConnectDlg(bool = false, QWidget *parent = 0);
42 // void newClientSyncer(ClientSyncer *);
45 /*** Phase Null: Accounts ***/
46 void restartPhaseNull();
48 void on_accountList_itemSelectionChanged();
49 void on_autoConnect_clicked(bool);
51 void on_addAccount_clicked();
52 void on_editAccount_clicked();
53 void on_deleteAccount_clicked();
54 void on_useInternalCore_clicked();
55 void on_viewSslCertButton_clicked();
56 void on_ignoreWarningsButton_clicked();
58 void on_accountList_itemDoubleClicked(QListWidgetItem *item);
59 void on_accountButtonBox_accepted();
61 void setAccountWidgetStates();
63 /*** Phase One: Connection ***/
66 void initPhaseError(const QString &error);
67 void initPhaseWarnings(const QStringList &warnings);
68 void initPhaseMsg(const QString &msg);
69 void initPhaseSocketState(QAbstractSocket::SocketState);
71 /*** Phase Two: Login ***/
74 void doLogin(const QVariantMap &loginData);
75 void loginFailed(const QString &);
76 void startCoreConfig(const QVariantList &backends);
77 void configWizardAccepted();
78 void configWizardRejected();
79 void on_launchCoreConfigWizard_clicked();
81 void setLoginWidgetStates();
83 /*** Phase Three: Sync ***/
87 void coreSessionProgress(quint32, quint32);
88 void coreNetworksProgress(quint32, quint32);
91 AccountId findFreeAccountId();
93 Ui::CoreConnectDlg ui;
95 AccountId autoConnectAccount;
96 QHash<AccountId, QVariantMap> accounts;
97 AccountId _internalAccountId;
98 QVariantMap accountData;
101 bool doingAutoConnect;
103 QVariantList storageBackends;
105 ClientSyncer *clientSyncer;
106 CoreConfigWizard *wizard;
110 // ========================================
111 // CoreAccountEditDlg
112 // ========================================
113 class CoreAccountEditDlg : public QDialog {
117 CoreAccountEditDlg(AccountId id, const QVariantMap &data, const QStringList &existing = QStringList(), QWidget *parent = 0);
119 QVariantMap accountData();
122 void on_host_textChanged(const QString &);
123 void on_accountName_textChanged(const QString &);
125 void setWidgetStates();
128 Ui::CoreAccountEditDlg ui;
130 QStringList existing;
134 // ========================================
135 // SslCertDisplayDialog
136 // ========================================
138 class QSslCertificate;
140 class SslCertDisplayDialog : public QDialog {
144 SslCertDisplayDialog(const QString &host, const QSslCertificate &cert, QWidget *parent = 0);
148 #endif // CORECONNECTDLG_H