summaryrefslogtreecommitdiff
authorbenmeyer <benmeyer>2002-10-01 21:21:48 (UTC)
committer benmeyer <benmeyer>2002-10-01 21:21:48 (UTC)
commit1ed782f91c1af59e31c117809ca5d9150b8b6654 (patch) (side-by-side diff)
treed29c3f84dee9a01649d246a625a71d38274dbaae
parent2987dafbdfa6602c5e165fe862546ea32f5fd3ca (diff)
downloadopie-1ed782f91c1af59e31c117809ca5d9150b8b6654.zip
opie-1ed782f91c1af59e31c117809ca5d9150b8b6654.tar.gz
opie-1ed782f91c1af59e31c117809ca5d9150b8b6654.tar.bz2
Getting modules to work
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/networksetup/interface.cpp2
-rw-r--r--noncore/net/networksetup/interface.h7
-rw-r--r--noncore/net/networksetup/interfacesetup.ui146
-rw-r--r--noncore/net/networksetup/mainwindow.ui74
-rw-r--r--noncore/net/networksetup/mainwindowimp.cpp51
-rw-r--r--noncore/net/networksetup/mainwindowimp.h1
-rw-r--r--noncore/net/networksetup/module.h7
-rw-r--r--noncore/net/networksetup/networksetup.pro4
-rw-r--r--noncore/settings/networksettings/interface.cpp2
-rw-r--r--noncore/settings/networksettings/interface.h7
-rw-r--r--noncore/settings/networksettings/interfacesetup.ui146
-rw-r--r--noncore/settings/networksettings/mainwindow.ui74
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp51
-rw-r--r--noncore/settings/networksettings/mainwindowimp.h1
-rw-r--r--noncore/settings/networksettings/module.h7
-rw-r--r--noncore/settings/networksettings/networksetup.pro4
16 files changed, 410 insertions, 174 deletions
diff --git a/noncore/net/networksetup/interface.cpp b/noncore/net/networksetup/interface.cpp
index f6eed00..5b21364 100644
--- a/noncore/net/networksetup/interface.cpp
+++ b/noncore/net/networksetup/interface.cpp
@@ -9,9 +9,9 @@
#include <stdio.h>
#include <stdlib.h>
-Interface::Interface(QString name, bool newSatus): status(newSatus), attached(false), interfaceName(name), hardareName("Unknown"), moduleOwner("Default"), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
+Interface::Interface(QString name, bool newSatus): status(newSatus), attached(false), interfaceName(name), hardareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
refresh();
}
/**
diff --git a/noncore/net/networksetup/interface.h b/noncore/net/networksetup/interface.h
index 1ad71eb..5dc95a4 100644
--- a/noncore/net/networksetup/interface.h
+++ b/noncore/net/networksetup/interface.h
@@ -2,8 +2,9 @@
#define INTERFACE_H
#include <qstring.h>
+class Module;
class Interface {
public:
Interface(QString name = "unknown", bool status = false);
@@ -20,10 +21,10 @@ public:
virtual QString getHardwareName(){ return hardareName; };
virtual void setHardwareName(QString name="Unknown"){ hardareName = name; };
- virtual QString getModuleOwner(){ return moduleOwner; };
- virtual void setModuleOwner(QString owner="Default"){ moduleOwner = owner; };
+ virtual Module* getModuleOwner(){ return moduleOwner; };
+ virtual void setModuleOwner(Module *owner=NULL){ moduleOwner = owner; };
// inet information.
QString getMacAddress(){ return macAddress; };
QString getIp(){ return ip; };
@@ -44,9 +45,9 @@ private:
bool status;
bool attached;
QString interfaceName;
QString hardareName;
- QString moduleOwner;
+ Module *moduleOwner;
// Network information
QString macAddress;
QString ip;
diff --git a/noncore/net/networksetup/interfacesetup.ui b/noncore/net/networksetup/interfacesetup.ui
index ff9810e..d367608 100644
--- a/noncore/net/networksetup/interfacesetup.ui
+++ b/noncore/net/networksetup/interfacesetup.ui
@@ -10,48 +10,63 @@
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>177</width>
- <height>320</height>
+ <width>271</width>
+ <height>280</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Interface Configuration</string>
</property>
- <grid>
+ <vbox>
<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="2" >
- <class>Line</class>
+ <widget>
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>Line1</cstring>
+ <cstring>autoStart</cstring>
</property>
<property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
+ <name>text</name>
+ <string>Automaticly bring up</string>
</property>
</widget>
- <widget row="0" column="0" rowspan="1" colspan="2" >
- <class>QCheckBox</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>autoStart</cstring>
+ <cstring>Layout8</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Automaticly bring up</string>
+ <string>Profile</string>
</property>
</widget>
- <widget row="2" column="1" >
+ <widget>
<class>QComboBox</class>
<item>
<property>
<name>text</name>
@@ -62,20 +77,47 @@
<name>name</name>
<cstring>profileCombo</cstring>
</property>
</widget>
- <widget row="4" column="0" >
- <class>QLabel</class>
- <property stdset="1">
+ <spacer>
+ <property>
<name>name</name>
- <cstring>leaseHoursLabel</cstring>
+ <cstring>Spacer20</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>Requested Lease</string>
+ <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>
+ </hbox>
</widget>
- <widget row="3" column="0" rowspan="1" colspan="2" >
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout9</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>dhcpCheckBox</cstring>
@@ -88,20 +130,20 @@
<name>checked</name>
<bool>true</bool>
</property>
</widget>
- <widget row="2" column="0" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1</cstring>
+ <cstring>leaseHoursLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Profile:</string>
+ <string>Requested Lease</string>
</property>
</widget>
- <widget row="4" column="1" >
+ <widget>
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>leaseTime</cstring>
@@ -122,30 +164,11 @@
<name>value</name>
<number>24</number>
</property>
</widget>
- <spacer row="6" column="1" >
- <property>
- <name>name</name>
- <cstring>Spacer9</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="5" column="0" rowspan="1" colspan="2" >
+ </hbox>
+ </widget>
+ <widget>
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>staticGroupBox</cstring>
@@ -154,8 +177,16 @@
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
+ <name>frameShape</name>
+ <enum>Box</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
+ </property>
+ <property stdset="1">
<name>title</name>
<string>Static Ip Configuration</string>
</property>
<grid>
@@ -258,9 +289,30 @@
</property>
</widget>
</grid>
</widget>
- </grid>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer9</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
</widget>
<connections>
<connection>
<sender>dhcpCheckBox</sender>
diff --git a/noncore/net/networksetup/mainwindow.ui b/noncore/net/networksetup/mainwindow.ui
index c1fa101..a3f7bb1 100644
--- a/noncore/net/networksetup/mainwindow.ui
+++ b/noncore/net/networksetup/mainwindow.ui
@@ -10,9 +10,9 @@
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>218</width>
+ <width>217</width>
<height>289</height>
</rect>
</property>
<property stdset="1">
@@ -193,9 +193,20 @@
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget row="0" column="0" rowspan="1" colspan="2" >
+ <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>
@@ -204,9 +215,9 @@
<name>text</name>
<string>Current Profile</string>
</property>
</widget>
- <widget row="0" column="2" >
+ <widget row="0" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>currentProfileLabel</cstring>
@@ -223,20 +234,30 @@
<name>text</name>
<string>All</string>
</property>
</widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
- <property stdset="1">
+ <spacer row="0" column="2" >
+ <property>
<name>name</name>
- <cstring>TextLabel1_2</cstring>
+ <cstring>Spacer2</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>Profiles</string>
+ <name>orientation</name>
+ <enum>Horizontal</enum>
</property>
- </widget>
- <spacer row="5" column="2" >
+ <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>
@@ -255,16 +276,9 @@
<height>20</height>
</size>
</property>
</spacer>
- <widget row="2" column="0" rowspan="3" colspan="1" >
- <class>QListBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>profilesList</cstring>
- </property>
- </widget>
- <widget row="4" column="1" rowspan="1" colspan="2" >
+ <widget row="5" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>PushButton7</cstring>
@@ -273,9 +287,9 @@
<name>text</name>
<string>&amp;Set Current</string>
</property>
</widget>
- <widget row="3" column="1" rowspan="1" colspan="2" >
+ <widget row="4" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>removeProfileButton</cstring>
@@ -284,9 +298,9 @@
<name>text</name>
<string>&amp;Remove</string>
</property>
</widget>
- <widget row="2" column="1" rowspan="1" colspan="2" >
+ <widget row="3" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>newProfileButton</cstring>
@@ -295,8 +309,26 @@
<name>text</name>
<string>&amp;New</string>
</property>
</widget>
+ <widget row="2" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Profiles</string>
+ </property>
+ </widget>
+ <widget row="3" column="0" rowspan="3" colspan="2" >
+ <class>QListBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>profilesList</cstring>
+ </property>
+ </widget>
</grid>
</widget>
</widget>
</vbox>
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp
index 0f48a4b..89dac6f 100644
--- a/noncore/net/networksetup/mainwindowimp.cpp
+++ b/noncore/net/networksetup/mainwindowimp.cpp
@@ -150,9 +150,9 @@ void MainWindowImp::removeClicked(){
QMessageBox::information(this, "Error","Please select an interface.", "Ok");
return;
}
- if(modules.find(interfaceItems[item]) == modules.end()){
+ if((interfaceItems[item])->getModuleOwner() == NULL){
QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok");
}
else{
// Try to remove.
@@ -170,17 +170,32 @@ void MainWindowImp::configureClicked(){
QMessageBox::information(this, "Error","Please select an interface.", "Ok");
return;
}
- if(modules.find(interfaceItems[item]) == modules.end()){
+ if((interfaceItems[item])->getModuleOwner() == NULL){
InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]);
conf->showMaximized();
conf->show();
}
else{
- InterfaceSetupImp *conf = new InterfaceSetupImp(this, "InterfaceConfiguration");
+ 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();
+ }
+ }
}
/**
* Pull up the information about the selected interface
@@ -192,18 +207,30 @@ void MainWindowImp::informationClicked(){
QMessageBox::information(this, "Error","Please select an interface.", "Ok");
return;
}
- if(modules.find(interfaceItems[item]) == modules.end()){
+ if( (interfaceItems[item])->getModuleOwner() == NULL){
InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]);
i->showMaximized();
i->show();
}
else{
- QTabWidget *t = new QTabWidget(this, "InterfaceInformationTAB");
+ 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");
- t->show();
+ }
+ conf->showMaximized();
+ conf->show();
+ }
+ else{
+ InterfaceInformationImp *i = new InterfaceInformationImp(0, "TCPIPInformation", interfaceItems[item], true);
+ i->showMaximized();
+ i->show();
+ }
}
}
/**
@@ -285,11 +312,13 @@ void MainWindowImp::updateInterface(Interface *i){
// See if we already have it
if(items.find(i) == items.end()){
item = new QListViewItem(serviceList, "", "", "");
// See if you can't find a module owner for this interface
- //EmployeeMap::Iterator it;
- //for( it = map.begin(); it != map.end(); ++it )
- // printf( "%s, %s earns %d\n", it.key().latin1(), it.data().name().latin1(), it.data().salary() );
+ 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);
}
@@ -308,8 +337,12 @@ void MainWindowImp::updateInterface(Interface *i){
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());
diff --git a/noncore/net/networksetup/mainwindowimp.h b/noncore/net/networksetup/mainwindowimp.h
index 8e300bf..19ebaf2 100644
--- a/noncore/net/networksetup/mainwindowimp.h
+++ b/noncore/net/networksetup/mainwindowimp.h
@@ -41,9 +41,8 @@ private:
// For our local list of names
QMap<QString, Interface*> interfaceNames;
QMap<Module*, QLibrary*> libraries;
- QMap<Interface*, Module*> modules;
QMap<Interface*, QListViewItem*> items;
QMap<QListViewItem*, Interface*> interfaceItems;
QMap<KProcess*, QString> threads;
diff --git a/noncore/net/networksetup/module.h b/noncore/net/networksetup/module.h
index 13fd523..c1e9488 100644
--- a/noncore/net/networksetup/module.h
+++ b/noncore/net/networksetup/module.h
@@ -6,8 +6,9 @@
#include <qmap.h>
#include "interface.h"
class QWidget;
+class QTabWidget;
class Module : QObject{
signals:
@@ -16,15 +17,15 @@ signals:
public:
Module(){};
virtual bool isOwner(Interface *){ return false; };
- virtual QWidget *configure(){ return NULL; } ;
- virtual QWidget *information(){ return NULL; };
+ virtual QWidget *configure(QTabWidget **tabWidget){ return NULL; } ;
+ virtual QWidget *information(QTabWidget **tabWidget){ return NULL; };
virtual QList<Interface> getInterfaces() = 0;
virtual QMap<QString, QString> possibleNewInterfaces() = 0;
virtual Interface *addNewInterface(QString name) = 0;
virtual bool remove(Interface* i) = 0;
-
+ virtual QString getPixmapName(Interface* i) = 0;
};
#endif
diff --git a/noncore/net/networksetup/networksetup.pro b/noncore/net/networksetup/networksetup.pro
index a01b050..0d48790 100644
--- a/noncore/net/networksetup/networksetup.pro
+++ b/noncore/net/networksetup/networksetup.pro
@@ -1,7 +1,7 @@
TEMPLATE = app
-CONFIG = qt warn_on debug
-#CONFIG = qt warn_on release
+#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
#INCLUDEPATH += $(QPEDIR)/include
#DEPENDPATH += $(QPEDIR)/include
diff --git a/noncore/settings/networksettings/interface.cpp b/noncore/settings/networksettings/interface.cpp
index f6eed00..5b21364 100644
--- a/noncore/settings/networksettings/interface.cpp
+++ b/noncore/settings/networksettings/interface.cpp
@@ -9,9 +9,9 @@
#include <stdio.h>
#include <stdlib.h>
-Interface::Interface(QString name, bool newSatus): status(newSatus), attached(false), interfaceName(name), hardareName("Unknown"), moduleOwner("Default"), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
+Interface::Interface(QString name, bool newSatus): status(newSatus), attached(false), interfaceName(name), hardareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
refresh();
}
/**
diff --git a/noncore/settings/networksettings/interface.h b/noncore/settings/networksettings/interface.h
index 1ad71eb..5dc95a4 100644
--- a/noncore/settings/networksettings/interface.h
+++ b/noncore/settings/networksettings/interface.h
@@ -2,8 +2,9 @@
#define INTERFACE_H
#include <qstring.h>
+class Module;
class Interface {
public:
Interface(QString name = "unknown", bool status = false);
@@ -20,10 +21,10 @@ public:
virtual QString getHardwareName(){ return hardareName; };
virtual void setHardwareName(QString name="Unknown"){ hardareName = name; };
- virtual QString getModuleOwner(){ return moduleOwner; };
- virtual void setModuleOwner(QString owner="Default"){ moduleOwner = owner; };
+ virtual Module* getModuleOwner(){ return moduleOwner; };
+ virtual void setModuleOwner(Module *owner=NULL){ moduleOwner = owner; };
// inet information.
QString getMacAddress(){ return macAddress; };
QString getIp(){ return ip; };
@@ -44,9 +45,9 @@ private:
bool status;
bool attached;
QString interfaceName;
QString hardareName;
- QString moduleOwner;
+ Module *moduleOwner;
// Network information
QString macAddress;
QString ip;
diff --git a/noncore/settings/networksettings/interfacesetup.ui b/noncore/settings/networksettings/interfacesetup.ui
index ff9810e..d367608 100644
--- a/noncore/settings/networksettings/interfacesetup.ui
+++ b/noncore/settings/networksettings/interfacesetup.ui
@@ -10,48 +10,63 @@
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>177</width>
- <height>320</height>
+ <width>271</width>
+ <height>280</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Interface Configuration</string>
</property>
- <grid>
+ <vbox>
<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="2" >
- <class>Line</class>
+ <widget>
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>Line1</cstring>
+ <cstring>autoStart</cstring>
</property>
<property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
+ <name>text</name>
+ <string>Automaticly bring up</string>
</property>
</widget>
- <widget row="0" column="0" rowspan="1" colspan="2" >
- <class>QCheckBox</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>autoStart</cstring>
+ <cstring>Layout8</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Automaticly bring up</string>
+ <string>Profile</string>
</property>
</widget>
- <widget row="2" column="1" >
+ <widget>
<class>QComboBox</class>
<item>
<property>
<name>text</name>
@@ -62,20 +77,47 @@
<name>name</name>
<cstring>profileCombo</cstring>
</property>
</widget>
- <widget row="4" column="0" >
- <class>QLabel</class>
- <property stdset="1">
+ <spacer>
+ <property>
<name>name</name>
- <cstring>leaseHoursLabel</cstring>
+ <cstring>Spacer20</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>Requested Lease</string>
+ <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>
+ </hbox>
</widget>
- <widget row="3" column="0" rowspan="1" colspan="2" >
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout9</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>dhcpCheckBox</cstring>
@@ -88,20 +130,20 @@
<name>checked</name>
<bool>true</bool>
</property>
</widget>
- <widget row="2" column="0" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1</cstring>
+ <cstring>leaseHoursLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Profile:</string>
+ <string>Requested Lease</string>
</property>
</widget>
- <widget row="4" column="1" >
+ <widget>
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>leaseTime</cstring>
@@ -122,30 +164,11 @@
<name>value</name>
<number>24</number>
</property>
</widget>
- <spacer row="6" column="1" >
- <property>
- <name>name</name>
- <cstring>Spacer9</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="5" column="0" rowspan="1" colspan="2" >
+ </hbox>
+ </widget>
+ <widget>
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>staticGroupBox</cstring>
@@ -154,8 +177,16 @@
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
+ <name>frameShape</name>
+ <enum>Box</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
+ </property>
+ <property stdset="1">
<name>title</name>
<string>Static Ip Configuration</string>
</property>
<grid>
@@ -258,9 +289,30 @@
</property>
</widget>
</grid>
</widget>
- </grid>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer9</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
</widget>
<connections>
<connection>
<sender>dhcpCheckBox</sender>
diff --git a/noncore/settings/networksettings/mainwindow.ui b/noncore/settings/networksettings/mainwindow.ui
index c1fa101..a3f7bb1 100644
--- a/noncore/settings/networksettings/mainwindow.ui
+++ b/noncore/settings/networksettings/mainwindow.ui
@@ -10,9 +10,9 @@
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>218</width>
+ <width>217</width>
<height>289</height>
</rect>
</property>
<property stdset="1">
@@ -193,9 +193,20 @@
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget row="0" column="0" rowspan="1" colspan="2" >
+ <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>
@@ -204,9 +215,9 @@
<name>text</name>
<string>Current Profile</string>
</property>
</widget>
- <widget row="0" column="2" >
+ <widget row="0" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>currentProfileLabel</cstring>
@@ -223,20 +234,30 @@
<name>text</name>
<string>All</string>
</property>
</widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
- <property stdset="1">
+ <spacer row="0" column="2" >
+ <property>
<name>name</name>
- <cstring>TextLabel1_2</cstring>
+ <cstring>Spacer2</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>Profiles</string>
+ <name>orientation</name>
+ <enum>Horizontal</enum>
</property>
- </widget>
- <spacer row="5" column="2" >
+ <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>
@@ -255,16 +276,9 @@
<height>20</height>
</size>
</property>
</spacer>
- <widget row="2" column="0" rowspan="3" colspan="1" >
- <class>QListBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>profilesList</cstring>
- </property>
- </widget>
- <widget row="4" column="1" rowspan="1" colspan="2" >
+ <widget row="5" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>PushButton7</cstring>
@@ -273,9 +287,9 @@
<name>text</name>
<string>&amp;Set Current</string>
</property>
</widget>
- <widget row="3" column="1" rowspan="1" colspan="2" >
+ <widget row="4" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>removeProfileButton</cstring>
@@ -284,9 +298,9 @@
<name>text</name>
<string>&amp;Remove</string>
</property>
</widget>
- <widget row="2" column="1" rowspan="1" colspan="2" >
+ <widget row="3" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>newProfileButton</cstring>
@@ -295,8 +309,26 @@
<name>text</name>
<string>&amp;New</string>
</property>
</widget>
+ <widget row="2" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Profiles</string>
+ </property>
+ </widget>
+ <widget row="3" column="0" rowspan="3" colspan="2" >
+ <class>QListBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>profilesList</cstring>
+ </property>
+ </widget>
</grid>
</widget>
</widget>
</vbox>
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 0f48a4b..89dac6f 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -150,9 +150,9 @@ void MainWindowImp::removeClicked(){
QMessageBox::information(this, "Error","Please select an interface.", "Ok");
return;
}
- if(modules.find(interfaceItems[item]) == modules.end()){
+ if((interfaceItems[item])->getModuleOwner() == NULL){
QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok");
}
else{
// Try to remove.
@@ -170,17 +170,32 @@ void MainWindowImp::configureClicked(){
QMessageBox::information(this, "Error","Please select an interface.", "Ok");
return;
}
- if(modules.find(interfaceItems[item]) == modules.end()){
+ if((interfaceItems[item])->getModuleOwner() == NULL){
InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]);
conf->showMaximized();
conf->show();
}
else{
- InterfaceSetupImp *conf = new InterfaceSetupImp(this, "InterfaceConfiguration");
+ 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();
+ }
+ }
}
/**
* Pull up the information about the selected interface
@@ -192,18 +207,30 @@ void MainWindowImp::informationClicked(){
QMessageBox::information(this, "Error","Please select an interface.", "Ok");
return;
}
- if(modules.find(interfaceItems[item]) == modules.end()){
+ if( (interfaceItems[item])->getModuleOwner() == NULL){
InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]);
i->showMaximized();
i->show();
}
else{
- QTabWidget *t = new QTabWidget(this, "InterfaceInformationTAB");
+ 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");
- t->show();
+ }
+ conf->showMaximized();
+ conf->show();
+ }
+ else{
+ InterfaceInformationImp *i = new InterfaceInformationImp(0, "TCPIPInformation", interfaceItems[item], true);
+ i->showMaximized();
+ i->show();
+ }
}
}
/**
@@ -285,11 +312,13 @@ void MainWindowImp::updateInterface(Interface *i){
// See if we already have it
if(items.find(i) == items.end()){
item = new QListViewItem(serviceList, "", "", "");
// See if you can't find a module owner for this interface
- //EmployeeMap::Iterator it;
- //for( it = map.begin(); it != map.end(); ++it )
- // printf( "%s, %s earns %d\n", it.key().latin1(), it.data().name().latin1(), it.data().salary() );
+ 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);
}
@@ -308,8 +337,12 @@ void MainWindowImp::updateInterface(Interface *i){
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());
diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h
index 8e300bf..19ebaf2 100644
--- a/noncore/settings/networksettings/mainwindowimp.h
+++ b/noncore/settings/networksettings/mainwindowimp.h
@@ -41,9 +41,8 @@ private:
// For our local list of names
QMap<QString, Interface*> interfaceNames;
QMap<Module*, QLibrary*> libraries;
- QMap<Interface*, Module*> modules;
QMap<Interface*, QListViewItem*> items;
QMap<QListViewItem*, Interface*> interfaceItems;
QMap<KProcess*, QString> threads;
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h
index 13fd523..c1e9488 100644
--- a/noncore/settings/networksettings/module.h
+++ b/noncore/settings/networksettings/module.h
@@ -6,8 +6,9 @@
#include <qmap.h>
#include "interface.h"
class QWidget;
+class QTabWidget;
class Module : QObject{
signals:
@@ -16,15 +17,15 @@ signals:
public:
Module(){};
virtual bool isOwner(Interface *){ return false; };
- virtual QWidget *configure(){ return NULL; } ;
- virtual QWidget *information(){ return NULL; };
+ virtual QWidget *configure(QTabWidget **tabWidget){ return NULL; } ;
+ virtual QWidget *information(QTabWidget **tabWidget){ return NULL; };
virtual QList<Interface> getInterfaces() = 0;
virtual QMap<QString, QString> possibleNewInterfaces() = 0;
virtual Interface *addNewInterface(QString name) = 0;
virtual bool remove(Interface* i) = 0;
-
+ virtual QString getPixmapName(Interface* i) = 0;
};
#endif
diff --git a/noncore/settings/networksettings/networksetup.pro b/noncore/settings/networksettings/networksetup.pro
index a01b050..0d48790 100644
--- a/noncore/settings/networksettings/networksetup.pro
+++ b/noncore/settings/networksettings/networksetup.pro
@@ -1,7 +1,7 @@
TEMPLATE = app
-CONFIG = qt warn_on debug
-#CONFIG = qt warn_on release
+#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
#INCLUDEPATH += $(QPEDIR)/include
#DEPENDPATH += $(QPEDIR)/include