summaryrefslogtreecommitdiff
authorbenmeyer <benmeyer>2002-10-02 17:22:50 (UTC)
committer benmeyer <benmeyer>2002-10-02 17:22:50 (UTC)
commit527e77d8244fb25d0bab39857eebbdfbcbfb807a (patch) (side-by-side diff)
treef3ec7cee3573ef83d8d86f859c7c3de3a8b06b9f
parent6e50141595ec2159d384c2cb9aaee4758eb720ea (diff)
downloadopie-527e77d8244fb25d0bab39857eebbdfbcbfb807a.zip
opie-527e77d8244fb25d0bab39857eebbdfbcbfb807a.tar.gz
opie-527e77d8244fb25d0bab39857eebbdfbcbfb807a.tar.bz2
Add Connection function more filled in
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/networksetup/TODO1
-rw-r--r--noncore/net/networksetup/addconnection.ui (renamed from noncore/net/networksetup/addservice.ui)19
-rw-r--r--noncore/net/networksetup/addconnectionimp.cpp38
-rw-r--r--noncore/net/networksetup/addconnectionimp.h29
-rw-r--r--noncore/net/networksetup/addserviceimp.cpp26
-rw-r--r--noncore/net/networksetup/addserviceimp.h26
-rw-r--r--noncore/net/networksetup/interface.h1
-rw-r--r--noncore/net/networksetup/interfacesetupimp.cpp3
-rw-r--r--noncore/net/networksetup/mainwindow.ui10
-rw-r--r--noncore/net/networksetup/mainwindowimp.cpp195
-rw-r--r--noncore/net/networksetup/mainwindowimp.h1
-rw-r--r--noncore/net/networksetup/module.h53
-rw-r--r--noncore/net/networksetup/networksetup.pro6
-rw-r--r--noncore/net/networksetup/wlan/wlan.ui4
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.cpp21
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.h2
-rw-r--r--noncore/settings/networksettings/TODO1
-rw-r--r--noncore/settings/networksettings/addconnection.ui (renamed from noncore/settings/networksettings/addservice.ui)19
-rw-r--r--noncore/settings/networksettings/addconnectionimp.cpp38
-rw-r--r--noncore/settings/networksettings/addconnectionimp.h29
-rw-r--r--noncore/settings/networksettings/addserviceimp.cpp26
-rw-r--r--noncore/settings/networksettings/addserviceimp.h26
-rw-r--r--noncore/settings/networksettings/interface.h1
-rw-r--r--noncore/settings/networksettings/interfacesetupimp.cpp3
-rw-r--r--noncore/settings/networksettings/mainwindow.ui10
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp195
-rw-r--r--noncore/settings/networksettings/mainwindowimp.h1
-rw-r--r--noncore/settings/networksettings/module.h53
-rw-r--r--noncore/settings/networksettings/networksetup.pro6
-rw-r--r--noncore/settings/networksettings/wlan/wlan.ui4
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp21
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.h2
32 files changed, 500 insertions, 370 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO
index 9a1657a..e69de29 100644
--- a/noncore/net/networksetup/TODO
+++ b/noncore/net/networksetup/TODO
@@ -1 +0,0 @@
-Fix DHCP obtained and expoired info
diff --git a/noncore/net/networksetup/addservice.ui b/noncore/net/networksetup/addconnection.ui
index 929f4fb..a349804 100644
--- a/noncore/net/networksetup/addservice.ui
+++ b/noncore/net/networksetup/addconnection.ui
@@ -1,154 +1,153 @@
<!DOCTYPE UI><UI>
-<class>AddService</class>
+<class>AddConnection</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
- <cstring>AddService</cstring>
+ <cstring>AddConnection</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>245</width>
+ <width>233</width>
<height>268</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
- <string>Add Network Service</string>
+ <string>Add Network Connection</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="3" column="1" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>cancelButton</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Cancel</string>
+ <string>&amp;Cancel</string>
</property>
</widget>
<widget row="3" column="0" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>addButton</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Add</string>
+ <string>&amp;Add</string>
</property>
</widget>
<widget row="0" column="0" rowspan="1" colspan="2" >
<class>QListView</class>
<column>
<property>
<name>text</name>
<string>Services</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>registeredServicesList</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>minimumSize</name>
<size>
<width>0</width>
<height>75</height>
</size>
</property>
</widget>
<spacer row="2" column="1" >
<property>
<name>name</name>
<cstring>Spacer12</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="1" column="0" rowspan="1" colspan="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>help</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>4</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
- <string>LAN - TCP/IP
-For Local-area network connections through PC_CARD network interfdace cards.</string>
+ <string></string>
</property>
<property stdset="1">
<name>alignment</name>
<set>WordBreak|AlignTop|AlignLeft</set>
</property>
<property>
<name>vAlign</name>
</property>
<property>
<name>wordwrap</name>
</property>
</widget>
</grid>
</widget>
<connections>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
- <receiver>AddService</receiver>
+ <receiver>AddConnection</receiver>
<slot>reject()</slot>
</connection>
<connection>
<sender>addButton</sender>
<signal>clicked()</signal>
- <receiver>AddService</receiver>
+ <receiver>AddConnection</receiver>
<slot>accept()</slot>
</connection>
</connections>
</UI>
diff --git a/noncore/net/networksetup/addconnectionimp.cpp b/noncore/net/networksetup/addconnectionimp.cpp
new file mode 100644
index 0000000..ee7bd97
--- a/dev/null
+++ b/noncore/net/networksetup/addconnectionimp.cpp
@@ -0,0 +1,38 @@
+#include "addconnectionimp.h"
+#include <qlistview.h>
+#include <qlist.h>
+#include <qlabel.h>
+#include <qheader.h>
+
+/**
+ * Constructor
+ */
+AddConnectionImp::AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0):AddConnection(parent, name, f){
+ connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed()));
+ registeredServicesList->header()->hide();
+};
+
+/**
+ * The current item changed, update the discription.
+ */
+void AddConnectionImp::changed(){
+ QListViewItem *item = registeredServicesList->currentItem();
+ if(item){
+ help->setText(list[item->text(0)]);
+ }
+}
+
+/**
+ * Save a copy of newList for the discriptions and append them all to the view
+ * @param newList the new list of possible interfaces
+ */
+void AddConnectionImp::addConnections(QMap<QString, QString> newList){
+ list = newList;
+ QMap<QString, QString>::Iterator it;
+ for( it = list.begin(); it != list.end(); ++it )
+ QListViewItem *item = new QListViewItem(registeredServicesList, it.key());
+ registeredServicesList->setCurrentItem(registeredServicesList->firstChild());
+}
+
+// addserviceimp.cpp
+
diff --git a/noncore/net/networksetup/addconnectionimp.h b/noncore/net/networksetup/addconnectionimp.h
new file mode 100644
index 0000000..643cd9a
--- a/dev/null
+++ b/noncore/net/networksetup/addconnectionimp.h
@@ -0,0 +1,29 @@
+#ifndef ADDCONNECTIONIMP_H
+#define ADDCONNECTIONIMP_H
+
+#include "addconnection.h"
+#include <qmap.h>
+#include <qlist.h>
+
+class QListViewItem;
+
+class AddConnectionImp : public AddConnection {
+
+Q_OBJECT
+
+public:
+ AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0);
+ void addConnections(QMap<QString, QString> newList);
+
+private slots:
+ void changed();
+
+private:
+ QMap<QString, QString> list;
+
+};
+
+#endif
+
+// addconectionimp.h
+
diff --git a/noncore/net/networksetup/addserviceimp.cpp b/noncore/net/networksetup/addserviceimp.cpp
deleted file mode 100644
index ac79d06..0000000
--- a/noncore/net/networksetup/addserviceimp.cpp
+++ b/dev/null
@@ -1,26 +0,0 @@
-#include "addserviceimp.h"
-#include <qpe/qlibrary.h>
-#include <qlistview.h>
-#include <qlist.h>
-
-void AddServiceImp::addServices(QList<QString> list){
- list.setAutoDelete(true);
-
- for(uint i = 0; i < list.count(); i++){
- QString pluginFileName = "";
- QLibrary *lib = new QLibrary(pluginFileName);
- void *functionPointer = lib->resolve("info");
- if( !functionPointer ){
- qDebug(QString("AddServiceImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
- delete lib;
- break;
- }
-
- // Try to get an info.
- QString info = ((QString (*)()) functionPointer)();
- QListViewItem *newItem = new QListViewItem(registeredServicesList, info);
- }
-}
-
-
-// addserviceimp.cpp
diff --git a/noncore/net/networksetup/addserviceimp.h b/noncore/net/networksetup/addserviceimp.h
deleted file mode 100644
index 7cacb97..0000000
--- a/noncore/net/networksetup/addserviceimp.h
+++ b/dev/null
@@ -1,26 +0,0 @@
-#ifndef ADDSERVICEIMP_H
-#define ADDSERVICEIMP_H
-
-#include "addservice.h"
-#include <qmap.h>
-#include <qlist.h>
-
-class QListViewItem;
-
-class AddServiceImp : public AddService {
-
-Q_OBJECT
-
-public:
- AddServiceImp(QWidget *parent=0, const char *name=0, WFlags f=0):AddService(parent, name, f){};
- void addServices(QList<QString> list);
-
-private:
- QMap<QListViewItem*, QString> pluginInfo;
-
-};
-
-#endif
-
-// addserviceimp.h
-
diff --git a/noncore/net/networksetup/interface.h b/noncore/net/networksetup/interface.h
index 5dc95a4..1406e99 100644
--- a/noncore/net/networksetup/interface.h
+++ b/noncore/net/networksetup/interface.h
@@ -1,66 +1,67 @@
#ifndef INTERFACE_H
#define INTERFACE_H
#include <qstring.h>
class Module;
+
class Interface {
public:
Interface(QString name = "unknown", bool status = false);
virtual ~Interface(){};
virtual bool getStatus(){ return status; };
virtual void setStatus(bool newSatus){ status = newSatus; refresh(); };
virtual bool isAttached(){ return attached; };
virtual void setAttached(bool isAttached=false){ attached = isAttached; };
virtual QString getInterfaceName(){ return interfaceName; };
virtual void setInterfaceName(QString name="unknown"){ interfaceName = name; };
virtual QString getHardwareName(){ return hardareName; };
virtual void setHardwareName(QString name="Unknown"){ hardareName = name; };
virtual Module* getModuleOwner(){ return moduleOwner; };
virtual void setModuleOwner(Module *owner=NULL){ moduleOwner = owner; };
// inet information.
QString getMacAddress(){ return macAddress; };
QString getIp(){ return ip; };
QString getSubnetMask(){ return subnetMask; };
QString getBroadcast(){ return broadcast; };
bool isDhcp(){ return dhcp; };
QString getDhcpServerIp(){ return dhcpServerIp; };
QString getLeaseObtained(){ return leaseObtained; };
QString getLeaseExpires(){ return leaseExpires; };
bool refresh();
bool start();
bool stop();
bool restart();
private:
// Interface information
bool status;
bool attached;
QString interfaceName;
QString hardareName;
Module *moduleOwner;
// Network information
QString macAddress;
QString ip;
QString broadcast;
QString subnetMask;
bool dhcp;
QString dhcpServerIp;
QString leaseObtained;
QString leaseExpires;
};
#endif
// interface.h
diff --git a/noncore/net/networksetup/interfacesetupimp.cpp b/noncore/net/networksetup/interfacesetupimp.cpp
index 6a8449d..951aeee 100644
--- a/noncore/net/networksetup/interfacesetupimp.cpp
+++ b/noncore/net/networksetup/interfacesetupimp.cpp
@@ -1,121 +1,120 @@
#include "interfacesetupimp.h"
#include "interface.h"
#include "interfaces.h"
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <assert.h>
-#define INTERFACE_FILE "/home/ben/interfaces"
#define DNSSCRIPT "interfacednsscript"
/**
* Constuctor. Set up the connection and load the first profile.
*/
InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){
assert(i);
interface = i;
- interfaces = new Interfaces(INTERFACE_FILE);
+ interfaces = new Interfaces();
changeProfile(profileCombo->currentText());
bool error = false;
if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
staticGroupBox->hide();
dhcpCheckBox->hide();
leaseTime->hide();
leaseHoursLabel->hide();
}
connect(profileCombo, SIGNAL(highlighted(const QString &)), this, SLOT(changeProfile(const QString &)));
}
/**
* Save the current settings, then write out the interfaces file and close.
*/
void InterfaceSetupImp::accept(){
if(!saveSettings())
return;
interfaces->write();
close(true);
}
/**
* Save the settings for the current Interface.
* @return bool true if successfull, false otherwise
*/
bool InterfaceSetupImp::saveSettings(){
// eh can't really do anything about it other then return. :-D
if(!interfaces->isInterfaceSet())
return true;
bool error = false;
// Loopback case
if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){
QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok");
return false;
}
interfaces->removeAllInterfaceOptions();
// DHCP
if(dhcpCheckBox->isChecked()){
interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value()));
interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60));
}
else{
interfaces->setInterfaceMethod("static");
interfaces->setInterfaceOption("address", ipAddressEdit->text());
interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
interfaces->setInterfaceOption("gateway", gatewayEdit->text());
QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
interfaces->setInterfaceOption("up "DNSSCRIPT" add ", dns);
interfaces->setInterfaceOption("down "DNSSCRIPT" remove ", dns);
}
// IP Information
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
/**
* The Profile has changed.
* @profile the new profile.
*/
void InterfaceSetupImp::changeProfile(const QString &profile){
QString newInterfaceName;
if(profile.lower() == "all")
newInterfaceName = interface->getInterfaceName();
else
newInterfaceName = interface->getInterfaceName() + "_" + profile;
if(newInterfaceName == currentInterfaceName)
return;
else{
saveSettings();
currentInterfaceName = newInterfaceName;
}
bool error = interfaces->setInterface(currentInterfaceName);
// See if we have to make a interface.
if(error){
qDebug("InterfaceSetupImp: Adding a new interface from profile change.");
interfaces->addInterface(currentInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
error = interfaces->setInterface(currentInterfaceName);
if(error){
qDebug("InterfaceSetupImp: Added interface, but still can't set.");
return;
}
}
//qDebug( currentInterfaceName.latin1() );
// We must have a valid interface to get this far so read some settings.
diff --git a/noncore/net/networksetup/mainwindow.ui b/noncore/net/networksetup/mainwindow.ui
index a3f7bb1..f5b104a 100644
--- a/noncore/net/networksetup/mainwindow.ui
+++ b/noncore/net/networksetup/mainwindow.ui
@@ -9,255 +9,255 @@
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>217</width>
<height>289</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Network Setup</string>
</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>
<name>layoutMargin</name>
</property>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Widget3</cstring>
</property>
<attribute>
<name>title</name>
<string>Interfaces</string>
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QListView</class>
<column>
<property>
<name>text</name>
<string>i</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>t</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>Name</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>serviceList</cstring>
+ <cstring>connectionList</cstring>
</property>
<property stdset="1">
<name>allColumnsShowFocus</name>
<bool>true</bool>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout2</cstring>
</property>
<property>
<name>layoutMargin</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>5</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="1" column="0" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>addServiceButton</cstring>
+ <cstring>addConnectionButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Add</string>
</property>
</widget>
<widget row="0" column="0" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>informationServiceButton</cstring>
+ <cstring>informationConnectionButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Information</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>configureServiceButton</cstring>
+ <cstring>configureConnectionButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Configure</string>
</property>
</widget>
<widget row="1" column="1" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>removeServiceButton</cstring>
+ <cstring>removeConnectionButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Remove</string>
</property>
</widget>
</grid>
</widget>
</vbox>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Profiles</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="1" column="0" rowspan="1" colspan="3" >
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>Line1</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Current Profile</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>currentProfileLabel</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string>All</string>
</property>
</widget>
<spacer row="0" column="2" >
<property>
<name>name</name>
<cstring>Spacer2</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>
<spacer row="6" column="2" >
<property>
<name>name</name>
<cstring>Spacer16</cstring>
</property>
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp
index 89dac6f..66ec8b5 100644
--- a/noncore/net/networksetup/mainwindowimp.cpp
+++ b/noncore/net/networksetup/mainwindowimp.cpp
@@ -1,396 +1,403 @@
#include "mainwindowimp.h"
-#include "addserviceimp.h"
+#include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
-#include "kprocess.h"
#include "module.h"
+#include "kprocess.h"
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qlistbox.h>
#include <qlistview.h>
#include <qheader.h>
#include <qlabel.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/resource.h>
#include <qlist.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
-// For library loading.
-#include <dlfcn.h>
-
#define TEMP_ALL "/tmp/ifconfig-a"
#define TEMP_UP "/tmp/ifconfig"
-MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) {
- connect(addServiceButton, SIGNAL(clicked()), this, SLOT(addClicked()));
- connect(removeServiceButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
- connect(informationServiceButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
- connect(configureServiceButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
+MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
+ connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
+ connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
+ connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
+ connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&)));
- // Make sure we have a plugin directory to scan.
- QString DirStr = QDir::homeDirPath() + "/.networksetup/" ;
- QDir pluginDir( DirStr );
- pluginDir.mkdir( DirStr );
- pluginDir.mkdir( ( DirStr + "plugins/" ) );
- QString path = DirStr + "plugins";
- pluginDir.setPath(path);
- if(!pluginDir.exists()){
- qDebug(QString("MainWindowImp: ERROR: %1 %2").arg(__FILE__).arg(__LINE__).latin1());
- return;
- }
-
- // Load any saved services.
- loadModules(path);
+ // Load connections.
+ loadModules(QDir::homeDirPath() + "/.networksetup/plugins");
getInterfaceList();
- serviceList->header()->hide();
+ connectionList->header()->hide();
Config cfg("NetworkSetup");
profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
+ advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
}
/**
- * Deconstructor. Unload libraries and save profile list.
+ * Deconstructor. Save profiles. Delete loaded libraries.
*/
MainWindowImp::~MainWindowImp(){
+ // Save profiles.
if(profiles.count() > 1){
Config cfg("NetworkSetup");
cfg.writeEntry("Profiles", profiles.join(" "));
}
+ // Delete Modules and Libraries
+ QMap<Module*, QLibrary*>::Iterator it;
+ for( it = libraries.begin(); it != libraries.end(); ++it ){
+ delete it.key();
+ delete it.data();
+ }
}
+/**
+ * Load all modules that are found in the path
+ * @param path a directory that is scaned for any plugins that can be loaded
+ * and attempts to load them
+ */
void MainWindowImp::loadModules(QString path){
qDebug(path.latin1());
- QDir d;
- d.setPath(path);
- if(!d.exists()){
- qDebug("MainWindowImp:: Path doesn't exists");
+ QDir d(path);
+ if(!d.exists())
return;
- }
+
+ // Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) ) {
if(fi->fileName().contains(".so")){
- qDebug("Found");
- Module *foo = loadPlugin(path + "/" + fi->fileName());
+ loadPlugin(path + "/" + fi->fileName());
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
- qDebug(pluginFileName.latin1());
+ qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer ){
qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
delete lib;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == NULL){
qDebug("MainWindowImp: Couldn't create object, but did load library!");
delete lib;
return NULL;
}
- // Store for reference
+ // Store for deletion later
libraries.insert(object, lib);
return object;
}
/**
* The Add button was clicked. Bring up the add dialog and if OK is hit
* load the plugin and append it to the list
*/
void MainWindowImp::addClicked(){
- // Now that we have a list of all of the protocals, list them.
- {
- QMessageBox::information(this, "No Modules", "Nothing to add.", "Ok");
+ QMap<Module*, QLibrary*>::Iterator it;
+ QMap<QString, QString> list;
+ list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
+ list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
+ for( it = libraries.begin(); it != libraries.end(); ++it ){
+ if(it.key())
+ (it.key())->possibleNewInterfaces(list);
+ }
+ // See if the list has anything that we can add.
+ if(list.count() == 0){
+ QMessageBox::information(this, "Sorry", "Nothing to add.", "Ok");
return;
}
- AddServiceImp service(this, "AddService", true);
- service.showMaximized();
- service.exec();
+ AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
+ addNewConnection.addConnections(list);
+ addNewConnection.showMaximized();
+ if(QDialog::Accepted == addNewConnection.exec()){
+
+ }
}
/**
* Prompt the user to see if they really want to do this.
* If they do then remove from the list and unload.
*/
void MainWindowImp::removeClicked(){
- QListViewItem *item = serviceList->currentItem();
+ QListViewItem *item = connectionList->currentItem();
if(item == NULL) {
QMessageBox::information(this, "Error","Please select an interface.", "Ok");
return;
}
if((interfaceItems[item])->getModuleOwner() == NULL){
QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok");
}
else{
// Try to remove.
}
}
/**
- * See if there is a configuration for the selected protocal.
- * Prompt with errors.
+ * Pull up the configure about the currently selected interface.
+ * Report an error if no interface is selected.
+ * If the interface has a module owner then request its configure with a empty
+ * tab. If tab is !NULL then append the interfaces setup widget to it.
*/
void MainWindowImp::configureClicked(){
- QListViewItem *item = serviceList->currentItem();
- if(item == NULL){
- QMessageBox::information(this, "Error","Please select an interface.", "Ok");
+ QListViewItem *item = connectionList->currentItem();
+ if(!item){
+ QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
return;
}
- if((interfaceItems[item])->getModuleOwner() == NULL){
- InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]);
- conf->showMaximized();
- conf->show();
+ Interface *i = interfaceItems[item];
+ if(i->getModuleOwner()){
+ QTabWidget *tabWidget = NULL;
+ QWidget *moduleConfigure = i->getModuleOwner()->configure(&tabWidget);
+ if(moduleConfigure != NULL){
+ if(tabWidget != NULL){
+ InterfaceSetupImp *configure = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, true);
+ tabWidget->insertTab(configure, "TCP/IP");
}
- else{
- QTabWidget *t = NULL;
- QWidget *conf = (interfaceItems[item])->getModuleOwner()->configure(&t);
- if(conf != NULL){
- qDebug("Conf found");
- if(t != NULL){
- qDebug("Adding Interface");
- InterfaceSetupImp *i = new InterfaceSetupImp(t, "TCPIPInformation", interfaceItems[item], true);
- t->insertTab(i, "TCP/IP");
- }
- conf->showMaximized();
- conf->show();
- }
- else{
- InterfaceSetupImp *i = new InterfaceSetupImp(0, "TCPIPInformation", interfaceItems[item], true);
- i->showMaximized();
- i->show();
+ moduleConfigure->showMaximized();
+ moduleConfigure->show();
+ return;
}
}
+
+ InterfaceSetupImp *configure = new InterfaceSetupImp(0, "InterfaceSetupImp", i, true);
+ configure->showMaximized();
+ configure->show();
}
/**
- * Pull up the information about the selected interface
- * Report an error
+ * Pull up the information about the currently selected interface.
+ * Report an error if no interface is selected.
+ * If the interface has a module owner then request its configure with a empty
+ * tab. If tab is !NULL then append the interfaces setup widget to it.
*/
void MainWindowImp::informationClicked(){
- QListViewItem *item = serviceList->currentItem();
- if(item == NULL){
- QMessageBox::information(this, "Error","Please select an interface.", "Ok");
+ QListViewItem *item = connectionList->currentItem();
+ if(!item){
+ QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
return;
}
- if( (interfaceItems[item])->getModuleOwner() == NULL){
- InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]);
- i->showMaximized();
- i->show();
+ Interface *i = interfaceItems[item];
+ if(i->getModuleOwner()){
+ QTabWidget *tabWidget = NULL;
+ QWidget *moduleInformation = i->getModuleOwner()->information(&tabWidget);
+ if(moduleInformation != NULL){
+ if(tabWidget != NULL){
+ InterfaceInformationImp *information = new InterfaceInformationImp(tabWidget, "InterfaceSetupImp", i, true);
+ tabWidget->insertTab(information, "TCP/IP");
}
- else{
- QTabWidget *t = NULL;
- QWidget *conf = (interfaceItems[item])->getModuleOwner()->information(&t);
- if(conf != NULL){
- if(t){
- qDebug("Adding Interface");
- InterfaceInformationImp *i = new InterfaceInformationImp(t, "TCPIPInformation", interfaceItems[item], true);
- t->insertTab(i, "TCP/IP");
- }
- conf->showMaximized();
- conf->show();
- }
- else{
- InterfaceInformationImp *i = new InterfaceInformationImp(0, "TCPIPInformation", interfaceItems[item], true);
- i->showMaximized();
- i->show();
+ moduleInformation->showMaximized();
+ moduleInformation->show();
+ return;
}
}
+
+ InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true);
+ information->showMaximized();
+ information->show();
}
/**
* Aquire the list of active interfaces from ifconfig
* Call ifconfig and ifconfig -a
*/
void MainWindowImp::getInterfaceList(){
KShellProcess *processAll = new KShellProcess();
*processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL;
connect(processAll, SIGNAL(processExited(KProcess *)),
this, SLOT(jobDone(KProcess *)));
threads.insert(processAll, TEMP_ALL);
processAll->start(KShellProcess::NotifyOnExit);
KShellProcess *process = new KShellProcess();
*process << "/sbin/ifconfig" << " > " TEMP_UP;
connect(process, SIGNAL(processExited(KProcess *)),
this, SLOT(jobDone(KProcess *)));
threads.insert(process, TEMP_UP);
process->start(KShellProcess::NotifyOnExit);
}
void MainWindowImp::jobDone(KProcess *process){
QString fileName = threads[process];
threads.remove(process);
delete process;
QFile file(fileName);
if (!file.open(IO_ReadOnly)){
qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1());
return;
}
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
line = stream.readLine();
int space = line.find(" ");
if(space > 1){
// We have found an interface
QString interfaceName = line.mid(0, space);
+ if(!advancedUserMode){
+ if(interfaceName == "lo")
+ break;
+ }
Interface *i;
// See if we already have it
if(interfaceNames.find(interfaceName) == interfaceNames.end()){
if(fileName == TEMP_ALL)
i = new Interface(interfaceName, false);
else
i = new Interface(interfaceName, true);
}
else{
i = interfaceNames[interfaceName];
if(fileName != TEMP_ALL)
i->setStatus(true);
}
i->setAttached(true);
i->setInterfaceName(interfaceName);
QString hardName = "Ethernet";
int hardwareName = line.find("Link encap:");
int macAddress = line.find("HWaddr");
if(macAddress == -1)
macAddress = line.length();
if(hardwareName != -1)
i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName()));
// We have found an interface
//qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1());
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
}
}
file.close();
QFile::remove(fileName);
}
+/**
+ *
+ */
void MainWindowImp::updateInterface(Interface *i){
QListViewItem *item = NULL;
// See if we already have it
if(items.find(i) == items.end()){
- item = new QListViewItem(serviceList, "", "", "");
+ item = new QListViewItem(connectionList, "", "", "");
// See if you can't find a module owner for this interface
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()->isOwner(i))
i->setModuleOwner(it.key());
}
items.insert(i, item);
interfaceItems.insert(item, i);
}
else
item = items[i];
QString statusImage = "down";
if(i->getStatus())
statusImage = "up";
QPixmap status = (Resource::loadPixmap(statusImage));
item->setPixmap(0, status);
QString typeName = "lan";
if(i->getHardwareName().contains("Local Loopback"))
typeName = "lo";
if(i->getInterfaceName().contains("irda"))
typeName = "irda";
if(i->getInterfaceName().contains("wlan"))
typeName = "wlan";
// Actually try to use the Module
if(i->getModuleOwner() != NULL){
typeName = i->getModuleOwner()->getPixmapName(i);
}
QPixmap type = (Resource::loadPixmap(typeName));
item->setPixmap(1, type);
item->setText(2, i->getHardwareName());
}
/**
* Adds a new profile to the list of profiles.
* Don't add profiles that already exists.
* Appends to the combo and QStringList
*/
void MainWindowImp::addProfile(){
QString newProfileName = "New";
if(profiles.grep(newProfileName).count() > 0){
QMessageBox::information(this, "Can't Add.","Profile already exists.", "Ok");
return;
}
profiles.append(newProfileName);
profilesList->insertItem(newProfileName);
}
/**
* Removes the currently selected profile in the combo.
* Doesn't delete if there are less then 2 profiles.
*/
void MainWindowImp::removeProfile(){
if(profilesList->count() <= 1){
QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok");
return;
}
QString profileToRemove = profilesList->currentText();
if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){
profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
profilesList->clear();
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
}
}
/**
* A new profile has been selected, change.
* @param newProfile the new profile.
*/
void MainWindowImp::changeProfile(const QString& newProfile){
currentProfileLabel->setText(newProfile);
}
// mainwindowimp.cpp
diff --git a/noncore/net/networksetup/mainwindowimp.h b/noncore/net/networksetup/mainwindowimp.h
index 19ebaf2..629b758 100644
--- a/noncore/net/networksetup/mainwindowimp.h
+++ b/noncore/net/networksetup/mainwindowimp.h
@@ -1,56 +1,57 @@
#ifndef MAINWINOWIMP_H
#define MAINWINOWIMP_H
#include "mainwindow.h"
#include <qmap.h>
#include <qstringlist.h>
class Module;
class Interface;
class QLibrary;
class KProcess;
class MainWindowImp : public MainWindow {
Q_OBJECT
public:
MainWindowImp(QWidget *parent=0, const char *name=0);
~MainWindowImp();
private slots:
void addClicked();
void removeClicked();
void configureClicked();
void informationClicked();
void jobDone(KProcess *process);
void getInterfaceList();
void addProfile();
void removeProfile();
void changeProfile(const QString&);
void updateInterface(Interface *i);
private:
void loadModules(QString path);
Module* loadPlugin(QString pluginFileName,
QString resolveString = "create_plugin");
// For our local list of names
QMap<QString, Interface*> interfaceNames;
QMap<Module*, QLibrary*> libraries;
QMap<Interface*, QListViewItem*> items;
QMap<QListViewItem*, Interface*> interfaceItems;
QMap<KProcess*, QString> threads;
QStringList profiles;
+ bool advancedUserMode;
};
#endif
// mainwindowimp.h
diff --git a/noncore/net/networksetup/module.h b/noncore/net/networksetup/module.h
index c1e9488..0c81928 100644
--- a/noncore/net/networksetup/module.h
+++ b/noncore/net/networksetup/module.h
@@ -1,34 +1,79 @@
#ifndef NETCONF_MODULE_H
#define NETCONF_MODULE_H
#include <qobject.h>
#include <qlist.h>
#include <qmap.h>
#include "interface.h"
class QWidget;
class QTabWidget;
class Module : QObject{
signals:
void updateInterface(Interface *i);
public:
Module(){};
+ /**
+ * 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)
+ */
+ virtual QString getPixmapName(Interface* i) = 0;
+
+ /**
+ * Check to see if the interface i is owned by this module.
+ * @param Interface* interface to check against
+ * @return bool true if i is owned by this module, false otherwise.
+ */
virtual bool isOwner(Interface *){ return false; };
- virtual QWidget *configure(QTabWidget **tabWidget){ return NULL; } ;
- virtual QWidget *information(QTabWidget **tabWidget){ return NULL; };
+
+ /**
+ * 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.
+ */
+ virtual QWidget *configure(QTabWidget **){ return NULL; } ;
+
+ /**
+ * 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.
+ */
+ virtual QWidget *information(QTabWidget **){ return NULL; };
+
+ /**
+ * Get all active (up or down) interfaces
+ * @return QList<Interface> A list of interfaces that exsist that havn't
+ * been called by isOwner()
+ */
virtual QList<Interface> getInterfaces() = 0;
- virtual QMap<QString, QString> possibleNewInterfaces() = 0;
+
+ /**
+ * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp),
+ * modem ppp)
+ */
+ virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0;
+
+ /**
+ * Attempts to create a new interface from name
+ * @return Interface* NULL if it was unable to be created.
+ * @param name the type of interface to create
+ */
virtual Interface *addNewInterface(QString name) = 0;
+
+ /**
+ * Attempts to remove the interface, doesn't delete i
+ * @return bool true if successfull, false otherwise.
+ */
virtual bool remove(Interface* i) = 0;
- virtual QString getPixmapName(Interface* i) = 0;
};
#endif
// module.h
diff --git a/noncore/net/networksetup/networksetup.pro b/noncore/net/networksetup/networksetup.pro
index 0d48790..ba70180 100644
--- a/noncore/net/networksetup/networksetup.pro
+++ b/noncore/net/networksetup/networksetup.pro
@@ -1,10 +1,10 @@
TEMPLATE = app
#CONFIG = qt warn_on debug
CONFIG = qt warn_on release
-HEADERS = mainwindowimp.h addserviceimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h
-SOURCES = main.cpp mainwindowimp.cpp addserviceimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp
+HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h
+SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp
#INCLUDEPATH += $(QPEDIR)/include
#DEPENDPATH += $(QPEDIR)/include
LIBS += -lqpe
-INTERFACES = mainwindow.ui addservice.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui
+INTERFACES = mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui
TARGET = networksetup
diff --git a/noncore/net/networksetup/wlan/wlan.ui b/noncore/net/networksetup/wlan/wlan.ui
index dcacbe8..9f33559 100644
--- a/noncore/net/networksetup/wlan/wlan.ui
+++ b/noncore/net/networksetup/wlan/wlan.ui
@@ -1,152 +1,152 @@
<!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>
+ <width>250</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>
+ <string>WLAN General</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>
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp
index 632f7e4..70b1f7a 100644
--- a/noncore/net/networksetup/wlan/wlanmodule.cpp
+++ b/noncore/net/networksetup/wlan/wlanmodule.cpp
@@ -1,85 +1,84 @@
#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.
+ * @param Interface* interface to check against
* @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;
}
/**
- *
+ * Get all active (up or down) interfaces
+ * @return QList<Interface> A list of interfaces that exsist that havn't
+ * been called by isOwner()
*/
QList<Interface> WLANModule::getInterfaces(){
- return list
-}
-
-/**
- * Return a list of possible new interfaces
- */
-QMap<QString, QString> WLANModule::possibleNewInterfaces(){
- //return list;
+ 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){
+Interface *WLANModule::addNewInterface(QString ){
+ // We can't add a 802.11 interface, either the hardware will be there
+ // or it wont.
return NULL;
}
/**
* Attempts to remove the interface, doesn't delete i
* @return bool true if successfull, false otherwise.
*/
-bool WLANModule::remove(Interface* i){
+bool WLANModule::remove(Interface*){
+ // Can't remove a hardware device, you can stop it though.
return false;
}
// wlanmodule.cpp
diff --git a/noncore/net/networksetup/wlan/wlanmodule.h b/noncore/net/networksetup/wlan/wlanmodule.h
index 1fbf6a9..7ebe129 100644
--- a/noncore/net/networksetup/wlan/wlanmodule.h
+++ b/noncore/net/networksetup/wlan/wlanmodule.h
@@ -1,38 +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 void possibleNewInterfaces(QMap<QString, QString> &list){};
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/TODO b/noncore/settings/networksettings/TODO
index 9a1657a..e69de29 100644
--- a/noncore/settings/networksettings/TODO
+++ b/noncore/settings/networksettings/TODO
@@ -1 +0,0 @@
-Fix DHCP obtained and expoired info
diff --git a/noncore/settings/networksettings/addservice.ui b/noncore/settings/networksettings/addconnection.ui
index 929f4fb..a349804 100644
--- a/noncore/settings/networksettings/addservice.ui
+++ b/noncore/settings/networksettings/addconnection.ui
@@ -1,154 +1,153 @@
<!DOCTYPE UI><UI>
-<class>AddService</class>
+<class>AddConnection</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
- <cstring>AddService</cstring>
+ <cstring>AddConnection</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>245</width>
+ <width>233</width>
<height>268</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
- <string>Add Network Service</string>
+ <string>Add Network Connection</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="3" column="1" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>cancelButton</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Cancel</string>
+ <string>&amp;Cancel</string>
</property>
</widget>
<widget row="3" column="0" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>addButton</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Add</string>
+ <string>&amp;Add</string>
</property>
</widget>
<widget row="0" column="0" rowspan="1" colspan="2" >
<class>QListView</class>
<column>
<property>
<name>text</name>
<string>Services</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>registeredServicesList</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>minimumSize</name>
<size>
<width>0</width>
<height>75</height>
</size>
</property>
</widget>
<spacer row="2" column="1" >
<property>
<name>name</name>
<cstring>Spacer12</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="1" column="0" rowspan="1" colspan="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>help</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>4</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
- <string>LAN - TCP/IP
-For Local-area network connections through PC_CARD network interfdace cards.</string>
+ <string></string>
</property>
<property stdset="1">
<name>alignment</name>
<set>WordBreak|AlignTop|AlignLeft</set>
</property>
<property>
<name>vAlign</name>
</property>
<property>
<name>wordwrap</name>
</property>
</widget>
</grid>
</widget>
<connections>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
- <receiver>AddService</receiver>
+ <receiver>AddConnection</receiver>
<slot>reject()</slot>
</connection>
<connection>
<sender>addButton</sender>
<signal>clicked()</signal>
- <receiver>AddService</receiver>
+ <receiver>AddConnection</receiver>
<slot>accept()</slot>
</connection>
</connections>
</UI>
diff --git a/noncore/settings/networksettings/addconnectionimp.cpp b/noncore/settings/networksettings/addconnectionimp.cpp
new file mode 100644
index 0000000..ee7bd97
--- a/dev/null
+++ b/noncore/settings/networksettings/addconnectionimp.cpp
@@ -0,0 +1,38 @@
+#include "addconnectionimp.h"
+#include <qlistview.h>
+#include <qlist.h>
+#include <qlabel.h>
+#include <qheader.h>
+
+/**
+ * Constructor
+ */
+AddConnectionImp::AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0):AddConnection(parent, name, f){
+ connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed()));
+ registeredServicesList->header()->hide();
+};
+
+/**
+ * The current item changed, update the discription.
+ */
+void AddConnectionImp::changed(){
+ QListViewItem *item = registeredServicesList->currentItem();
+ if(item){
+ help->setText(list[item->text(0)]);
+ }
+}
+
+/**
+ * Save a copy of newList for the discriptions and append them all to the view
+ * @param newList the new list of possible interfaces
+ */
+void AddConnectionImp::addConnections(QMap<QString, QString> newList){
+ list = newList;
+ QMap<QString, QString>::Iterator it;
+ for( it = list.begin(); it != list.end(); ++it )
+ QListViewItem *item = new QListViewItem(registeredServicesList, it.key());
+ registeredServicesList->setCurrentItem(registeredServicesList->firstChild());
+}
+
+// addserviceimp.cpp
+
diff --git a/noncore/settings/networksettings/addconnectionimp.h b/noncore/settings/networksettings/addconnectionimp.h
new file mode 100644
index 0000000..643cd9a
--- a/dev/null
+++ b/noncore/settings/networksettings/addconnectionimp.h
@@ -0,0 +1,29 @@
+#ifndef ADDCONNECTIONIMP_H
+#define ADDCONNECTIONIMP_H
+
+#include "addconnection.h"
+#include <qmap.h>
+#include <qlist.h>
+
+class QListViewItem;
+
+class AddConnectionImp : public AddConnection {
+
+Q_OBJECT
+
+public:
+ AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0);
+ void addConnections(QMap<QString, QString> newList);
+
+private slots:
+ void changed();
+
+private:
+ QMap<QString, QString> list;
+
+};
+
+#endif
+
+// addconectionimp.h
+
diff --git a/noncore/settings/networksettings/addserviceimp.cpp b/noncore/settings/networksettings/addserviceimp.cpp
deleted file mode 100644
index ac79d06..0000000
--- a/noncore/settings/networksettings/addserviceimp.cpp
+++ b/dev/null
@@ -1,26 +0,0 @@
-#include "addserviceimp.h"
-#include <qpe/qlibrary.h>
-#include <qlistview.h>
-#include <qlist.h>
-
-void AddServiceImp::addServices(QList<QString> list){
- list.setAutoDelete(true);
-
- for(uint i = 0; i < list.count(); i++){
- QString pluginFileName = "";
- QLibrary *lib = new QLibrary(pluginFileName);
- void *functionPointer = lib->resolve("info");
- if( !functionPointer ){
- qDebug(QString("AddServiceImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
- delete lib;
- break;
- }
-
- // Try to get an info.
- QString info = ((QString (*)()) functionPointer)();
- QListViewItem *newItem = new QListViewItem(registeredServicesList, info);
- }
-}
-
-
-// addserviceimp.cpp
diff --git a/noncore/settings/networksettings/addserviceimp.h b/noncore/settings/networksettings/addserviceimp.h
deleted file mode 100644
index 7cacb97..0000000
--- a/noncore/settings/networksettings/addserviceimp.h
+++ b/dev/null
@@ -1,26 +0,0 @@
-#ifndef ADDSERVICEIMP_H
-#define ADDSERVICEIMP_H
-
-#include "addservice.h"
-#include <qmap.h>
-#include <qlist.h>
-
-class QListViewItem;
-
-class AddServiceImp : public AddService {
-
-Q_OBJECT
-
-public:
- AddServiceImp(QWidget *parent=0, const char *name=0, WFlags f=0):AddService(parent, name, f){};
- void addServices(QList<QString> list);
-
-private:
- QMap<QListViewItem*, QString> pluginInfo;
-
-};
-
-#endif
-
-// addserviceimp.h
-
diff --git a/noncore/settings/networksettings/interface.h b/noncore/settings/networksettings/interface.h
index 5dc95a4..1406e99 100644
--- a/noncore/settings/networksettings/interface.h
+++ b/noncore/settings/networksettings/interface.h
@@ -1,66 +1,67 @@
#ifndef INTERFACE_H
#define INTERFACE_H
#include <qstring.h>
class Module;
+
class Interface {
public:
Interface(QString name = "unknown", bool status = false);
virtual ~Interface(){};
virtual bool getStatus(){ return status; };
virtual void setStatus(bool newSatus){ status = newSatus; refresh(); };
virtual bool isAttached(){ return attached; };
virtual void setAttached(bool isAttached=false){ attached = isAttached; };
virtual QString getInterfaceName(){ return interfaceName; };
virtual void setInterfaceName(QString name="unknown"){ interfaceName = name; };
virtual QString getHardwareName(){ return hardareName; };
virtual void setHardwareName(QString name="Unknown"){ hardareName = name; };
virtual Module* getModuleOwner(){ return moduleOwner; };
virtual void setModuleOwner(Module *owner=NULL){ moduleOwner = owner; };
// inet information.
QString getMacAddress(){ return macAddress; };
QString getIp(){ return ip; };
QString getSubnetMask(){ return subnetMask; };
QString getBroadcast(){ return broadcast; };
bool isDhcp(){ return dhcp; };
QString getDhcpServerIp(){ return dhcpServerIp; };
QString getLeaseObtained(){ return leaseObtained; };
QString getLeaseExpires(){ return leaseExpires; };
bool refresh();
bool start();
bool stop();
bool restart();
private:
// Interface information
bool status;
bool attached;
QString interfaceName;
QString hardareName;
Module *moduleOwner;
// Network information
QString macAddress;
QString ip;
QString broadcast;
QString subnetMask;
bool dhcp;
QString dhcpServerIp;
QString leaseObtained;
QString leaseExpires;
};
#endif
// interface.h
diff --git a/noncore/settings/networksettings/interfacesetupimp.cpp b/noncore/settings/networksettings/interfacesetupimp.cpp
index 6a8449d..951aeee 100644
--- a/noncore/settings/networksettings/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfacesetupimp.cpp
@@ -1,121 +1,120 @@
#include "interfacesetupimp.h"
#include "interface.h"
#include "interfaces.h"
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <assert.h>
-#define INTERFACE_FILE "/home/ben/interfaces"
#define DNSSCRIPT "interfacednsscript"
/**
* Constuctor. Set up the connection and load the first profile.
*/
InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){
assert(i);
interface = i;
- interfaces = new Interfaces(INTERFACE_FILE);
+ interfaces = new Interfaces();
changeProfile(profileCombo->currentText());
bool error = false;
if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
staticGroupBox->hide();
dhcpCheckBox->hide();
leaseTime->hide();
leaseHoursLabel->hide();
}
connect(profileCombo, SIGNAL(highlighted(const QString &)), this, SLOT(changeProfile(const QString &)));
}
/**
* Save the current settings, then write out the interfaces file and close.
*/
void InterfaceSetupImp::accept(){
if(!saveSettings())
return;
interfaces->write();
close(true);
}
/**
* Save the settings for the current Interface.
* @return bool true if successfull, false otherwise
*/
bool InterfaceSetupImp::saveSettings(){
// eh can't really do anything about it other then return. :-D
if(!interfaces->isInterfaceSet())
return true;
bool error = false;
// Loopback case
if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){
QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok");
return false;
}
interfaces->removeAllInterfaceOptions();
// DHCP
if(dhcpCheckBox->isChecked()){
interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value()));
interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60));
}
else{
interfaces->setInterfaceMethod("static");
interfaces->setInterfaceOption("address", ipAddressEdit->text());
interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
interfaces->setInterfaceOption("gateway", gatewayEdit->text());
QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
interfaces->setInterfaceOption("up "DNSSCRIPT" add ", dns);
interfaces->setInterfaceOption("down "DNSSCRIPT" remove ", dns);
}
// IP Information
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
/**
* The Profile has changed.
* @profile the new profile.
*/
void InterfaceSetupImp::changeProfile(const QString &profile){
QString newInterfaceName;
if(profile.lower() == "all")
newInterfaceName = interface->getInterfaceName();
else
newInterfaceName = interface->getInterfaceName() + "_" + profile;
if(newInterfaceName == currentInterfaceName)
return;
else{
saveSettings();
currentInterfaceName = newInterfaceName;
}
bool error = interfaces->setInterface(currentInterfaceName);
// See if we have to make a interface.
if(error){
qDebug("InterfaceSetupImp: Adding a new interface from profile change.");
interfaces->addInterface(currentInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
error = interfaces->setInterface(currentInterfaceName);
if(error){
qDebug("InterfaceSetupImp: Added interface, but still can't set.");
return;
}
}
//qDebug( currentInterfaceName.latin1() );
// We must have a valid interface to get this far so read some settings.
diff --git a/noncore/settings/networksettings/mainwindow.ui b/noncore/settings/networksettings/mainwindow.ui
index a3f7bb1..f5b104a 100644
--- a/noncore/settings/networksettings/mainwindow.ui
+++ b/noncore/settings/networksettings/mainwindow.ui
@@ -9,255 +9,255 @@
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>217</width>
<height>289</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Network Setup</string>
</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>
<name>layoutMargin</name>
</property>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Widget3</cstring>
</property>
<attribute>
<name>title</name>
<string>Interfaces</string>
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QListView</class>
<column>
<property>
<name>text</name>
<string>i</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>t</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>Name</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>serviceList</cstring>
+ <cstring>connectionList</cstring>
</property>
<property stdset="1">
<name>allColumnsShowFocus</name>
<bool>true</bool>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout2</cstring>
</property>
<property>
<name>layoutMargin</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>5</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="1" column="0" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>addServiceButton</cstring>
+ <cstring>addConnectionButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Add</string>
</property>
</widget>
<widget row="0" column="0" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>informationServiceButton</cstring>
+ <cstring>informationConnectionButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Information</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>configureServiceButton</cstring>
+ <cstring>configureConnectionButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Configure</string>
</property>
</widget>
<widget row="1" column="1" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>removeServiceButton</cstring>
+ <cstring>removeConnectionButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Remove</string>
</property>
</widget>
</grid>
</widget>
</vbox>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Profiles</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="1" column="0" rowspan="1" colspan="3" >
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>Line1</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Current Profile</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>currentProfileLabel</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string>All</string>
</property>
</widget>
<spacer row="0" column="2" >
<property>
<name>name</name>
<cstring>Spacer2</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>
<spacer row="6" column="2" >
<property>
<name>name</name>
<cstring>Spacer16</cstring>
</property>
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 89dac6f..66ec8b5 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -1,396 +1,403 @@
#include "mainwindowimp.h"
-#include "addserviceimp.h"
+#include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
-#include "kprocess.h"
#include "module.h"
+#include "kprocess.h"
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qlistbox.h>
#include <qlistview.h>
#include <qheader.h>
#include <qlabel.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/resource.h>
#include <qlist.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
-// For library loading.
-#include <dlfcn.h>
-
#define TEMP_ALL "/tmp/ifconfig-a"
#define TEMP_UP "/tmp/ifconfig"
-MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) {
- connect(addServiceButton, SIGNAL(clicked()), this, SLOT(addClicked()));
- connect(removeServiceButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
- connect(informationServiceButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
- connect(configureServiceButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
+MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
+ connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
+ connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
+ connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
+ connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&)));
- // Make sure we have a plugin directory to scan.
- QString DirStr = QDir::homeDirPath() + "/.networksetup/" ;
- QDir pluginDir( DirStr );
- pluginDir.mkdir( DirStr );
- pluginDir.mkdir( ( DirStr + "plugins/" ) );
- QString path = DirStr + "plugins";
- pluginDir.setPath(path);
- if(!pluginDir.exists()){
- qDebug(QString("MainWindowImp: ERROR: %1 %2").arg(__FILE__).arg(__LINE__).latin1());
- return;
- }
-
- // Load any saved services.
- loadModules(path);
+ // Load connections.
+ loadModules(QDir::homeDirPath() + "/.networksetup/plugins");
getInterfaceList();
- serviceList->header()->hide();
+ connectionList->header()->hide();
Config cfg("NetworkSetup");
profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
+ advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
}
/**
- * Deconstructor. Unload libraries and save profile list.
+ * Deconstructor. Save profiles. Delete loaded libraries.
*/
MainWindowImp::~MainWindowImp(){
+ // Save profiles.
if(profiles.count() > 1){
Config cfg("NetworkSetup");
cfg.writeEntry("Profiles", profiles.join(" "));
}
+ // Delete Modules and Libraries
+ QMap<Module*, QLibrary*>::Iterator it;
+ for( it = libraries.begin(); it != libraries.end(); ++it ){
+ delete it.key();
+ delete it.data();
+ }
}
+/**
+ * Load all modules that are found in the path
+ * @param path a directory that is scaned for any plugins that can be loaded
+ * and attempts to load them
+ */
void MainWindowImp::loadModules(QString path){
qDebug(path.latin1());
- QDir d;
- d.setPath(path);
- if(!d.exists()){
- qDebug("MainWindowImp:: Path doesn't exists");
+ QDir d(path);
+ if(!d.exists())
return;
- }
+
+ // Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) ) {
if(fi->fileName().contains(".so")){
- qDebug("Found");
- Module *foo = loadPlugin(path + "/" + fi->fileName());
+ loadPlugin(path + "/" + fi->fileName());
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
- qDebug(pluginFileName.latin1());
+ qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer ){
qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
delete lib;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == NULL){
qDebug("MainWindowImp: Couldn't create object, but did load library!");
delete lib;
return NULL;
}
- // Store for reference
+ // Store for deletion later
libraries.insert(object, lib);
return object;
}
/**
* The Add button was clicked. Bring up the add dialog and if OK is hit
* load the plugin and append it to the list
*/
void MainWindowImp::addClicked(){
- // Now that we have a list of all of the protocals, list them.
- {
- QMessageBox::information(this, "No Modules", "Nothing to add.", "Ok");
+ QMap<Module*, QLibrary*>::Iterator it;
+ QMap<QString, QString> list;
+ list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
+ list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
+ for( it = libraries.begin(); it != libraries.end(); ++it ){
+ if(it.key())
+ (it.key())->possibleNewInterfaces(list);
+ }
+ // See if the list has anything that we can add.
+ if(list.count() == 0){
+ QMessageBox::information(this, "Sorry", "Nothing to add.", "Ok");
return;
}
- AddServiceImp service(this, "AddService", true);
- service.showMaximized();
- service.exec();
+ AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
+ addNewConnection.addConnections(list);
+ addNewConnection.showMaximized();
+ if(QDialog::Accepted == addNewConnection.exec()){
+
+ }
}
/**
* Prompt the user to see if they really want to do this.
* If they do then remove from the list and unload.
*/
void MainWindowImp::removeClicked(){
- QListViewItem *item = serviceList->currentItem();
+ QListViewItem *item = connectionList->currentItem();
if(item == NULL) {
QMessageBox::information(this, "Error","Please select an interface.", "Ok");
return;
}
if((interfaceItems[item])->getModuleOwner() == NULL){
QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok");
}
else{
// Try to remove.
}
}
/**
- * See if there is a configuration for the selected protocal.
- * Prompt with errors.
+ * Pull up the configure about the currently selected interface.
+ * Report an error if no interface is selected.
+ * If the interface has a module owner then request its configure with a empty
+ * tab. If tab is !NULL then append the interfaces setup widget to it.
*/
void MainWindowImp::configureClicked(){
- QListViewItem *item = serviceList->currentItem();
- if(item == NULL){
- QMessageBox::information(this, "Error","Please select an interface.", "Ok");
+ QListViewItem *item = connectionList->currentItem();
+ if(!item){
+ QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
return;
}
- if((interfaceItems[item])->getModuleOwner() == NULL){
- InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]);
- conf->showMaximized();
- conf->show();
+ Interface *i = interfaceItems[item];
+ if(i->getModuleOwner()){
+ QTabWidget *tabWidget = NULL;
+ QWidget *moduleConfigure = i->getModuleOwner()->configure(&tabWidget);
+ if(moduleConfigure != NULL){
+ if(tabWidget != NULL){
+ InterfaceSetupImp *configure = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, true);
+ tabWidget->insertTab(configure, "TCP/IP");
}
- else{
- QTabWidget *t = NULL;
- QWidget *conf = (interfaceItems[item])->getModuleOwner()->configure(&t);
- if(conf != NULL){
- qDebug("Conf found");
- if(t != NULL){
- qDebug("Adding Interface");
- InterfaceSetupImp *i = new InterfaceSetupImp(t, "TCPIPInformation", interfaceItems[item], true);
- t->insertTab(i, "TCP/IP");
- }
- conf->showMaximized();
- conf->show();
- }
- else{
- InterfaceSetupImp *i = new InterfaceSetupImp(0, "TCPIPInformation", interfaceItems[item], true);
- i->showMaximized();
- i->show();
+ moduleConfigure->showMaximized();
+ moduleConfigure->show();
+ return;
}
}
+
+ InterfaceSetupImp *configure = new InterfaceSetupImp(0, "InterfaceSetupImp", i, true);
+ configure->showMaximized();
+ configure->show();
}
/**
- * Pull up the information about the selected interface
- * Report an error
+ * Pull up the information about the currently selected interface.
+ * Report an error if no interface is selected.
+ * If the interface has a module owner then request its configure with a empty
+ * tab. If tab is !NULL then append the interfaces setup widget to it.
*/
void MainWindowImp::informationClicked(){
- QListViewItem *item = serviceList->currentItem();
- if(item == NULL){
- QMessageBox::information(this, "Error","Please select an interface.", "Ok");
+ QListViewItem *item = connectionList->currentItem();
+ if(!item){
+ QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
return;
}
- if( (interfaceItems[item])->getModuleOwner() == NULL){
- InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]);
- i->showMaximized();
- i->show();
+ Interface *i = interfaceItems[item];
+ if(i->getModuleOwner()){
+ QTabWidget *tabWidget = NULL;
+ QWidget *moduleInformation = i->getModuleOwner()->information(&tabWidget);
+ if(moduleInformation != NULL){
+ if(tabWidget != NULL){
+ InterfaceInformationImp *information = new InterfaceInformationImp(tabWidget, "InterfaceSetupImp", i, true);
+ tabWidget->insertTab(information, "TCP/IP");
}
- else{
- QTabWidget *t = NULL;
- QWidget *conf = (interfaceItems[item])->getModuleOwner()->information(&t);
- if(conf != NULL){
- if(t){
- qDebug("Adding Interface");
- InterfaceInformationImp *i = new InterfaceInformationImp(t, "TCPIPInformation", interfaceItems[item], true);
- t->insertTab(i, "TCP/IP");
- }
- conf->showMaximized();
- conf->show();
- }
- else{
- InterfaceInformationImp *i = new InterfaceInformationImp(0, "TCPIPInformation", interfaceItems[item], true);
- i->showMaximized();
- i->show();
+ moduleInformation->showMaximized();
+ moduleInformation->show();
+ return;
}
}
+
+ InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true);
+ information->showMaximized();
+ information->show();
}
/**
* Aquire the list of active interfaces from ifconfig
* Call ifconfig and ifconfig -a
*/
void MainWindowImp::getInterfaceList(){
KShellProcess *processAll = new KShellProcess();
*processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL;
connect(processAll, SIGNAL(processExited(KProcess *)),
this, SLOT(jobDone(KProcess *)));
threads.insert(processAll, TEMP_ALL);
processAll->start(KShellProcess::NotifyOnExit);
KShellProcess *process = new KShellProcess();
*process << "/sbin/ifconfig" << " > " TEMP_UP;
connect(process, SIGNAL(processExited(KProcess *)),
this, SLOT(jobDone(KProcess *)));
threads.insert(process, TEMP_UP);
process->start(KShellProcess::NotifyOnExit);
}
void MainWindowImp::jobDone(KProcess *process){
QString fileName = threads[process];
threads.remove(process);
delete process;
QFile file(fileName);
if (!file.open(IO_ReadOnly)){
qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1());
return;
}
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
line = stream.readLine();
int space = line.find(" ");
if(space > 1){
// We have found an interface
QString interfaceName = line.mid(0, space);
+ if(!advancedUserMode){
+ if(interfaceName == "lo")
+ break;
+ }
Interface *i;
// See if we already have it
if(interfaceNames.find(interfaceName) == interfaceNames.end()){
if(fileName == TEMP_ALL)
i = new Interface(interfaceName, false);
else
i = new Interface(interfaceName, true);
}
else{
i = interfaceNames[interfaceName];
if(fileName != TEMP_ALL)
i->setStatus(true);
}
i->setAttached(true);
i->setInterfaceName(interfaceName);
QString hardName = "Ethernet";
int hardwareName = line.find("Link encap:");
int macAddress = line.find("HWaddr");
if(macAddress == -1)
macAddress = line.length();
if(hardwareName != -1)
i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName()));
// We have found an interface
//qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1());
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
}
}
file.close();
QFile::remove(fileName);
}
+/**
+ *
+ */
void MainWindowImp::updateInterface(Interface *i){
QListViewItem *item = NULL;
// See if we already have it
if(items.find(i) == items.end()){
- item = new QListViewItem(serviceList, "", "", "");
+ item = new QListViewItem(connectionList, "", "", "");
// See if you can't find a module owner for this interface
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()->isOwner(i))
i->setModuleOwner(it.key());
}
items.insert(i, item);
interfaceItems.insert(item, i);
}
else
item = items[i];
QString statusImage = "down";
if(i->getStatus())
statusImage = "up";
QPixmap status = (Resource::loadPixmap(statusImage));
item->setPixmap(0, status);
QString typeName = "lan";
if(i->getHardwareName().contains("Local Loopback"))
typeName = "lo";
if(i->getInterfaceName().contains("irda"))
typeName = "irda";
if(i->getInterfaceName().contains("wlan"))
typeName = "wlan";
// Actually try to use the Module
if(i->getModuleOwner() != NULL){
typeName = i->getModuleOwner()->getPixmapName(i);
}
QPixmap type = (Resource::loadPixmap(typeName));
item->setPixmap(1, type);
item->setText(2, i->getHardwareName());
}
/**
* Adds a new profile to the list of profiles.
* Don't add profiles that already exists.
* Appends to the combo and QStringList
*/
void MainWindowImp::addProfile(){
QString newProfileName = "New";
if(profiles.grep(newProfileName).count() > 0){
QMessageBox::information(this, "Can't Add.","Profile already exists.", "Ok");
return;
}
profiles.append(newProfileName);
profilesList->insertItem(newProfileName);
}
/**
* Removes the currently selected profile in the combo.
* Doesn't delete if there are less then 2 profiles.
*/
void MainWindowImp::removeProfile(){
if(profilesList->count() <= 1){
QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok");
return;
}
QString profileToRemove = profilesList->currentText();
if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){
profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
profilesList->clear();
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
}
}
/**
* A new profile has been selected, change.
* @param newProfile the new profile.
*/
void MainWindowImp::changeProfile(const QString& newProfile){
currentProfileLabel->setText(newProfile);
}
// mainwindowimp.cpp
diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h
index 19ebaf2..629b758 100644
--- a/noncore/settings/networksettings/mainwindowimp.h
+++ b/noncore/settings/networksettings/mainwindowimp.h
@@ -1,56 +1,57 @@
#ifndef MAINWINOWIMP_H
#define MAINWINOWIMP_H
#include "mainwindow.h"
#include <qmap.h>
#include <qstringlist.h>
class Module;
class Interface;
class QLibrary;
class KProcess;
class MainWindowImp : public MainWindow {
Q_OBJECT
public:
MainWindowImp(QWidget *parent=0, const char *name=0);
~MainWindowImp();
private slots:
void addClicked();
void removeClicked();
void configureClicked();
void informationClicked();
void jobDone(KProcess *process);
void getInterfaceList();
void addProfile();
void removeProfile();
void changeProfile(const QString&);
void updateInterface(Interface *i);
private:
void loadModules(QString path);
Module* loadPlugin(QString pluginFileName,
QString resolveString = "create_plugin");
// For our local list of names
QMap<QString, Interface*> interfaceNames;
QMap<Module*, QLibrary*> libraries;
QMap<Interface*, QListViewItem*> items;
QMap<QListViewItem*, Interface*> interfaceItems;
QMap<KProcess*, QString> threads;
QStringList profiles;
+ bool advancedUserMode;
};
#endif
// mainwindowimp.h
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h
index c1e9488..0c81928 100644
--- a/noncore/settings/networksettings/module.h
+++ b/noncore/settings/networksettings/module.h
@@ -1,34 +1,79 @@
#ifndef NETCONF_MODULE_H
#define NETCONF_MODULE_H
#include <qobject.h>
#include <qlist.h>
#include <qmap.h>
#include "interface.h"
class QWidget;
class QTabWidget;
class Module : QObject{
signals:
void updateInterface(Interface *i);
public:
Module(){};
+ /**
+ * 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)
+ */
+ virtual QString getPixmapName(Interface* i) = 0;
+
+ /**
+ * Check to see if the interface i is owned by this module.
+ * @param Interface* interface to check against
+ * @return bool true if i is owned by this module, false otherwise.
+ */
virtual bool isOwner(Interface *){ return false; };
- virtual QWidget *configure(QTabWidget **tabWidget){ return NULL; } ;
- virtual QWidget *information(QTabWidget **tabWidget){ return NULL; };
+
+ /**
+ * 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.
+ */
+ virtual QWidget *configure(QTabWidget **){ return NULL; } ;
+
+ /**
+ * 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.
+ */
+ virtual QWidget *information(QTabWidget **){ return NULL; };
+
+ /**
+ * Get all active (up or down) interfaces
+ * @return QList<Interface> A list of interfaces that exsist that havn't
+ * been called by isOwner()
+ */
virtual QList<Interface> getInterfaces() = 0;
- virtual QMap<QString, QString> possibleNewInterfaces() = 0;
+
+ /**
+ * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp),
+ * modem ppp)
+ */
+ virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0;
+
+ /**
+ * Attempts to create a new interface from name
+ * @return Interface* NULL if it was unable to be created.
+ * @param name the type of interface to create
+ */
virtual Interface *addNewInterface(QString name) = 0;
+
+ /**
+ * Attempts to remove the interface, doesn't delete i
+ * @return bool true if successfull, false otherwise.
+ */
virtual bool remove(Interface* i) = 0;
- virtual QString getPixmapName(Interface* i) = 0;
};
#endif
// module.h
diff --git a/noncore/settings/networksettings/networksetup.pro b/noncore/settings/networksettings/networksetup.pro
index 0d48790..ba70180 100644
--- a/noncore/settings/networksettings/networksetup.pro
+++ b/noncore/settings/networksettings/networksetup.pro
@@ -1,10 +1,10 @@
TEMPLATE = app
#CONFIG = qt warn_on debug
CONFIG = qt warn_on release
-HEADERS = mainwindowimp.h addserviceimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h
-SOURCES = main.cpp mainwindowimp.cpp addserviceimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp
+HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h
+SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp
#INCLUDEPATH += $(QPEDIR)/include
#DEPENDPATH += $(QPEDIR)/include
LIBS += -lqpe
-INTERFACES = mainwindow.ui addservice.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui
+INTERFACES = mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui
TARGET = networksetup
diff --git a/noncore/settings/networksettings/wlan/wlan.ui b/noncore/settings/networksettings/wlan/wlan.ui
index dcacbe8..9f33559 100644
--- a/noncore/settings/networksettings/wlan/wlan.ui
+++ b/noncore/settings/networksettings/wlan/wlan.ui
@@ -1,152 +1,152 @@
<!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>
+ <width>250</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>
+ <string>WLAN General</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>
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index 632f7e4..70b1f7a 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -1,85 +1,84 @@
#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.
+ * @param Interface* interface to check against
* @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;
}
/**
- *
+ * Get all active (up or down) interfaces
+ * @return QList<Interface> A list of interfaces that exsist that havn't
+ * been called by isOwner()
*/
QList<Interface> WLANModule::getInterfaces(){
- return list
-}
-
-/**
- * Return a list of possible new interfaces
- */
-QMap<QString, QString> WLANModule::possibleNewInterfaces(){
- //return list;
+ 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){
+Interface *WLANModule::addNewInterface(QString ){
+ // We can't add a 802.11 interface, either the hardware will be there
+ // or it wont.
return NULL;
}
/**
* Attempts to remove the interface, doesn't delete i
* @return bool true if successfull, false otherwise.
*/
-bool WLANModule::remove(Interface* i){
+bool WLANModule::remove(Interface*){
+ // Can't remove a hardware device, you can stop it though.
return false;
}
// wlanmodule.cpp
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.h b/noncore/settings/networksettings/wlan/wlanmodule.h
index 1fbf6a9..7ebe129 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.h
+++ b/noncore/settings/networksettings/wlan/wlanmodule.h
@@ -1,38 +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 void possibleNewInterfaces(QMap<QString, QString> &list){};
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