summaryrefslogtreecommitdiffstats
path: root/wifi/kcmwifi
diff options
context:
space:
mode:
Diffstat (limited to 'wifi/kcmwifi')
-rw-r--r--wifi/kcmwifi/Makefile.am19
-rw-r--r--wifi/kcmwifi/configadvanced.ui145
-rw-r--r--wifi/kcmwifi/configcrypto.ui365
-rw-r--r--wifi/kcmwifi/configcrypto.ui.h157
-rw-r--r--wifi/kcmwifi/configpower.ui158
-rw-r--r--wifi/kcmwifi/configpower.ui.h22
-rw-r--r--wifi/kcmwifi/ifconfigpage.cpp173
-rw-r--r--wifi/kcmwifi/ifconfigpage.h51
-rw-r--r--wifi/kcmwifi/ifconfigpagebase.ui500
-rw-r--r--wifi/kcmwifi/indent-options1
-rw-r--r--wifi/kcmwifi/kcmwifi.cpp382
-rw-r--r--wifi/kcmwifi/kcmwifi.desktop162
-rw-r--r--wifi/kcmwifi/kcmwifi.h62
-rw-r--r--wifi/kcmwifi/mainconfig.cpp108
-rw-r--r--wifi/kcmwifi/mainconfig.h51
-rw-r--r--wifi/kcmwifi/mainconfigbase.ui166
-rw-r--r--wifi/kcmwifi/vendorconfig.cpp271
-rw-r--r--wifi/kcmwifi/vendorconfig.h36
-rw-r--r--wifi/kcmwifi/wificonfig.cpp369
-rw-r--r--wifi/kcmwifi/wificonfig.h126
20 files changed, 3324 insertions, 0 deletions
diff --git a/wifi/kcmwifi/Makefile.am b/wifi/kcmwifi/Makefile.am
new file mode 100644
index 00000000..50a3bc62
--- /dev/null
+++ b/wifi/kcmwifi/Makefile.am
@@ -0,0 +1,19 @@
+## Makefile.am for kcmwifi
+
+INCLUDES= $(all_includes)
+
+kde_module_LTLIBRARIES = kcm_wifi.la
+kcm_wifi_la_SOURCES = wificonfig.cpp kcmwifi.cpp configcrypto.ui \
+ ifconfigpagebase.ui configpower.ui mainconfigbase.ui \
+ mainconfig.cpp ifconfigpage.cpp vendorconfig.cpp
+kcm_wifi_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined
+kcm_wifi_la_LIBADD = $(LIB_KIO)
+
+METASOURCES = AUTO
+
+noinst_HEADERS =
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kcmwifi.pot
+
+xdg_apps_DATA = kcmwifi.desktop
diff --git a/wifi/kcmwifi/configadvanced.ui b/wifi/kcmwifi/configadvanced.ui
new file mode 100644
index 00000000..beeda9fe
--- /dev/null
+++ b/wifi/kcmwifi/configadvanced.ui
@@ -0,0 +1,145 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>Form1</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>cmb_channel</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>23</y>
+ <width>99</width>
+ <height>24</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>lbl_channel</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>33</y>
+ <width>70</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Channel:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>lbl_txPower</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>6</x>
+ <y>60</y>
+ <width>107</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Transmit power:</string>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>cmb_txPower</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>121</x>
+ <y>58</y>
+ <width>99</width>
+ <height>24</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>cb_forceAP</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>91</y>
+ <width>268</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Force registration to an access point</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>120</y>
+ <width>40</width>
+ <height>20</height>
+ </rect>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>lbl_apMAC</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>64</x>
+ <y>124</y>
+ <width>89</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>MAC address:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>kLineEdit1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>193</x>
+ <y>128</y>
+ <width>140</width>
+ <height>24</height>
+ </rect>
+ </property>
+ </widget>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/wifi/kcmwifi/configcrypto.ui b/wifi/kcmwifi/configcrypto.ui
new file mode 100644
index 00000000..7ef18da2
--- /dev/null
+++ b/wifi/kcmwifi/configcrypto.ui
@@ -0,0 +1,365 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConfigCrypto</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ConfigCrypto</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>360</width>
+ <height>236</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>gb_keys</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Crypto Keys</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lb_key1</cstring>
+ </property>
+ <property name="text">
+ <string>Key 1:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The first encryption key. 5 or 13 characters are ASCII keys, 10 or 26 characters are hexadecimal keys.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>lb_key3</cstring>
+ </property>
+ <property name="text">
+ <string>Key 3:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The third encryption key. 5 or 13 characters are ASCII keys, 10 or 26 characters are hexadecimal keys.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lb_key2</cstring>
+ </property>
+ <property name="text">
+ <string>Key 2:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The second encryption key. 5 or 13 characters are ASCII keys, 10 or 26 characters are hexadecimal keys.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>lb_key4</cstring>
+ </property>
+ <property name="text">
+ <string>Key 4:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The fourth encryption key. 5 or 13 characters are ASCII keys, 10 or 26 characters are hexadecimal keys.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>format_1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;font color="#ff0000"&gt;unrecognized&lt;/font&gt;</string>
+ </property>
+ <property name="textFormat">
+ <enum>RichText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>format_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;font color="#ff0000"&gt;unrecognised&lt;/font&gt;</string>
+ </property>
+ <property name="textFormat">
+ <enum>RichText</enum>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>le_key1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>le_key2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>format_3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;font color="#ff0000"&gt;unrecognised&lt;/font&gt;</string>
+ </property>
+ <property name="textFormat">
+ <enum>RichText</enum>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>le_key3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="2">
+ <property name="name">
+ <cstring>format_4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;font color="#ff0000"&gt;unrecognised&lt;/font&gt;</string>
+ </property>
+ <property name="textFormat">
+ <enum>RichText</enum>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>le_key4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>bg_cryptoMode</cstring>
+ </property>
+ <property name="title">
+ <string>Crypto Mode</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Sets which types of packets the card will accept.</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>rb_openMode</cstring>
+ </property>
+ <property name="text">
+ <string>Ope&amp;n</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Makes the card accept encrypted and unencrypted packets.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>rb_restrictMode</cstring>
+ </property>
+ <property name="text">
+ <string>Restricted</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Makes the card only accept encrypted packets.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>80</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lb_useKey</cstring>
+ </property>
+ <property name="text">
+ <string>Key to use:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Sets which of the four keys is to be used for transmitting packets.</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+ <string>Key 1</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Key 2</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Key 3</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Key 4</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cmb_activeKey</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>le_key1</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>ConfigCrypto</receiver>
+ <slot>slotUpdateKey1Status(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>le_key2</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>ConfigCrypto</receiver>
+ <slot>slotUpdateKey2Status(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>le_key3</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>ConfigCrypto</receiver>
+ <slot>slotUpdateKey3Status(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>le_key4</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>ConfigCrypto</receiver>
+ <slot>slotUpdateKey4Status(const QString&amp;)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>cmb_activeKey</tabstop>
+ <tabstop>rb_openMode</tabstop>
+ <tabstop>rb_restrictMode</tabstop>
+ <tabstop>le_key1</tabstop>
+ <tabstop>le_key2</tabstop>
+ <tabstop>le_key3</tabstop>
+ <tabstop>le_key4</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in declaration">wificonfig.h</include>
+ <include location="local" impldecl="in implementation">configcrypto.ui.h</include>
+</includes>
+<slots>
+ <slot>slotUpdateKey1Status( const QString &amp; key )</slot>
+ <slot>slotUpdateKey2Status( const QString &amp; key )</slot>
+ <slot>slotUpdateKey3Status( const QString &amp; key )</slot>
+ <slot>slotUpdateKey4Status( const QString &amp; key )</slot>
+</slots>
+<functions>
+ <function specifier="non virtual">load( const IfConfig &amp; ifconfig )</function>
+ <function specifier="non virtual">save( IfConfig &amp; ifconfig )</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/wifi/kcmwifi/configcrypto.ui.h b/wifi/kcmwifi/configcrypto.ui.h
new file mode 100644
index 00000000..6ada4aa4
--- /dev/null
+++ b/wifi/kcmwifi/configcrypto.ui.h
@@ -0,0 +1,157 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+#include <kdebug.h>
+#include "wificonfig.h"
+
+void ConfigCrypto::load( const IfConfig &ifconfig)
+{
+ cmb_activeKey->setCurrentItem( ifconfig.m_activeKey-1 );
+ bg_cryptoMode->setButton( ifconfig.m_cryptoMode );
+
+ le_key1->setText( ifconfig.m_keys[0].key() );
+ le_key2->setText( ifconfig.m_keys[1].key() );
+ le_key3->setText( ifconfig.m_keys[2].key() );
+ le_key4->setText( ifconfig.m_keys[3].key() );
+}
+
+void ConfigCrypto::save( IfConfig &ifconfig )
+{
+ ifconfig.m_activeKey = cmb_activeKey->currentItem()+1;
+ ifconfig.m_cryptoMode = (IfConfig::CryptoMode)bg_cryptoMode->selectedId();
+
+ ifconfig.m_keys[0].setKey( le_key1->text() );
+ ifconfig.m_keys[1].setKey( le_key2->text() );
+ ifconfig.m_keys[2].setKey( le_key3->text() );
+ ifconfig.m_keys[3].setKey( le_key4->text() );
+}
+
+
+void ConfigCrypto::slotUpdateKey1Status(const QString& key)
+{
+ KeyStates status = ::Key::isValid( key );
+ switch (status) {
+ case INVALID:
+ format_1->setText("<font color=\"#ff0000\">unrecognised</font>");
+ break;
+ case EMPTY:
+ format_1->setText("<font color=\"#000000\">slot empty</font>");
+ break;
+ case HEX_64:
+ format_1->setText("<font color=\"#00b000\">WEP 64-Bit hex</font>");
+ break;
+ case HEX_128:
+ format_1->setText("<font color=\"#00b000\">WEP 128-Bit hex</font>");
+ break;
+ case HEX_256:
+ format_1->setText("<font color=\"#00b000\">WEP 256-Bit hex</font>");
+ break;
+ case STRING_64:
+ format_1->setText("<font color=\"#00b000\">WEP 64-Bit string</font>");
+ break;
+ case STRING_128:
+ format_1->setText("<font color=\"#00b000\">WEP 128-Bit string</font>");
+ break;
+ case STRING_256:
+ format_1->setText("<font color=\"#00b000\">WEP 256-Bit string</font>");
+ break;
+ }
+}
+
+void ConfigCrypto::slotUpdateKey2Status(const QString& key)
+{
+ KeyStates status = ::Key::isValid( key );
+ switch (status) {
+ case INVALID:
+ format_2->setText("<font color=\"#ff0000\">unrecognised</font>");
+ break;
+ case EMPTY:
+ format_2->setText("<font color=\"#000000\">slot empty</font>");
+ break;
+ case HEX_64:
+ format_2->setText("<font color=\"#00b000\">WEP 64-Bit hex</font>");
+ break;
+ case HEX_128:
+ format_2->setText("<font color=\"#00b000\">WEP 128-Bit hex</font>");
+ break;
+ case HEX_256:
+ format_2->setText("<font color=\"#00b000\">WEP 256-Bit hex</font>");
+ break;
+ case STRING_64:
+ format_2->setText("<font color=\"#00b000\">WEP 64-Bit string</font>");
+ break;
+ case STRING_128:
+ format_2->setText("<font color=\"#00b000\">WEP 128-Bit string</font>");
+ break;
+ case STRING_256:
+ format_2->setText("<font color=\"#00b000\">WEP 256-Bit string</font>");
+ break;
+ }
+}
+
+void ConfigCrypto::slotUpdateKey3Status(const QString& key)
+{
+ KeyStates status = ::Key::isValid( key );
+ switch (status) {
+ case INVALID:
+ format_3->setText("<font color=\"#ff0000\">unrecognised</font>");
+ break;
+ case EMPTY:
+ format_3->setText("<font color=\"#000000\">slot empty</font>");
+ break;
+ case HEX_64:
+ format_3->setText("<font color=\"#00b000\">WEP 64-Bit hex</font>");
+ break;
+ case HEX_128:
+ format_3->setText("<font color=\"#00b000\">WEP 128-Bit hex</font>");
+ break;
+ case HEX_256:
+ format_3->setText("<font color=\"#00b000\">WEP 256-Bit hex</font>");
+ break;
+ case STRING_64:
+ format_3->setText("<font color=\"#00b000\">WEP 64-Bit string</font>");
+ break;
+ case STRING_128:
+ format_3->setText("<font color=\"#00b000\">WEP 128-Bit string</font>");
+ break;
+ case STRING_256:
+ format_3->setText("<font color=\"#00b000\">WEP 256-Bit string</font>");
+ break;
+ }
+}
+
+void ConfigCrypto::slotUpdateKey4Status(const QString& key)
+{
+ KeyStates status = ::Key::isValid( key );
+ switch (status) {
+ case INVALID:
+ format_4->setText("<font color=\"#ff0000\">unrecognised</font>");
+ break;
+ case EMPTY:
+ format_4->setText("<font color=\"#000000\">slot empty</font>");
+ break;
+ case HEX_64:
+ format_4->setText("<font color=\"#00b000\">WEP 64-Bit hex</font>");
+ break;
+ case HEX_128:
+ format_4->setText("<font color=\"#00b000\">WEP 128-Bit hex</font>");
+ break;
+ case HEX_256:
+ format_4->setText("<font color=\"#00b000\">WEP 256-Bit hex</font>");
+ break;
+ case STRING_64:
+ format_4->setText("<font color=\"#00b000\">WEP 64-Bit string</font>");
+ break;
+ case STRING_128:
+ format_4->setText("<font color=\"#00b000\">WEP 128-Bit string</font>");
+ break;
+ case STRING_256:
+ format_4->setText("<font color=\"#00b000\">WEP 256-Bit string</font>");
+ break;
+ }
+}
diff --git a/wifi/kcmwifi/configpower.ui b/wifi/kcmwifi/configpower.ui
new file mode 100644
index 00000000..fa44c928
--- /dev/null
+++ b/wifi/kcmwifi/configpower.ui
@@ -0,0 +1,158 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConfigPower</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ConfigPower</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>318</width>
+ <height>186</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lb_sleepTimeout</cstring>
+ </property>
+ <property name="text">
+ <string>Sleep timeout:</string>
+ </property>
+ <property name="toolTip">
+ <string>Sets how long the card will be offline before looking for new packages again.</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput" row="0" column="1">
+ <property name="name">
+ <cstring>sb_sleepTimeout</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>60</number>
+ </property>
+ <property name="suffix">
+ <string> sec</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lb_wakeupPeriod</cstring>
+ </property>
+ <property name="text">
+ <string>Wakeup period:</string>
+ </property>
+ <property name="toolTip">
+ <string>Sets how long the card will be online and looking for new packages before it falls asleep.</string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>bg_packets</cstring>
+ </property>
+ <property name="title">
+ <string>Receive Packets</string>
+ </property>
+ <property name="toolTip">
+ <string>Sets which sort of packets to listen to.</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>bg_allPackets</cstring>
+ </property>
+ <property name="text">
+ <string>All</string>
+ </property>
+ <property name="toolTip">
+ <string>Listen to all packet types.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>rb_unicastOnly</cstring>
+ </property>
+ <property name="text">
+ <string>Unicast only</string>
+ </property>
+ <property name="toolTip">
+ <string>Listen to Unicast packets only.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>rb_multicastOnly</cstring>
+ </property>
+ <property name="text">
+ <string>Multicast/Broadcast only</string>
+ </property>
+ <property name="toolTip">
+ <string>Listen to Multicast and Broadcast packets only.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="KIntNumInput" row="1" column="1">
+ <property name="name">
+ <cstring>sb_wakeupPeriod</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>60</number>
+ </property>
+ <property name="suffix">
+ <string> sec</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<includes>
+ <include location="local" impldecl="in declaration">wificonfig.h</include>
+ <include location="local" impldecl="in implementation">configpower.ui.h</include>
+</includes>
+<slots>
+ <slot>load( const IfConfig &amp; ifconfig )</slot>
+ <slot>save( IfConfig &amp; ifconfig )</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/wifi/kcmwifi/configpower.ui.h b/wifi/kcmwifi/configpower.ui.h
new file mode 100644
index 00000000..feb0906f
--- /dev/null
+++ b/wifi/kcmwifi/configpower.ui.h
@@ -0,0 +1,22 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+void ConfigPower::load( const IfConfig &ifconfig)
+{
+ sb_sleepTimeout->setValue(ifconfig.m_sleepTimeout);
+ sb_wakeupPeriod->setValue(ifconfig.m_wakeupPeriod);
+ bg_packets->setButton(ifconfig.m_pmMode);
+}
+
+void ConfigPower::save( IfConfig &ifconfig)
+{
+ ifconfig.m_sleepTimeout = sb_sleepTimeout->value();
+ ifconfig.m_wakeupPeriod = sb_wakeupPeriod->value();
+ ifconfig.m_pmMode = (IfConfig::PowerMode)bg_packets->selectedId();
+}
diff --git a/wifi/kcmwifi/ifconfigpage.cpp b/wifi/kcmwifi/ifconfigpage.cpp
new file mode 100644
index 00000000..a7306255
--- /dev/null
+++ b/wifi/kcmwifi/ifconfigpage.cpp
@@ -0,0 +1,173 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <klineedit.h>
+#include <klocale.h>
+#include <kurlrequester.h>
+
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+
+#include "configcrypto.h"
+#include "configpower.h"
+#include "ifconfigpage.h"
+#include "wificonfig.h"
+
+#include <unistd.h>
+#include <sys/types.h>
+
+IfConfigPage::IfConfigPage( int configNum, QWidget *parent, const char *name )
+ : IfConfigPageBase( parent, name ),
+ m_configNum( configNum )
+{
+ connect( cb_pmEnabled, SIGNAL( toggled( bool ) ), SIGNAL( changed() ) );
+ connect( cb_useCrypto, SIGNAL( toggled( bool ) ), SIGNAL( changed() ) );
+ connect( le_networkName, SIGNAL( textChanged( const QString & ) ),
+ SIGNAL( changed() ) );
+ connect( cmb_wifiMode, SIGNAL( activated( int ) ), SIGNAL( changed() ) );
+ connect( cmb_speed, SIGNAL( activated( int ) ), SIGNAL( changed() ) );
+ connect( cb_runScript, SIGNAL( toggled( bool ) ), SIGNAL( changed() ) );
+ connect( url_connectScript, SIGNAL( textChanged( const QString & ) ),
+ SIGNAL( changed() ) );
+ connect( cb_Autodetect, SIGNAL( toggled( bool ) ), SIGNAL( changed() ) );
+ connect( le_interface, SIGNAL( textChanged( const QString & ) ),
+ SIGNAL( changed() ) );
+
+ connect( pb_setupPower, SIGNAL( clicked() ), SLOT( slotSetupPower() ) );
+ connect( pb_setupCrypto, SIGNAL( clicked() ), SLOT( slotSetupCrypto() ) );
+
+ connect( cb_useCrypto, SIGNAL( toggled( bool ) ),
+ pb_setupCrypto, SLOT( setEnabled( bool ) ) );
+ connect( cb_pmEnabled, SIGNAL( toggled( bool ) ),
+ pb_setupPower, SLOT( setEnabled( bool ) ) );
+ connect( cb_runScript, SIGNAL( toggled( bool ) ),
+ lb_connectScript, SLOT( setEnabled( bool ) ) );
+ connect( cb_runScript, SIGNAL( toggled( bool ) ),
+ lb_connectScript, SLOT( setEnabled( bool ) ) );
+ connect( cb_runScript, SIGNAL( toggled( bool ) ),
+ lb_connectScript, SLOT( setEnabled( bool ) ) );
+ connect( cb_Autodetect, SIGNAL( toggled( bool ) ),
+ le_interface, SLOT( setDisabled( bool ) ) );
+
+ connect( cb_Autodetect, SIGNAL( toggled( bool ) ),
+ this, SLOT ( slotResetInterface( bool ) ) );
+}
+
+void IfConfigPage::slotResetInterface( bool checked )
+{
+ if ( checked )
+ {
+ WifiConfig *config = WifiConfig::instance();
+ le_interface->setText( config->autoDetectInterface() );
+ }
+}
+
+void IfConfigPage::load()
+{
+ WifiConfig *config = WifiConfig::instance();
+ IfConfig ifConfig = config->m_ifConfig[ m_configNum ];
+
+ le_networkName->setText( ifConfig.m_networkName );
+ if ( ! ifConfig.m_interface.isEmpty() )
+ {
+ le_interface->setText( ifConfig.m_interface );
+ cb_Autodetect->setChecked( false );
+ }
+ else
+ {
+ if ( geteuid()==0 )
+ le_interface->setText( config->autoDetectInterface() );
+ cb_Autodetect->setChecked( true );
+ }
+
+ cmb_wifiMode->setCurrentItem( ifConfig.m_wifiMode );
+ cmb_speed->setCurrentItem( ifConfig.m_speed );
+ cb_runScript->setChecked( ifConfig.m_runScript );
+ url_connectScript->setURL( ifConfig.m_connectScript );
+ cb_useCrypto->setChecked( ifConfig.m_useCrypto );
+ cb_pmEnabled->setChecked( ifConfig.m_pmEnabled );
+
+ pb_setupCrypto->setEnabled( ifConfig.m_useCrypto );
+ pb_setupPower->setEnabled( ifConfig.m_pmEnabled );
+ lb_connectScript->setEnabled( ifConfig.m_runScript );
+ url_connectScript->setEnabled( ifConfig.m_runScript );
+}
+
+void IfConfigPage::save()
+{
+ WifiConfig *config = WifiConfig::instance();
+ IfConfig &ifconfig = config->m_ifConfig[ m_configNum ];
+
+ ifconfig.m_networkName = le_networkName->text();
+ ifconfig.m_interface = cb_Autodetect->isChecked()? QString::null :
+ le_interface->text();
+ ifconfig.m_wifiMode = ( IfConfig::WifiMode ) cmb_wifiMode->currentItem();
+ ifconfig.m_speed = ( IfConfig::Speed ) cmb_speed->currentItem();
+ ifconfig.m_runScript = cb_runScript->isChecked();
+ ifconfig.m_connectScript = url_connectScript->url();
+ ifconfig.m_useCrypto = cb_useCrypto->isChecked();
+ ifconfig.m_pmEnabled = cb_pmEnabled->isChecked();
+}
+
+void IfConfigPage::slotSetupPower()
+{
+ KDialogBase *dlg = new KDialogBase( this, "ConfigPower", true,
+ i18n( "Configure Power Mode" ), KDialogBase::Ok|KDialogBase::Cancel,
+ KDialogBase::Ok );
+ ConfigPower *power = new ConfigPower( dlg, "ConfigPower" );
+
+ WifiConfig *config = WifiConfig::instance();
+ IfConfig &ifconfig = config->m_ifConfig[ m_configNum ];
+ power->load( ifconfig );
+
+ dlg->setMainWidget( power );
+
+ if ( dlg->exec() == KDialog::Accepted )
+ {
+ power->save( ifconfig );
+ emit changed();
+ }
+}
+
+void IfConfigPage::slotSetupCrypto()
+{
+ KDialogBase *dlg = new KDialogBase( this, "ConfigCrypto", true,
+ i18n( "Configure Encryption" ), KDialogBase::Ok|KDialogBase::Cancel,
+ KDialogBase::Ok );
+ ConfigCrypto *crypto = new ConfigCrypto( dlg, "ConfigCrypto" );
+
+ WifiConfig *config = WifiConfig::instance();
+ IfConfig &ifconfig = config->m_ifConfig[ m_configNum ];
+ crypto->load( ifconfig );
+
+ dlg->setMainWidget( crypto );
+
+ if ( dlg->exec() == KDialog::Accepted )
+ {
+ crypto->save( ifconfig );
+ emit changed();
+ }
+}
+
+#include "ifconfigpage.moc"
diff --git a/wifi/kcmwifi/ifconfigpage.h b/wifi/kcmwifi/ifconfigpage.h
new file mode 100644
index 00000000..05ae61c0
--- /dev/null
+++ b/wifi/kcmwifi/ifconfigpage.h
@@ -0,0 +1,51 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef IFCONFIGPAGE_H
+#define IFCONFIGPAGE_H
+
+#include "ifconfigpagebase.h"
+#include "wificonfig.h"
+
+class IfConfigPage : public IfConfigPageBase
+{
+ Q_OBJECT
+
+ public:
+ IfConfigPage( int configNum, QWidget *parent, const char *name );
+ ~IfConfigPage() {}
+
+ void load();
+ void save();
+
+ protected slots:
+ void slotSetupPower();
+ void slotSetupCrypto();
+ void slotResetInterface( bool checked );
+
+ signals:
+ void changed();
+ void setupCrypto();
+ void setupPower();
+
+ private:
+ int m_configNum;
+};
+
+#endif // IFCONFIGPAGE_H
diff --git a/wifi/kcmwifi/ifconfigpagebase.ui b/wifi/kcmwifi/ifconfigpagebase.ui
new file mode 100644
index 00000000..45df9e19
--- /dev/null
+++ b/wifi/kcmwifi/ifconfigpagebase.ui
@@ -0,0 +1,500 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>IfConfigPageBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>IfConfigPageBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>626</width>
+ <height>242</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout16</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>lb_netName</cstring>
+ </property>
+ <property name="text">
+ <string>Network name:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>SSID of the network to connect to. "any" means "arbitrary available network".</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>le_networkName</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>lb_ifName</cstring>
+ </property>
+ <property name="text">
+ <string>Interface:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>SSID of the network to connect to. "any" means "arbitrary available network".</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>le_interface</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>cb_Autodetect</cstring>
+ </property>
+ <property name="text">
+ <string>Autodetect</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>226</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="0">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>lb_connectScript</cstring>
+ </property>
+ <property name="text">
+ <string>Script:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Command to perform after the connection is established, e.g. for obtaining a DHCP lease.</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>url_connectScript</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer18</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>196</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="5" column="0">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>cb_pmEnabled</cstring>
+ </property>
+ <property name="text">
+ <string>Enable power management</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enables advanced power management settings.</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pb_setupPower</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Configure...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Clicking this button opens the Power Management menu.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>285</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Speed:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Sets the connection speed. Not all cards support this.</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Auto</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>2 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>5.5 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>6 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>9 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>11 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>12 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>18 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>24 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>36 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>48 Mb/s</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>54 Mb/s</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cmb_speed</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>190</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>lb_opMode</cstring>
+ </property>
+ <property name="text">
+ <string>Operation mode:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Operation mode of the card. For standard infrastructure networks, "Managed" is appropriate.</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Ad-Hoc</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Managed</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Repeater</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Master</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Secondary</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cmb_wifiMode</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>413</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>cb_runScript</cstring>
+ </property>
+ <property name="text">
+ <string>Execute script on connect</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Activates a script to perform arbitrary operations after associating with the network.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="6" column="0">
+ <property name="name">
+ <cstring>layout17</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>cb_useCrypto</cstring>
+ </property>
+ <property name="text">
+ <string>Use encryption</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enables WEP encryption.</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pb_setupCrypto</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Configure...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Clicking this button opens the Encryption menu.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>396</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>cb_Autodetect</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>le_interface</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>cb_runScript</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>lb_connectScript</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>cb_runScript</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>url_connectScript</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>le_networkName</tabstop>
+ <tabstop>cmb_wifiMode</tabstop>
+ <tabstop>cmb_speed</tabstop>
+ <tabstop>cb_runScript</tabstop>
+ <tabstop>url_connectScript</tabstop>
+ <tabstop>cb_pmEnabled</tabstop>
+ <tabstop>pb_setupPower</tabstop>
+ <tabstop>cb_useCrypto</tabstop>
+ <tabstop>pb_setupCrypto</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/wifi/kcmwifi/indent-options b/wifi/kcmwifi/indent-options
new file mode 100644
index 00000000..b79f4fbb
--- /dev/null
+++ b/wifi/kcmwifi/indent-options
@@ -0,0 +1 @@
+-prs -l120
diff --git a/wifi/kcmwifi/kcmwifi.cpp b/wifi/kcmwifi/kcmwifi.cpp
new file mode 100644
index 00000000..55920dad
--- /dev/null
+++ b/wifi/kcmwifi/kcmwifi.cpp
@@ -0,0 +1,382 @@
+/*
+ Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
+ (C) 2001-2004 by Stefan Winter <mail@stefan-winter.de>
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <qlayout.h>
+#include <qtabwidget.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+
+#include <kaboutdata.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <kgenericfactory.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kprocio.h>
+#include <klineedit.h>
+
+#include "kcmwifi.h"
+#include "ifconfigpage.h"
+#include "mainconfig.h"
+#include "configcrypto.h"
+#include "wificonfig.h"
+#include "vendorconfig.h"
+
+typedef KGenericFactory < KCMWifi, QWidget > KWiFiFactory;
+K_EXPORT_COMPONENT_FACTORY (kcm_wifi, KWiFiFactory("kcmwifi") )
+
+KCMWifi::KCMWifi(QWidget * parent, const char *name, const QStringList &)
+ : KCModule (parent, name)
+{
+ tabs = new QTabWidget (this, "tabs");
+
+ m_mainConfig = new MainConfig(this, "m_mainConfig");
+
+ WifiConfig *config = WifiConfig::instance();
+
+ for ( int i=0; i<config->m_numConfigs; ++i )
+ {
+ IfConfigPage *ifConfigPage = new IfConfigPage( i, tabs, "m_configPage" );
+ tabs->addTab(ifConfigPage, i18n ("Config &%1").arg( i+1 ));
+ connect(ifConfigPage, SIGNAL(changed()), SLOT( slotChanged() ) );
+
+ m_ifConfigPage[ i ] = ifConfigPage;
+ }
+
+ QVBoxLayout *top = new QVBoxLayout (this, 0, KDialog::spacingHint());
+ top->addWidget( tabs );
+ top->addWidget( m_mainConfig );
+ top->addStretch();
+
+ connect(m_mainConfig, SIGNAL(changed()), SLOT( slotChanged() ) );
+ connect(m_mainConfig, SIGNAL(activateClicked()), SLOT(slotActivate()));
+
+ if ( geteuid() != 0 )
+ {
+ tabs->setEnabled( false );
+ m_mainConfig->setEnabled( false );
+ }
+ else
+ {
+ KProcess iwconfigtest;
+ iwconfigtest << "iwconfig";
+ if (!iwconfigtest.start(KProcess::DontCare))
+ {
+ KMessageBox::sorry(0, i18n("Error executing iwconfig. WLAN "
+ "configurations can only be altered if the wireless tools are "
+ "properly installed."), i18n ("No Wireless Tools"));
+
+ tabs->setEnabled( false );
+ m_mainConfig->setEnabled( false );
+ }
+ }
+
+ load();
+
+ m_activeVendorCount = 0;
+ VendorConfig vendors( this );
+ vendors.initAll();
+}
+
+
+KCMWifi::~KCMWifi()
+{
+}
+
+void KCMWifi::load()
+{
+ WifiConfig *config = WifiConfig::instance();
+
+ for ( int i=0; i<config->m_numConfigs; ++i )
+ m_ifConfigPage[ i ]->load();
+
+ m_mainConfig->load();
+}
+
+void KCMWifi::save()
+{
+ WifiConfig *config = WifiConfig::instance();
+ for ( int i=0; i<config->m_numConfigs; ++i )
+ m_ifConfigPage[ i ]->save();
+
+ m_mainConfig->save();
+
+ config->save();
+}
+
+void KCMWifi::slotActivate()
+{
+ save();
+ activate();
+}
+
+void KCMWifi::defaults()
+{
+}
+
+void KCMWifi::slotChanged()
+{
+ emit changed( true );
+}
+
+IfConfigPage* KCMWifi::addConfigTab( int count, bool vendor )
+{
+
+ WifiConfig *config = WifiConfig::instance();
+
+ IfConfigPage* retval = NULL;
+
+ if (vendor)
+ {
+ IfConfigPage *ifConfigPage = new IfConfigPage( vendorBase + m_activeVendorCount, tabs, "m_configPage" );
+ tabs->addTab(ifConfigPage, i18n ("Vendor %1").arg( m_activeVendorCount+1 ) );
+ connect(ifConfigPage, SIGNAL(changed()), SLOT( slotChanged() ) );
+ m_ifConfigPage[ vendorBase+m_activeVendorCount ] = ifConfigPage;
+ m_mainConfig->registerConfig( vendorBase+m_activeVendorCount );
+ m_activeVendorCount++;
+ retval = ifConfigPage;
+
+ // these configs are read-only, so disable all widgets
+ // the content shall only be modified by VendorConfig code
+ retval->cb_Autodetect->setEnabled( false );
+ retval->le_networkName->setReadOnly( true );
+ retval->cmb_wifiMode->setEnabled( false );
+ retval->cmb_speed->setEnabled( false );
+ retval->cb_runScript->setEnabled( false );
+ retval->cb_useCrypto->setEnabled( false );
+ retval->cb_pmEnabled->setEnabled( false );
+
+ }
+ else
+ {
+ for ( int i=config->m_numConfigs; i<config->m_numConfigs+count; i++ )
+ {
+ IfConfigPage *ifConfigPage = new IfConfigPage( i, tabs, "m_configPage" );
+ tabs->insertTab(ifConfigPage, i18n ("Config &%1").arg( i+1 ), i );
+ connect(ifConfigPage, SIGNAL(changed()), SLOT( slotChanged() ) );
+ m_ifConfigPage[ i ] = ifConfigPage;
+ m_mainConfig->registerConfig( i+1 );
+ retval = ifConfigPage;
+ }
+ config->m_numConfigs += count;
+ }
+
+ // if more than one was constructed, only the last is returned
+ return retval;
+}
+
+void KCMWifi::delConfigTab( int count )
+{
+ WifiConfig *config = WifiConfig::instance();
+
+ for ( int i=config->m_numConfigs-1; i>(config->m_numConfigs)-count-1; i-- )
+ {
+ tabs->setTabEnabled(m_ifConfigPage[ i ], false);
+ m_ifConfigPage[ i ]->deleteLater();
+
+ m_mainConfig->unregisterConfig( i+1 );
+
+ }
+
+ config->m_numConfigs -= count;
+
+}
+
+void KCMWifi::activate()
+{
+ KProcess proc;
+
+ QStringList failedParts;
+
+ WifiConfig *config = WifiConfig::instance();
+ int index;
+ if ( config->m_presetConfig >= config->m_numConfigs )
+ {
+ index = vendorBase+config->m_presetConfig-config->m_numConfigs;
+ } else
+ {
+ index = config->m_presetConfig;
+ }
+
+ kdDebug() << "I was told to use array slot number " << index << ".\n";
+
+ IfConfig ifconfig = config->m_ifConfig[ index ];
+
+ QString tempInterface;
+
+ if ( ifconfig.m_interface.isEmpty() ) {
+ tempInterface = config->autoDetectInterface();
+ kdDebug() << "Autodetecting interface...\n";
+ } else
+ {
+ tempInterface = ifconfig.m_interface;
+ }
+
+ proc << "ifconfig"
+ << tempInterface
+ << "down";
+ kdDebug() << "Command: " << proc.args() << endl;
+ proc.start (KProcess::Block);
+
+ if ( (!proc.normalExit()) || (proc.exitStatus() != 0) )
+ failedParts << i18n("Interface could not be shut down. It is likely that your settings have not been applied.");
+
+ proc.clearArguments();
+
+ proc << "iwconfig"
+ << tempInterface;
+ proc << "essid"
+ << ifconfig.m_networkName;
+
+ kdDebug() << "Command: " << proc.args() << endl;
+ proc.start (KProcess::Block);
+
+ if ( (!proc.normalExit()) || (proc.exitStatus() != 0) )
+ failedParts << i18n("SSID could not be set.");
+
+ proc.clearArguments();
+
+ proc << "iwconfig"
+ << tempInterface;
+ proc << "mode"
+ << ifconfig.wifimodeAsString();
+
+ kdDebug() << "Command: " << proc.args() << endl;
+ proc.start (KProcess::Block);
+
+ if ( (!proc.normalExit()) || (proc.exitStatus() != 0) )
+ failedParts << i18n("Operation mode could not be set.");
+
+ proc.clearArguments();
+
+ proc << "iwconfig"
+ << tempInterface;
+ proc << "rate"
+ << ifconfig.speedAsString();
+
+ kdDebug() << "Command: " << proc.args() << endl;
+ proc.start (KProcess::Block);
+
+ if ( (!proc.normalExit()) || (proc.exitStatus() != 0) )
+ failedParts << i18n("Speed settings could not be modified.");
+
+
+ proc.clearArguments();
+
+ proc << "iwconfig"
+ << tempInterface;
+
+ if (!ifconfig.m_useCrypto )
+ {
+ proc << "key"
+ << "off";
+ }
+ else
+ {
+ for ( int i=0; i<4; ++i )
+ {
+ if ( ifconfig.m_keys[ i ].isValid( ifconfig.m_keys[ i ].key() ) > INVALID )
+ {
+ proc << "key"
+ << QString( "[%1]").arg( i+1 )
+ << QString( "%1").arg( ifconfig.m_keys[ i ].rawKey() );
+ }
+ }
+
+ // kdDebug() << "All appropriate keys have been fed into iwconfig.\n";
+
+ if ( ifconfig.activeKey().isValid( ifconfig.activeKey().key() ) > INVALID )
+ {
+ // kdDebug() << "Entering final phase of key setup.\n";
+ proc << "key"
+ << ifconfig.cryptomodeAsString();
+ proc << "key"
+ << QString( "[%1]" ).arg( ifconfig.activeKeyId() );
+ proc << "key"
+ << "on";
+ }
+ }
+
+ kdDebug() << "Command: " << proc.args() << endl;
+ proc.start (KProcess::Block);
+
+ if ( (ifconfig.m_useCrypto) && ((!proc.normalExit()) || (proc.exitStatus() != 0)) )
+ failedParts << i18n("Encryption settings could not be set.");
+
+ proc.clearArguments();
+
+ proc << "iwconfig"
+ << tempInterface;
+
+ if ( !ifconfig.m_pmEnabled )
+ {
+ proc << "power"
+ << "off";
+ }
+ else
+ {
+ proc << "power"
+ << "period"
+ << QString( "%1" ).arg( ifconfig.m_wakeupPeriod );
+ proc << "power"
+ << "timeout"
+ << QString( "%1" ).arg( ifconfig.m_sleepTimeout );
+ proc << ifconfig.powermodeAsString();
+ }
+
+ kdDebug() << "Command: " << proc.args() << endl;
+ proc.start (KProcess::Block);
+
+ if ( (ifconfig.m_pmEnabled) && ((!proc.normalExit()) || (proc.exitStatus() != 0)) )
+ failedParts << i18n("Power management settings could not be set.");
+
+ proc.clearArguments();
+ proc << "ifconfig"
+ << tempInterface
+ << "up";
+
+ kdDebug() << "Command: " << proc.args() << endl;
+ proc.start (KProcess::Block);
+
+ if ( (!proc.normalExit()) || (proc.exitStatus() != 0) )
+ failedParts << i18n("Interface could not be re-enabled.");
+
+ if ( ifconfig.m_runScript )
+ {
+ proc.clearArguments();
+ proc << QStringList::split( " ", ifconfig.m_connectScript );
+
+ proc.start(KProcess::DontCare);
+ }
+
+if (!failedParts.empty()) KMessageBox::informationList(0,i18n("The following settings could not be applied:"),failedParts);
+
+}
+
+extern "C"
+{
+ void init_wifi()
+ {
+ KCMWifi::activate();
+ }
+}
+
+
+#include "kcmwifi.moc"
diff --git a/wifi/kcmwifi/kcmwifi.desktop b/wifi/kcmwifi/kcmwifi.desktop
new file mode 100644
index 00000000..15d506dc
--- /dev/null
+++ b/wifi/kcmwifi/kcmwifi.desktop
@@ -0,0 +1,162 @@
+[Desktop Entry]
+Icon=kwifimanager
+Type=Application
+Exec=kcmshell kcmwifi
+DocPath=
+X-KDE-ModuleType=Library
+X-KDE-Library=wifi
+X-KDE-RootOnly=true
+Name=Wireless Network
+Name[ar]=شبكة لاسلكية
+Name[bg]=Безжична мрежа
+Name[bn]=ওয়্যারলেস নেটওয়ার্ক
+Name[br]=Rouedad hep neud
+Name[bs]=Bežična mreža
+Name[ca]=Xarxa sense fils
+Name[cs]=Bezdrátová síť
+Name[cy]=Rhwydwaith Di-Wifren
+Name[da]=Trådløst netværk
+Name[de]=Drahtloses Netzwerk
+Name[el]=Ασύρματο δίκτυο
+Name[eo]=Sendrata reto
+Name[es]=Red inalámbrica
+Name[et]=Traadita võrk
+Name[eu]=Kablerik gabeko sarea
+Name[fa]=شبکۀ بی‌سیم
+Name[fi]=Langaton verkko
+Name[fr]=Réseau sans fil
+Name[ga]=Gréasán gan sreang
+Name[gl]=Rede inalámbrica
+Name[he]=רשת אלחוטית
+Name[hi]=वायरलेस नेटवर्क
+Name[hr]=Bežična mreža
+Name[hu]=Vezeték nélküli hálózat
+Name[is]=Þráðlaus nettenging
+Name[it]=Rete senza fili
+Name[ja]=ワイヤレスネットワーク
+Name[ka]=უკაბელო ქსელი
+Name[kk]=Сымсыз желі
+Name[km]=បណ្ដាញ​ឥត​ខ្សែ
+Name[lt]=Bevielis tinklas
+Name[mk]=Безжична мрежа
+Name[ms]=Jaringan Tanpa Wayar
+Name[nb]=Trådløst nettverk
+Name[nds]=WLAN-Nettwark
+Name[ne]=तारविहिन सञ्जाल
+Name[nl]=Draadloos netwerk
+Name[nn]=Trådlaust nettverk
+Name[pa]=ਬੇਤਾਰ ਨੈੱਟਵਰਕ
+Name[pl]=Sieć bezprzewodowa
+Name[pt]=Rede Sem Fios
+Name[pt_BR]=Rede Sem Fio
+Name[ru]=Беспроводная сеть
+Name[se]=Jođaskeahttes fierpmádat
+Name[sk]=Bezdrôtová sieť
+Name[sl]=Brezžično omrežje
+Name[sr]=Бежична мрежа
+Name[sr@Latn]=Bežična mreža
+Name[sv]=Trådlöst nätverk
+Name[ta]=கம்பியில்லா பிணையம்
+Name[tg]=Шабакаи Беноқил
+Name[tr]=Telsiz Ağ
+Name[uk]=Радіомережа
+Name[uz]=Simsiz tarmoq
+Name[uz@cyrillic]=Симсиз тармоқ
+Name[zh_CN]=无线网
+Name[zh_HK]=無線網絡
+Name[zh_TW]=無線網路
+Comment=Set up your wireless LAN
+Comment[ar]=ركب شبكة LAN الاسلكية الخاصةبك
+Comment[bg]=Настройване на безжична локална мрежа
+Comment[bn]=আপনার ওয়্যারলেস ল্যান স্থাপন করুন
+Comment[br]=Lakaat ho roueded hep neud
+Comment[bs]=Podesite vaš bežični LAN
+Comment[ca]=Configureu la vostra xarxa local sense fils
+Comment[cs]=Nastavte si svou bezdrátovou síť
+Comment[cy]=Gosod eich LAN di-wifren
+Comment[da]=Opsætning af trådløst LAN
+Comment[de]=Einrichtung eines drahtlosen Netzwerkes
+Comment[el]=Ρυθμίστε το ασύρματο δίκτυό σας
+Comment[es]=Configure su red inalámbrica local
+Comment[et]=Traadita võrgu seadistamine
+Comment[eu]=Konfiguratu zure kablerik gabeko LAN-a
+Comment[fa]=تنظیم شبکۀ داخلی بی‌سیم شما
+Comment[fi]=Aseta langaton lähiverkko
+Comment[fr]=Configuration de votre réseau sans fil
+Comment[gl]=Configura a túa rede inalámbrica
+Comment[he]=הגדרת רשת ה- LAN האלחוטית שלך
+Comment[hi]=आपके बेतार लैन सेट अप करे
+Comment[hr]=Podešavamke vaše bežične lokalne mrežu
+Comment[hu]=A vezeték nélküli (WiFi) hálózat beállításai
+Comment[is]=Uppsetning á þráðlausu staðarneti
+Comment[it]=Configura la tua rete LAN senza fili
+Comment[ja]=ワイヤレス LAN をセットアップ
+Comment[ka]=თქვენი უკაბელო LAN-ის გამართვა
+Comment[kk]=Сымсыз желіңізді баптау
+Comment[km]=រៀបចំ​បណ្ដាញ​មូលដ្ឋាន​ឥត​ខ្សែ​របស់​អ្នក
+Comment[lt]=Nustatyti bevielio ryšio tinklą
+Comment[mk]=Поставете ја вашата безжична локална мрежа
+Comment[ms]=Pasang LAN tanpa wayar
+Comment[nb]=Sett opp trådløst nettverk
+Comment[nds]=Dien Funk-Nettwark instellen
+Comment[ne]=तपाईँको तारविहिन LAN सेटअप गर्नुहोस्
+Comment[nl]=Stel hier uw draadloos netwerk in
+Comment[nn]=Set opp trådlaust nettverk
+Comment[pl]=Ustawienia sieci bezprzewodowej
+Comment[pt]=Configuração da rede sem fios
+Comment[pt_BR]=Configurar a sua rede local sem fio
+Comment[ru]=Настройка беспроводной сети
+Comment[se]=Heivet iežat jođaskeahttes LAN:a
+Comment[sk]=Nastavte si vašu bezdrôtovu sieť LAN
+Comment[sl]=Nastavite svoje brezžično lokalno omrežje
+Comment[sr]=Подесите вашу бежичну локалну мрежу
+Comment[sr@Latn]=Podesite vašu bežičnu lokalnu mrežu
+Comment[sv]=Anpassa trådlöst nätverk
+Comment[ta]=உங்கள் கம்பியில்லா LAN ஐ அமைக்கிறது
+Comment[tg]=Барпосозии шабакаи беноқили маҳаллии шумо
+Comment[tr]=Telsiz ağı yapılandır
+Comment[uk]=Налаштування локальної радіо мережі
+Comment[uz]=Simsiz tarmoqni oʻrnatish
+Comment[uz@cyrillic]=Симсиз тармоқни ўрнатиш
+Comment[zh_CN]=设置您的无线局域网
+Comment[zh_HK]=設定您的無線網絡
+Comment[zh_TW]=設定您的無線網路
+Keywords=network,orinoco,wireless,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[bg]=мрежа, безжична, настройки, локална, споделяне, network, orinoco, wireless, wlan, wlan-ng
+Keywords[ca]=xarxa,orinoco,sense fils,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[cs]=síť,orinoco,bezdrát,wlan,wlan-ng,wifi,adhoc
+Keywords[da]=network,orinoco,trådløs,wlan,wlan-ng, wifi,Ad-Hoc
+Keywords[de]=Netzwerk,orinoco,drahtlos,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[el]=δίκτυο,orinoco,ασύρματο,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[es]=red,orinoco,inalámbrica,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[et]=võrk,orinoco,traadita,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[eu]=sarea,orinoco,kablerik gabe,wlan,wlan-ng,ad-hoc
+Keywords[fa]=شبکه، orinoco، بی‌سیم، شبکۀ محلی بی‌سیم، wlan-ng، wifi، Ad-Hoc
+Keywords[fi]=verkko,orinoco,langaton,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[fr]=network,orinoco,wireless,wlan,wlan-ng,sans fil,Ad-Hoc
+Keywords[gl]=rede,orinoco,sen fíos,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[he]=network,orinoco,wireless,wlan,wlan-ng,wifi,Ad-Hoc, רשת אלחוטי
+Keywords[hu]=hálózat,orinoco,vezeték nélküli,wlan,wlan-ng,wifi,ad-hoc
+Keywords[is]=network,orinoco,wireless,wlan,wlan-ng,wifi,Ad-Hoc,þráðlaust,net
+Keywords[it]=rete,orinoco,senza fili,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[ja]=ネットワーク,orinoco,ワイヤレス,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[km]=បណ្ដាញ,orinoco,ឥត​ខ្សែ,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[lt]=network,orinoco,wireless,wlan,wlan-ng,wifi,Ad-Hoc,tinklas,bevielis,bevielis ryšys
+Keywords[nb]=nettverk,orinoco,trådløst,wlan,wlan-ng
+Keywords[nds]=nettwark,orinoco,drahtloos,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[ne]=सञ्जाल,ओरिनोको,तारविहिन,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[nl]=netwerk,orinoco,wireless,wlan,wlan-ng,draadloos,wifi,ad-hoc
+Keywords[nn]=nettverk,orinoco,trådlaust,wlan,wlan-ng,wifi,ad-hoc
+Keywords[pl]=sieć,orinoco,bezprzewodowy,bezprzewodowa,wi-fi,wlan,wlan-ng,wifi,ad-hoc,adhoc
+Keywords[pt]=rede,orinoco,wireless,wlan,wlan-ng,sem fios,wifi,ad-hoc
+Keywords[pt_BR]=rede,orinoco,sem fio,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[sl]=omrežje,orinoco,brezžično,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[sr]=network,orinoco,wireless,wlan,wlan-ng,wifi,Ad-Hoc,мрежа,ориноко,бежична,бежично
+Keywords[sr@Latn]=network,orinoco,wireless,wlan,wlan-ng,wifi,Ad-Hoc,mreža,orinoko,bežična,bežično
+Keywords[sv]=nätverk,orinoco,trådlöst,wlan,wlan-ng,wifi,ad-hoc
+Keywords[uk]=мережа,orinoco,радіо,бездротовий,зв'язок,wlan,wlan-ng,wifi,Ad-Hoc
+Keywords[uz]=tarmoq,orinoco,simsiz,wlan,wlan-ng,simsiz tarmoq,wifi,Ad-Hoc
+Keywords[uz@cyrillic]=тармоқ,orinoco,симсиз,wlan,wlan-ng,симсиз тармоқ,wifi,Ad-Hoc
+Keywords[zh_CN]=network,orinoco,wireless,wlan,wlan-ng,wifi,Ad-Hoc,网络,无线,无线网络
+
+Categories=Qt;KDE;X-KDE-settings-network;Settings;
diff --git a/wifi/kcmwifi/kcmwifi.h b/wifi/kcmwifi/kcmwifi.h
new file mode 100644
index 00000000..747688ec
--- /dev/null
+++ b/wifi/kcmwifi/kcmwifi.h
@@ -0,0 +1,62 @@
+/*
+ Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
+ (C) 2001 by Stefan Winter <mail@stefan-winter.de>
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef KCMWIFI_H
+#define KCMWIFI_H
+
+#include <kcmodule.h>
+
+#include <qstring.h>
+
+class IfConfigPage;
+class MainConfig;
+class QTabWidget;
+class KProcIO;
+
+class KCMWifi : public KCModule
+{
+ Q_OBJECT
+public:
+ KCMWifi (QWidget * parent, const char *name, const QStringList &);
+ ~KCMWifi ();
+
+ void load();
+ void save();
+ void defaults();
+ int buttons();
+
+ static void activate();
+ IfConfigPage* addConfigTab( int count, bool vendor );
+ void delConfigTab( int count );
+
+ static const int vendorBase = 10;
+
+protected slots:
+ void slotActivate();
+ void slotChanged();
+
+private:
+ MainConfig *m_mainConfig;
+ IfConfigPage *m_ifConfigPage[ 15 ]; // that makes 5 vendor configs
+ QTabWidget* tabs;
+ int m_activeVendorCount;
+};
+
+#endif // KCMWIFI_H
diff --git a/wifi/kcmwifi/mainconfig.cpp b/wifi/kcmwifi/mainconfig.cpp
new file mode 100644
index 00000000..506d1f02
--- /dev/null
+++ b/wifi/kcmwifi/mainconfig.cpp
@@ -0,0 +1,108 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
+ (C) 2001-2004 by Stefan Winter <mail@stefan-winter.de>
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "mainconfig.h"
+#include "wificonfig.h"
+#include "kcmwifi.h"
+
+#include <kcombobox.h>
+#include <klineedit.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kprocio.h>
+#include <kpushbutton.h>
+#include <knuminput.h>
+
+#include <qcheckbox.h>
+#include <qfile.h>
+
+MainConfig::MainConfig( QWidget *parent, const char *name )
+ : MainConfigBase( parent, name )
+{
+ WifiConfig *config = WifiConfig::instance();
+
+ for (int i=1;i<=config->m_numConfigs;i++) {
+ cmb_presetConfig->insertItem( i18n( "Config %1" ).arg( i ) );
+ }
+
+
+ connect( cb_usePreset, SIGNAL( toggled( bool ) ), SIGNAL( changed() ) );
+ connect( cmb_presetConfig, SIGNAL( activated( int ) ), SIGNAL( changed() ) );
+ connect( sb_numConfigs, SIGNAL( valueChanged( int ) ), SIGNAL( changed() ) );
+
+ connect( pb_activate, SIGNAL( clicked() ), SIGNAL( activateClicked() ) );
+ connect( sb_numConfigs, SIGNAL( valueChanged( int ) ), SLOT( slotChangeNumConfigs( int ) ) );
+
+}
+
+void MainConfig::load()
+{
+ WifiConfig *config = WifiConfig::instance();
+
+ cb_usePreset->setChecked( config->m_usePreset );
+ cmb_presetConfig->setCurrentItem( config->m_presetConfig );
+ sb_numConfigs->setValue( config->m_numConfigs );
+}
+
+void MainConfig::save()
+{
+ WifiConfig *config = WifiConfig::instance();
+
+ config->m_usePreset = cb_usePreset->isChecked();
+ config->m_presetConfig = cmb_presetConfig->currentItem();
+ config->m_numConfigs = sb_numConfigs->value();
+}
+
+void MainConfig::slotChangeNumConfigs( int newnumber )
+{
+
+ WifiConfig* config = WifiConfig::instance();
+
+ if ( config->m_numConfigs < newnumber ) // number of configs raised
+ {
+ int diff = newnumber - config->m_numConfigs;
+ ( (KCMWifi*)parentWidget() )->addConfigTab( diff, false );
+ }
+ else // number of configs lowered
+ {
+ int diff = config->m_numConfigs - newnumber;
+ ( (KCMWifi*)parentWidget() )->delConfigTab( diff );
+ }
+}
+
+void MainConfig::registerConfig( int number )
+{
+ if ( number >= KCMWifi::vendorBase )
+ {
+ cmb_presetConfig->insertItem( i18n( "Vendor %1" ).arg( number-KCMWifi::vendorBase+1 ) );
+ }
+ else
+ {
+ WifiConfig* config = WifiConfig::instance();
+ cmb_presetConfig->insertItem( i18n( "Config %1" ).arg( number ), number-1 );
+ }
+}
+
+void MainConfig::unregisterConfig( int number )
+{
+ cmb_presetConfig->removeItem( number-1 );
+}
+
+#include "mainconfig.moc"
diff --git a/wifi/kcmwifi/mainconfig.h b/wifi/kcmwifi/mainconfig.h
new file mode 100644
index 00000000..83b014ac
--- /dev/null
+++ b/wifi/kcmwifi/mainconfig.h
@@ -0,0 +1,51 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
+ (C) 2001-2004 by Stefan Winter <mail@stefan-winter.de>
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef CONFIGMAIN_H
+#define CONFIGMAIN_H
+
+#include "mainconfigbase.h"
+
+class KProcIO;
+
+class MainConfig : public MainConfigBase
+{
+ Q_OBJECT
+
+ public:
+ MainConfig( QWidget *parent, const char *name=0 );
+ ~MainConfig() {}
+
+ void load();
+ void save();
+
+ void registerConfig( int number );
+ void unregisterConfig( int number );
+
+ signals:
+ void changed();
+ void activateClicked();
+
+ protected slots:
+ void slotChangeNumConfigs( int newnumber );
+};
+
+#endif // CONFIGMAIN_H
+
diff --git a/wifi/kcmwifi/mainconfigbase.ui b/wifi/kcmwifi/mainconfigbase.ui
new file mode 100644
index 00000000..f7ecef24
--- /dev/null
+++ b/wifi/kcmwifi/mainconfigbase.ui
@@ -0,0 +1,166 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>MainConfigBase</class>
+<widget class="QWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>581</width>
+ <height>135</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>grpGeneralSettings</cstring>
+ </property>
+ <property name="title">
+ <string>General Settings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton" row="1" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>pb_activate</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Activate</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Applies the configuration to the interface.</string>
+ </property>
+ </widget>
+ <spacer row="2" column="2" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>spacerrow2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>146</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>lb_numConfig</cstring>
+ </property>
+ <property name="text">
+ <string>Number of configurations:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Modifies the number of configurations that this tool should provide.</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>cmb_presetConfig</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Selects which of the configurations is to be applied.</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput" row="2" column="1">
+ <property name="name">
+ <cstring>sb_numConfigs</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lb_config</cstring>
+ </property>
+ <property name="text">
+ <string>Configuration to load:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Selects which of the configurations is to be applied.</string>
+ </property>
+ </widget>
+ <spacer row="0" column="3" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>106</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="4">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>66</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>cb_usePreset</cstring>
+ </property>
+ <property name="text">
+ <string>Load preset &amp;configuration on startup</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>When this box is checked, your settings are applied when you launch the Control Center module.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/wifi/kcmwifi/vendorconfig.cpp b/wifi/kcmwifi/vendorconfig.cpp
new file mode 100644
index 00000000..b237f4cc
--- /dev/null
+++ b/wifi/kcmwifi/vendorconfig.cpp
@@ -0,0 +1,271 @@
+/*
+ Copyright (C) 2005 Stefan Winter <swinter@kde.org>
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <qdir.h>
+#include <qstringlist.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+
+#include <kdebug.h>
+#include <klineedit.h>
+#include <kcombobox.h>
+
+#include "kcmwifi.h"
+#include "vendorconfig.h"
+#include "ifconfigpage.h"
+#include "configcrypto.h"
+#include "wificonfig.h"
+
+VendorConfig::VendorConfig ( KCMWifi * caller )
+{
+ m_caller = caller;
+ m_totalConfigs = 0;
+}
+
+void
+VendorConfig::initAll ( )
+{
+ initSuSE_92plus ( );
+ initDebian ( );
+}
+
+void
+VendorConfig::initSuSE_92plus ( )
+{
+
+ /* configurations are located in /etc/sysconfig/network/ifcfg-wlan*
+ there can be more than one if there are multiple wireless interfaces */
+
+ QDir filelist ( "/etc/sysconfig/network", "ifcfg-wlan*" );
+ QStringList files = filelist.entryList ( );
+
+ if ( files.count() == 0 )
+ {
+ return;
+ }
+
+ for ( QStringList::Iterator it = files.begin ( ); it != files.end ( ); ++it )
+ {
+ if ( ( ( *it ).endsWith ( "~" ) ) == false )
+ { // ignore backup files
+ QFile configfile ( QString ( "/etc/sysconfig/network/%1" ).arg ( *it ) );
+ configfile.open ( IO_ReadOnly );
+ kdDebug ( ) << "Opened SuSE configuration file " << configfile.name ( ) << "\n";
+
+ IfConfigPage *newtab = m_caller->addConfigTab ( 1, true );
+ /* this config tab gets automagically stored in an array, the first
+ starting at position vendorBase. We need to construct its power
+ and crypto settings and therefore need the array index, which is
+ vendorBase+m_totalConfigs. It is _essential_ that m_totalConfigs
+ is incremented _after_ successful setup of each given config. */
+
+ // init crypto entries
+ ConfigCrypto *crypto = new ConfigCrypto ( 0, "ConfigCrypto" );
+ WifiConfig *config = WifiConfig::instance ( );
+ IfConfig & ifconfig = config->m_ifConfig[KCMWifi::vendorBase + m_totalConfigs];
+
+ QString buffer;
+ while ( configfile.readLine ( buffer, 255 ) != -1 )
+ {
+ // lines look like WIRELESS_ESSID='bla', so split it into WIRELESS_ESSID and bla
+ QString var = buffer.section ( '=', 0, 0 );
+ QString value = buffer.section ( '=', 1, 1 );
+ value = value.mid ( 1, value.length ( ) - 3 );
+ kdDebug ( ) << "Variable " << var << " contains " << value << ".\n";
+ // evaluate the meaningful lines
+ if ( var == "WIRELESS_ESSID" )
+ {
+ newtab->le_networkName->setText ( value );
+ }
+ else if ( var == "WIRELESS_MODE" )
+ {
+ newtab->cmb_wifiMode->setCurrentItem ( IfConfig::convertToWifiModeFromString ( value ) );
+ }
+ else if ( var == "WIRELESS_BITRATE" )
+ {
+ newtab->cmb_speed->setCurrentItem ( IfConfig::convertToSpeedFromString ( value ) );
+ }
+ else if ( var == "WIRELESS_DEFAULT_KEY" )
+ {
+ crypto->cmb_activeKey->setCurrentItem ( value.toInt ( ) );
+ }
+ else if ( var == "WIRELESS_AUTH_MODE" )
+ {
+ if ( value == "shared" || value == "sharedkey" || value == "restricted" )
+ {
+ crypto->rb_restrictMode->setChecked ( true );
+ newtab->cb_useCrypto->setChecked ( true );
+ }
+ if ( value == "open" || value == "opensystem" || value == "" )
+ {
+ crypto->rb_openMode->setChecked ( true );
+ newtab->cb_useCrypto->setChecked ( false );
+ }
+ }
+ else if ( var == "WIRELESS_KEY_0" )
+ {
+ if ( value.startsWith ( "s:" ) )
+ value = value.right ( value.length ( ) - 2 );
+ crypto->le_key1->setText ( value );
+ }
+ else if ( var == "WIRELESS_KEY_1" )
+ {
+ if ( value.startsWith ( "s:" ) )
+ value = value.right ( value.length ( ) - 2 );
+ crypto->le_key2->setText ( value );
+ }
+ else if ( var == "WIRELESS_KEY_2" )
+ {
+ if ( value.startsWith ( "s:" ) )
+ value = value.right ( value.length ( ) - 2 );
+ crypto->le_key3->setText ( value );
+ }
+ else if ( var == "WIRELESS_KEY_3" )
+ {
+ if ( value.startsWith ( "s:" ) )
+ value = value.right ( value.length ( ) - 2 );
+ crypto->le_key4->setText ( value );
+ }
+ }
+ newtab->save ( );
+ crypto->save ( ifconfig );
+ configfile.close ( );
+ m_totalConfigs++;
+ }
+ }
+
+}
+
+void
+VendorConfig::initDebian ( )
+{
+ QFile configfile ( QString ( "/etc/network/interfaces" ) );
+ if ( !configfile.open ( IO_ReadOnly ) )
+ {
+ return;
+ }
+
+ kdDebug ( ) << "Opened Debian configuration file " << configfile.name ( ) << "\n";
+
+ IfConfigPage *newtab = m_caller->addConfigTab ( 1, true );
+/* this config tab gets automagically stored in an array, the first
+starting at position vendorBase. We need to construct its power
+and crypto settings and therefore need the array index, which is
+vendorBase+m_totalConfigs. It is _essential_ that m_totalConfigs
+is incremented _after_ successful setup of each given config. */
+// init crypto entries
+ ConfigCrypto *crypto = new ConfigCrypto ( 0, "ConfigCrypto" );
+ WifiConfig *config = WifiConfig::instance ( );
+ IfConfig & ifconfig = config->m_ifConfig[KCMWifi::vendorBase + m_totalConfigs];
+
+ QString buffer;
+ while ( configfile.readLine ( buffer, 255 ) != -1 )
+ {
+// lines look like wireless-defaultkey bla, so split it into wireless-defaultkey and bla
+ QString var = buffer.section ( ' ', 0, 0 );
+ QString value = buffer.section ( ' ', 1, 1 );
+ kdDebug ( ) << "Variable " << var << " contains " << value << ".\n";
+// evaluate the meaningful lines
+ if ( var.startsWith ( "wireless", false ) )
+ {
+ if ( var.endsWith ( "essid" ) )
+ {
+ newtab->le_networkName->setText ( value );
+ }
+
+ else if ( var.endsWith ( "mode" ) && !var.contains ( "key" ) )
+
+ {
+ newtab->cmb_wifiMode->setCurrentItem ( IfConfig::convertToWifiModeFromString ( value ) );
+ }
+
+ else if ( var.endsWith ( "rate" ) )
+
+ {
+ newtab->cmb_speed->setCurrentItem ( IfConfig::convertToSpeedFromString ( value ) );
+ }
+
+ else if ( var.contains ( "key" ) )
+ {
+// Could be any of key, key1, key2, ..., or defaultkey
+ if ( var.contains ( "default" ) )
+ {
+ crypto->cmb_activeKey->setCurrentItem ( value.toInt ( ) );
+ }
+
+ else if ( var.contains ( "mode" ) )
+ {
+ if ( value == "shared" || value == "sharedkey" || value == "restricted" )
+ {
+ crypto->rb_restrictMode->setChecked ( true );
+ newtab->cb_useCrypto->setChecked ( true );
+ }
+ }
+
+ else if ( value == "open" || value == "opensystem" || value == "" )
+ {
+ crypto->rb_openMode->setChecked ( true );
+ newtab->cb_useCrypto->setChecked ( false );
+ }
+
+ else if ( var.right ( 1 ) == "1" )
+ {
+ if ( value.startsWith ( "s:" ) )
+ value = value.right ( value.length ( ) - 2 );
+ crypto->le_key1->setText ( value );
+ }
+
+ else if ( var.right ( 1 ) == "2" )
+ {
+ if ( value.startsWith ( "s:" ) )
+ value = value.right ( value.length ( ) - 2 );
+ crypto->le_key2->setText ( value );
+ }
+
+ else if ( var.right ( 1 ) == "3" )
+ {
+ if ( value.startsWith ( "s:" ) )
+ value = value.right ( value.length ( ) - 2 );
+ crypto->le_key3->setText ( value );
+ }
+
+ else if ( var.right ( 1 ) == "4" )
+ {
+ if ( value.startsWith ( "s:" ) )
+ value = value.right ( value.length ( ) - 2 );
+ crypto->le_key4->setText ( value );
+ }
+
+ else
+ {
+// does not contain a number. It's the only one.
+ if ( value.startsWith ( "s:" ) )
+ value = value.right ( value.length ( ) - 2 );
+ crypto->le_key1->setText ( value );
+ }
+ }
+ }
+ }
+ newtab->save ( );
+ crypto->save ( ifconfig );
+ configfile.close ( );
+ m_totalConfigs++;
+}
diff --git a/wifi/kcmwifi/vendorconfig.h b/wifi/kcmwifi/vendorconfig.h
new file mode 100644
index 00000000..e9a8a9a2
--- /dev/null
+++ b/wifi/kcmwifi/vendorconfig.h
@@ -0,0 +1,36 @@
+/*
+ Copyright (C) 2005 Stefan Winter <swinter@kde.org>
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef VENDORCONFIG_H
+#define VENDORCONFIG_H
+
+class KCMWifi;
+
+class VendorConfig {
+ public:
+ VendorConfig( KCMWifi* caller);
+ void initAll ();
+ void initSuSE_92plus ();
+ void initDebian ();
+ protected:
+ KCMWifi* m_caller;
+ int m_totalConfigs;
+};
+
+#endif // VENDORCONFIG_H
diff --git a/wifi/kcmwifi/wificonfig.cpp b/wifi/kcmwifi/wificonfig.cpp
new file mode 100644
index 00000000..c5bafba3
--- /dev/null
+++ b/wifi/kcmwifi/wificonfig.cpp
@@ -0,0 +1,369 @@
+/*
+ Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <qfile.h>
+
+#include <ksimpleconfig.h>
+#include <kglobal.h>
+#include <kdebug.h>
+#include <kprocio.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+
+#include "wificonfig.h"
+
+static QStringList speedList;
+static QStringList wifiModeList;
+static QStringList cryptoModeList;
+static QStringList powerModeList;
+
+Key::Key()
+{
+}
+
+Key::Key( const QString &key )
+{
+ setKey( key );
+}
+
+QString Key::rawKey() const
+{
+ QString s = m_key;
+
+ if ( isValid( m_key ) >= STRING_64 )
+ s = "s:" + s;
+
+ return s;
+}
+
+void Key::setKey( const QString &key )
+{
+ m_key = key;
+}
+
+KeyStates Key::isValid ( QString keyCandidate )
+{
+ if (keyCandidate.isEmpty()) {
+ kdDebug() << "Ignoring key: empty.\n";
+ return EMPTY;
+ }
+
+ if (keyCandidate.length() == 5)
+ return STRING_64;
+
+ if (keyCandidate.length() == 10)
+ return HEX_64;
+
+ if (keyCandidate.length() == 13)
+ return STRING_128;
+
+ if (keyCandidate.length() == 26)
+ return HEX_128;
+
+ if (keyCandidate.length() == 32)
+ return STRING_256;
+
+ if (keyCandidate.length() == 64)
+ return HEX_256;
+
+ return INVALID;
+}
+
+IfConfig::IfConfig()
+{
+
+ // initialise all config items...
+
+ m_networkName = "";
+ m_interface = "";
+ m_wifiMode = Managed;
+ m_speed = AUTO;
+ m_runScript = false;
+ m_connectScript = "";
+
+ m_useCrypto = false;
+ m_cryptoMode = Open;
+ m_activeKey = 1;
+ for (int i=0; i<4; i++)
+ m_keys[ i ].setKey( "" );
+
+ m_pmEnabled = false;
+ m_pmMode = AllPackets;
+ m_sleepTimeout = 1;
+ m_wakeupPeriod = 1;
+
+ speedList << "Auto" << "1M" << "2M" << "5.5M" << "6M" << "9M" << "11M" << "12M" << "18M" << "24M" << "36M" << "48M" << "54M";
+ wifiModeList << "Ad-Hoc" << "Managed" << "Repeater"
+ << "Master" << "Secondary";
+ cryptoModeList << "Open" << "Restricted";
+ powerModeList << "All" << "UnicastOnly" << "MulticastOnly";
+}
+
+void IfConfig::load( KConfig *config, int i )
+{
+ QString entry;
+
+ QString group = QString( "Configuration %1" ).arg( i+1 );
+ config->setGroup( group );
+
+ m_networkName = config->readEntry( "NetworkName" );
+ m_interface = config->readEntry( "InterfaceName" );
+
+ entry = config->readEntry( "WifiMode", "Managed" );
+ wifimodeFromString( entry );
+ entry = config->readEntry( "Speed", "Auto" );
+ speedFromString( entry );
+ m_runScript = config->readBoolEntry( "RunScript", false );
+ m_connectScript = config->readEntry( "ScriptName" );
+
+ m_useCrypto = config->readBoolEntry( "UseCrypto", false );
+ entry = config->readEntry( "CryptoMode", "Open" );
+ cryptomodeFromString( entry );
+ m_activeKey = config->readNumEntry( "ActiveKey", 1 );
+ m_keys[ 0 ].setKey( config->readEntry( "Key1" ) );
+ m_keys[ 1 ].setKey( config->readEntry( "Key2" ) );
+ m_keys[ 2 ].setKey( config->readEntry( "Key3" ) );
+ m_keys[ 3 ].setKey( config->readEntry( "Key4" ) );
+
+ m_pmEnabled = config->readBoolEntry( "PMEnabled", false );
+ entry = config->readEntry( "PMMode", "All" );
+ powermodeFromString( entry );
+ m_sleepTimeout = config->readNumEntry( "SleepTimeout", 30 );
+ m_wakeupPeriod = config->readNumEntry( "WakeupPeriod", 20 );
+}
+
+void IfConfig::save( KConfig *config, int i )
+{
+ QString group = QString( "Configuration %1" ).arg( i+1 );
+ config->setGroup( group );
+
+ config->writeEntry( "NetworkName", m_networkName );
+ config->writeEntry( "InterfaceName", m_interface );
+ config->writeEntry( "WifiMode", wifimodeAsString() );
+ config->writeEntry( "Speed", speedAsString() );
+ config->writeEntry( "RunScript", m_runScript );
+ config->writeEntry( "ScriptName", m_connectScript );
+
+ config->writeEntry( "UseCrypto", m_useCrypto );
+ config->writeEntry( "CryptoMode", cryptomodeAsString() );
+ config->writeEntry( "ActiveKey", m_activeKey );
+ config->writeEntry( "Key1", m_keys[ 0 ].key() );
+ config->writeEntry( "Key2", m_keys[ 1 ].key() );
+ config->writeEntry( "Key3", m_keys[ 2 ].key() );
+ config->writeEntry( "Key4", m_keys[ 3 ].key() );
+
+ config->writeEntry( "PMEnabled", m_pmEnabled );
+ config->writeEntry( "PMMode", powermodeAsString() );
+ config->writeEntry( "SleepTimeout", m_sleepTimeout );
+ config->writeEntry( "WakeupPeriod", m_wakeupPeriod );
+}
+
+WifiConfig *WifiConfig::m_instance = 0;
+
+WifiConfig *WifiConfig::instance()
+{
+ if ( m_instance == 0 )
+ m_instance = new WifiConfig();
+
+ return m_instance;
+}
+
+WifiConfig::WifiConfig()
+{
+ //m_config = KGlobal::config();
+ m_config = new KSimpleConfig( "kcmwifirc" );
+
+ load();
+}
+
+WifiConfig::~WifiConfig()
+{
+ delete m_config;
+}
+
+void WifiConfig::load()
+{
+ m_config->setGroup( "General" );
+
+ m_usePreset = m_config->readBoolEntry( "UsePreset", false );
+ m_presetConfig = m_config->readNumEntry( "PresetConfig", 1 )-1;
+ m_numConfigs = m_config->readNumEntry( "NumberConfigs", 4 );
+
+ for ( int i=0; i<m_numConfigs; ++i )
+ {
+ m_ifConfig[ i ].load( m_config, i );
+ }
+}
+
+void WifiConfig::save()
+{
+ m_config->setGroup( "General" );
+
+ m_config->writeEntry( "UsePreset", m_usePreset );
+ m_config->writeEntry( "PresetConfig", m_presetConfig+1 );
+ m_config->writeEntry( "NumberConfigs", m_numConfigs );
+
+ for ( int i=0; i<m_numConfigs; ++i )
+ {
+ m_ifConfig[ i ].save( m_config, i );
+ }
+
+ m_config->sync();
+}
+
+QString WifiConfig::autoDetectInterface()
+{
+ m_detectedInterface.truncate( 0 );
+
+ QFile procFile ( "/proc/net/dev" );
+
+ if ( !procFile.open( IO_ReadOnly ) )
+ {
+ KMessageBox::sorry( 0,
+ i18n( "Unable to autodetect wireless interface." ) );
+ return m_detectedInterface;
+ }
+
+ QStringList list;
+ QString line;
+
+ while ( !procFile.atEnd() )
+ {
+ procFile.readLine( line, 9999 );
+ if ( line.find( ":" ) > 0 )
+ {
+ line.truncate ( line.find( ":" ) );
+ list.append( line.stripWhiteSpace() );
+ }
+ }
+
+ procFile.close();
+
+ if ( list.empty() )
+ {
+ KMessageBox::sorry( 0,
+ i18n( "Unable to autodetect wireless interface." ) );
+ return m_detectedInterface;
+ }
+
+ for ( QStringList::Iterator it = list.begin (); it != list.end (); ++it )
+ {
+ if ( ((*it).contains("wifi"))==0 ) { // if the name is wifiX, ignore
+ KProcIO test;
+ test << "iwconfig";
+ test << *it;
+ connect( &test, SIGNAL( readReady( KProcIO * ) ),
+ this, SLOT( slotTestInterface( KProcIO * ) ) );
+ test.start ( KProcess::Block );
+ }
+ }
+
+ if ( m_detectedInterface.isEmpty() )
+ {
+ KMessageBox::sorry( 0,
+ i18n( "Unable to autodetect wireless interface." ) );
+ return m_detectedInterface;
+ }
+
+ return m_detectedInterface;
+}
+
+void WifiConfig::slotTestInterface( KProcIO *proc )
+{
+ QString output;
+ proc->readln( output );
+ if ( output.find ( "no wireless extensions" ) == -1 )
+ {
+ output.truncate( output.find ( " " ) );
+ m_detectedInterface = output.stripWhiteSpace();
+ }
+}
+
+QString IfConfig::speedAsString()
+{
+ return speedList[ m_speed ];
+}
+
+QString IfConfig::wifimodeAsString()
+{
+ return wifiModeList[ m_wifiMode ];
+}
+
+QString IfConfig::cryptomodeAsString()
+{
+ return cryptoModeList[ m_cryptoMode ];
+}
+
+QString IfConfig::powermodeAsString()
+{
+ return powerModeList[ m_pmMode ];
+}
+
+int IfConfig::activeKeyId()
+{
+ return m_activeKey;
+}
+
+Key IfConfig::activeKey()
+{
+ return m_keys[ m_activeKey-1 ];
+}
+
+IfConfig::Speed IfConfig::convertToSpeedFromString( const QString &s )
+{
+ return ( IfConfig::Speed )speedList.findIndex( s );
+}
+
+void IfConfig::speedFromString( const QString &s )
+{
+ m_speed = convertToSpeedFromString( s );
+}
+
+IfConfig::WifiMode IfConfig::convertToWifiModeFromString( const QString &s )
+{
+ return ( IfConfig::WifiMode )wifiModeList.findIndex( s );
+}
+
+void IfConfig::wifimodeFromString( const QString &s )
+{
+ m_wifiMode = convertToWifiModeFromString( s );
+}
+
+IfConfig::CryptoMode IfConfig::convertToCryptoModeFromString( const QString &s )
+{
+ return ( IfConfig::CryptoMode )cryptoModeList.findIndex( s );
+}
+
+void IfConfig::cryptomodeFromString( const QString &s )
+{
+ m_cryptoMode = convertToCryptoModeFromString( s );
+}
+
+IfConfig::PowerMode IfConfig::convertToPowerModeFromString( const QString &s )
+{
+ return ( IfConfig::PowerMode )powerModeList.findIndex( s );
+}
+
+void IfConfig::powermodeFromString( const QString &s )
+{
+ m_pmMode = convertToPowerModeFromString( s );
+}
+
+#include "wificonfig.moc"
+
diff --git a/wifi/kcmwifi/wificonfig.h b/wifi/kcmwifi/wificonfig.h
new file mode 100644
index 00000000..452732b2
--- /dev/null
+++ b/wifi/kcmwifi/wificonfig.h
@@ -0,0 +1,126 @@
+/*
+ Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef WIFICONFIG_H
+#define WIFICONFIG_H
+
+#include <qstring.h>
+#include <qvaluelist.h>
+
+#include "kcmwifi.h"
+
+class KConfig;
+class KSimpleConfig;
+
+enum KeyStates { EMPTY=0, INVALID=1, HEX_64=2, HEX_128=3, HEX_256=4, STRING_64=5, STRING_128=6, STRING_256=7 };
+
+class Key
+{
+ public:
+ Key( const QString &key );
+ Key();
+
+ QString key() const { return m_key; }
+ static KeyStates isValid( QString keyCandidate );
+ QString rawKey() const;
+
+ void setKey( const QString &key );
+
+ protected:
+ QString m_key;
+};
+
+typedef QValueList<Key> KeyList;
+
+class IfConfig
+{
+ public:
+ IfConfig();
+
+ enum Speed { AUTO=0, M1, M2, M55, M6, M9, M11, M12, M18, M24, M36, M48, M54 };
+ enum WifiMode { AdHoc=0, Managed, Repeater, Master, Secondary };
+ enum PowerMode { AllPackets=0, UnicastOnly, MulticastOnly };
+ enum CryptoMode { Open=0, Restricted };
+
+ void load( KConfig *config, int i );
+ void save( KConfig *config, int i );
+
+ QString speedAsString();
+ QString wifimodeAsString();
+ QString cryptomodeAsString();
+ QString powermodeAsString();
+ int activeKeyId();
+ Key activeKey();
+
+ static Speed convertToSpeedFromString( const QString &s );
+ static WifiMode convertToWifiModeFromString( const QString &s );
+ static PowerMode convertToPowerModeFromString( const QString &s );
+ static CryptoMode convertToCryptoModeFromString( const QString &s );
+
+ void speedFromString( const QString &s );
+ void wifimodeFromString( const QString &s );
+ void powermodeFromString( const QString &s );
+ void cryptomodeFromString( const QString &s );
+
+ QString m_networkName;
+ QString m_interface;
+ WifiMode m_wifiMode;
+ Speed m_speed;
+ bool m_runScript;
+ QString m_connectScript;
+
+ bool m_useCrypto;
+ CryptoMode m_cryptoMode;
+ int m_activeKey;
+ Key m_keys[ 4 ];
+
+ bool m_pmEnabled;
+ PowerMode m_pmMode;
+ int m_sleepTimeout;
+ int m_wakeupPeriod;
+};
+
+class WifiConfig : QObject
+{
+ Q_OBJECT
+ public:
+ static WifiConfig *instance();
+ QString autoDetectInterface();
+ ~WifiConfig();
+
+ void load();
+ void save();
+
+ IfConfig m_ifConfig[ KCMWifi::vendorBase+5 ];
+ bool m_usePreset;
+ int m_presetConfig;
+ int m_numConfigs;
+
+ private slots:
+ void slotTestInterface( KProcIO *proc );
+
+ private:
+ WifiConfig();
+
+ KSimpleConfig *m_config;
+ static WifiConfig *m_instance;
+ QString m_detectedInterface;
+};
+
+#endif // WIFICONFIG_H