summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/wlan/config.in4
-rw-r--r--noncore/settings/networksettings/wlan/opie-networksettingsplugin-wlan.control2
-rw-r--r--noncore/settings/networksettings/wlan/wlan.pro2
-rw-r--r--noncore/settings/networksettings/wlan/wlan.ui658
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp216
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.h21
-rw-r--r--pics/networksettings/adhoc.pngbin0 -> 694 bytes
-rw-r--r--pics/networksettings/managed.pngbin0 -> 410 bytes
9 files changed, 577 insertions, 328 deletions
diff --git a/noncore/settings/networksettings/wlan/config.in b/noncore/settings/networksettings/wlan/config.in
index 53bcb1e..e459788 100644
--- a/noncore/settings/networksettings/wlan/config.in
+++ b/noncore/settings/networksettings/wlan/config.in
@@ -1,4 +1,6 @@
config WLAN
boolean "opie-networksettingsplugin-wlan (wireless LAN module)"
default "n" if NETWORKSETUP
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES && LIBOPIE2NET
+ #comment "opie-networksettingsplugin-wlan needs libopie, libopie2net and networksetup"
+ #depends !( LIBOPIE2NET && LIBOPIE && NETWORKSETUP) \ No newline at end of file
diff --git a/noncore/settings/networksettings/wlan/opie-networksettingsplugin-wlan.control b/noncore/settings/networksettings/wlan/opie-networksettingsplugin-wlan.control
index 719337f..ec3078d 100644
--- a/noncore/settings/networksettings/wlan/opie-networksettingsplugin-wlan.control
+++ b/noncore/settings/networksettings/wlan/opie-networksettingsplugin-wlan.control
@@ -1,10 +1,10 @@
Package: opie-networksettingsplugin-wlan
Files: plugins/networksettings/libwlan.so*
Priority: optional
Section: opie/settings
Maintainer: Patrick S. Vogt <tille@handhelds.org>
Architecture: arm
-Depends: opie-networksettings
+Depends: opie-networksettings, libopie2net (1.8.1)
Description: Network settings wavelan plugin.
Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/settings/networksettings/wlan/wlan.pro b/noncore/settings/networksettings/wlan/wlan.pro
index 552c669..82a5b2f 100644
--- a/noncore/settings/networksettings/wlan/wlan.pro
+++ b/noncore/settings/networksettings/wlan/wlan.pro
@@ -1,28 +1,28 @@
#
TEMPLATE = lib
#TEMPLATE = app
CONFIG += qt warn_on release
#CONFIG += qt warn_on debug
DESTDIR = $(OPIEDIR)/plugins/networksettings
HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h
SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -L../interfaces/ -linterfaces
+LIBS += -lqpe -L../interfaces/ -linterfaces -lopienet2
INTERFACES = wlan.ui info.ui
TARGET = wlan
VERSION = 1.0.0
#CONFIG += wirelessopts
wirelessopts {
HEADERS += wlanimp.h
SOURCES += wlanimp.cpp
}
! wirelessopts {
HEADERS += wlanimp2.h
SOURCES += wlanimp2.cpp
}
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings/wlan/wlan.ui b/noncore/settings/networksettings/wlan/wlan.ui
index 7e39e23..195ead9 100644
--- a/noncore/settings/networksettings/wlan/wlan.ui
+++ b/noncore/settings/networksettings/wlan/wlan.ui
@@ -1,427 +1,445 @@
<!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>247</width>
- <height>299</height>
+ <width>216</width>
+ <height>342</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Wireless Configuration</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>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>ConfigPage</cstring>
</property>
<attribute>
<name>title</name>
<string>General</string>
</attribute>
- <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>
- <widget>
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>modeLabel</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>11</x>
- <y>11</y>
- <width>84</width>
- <height>29</height>
- </rect>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Mode</string>
- </property>
- </widget>
- <widget>
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>essidLabel</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>11</x>
- <y>46</y>
- <width>84</width>
- <height>29</height>
- </rect>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>ESS-ID</string>
- </property>
- </widget>
- <widget>
- <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>geometry</name>
- <rect>
- <x>146</x>
- <y>139</y>
- <width>58</width>
- <height>25</height>
- </rect>
- </property>
- <property stdset="1">
- <name>maxValue</name>
- <number>15</number>
- </property>
- <property stdset="1">
- <name>minValue</name>
- <number>1</number>
- </property>
- <property stdset="1">
- <name>value</name>
- <number>1</number>
- </property>
- </widget>
- <widget>
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>macEdit</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>56</x>
- <y>108</y>
- <width>182</width>
- <height>25</height>
- </rect>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
- </property>
- </widget>
- <widget>
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>macLabel</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>11</x>
- <y>108</y>
- <width>39</width>
- <height>25</height>
- </rect>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>MAC</string>
- </property>
- </widget>
- <widget>
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>specifyAp</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>11</x>
- <y>81</y>
- <width>227</width>
- <height>21</height>
- </rect>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Specify &amp;Access Point</string>
- </property>
- </widget>
- <widget>
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>specifyChan</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>11</x>
- <y>141</y>
- <width>129</width>
- <height>21</height>
- </rect>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Specify &amp;Channel</string>
- </property>
- </widget>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer10</cstring>
- </property>
+ <vbox>
<property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
+ <name>margin</name>
+ <number>3</number>
</property>
<property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
+ <name>spacing</name>
+ <number>2</number>
</property>
- </spacer>
- <widget>
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>any</string>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout1</cstring>
</property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>essid</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>101</x>
- <y>46</y>
- <width>103</width>
- <height>29</height>
- </rect>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>editable</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>currentItem</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>sizeLimit</name>
- <number>5</number>
- </property>
- <property stdset="1">
- <name>autoCompletion</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>duplicatesEnabled</name>
- <bool>false</bool>
- </property>
- </widget>
- <widget>
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>Infrastructure</string>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="1" column="1" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>any</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>essid</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>editable</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>currentItem</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>sizeLimit</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>autoCompletion</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>duplicatesEnabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>essidLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>SSID</string>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Infrastructure</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Auto</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Managed</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Ad-Hoc</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>mode</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>modeLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Mode</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>specifyAp</cstring>
</property>
- </item>
- <item>
- <property>
+ <property stdset="1">
<name>text</name>
- <string>Auto</string>
+ <string>Specify &amp;Access Point</string>
</property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Managed</string>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout3</cstring>
</property>
- </item>
- <item>
- <property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>macLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>MAC</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>macEdit</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>specifyChan</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Specify &amp;Channel</string>
+ </property>
+ </widget>
+ <widget>
+ <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>15</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ <property stdset="1">
+ <name>value</name>
+ <number>1</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rescanButton</cstring>
+ </property>
+ <property stdset="1">
<name>text</name>
- <string>Ad-Hoc</string>
+ <string>Rescan Neighbourhood</string>
</property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>mode</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>101</x>
- <y>11</y>
- <width>103</width>
- <height>29</height>
- </rect>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- </widget>
+ </widget>
+ <widget>
+ <class>QListView</class>
+ <column>
+ <property>
+ <name>text</name>
+ <string></string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property>
+ <name>text</name>
+ <string>SSID</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property>
+ <name>text</name>
+ <string>Chn</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property>
+ <name>text</name>
+ <string>MAC</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>netView</cstring>
+ </property>
+ </widget>
+ </vbox>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>WepPage</cstring>
</property>
<attribute>
<name>title</name>
<string>Encryption</string>
</attribute>
<grid>
<property stdset="1">
<name>margin</name>
- <number>11</number>
+ <number>7</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>3</number>
</property>
<widget row="0" column="0" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>wepEnabled</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Enable Encryption</string>
</property>
</widget>
<widget row="1" column="0" >
<class>QButtonGroup</class>
<property stdset="1">
<name>name</name>
<cstring>KeyButtonGroup</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
<name>title</name>
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp
index 8bf004f..719be1b 100644
--- a/noncore/settings/networksettings/wlan/wlanimp.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp.cpp
@@ -197,48 +197,48 @@ void WLANImp::changeAndSaveSettingFile(){
if(line.contains("esac"))
stream << line << "\n";
}
if(line.contains(";;"))
output = true;
if(output && (*it).length() )
stream << (*it) << '\n';
}
file.close();
}
/**
* Check to see if the current config is valid
* Save wireless.opts, save interfaces
*/
void WLANImp::accept(){
if(wepEnabled->isChecked()){
if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ){
QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok);
return;
}
}
if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){
- QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok);
+ QMessageBox::information(this, "Error", "Please enter a SSID.", QMessageBox::Ok);
return;
}
// Ok settings are good here, save
changeAndSaveSettingFile();
// Try to save the interfaces settings.
if(!interfaceSetup->saveChanges())
return;
OProcess insert;
insert << "sh";
insert << "-c";
insert << "cardctl eject && cardctl insert";
if (!insert.start(OProcess::DontCare, OProcess::NoCommunication) ) {
qWarning("could not start cardctl");
}
// Close out the dialog
QDialog::accept();
}
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index 26e3aa9..7ce096f 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -1,63 +1,85 @@
#include "wlanimp2.h"
#include "keyedit.h"
#include "interfacesetupimp.h"
+#include "../interfaces/interface.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+
+#include <qapplication.h>
#include <qfile.h>
#include <qdir.h>
+#include <qdialog.h>
#include <qtextstream.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qspinbox.h>
#include <qradiobutton.h>
+#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qtabwidget.h>
#include <qcombobox.h>
+#include <qlistview.h>
+#include <qvbox.h>
+#include <qprogressbar.h>
#ifdef QWS
+ #include <qpe/resource.h>
#include <opie/oprocess.h>
+ #include <opie2/onetwork.h>
+ #include <opie2/opcap.h>
#else
#define OProcess KProcess
#include <kprocess.h>
#endif
#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts"
-#define PREUP "/etc/netwrok/if-pre-up.d/wireless-tools"
+#define PREUP "/etc/network/if-pre-up.d/wireless-tools"
/**
* Constructor, read in the wireless.opts file for parsing later.
*/
WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") {
interfaces = new Interfaces();
interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces);
tabWidget->insertTab(interfaceSetup, "TCP/IP");
// Check sanity - the existance of the wireless-tools if-pre-up script
QFile file(QString(PREUP));
if (file.exists()) {
qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools"));
}
+
+ connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) );
+ connect( netView, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectNetwork( QListViewItem* ) ) );
+ netView->setColumnAlignment( col_chn, AlignCenter );
+ netView->setItemMargin( 3 );
+ netView->setAllColumnsShowFocus( true );
+
}
WLANImp::~WLANImp() {
//FIXME: delete interfaces;
}
/**
* Change the profile for both wireless settings and network settings.
*/
void WLANImp::setProfile(const QString &profile){
interfaceSetup->setProfile(profile);
parseOpts();
}
void WLANImp::parseOpts() {
bool error;
QString opt;
if (! interfaces->isInterfaceSet())
return;
opt = interfaces->getInterfaceOption("wireless_essid", error);
if(opt == "any" || opt == "off" || opt.isNull()){
@@ -253,24 +275,216 @@ void WLANImp::writeOpts() {
keyList += "restricted";
}
keyList += "key";
if (keyRadio0->isChecked()) {
keyList += "[1]";
} else if (keyRadio1->isChecked()) {
keyList += "[2]";
} else if (keyRadio2->isChecked()) {
keyList += "[3]";
} else if (keyRadio3->isChecked()) {
keyList += "[4]";
}
interfaces->setInterfaceOption(QString("wireless_key"), keyList.join(QString(" ")));
} else {
interfaces->removeInterfaceOption(QString("wireless_key"));
}
interfaces->removeInterfaceOption(QString("wireless_enc"));
if(!interfaceSetup->saveChanges())
return;
QDialog::accept();
}
+
+/*
+ * Scan for possible wireless networks around...
+ * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org>
+ */
+
+void WLANImp::rescanNeighbourhood()
+{
+ QString name = interface->getInterfaceName();
+ qDebug( "rescanNeighbourhood via '%s'", (const char*) name );
+
+ OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) );
+ assert( wiface );
+
+ // try to guess device type
+ QString devicetype;
+ QFile m( "/proc/modules" );
+ if ( m.open( IO_ReadOnly ) )
+ {
+ QString line;
+ QTextStream modules( &m );
+ while( !modules.atEnd() && !devicetype )
+ {
+ modules >> line;
+ if ( line.contains( "cisco" ) ) devicetype = "cisco";
+ else if ( line.contains( "hostap" ) ) devicetype = "hostap";
+ else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */
+ else if ( line.contains( "orinoco" ) ) devicetype = "orinoco";
+ }
+ }
+ if ( devicetype.isEmpty() )
+ {
+ qWarning( "rescanNeighbourhood(): couldn't guess device type :(" );
+ return;
+ }
+ else
+ {
+ qDebug( "rescanNeighbourhood(): device type seems to be '%s'", (const char*) devicetype );
+ }
+
+ // configure interface to receive 802.11 management frames
+
+ wiface->setUp( true );
+ wiface->setPromiscuousMode( true );
+
+ if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) );
+ else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) );
+ else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) );
+ else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) );
+ else
+ {
+ qDebug( "rescanNeighbourhood(): unsupported device type for monitoring :(" );
+ return;
+ }
+
+ wiface->setMonitorMode( true );
+ if ( !wiface->monitorMode() )
+ {
+ qWarning( "rescanNeighbourhood(): Unable to bring device into monitor mode (%s).", strerror( errno ) );
+ return;
+ }
+
+ // open a packet capturer
+ OPacketCapturer* cap = new OPacketCapturer();
+ cap->open( name );
+ if ( !cap->isOpen() )
+ {
+ qWarning( "rescanNeighbourhood(): Unable to open libpcap (%s).", strerror( errno ) );
+ return;
+ }
+
+ // display splash screen
+ QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize );
+ splash->setLineWidth( 2 );
+ splash->setFrameStyle( QFrame::Panel | QFrame::Raised );
+ QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 );
+ QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash );
+ QProgressBar* pb = new QProgressBar( wiface->channels(), splash );
+ vbox->addWidget( lab );
+ vbox->addWidget( pb );
+ pb->setCenterIndicator( true );
+ pb->setFixedHeight( pb->sizeHint().height() );
+ QWidget* widgetDesktop = qApp->desktop();
+ int dw = widgetDesktop->width();
+ int dh = widgetDesktop->height();
+ int pw = vbox->sizeHint().width();
+ int ph = vbox->sizeHint().height();
+ splash->setGeometry((dw-pw)/2,(dh-ph)/2,pw,ph);
+ splash->show();
+ splash->raise();
+ qApp->processEvents();
+
+ // set capturer to non-blocking mode
+ cap->setBlocking( false );
+
+ for ( int i = 1; i <= wiface->channels(); ++i )
+ {
+ wiface->setChannel( i );
+ pb->setProgress( i );
+ qApp->processEvents();
+ qDebug( "rescanNeighbourhood(): listening on channel %d...", i );
+ OPacket* p = cap->next( 1000 );
+ if ( !p )
+ {
+ qDebug( "rescanNeighbourhood(): nothing received on channel %d", i );
+ }
+ else
+ {
+ qDebug( "rescanNeighbourhood(): TADAA - something came in on channel %d", i );
+ handlePacket( p );
+ }
+ }
+
+ cap->close();
+ wiface->setMonitorMode( false );
+ wiface->setPromiscuousMode( true );
+
+ splash->hide();
+ delete splash;
+
+}
+
+void WLANImp::handlePacket( OPacket* p )
+{
+
+ // check if we received a beacon frame
+ OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
+ if ( beacon && beacon->managementType() == "Beacon" )
+ {
+
+ QString type;
+ if ( beacon->canIBSS() )
+ {
+ type = "adhoc";
+ }
+ else if ( beacon->canESS() )
+ {
+ type = "managed";
+ }
+ else
+ {
+ qWarning( "handlePacket(): invalid frame [possibly noise] detected!" );
+ return;
+ }
+
+ OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
+ QString essid = ssid ? ssid->ID() : QString("<unknown>");
+ OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
+ int channel = ds ? ds->channel() : -1;
+ OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
+ displayFoundNetwork( type, channel, essid, header->macAddress2() );
+ }
+}
+
+
+void WLANImp::displayFoundNetwork( const QString& mode, int channel, const QString& ssid, const OMacAddress& mac )
+{
+
+ qDebug( "found network: <%s>, chn %d, ssid '%s', mac '%s'", (const char*) mode, channel,
+ (const char*) ssid,
+ (const char*) mac.toString() );
+
+ QListViewItemIterator it( netView );
+ while ( it.current() && it.current()->text( col_ssid ) != ssid ) ++it;
+ if ( !it.current() ) // ssid didn't show up yet
+ {
+ QListViewItem* item = new QListViewItem( netView, mode.left( 1 ).upper(), ssid, QString::number( channel ), mac.toString() );
+ QString name;
+ name.sprintf( "networksettings/%s", (const char*) mode );
+ item->setPixmap( col_mode, Resource::loadPixmap( name ) );
+ qApp->processEvents();
+ }
+
+}
+
+
+void WLANImp::selectNetwork( QListViewItem* item )
+{
+ bool ok;
+ if ( item )
+ {
+ specifyAp->setChecked(true);
+ macEdit->setText( item->text( col_mac ) );
+ specifyChan->setChecked( item->text( col_mode ) == "A" );
+ networkChannel->setValue( item->text( col_chn ).toInt( &ok ) );
+ essid->setEditText( item->text( col_ssid ) );
+ if ( item->text( col_mode ) == "A" )
+ mode->setCurrentItem( 3 );
+ else
+ mode->setCurrentItem( 2 );
+ }
+}
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.h b/noncore/settings/networksettings/wlan/wlanimp2.h
index 992d09a..a777203 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.h
+++ b/noncore/settings/networksettings/wlan/wlanimp2.h
@@ -1,37 +1,52 @@
#ifndef WLANIMP_H
#define WLANIMP_H
#include "wlan.h"
#include "interfaces.h"
#include <qstringlist.h>
+#include <opie2/onetutils.h>
class InterfaceSetupImp;
class Interface;
class Config;
+class OPacket;
+class QListViewItem;
-class WLANImp : public WLAN {
+const int col_mode= 0;
+const int col_ssid = 1;
+const int col_chn = 2;
+const int col_mac = 3;
+
+class WLANImp : public WLAN {
Q_OBJECT
public:
WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 );
~WLANImp();
void setProfile(const QString &profile);
+public slots:
+ void rescanNeighbourhood();
+ void selectNetwork( QListViewItem* );
+
protected:
void accept();
private:
void parseOpts();
void writeOpts();
void parseKeyStr(QString keystr);
-
+
+ void handlePacket( OPacket* );
+ void displayFoundNetwork( const QString& mode, int channel, const QString& ssid, const OMacAddress& mac );
+
InterfaceSetupImp *interfaceSetup;
Interfaces *interfaces;
Interface *interface;
QString currentProfile;
};
#endif
-
+
diff --git a/pics/networksettings/adhoc.png b/pics/networksettings/adhoc.png
new file mode 100644
index 0000000..dcf5ad2
--- a/dev/null
+++ b/pics/networksettings/adhoc.png
Binary files differ
diff --git a/pics/networksettings/managed.png b/pics/networksettings/managed.png
new file mode 100644
index 0000000..4554533
--- a/dev/null
+++ b/pics/networksettings/managed.png
Binary files differ