/*************************************************************************** * * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * * Author: Helmut Schaa , * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************/ #ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H /* qt autogenerated headers */ #include "connection_setting_wireless_security.h" #include "connection_setting_wireless_security_eap.h" #include "connection_setting_wireless_security_phase2.h" #include "connection_setting_wireless_security_wep.h" #include "connection_setting_wireless_security_wpaversion.h" #include "connection_setting_wireless_security_wpacipher.h" #include "connection_setting_wireless_security_wpapsk.h" #include "connection_setting_wireless_security_wepencryption.h" /* knetworkmanager headers */ #include "knetworkmanager-connection_setting.h" #include "knetworkmanager-connection_setting_8021x.h" #include "knetworkmanager-connection_setting_widget_interface.h" namespace ConnectionSettings { /* class declarations */ class WirelessSecurity; class Wireless; class IEEE8021x; class WirelessSecurityPhase2Impl; class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP { Q_OBJECT public: enum WEPKEY_TYPE { WEPKEY_TYPE_ASCII = 0 , WEPKEY_TYPE_HEX , WEPKEY_TYPE_PASSPHRASE }; WirelessSecurityWEPImpl(WirelessSecurity* security, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); TQCString getHashedWEPKey(TQString key, WEPKEY_TYPE type) const; TQCString getWEP128PassphraseHash(TQCString input) const; TQCString String2Hex(TQByteArray bytes, int final_len) const; public slots: void slotAuthAlgChanged(int); void slotKeyTypeChanged(int); void slotWepKey0Changed(const TQString&); void slotWepKey1Changed(const TQString&); void slotWepKey2Changed(const TQString&); void slotWepKey3Changed(const TQString&); void slotWepIdx0Checked(bool); void slotWepIdx1Checked(bool); void slotWepIdx2Checked(bool); void slotWepIdx3Checked(bool); private: WirelessSecurity* _security_setting; WEPKEY_TYPE _wepKeyType; }; class WirelessSecurityWEPEncryptionImpl : public ConnectionSettingWirelessSecurityWEPEncryption { Q_OBJECT public: WirelessSecurityWEPEncryptionImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); private: WirelessSecurity* _security_setting; }; class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion { Q_OBJECT public: WirelessSecurityWPAVersionImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); public slots: void slotAuto(bool); void slotWPA1(bool); void slotWPA2(bool); private: WirelessSecurity* _security_setting; }; class WirelessSecurityWPACipherImpl : public ConnectionSettingWirelessSecurityWPACipher { Q_OBJECT private: enum WPA_CIPHERS { WPA_CIPHER_AUTO = 0 , WPA_CIPHER_TKIP , WPA_CIPHER_CCMP , WPA_CIPHER_LAST }; public: WirelessSecurityWPACipherImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); public slots: void slotCipherChangedAuto(bool); void slotGroupCipherChangedTKIP(bool); void slotGroupCipherChangedCCMP(bool); void slotGroupCipherChangedWEP40(bool); void slotGroupCipherChangedWEP104(bool); void slotPairwiseCipherChangedTKIP(bool); void slotPairwiseCipherChangedCCMP(bool); private: WirelessSecurity* _security_setting; }; class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK { Q_OBJECT public: WirelessSecurityWPAPSKImpl(WirelessSecurity* security_setting, Wireless* wireless_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); TQCString String2Hex(TQByteArray bytes, int final_len) const; public slots: void slotPSKChanged(const TQString&); private: WirelessSecurity* _security_setting; Wireless* _wireless_setting; }; class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP { Q_OBJECT public: WirelessSecurityEAPImpl(IEEE8021x* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); public slots: void slotMethodChanged(int index); void slotIdentityChanged(const TQString&); void slotAnonIdentityChanged(const TQString&); void slotPasswordChanged(const TQString&); void slotUseSystemCaCertChanged(bool on); private: IEEE8021x* _security_setting; TQBiDirectionalMap _eapIndexMap; WirelessSecurityPhase2Impl* _phase2_widget; }; class WirelessSecurityPhase2Impl : public ConnectionSettingWirelessSecurityPhase2 { Q_OBJECT public: WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); public slots: void setAllowedPhase2Methods(const TQValueList&); void slotPhase2MethodChanged(int index); private: void updateMethodComboBox(); IEEE8021x* _security_setting; TQBiDirectionalMap _eapIndexMap; TQValueList _allowed_methods; }; class WirelessSecurityWidgetImpl : public WidgetInterface { Q_OBJECT private: enum SecurityMethods { SECURITY_WEP = 0 , SECURITY_WPA_PSK , SECURITY_WPA_EAP , SECURITY_IEEE8021X , SECURITY_COUNT }; public: WirelessSecurityWidgetImpl(Connection*, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); void Activate(); public slots: void slotComboSecurityActivated(int); void slotUseEncryptionToggled(bool); void slotExtraSettingsToggled(bool); private slots: void slotInit(); private: void comboSecurityInit(); void configureWidgets(SecurityMethods); void configureForWEP(); void configureForWPAPSK(); void configureForWPAEAP(); void configureForIEEE8021X(); SecurityMethods _currentMethod; TQValueList _widgets[SECURITY_COUNT]; TQValueList _extra_widgets[SECURITY_COUNT]; WirelessSecurity* _security_setting; Wireless* _wireless_setting; IEEE8021x* _ieee8021x_setting; ConnectionSettingWirelessSecurityWidget* _mainWid; bool _new_conn; TQMap _securityComboMap; }; } #endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H*/