summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show 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.ui402
-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.h15
-rw-r--r--pics/networksettings/adhoc.pngbin0 -> 694 bytes
-rw-r--r--pics/networksettings/managed.pngbin0 -> 410 bytes
9 files changed, 446 insertions, 197 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
@@ -2,3 +2,5 @@
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
@@ -5,5 +5,5 @@ 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.
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
@@ -9,5 +9,5 @@ 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
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
@@ -12,6 +12,6 @@
<x>0</x>
<y>0</y>
- <width>247</width>
- <height>299</height>
+ <width>216</width>
+ <height>342</height>
</rect>
</property>
@@ -46,4 +46,10 @@
<bool>true</bool>
</property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
<widget>
<class>QWidget</class>
@@ -56,57 +62,69 @@
<string>General</string>
</attribute>
- <spacer>
- <property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>3</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
<name>name</name>
- <cstring>Spacer31</cstring>
+ <cstring>Layout1</cstring>
</property>
+ <grid>
<property stdset="1">
- <name>orientation</name>
- <enum>Vertical</enum>
+ <name>margin</name>
+ <number>0</number>
</property>
<property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
+ <name>spacing</name>
+ <number>6</number>
</property>
+ <widget row="1" column="1" >
+ <class>QComboBox</class>
+ <item>
<property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
+ <name>text</name>
+ <string>any</string>
</property>
- </spacer>
- <widget>
- <class>QLabel</class>
+ </item>
<property stdset="1">
<name>name</name>
- <cstring>modeLabel</cstring>
+ <cstring>essid</cstring>
</property>
<property stdset="1">
- <name>enabled</name>
+ <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>geometry</name>
- <rect>
- <x>11</x>
- <y>11</y>
- <width>84</width>
- <height>29</height>
- </rect>
+ <name>currentItem</name>
+ <number>0</number>
</property>
<property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
+ <name>sizeLimit</name>
+ <number>5</number>
</property>
<property stdset="1">
- <name>text</name>
- <string>Mode</string>
+ <name>autoCompletion</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>duplicatesEnabled</name>
+ <bool>false</bool>
</property>
</widget>
- <widget>
+ <widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
@@ -119,13 +137,4 @@
</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>
@@ -136,90 +145,73 @@
<property stdset="1">
<name>text</name>
- <string>ESS-ID</string>
+ <string>SSID</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>
+ <widget row="0" column="1" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Infrastructure</string>
</property>
- <property stdset="1">
- <name>maxValue</name>
- <number>15</number>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Auto</string>
</property>
- <property stdset="1">
- <name>minValue</name>
- <number>1</number>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Managed</string>
</property>
- <property stdset="1">
- <name>value</name>
- <number>1</number>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Ad-Hoc</string>
</property>
- </widget>
- <widget>
- <class>QLineEdit</class>
+ </item>
<property stdset="1">
<name>name</name>
- <cstring>macEdit</cstring>
+ <cstring>mode</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>
+ <bool>true</bool>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>1</vsizetype>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
</sizepolicy>
</property>
</widget>
- <widget>
+ <widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>macLabel</cstring>
+ <cstring>modeLabel</cstring>
</property>
<property stdset="1">
<name>enabled</name>
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property stdset="1">
- <name>geometry</name>
- <rect>
- <x>11</x>
- <y>108</y>
- <width>39</width>
- <height>25</height>
- </rect>
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
</property>
<property stdset="1">
<name>text</name>
- <string>MAC</string>
+ <string>Mode</string>
</property>
</widget>
+ </grid>
+ </widget>
<widget>
<class>QCheckBox</class>
@@ -229,13 +221,4 @@
</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>
@@ -243,64 +226,42 @@
</widget>
<widget>
- <class>QCheckBox</class>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>specifyChan</cstring>
+ <cstring>Layout3</cstring>
</property>
+ <hbox>
<property stdset="1">
- <name>geometry</name>
- <rect>
- <x>11</x>
- <y>141</y>
- <width>129</width>
- <height>21</height>
- </rect>
+ <name>margin</name>
+ <number>0</number>
</property>
<property stdset="1">
- <name>text</name>
- <string>Specify &amp;Channel</string>
+ <name>spacing</name>
+ <number>6</number>
</property>
- </widget>
- <spacer>
- <property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
<name>name</name>
- <cstring>Spacer10</cstring>
+ <cstring>macLabel</cstring>
</property>
<property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
+ <name>enabled</name>
+ <bool>false</bool>
</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>QComboBox</class>
- <item>
- <property>
<name>text</name>
- <string>any</string>
+ <string>MAC</string>
</property>
- </item>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>essid</cstring>
+ <cstring>macEdit</cstring>
</property>
<property stdset="1">
- <name>geometry</name>
- <rect>
- <x>101</x>
- <y>46</y>
- <width>103</width>
- <height>29</height>
- </rect>
+ <name>enabled</name>
+ <bool>false</bool>
</property>
<property stdset="1">
@@ -308,79 +269,136 @@
<sizepolicy>
<hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
+ <vsizetype>1</vsizetype>
</sizepolicy>
</property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
- <name>editable</name>
- <bool>true</bool>
+ <name>name</name>
+ <cstring>Layout4</cstring>
</property>
+ <hbox>
<property stdset="1">
- <name>currentItem</name>
+ <name>margin</name>
<number>0</number>
</property>
<property stdset="1">
- <name>sizeLimit</name>
- <number>5</number>
+ <name>spacing</name>
+ <number>6</number>
</property>
+ <widget>
+ <class>QCheckBox</class>
<property stdset="1">
- <name>autoCompletion</name>
- <bool>true</bool>
+ <name>name</name>
+ <cstring>specifyChan</cstring>
</property>
<property stdset="1">
- <name>duplicatesEnabled</name>
+ <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>QComboBox</class>
- <item>
- <property>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rescanButton</cstring>
+ </property>
+ <property stdset="1">
<name>text</name>
- <string>Infrastructure</string>
+ <string>Rescan Neighbourhood</string>
</property>
- </item>
- <item>
+ </widget>
+ <widget>
+ <class>QListView</class>
+ <column>
<property>
<name>text</name>
- <string>Auto</string>
+ <string></string>
</property>
- </item>
- <item>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
<property>
<name>text</name>
- <string>Managed</string>
+ <string>SSID</string>
</property>
- </item>
- <item>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
<property>
<name>text</name>
- <string>Ad-Hoc</string>
+ <string>Chn</string>
</property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>mode</cstring>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
</property>
- <property stdset="1">
- <name>enabled</name>
+ <property>
+ <name>resizeable</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>
+ </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>sizePolicy</name>
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
+ <name>name</name>
+ <cstring>netView</cstring>
</property>
</widget>
+ </vbox>
</widget>
<widget>
@@ -397,9 +415,9 @@
<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" >
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
@@ -219,5 +219,5 @@ void WLANImp::accept(){
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;
}
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
@@ -3,6 +3,14 @@
#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>
@@ -11,10 +19,17 @@
#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
@@ -23,5 +38,5 @@
#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"
/**
@@ -38,4 +53,11 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W
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 );
+
}
@@ -275,2 +297,194 @@ void WLANImp::writeOpts() {
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
@@ -5,8 +5,16 @@
#include "interfaces.h"
#include <qstringlist.h>
+#include <opie2/onetutils.h>
class InterfaceSetupImp;
class Interface;
class Config;
+class OPacket;
+class QListViewItem;
+
+const int col_mode= 0;
+const int col_ssid = 1;
+const int col_chn = 2;
+const int col_mac = 3;
class WLANImp : public WLAN {
@@ -18,4 +26,8 @@ public:
void setProfile(const QString &profile);
+public slots:
+ void rescanNeighbourhood();
+ void selectNetwork( QListViewItem* );
+
protected:
void accept();
@@ -27,4 +39,7 @@ private:
void parseKeyStr(QString keystr);
+ void handlePacket( OPacket* );
+ void displayFoundNetwork( const QString& mode, int channel, const QString& ssid, const OMacAddress& mac );
+
InterfaceSetupImp *interfaceSetup;
Interfaces *interfaces;
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