Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
identitiessettingspage.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2015 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) version 3. *
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  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 
36 {
37  Q_OBJECT
38 
39 public:
40  IdentitiesSettingsPage(QWidget *parent = 0);
41 
42  virtual inline bool needsCoreConnection() const { return true; }
43 
44  bool aboutToSave();
45 
46 public slots:
47  void save();
48  void load();
49 
50 private slots:
51  void coreConnectionStateChanged(bool);
53  void clientIdentityUpdated();
55 
57 
61 
62 #ifdef HAVE_SSL
63  void continueUnsecured();
64 #endif
65  void widgetHasChanged();
66  void setWidgetStates();
67 
68 private:
69  Ui::IdentitiesSettingsPage ui;
70 
71  QHash<IdentityId, CertIdentity *> identities;
73 
74  QList<IdentityId> changedIdentities; // for setting the widget changed state
75  QList<IdentityId> deletedIdentities;
76 
77  bool _editSsl;
78 
79  void insertIdentity(CertIdentity *identity);
80  void removeIdentity(Identity *identity);
81  void renameIdentity(IdentityId id, const QString &newName);
82 
83 #ifdef HAVE_SSL
84  QSslKey keyByFilename(const QString &filename);
85  void showKeyState(const QSslKey &key);
86  QSslCertificate certByFilename(const QString &filename);
87  void showCertState(const QSslCertificate &cert);
88 #endif
89 
90  bool testHasChanged();
91 };
92 
93 
94 // ==============================
95 // Various Dialogs
96 // ==============================
97 class CreateIdentityDlg : public QDialog
98 {
99  Q_OBJECT
100 
101 public:
102  CreateIdentityDlg(QAbstractItemModel *model, QWidget *parent = 0);
103 
104  QString identityName() const;
105  IdentityId duplicateId() const;
106 
107 private slots:
108  void on_identityName_textChanged(const QString &text);
109 
110 private:
111  Ui::CreateIdentityDlg ui;
112 };
113 
114 
115 class SaveIdentitiesDlg : public QDialog
116 {
117  Q_OBJECT
118 
119 public:
120  SaveIdentitiesDlg(const QList<CertIdentity *> &toCreate, const QList<CertIdentity *> &toUpdate, const QList<IdentityId> &toRemove, QWidget *parent = 0);
121 
122 private slots:
123  void clientEvent();
124 
125 private:
126  Ui::SaveIdentitiesDlg ui;
127 
129 };
130 
131 
132 #endif