summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore 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.cpp205
-rw-r--r--noncore/net/networksetup/mainwindowimp.h1
-rw-r--r--noncore/net/networksetup/module.h55
-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.cpp23
-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.cpp205
-rw-r--r--noncore/settings/networksettings/mainwindowimp.h1
-rw-r--r--noncore/settings/networksettings/module.h55
-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.cpp23
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.h2
32 files changed, 514 insertions, 384 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 @@
1Fix 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,23 +1,23 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>AddService</class> 2<class>AddConnection</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>AddService</cstring> 7 <cstring>AddConnection</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>245</width> 14 <width>233</width>
15 <height>268</height> 15 <height>268</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Add Network Service</string> 20 <string>Add Network Connection</string>
21 </property> 21 </property>
22 <grid> 22 <grid>
23 <property stdset="1"> 23 <property stdset="1">
@@ -36,7 +36,7 @@
36 </property> 36 </property>
37 <property stdset="1"> 37 <property stdset="1">
38 <name>text</name> 38 <name>text</name>
39 <string>Cancel</string> 39 <string>&amp;Cancel</string>
40 </property> 40 </property>
41 </widget> 41 </widget>
42 <widget row="3" column="0" > 42 <widget row="3" column="0" >
@@ -47,7 +47,7 @@
47 </property> 47 </property>
48 <property stdset="1"> 48 <property stdset="1">
49 <name>text</name> 49 <name>text</name>
50 <string>Add</string> 50 <string>&amp;Add</string>
51 </property> 51 </property>
52 </widget> 52 </widget>
53 <widget row="0" column="0" rowspan="1" colspan="2" > 53 <widget row="0" column="0" rowspan="1" colspan="2" >
@@ -121,8 +121,7 @@
121 </property> 121 </property>
122 <property stdset="1"> 122 <property stdset="1">
123 <name>text</name> 123 <name>text</name>
124 <string>LAN - TCP/IP 124 <string></string>
125For Local-area network connections through PC_CARD network interfdace cards.</string>
126 </property> 125 </property>
127 <property stdset="1"> 126 <property stdset="1">
128 <name>alignment</name> 127 <name>alignment</name>
@@ -141,13 +140,13 @@ For Local-area network connections through PC_CARD network interfdace cards.</st
141 <connection> 140 <connection>
142 <sender>cancelButton</sender> 141 <sender>cancelButton</sender>
143 <signal>clicked()</signal> 142 <signal>clicked()</signal>
144 <receiver>AddService</receiver> 143 <receiver>AddConnection</receiver>
145 <slot>reject()</slot> 144 <slot>reject()</slot>
146 </connection> 145 </connection>
147 <connection> 146 <connection>
148 <sender>addButton</sender> 147 <sender>addButton</sender>
149 <signal>clicked()</signal> 148 <signal>clicked()</signal>
150 <receiver>AddService</receiver> 149 <receiver>AddConnection</receiver>
151 <slot>accept()</slot> 150 <slot>accept()</slot>
152 </connection> 151 </connection>
153</connections> 152</connections>
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 @@
1#include "addconnectionimp.h"
2#include <qlistview.h>
3#include <qlist.h>
4#include <qlabel.h>
5#include <qheader.h>
6
7/**
8 * Constructor
9 */
10AddConnectionImp::AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0):AddConnection(parent, name, f){
11 connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed()));
12 registeredServicesList->header()->hide();
13};
14
15/**
16 * The current item changed, update the discription.
17 */
18void AddConnectionImp::changed(){
19 QListViewItem *item = registeredServicesList->currentItem();
20 if(item){
21 help->setText(list[item->text(0)]);
22 }
23}
24
25/**
26 * Save a copy of newList for the discriptions and append them all to the view
27 * @param newList the new list of possible interfaces
28 */
29void AddConnectionImp::addConnections(QMap<QString, QString> newList){
30 list = newList;
31 QMap<QString, QString>::Iterator it;
32 for( it = list.begin(); it != list.end(); ++it )
33 QListViewItem *item = new QListViewItem(registeredServicesList, it.key());
34 registeredServicesList->setCurrentItem(registeredServicesList->firstChild());
35}
36
37// addserviceimp.cpp
38
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 @@
1#ifndef ADDCONNECTIONIMP_H
2#define ADDCONNECTIONIMP_H
3
4#include "addconnection.h"
5#include <qmap.h>
6#include <qlist.h>
7
8class QListViewItem;
9
10class AddConnectionImp : public AddConnection {
11
12Q_OBJECT
13
14public:
15 AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0);
16 void addConnections(QMap<QString, QString> newList);
17
18private slots:
19 void changed();
20
21private:
22 QMap<QString, QString> list;
23
24};
25
26#endif
27
28// addconectionimp.h
29
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 @@
1#include "addserviceimp.h"
2#include <qpe/qlibrary.h>
3#include <qlistview.h>
4#include <qlist.h>
5
6void AddServiceImp::addServices(QList<QString> list){
7 list.setAutoDelete(true);
8
9 for(uint i = 0; i < list.count(); i++){
10 QString pluginFileName = "";
11 QLibrary *lib = new QLibrary(pluginFileName);
12 void *functionPointer = lib->resolve("info");
13 if( !functionPointer ){
14 qDebug(QString("AddServiceImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
15 delete lib;
16 break;
17 }
18
19 // Try to get an info.
20 QString info = ((QString (*)()) functionPointer)();
21 QListViewItem *newItem = new QListViewItem(registeredServicesList, info);
22 }
23}
24
25
26// 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 @@
1#ifndef ADDSERVICEIMP_H
2#define ADDSERVICEIMP_H
3
4#include "addservice.h"
5#include <qmap.h>
6#include <qlist.h>
7
8class QListViewItem;
9
10class AddServiceImp : public AddService {
11
12Q_OBJECT
13
14public:
15 AddServiceImp(QWidget *parent=0, const char *name=0, WFlags f=0):AddService(parent, name, f){};
16 void addServices(QList<QString> list);
17
18private:
19 QMap<QListViewItem*, QString> pluginInfo;
20
21};
22
23#endif
24
25// addserviceimp.h
26
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
@@ -4,6 +4,7 @@
4#include <qstring.h> 4#include <qstring.h>
5 5
6class Module; 6class Module;
7
7class Interface { 8class Interface {
8 9
9public: 10public:
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
@@ -13,7 +13,6 @@
13 13
14#include <assert.h> 14#include <assert.h>
15 15
16#define INTERFACE_FILE "/home/ben/interfaces"
17#define DNSSCRIPT "interfacednsscript" 16#define DNSSCRIPT "interfacednsscript"
18 17
19/** 18/**
@@ -22,7 +21,7 @@
22InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){ 21InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){
23 assert(i); 22 assert(i);
24 interface = i; 23 interface = i;
25 interfaces = new Interfaces(INTERFACE_FILE); 24 interfaces = new Interfaces();
26 changeProfile(profileCombo->currentText()); 25 changeProfile(profileCombo->currentText());
27 bool error = false; 26 bool error = false;
28 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ 27 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
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
@@ -102,7 +102,7 @@
102 </column> 102 </column>
103 <property stdset="1"> 103 <property stdset="1">
104 <name>name</name> 104 <name>name</name>
105 <cstring>serviceList</cstring> 105 <cstring>connectionList</cstring>
106 </property> 106 </property>
107 <property stdset="1"> 107 <property stdset="1">
108 <name>allColumnsShowFocus</name> 108 <name>allColumnsShowFocus</name>
@@ -131,7 +131,7 @@
131 <class>QPushButton</class> 131 <class>QPushButton</class>
132 <property stdset="1"> 132 <property stdset="1">
133 <name>name</name> 133 <name>name</name>
134 <cstring>addServiceButton</cstring> 134 <cstring>addConnectionButton</cstring>
135 </property> 135 </property>
136 <property stdset="1"> 136 <property stdset="1">
137 <name>text</name> 137 <name>text</name>
@@ -142,7 +142,7 @@
142 <class>QPushButton</class> 142 <class>QPushButton</class>
143 <property stdset="1"> 143 <property stdset="1">
144 <name>name</name> 144 <name>name</name>
145 <cstring>informationServiceButton</cstring> 145 <cstring>informationConnectionButton</cstring>
146 </property> 146 </property>
147 <property stdset="1"> 147 <property stdset="1">
148 <name>text</name> 148 <name>text</name>
@@ -153,7 +153,7 @@
153 <class>QPushButton</class> 153 <class>QPushButton</class>
154 <property stdset="1"> 154 <property stdset="1">
155 <name>name</name> 155 <name>name</name>
156 <cstring>configureServiceButton</cstring> 156 <cstring>configureConnectionButton</cstring>
157 </property> 157 </property>
158 <property stdset="1"> 158 <property stdset="1">
159 <name>text</name> 159 <name>text</name>
@@ -164,7 +164,7 @@
164 <class>QPushButton</class> 164 <class>QPushButton</class>
165 <property stdset="1"> 165 <property stdset="1">
166 <name>name</name> 166 <name>name</name>
167 <cstring>removeServiceButton</cstring> 167 <cstring>removeConnectionButton</cstring>
168 </property> 168 </property>
169 <property stdset="1"> 169 <property stdset="1">
170 <name>text</name> 170 <name>text</name>
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,10 +1,10 @@
1#include "mainwindowimp.h" 1#include "mainwindowimp.h"
2#include "addserviceimp.h" 2#include "addconnectionimp.h"
3#include "interfaceinformationimp.h" 3#include "interfaceinformationimp.h"
4#include "interfacesetupimp.h" 4#include "interfacesetupimp.h"
5#include "kprocess.h"
6#include "module.h" 5#include "module.h"
7 6
7#include "kprocess.h"
8 8
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qtabwidget.h> 10#include <qtabwidget.h>
@@ -25,72 +25,68 @@
25#include <qfile.h> 25#include <qfile.h>
26#include <qtextstream.h> 26#include <qtextstream.h>
27 27
28// For library loading.
29#include <dlfcn.h>
30
31#define TEMP_ALL "/tmp/ifconfig-a" 28#define TEMP_ALL "/tmp/ifconfig-a"
32#define TEMP_UP "/tmp/ifconfig" 29#define TEMP_UP "/tmp/ifconfig"
33 30
34MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) { 31MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
35 connect(addServiceButton, SIGNAL(clicked()), this, SLOT(addClicked())); 32 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
36 connect(removeServiceButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 33 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
37 connect(informationServiceButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 34 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
38 connect(configureServiceButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 35 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
39 36
40 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 37 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
41 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 38 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
42 connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&))); 39 connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&)));
43 40
44 // Make sure we have a plugin directory to scan. 41 // Load connections.
45 QString DirStr = QDir::homeDirPath() + "/.networksetup/" ; 42 loadModules(QDir::homeDirPath() + "/.networksetup/plugins");
46 QDir pluginDir( DirStr );
47 pluginDir.mkdir( DirStr );
48 pluginDir.mkdir( ( DirStr + "plugins/" ) );
49 QString path = DirStr + "plugins";
50 pluginDir.setPath(path);
51 if(!pluginDir.exists()){
52 qDebug(QString("MainWindowImp: ERROR: %1 %2").arg(__FILE__).arg(__LINE__).latin1());
53 return;
54 }
55
56 // Load any saved services.
57 loadModules(path);
58 getInterfaceList(); 43 getInterfaceList();
59 serviceList->header()->hide(); 44 connectionList->header()->hide();
60 45
61 46
62 Config cfg("NetworkSetup"); 47 Config cfg("NetworkSetup");
63 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 48 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
64 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 49 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
65 profilesList->insertItem((*it)); 50 profilesList->insertItem((*it));
51 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
66} 52}
67 53
68/** 54/**
69 * Deconstructor. Unload libraries and save profile list. 55 * Deconstructor. Save profiles. Delete loaded libraries.
70 */ 56 */
71MainWindowImp::~MainWindowImp(){ 57MainWindowImp::~MainWindowImp(){
58 // Save profiles.
72 if(profiles.count() > 1){ 59 if(profiles.count() > 1){
73 Config cfg("NetworkSetup"); 60 Config cfg("NetworkSetup");
74 cfg.writeEntry("Profiles", profiles.join(" ")); 61 cfg.writeEntry("Profiles", profiles.join(" "));
75 } 62 }
63 // Delete Modules and Libraries
64 QMap<Module*, QLibrary*>::Iterator it;
65 for( it = libraries.begin(); it != libraries.end(); ++it ){
66 delete it.key();
67 delete it.data();
68 }
76} 69}
77 70
71/**
72 * Load all modules that are found in the path
73 * @param path a directory that is scaned for any plugins that can be loaded
74 * and attempts to load them
75 */
78void MainWindowImp::loadModules(QString path){ 76void MainWindowImp::loadModules(QString path){
79 qDebug(path.latin1()); 77 qDebug(path.latin1());
80 QDir d; 78 QDir d(path);
81 d.setPath(path); 79 if(!d.exists())
82 if(!d.exists()){
83 qDebug("MainWindowImp:: Path doesn't exists");
84 return; 80 return;
85 } 81
82 // Don't want sym links
86 d.setFilter( QDir::Files | QDir::NoSymLinks ); 83 d.setFilter( QDir::Files | QDir::NoSymLinks );
87 const QFileInfoList *list = d.entryInfoList(); 84 const QFileInfoList *list = d.entryInfoList();
88 QFileInfoListIterator it( *list ); 85 QFileInfoListIterator it( *list );
89 QFileInfo *fi; 86 QFileInfo *fi;
90 while ( (fi=it.current()) ) { 87 while ( (fi=it.current()) ) {
91 if(fi->fileName().contains(".so")){ 88 if(fi->fileName().contains(".so")){
92 qDebug("Found"); 89 loadPlugin(path + "/" + fi->fileName());
93 Module *foo = loadPlugin(path + "/" + fi->fileName());
94 } 90 }
95 ++it; 91 ++it;
96 } 92 }
@@ -103,7 +99,7 @@ void MainWindowImp::loadModules(QString path){
103 * @return pointer to the function with name resolveString or NULL 99 * @return pointer to the function with name resolveString or NULL
104 */ 100 */
105Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ 101Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
106 qDebug(pluginFileName.latin1()); 102 qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
107 QLibrary *lib = new QLibrary(pluginFileName); 103 QLibrary *lib = new QLibrary(pluginFileName);
108 void *functionPointer = lib->resolve(resolveString); 104 void *functionPointer = lib->resolve(resolveString);
109 if( !functionPointer ){ 105 if( !functionPointer ){
@@ -120,7 +116,7 @@ Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString)
120 return NULL; 116 return NULL;
121 } 117 }
122 118
123 // Store for reference 119 // Store for deletion later
124 libraries.insert(object, lib); 120 libraries.insert(object, lib);
125 return object; 121 return object;
126} 122}
@@ -130,14 +126,25 @@ Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString)
130 * load the plugin and append it to the list 126 * load the plugin and append it to the list
131 */ 127 */
132void MainWindowImp::addClicked(){ 128void MainWindowImp::addClicked(){
133 // Now that we have a list of all of the protocals, list them. 129 QMap<Module*, QLibrary*>::Iterator it;
134 { 130 QMap<QString, QString> list;
135 QMessageBox::information(this, "No Modules", "Nothing to add.", "Ok"); 131 list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
132 list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
133 for( it = libraries.begin(); it != libraries.end(); ++it ){
134 if(it.key())
135 (it.key())->possibleNewInterfaces(list);
136 }
137 // See if the list has anything that we can add.
138 if(list.count() == 0){
139 QMessageBox::information(this, "Sorry", "Nothing to add.", "Ok");
136 return; 140 return;
137 } 141 }
138 AddServiceImp service(this, "AddService", true); 142 AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
139 service.showMaximized(); 143 addNewConnection.addConnections(list);
140 service.exec(); 144 addNewConnection.showMaximized();
145 if(QDialog::Accepted == addNewConnection.exec()){
146
147 }
141} 148}
142 149
143/** 150/**
@@ -145,7 +152,7 @@ void MainWindowImp::addClicked(){
145 * If they do then remove from the list and unload. 152 * If they do then remove from the list and unload.
146 */ 153 */
147void MainWindowImp::removeClicked(){ 154void MainWindowImp::removeClicked(){
148 QListViewItem *item = serviceList->currentItem(); 155 QListViewItem *item = connectionList->currentItem();
149 if(item == NULL) { 156 if(item == NULL) {
150 QMessageBox::information(this, "Error","Please select an interface.", "Ok"); 157 QMessageBox::information(this, "Error","Please select an interface.", "Ok");
151 return; 158 return;
@@ -161,76 +168,69 @@ void MainWindowImp::removeClicked(){
161} 168}
162 169
163/** 170/**
164 * See if there is a configuration for the selected protocal. 171 * Pull up the configure about the currently selected interface.
165 * Prompt with errors. 172 * Report an error if no interface is selected.
173 * If the interface has a module owner then request its configure with a empty
174 * tab. If tab is !NULL then append the interfaces setup widget to it.
166 */ 175 */
167void MainWindowImp::configureClicked(){ 176void MainWindowImp::configureClicked(){
168 QListViewItem *item = serviceList->currentItem(); 177 QListViewItem *item = connectionList->currentItem();
169 if(item == NULL){ 178 if(!item){
170 QMessageBox::information(this, "Error","Please select an interface.", "Ok"); 179 QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
171 return; 180 return;
172 } 181 }
173 182
174 if((interfaceItems[item])->getModuleOwner() == NULL){ 183 Interface *i = interfaceItems[item];
175 InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]); 184 if(i->getModuleOwner()){
176 conf->showMaximized(); 185 QTabWidget *tabWidget = NULL;
177 conf->show(); 186 QWidget *moduleConfigure = i->getModuleOwner()->configure(&tabWidget);
178 } 187 if(moduleConfigure != NULL){
179 else{ 188 if(tabWidget != NULL){
180 QTabWidget *t = NULL; 189 InterfaceSetupImp *configure = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, true);
181 QWidget *conf = (interfaceItems[item])->getModuleOwner()->configure(&t); 190 tabWidget->insertTab(configure, "TCP/IP");
182 if(conf != NULL){
183 qDebug("Conf found");
184 if(t != NULL){
185 qDebug("Adding Interface");
186 InterfaceSetupImp *i = new InterfaceSetupImp(t, "TCPIPInformation", interfaceItems[item], true);
187 t->insertTab(i, "TCP/IP");
188 } 191 }
189 conf->showMaximized(); 192 moduleConfigure->showMaximized();
190 conf->show(); 193 moduleConfigure->show();
191 } 194 return;
192 else{
193 InterfaceSetupImp *i = new InterfaceSetupImp(0, "TCPIPInformation", interfaceItems[item], true);
194 i->showMaximized();
195 i->show();
196 } 195 }
197 } 196 }
197
198 InterfaceSetupImp *configure = new InterfaceSetupImp(0, "InterfaceSetupImp", i, true);
199 configure->showMaximized();
200 configure->show();
198} 201}
199 202
200/** 203/**
201 * Pull up the information about the selected interface 204 * Pull up the information about the currently selected interface.
202 * Report an error 205 * Report an error if no interface is selected.
206 * If the interface has a module owner then request its configure with a empty
207 * tab. If tab is !NULL then append the interfaces setup widget to it.
203 */ 208 */
204void MainWindowImp::informationClicked(){ 209void MainWindowImp::informationClicked(){
205 QListViewItem *item = serviceList->currentItem(); 210 QListViewItem *item = connectionList->currentItem();
206 if(item == NULL){ 211 if(!item){
207 QMessageBox::information(this, "Error","Please select an interface.", "Ok"); 212 QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
208 return; 213 return;
209 } 214 }
210 215
211 if( (interfaceItems[item])->getModuleOwner() == NULL){ 216 Interface *i = interfaceItems[item];
212 InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]); 217 if(i->getModuleOwner()){
213 i->showMaximized(); 218 QTabWidget *tabWidget = NULL;
214 i->show(); 219 QWidget *moduleInformation = i->getModuleOwner()->information(&tabWidget);
215 } 220 if(moduleInformation != NULL){
216 else{ 221 if(tabWidget != NULL){
217 QTabWidget *t = NULL; 222 InterfaceInformationImp *information = new InterfaceInformationImp(tabWidget, "InterfaceSetupImp", i, true);
218 QWidget *conf = (interfaceItems[item])->getModuleOwner()->information(&t); 223 tabWidget->insertTab(information, "TCP/IP");
219 if(conf != NULL){
220 if(t){
221 qDebug("Adding Interface");
222 InterfaceInformationImp *i = new InterfaceInformationImp(t, "TCPIPInformation", interfaceItems[item], true);
223 t->insertTab(i, "TCP/IP");
224 } 224 }
225 conf->showMaximized(); 225 moduleInformation->showMaximized();
226 conf->show(); 226 moduleInformation->show();
227 return;
227 } 228 }
228 else{ 229 }
229 InterfaceInformationImp *i = new InterfaceInformationImp(0, "TCPIPInformation", interfaceItems[item], true); 230
230 i->showMaximized(); 231 InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true);
231 i->show(); 232 information->showMaximized();
232 } 233 information->show();
233 }
234} 234}
235 235
236/** 236/**
@@ -272,6 +272,10 @@ void MainWindowImp::jobDone(KProcess *process){
272 if(space > 1){ 272 if(space > 1){
273 // We have found an interface 273 // We have found an interface
274 QString interfaceName = line.mid(0, space); 274 QString interfaceName = line.mid(0, space);
275 if(!advancedUserMode){
276 if(interfaceName == "lo")
277 break;
278 }
275 Interface *i; 279 Interface *i;
276 // See if we already have it 280 // See if we already have it
277 if(interfaceNames.find(interfaceName) == interfaceNames.end()){ 281 if(interfaceNames.find(interfaceName) == interfaceNames.end()){
@@ -306,12 +310,15 @@ void MainWindowImp::jobDone(KProcess *process){
306 QFile::remove(fileName); 310 QFile::remove(fileName);
307} 311}
308 312
313/**
314 *
315 */
309void MainWindowImp::updateInterface(Interface *i){ 316void MainWindowImp::updateInterface(Interface *i){
310 QListViewItem *item = NULL; 317 QListViewItem *item = NULL;
311 318
312 // See if we already have it 319 // See if we already have it
313 if(items.find(i) == items.end()){ 320 if(items.find(i) == items.end()){
314 item = new QListViewItem(serviceList, "", "", ""); 321 item = new QListViewItem(connectionList, "", "", "");
315 // See if you can't find a module owner for this interface 322 // See if you can't find a module owner for this interface
316 QMap<Module*, QLibrary*>::Iterator it; 323 QMap<Module*, QLibrary*>::Iterator it;
317 for( it = libraries.begin(); it != libraries.end(); ++it ){ 324 for( it = libraries.begin(); it != libraries.end(); ++it ){
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
@@ -48,6 +48,7 @@ private:
48 QMap<KProcess*, QString> threads; 48 QMap<KProcess*, QString> threads;
49 QStringList profiles; 49 QStringList profiles;
50 50
51 bool advancedUserMode;
51}; 52};
52 53
53#endif 54#endif
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
@@ -16,15 +16,60 @@ signals:
16 16
17public: 17public:
18 Module(){}; 18 Module(){};
19 19
20 /**
21 * get the icon name for this device.
22 * @param Interface* can be used in determining the icon.
23 * @return QString the icon name (minus .png, .gif etc)
24 */
25 virtual QString getPixmapName(Interface* i) = 0;
26
27 /**
28 * Check to see if the interface i is owned by this module.
29 * @param Interface* interface to check against
30 * @return bool true if i is owned by this module, false otherwise.
31 */
20 virtual bool isOwner(Interface *){ return false; }; 32 virtual bool isOwner(Interface *){ return false; };
21 virtual QWidget *configure(QTabWidget **tabWidget){ return NULL; } ; 33
22 virtual QWidget *information(QTabWidget **tabWidget){ return NULL; }; 34 /**
35 * Create, set tabWiget and return the WLANConfigure Module
36 * @param tabWidget a pointer to the tab widget that this configure has.
37 * @return QWidget* pointer to the tab widget in this modules configure.
38 */
39 virtual QWidget *configure(QTabWidget **){ return NULL; } ;
40
41 /**
42 * Create, set tabWiget and return the Information Module
43 * @param tabWidget a pointer to the tab widget that this information has.
44 * @return QWidget* pointer to the tab widget in this modules info.
45 */
46 virtual QWidget *information(QTabWidget **){ return NULL; };
47
48 /**
49 * Get all active (up or down) interfaces
50 * @return QList<Interface> A list of interfaces that exsist that havn't
51 * been called by isOwner()
52 */
23 virtual QList<Interface> getInterfaces() = 0; 53 virtual QList<Interface> getInterfaces() = 0;
24 virtual QMap<QString, QString> possibleNewInterfaces() = 0; 54
55 /**
56 * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp),
57 * modem ppp)
58 */
59 virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0;
60
61 /**
62 * Attempts to create a new interface from name
63 * @return Interface* NULL if it was unable to be created.
64 * @param name the type of interface to create
65 */
25 virtual Interface *addNewInterface(QString name) = 0; 66 virtual Interface *addNewInterface(QString name) = 0;
67
68 /**
69 * Attempts to remove the interface, doesn't delete i
70 * @return bool true if successfull, false otherwise.
71 */
26 virtual bool remove(Interface* i) = 0; 72 virtual bool remove(Interface* i) = 0;
27 virtual QString getPixmapName(Interface* i) = 0;
28 73
29}; 74};
30 75
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 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 #CONFIG = qt warn_on debug 2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release 3 CONFIG = qt warn_on release
4 HEADERS = mainwindowimp.h addserviceimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h 4 HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h
5 SOURCES = main.cpp mainwindowimp.cpp addserviceimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp 5 SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp
6 #INCLUDEPATH+= $(QPEDIR)/include 6 #INCLUDEPATH+= $(QPEDIR)/include
7 #DEPENDPATH+= $(QPEDIR)/include 7 #DEPENDPATH+= $(QPEDIR)/include
8LIBS += -lqpe 8LIBS += -lqpe
9 INTERFACES= mainwindow.ui addservice.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui 9 INTERFACES= mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui
10 TARGET = networksetup 10 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
@@ -11,7 +11,7 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>254</width> 14 <width>250</width>
15 <height>286</height> 15 <height>286</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
@@ -53,7 +53,7 @@
53 </property> 53 </property>
54 <attribute> 54 <attribute>
55 <name>title</name> 55 <name>title</name>
56 <string>Config</string> 56 <string>WLAN General</string>
57 </attribute> 57 </attribute>
58 <vbox> 58 <vbox>
59 <property stdset="1"> 59 <property stdset="1">
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
@@ -20,6 +20,7 @@ QString WLANModule::getPixmapName(Interface* ){
20 20
21/** 21/**
22 * Check to see if the interface i is owned by this module. 22 * Check to see if the interface i is owned by this module.
23 * @param Interface* interface to check against
23 * @return bool true if i is owned by this module, false otherwise. 24 * @return bool true if i is owned by this module, false otherwise.
24 */ 25 */
25bool WLANModule::isOwner(Interface *i){ 26bool WLANModule::isOwner(Interface *i){
@@ -50,17 +51,12 @@ QWidget *WLANModule::information(QTabWidget **tabWidget){
50} 51}
51 52
52/** 53/**
53 * 54 * Get all active (up or down) interfaces
54 */ 55 * @return QList<Interface> A list of interfaces that exsist that havn't
56 * been called by isOwner()
57 */
55QList<Interface> WLANModule::getInterfaces(){ 58QList<Interface> WLANModule::getInterfaces(){
56 return list 59 return list;
57}
58
59/**
60 * Return a list of possible new interfaces
61 */
62QMap<QString, QString> WLANModule::possibleNewInterfaces(){
63 //return list;
64} 60}
65 61
66/** 62/**
@@ -69,7 +65,9 @@ QMap<QString, QString> WLANModule::possibleNewInterfaces(){
69 * by possibleNewInterfaces(); 65 * by possibleNewInterfaces();
70 * @return Interface* NULL if it was unable to be created. 66 * @return Interface* NULL if it was unable to be created.
71 */ 67 */
72Interface *WLANModule::addNewInterface(QString name){ 68Interface *WLANModule::addNewInterface(QString ){
69 // We can't add a 802.11 interface, either the hardware will be there
70 // or it wont.
73 return NULL; 71 return NULL;
74} 72}
75 73
@@ -77,7 +75,8 @@ Interface *WLANModule::addNewInterface(QString name){
77 * Attempts to remove the interface, doesn't delete i 75 * Attempts to remove the interface, doesn't delete i
78 * @return bool true if successfull, false otherwise. 76 * @return bool true if successfull, false otherwise.
79 */ 77 */
80bool WLANModule::remove(Interface* i){ 78bool WLANModule::remove(Interface*){
79 // Can't remove a hardware device, you can stop it though.
81 return false; 80 return false;
82} 81}
83 82
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
@@ -15,7 +15,7 @@ public:
15 virtual QWidget *configure(QTabWidget **tabWidget); 15 virtual QWidget *configure(QTabWidget **tabWidget);
16 virtual QWidget *information(QTabWidget **tabWidget); 16 virtual QWidget *information(QTabWidget **tabWidget);
17 virtual QList<Interface> getInterfaces(); 17 virtual QList<Interface> getInterfaces();
18 virtual QMap<QString, QString> possibleNewInterfaces(); 18 virtual void possibleNewInterfaces(QMap<QString, QString> &list){};
19 virtual Interface *addNewInterface(QString name); 19 virtual Interface *addNewInterface(QString name);
20 virtual bool remove(Interface* i); 20 virtual bool remove(Interface* i);
21 virtual QString getPixmapName(Interface* i); 21 virtual QString getPixmapName(Interface* i);
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 @@
1Fix 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,23 +1,23 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>AddService</class> 2<class>AddConnection</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>AddService</cstring> 7 <cstring>AddConnection</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>245</width> 14 <width>233</width>
15 <height>268</height> 15 <height>268</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Add Network Service</string> 20 <string>Add Network Connection</string>
21 </property> 21 </property>
22 <grid> 22 <grid>
23 <property stdset="1"> 23 <property stdset="1">
@@ -36,7 +36,7 @@
36 </property> 36 </property>
37 <property stdset="1"> 37 <property stdset="1">
38 <name>text</name> 38 <name>text</name>
39 <string>Cancel</string> 39 <string>&amp;Cancel</string>
40 </property> 40 </property>
41 </widget> 41 </widget>
42 <widget row="3" column="0" > 42 <widget row="3" column="0" >
@@ -47,7 +47,7 @@
47 </property> 47 </property>
48 <property stdset="1"> 48 <property stdset="1">
49 <name>text</name> 49 <name>text</name>
50 <string>Add</string> 50 <string>&amp;Add</string>
51 </property> 51 </property>
52 </widget> 52 </widget>
53 <widget row="0" column="0" rowspan="1" colspan="2" > 53 <widget row="0" column="0" rowspan="1" colspan="2" >
@@ -121,8 +121,7 @@
121 </property> 121 </property>
122 <property stdset="1"> 122 <property stdset="1">
123 <name>text</name> 123 <name>text</name>
124 <string>LAN - TCP/IP 124 <string></string>
125For Local-area network connections through PC_CARD network interfdace cards.</string>
126 </property> 125 </property>
127 <property stdset="1"> 126 <property stdset="1">
128 <name>alignment</name> 127 <name>alignment</name>
@@ -141,13 +140,13 @@ For Local-area network connections through PC_CARD network interfdace cards.</st
141 <connection> 140 <connection>
142 <sender>cancelButton</sender> 141 <sender>cancelButton</sender>
143 <signal>clicked()</signal> 142 <signal>clicked()</signal>
144 <receiver>AddService</receiver> 143 <receiver>AddConnection</receiver>
145 <slot>reject()</slot> 144 <slot>reject()</slot>
146 </connection> 145 </connection>
147 <connection> 146 <connection>
148 <sender>addButton</sender> 147 <sender>addButton</sender>
149 <signal>clicked()</signal> 148 <signal>clicked()</signal>
150 <receiver>AddService</receiver> 149 <receiver>AddConnection</receiver>
151 <slot>accept()</slot> 150 <slot>accept()</slot>
152 </connection> 151 </connection>
153</connections> 152</connections>
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 @@
1#include "addconnectionimp.h"
2#include <qlistview.h>
3#include <qlist.h>
4#include <qlabel.h>
5#include <qheader.h>
6
7/**
8 * Constructor
9 */
10AddConnectionImp::AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0):AddConnection(parent, name, f){
11 connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed()));
12 registeredServicesList->header()->hide();
13};
14
15/**
16 * The current item changed, update the discription.
17 */
18void AddConnectionImp::changed(){
19 QListViewItem *item = registeredServicesList->currentItem();
20 if(item){
21 help->setText(list[item->text(0)]);
22 }
23}
24
25/**
26 * Save a copy of newList for the discriptions and append them all to the view
27 * @param newList the new list of possible interfaces
28 */
29void AddConnectionImp::addConnections(QMap<QString, QString> newList){
30 list = newList;
31 QMap<QString, QString>::Iterator it;
32 for( it = list.begin(); it != list.end(); ++it )
33 QListViewItem *item = new QListViewItem(registeredServicesList, it.key());
34 registeredServicesList->setCurrentItem(registeredServicesList->firstChild());
35}
36
37// addserviceimp.cpp
38
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 @@
1#ifndef ADDCONNECTIONIMP_H
2#define ADDCONNECTIONIMP_H
3
4#include "addconnection.h"
5#include <qmap.h>
6#include <qlist.h>
7
8class QListViewItem;
9
10class AddConnectionImp : public AddConnection {
11
12Q_OBJECT
13
14public:
15 AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0);
16 void addConnections(QMap<QString, QString> newList);
17
18private slots:
19 void changed();
20
21private:
22 QMap<QString, QString> list;
23
24};
25
26#endif
27
28// addconectionimp.h
29
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 @@
1#include "addserviceimp.h"
2#include <qpe/qlibrary.h>
3#include <qlistview.h>
4#include <qlist.h>
5
6void AddServiceImp::addServices(QList<QString> list){
7 list.setAutoDelete(true);
8
9 for(uint i = 0; i < list.count(); i++){
10 QString pluginFileName = "";
11 QLibrary *lib = new QLibrary(pluginFileName);
12 void *functionPointer = lib->resolve("info");
13 if( !functionPointer ){
14 qDebug(QString("AddServiceImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
15 delete lib;
16 break;
17 }
18
19 // Try to get an info.
20 QString info = ((QString (*)()) functionPointer)();
21 QListViewItem *newItem = new QListViewItem(registeredServicesList, info);
22 }
23}
24
25
26// 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 @@
1#ifndef ADDSERVICEIMP_H
2#define ADDSERVICEIMP_H
3
4#include "addservice.h"
5#include <qmap.h>
6#include <qlist.h>
7
8class QListViewItem;
9
10class AddServiceImp : public AddService {
11
12Q_OBJECT
13
14public:
15 AddServiceImp(QWidget *parent=0, const char *name=0, WFlags f=0):AddService(parent, name, f){};
16 void addServices(QList<QString> list);
17
18private:
19 QMap<QListViewItem*, QString> pluginInfo;
20
21};
22
23#endif
24
25// addserviceimp.h
26
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
@@ -4,6 +4,7 @@
4#include <qstring.h> 4#include <qstring.h>
5 5
6class Module; 6class Module;
7
7class Interface { 8class Interface {
8 9
9public: 10public:
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
@@ -13,7 +13,6 @@
13 13
14#include <assert.h> 14#include <assert.h>
15 15
16#define INTERFACE_FILE "/home/ben/interfaces"
17#define DNSSCRIPT "interfacednsscript" 16#define DNSSCRIPT "interfacednsscript"
18 17
19/** 18/**
@@ -22,7 +21,7 @@
22InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){ 21InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){
23 assert(i); 22 assert(i);
24 interface = i; 23 interface = i;
25 interfaces = new Interfaces(INTERFACE_FILE); 24 interfaces = new Interfaces();
26 changeProfile(profileCombo->currentText()); 25 changeProfile(profileCombo->currentText());
27 bool error = false; 26 bool error = false;
28 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ 27 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
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
@@ -102,7 +102,7 @@
102 </column> 102 </column>
103 <property stdset="1"> 103 <property stdset="1">
104 <name>name</name> 104 <name>name</name>
105 <cstring>serviceList</cstring> 105 <cstring>connectionList</cstring>
106 </property> 106 </property>
107 <property stdset="1"> 107 <property stdset="1">
108 <name>allColumnsShowFocus</name> 108 <name>allColumnsShowFocus</name>
@@ -131,7 +131,7 @@
131 <class>QPushButton</class> 131 <class>QPushButton</class>
132 <property stdset="1"> 132 <property stdset="1">
133 <name>name</name> 133 <name>name</name>
134 <cstring>addServiceButton</cstring> 134 <cstring>addConnectionButton</cstring>
135 </property> 135 </property>
136 <property stdset="1"> 136 <property stdset="1">
137 <name>text</name> 137 <name>text</name>
@@ -142,7 +142,7 @@
142 <class>QPushButton</class> 142 <class>QPushButton</class>
143 <property stdset="1"> 143 <property stdset="1">
144 <name>name</name> 144 <name>name</name>
145 <cstring>informationServiceButton</cstring> 145 <cstring>informationConnectionButton</cstring>
146 </property> 146 </property>
147 <property stdset="1"> 147 <property stdset="1">
148 <name>text</name> 148 <name>text</name>
@@ -153,7 +153,7 @@
153 <class>QPushButton</class> 153 <class>QPushButton</class>
154 <property stdset="1"> 154 <property stdset="1">
155 <name>name</name> 155 <name>name</name>
156 <cstring>configureServiceButton</cstring> 156 <cstring>configureConnectionButton</cstring>
157 </property> 157 </property>
158 <property stdset="1"> 158 <property stdset="1">
159 <name>text</name> 159 <name>text</name>
@@ -164,7 +164,7 @@
164 <class>QPushButton</class> 164 <class>QPushButton</class>
165 <property stdset="1"> 165 <property stdset="1">
166 <name>name</name> 166 <name>name</name>
167 <cstring>removeServiceButton</cstring> 167 <cstring>removeConnectionButton</cstring>
168 </property> 168 </property>
169 <property stdset="1"> 169 <property stdset="1">
170 <name>text</name> 170 <name>text</name>
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,10 +1,10 @@
1#include "mainwindowimp.h" 1#include "mainwindowimp.h"
2#include "addserviceimp.h" 2#include "addconnectionimp.h"
3#include "interfaceinformationimp.h" 3#include "interfaceinformationimp.h"
4#include "interfacesetupimp.h" 4#include "interfacesetupimp.h"
5#include "kprocess.h"
6#include "module.h" 5#include "module.h"
7 6
7#include "kprocess.h"
8 8
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qtabwidget.h> 10#include <qtabwidget.h>
@@ -25,72 +25,68 @@
25#include <qfile.h> 25#include <qfile.h>
26#include <qtextstream.h> 26#include <qtextstream.h>
27 27
28// For library loading.
29#include <dlfcn.h>
30
31#define TEMP_ALL "/tmp/ifconfig-a" 28#define TEMP_ALL "/tmp/ifconfig-a"
32#define TEMP_UP "/tmp/ifconfig" 29#define TEMP_UP "/tmp/ifconfig"
33 30
34MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) { 31MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
35 connect(addServiceButton, SIGNAL(clicked()), this, SLOT(addClicked())); 32 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
36 connect(removeServiceButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 33 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
37 connect(informationServiceButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 34 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
38 connect(configureServiceButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 35 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
39 36
40 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 37 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
41 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 38 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
42 connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&))); 39 connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&)));
43 40
44 // Make sure we have a plugin directory to scan. 41 // Load connections.
45 QString DirStr = QDir::homeDirPath() + "/.networksetup/" ; 42 loadModules(QDir::homeDirPath() + "/.networksetup/plugins");
46 QDir pluginDir( DirStr );
47 pluginDir.mkdir( DirStr );
48 pluginDir.mkdir( ( DirStr + "plugins/" ) );
49 QString path = DirStr + "plugins";
50 pluginDir.setPath(path);
51 if(!pluginDir.exists()){
52 qDebug(QString("MainWindowImp: ERROR: %1 %2").arg(__FILE__).arg(__LINE__).latin1());
53 return;
54 }
55
56 // Load any saved services.
57 loadModules(path);
58 getInterfaceList(); 43 getInterfaceList();
59 serviceList->header()->hide(); 44 connectionList->header()->hide();
60 45
61 46
62 Config cfg("NetworkSetup"); 47 Config cfg("NetworkSetup");
63 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 48 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
64 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 49 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
65 profilesList->insertItem((*it)); 50 profilesList->insertItem((*it));
51 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
66} 52}
67 53
68/** 54/**
69 * Deconstructor. Unload libraries and save profile list. 55 * Deconstructor. Save profiles. Delete loaded libraries.
70 */ 56 */
71MainWindowImp::~MainWindowImp(){ 57MainWindowImp::~MainWindowImp(){
58 // Save profiles.
72 if(profiles.count() > 1){ 59 if(profiles.count() > 1){
73 Config cfg("NetworkSetup"); 60 Config cfg("NetworkSetup");
74 cfg.writeEntry("Profiles", profiles.join(" ")); 61 cfg.writeEntry("Profiles", profiles.join(" "));
75 } 62 }
63 // Delete Modules and Libraries
64 QMap<Module*, QLibrary*>::Iterator it;
65 for( it = libraries.begin(); it != libraries.end(); ++it ){
66 delete it.key();
67 delete it.data();
68 }
76} 69}
77 70
71/**
72 * Load all modules that are found in the path
73 * @param path a directory that is scaned for any plugins that can be loaded
74 * and attempts to load them
75 */
78void MainWindowImp::loadModules(QString path){ 76void MainWindowImp::loadModules(QString path){
79 qDebug(path.latin1()); 77 qDebug(path.latin1());
80 QDir d; 78 QDir d(path);
81 d.setPath(path); 79 if(!d.exists())
82 if(!d.exists()){
83 qDebug("MainWindowImp:: Path doesn't exists");
84 return; 80 return;
85 } 81
82 // Don't want sym links
86 d.setFilter( QDir::Files | QDir::NoSymLinks ); 83 d.setFilter( QDir::Files | QDir::NoSymLinks );
87 const QFileInfoList *list = d.entryInfoList(); 84 const QFileInfoList *list = d.entryInfoList();
88 QFileInfoListIterator it( *list ); 85 QFileInfoListIterator it( *list );
89 QFileInfo *fi; 86 QFileInfo *fi;
90 while ( (fi=it.current()) ) { 87 while ( (fi=it.current()) ) {
91 if(fi->fileName().contains(".so")){ 88 if(fi->fileName().contains(".so")){
92 qDebug("Found"); 89 loadPlugin(path + "/" + fi->fileName());
93 Module *foo = loadPlugin(path + "/" + fi->fileName());
94 } 90 }
95 ++it; 91 ++it;
96 } 92 }
@@ -103,7 +99,7 @@ void MainWindowImp::loadModules(QString path){
103 * @return pointer to the function with name resolveString or NULL 99 * @return pointer to the function with name resolveString or NULL
104 */ 100 */
105Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ 101Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
106 qDebug(pluginFileName.latin1()); 102 qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
107 QLibrary *lib = new QLibrary(pluginFileName); 103 QLibrary *lib = new QLibrary(pluginFileName);
108 void *functionPointer = lib->resolve(resolveString); 104 void *functionPointer = lib->resolve(resolveString);
109 if( !functionPointer ){ 105 if( !functionPointer ){
@@ -120,7 +116,7 @@ Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString)
120 return NULL; 116 return NULL;
121 } 117 }
122 118
123 // Store for reference 119 // Store for deletion later
124 libraries.insert(object, lib); 120 libraries.insert(object, lib);
125 return object; 121 return object;
126} 122}
@@ -130,14 +126,25 @@ Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString)
130 * load the plugin and append it to the list 126 * load the plugin and append it to the list
131 */ 127 */
132void MainWindowImp::addClicked(){ 128void MainWindowImp::addClicked(){
133 // Now that we have a list of all of the protocals, list them. 129 QMap<Module*, QLibrary*>::Iterator it;
134 { 130 QMap<QString, QString> list;
135 QMessageBox::information(this, "No Modules", "Nothing to add.", "Ok"); 131 list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
132 list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
133 for( it = libraries.begin(); it != libraries.end(); ++it ){
134 if(it.key())
135 (it.key())->possibleNewInterfaces(list);
136 }
137 // See if the list has anything that we can add.
138 if(list.count() == 0){
139 QMessageBox::information(this, "Sorry", "Nothing to add.", "Ok");
136 return; 140 return;
137 } 141 }
138 AddServiceImp service(this, "AddService", true); 142 AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
139 service.showMaximized(); 143 addNewConnection.addConnections(list);
140 service.exec(); 144 addNewConnection.showMaximized();
145 if(QDialog::Accepted == addNewConnection.exec()){
146
147 }
141} 148}
142 149
143/** 150/**
@@ -145,7 +152,7 @@ void MainWindowImp::addClicked(){
145 * If they do then remove from the list and unload. 152 * If they do then remove from the list and unload.
146 */ 153 */
147void MainWindowImp::removeClicked(){ 154void MainWindowImp::removeClicked(){
148 QListViewItem *item = serviceList->currentItem(); 155 QListViewItem *item = connectionList->currentItem();
149 if(item == NULL) { 156 if(item == NULL) {
150 QMessageBox::information(this, "Error","Please select an interface.", "Ok"); 157 QMessageBox::information(this, "Error","Please select an interface.", "Ok");
151 return; 158 return;
@@ -161,76 +168,69 @@ void MainWindowImp::removeClicked(){
161} 168}
162 169
163/** 170/**
164 * See if there is a configuration for the selected protocal. 171 * Pull up the configure about the currently selected interface.
165 * Prompt with errors. 172 * Report an error if no interface is selected.
173 * If the interface has a module owner then request its configure with a empty
174 * tab. If tab is !NULL then append the interfaces setup widget to it.
166 */ 175 */
167void MainWindowImp::configureClicked(){ 176void MainWindowImp::configureClicked(){
168 QListViewItem *item = serviceList->currentItem(); 177 QListViewItem *item = connectionList->currentItem();
169 if(item == NULL){ 178 if(!item){
170 QMessageBox::information(this, "Error","Please select an interface.", "Ok"); 179 QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
171 return; 180 return;
172 } 181 }
173 182
174 if((interfaceItems[item])->getModuleOwner() == NULL){ 183 Interface *i = interfaceItems[item];
175 InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]); 184 if(i->getModuleOwner()){
176 conf->showMaximized(); 185 QTabWidget *tabWidget = NULL;
177 conf->show(); 186 QWidget *moduleConfigure = i->getModuleOwner()->configure(&tabWidget);
178 } 187 if(moduleConfigure != NULL){
179 else{ 188 if(tabWidget != NULL){
180 QTabWidget *t = NULL; 189 InterfaceSetupImp *configure = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, true);
181 QWidget *conf = (interfaceItems[item])->getModuleOwner()->configure(&t); 190 tabWidget->insertTab(configure, "TCP/IP");
182 if(conf != NULL){
183 qDebug("Conf found");
184 if(t != NULL){
185 qDebug("Adding Interface");
186 InterfaceSetupImp *i = new InterfaceSetupImp(t, "TCPIPInformation", interfaceItems[item], true);
187 t->insertTab(i, "TCP/IP");
188 } 191 }
189 conf->showMaximized(); 192 moduleConfigure->showMaximized();
190 conf->show(); 193 moduleConfigure->show();
191 } 194 return;
192 else{
193 InterfaceSetupImp *i = new InterfaceSetupImp(0, "TCPIPInformation", interfaceItems[item], true);
194 i->showMaximized();
195 i->show();
196 } 195 }
197 } 196 }
197
198 InterfaceSetupImp *configure = new InterfaceSetupImp(0, "InterfaceSetupImp", i, true);
199 configure->showMaximized();
200 configure->show();
198} 201}
199 202
200/** 203/**
201 * Pull up the information about the selected interface 204 * Pull up the information about the currently selected interface.
202 * Report an error 205 * Report an error if no interface is selected.
206 * If the interface has a module owner then request its configure with a empty
207 * tab. If tab is !NULL then append the interfaces setup widget to it.
203 */ 208 */
204void MainWindowImp::informationClicked(){ 209void MainWindowImp::informationClicked(){
205 QListViewItem *item = serviceList->currentItem(); 210 QListViewItem *item = connectionList->currentItem();
206 if(item == NULL){ 211 if(!item){
207 QMessageBox::information(this, "Error","Please select an interface.", "Ok"); 212 QMessageBox::information(this, "Error","Please select an interface.", QMessageBox::Ok);
208 return; 213 return;
209 } 214 }
210 215
211 if( (interfaceItems[item])->getModuleOwner() == NULL){ 216 Interface *i = interfaceItems[item];
212 InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]); 217 if(i->getModuleOwner()){
213 i->showMaximized(); 218 QTabWidget *tabWidget = NULL;
214 i->show(); 219 QWidget *moduleInformation = i->getModuleOwner()->information(&tabWidget);
215 } 220 if(moduleInformation != NULL){
216 else{ 221 if(tabWidget != NULL){
217 QTabWidget *t = NULL; 222 InterfaceInformationImp *information = new InterfaceInformationImp(tabWidget, "InterfaceSetupImp", i, true);
218 QWidget *conf = (interfaceItems[item])->getModuleOwner()->information(&t); 223 tabWidget->insertTab(information, "TCP/IP");
219 if(conf != NULL){
220 if(t){
221 qDebug("Adding Interface");
222 InterfaceInformationImp *i = new InterfaceInformationImp(t, "TCPIPInformation", interfaceItems[item], true);
223 t->insertTab(i, "TCP/IP");
224 } 224 }
225 conf->showMaximized(); 225 moduleInformation->showMaximized();
226 conf->show(); 226 moduleInformation->show();
227 return;
227 } 228 }
228 else{ 229 }
229 InterfaceInformationImp *i = new InterfaceInformationImp(0, "TCPIPInformation", interfaceItems[item], true); 230
230 i->showMaximized(); 231 InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true);
231 i->show(); 232 information->showMaximized();
232 } 233 information->show();
233 }
234} 234}
235 235
236/** 236/**
@@ -272,6 +272,10 @@ void MainWindowImp::jobDone(KProcess *process){
272 if(space > 1){ 272 if(space > 1){
273 // We have found an interface 273 // We have found an interface
274 QString interfaceName = line.mid(0, space); 274 QString interfaceName = line.mid(0, space);
275 if(!advancedUserMode){
276 if(interfaceName == "lo")
277 break;
278 }
275 Interface *i; 279 Interface *i;
276 // See if we already have it 280 // See if we already have it
277 if(interfaceNames.find(interfaceName) == interfaceNames.end()){ 281 if(interfaceNames.find(interfaceName) == interfaceNames.end()){
@@ -306,12 +310,15 @@ void MainWindowImp::jobDone(KProcess *process){
306 QFile::remove(fileName); 310 QFile::remove(fileName);
307} 311}
308 312
313/**
314 *
315 */
309void MainWindowImp::updateInterface(Interface *i){ 316void MainWindowImp::updateInterface(Interface *i){
310 QListViewItem *item = NULL; 317 QListViewItem *item = NULL;
311 318
312 // See if we already have it 319 // See if we already have it
313 if(items.find(i) == items.end()){ 320 if(items.find(i) == items.end()){
314 item = new QListViewItem(serviceList, "", "", ""); 321 item = new QListViewItem(connectionList, "", "", "");
315 // See if you can't find a module owner for this interface 322 // See if you can't find a module owner for this interface
316 QMap<Module*, QLibrary*>::Iterator it; 323 QMap<Module*, QLibrary*>::Iterator it;
317 for( it = libraries.begin(); it != libraries.end(); ++it ){ 324 for( it = libraries.begin(); it != libraries.end(); ++it ){
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
@@ -48,6 +48,7 @@ private:
48 QMap<KProcess*, QString> threads; 48 QMap<KProcess*, QString> threads;
49 QStringList profiles; 49 QStringList profiles;
50 50
51 bool advancedUserMode;
51}; 52};
52 53
53#endif 54#endif
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
@@ -16,15 +16,60 @@ signals:
16 16
17public: 17public:
18 Module(){}; 18 Module(){};
19 19
20 /**
21 * get the icon name for this device.
22 * @param Interface* can be used in determining the icon.
23 * @return QString the icon name (minus .png, .gif etc)
24 */
25 virtual QString getPixmapName(Interface* i) = 0;
26
27 /**
28 * Check to see if the interface i is owned by this module.
29 * @param Interface* interface to check against
30 * @return bool true if i is owned by this module, false otherwise.
31 */
20 virtual bool isOwner(Interface *){ return false; }; 32 virtual bool isOwner(Interface *){ return false; };
21 virtual QWidget *configure(QTabWidget **tabWidget){ return NULL; } ; 33
22 virtual QWidget *information(QTabWidget **tabWidget){ return NULL; }; 34 /**
35 * Create, set tabWiget and return the WLANConfigure Module
36 * @param tabWidget a pointer to the tab widget that this configure has.
37 * @return QWidget* pointer to the tab widget in this modules configure.
38 */
39 virtual QWidget *configure(QTabWidget **){ return NULL; } ;
40
41 /**
42 * Create, set tabWiget and return the Information Module
43 * @param tabWidget a pointer to the tab widget that this information has.
44 * @return QWidget* pointer to the tab widget in this modules info.
45 */
46 virtual QWidget *information(QTabWidget **){ return NULL; };
47
48 /**
49 * Get all active (up or down) interfaces
50 * @return QList<Interface> A list of interfaces that exsist that havn't
51 * been called by isOwner()
52 */
23 virtual QList<Interface> getInterfaces() = 0; 53 virtual QList<Interface> getInterfaces() = 0;
24 virtual QMap<QString, QString> possibleNewInterfaces() = 0; 54
55 /**
56 * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp),
57 * modem ppp)
58 */
59 virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0;
60
61 /**
62 * Attempts to create a new interface from name
63 * @return Interface* NULL if it was unable to be created.
64 * @param name the type of interface to create
65 */
25 virtual Interface *addNewInterface(QString name) = 0; 66 virtual Interface *addNewInterface(QString name) = 0;
67
68 /**
69 * Attempts to remove the interface, doesn't delete i
70 * @return bool true if successfull, false otherwise.
71 */
26 virtual bool remove(Interface* i) = 0; 72 virtual bool remove(Interface* i) = 0;
27 virtual QString getPixmapName(Interface* i) = 0;
28 73
29}; 74};
30 75
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 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 #CONFIG = qt warn_on debug 2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release 3 CONFIG = qt warn_on release
4 HEADERS = mainwindowimp.h addserviceimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h 4 HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h
5 SOURCES = main.cpp mainwindowimp.cpp addserviceimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp 5 SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp
6 #INCLUDEPATH+= $(QPEDIR)/include 6 #INCLUDEPATH+= $(QPEDIR)/include
7 #DEPENDPATH+= $(QPEDIR)/include 7 #DEPENDPATH+= $(QPEDIR)/include
8LIBS += -lqpe 8LIBS += -lqpe
9 INTERFACES= mainwindow.ui addservice.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui 9 INTERFACES= mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui
10 TARGET = networksetup 10 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
@@ -11,7 +11,7 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>254</width> 14 <width>250</width>
15 <height>286</height> 15 <height>286</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
@@ -53,7 +53,7 @@
53 </property> 53 </property>
54 <attribute> 54 <attribute>
55 <name>title</name> 55 <name>title</name>
56 <string>Config</string> 56 <string>WLAN General</string>
57 </attribute> 57 </attribute>
58 <vbox> 58 <vbox>
59 <property stdset="1"> 59 <property stdset="1">
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
@@ -20,6 +20,7 @@ QString WLANModule::getPixmapName(Interface* ){
20 20
21/** 21/**
22 * Check to see if the interface i is owned by this module. 22 * Check to see if the interface i is owned by this module.
23 * @param Interface* interface to check against
23 * @return bool true if i is owned by this module, false otherwise. 24 * @return bool true if i is owned by this module, false otherwise.
24 */ 25 */
25bool WLANModule::isOwner(Interface *i){ 26bool WLANModule::isOwner(Interface *i){
@@ -50,17 +51,12 @@ QWidget *WLANModule::information(QTabWidget **tabWidget){
50} 51}
51 52
52/** 53/**
53 * 54 * Get all active (up or down) interfaces
54 */ 55 * @return QList<Interface> A list of interfaces that exsist that havn't
56 * been called by isOwner()
57 */
55QList<Interface> WLANModule::getInterfaces(){ 58QList<Interface> WLANModule::getInterfaces(){
56 return list 59 return list;
57}
58
59/**
60 * Return a list of possible new interfaces
61 */
62QMap<QString, QString> WLANModule::possibleNewInterfaces(){
63 //return list;
64} 60}
65 61
66/** 62/**
@@ -69,7 +65,9 @@ QMap<QString, QString> WLANModule::possibleNewInterfaces(){
69 * by possibleNewInterfaces(); 65 * by possibleNewInterfaces();
70 * @return Interface* NULL if it was unable to be created. 66 * @return Interface* NULL if it was unable to be created.
71 */ 67 */
72Interface *WLANModule::addNewInterface(QString name){ 68Interface *WLANModule::addNewInterface(QString ){
69 // We can't add a 802.11 interface, either the hardware will be there
70 // or it wont.
73 return NULL; 71 return NULL;
74} 72}
75 73
@@ -77,7 +75,8 @@ Interface *WLANModule::addNewInterface(QString name){
77 * Attempts to remove the interface, doesn't delete i 75 * Attempts to remove the interface, doesn't delete i
78 * @return bool true if successfull, false otherwise. 76 * @return bool true if successfull, false otherwise.
79 */ 77 */
80bool WLANModule::remove(Interface* i){ 78bool WLANModule::remove(Interface*){
79 // Can't remove a hardware device, you can stop it though.
81 return false; 80 return false;
82} 81}
83 82
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
@@ -15,7 +15,7 @@ public:
15 virtual QWidget *configure(QTabWidget **tabWidget); 15 virtual QWidget *configure(QTabWidget **tabWidget);
16 virtual QWidget *information(QTabWidget **tabWidget); 16 virtual QWidget *information(QTabWidget **tabWidget);
17 virtual QList<Interface> getInterfaces(); 17 virtual QList<Interface> getInterfaces();
18 virtual QMap<QString, QString> possibleNewInterfaces(); 18 virtual void possibleNewInterfaces(QMap<QString, QString> &list){};
19 virtual Interface *addNewInterface(QString name); 19 virtual Interface *addNewInterface(QString name);
20 virtual bool remove(Interface* i); 20 virtual bool remove(Interface* i);
21 virtual QString getPixmapName(Interface* i); 21 virtual QString getPixmapName(Interface* i);