~ubuntu-branches/ubuntu/lucid/knetworkmanager/lucid

« back to all changes in this revision

Viewing changes to knetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-09-26 12:40:26 UTC
  • mfrom: (1.2.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080926124026-t5fr920l4lf2l6hz
Tags: 1:0.7svn864988-0ubuntu1
New upstream snapshot, now works with current NM API, 
closes LP: #259278

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *
3
 
 * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
4
 
 *
5
 
 * Copyright (C) 2005, 2006 Novell, Inc.
6
 
 *
7
 
 * Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
8
 
 *
9
 
 * This program is free software; you can redistribute it and/or modify
10
 
 * it under the terms of the GNU General Public License as published by
11
 
 * the Free Software Foundation; either version 2 of the License, or
12
 
 * (at your option) any later version.
13
 
 *
14
 
 * This program is distributed in the hope that it will be useful,
15
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
 * GNU General Public License for more details.
18
 
 * 
19
 
 * You should have received a copy of the GNU General Public License
20
 
 * along with this program; if not, write to the Free Software
21
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
 
 *
23
 
 **************************************************************************/
24
 
 
25
 
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H
26
 
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H
27
 
 
28
 
/* qt autogenerated headers */
29
 
#include "connection_setting_wireless_security.h"
30
 
#include "connection_setting_wireless_security_eap.h"
31
 
#include "connection_setting_wireless_security_phase2.h"
32
 
#include "connection_setting_wireless_security_wep.h"
33
 
#include "connection_setting_wireless_security_wpaversion.h"
34
 
#include "connection_setting_wireless_security_wpacipher.h"
35
 
#include "connection_setting_wireless_security_wpapsk.h"
36
 
#include "connection_setting_wireless_security_wepencryption.h"
37
 
 
38
 
/* knetworkmanager headers */
39
 
#include "knetworkmanager-connection_setting.h"
40
 
#include "knetworkmanager-connection_setting_8021x.h"
41
 
#include "knetworkmanager-connection_setting_widget_interface.h"
42
 
 
43
 
namespace ConnectionSettings
44
 
{
45
 
        /* class declarations */
46
 
        class WirelessSecurity;
47
 
        class Wireless;
48
 
        class IEEE8021x;
49
 
        class WirelessSecurityPhase2Impl;
50
 
 
51
 
        class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP
52
 
        {
53
 
                Q_OBJECT
54
 
                public:
55
 
                        enum WEPKEY_TYPE
56
 
                        {
57
 
                          WEPKEY_TYPE_ASCII = 0
58
 
                        , WEPKEY_TYPE_HEX
59
 
                        , WEPKEY_TYPE_PASSPHRASE
60
 
                        };
61
 
 
62
 
                        WirelessSecurityWEPImpl(WirelessSecurity* security, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
63
 
                        QCString getHashedWEPKey(QString key, WEPKEY_TYPE type) const;
64
 
                        QCString getWEP128PassphraseHash(QCString input) const;
65
 
                        QCString String2Hex(QByteArray bytes, int final_len) const;
66
 
 
67
 
                public slots:
68
 
                        void slotAuthAlgChanged(int);
69
 
                        void slotKeyTypeChanged(int);
70
 
                        void slotWepKey0Changed(const QString&);
71
 
                        void slotWepKey1Changed(const QString&);
72
 
                        void slotWepKey2Changed(const QString&);
73
 
                        void slotWepKey3Changed(const QString&);
74
 
                        void slotWepIdx0Checked(bool);
75
 
                        void slotWepIdx1Checked(bool);
76
 
                        void slotWepIdx2Checked(bool);
77
 
                        void slotWepIdx3Checked(bool);
78
 
                private:
79
 
                        WirelessSecurity* _security_setting;
80
 
                        WEPKEY_TYPE _wepKeyType;
81
 
        };
82
 
 
83
 
        class WirelessSecurityWEPEncryptionImpl : public ConnectionSettingWirelessSecurityWEPEncryption
84
 
        {
85
 
                Q_OBJECT
86
 
                public:
87
 
                        WirelessSecurityWEPEncryptionImpl(WirelessSecurity* security_setting, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
88
 
                private:
89
 
                        WirelessSecurity* _security_setting;
90
 
        };
91
 
 
92
 
        class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion
93
 
        {
94
 
                Q_OBJECT
95
 
                public:
96
 
                        WirelessSecurityWPAVersionImpl(WirelessSecurity* security_setting, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
97
 
 
98
 
                public slots:
99
 
                        void slotAuto(bool);
100
 
                        void slotWPA1(bool);
101
 
                        void slotWPA2(bool);
102
 
 
103
 
                private:
104
 
                        WirelessSecurity* _security_setting;
105
 
 
106
 
        };
107
 
 
108
 
        class WirelessSecurityWPACipherImpl : public ConnectionSettingWirelessSecurityWPACipher
109
 
        {
110
 
                Q_OBJECT
111
 
                private:
112
 
                        enum WPA_CIPHERS
113
 
                        {
114
 
                                WPA_CIPHER_AUTO = 0
115
 
                        , WPA_CIPHER_TKIP
116
 
                        , WPA_CIPHER_CCMP
117
 
                        , WPA_CIPHER_LAST
118
 
                        };
119
 
                public:
120
 
                        WirelessSecurityWPACipherImpl(WirelessSecurity* security_setting, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
121
 
 
122
 
                public slots:
123
 
                        void slotCipherChangedAuto(bool);
124
 
                        void slotGroupCipherChangedTKIP(bool);
125
 
                        void slotGroupCipherChangedCCMP(bool);
126
 
                        void slotGroupCipherChangedWEP40(bool);
127
 
                        void slotGroupCipherChangedWEP104(bool);
128
 
                        void slotPairwiseCipherChangedTKIP(bool);
129
 
                        void slotPairwiseCipherChangedCCMP(bool);
130
 
 
131
 
                private:
132
 
                        WirelessSecurity* _security_setting;
133
 
        };
134
 
 
135
 
        class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK
136
 
        {
137
 
                Q_OBJECT
138
 
                public:
139
 
                        WirelessSecurityWPAPSKImpl(WirelessSecurity* security_setting, Wireless* wireless_setting, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
140
 
                        QCString String2Hex(QByteArray bytes, int final_len) const;
141
 
 
142
 
                public slots:
143
 
                        void slotPSKChanged(const QString&);
144
 
 
145
 
                private:
146
 
                        WirelessSecurity* _security_setting;
147
 
                        Wireless*         _wireless_setting;
148
 
        };
149
 
 
150
 
        class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP
151
 
        {
152
 
                Q_OBJECT
153
 
                public:
154
 
                        WirelessSecurityEAPImpl(IEEE8021x* security_setting, WirelessSecurityPhase2Impl* phase2_widget, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
155
 
 
156
 
                public slots:
157
 
                        void slotMethodChanged(int index);
158
 
                        void slotIdentityChanged(const QString&);
159
 
                        void slotAnonIdentityChanged(const QString&);
160
 
                        void slotPasswordChanged(const QString&);
161
 
 
162
 
                private:
163
 
                        IEEE8021x* _security_setting;
164
 
                        QBiDirectionalMap<int, IEEE8021x::EAP_PHASE1> _eapIndexMap;
165
 
                        WirelessSecurityPhase2Impl* _phase2_widget;
166
 
        };
167
 
 
168
 
        class WirelessSecurityPhase2Impl : public ConnectionSettingWirelessSecurityPhase2
169
 
        {
170
 
                Q_OBJECT
171
 
                public:
172
 
                        WirelessSecurityPhase2Impl(IEEE8021x* security_setting, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
173
 
                public slots:
174
 
                        void setAllowedPhase2Methods(const QValueList<IEEE8021x::EAP_PHASE2>&);
175
 
                        void slotPhase2MethodChanged(int index);
176
 
                private:
177
 
                        void updateMethodComboBox();
178
 
 
179
 
                        IEEE8021x* _security_setting;
180
 
                        QBiDirectionalMap<int, IEEE8021x::EAP_PHASE2> _eapIndexMap;
181
 
                        QValueList<IEEE8021x::EAP_PHASE2> _allowed_methods;
182
 
        };
183
 
 
184
 
        class WirelessSecurityWidgetImpl : public WidgetInterface
185
 
        {
186
 
                Q_OBJECT
187
 
                private:
188
 
                        enum SecurityMethods
189
 
                        {
190
 
                                SECURITY_WEP = 0
191
 
                        , SECURITY_WPA_PSK
192
 
                        , SECURITY_WPA_EAP
193
 
                        , SECURITY_IEEE8021X
194
 
                        , SECURITY_COUNT
195
 
                        };
196
 
 
197
 
                public:
198
 
                        WirelessSecurityWidgetImpl(Connection*, bool new_conn, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
199
 
                        void Activate();
200
 
 
201
 
                public slots:
202
 
                        void slotComboSecurityActivated(int);
203
 
                        void slotUseEncryptionToggled(bool);
204
 
                        void slotExtraSettingsToggled(bool);
205
 
 
206
 
                private slots:
207
 
                        void slotInit();
208
 
 
209
 
                private:
210
 
                        void comboSecurityInit();
211
 
                        void configureWidgets(SecurityMethods);
212
 
                        void configureForWEP();
213
 
                        void configureForWPAPSK();
214
 
                        void configureForWPAEAP();
215
 
                        void configureForIEEE8021X();
216
 
 
217
 
                        SecurityMethods      _currentMethod;
218
 
                        QValueList<QWidget*> _widgets[SECURITY_COUNT];
219
 
                        QValueList<QWidget*> _extra_widgets[SECURITY_COUNT];
220
 
                        WirelessSecurity*    _security_setting;
221
 
                        Wireless*            _wireless_setting;
222
 
                        IEEE8021x*           _ieee8021x_setting;
223
 
                        ConnectionSettingWirelessSecurityWidget* _mainWid;
224
 
                        bool _new_conn;
225
 
                        QMap<int, SecurityMethods> _securityComboMap;
226
 
        };
227
 
}
228
 
 
229
 
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H*/