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) any later version. *
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 IDENTITIESSETTINGSPAGE_H
22 #define IDENTITIESSETTINGSPAGE_H
24 #include "clientidentity.h"
25 #include "settingspage.h"
27 #include "ui_identitiessettingspage.h"
28 #include "ui_createidentitydlg.h"
29 #include "ui_saveidentitiesdlg.h"
30 #include "ui_nickeditdlg.h"
33 #include <QSslCertificate>
37 class QAbstractItemModel;
39 class IdentitiesSettingsPage : public SettingsPage {
43 IdentitiesSettingsPage(QWidget *parent = 0);
53 virtual bool eventFilter(QObject *watched, QEvent *event);
57 void coreConnectionStateChanged(bool);
58 void clientIdentityCreated(IdentityId);
59 void clientIdentityUpdated();
60 void clientIdentityRemoved(IdentityId);
62 void on_identityList_currentIndexChanged(int index);
64 void on_addIdentity_clicked();
65 void on_deleteIdentity_clicked();
66 void on_renameIdentity_clicked();
68 void on_addNick_clicked();
69 void on_deleteNick_clicked();
70 void on_renameNick_clicked();
71 void on_nickUp_clicked();
72 void on_nickDown_clicked();
75 void on_continueUnsecured_clicked();
76 void on_clearOrLoadKeyButton_clicked();
77 void on_clearOrLoadCertButton_clicked();
79 void widgetHasChanged();
80 void setWidgetStates();
83 void sslDragEnterEvent(QDragEnterEvent *event);
84 void sslDropEvent(QDropEvent *event, bool isCert);
88 Ui::IdentitiesSettingsPage ui;
90 QHash<IdentityId, CertIdentity *> identities;
93 QList<IdentityId> changedIdentities; // for setting the widget changed state
94 QList<IdentityId> deletedIdentities;
98 void insertIdentity(CertIdentity *identity);
99 void removeIdentity(Identity *identity);
100 void renameIdentity(IdentityId id, const QString &newName);
101 void displayIdentity(CertIdentity *, bool dontsave = false);
102 void saveToIdentity(CertIdentity *);
105 QSslKey keyByFilename(const QString &filename);
106 void showKeyState(const QSslKey &key);
107 QSslCertificate certByFilename(const QString &filename);
108 void showCertState(const QSslCertificate &cert);
111 bool testHasChanged();
114 class CreateIdentityDlg : public QDialog {
118 CreateIdentityDlg(QAbstractItemModel *model, QWidget *parent = 0);
120 QString identityName() const;
121 IdentityId duplicateId() const;
124 void on_identityName_textChanged(const QString &text);
127 Ui::CreateIdentityDlg ui;
130 class SaveIdentitiesDlg : public QDialog {
134 SaveIdentitiesDlg(const QList<CertIdentity *> &toCreate, const QList<CertIdentity *> &toUpdate, const QList<IdentityId> &toRemove, QWidget *parent = 0);
140 Ui::SaveIdentitiesDlg ui;
142 int numevents, rcvevents;
145 class NickEditDlg : public QDialog {
149 NickEditDlg(const QString &oldnick, const QStringList &existing = QStringList(), QWidget *parent = 0);
151 QString nick() const;
154 void on_nickEdit_textChanged(const QString &);
160 QStringList existing;