Make fonts/sizes changeable again Fixes #664
[quassel.git] / src / qtui / settingspages / identitiessettingspage.h
1 /***************************************************************************
2  *   Copyright (C) 2005-09 by the Quassel Project                          *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
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.                                   *
9  *                                                                         *
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.                          *
14  *                                                                         *
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  ***************************************************************************/
20
21 #ifndef IDENTITIESSETTINGSPAGE_H
22 #define IDENTITIESSETTINGSPAGE_H
23
24 #include "clientidentity.h"
25 #include "settingspage.h"
26
27 #include "identityeditwidget.h"
28
29 #include "ui_identitiessettingspage.h"
30 #include "ui_createidentitydlg.h"
31 #include "ui_saveidentitiesdlg.h"
32
33 class QAbstractItemModel;
34
35 class IdentitiesSettingsPage : public SettingsPage {
36   Q_OBJECT
37
38 public:
39   IdentitiesSettingsPage(QWidget *parent = 0);
40
41   bool aboutToSave();
42
43 public slots:
44   void save();
45   void load();
46
47 private slots:
48   void coreConnectionStateChanged(bool);
49   void clientIdentityCreated(IdentityId);
50   void clientIdentityUpdated();
51   void clientIdentityRemoved(IdentityId);
52
53   void on_identityList_currentIndexChanged(int index);
54
55   void on_addIdentity_clicked();
56   void on_deleteIdentity_clicked();
57   void on_renameIdentity_clicked();
58
59 #ifdef HAVE_SSL
60   void continueUnsecured();
61 #endif
62   void widgetHasChanged();
63   void setWidgetStates();
64
65 private:
66   Ui::IdentitiesSettingsPage ui;
67
68   QHash<IdentityId, CertIdentity *> identities;
69   IdentityId currentId;
70
71   QList<IdentityId> changedIdentities;  // for setting the widget changed state
72   QList<IdentityId> deletedIdentities;
73
74   bool _editSsl;
75
76   void insertIdentity(CertIdentity *identity);
77   void removeIdentity(Identity *identity);
78   void renameIdentity(IdentityId id, const QString &newName);
79
80 #ifdef HAVE_SSL
81   QSslKey keyByFilename(const QString &filename);
82   void showKeyState(const QSslKey &key);
83   QSslCertificate certByFilename(const QString &filename);
84   void showCertState(const QSslCertificate &cert);
85 #endif
86
87   bool testHasChanged();
88 };
89
90 // ==============================
91 //  Various Dialogs
92 // ==============================
93 class CreateIdentityDlg : public QDialog {
94   Q_OBJECT
95
96 public:
97   CreateIdentityDlg(QAbstractItemModel *model, QWidget *parent = 0);
98
99   QString identityName() const;
100   IdentityId duplicateId() const;
101
102 private slots:
103   void on_identityName_textChanged(const QString &text);
104
105 private:
106   Ui::CreateIdentityDlg ui;
107 };
108
109
110
111 class SaveIdentitiesDlg : public QDialog {
112   Q_OBJECT
113
114 public:
115   SaveIdentitiesDlg(const QList<CertIdentity *> &toCreate, const QList<CertIdentity *> &toUpdate, const QList<IdentityId> &toRemove, QWidget *parent = 0);
116
117 private slots:
118   void clientEvent();
119
120 private:
121   Ui::SaveIdentitiesDlg ui;
122
123   int numevents, rcvevents;
124 };
125
126
127
128 #endif