summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/wlan/wlan.ui572
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.cpp235
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.h27
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.cpp85
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.h38
-rw-r--r--noncore/net/networksetup/wlan/wlansetup.pro12
-rw-r--r--noncore/settings/networksettings/wlan/wlan.ui572
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp235
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.h27
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp85
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.h38
-rw-r--r--noncore/settings/networksettings/wlan/wlansetup.pro12
12 files changed, 1938 insertions, 0 deletions
diff --git a/noncore/net/networksetup/wlan/wlan.ui b/noncore/net/networksetup/wlan/wlan.ui
new file mode 100644
index 0000000..dcacbe8
--- a/dev/null
+++ b/noncore/net/networksetup/wlan/wlan.ui
@@ -0,0 +1,572 @@
+<!DOCTYPE UI><UI>
+<class>WLAN</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>WLAN</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>254</width>
+ <height>286</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Wireless LAN Setting</string>
+ </property>
+ <property stdset="1">
+ <name>sizeGripEnabled</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QTabWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tabWidget</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ConfigPage</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Config</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup45</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>ESS ID</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>essNon</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Non-Spec ESSID: "ANY"</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>essSpecific</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Specific ESSID</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>essSpecificLineEdit</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup46</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Network Type</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" rowspan="1" colspan="3" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>networkInfrastructure</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Infrastructure</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Channel</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" rowspan="1" colspan="2" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>network802</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>802.11 Ad-Hoc</string>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>networkChannel</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ </widget>
+ <spacer row="2" column="2" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer32</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer31</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>WepPage</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Wep</string>
+ </attribute>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="2" column="0" rowspan="1" colspan="2" >
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup44</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Key Setting</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyLineEdit0</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyLineEdit1</cstring>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyLineEdit2</cstring>
+ </property>
+ </widget>
+ <widget row="3" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyLineEdit3</cstring>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyRadio0</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Key 1</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyRadio1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Key 2</string>
+ </property>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyRadio2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Key 3</string>
+ </property>
+ </widget>
+ <widget row="3" column="0" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyRadio3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Key 4</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup42</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Key Length</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>key40</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>40 Bits</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>key128</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>128 Bits</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup43</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Authentication Type</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>authOpen</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Open System</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>authShared</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Shared Key</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer row="3" column="1" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer30</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget row="0" column="0" rowspan="1" colspan="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>wepEnabled</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable Wep</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>essSpecific</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>essSpecificLineEdit</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>network802</sender>
+ <signal>clicked()</signal>
+ <receiver>essSpecific</receiver>
+ <slot>animateClick()</slot>
+ </connection>
+ <connection>
+ <sender>network802</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>TextLabel2</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>network802</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>networkChannel</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>wepEnabled</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>ButtonGroup42</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>wepEnabled</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>ButtonGroup43</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>wepEnabled</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>ButtonGroup44</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tabWidget</tabstop>
+ <tabstop>essNon</tabstop>
+ <tabstop>essSpecificLineEdit</tabstop>
+ <tabstop>networkInfrastructure</tabstop>
+ <tabstop>networkChannel</tabstop>
+ <tabstop>key40</tabstop>
+ <tabstop>key128</tabstop>
+ <tabstop>authOpen</tabstop>
+ <tabstop>authShared</tabstop>
+ <tabstop>keyRadio0</tabstop>
+ <tabstop>keyLineEdit0</tabstop>
+ <tabstop>keyRadio1</tabstop>
+ <tabstop>keyLineEdit1</tabstop>
+ <tabstop>keyRadio2</tabstop>
+ <tabstop>keyLineEdit2</tabstop>
+ <tabstop>keyRadio3</tabstop>
+ <tabstop>keyLineEdit3</tabstop>
+</tabstops>
+</UI>
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp
new file mode 100644
index 0000000..60ffeeb
--- a/dev/null
+++ b/noncore/net/networksetup/wlan/wlanimp.cpp
@@ -0,0 +1,235 @@
+#include "wlanimp.h"
+
+/* Config class */
+#include <qpe/config.h>
+/* Global namespace */
+#include <qpe/global.h>
+/* system() */
+#include <stdlib.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <qtextstream.h>
+#include <qmessagebox.h>
+#include <qlineedit.h>
+#include <qspinbox.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qregexp.h>
+
+WLANImp::WLANImp( Config &cfg, QWidget* parent, const char* name):WLAN(parent, name),config(cfg){
+ readConfig();
+}
+
+void WLANImp::readConfig()
+{
+ qWarning( "WLANImp::readConfig() called." );
+ config.setGroup( "Properties" );
+ QString ssid = config.readEntry( "SSID", "any" );
+ if( ssid == "any" || ssid == "ANY" ){
+ essNon->setChecked( TRUE );
+ } else {
+ essSpecific->setChecked( TRUE );
+ essSpecificLineEdit->setText( ssid );
+ }
+ QString mode = config.readEntry( "Mode", "Managed" );
+ if( mode == "adhoc" ) {
+ network802->setChecked( TRUE );
+ } else {
+ networkInfrastructure->setChecked( TRUE );
+ }
+ networkChannel->setValue( config.readNumEntry( "CHANNEL", 1 ) );
+// config.readEntry( "RATE", "auto" );
+ config.readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( TRUE ) : wepEnabled->setChecked( FALSE );
+ config.readEntry( "AuthType", "opensystem" );
+ config.readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( TRUE ) : key128->setChecked( TRUE );
+ int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 );
+ switch( defaultkey ){
+ case 0:
+ keyRadio0->setChecked( TRUE );
+ break;
+ case 1:
+ keyRadio1->setChecked( TRUE );
+ break;
+ case 2:
+ keyRadio2->setChecked( TRUE );
+ break;
+ case 3:
+ keyRadio3->setChecked( TRUE );
+ break;
+ }
+ keyLineEdit0->setText(config.readEntry( "dot11WEPDefaultKey0" ));
+ keyLineEdit1->setText(config.readEntry( "dot11WEPDefaultKey1" ));
+ keyLineEdit2->setText(config.readEntry( "dot11WEPDefaultKey2" ));
+ keyLineEdit3->setText(config.readEntry( "dot11WEPDefaultKey3" ));
+ return;
+}
+
+bool WLANImp::writeConfig()
+{
+ qWarning( "WLANImp::writeConfig() called." );
+ config.setGroup( "Properties" );
+ if( essNon->isChecked() ) {
+ config.writeEntry( "SSID", "any" );
+ } else {
+ config.writeEntry( "SSID", essSpecificLineEdit->text() );
+ }
+ if( networkInfrastructure->isChecked() ){
+ config.writeEntry( "Mode", "Managed" );
+ } else if( network802->isChecked() ){
+ config.writeEntry( "Mode", "adhoc" );
+ }
+ config.writeEntry( "CHANNEL", networkChannel->value() );
+// config.readEntry( "RATE", "auto" );
+ wepEnabled->isChecked() ? config.writeEntry( "dot11PrivacyInvoked", "true" ) : config.writeEntry( "dot11PrivacyInvoked", "false" );
+ authOpen->isChecked() ? config.writeEntry( "AuthType", "opensystem" ) : config.writeEntry( "AuthType", "sharedkey" );
+ key40->isChecked() ? config.writeEntry( "PRIV_KEY128", "false" ) : config.writeEntry( "PRIV_KEY128", "true" );
+ if( keyRadio0->isChecked() ){
+ config.writeEntry( "dot11WEPDefaultKeyID", 0 );
+ } else if( keyRadio1->isChecked() ){
+ config.writeEntry( "dot11WEPDefaultKeyID", 1 );
+ } else if( keyRadio2->isChecked() ){
+ config.writeEntry( "dot11WEPDefaultKeyID", 2 );
+ } else if( keyRadio3->isChecked() ){
+ config.writeEntry( "dot11WEPDefaultKeyID", 3 );
+ }
+ config.writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() );
+ config.writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() );
+ config.writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() );
+ config.writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() );
+ return writeWirelessOpts( config );
+// return TRUE;
+}
+
+/**
+ */
+void WLANImp::accept()
+{
+ if ( writeConfig() )
+ QDialog::accept();
+}
+
+void WLANImp::done ( int r )
+{
+ QDialog::done ( r );
+ close ( );
+}
+
+bool WLANImp::writeWirelessOpts( Config &config, QString scheme )
+{
+ qWarning( "WLANImp::writeWirelessOpts entered." );
+ QString prev = "/etc/pcmcia/wireless.opts";
+ QFile prevFile(prev);
+ if ( !prevFile.open( IO_ReadOnly ) )
+ return FALSE;
+
+ QString tmp = "/etc/pcmcia/wireless.opts-qpe-new";
+ QFile tmpFile(tmp);
+ if ( !tmpFile.open( IO_WriteOnly ) )
+ return FALSE;
+
+ bool retval = TRUE;
+
+ QTextStream in( &prevFile );
+ QTextStream out( &tmpFile );
+
+ config.setGroup("Properties");
+
+ QString line;
+ bool found=FALSE;
+ bool done=FALSE;
+ while ( !in.atEnd() ) {
+ QString line = in.readLine();
+ QString wline = line.simplifyWhiteSpace();
+ if ( !done ) {
+ if ( found ) {
+ // skip existing entry for this scheme, and write our own.
+ if ( wline == ";;" ) {
+ found = FALSE;
+ continue;
+ } else {
+ continue;
+ }
+ } else {
+ if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) {
+ found=TRUE;
+ continue; // skip this line
+ } else if ( wline == "esac" || wline == "*,*,*,*)" ) {
+ // end - add new entry
+ // Not all fields have a GUI, but all are supported
+ // in the letwork configuration files.
+ static const char* txtfields[] = {
+ 0
+ };
+ QString readmode = config.readEntry( "Mode", "Managed" );
+ QString mode;
+ if( readmode == "Managed" ){
+ mode = readmode;
+ } else if( readmode == "adhoc" ){
+ mode = "Ad-Hoc";
+ }
+ QString key;
+ if( wepEnabled->isChecked() ){
+ int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 );
+ switch( defaultkey ){
+ case 0:
+ key += keyLineEdit0->text();
+ break;
+ case 1:
+ key += keyLineEdit1->text();
+ break;
+ case 2:
+ key += keyLineEdit2->text();
+ break;
+ case 3:
+ key += keyLineEdit3->text();
+ break;
+ }
+ if( config.readEntry( "AuthType", "opensystem" ) == "opensystem")
+ key += " open";
+ }
+ out << scheme << ",*,*,*)" << "\n"
+ << " ESSID=" << Global::shellQuote( config.readEntry( "SSID", "any" ) ) << "\n"
+ << " MODE=" << mode << "\n"
+ << " KEY=" << Global::shellQuote( key ) << "\n"
+ << " RATE=" << "auto" << "\n"
+ ;
+ if( mode != "Managed" )
+ out << " CHANNEL=" << config.readNumEntry( "CHANNEL", 1 ) << "\n";
+ const char** f = txtfields;
+ while (*f) {
+ out << " " << *f << "=" << config.readEntry(*f,"") << "\n";
+ ++f;
+ }
+ out << " ;;\n";
+ done = TRUE;
+ }
+ }
+ }
+ out << line << "\n";
+ }
+
+ prevFile.close();
+ tmpFile.close();
+ QString initpath;
+ //system("cardctl suspend");
+ if( QDir("/etc/rc.d/init.d").exists() ){
+ initpath = "/etc/rc.d/init.d";
+ } else if( QDir("/etc/init.d").exists() ){
+ initpath = "/etc/init.d";
+ }
+ if( initpath )
+ system(QString("%1/pcmcia stop").arg(initpath));
+
+ if( system( "mv " + tmp + " " + prev ) )
+ retval = FALSE;
+//#ifdef USE_SCHEMES
+// if ( retval )
+// SchemeChanger::changeScheme(scheme);
+//#endif
+
+ //system("cardctl resume");
+ if( initpath )
+ system(QString("%1/pcmcia start").arg(initpath));
+
+ return retval;
+}
diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h
new file mode 100644
index 0000000..8e355ce
--- a/dev/null
+++ b/noncore/net/networksetup/wlan/wlanimp.h
@@ -0,0 +1,27 @@
+#ifndef WLANIMP_H
+#define WLANIMP_H
+
+#include "wlan.h"
+
+class Config;
+
+class WLANImp : public WLAN {
+ Q_OBJECT
+
+public:
+ WLANImp( Config& cfg, QWidget* parent = 0, const char* name = 0);
+
+protected:
+ void accept();
+ void done ( int r );
+
+private:
+ void readConfig();
+ bool writeConfig();
+ bool writeWirelessOpts( Config &cfg, QString scheme = "*" );
+ bool writeWlanngOpts( Config &cfg, QString scheme = "*" );
+ Config& config;
+};
+
+#endif
+
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp
new file mode 100644
index 0000000..632f7e4
--- a/dev/null
+++ b/noncore/net/networksetup/wlan/wlanmodule.cpp
@@ -0,0 +1,85 @@
+#include "wlanmodule.h"
+#include <qpe/config.h>
+#include "wlanimp.h"
+
+/**
+ * Constructor, find all of the possible interfaces
+ */
+WLANModule::WLANModule() : Module() {
+ // get output from iwconfig
+}
+
+/**
+ * get the icon name for this device.
+ * @param Interface* can be used in determining the icon.
+ * @return QString the icon name (minus .png, .gif etc)
+ */
+QString WLANModule::getPixmapName(Interface* ){
+ return "wlan";
+}
+
+/**
+ * Check to see if the interface i is owned by this module.
+ * @return bool true if i is owned by this module, false otherwise.
+ */
+bool WLANModule::isOwner(Interface *i){
+ if(i->getInterfaceName() == "eth0")
+ return true;
+ return false;
+}
+
+/**
+ * Create, set tabWiget and return the WLANConfigure Module
+ * @param tabWidget a pointer to the tab widget that this configure has.
+ * @return QWidget* pointer to the tab widget in this modules configure.
+ */
+QWidget *WLANModule::configure(QTabWidget **tabWidget){
+ Config cfg("wireless");
+ WLANImp *wlanconfig = new WLANImp(cfg);
+ (*tabWidget) = wlanconfig->tabWidget;
+ return wlanconfig;
+}
+
+/**
+ * Create, set tabWiget and return the Information Module
+ * @param tabWidget a pointer to the tab widget that this information has.
+ * @return QWidget* pointer to the tab widget in this modules info.
+ */
+QWidget *WLANModule::information(QTabWidget **tabWidget){
+ return NULL;
+}
+
+/**
+ *
+ */
+QList<Interface> WLANModule::getInterfaces(){
+ return list
+}
+
+/**
+ * Return a list of possible new interfaces
+ */
+QMap<QString, QString> WLANModule::possibleNewInterfaces(){
+ //return list;
+}
+
+/**
+ * Attempt to add a new interface as defined by name
+ * @param name the name of the type of interface that should be created given
+ * by possibleNewInterfaces();
+ * @return Interface* NULL if it was unable to be created.
+ */
+Interface *WLANModule::addNewInterface(QString name){
+ return NULL;
+}
+
+/**
+ * Attempts to remove the interface, doesn't delete i
+ * @return bool true if successfull, false otherwise.
+ */
+bool WLANModule::remove(Interface* i){
+ return false;
+}
+
+// wlanmodule.cpp
+
diff --git a/noncore/net/networksetup/wlan/wlanmodule.h b/noncore/net/networksetup/wlan/wlanmodule.h
new file mode 100644
index 0000000..1fbf6a9
--- a/dev/null
+++ b/noncore/net/networksetup/wlan/wlanmodule.h
@@ -0,0 +1,38 @@
+#ifndef WLAN_MODULE_H
+#define WLAN_MODULE_H
+
+#include "module.h"
+
+class WLANModule : Module{
+
+signals:
+ void updateInterface(Interface *i);
+
+public:
+ WLANModule();
+
+ virtual bool isOwner(Interface *);
+ virtual QWidget *configure(QTabWidget **tabWidget);
+ virtual QWidget *information(QTabWidget **tabWidget);
+ virtual QList<Interface> getInterfaces();
+ virtual QMap<QString, QString> possibleNewInterfaces();
+ virtual Interface *addNewInterface(QString name);
+ virtual bool remove(Interface* i);
+ virtual QString getPixmapName(Interface* i);
+
+private:
+ QList<Interface> list;
+
+};
+
+extern "C"
+{
+ void* create_plugin() {
+ return new WLANModule();
+ }
+};
+
+#endif
+
+// wlanmodule.h
+
diff --git a/noncore/net/networksetup/wlan/wlansetup.pro b/noncore/net/networksetup/wlan/wlansetup.pro
new file mode 100644
index 0000000..7102adb
--- a/dev/null
+++ b/noncore/net/networksetup/wlan/wlansetup.pro
@@ -0,0 +1,12 @@
+TEMPLATE = lib
+CONFIG += qt warn_on release
+#CONFIG += qt warn_on debug
+#DESTDIR = $(OPIEDIR)/bin
+HEADERS = wlanimp.h wlanmodule.h
+SOURCES = wlanimp.cpp wlanmodule.cpp
+INCLUDEPATH += $(OPIEDIR)/include ../
+DEPENDPATH += $(OPIEDIR)/include
+LIBS += -lqpe
+INTERFACES = wlan.ui
+TARGET = wlanplugin
+VERSION = 1.0.0
diff --git a/noncore/settings/networksettings/wlan/wlan.ui b/noncore/settings/networksettings/wlan/wlan.ui
new file mode 100644
index 0000000..dcacbe8
--- a/dev/null
+++ b/noncore/settings/networksettings/wlan/wlan.ui
@@ -0,0 +1,572 @@
+<!DOCTYPE UI><UI>
+<class>WLAN</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>WLAN</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>254</width>
+ <height>286</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Wireless LAN Setting</string>
+ </property>
+ <property stdset="1">
+ <name>sizeGripEnabled</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QTabWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tabWidget</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ConfigPage</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Config</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup45</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>ESS ID</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>essNon</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Non-Spec ESSID: "ANY"</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>essSpecific</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Specific ESSID</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>essSpecificLineEdit</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup46</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Network Type</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" rowspan="1" colspan="3" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>networkInfrastructure</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Infrastructure</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Channel</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" rowspan="1" colspan="2" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>network802</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>802.11 Ad-Hoc</string>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>networkChannel</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ </widget>
+ <spacer row="2" column="2" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer32</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer31</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>WepPage</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Wep</string>
+ </attribute>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="2" column="0" rowspan="1" colspan="2" >
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup44</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Key Setting</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyLineEdit0</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyLineEdit1</cstring>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyLineEdit2</cstring>
+ </property>
+ </widget>
+ <widget row="3" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyLineEdit3</cstring>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyRadio0</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Key 1</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyRadio1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Key 2</string>
+ </property>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyRadio2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Key 3</string>
+ </property>
+ </widget>
+ <widget row="3" column="0" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>keyRadio3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Key 4</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup42</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Key Length</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>key40</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>40 Bits</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>key128</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>128 Bits</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup43</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Authentication Type</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>authOpen</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Open System</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>authShared</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Shared Key</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer row="3" column="1" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer30</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget row="0" column="0" rowspan="1" colspan="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>wepEnabled</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable Wep</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>essSpecific</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>essSpecificLineEdit</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>network802</sender>
+ <signal>clicked()</signal>
+ <receiver>essSpecific</receiver>
+ <slot>animateClick()</slot>
+ </connection>
+ <connection>
+ <sender>network802</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>TextLabel2</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>network802</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>networkChannel</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>wepEnabled</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>ButtonGroup42</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>wepEnabled</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>ButtonGroup43</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>wepEnabled</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>ButtonGroup44</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tabWidget</tabstop>
+ <tabstop>essNon</tabstop>
+ <tabstop>essSpecificLineEdit</tabstop>
+ <tabstop>networkInfrastructure</tabstop>
+ <tabstop>networkChannel</tabstop>
+ <tabstop>key40</tabstop>
+ <tabstop>key128</tabstop>
+ <tabstop>authOpen</tabstop>
+ <tabstop>authShared</tabstop>
+ <tabstop>keyRadio0</tabstop>
+ <tabstop>keyLineEdit0</tabstop>
+ <tabstop>keyRadio1</tabstop>
+ <tabstop>keyLineEdit1</tabstop>
+ <tabstop>keyRadio2</tabstop>
+ <tabstop>keyLineEdit2</tabstop>
+ <tabstop>keyRadio3</tabstop>
+ <tabstop>keyLineEdit3</tabstop>
+</tabstops>
+</UI>
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp
new file mode 100644
index 0000000..60ffeeb
--- a/dev/null
+++ b/noncore/settings/networksettings/wlan/wlanimp.cpp
@@ -0,0 +1,235 @@
+#include "wlanimp.h"
+
+/* Config class */
+#include <qpe/config.h>
+/* Global namespace */
+#include <qpe/global.h>
+/* system() */
+#include <stdlib.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <qtextstream.h>
+#include <qmessagebox.h>
+#include <qlineedit.h>
+#include <qspinbox.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qregexp.h>
+
+WLANImp::WLANImp( Config &cfg, QWidget* parent, const char* name):WLAN(parent, name),config(cfg){
+ readConfig();
+}
+
+void WLANImp::readConfig()
+{
+ qWarning( "WLANImp::readConfig() called." );
+ config.setGroup( "Properties" );
+ QString ssid = config.readEntry( "SSID", "any" );
+ if( ssid == "any" || ssid == "ANY" ){
+ essNon->setChecked( TRUE );
+ } else {
+ essSpecific->setChecked( TRUE );
+ essSpecificLineEdit->setText( ssid );
+ }
+ QString mode = config.readEntry( "Mode", "Managed" );
+ if( mode == "adhoc" ) {
+ network802->setChecked( TRUE );
+ } else {
+ networkInfrastructure->setChecked( TRUE );
+ }
+ networkChannel->setValue( config.readNumEntry( "CHANNEL", 1 ) );
+// config.readEntry( "RATE", "auto" );
+ config.readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( TRUE ) : wepEnabled->setChecked( FALSE );
+ config.readEntry( "AuthType", "opensystem" );
+ config.readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( TRUE ) : key128->setChecked( TRUE );
+ int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 );
+ switch( defaultkey ){
+ case 0:
+ keyRadio0->setChecked( TRUE );
+ break;
+ case 1:
+ keyRadio1->setChecked( TRUE );
+ break;
+ case 2:
+ keyRadio2->setChecked( TRUE );
+ break;
+ case 3:
+ keyRadio3->setChecked( TRUE );
+ break;
+ }
+ keyLineEdit0->setText(config.readEntry( "dot11WEPDefaultKey0" ));
+ keyLineEdit1->setText(config.readEntry( "dot11WEPDefaultKey1" ));
+ keyLineEdit2->setText(config.readEntry( "dot11WEPDefaultKey2" ));
+ keyLineEdit3->setText(config.readEntry( "dot11WEPDefaultKey3" ));
+ return;
+}
+
+bool WLANImp::writeConfig()
+{
+ qWarning( "WLANImp::writeConfig() called." );
+ config.setGroup( "Properties" );
+ if( essNon->isChecked() ) {
+ config.writeEntry( "SSID", "any" );
+ } else {
+ config.writeEntry( "SSID", essSpecificLineEdit->text() );
+ }
+ if( networkInfrastructure->isChecked() ){
+ config.writeEntry( "Mode", "Managed" );
+ } else if( network802->isChecked() ){
+ config.writeEntry( "Mode", "adhoc" );
+ }
+ config.writeEntry( "CHANNEL", networkChannel->value() );
+// config.readEntry( "RATE", "auto" );
+ wepEnabled->isChecked() ? config.writeEntry( "dot11PrivacyInvoked", "true" ) : config.writeEntry( "dot11PrivacyInvoked", "false" );
+ authOpen->isChecked() ? config.writeEntry( "AuthType", "opensystem" ) : config.writeEntry( "AuthType", "sharedkey" );
+ key40->isChecked() ? config.writeEntry( "PRIV_KEY128", "false" ) : config.writeEntry( "PRIV_KEY128", "true" );
+ if( keyRadio0->isChecked() ){
+ config.writeEntry( "dot11WEPDefaultKeyID", 0 );
+ } else if( keyRadio1->isChecked() ){
+ config.writeEntry( "dot11WEPDefaultKeyID", 1 );
+ } else if( keyRadio2->isChecked() ){
+ config.writeEntry( "dot11WEPDefaultKeyID", 2 );
+ } else if( keyRadio3->isChecked() ){
+ config.writeEntry( "dot11WEPDefaultKeyID", 3 );
+ }
+ config.writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() );
+ config.writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() );
+ config.writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() );
+ config.writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() );
+ return writeWirelessOpts( config );
+// return TRUE;
+}
+
+/**
+ */
+void WLANImp::accept()
+{
+ if ( writeConfig() )
+ QDialog::accept();
+}
+
+void WLANImp::done ( int r )
+{
+ QDialog::done ( r );
+ close ( );
+}
+
+bool WLANImp::writeWirelessOpts( Config &config, QString scheme )
+{
+ qWarning( "WLANImp::writeWirelessOpts entered." );
+ QString prev = "/etc/pcmcia/wireless.opts";
+ QFile prevFile(prev);
+ if ( !prevFile.open( IO_ReadOnly ) )
+ return FALSE;
+
+ QString tmp = "/etc/pcmcia/wireless.opts-qpe-new";
+ QFile tmpFile(tmp);
+ if ( !tmpFile.open( IO_WriteOnly ) )
+ return FALSE;
+
+ bool retval = TRUE;
+
+ QTextStream in( &prevFile );
+ QTextStream out( &tmpFile );
+
+ config.setGroup("Properties");
+
+ QString line;
+ bool found=FALSE;
+ bool done=FALSE;
+ while ( !in.atEnd() ) {
+ QString line = in.readLine();
+ QString wline = line.simplifyWhiteSpace();
+ if ( !done ) {
+ if ( found ) {
+ // skip existing entry for this scheme, and write our own.
+ if ( wline == ";;" ) {
+ found = FALSE;
+ continue;
+ } else {
+ continue;
+ }
+ } else {
+ if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) {
+ found=TRUE;
+ continue; // skip this line
+ } else if ( wline == "esac" || wline == "*,*,*,*)" ) {
+ // end - add new entry
+ // Not all fields have a GUI, but all are supported
+ // in the letwork configuration files.
+ static const char* txtfields[] = {
+ 0
+ };
+ QString readmode = config.readEntry( "Mode", "Managed" );
+ QString mode;
+ if( readmode == "Managed" ){
+ mode = readmode;
+ } else if( readmode == "adhoc" ){
+ mode = "Ad-Hoc";
+ }
+ QString key;
+ if( wepEnabled->isChecked() ){
+ int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 );
+ switch( defaultkey ){
+ case 0:
+ key += keyLineEdit0->text();
+ break;
+ case 1:
+ key += keyLineEdit1->text();
+ break;
+ case 2:
+ key += keyLineEdit2->text();
+ break;
+ case 3:
+ key += keyLineEdit3->text();
+ break;
+ }
+ if( config.readEntry( "AuthType", "opensystem" ) == "opensystem")
+ key += " open";
+ }
+ out << scheme << ",*,*,*)" << "\n"
+ << " ESSID=" << Global::shellQuote( config.readEntry( "SSID", "any" ) ) << "\n"
+ << " MODE=" << mode << "\n"
+ << " KEY=" << Global::shellQuote( key ) << "\n"
+ << " RATE=" << "auto" << "\n"
+ ;
+ if( mode != "Managed" )
+ out << " CHANNEL=" << config.readNumEntry( "CHANNEL", 1 ) << "\n";
+ const char** f = txtfields;
+ while (*f) {
+ out << " " << *f << "=" << config.readEntry(*f,"") << "\n";
+ ++f;
+ }
+ out << " ;;\n";
+ done = TRUE;
+ }
+ }
+ }
+ out << line << "\n";
+ }
+
+ prevFile.close();
+ tmpFile.close();
+ QString initpath;
+ //system("cardctl suspend");
+ if( QDir("/etc/rc.d/init.d").exists() ){
+ initpath = "/etc/rc.d/init.d";
+ } else if( QDir("/etc/init.d").exists() ){
+ initpath = "/etc/init.d";
+ }
+ if( initpath )
+ system(QString("%1/pcmcia stop").arg(initpath));
+
+ if( system( "mv " + tmp + " " + prev ) )
+ retval = FALSE;
+//#ifdef USE_SCHEMES
+// if ( retval )
+// SchemeChanger::changeScheme(scheme);
+//#endif
+
+ //system("cardctl resume");
+ if( initpath )
+ system(QString("%1/pcmcia start").arg(initpath));
+
+ return retval;
+}
diff --git a/noncore/settings/networksettings/wlan/wlanimp.h b/noncore/settings/networksettings/wlan/wlanimp.h
new file mode 100644
index 0000000..8e355ce
--- a/dev/null
+++ b/noncore/settings/networksettings/wlan/wlanimp.h
@@ -0,0 +1,27 @@
+#ifndef WLANIMP_H
+#define WLANIMP_H
+
+#include "wlan.h"
+
+class Config;
+
+class WLANImp : public WLAN {
+ Q_OBJECT
+
+public:
+ WLANImp( Config& cfg, QWidget* parent = 0, const char* name = 0);
+
+protected:
+ void accept();
+ void done ( int r );
+
+private:
+ void readConfig();
+ bool writeConfig();
+ bool writeWirelessOpts( Config &cfg, QString scheme = "*" );
+ bool writeWlanngOpts( Config &cfg, QString scheme = "*" );
+ Config& config;
+};
+
+#endif
+
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
new file mode 100644
index 0000000..632f7e4
--- a/dev/null
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -0,0 +1,85 @@
+#include "wlanmodule.h"
+#include <qpe/config.h>
+#include "wlanimp.h"
+
+/**
+ * Constructor, find all of the possible interfaces
+ */
+WLANModule::WLANModule() : Module() {
+ // get output from iwconfig
+}
+
+/**
+ * get the icon name for this device.
+ * @param Interface* can be used in determining the icon.
+ * @return QString the icon name (minus .png, .gif etc)
+ */
+QString WLANModule::getPixmapName(Interface* ){
+ return "wlan";
+}
+
+/**
+ * Check to see if the interface i is owned by this module.
+ * @return bool true if i is owned by this module, false otherwise.
+ */
+bool WLANModule::isOwner(Interface *i){
+ if(i->getInterfaceName() == "eth0")
+ return true;
+ return false;
+}
+
+/**
+ * Create, set tabWiget and return the WLANConfigure Module
+ * @param tabWidget a pointer to the tab widget that this configure has.
+ * @return QWidget* pointer to the tab widget in this modules configure.
+ */
+QWidget *WLANModule::configure(QTabWidget **tabWidget){
+ Config cfg("wireless");
+ WLANImp *wlanconfig = new WLANImp(cfg);
+ (*tabWidget) = wlanconfig->tabWidget;
+ return wlanconfig;
+}
+
+/**
+ * Create, set tabWiget and return the Information Module
+ * @param tabWidget a pointer to the tab widget that this information has.
+ * @return QWidget* pointer to the tab widget in this modules info.
+ */
+QWidget *WLANModule::information(QTabWidget **tabWidget){
+ return NULL;
+}
+
+/**
+ *
+ */
+QList<Interface> WLANModule::getInterfaces(){
+ return list
+}
+
+/**
+ * Return a list of possible new interfaces
+ */
+QMap<QString, QString> WLANModule::possibleNewInterfaces(){
+ //return list;
+}
+
+/**
+ * Attempt to add a new interface as defined by name
+ * @param name the name of the type of interface that should be created given
+ * by possibleNewInterfaces();
+ * @return Interface* NULL if it was unable to be created.
+ */
+Interface *WLANModule::addNewInterface(QString name){
+ return NULL;
+}
+
+/**
+ * Attempts to remove the interface, doesn't delete i
+ * @return bool true if successfull, false otherwise.
+ */
+bool WLANModule::remove(Interface* i){
+ return false;
+}
+
+// wlanmodule.cpp
+
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.h b/noncore/settings/networksettings/wlan/wlanmodule.h
new file mode 100644
index 0000000..1fbf6a9
--- a/dev/null
+++ b/noncore/settings/networksettings/wlan/wlanmodule.h
@@ -0,0 +1,38 @@
+#ifndef WLAN_MODULE_H
+#define WLAN_MODULE_H
+
+#include "module.h"
+
+class WLANModule : Module{
+
+signals:
+ void updateInterface(Interface *i);
+
+public:
+ WLANModule();
+
+ virtual bool isOwner(Interface *);
+ virtual QWidget *configure(QTabWidget **tabWidget);
+ virtual QWidget *information(QTabWidget **tabWidget);
+ virtual QList<Interface> getInterfaces();
+ virtual QMap<QString, QString> possibleNewInterfaces();
+ virtual Interface *addNewInterface(QString name);
+ virtual bool remove(Interface* i);
+ virtual QString getPixmapName(Interface* i);
+
+private:
+ QList<Interface> list;
+
+};
+
+extern "C"
+{
+ void* create_plugin() {
+ return new WLANModule();
+ }
+};
+
+#endif
+
+// wlanmodule.h
+
diff --git a/noncore/settings/networksettings/wlan/wlansetup.pro b/noncore/settings/networksettings/wlan/wlansetup.pro
new file mode 100644
index 0000000..7102adb
--- a/dev/null
+++ b/noncore/settings/networksettings/wlan/wlansetup.pro
@@ -0,0 +1,12 @@
+TEMPLATE = lib
+CONFIG += qt warn_on release
+#CONFIG += qt warn_on debug
+#DESTDIR = $(OPIEDIR)/bin
+HEADERS = wlanimp.h wlanmodule.h
+SOURCES = wlanimp.cpp wlanmodule.cpp
+INCLUDEPATH += $(OPIEDIR)/include ../
+DEPENDPATH += $(OPIEDIR)/include
+LIBS += -lqpe
+INTERFACES = wlan.ui
+TARGET = wlanplugin
+VERSION = 1.0.0