author | benmeyer <benmeyer> | 2002-10-02 17:22:50 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-10-02 17:22:50 (UTC) |
commit | 527e77d8244fb25d0bab39857eebbdfbcbfb807a (patch) (unidiff) | |
tree | f3ec7cee3573ef83d8d86f859c7c3de3a8b06b9f | |
parent | 6e50141595ec2159d384c2cb9aaee4758eb720ea (diff) | |
download | opie-527e77d8244fb25d0bab39857eebbdfbcbfb807a.zip opie-527e77d8244fb25d0bab39857eebbdfbcbfb807a.tar.gz opie-527e77d8244fb25d0bab39857eebbdfbcbfb807a.tar.bz2 |
Add Connection function more filled in
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 @@ | |||
1 | Fix DHCP obtained and expoired info | ||
diff --git a/noncore/net/networksetup/addservice.ui b/noncore/net/networksetup/addconnection.ui index 929f4fb..a349804 100644 --- a/noncore/net/networksetup/addservice.ui +++ b/noncore/net/networksetup/addconnection.ui | |||
@@ -1,154 +1,153 @@ | |||
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"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>11</number> | 25 | <number>11</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget row="3" column="1" > | 31 | <widget row="3" column="1" > |
32 | <class>QPushButton</class> | 32 | <class>QPushButton</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>cancelButton</cstring> | 35 | <cstring>cancelButton</cstring> |
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>&Cancel</string> |
40 | </property> | 40 | </property> |
41 | </widget> | 41 | </widget> |
42 | <widget row="3" column="0" > | 42 | <widget row="3" column="0" > |
43 | <class>QPushButton</class> | 43 | <class>QPushButton</class> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>name</name> | 45 | <name>name</name> |
46 | <cstring>addButton</cstring> | 46 | <cstring>addButton</cstring> |
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>&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" > |
54 | <class>QListView</class> | 54 | <class>QListView</class> |
55 | <column> | 55 | <column> |
56 | <property> | 56 | <property> |
57 | <name>text</name> | 57 | <name>text</name> |
58 | <string>Services</string> | 58 | <string>Services</string> |
59 | </property> | 59 | </property> |
60 | <property> | 60 | <property> |
61 | <name>clickable</name> | 61 | <name>clickable</name> |
62 | <bool>true</bool> | 62 | <bool>true</bool> |
63 | </property> | 63 | </property> |
64 | <property> | 64 | <property> |
65 | <name>resizeable</name> | 65 | <name>resizeable</name> |
66 | <bool>true</bool> | 66 | <bool>true</bool> |
67 | </property> | 67 | </property> |
68 | </column> | 68 | </column> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>name</name> | 70 | <name>name</name> |
71 | <cstring>registeredServicesList</cstring> | 71 | <cstring>registeredServicesList</cstring> |
72 | </property> | 72 | </property> |
73 | <property stdset="1"> | 73 | <property stdset="1"> |
74 | <name>sizePolicy</name> | 74 | <name>sizePolicy</name> |
75 | <sizepolicy> | 75 | <sizepolicy> |
76 | <hsizetype>7</hsizetype> | 76 | <hsizetype>7</hsizetype> |
77 | <vsizetype>3</vsizetype> | 77 | <vsizetype>3</vsizetype> |
78 | </sizepolicy> | 78 | </sizepolicy> |
79 | </property> | 79 | </property> |
80 | <property stdset="1"> | 80 | <property stdset="1"> |
81 | <name>minimumSize</name> | 81 | <name>minimumSize</name> |
82 | <size> | 82 | <size> |
83 | <width>0</width> | 83 | <width>0</width> |
84 | <height>75</height> | 84 | <height>75</height> |
85 | </size> | 85 | </size> |
86 | </property> | 86 | </property> |
87 | </widget> | 87 | </widget> |
88 | <spacer row="2" column="1" > | 88 | <spacer row="2" column="1" > |
89 | <property> | 89 | <property> |
90 | <name>name</name> | 90 | <name>name</name> |
91 | <cstring>Spacer12</cstring> | 91 | <cstring>Spacer12</cstring> |
92 | </property> | 92 | </property> |
93 | <property stdset="1"> | 93 | <property stdset="1"> |
94 | <name>orientation</name> | 94 | <name>orientation</name> |
95 | <enum>Vertical</enum> | 95 | <enum>Vertical</enum> |
96 | </property> | 96 | </property> |
97 | <property stdset="1"> | 97 | <property stdset="1"> |
98 | <name>sizeType</name> | 98 | <name>sizeType</name> |
99 | <enum>Expanding</enum> | 99 | <enum>Expanding</enum> |
100 | </property> | 100 | </property> |
101 | <property> | 101 | <property> |
102 | <name>sizeHint</name> | 102 | <name>sizeHint</name> |
103 | <size> | 103 | <size> |
104 | <width>20</width> | 104 | <width>20</width> |
105 | <height>20</height> | 105 | <height>20</height> |
106 | </size> | 106 | </size> |
107 | </property> | 107 | </property> |
108 | </spacer> | 108 | </spacer> |
109 | <widget row="1" column="0" rowspan="1" colspan="2" > | 109 | <widget row="1" column="0" rowspan="1" colspan="2" > |
110 | <class>QLabel</class> | 110 | <class>QLabel</class> |
111 | <property stdset="1"> | 111 | <property stdset="1"> |
112 | <name>name</name> | 112 | <name>name</name> |
113 | <cstring>help</cstring> | 113 | <cstring>help</cstring> |
114 | </property> | 114 | </property> |
115 | <property stdset="1"> | 115 | <property stdset="1"> |
116 | <name>sizePolicy</name> | 116 | <name>sizePolicy</name> |
117 | <sizepolicy> | 117 | <sizepolicy> |
118 | <hsizetype>5</hsizetype> | 118 | <hsizetype>5</hsizetype> |
119 | <vsizetype>4</vsizetype> | 119 | <vsizetype>4</vsizetype> |
120 | </sizepolicy> | 120 | </sizepolicy> |
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> |
125 | For 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> |
129 | <set>WordBreak|AlignTop|AlignLeft</set> | 128 | <set>WordBreak|AlignTop|AlignLeft</set> |
130 | </property> | 129 | </property> |
131 | <property> | 130 | <property> |
132 | <name>vAlign</name> | 131 | <name>vAlign</name> |
133 | </property> | 132 | </property> |
134 | <property> | 133 | <property> |
135 | <name>wordwrap</name> | 134 | <name>wordwrap</name> |
136 | </property> | 135 | </property> |
137 | </widget> | 136 | </widget> |
138 | </grid> | 137 | </grid> |
139 | </widget> | 138 | </widget> |
140 | <connections> | 139 | <connections> |
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> |
154 | </UI> | 153 | </UI> |
diff --git a/noncore/net/networksetup/addconnectionimp.cpp b/noncore/net/networksetup/addconnectionimp.cpp new file mode 100644 index 0000000..ee7bd97 --- a/dev/null +++ b/noncore/net/networksetup/addconnectionimp.cpp | |||
@@ -0,0 +1,38 @@ | |||
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 | */ | ||
10 | AddConnectionImp::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 | */ | ||
18 | void 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 | */ | ||
29 | void 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 | |||
8 | class QListViewItem; | ||
9 | |||
10 | class AddConnectionImp : public AddConnection { | ||
11 | |||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0); | ||
16 | void addConnections(QMap<QString, QString> newList); | ||
17 | |||
18 | private slots: | ||
19 | void changed(); | ||
20 | |||
21 | private: | ||
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 | |||
6 | void 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 | |||
8 | class QListViewItem; | ||
9 | |||
10 | class AddServiceImp : public AddService { | ||
11 | |||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | AddServiceImp(QWidget *parent=0, const char *name=0, WFlags f=0):AddService(parent, name, f){}; | ||
16 | void addServices(QList<QString> list); | ||
17 | |||
18 | private: | ||
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 | |||
@@ -1,66 +1,67 @@ | |||
1 | #ifndef INTERFACE_H | 1 | #ifndef INTERFACE_H |
2 | #define INTERFACE_H | 2 | #define INTERFACE_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | class Module; | 6 | class Module; |
7 | |||
7 | class Interface { | 8 | class Interface { |
8 | 9 | ||
9 | public: | 10 | public: |
10 | Interface(QString name = "unknown", bool status = false); | 11 | Interface(QString name = "unknown", bool status = false); |
11 | virtual ~Interface(){}; | 12 | virtual ~Interface(){}; |
12 | 13 | ||
13 | virtual bool getStatus(){ return status; }; | 14 | virtual bool getStatus(){ return status; }; |
14 | virtual void setStatus(bool newSatus){ status = newSatus; refresh(); }; | 15 | virtual void setStatus(bool newSatus){ status = newSatus; refresh(); }; |
15 | 16 | ||
16 | virtual bool isAttached(){ return attached; }; | 17 | virtual bool isAttached(){ return attached; }; |
17 | virtual void setAttached(bool isAttached=false){ attached = isAttached; }; | 18 | virtual void setAttached(bool isAttached=false){ attached = isAttached; }; |
18 | 19 | ||
19 | virtual QString getInterfaceName(){ return interfaceName; }; | 20 | virtual QString getInterfaceName(){ return interfaceName; }; |
20 | virtual void setInterfaceName(QString name="unknown"){ interfaceName = name; }; | 21 | virtual void setInterfaceName(QString name="unknown"){ interfaceName = name; }; |
21 | 22 | ||
22 | virtual QString getHardwareName(){ return hardareName; }; | 23 | virtual QString getHardwareName(){ return hardareName; }; |
23 | virtual void setHardwareName(QString name="Unknown"){ hardareName = name; }; | 24 | virtual void setHardwareName(QString name="Unknown"){ hardareName = name; }; |
24 | 25 | ||
25 | virtual Module* getModuleOwner(){ return moduleOwner; }; | 26 | virtual Module* getModuleOwner(){ return moduleOwner; }; |
26 | virtual void setModuleOwner(Module *owner=NULL){ moduleOwner = owner; }; | 27 | virtual void setModuleOwner(Module *owner=NULL){ moduleOwner = owner; }; |
27 | 28 | ||
28 | // inet information. | 29 | // inet information. |
29 | QString getMacAddress(){ return macAddress; }; | 30 | QString getMacAddress(){ return macAddress; }; |
30 | QString getIp(){ return ip; }; | 31 | QString getIp(){ return ip; }; |
31 | QString getSubnetMask(){ return subnetMask; }; | 32 | QString getSubnetMask(){ return subnetMask; }; |
32 | QString getBroadcast(){ return broadcast; }; | 33 | QString getBroadcast(){ return broadcast; }; |
33 | bool isDhcp(){ return dhcp; }; | 34 | bool isDhcp(){ return dhcp; }; |
34 | QString getDhcpServerIp(){ return dhcpServerIp; }; | 35 | QString getDhcpServerIp(){ return dhcpServerIp; }; |
35 | QString getLeaseObtained(){ return leaseObtained; }; | 36 | QString getLeaseObtained(){ return leaseObtained; }; |
36 | QString getLeaseExpires(){ return leaseExpires; }; | 37 | QString getLeaseExpires(){ return leaseExpires; }; |
37 | 38 | ||
38 | bool refresh(); | 39 | bool refresh(); |
39 | bool start(); | 40 | bool start(); |
40 | bool stop(); | 41 | bool stop(); |
41 | bool restart(); | 42 | bool restart(); |
42 | 43 | ||
43 | private: | 44 | private: |
44 | // Interface information | 45 | // Interface information |
45 | bool status; | 46 | bool status; |
46 | bool attached; | 47 | bool attached; |
47 | QString interfaceName; | 48 | QString interfaceName; |
48 | QString hardareName; | 49 | QString hardareName; |
49 | Module *moduleOwner; | 50 | Module *moduleOwner; |
50 | 51 | ||
51 | // Network information | 52 | // Network information |
52 | QString macAddress; | 53 | QString macAddress; |
53 | QString ip; | 54 | QString ip; |
54 | QString broadcast; | 55 | QString broadcast; |
55 | QString subnetMask; | 56 | QString subnetMask; |
56 | bool dhcp; | 57 | bool dhcp; |
57 | QString dhcpServerIp; | 58 | QString dhcpServerIp; |
58 | QString leaseObtained; | 59 | QString leaseObtained; |
59 | QString leaseExpires; | 60 | QString leaseExpires; |
60 | 61 | ||
61 | }; | 62 | }; |
62 | 63 | ||
63 | #endif | 64 | #endif |
64 | 65 | ||
65 | // interface.h | 66 | // interface.h |
66 | 67 | ||
diff --git a/noncore/net/networksetup/interfacesetupimp.cpp b/noncore/net/networksetup/interfacesetupimp.cpp index 6a8449d..951aeee 100644 --- a/noncore/net/networksetup/interfacesetupimp.cpp +++ b/noncore/net/networksetup/interfacesetupimp.cpp | |||
@@ -1,147 +1,146 @@ | |||
1 | #include "interfacesetupimp.h" | 1 | #include "interfacesetupimp.h" |
2 | #include "interface.h" | 2 | #include "interface.h" |
3 | #include "interfaces.h" | 3 | #include "interfaces.h" |
4 | 4 | ||
5 | #include <qcombobox.h> | 5 | #include <qcombobox.h> |
6 | #include <qcheckbox.h> | 6 | #include <qcheckbox.h> |
7 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | #include <qspinbox.h> | 8 | #include <qspinbox.h> |
9 | #include <qgroupbox.h> | 9 | #include <qgroupbox.h> |
10 | #include <qlabel.h> | 10 | #include <qlabel.h> |
11 | 11 | ||
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
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 | /** |
20 | * Constuctor. Set up the connection and load the first profile. | 19 | * Constuctor. Set up the connection and load the first profile. |
21 | */ | 20 | */ |
22 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){ | 21 | InterfaceSetupImp::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){ |
29 | staticGroupBox->hide(); | 28 | staticGroupBox->hide(); |
30 | dhcpCheckBox->hide(); | 29 | dhcpCheckBox->hide(); |
31 | leaseTime->hide(); | 30 | leaseTime->hide(); |
32 | leaseHoursLabel->hide(); | 31 | leaseHoursLabel->hide(); |
33 | } | 32 | } |
34 | connect(profileCombo, SIGNAL(highlighted(const QString &)), this, SLOT(changeProfile(const QString &))); | 33 | connect(profileCombo, SIGNAL(highlighted(const QString &)), this, SLOT(changeProfile(const QString &))); |
35 | } | 34 | } |
36 | 35 | ||
37 | /** | 36 | /** |
38 | * Save the current settings, then write out the interfaces file and close. | 37 | * Save the current settings, then write out the interfaces file and close. |
39 | */ | 38 | */ |
40 | void InterfaceSetupImp::accept(){ | 39 | void InterfaceSetupImp::accept(){ |
41 | if(!saveSettings()) | 40 | if(!saveSettings()) |
42 | return; | 41 | return; |
43 | interfaces->write(); | 42 | interfaces->write(); |
44 | close(true); | 43 | close(true); |
45 | } | 44 | } |
46 | 45 | ||
47 | /** | 46 | /** |
48 | * Save the settings for the current Interface. | 47 | * Save the settings for the current Interface. |
49 | * @return bool true if successfull, false otherwise | 48 | * @return bool true if successfull, false otherwise |
50 | */ | 49 | */ |
51 | bool InterfaceSetupImp::saveSettings(){ | 50 | bool InterfaceSetupImp::saveSettings(){ |
52 | // eh can't really do anything about it other then return. :-D | 51 | // eh can't really do anything about it other then return. :-D |
53 | if(!interfaces->isInterfaceSet()) | 52 | if(!interfaces->isInterfaceSet()) |
54 | return true; | 53 | return true; |
55 | 54 | ||
56 | bool error = false; | 55 | bool error = false; |
57 | // Loopback case | 56 | // Loopback case |
58 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 57 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
59 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 58 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
60 | return true; | 59 | return true; |
61 | } | 60 | } |
62 | 61 | ||
63 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){ | 62 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){ |
64 | QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok"); | 63 | QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok"); |
65 | return false; | 64 | return false; |
66 | } | 65 | } |
67 | interfaces->removeAllInterfaceOptions(); | 66 | interfaces->removeAllInterfaceOptions(); |
68 | 67 | ||
69 | // DHCP | 68 | // DHCP |
70 | if(dhcpCheckBox->isChecked()){ | 69 | if(dhcpCheckBox->isChecked()){ |
71 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); | 70 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); |
72 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); | 71 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); |
73 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); | 72 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); |
74 | } | 73 | } |
75 | else{ | 74 | else{ |
76 | interfaces->setInterfaceMethod("static"); | 75 | interfaces->setInterfaceMethod("static"); |
77 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); | 76 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); |
78 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); | 77 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); |
79 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); | 78 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); |
80 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); | 79 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); |
81 | interfaces->setInterfaceOption("up "DNSSCRIPT" add ", dns); | 80 | interfaces->setInterfaceOption("up "DNSSCRIPT" add ", dns); |
82 | interfaces->setInterfaceOption("down "DNSSCRIPT" remove ", dns); | 81 | interfaces->setInterfaceOption("down "DNSSCRIPT" remove ", dns); |
83 | } | 82 | } |
84 | 83 | ||
85 | // IP Information | 84 | // IP Information |
86 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 85 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
87 | return true; | 86 | return true; |
88 | } | 87 | } |
89 | 88 | ||
90 | /** | 89 | /** |
91 | * The Profile has changed. | 90 | * The Profile has changed. |
92 | * @profile the new profile. | 91 | * @profile the new profile. |
93 | */ | 92 | */ |
94 | void InterfaceSetupImp::changeProfile(const QString &profile){ | 93 | void InterfaceSetupImp::changeProfile(const QString &profile){ |
95 | QString newInterfaceName; | 94 | QString newInterfaceName; |
96 | if(profile.lower() == "all") | 95 | if(profile.lower() == "all") |
97 | newInterfaceName = interface->getInterfaceName(); | 96 | newInterfaceName = interface->getInterfaceName(); |
98 | else | 97 | else |
99 | newInterfaceName = interface->getInterfaceName() + "_" + profile; | 98 | newInterfaceName = interface->getInterfaceName() + "_" + profile; |
100 | if(newInterfaceName == currentInterfaceName) | 99 | if(newInterfaceName == currentInterfaceName) |
101 | return; | 100 | return; |
102 | else{ | 101 | else{ |
103 | saveSettings(); | 102 | saveSettings(); |
104 | currentInterfaceName = newInterfaceName; | 103 | currentInterfaceName = newInterfaceName; |
105 | } | 104 | } |
106 | bool error = interfaces->setInterface(currentInterfaceName); | 105 | bool error = interfaces->setInterface(currentInterfaceName); |
107 | 106 | ||
108 | // See if we have to make a interface. | 107 | // See if we have to make a interface. |
109 | if(error){ | 108 | if(error){ |
110 | qDebug("InterfaceSetupImp: Adding a new interface from profile change."); | 109 | qDebug("InterfaceSetupImp: Adding a new interface from profile change."); |
111 | interfaces->addInterface(currentInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); | 110 | interfaces->addInterface(currentInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); |
112 | error = interfaces->setInterface(currentInterfaceName); | 111 | error = interfaces->setInterface(currentInterfaceName); |
113 | if(error){ | 112 | if(error){ |
114 | qDebug("InterfaceSetupImp: Added interface, but still can't set."); | 113 | qDebug("InterfaceSetupImp: Added interface, but still can't set."); |
115 | return; | 114 | return; |
116 | } | 115 | } |
117 | } | 116 | } |
118 | 117 | ||
119 | //qDebug( currentInterfaceName.latin1() ); | 118 | //qDebug( currentInterfaceName.latin1() ); |
120 | // We must have a valid interface to get this far so read some settings. | 119 | // We must have a valid interface to get this far so read some settings. |
121 | 120 | ||
122 | // DHCP | 121 | // DHCP |
123 | if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) | 122 | if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) |
124 | dhcpCheckBox->setChecked(true); | 123 | dhcpCheckBox->setChecked(true); |
125 | else | 124 | else |
126 | dhcpCheckBox->setChecked(false); | 125 | dhcpCheckBox->setChecked(false); |
127 | leaseTime->setValue(interfaces->getInterfaceOption("leasehours", error).toInt()); | 126 | leaseTime->setValue(interfaces->getInterfaceOption("leasehours", error).toInt()); |
128 | if(error) | 127 | if(error) |
129 | leaseTime->setValue(interfaces->getInterfaceOption("leasetime", error).toInt()/60/60); | 128 | leaseTime->setValue(interfaces->getInterfaceOption("leasetime", error).toInt()/60/60); |
130 | if(error) | 129 | if(error) |
131 | leaseTime->setValue(24); | 130 | leaseTime->setValue(24); |
132 | 131 | ||
133 | // IP Information | 132 | // IP Information |
134 | autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); | 133 | autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); |
135 | QString dns = interfaces->getInterfaceOption("up interfacednsscript add", error); | 134 | QString dns = interfaces->getInterfaceOption("up interfacednsscript add", error); |
136 | if(dns.contains(" ")){ | 135 | if(dns.contains(" ")){ |
137 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); | 136 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); |
138 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); | 137 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); |
139 | } | 138 | } |
140 | ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); | 139 | ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); |
141 | subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); | 140 | subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); |
142 | gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); | 141 | gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); |
143 | } | 142 | } |
144 | 143 | ||
145 | 144 | ||
146 | // interfacesetup.cpp | 145 | // interfacesetup.cpp |
147 | 146 | ||
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 | |||
@@ -1,358 +1,358 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>MainWindow</class> | 2 | <class>MainWindow</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>MainWindow</cstring> | 7 | <cstring>MainWindow</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>217</width> | 14 | <width>217</width> |
15 | <height>289</height> | 15 | <height>289</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>Network Setup</string> | 20 | <string>Network Setup</string> |
21 | </property> | 21 | </property> |
22 | <vbox> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>0</number> | 25 | <number>0</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget> | 31 | <widget> |
32 | <class>QTabWidget</class> | 32 | <class>QTabWidget</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>tabWidget</cstring> | 35 | <cstring>tabWidget</cstring> |
36 | </property> | 36 | </property> |
37 | <property> | 37 | <property> |
38 | <name>layoutMargin</name> | 38 | <name>layoutMargin</name> |
39 | </property> | 39 | </property> |
40 | <widget> | 40 | <widget> |
41 | <class>QWidget</class> | 41 | <class>QWidget</class> |
42 | <property stdset="1"> | 42 | <property stdset="1"> |
43 | <name>name</name> | 43 | <name>name</name> |
44 | <cstring>Widget3</cstring> | 44 | <cstring>Widget3</cstring> |
45 | </property> | 45 | </property> |
46 | <attribute> | 46 | <attribute> |
47 | <name>title</name> | 47 | <name>title</name> |
48 | <string>Interfaces</string> | 48 | <string>Interfaces</string> |
49 | </attribute> | 49 | </attribute> |
50 | <vbox> | 50 | <vbox> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>margin</name> | 52 | <name>margin</name> |
53 | <number>0</number> | 53 | <number>0</number> |
54 | </property> | 54 | </property> |
55 | <property stdset="1"> | 55 | <property stdset="1"> |
56 | <name>spacing</name> | 56 | <name>spacing</name> |
57 | <number>6</number> | 57 | <number>6</number> |
58 | </property> | 58 | </property> |
59 | <widget> | 59 | <widget> |
60 | <class>QListView</class> | 60 | <class>QListView</class> |
61 | <column> | 61 | <column> |
62 | <property> | 62 | <property> |
63 | <name>text</name> | 63 | <name>text</name> |
64 | <string>i</string> | 64 | <string>i</string> |
65 | </property> | 65 | </property> |
66 | <property> | 66 | <property> |
67 | <name>clickable</name> | 67 | <name>clickable</name> |
68 | <bool>true</bool> | 68 | <bool>true</bool> |
69 | </property> | 69 | </property> |
70 | <property> | 70 | <property> |
71 | <name>resizeable</name> | 71 | <name>resizeable</name> |
72 | <bool>true</bool> | 72 | <bool>true</bool> |
73 | </property> | 73 | </property> |
74 | </column> | 74 | </column> |
75 | <column> | 75 | <column> |
76 | <property> | 76 | <property> |
77 | <name>text</name> | 77 | <name>text</name> |
78 | <string>t</string> | 78 | <string>t</string> |
79 | </property> | 79 | </property> |
80 | <property> | 80 | <property> |
81 | <name>clickable</name> | 81 | <name>clickable</name> |
82 | <bool>true</bool> | 82 | <bool>true</bool> |
83 | </property> | 83 | </property> |
84 | <property> | 84 | <property> |
85 | <name>resizeable</name> | 85 | <name>resizeable</name> |
86 | <bool>true</bool> | 86 | <bool>true</bool> |
87 | </property> | 87 | </property> |
88 | </column> | 88 | </column> |
89 | <column> | 89 | <column> |
90 | <property> | 90 | <property> |
91 | <name>text</name> | 91 | <name>text</name> |
92 | <string>Name</string> | 92 | <string>Name</string> |
93 | </property> | 93 | </property> |
94 | <property> | 94 | <property> |
95 | <name>clickable</name> | 95 | <name>clickable</name> |
96 | <bool>true</bool> | 96 | <bool>true</bool> |
97 | </property> | 97 | </property> |
98 | <property> | 98 | <property> |
99 | <name>resizeable</name> | 99 | <name>resizeable</name> |
100 | <bool>true</bool> | 100 | <bool>true</bool> |
101 | </property> | 101 | </property> |
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> |
109 | <bool>true</bool> | 109 | <bool>true</bool> |
110 | </property> | 110 | </property> |
111 | </widget> | 111 | </widget> |
112 | <widget> | 112 | <widget> |
113 | <class>QLayoutWidget</class> | 113 | <class>QLayoutWidget</class> |
114 | <property stdset="1"> | 114 | <property stdset="1"> |
115 | <name>name</name> | 115 | <name>name</name> |
116 | <cstring>Layout2</cstring> | 116 | <cstring>Layout2</cstring> |
117 | </property> | 117 | </property> |
118 | <property> | 118 | <property> |
119 | <name>layoutMargin</name> | 119 | <name>layoutMargin</name> |
120 | </property> | 120 | </property> |
121 | <grid> | 121 | <grid> |
122 | <property stdset="1"> | 122 | <property stdset="1"> |
123 | <name>margin</name> | 123 | <name>margin</name> |
124 | <number>5</number> | 124 | <number>5</number> |
125 | </property> | 125 | </property> |
126 | <property stdset="1"> | 126 | <property stdset="1"> |
127 | <name>spacing</name> | 127 | <name>spacing</name> |
128 | <number>6</number> | 128 | <number>6</number> |
129 | </property> | 129 | </property> |
130 | <widget row="1" column="0" > | 130 | <widget row="1" column="0" > |
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> |
138 | <string>&Add</string> | 138 | <string>&Add</string> |
139 | </property> | 139 | </property> |
140 | </widget> | 140 | </widget> |
141 | <widget row="0" column="0" > | 141 | <widget row="0" column="0" > |
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> |
149 | <string>&Information</string> | 149 | <string>&Information</string> |
150 | </property> | 150 | </property> |
151 | </widget> | 151 | </widget> |
152 | <widget row="0" column="1" > | 152 | <widget row="0" column="1" > |
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> |
160 | <string>&Configure</string> | 160 | <string>&Configure</string> |
161 | </property> | 161 | </property> |
162 | </widget> | 162 | </widget> |
163 | <widget row="1" column="1" > | 163 | <widget row="1" column="1" > |
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> |
171 | <string>&Remove</string> | 171 | <string>&Remove</string> |
172 | </property> | 172 | </property> |
173 | </widget> | 173 | </widget> |
174 | </grid> | 174 | </grid> |
175 | </widget> | 175 | </widget> |
176 | </vbox> | 176 | </vbox> |
177 | </widget> | 177 | </widget> |
178 | <widget> | 178 | <widget> |
179 | <class>QWidget</class> | 179 | <class>QWidget</class> |
180 | <property stdset="1"> | 180 | <property stdset="1"> |
181 | <name>name</name> | 181 | <name>name</name> |
182 | <cstring>tab</cstring> | 182 | <cstring>tab</cstring> |
183 | </property> | 183 | </property> |
184 | <attribute> | 184 | <attribute> |
185 | <name>title</name> | 185 | <name>title</name> |
186 | <string>Profiles</string> | 186 | <string>Profiles</string> |
187 | </attribute> | 187 | </attribute> |
188 | <grid> | 188 | <grid> |
189 | <property stdset="1"> | 189 | <property stdset="1"> |
190 | <name>margin</name> | 190 | <name>margin</name> |
191 | <number>11</number> | 191 | <number>11</number> |
192 | </property> | 192 | </property> |
193 | <property stdset="1"> | 193 | <property stdset="1"> |
194 | <name>spacing</name> | 194 | <name>spacing</name> |
195 | <number>6</number> | 195 | <number>6</number> |
196 | </property> | 196 | </property> |
197 | <widget row="1" column="0" rowspan="1" colspan="3" > | 197 | <widget row="1" column="0" rowspan="1" colspan="3" > |
198 | <class>Line</class> | 198 | <class>Line</class> |
199 | <property stdset="1"> | 199 | <property stdset="1"> |
200 | <name>name</name> | 200 | <name>name</name> |
201 | <cstring>Line1</cstring> | 201 | <cstring>Line1</cstring> |
202 | </property> | 202 | </property> |
203 | <property stdset="1"> | 203 | <property stdset="1"> |
204 | <name>orientation</name> | 204 | <name>orientation</name> |
205 | <enum>Horizontal</enum> | 205 | <enum>Horizontal</enum> |
206 | </property> | 206 | </property> |
207 | </widget> | 207 | </widget> |
208 | <widget row="0" column="0" > | 208 | <widget row="0" column="0" > |
209 | <class>QLabel</class> | 209 | <class>QLabel</class> |
210 | <property stdset="1"> | 210 | <property stdset="1"> |
211 | <name>name</name> | 211 | <name>name</name> |
212 | <cstring>TextLabel1</cstring> | 212 | <cstring>TextLabel1</cstring> |
213 | </property> | 213 | </property> |
214 | <property stdset="1"> | 214 | <property stdset="1"> |
215 | <name>text</name> | 215 | <name>text</name> |
216 | <string>Current Profile</string> | 216 | <string>Current Profile</string> |
217 | </property> | 217 | </property> |
218 | </widget> | 218 | </widget> |
219 | <widget row="0" column="1" > | 219 | <widget row="0" column="1" > |
220 | <class>QLabel</class> | 220 | <class>QLabel</class> |
221 | <property stdset="1"> | 221 | <property stdset="1"> |
222 | <name>name</name> | 222 | <name>name</name> |
223 | <cstring>currentProfileLabel</cstring> | 223 | <cstring>currentProfileLabel</cstring> |
224 | </property> | 224 | </property> |
225 | <property stdset="1"> | 225 | <property stdset="1"> |
226 | <name>frameShape</name> | 226 | <name>frameShape</name> |
227 | <enum>Panel</enum> | 227 | <enum>Panel</enum> |
228 | </property> | 228 | </property> |
229 | <property stdset="1"> | 229 | <property stdset="1"> |
230 | <name>frameShadow</name> | 230 | <name>frameShadow</name> |
231 | <enum>Sunken</enum> | 231 | <enum>Sunken</enum> |
232 | </property> | 232 | </property> |
233 | <property stdset="1"> | 233 | <property stdset="1"> |
234 | <name>text</name> | 234 | <name>text</name> |
235 | <string>All</string> | 235 | <string>All</string> |
236 | </property> | 236 | </property> |
237 | </widget> | 237 | </widget> |
238 | <spacer row="0" column="2" > | 238 | <spacer row="0" column="2" > |
239 | <property> | 239 | <property> |
240 | <name>name</name> | 240 | <name>name</name> |
241 | <cstring>Spacer2</cstring> | 241 | <cstring>Spacer2</cstring> |
242 | </property> | 242 | </property> |
243 | <property stdset="1"> | 243 | <property stdset="1"> |
244 | <name>orientation</name> | 244 | <name>orientation</name> |
245 | <enum>Horizontal</enum> | 245 | <enum>Horizontal</enum> |
246 | </property> | 246 | </property> |
247 | <property stdset="1"> | 247 | <property stdset="1"> |
248 | <name>sizeType</name> | 248 | <name>sizeType</name> |
249 | <enum>Expanding</enum> | 249 | <enum>Expanding</enum> |
250 | </property> | 250 | </property> |
251 | <property> | 251 | <property> |
252 | <name>sizeHint</name> | 252 | <name>sizeHint</name> |
253 | <size> | 253 | <size> |
254 | <width>20</width> | 254 | <width>20</width> |
255 | <height>20</height> | 255 | <height>20</height> |
256 | </size> | 256 | </size> |
257 | </property> | 257 | </property> |
258 | </spacer> | 258 | </spacer> |
259 | <spacer row="6" column="2" > | 259 | <spacer row="6" column="2" > |
260 | <property> | 260 | <property> |
261 | <name>name</name> | 261 | <name>name</name> |
262 | <cstring>Spacer16</cstring> | 262 | <cstring>Spacer16</cstring> |
263 | </property> | 263 | </property> |
264 | <property stdset="1"> | 264 | <property stdset="1"> |
265 | <name>orientation</name> | 265 | <name>orientation</name> |
266 | <enum>Vertical</enum> | 266 | <enum>Vertical</enum> |
267 | </property> | 267 | </property> |
268 | <property stdset="1"> | 268 | <property stdset="1"> |
269 | <name>sizeType</name> | 269 | <name>sizeType</name> |
270 | <enum>Expanding</enum> | 270 | <enum>Expanding</enum> |
271 | </property> | 271 | </property> |
272 | <property> | 272 | <property> |
273 | <name>sizeHint</name> | 273 | <name>sizeHint</name> |
274 | <size> | 274 | <size> |
275 | <width>20</width> | 275 | <width>20</width> |
276 | <height>20</height> | 276 | <height>20</height> |
277 | </size> | 277 | </size> |
278 | </property> | 278 | </property> |
279 | </spacer> | 279 | </spacer> |
280 | <widget row="5" column="2" > | 280 | <widget row="5" column="2" > |
281 | <class>QPushButton</class> | 281 | <class>QPushButton</class> |
282 | <property stdset="1"> | 282 | <property stdset="1"> |
283 | <name>name</name> | 283 | <name>name</name> |
284 | <cstring>PushButton7</cstring> | 284 | <cstring>PushButton7</cstring> |
285 | </property> | 285 | </property> |
286 | <property stdset="1"> | 286 | <property stdset="1"> |
287 | <name>text</name> | 287 | <name>text</name> |
288 | <string>&Set Current</string> | 288 | <string>&Set Current</string> |
289 | </property> | 289 | </property> |
290 | </widget> | 290 | </widget> |
291 | <widget row="4" column="2" > | 291 | <widget row="4" column="2" > |
292 | <class>QPushButton</class> | 292 | <class>QPushButton</class> |
293 | <property stdset="1"> | 293 | <property stdset="1"> |
294 | <name>name</name> | 294 | <name>name</name> |
295 | <cstring>removeProfileButton</cstring> | 295 | <cstring>removeProfileButton</cstring> |
296 | </property> | 296 | </property> |
297 | <property stdset="1"> | 297 | <property stdset="1"> |
298 | <name>text</name> | 298 | <name>text</name> |
299 | <string>&Remove</string> | 299 | <string>&Remove</string> |
300 | </property> | 300 | </property> |
301 | </widget> | 301 | </widget> |
302 | <widget row="3" column="2" > | 302 | <widget row="3" column="2" > |
303 | <class>QPushButton</class> | 303 | <class>QPushButton</class> |
304 | <property stdset="1"> | 304 | <property stdset="1"> |
305 | <name>name</name> | 305 | <name>name</name> |
306 | <cstring>newProfileButton</cstring> | 306 | <cstring>newProfileButton</cstring> |
307 | </property> | 307 | </property> |
308 | <property stdset="1"> | 308 | <property stdset="1"> |
309 | <name>text</name> | 309 | <name>text</name> |
310 | <string>&New</string> | 310 | <string>&New</string> |
311 | </property> | 311 | </property> |
312 | </widget> | 312 | </widget> |
313 | <widget row="2" column="0" > | 313 | <widget row="2" column="0" > |
314 | <class>QLabel</class> | 314 | <class>QLabel</class> |
315 | <property stdset="1"> | 315 | <property stdset="1"> |
316 | <name>name</name> | 316 | <name>name</name> |
317 | <cstring>TextLabel1_2</cstring> | 317 | <cstring>TextLabel1_2</cstring> |
318 | </property> | 318 | </property> |
319 | <property stdset="1"> | 319 | <property stdset="1"> |
320 | <name>text</name> | 320 | <name>text</name> |
321 | <string>Profiles</string> | 321 | <string>Profiles</string> |
322 | </property> | 322 | </property> |
323 | </widget> | 323 | </widget> |
324 | <widget row="3" column="0" rowspan="3" colspan="2" > | 324 | <widget row="3" column="0" rowspan="3" colspan="2" > |
325 | <class>QListBox</class> | 325 | <class>QListBox</class> |
326 | <property stdset="1"> | 326 | <property stdset="1"> |
327 | <name>name</name> | 327 | <name>name</name> |
328 | <cstring>profilesList</cstring> | 328 | <cstring>profilesList</cstring> |
329 | </property> | 329 | </property> |
330 | </widget> | 330 | </widget> |
331 | </grid> | 331 | </grid> |
332 | </widget> | 332 | </widget> |
333 | </widget> | 333 | </widget> |
334 | </vbox> | 334 | </vbox> |
335 | </widget> | 335 | </widget> |
336 | <customwidgets> | 336 | <customwidgets> |
337 | <customwidget> | 337 | <customwidget> |
338 | <class>QWidget</class> | 338 | <class>QWidget</class> |
339 | <header location="local">qwidget.h</header> | 339 | <header location="local">qwidget.h</header> |
340 | <sizehint> | 340 | <sizehint> |
341 | <width>100</width> | 341 | <width>100</width> |
342 | <height>100</height> | 342 | <height>100</height> |
343 | </sizehint> | 343 | </sizehint> |
344 | <container>0</container> | 344 | <container>0</container> |
345 | <sizepolicy> | 345 | <sizepolicy> |
346 | <hordata>7</hordata> | 346 | <hordata>7</hordata> |
347 | <verdata>7</verdata> | 347 | <verdata>7</verdata> |
348 | </sizepolicy> | 348 | </sizepolicy> |
349 | <pixmap>image0</pixmap> | 349 | <pixmap>image0</pixmap> |
350 | </customwidget> | 350 | </customwidget> |
351 | </customwidgets> | 351 | </customwidgets> |
352 | <images> | 352 | <images> |
353 | <image> | 353 | <image> |
354 | <name>image0</name> | 354 | <name>image0</name> |
355 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | 355 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> |
356 | </image> | 356 | </image> |
357 | </images> | 357 | </images> |
358 | </UI> | 358 | </UI> |
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index 89dac6f..66ec8b5 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp | |||
@@ -1,396 +1,403 @@ | |||
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> |
11 | #include <qlistbox.h> | 11 | #include <qlistbox.h> |
12 | #include <qlistview.h> | 12 | #include <qlistview.h> |
13 | #include <qheader.h> | 13 | #include <qheader.h> |
14 | #include <qlabel.h> | 14 | #include <qlabel.h> |
15 | 15 | ||
16 | #include <qmainwindow.h> | 16 | #include <qmainwindow.h> |
17 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | #include <qpe/qlibrary.h> | 20 | #include <qpe/qlibrary.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | 22 | ||
23 | #include <qlist.h> | 23 | #include <qlist.h> |
24 | #include <qdir.h> | 24 | #include <qdir.h> |
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 | ||
34 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) { | 31 | MainWindowImp::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 | */ |
71 | MainWindowImp::~MainWindowImp(){ | 57 | MainWindowImp::~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 | */ | ||
78 | void MainWindowImp::loadModules(QString path){ | 76 | void 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 | } |
97 | } | 93 | } |
98 | 94 | ||
99 | /** | 95 | /** |
100 | * Attempt to load a function and resolve a function. | 96 | * Attempt to load a function and resolve a function. |
101 | * @param pluginFileName - the name of the file in which to attempt to load | 97 | * @param pluginFileName - the name of the file in which to attempt to load |
102 | * @param resolveString - function pointer to resolve | 98 | * @param resolveString - function pointer to resolve |
103 | * @return pointer to the function with name resolveString or NULL | 99 | * @return pointer to the function with name resolveString or NULL |
104 | */ | 100 | */ |
105 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ | 101 | Module* 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 ){ |
110 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 106 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); |
111 | delete lib; | 107 | delete lib; |
112 | return NULL; | 108 | return NULL; |
113 | } | 109 | } |
114 | 110 | ||
115 | // Try to get an object. | 111 | // Try to get an object. |
116 | Module *object = ((Module* (*)()) functionPointer)(); | 112 | Module *object = ((Module* (*)()) functionPointer)(); |
117 | if(object == NULL){ | 113 | if(object == NULL){ |
118 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 114 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
119 | delete lib; | 115 | delete lib; |
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 | } |
127 | 123 | ||
128 | /** | 124 | /** |
129 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 125 | * The Add button was clicked. Bring up the add dialog and if OK is hit |
130 | * load the plugin and append it to the list | 126 | * load the plugin and append it to the list |
131 | */ | 127 | */ |
132 | void MainWindowImp::addClicked(){ | 128 | void 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 | /** |
144 | * Prompt the user to see if they really want to do this. | 151 | * Prompt the user to see if they really want to do this. |
145 | * If they do then remove from the list and unload. | 152 | * If they do then remove from the list and unload. |
146 | */ | 153 | */ |
147 | void MainWindowImp::removeClicked(){ | 154 | void 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; |
152 | } | 159 | } |
153 | 160 | ||
154 | if((interfaceItems[item])->getModuleOwner() == NULL){ | 161 | if((interfaceItems[item])->getModuleOwner() == NULL){ |
155 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); | 162 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); |
156 | } | 163 | } |
157 | else{ | 164 | else{ |
158 | // Try to remove. | 165 | // Try to remove. |
159 | } | 166 | } |
160 | 167 | ||
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 | */ |
167 | void MainWindowImp::configureClicked(){ | 176 | void 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 | */ |
204 | void MainWindowImp::informationClicked(){ | 209 | void 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 | /** |
237 | * Aquire the list of active interfaces from ifconfig | 237 | * Aquire the list of active interfaces from ifconfig |
238 | * Call ifconfig and ifconfig -a | 238 | * Call ifconfig and ifconfig -a |
239 | */ | 239 | */ |
240 | void MainWindowImp::getInterfaceList(){ | 240 | void MainWindowImp::getInterfaceList(){ |
241 | KShellProcess *processAll = new KShellProcess(); | 241 | KShellProcess *processAll = new KShellProcess(); |
242 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; | 242 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; |
243 | connect(processAll, SIGNAL(processExited(KProcess *)), | 243 | connect(processAll, SIGNAL(processExited(KProcess *)), |
244 | this, SLOT(jobDone(KProcess *))); | 244 | this, SLOT(jobDone(KProcess *))); |
245 | threads.insert(processAll, TEMP_ALL); | 245 | threads.insert(processAll, TEMP_ALL); |
246 | processAll->start(KShellProcess::NotifyOnExit); | 246 | processAll->start(KShellProcess::NotifyOnExit); |
247 | 247 | ||
248 | KShellProcess *process = new KShellProcess(); | 248 | KShellProcess *process = new KShellProcess(); |
249 | *process << "/sbin/ifconfig" << " > " TEMP_UP; | 249 | *process << "/sbin/ifconfig" << " > " TEMP_UP; |
250 | connect(process, SIGNAL(processExited(KProcess *)), | 250 | connect(process, SIGNAL(processExited(KProcess *)), |
251 | this, SLOT(jobDone(KProcess *))); | 251 | this, SLOT(jobDone(KProcess *))); |
252 | threads.insert(process, TEMP_UP); | 252 | threads.insert(process, TEMP_UP); |
253 | process->start(KShellProcess::NotifyOnExit); | 253 | process->start(KShellProcess::NotifyOnExit); |
254 | } | 254 | } |
255 | 255 | ||
256 | void MainWindowImp::jobDone(KProcess *process){ | 256 | void MainWindowImp::jobDone(KProcess *process){ |
257 | QString fileName = threads[process]; | 257 | QString fileName = threads[process]; |
258 | threads.remove(process); | 258 | threads.remove(process); |
259 | delete process; | 259 | delete process; |
260 | 260 | ||
261 | QFile file(fileName); | 261 | QFile file(fileName); |
262 | if (!file.open(IO_ReadOnly)){ | 262 | if (!file.open(IO_ReadOnly)){ |
263 | qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1()); | 263 | qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1()); |
264 | return; | 264 | return; |
265 | } | 265 | } |
266 | 266 | ||
267 | QTextStream stream( &file ); | 267 | QTextStream stream( &file ); |
268 | QString line; | 268 | QString line; |
269 | while ( !stream.eof() ) { | 269 | while ( !stream.eof() ) { |
270 | line = stream.readLine(); | 270 | line = stream.readLine(); |
271 | int space = line.find(" "); | 271 | int space = line.find(" "); |
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()){ |
278 | if(fileName == TEMP_ALL) | 282 | if(fileName == TEMP_ALL) |
279 | i = new Interface(interfaceName, false); | 283 | i = new Interface(interfaceName, false); |
280 | else | 284 | else |
281 | i = new Interface(interfaceName, true); | 285 | i = new Interface(interfaceName, true); |
282 | } | 286 | } |
283 | else{ | 287 | else{ |
284 | i = interfaceNames[interfaceName]; | 288 | i = interfaceNames[interfaceName]; |
285 | if(fileName != TEMP_ALL) | 289 | if(fileName != TEMP_ALL) |
286 | i->setStatus(true); | 290 | i->setStatus(true); |
287 | } | 291 | } |
288 | 292 | ||
289 | i->setAttached(true); | 293 | i->setAttached(true); |
290 | i->setInterfaceName(interfaceName); | 294 | i->setInterfaceName(interfaceName); |
291 | 295 | ||
292 | QString hardName = "Ethernet"; | 296 | QString hardName = "Ethernet"; |
293 | int hardwareName = line.find("Link encap:"); | 297 | int hardwareName = line.find("Link encap:"); |
294 | int macAddress = line.find("HWaddr"); | 298 | int macAddress = line.find("HWaddr"); |
295 | if(macAddress == -1) | 299 | if(macAddress == -1) |
296 | macAddress = line.length(); | 300 | macAddress = line.length(); |
297 | if(hardwareName != -1) | 301 | if(hardwareName != -1) |
298 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); | 302 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); |
299 | // We have found an interface | 303 | // We have found an interface |
300 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); | 304 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); |
301 | interfaceNames.insert(i->getInterfaceName(), i); | 305 | interfaceNames.insert(i->getInterfaceName(), i); |
302 | updateInterface(i); | 306 | updateInterface(i); |
303 | } | 307 | } |
304 | } | 308 | } |
305 | file.close(); | 309 | file.close(); |
306 | QFile::remove(fileName); | 310 | QFile::remove(fileName); |
307 | } | 311 | } |
308 | 312 | ||
313 | /** | ||
314 | * | ||
315 | */ | ||
309 | void MainWindowImp::updateInterface(Interface *i){ | 316 | void 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 ){ |
318 | if(it.key()->isOwner(i)) | 325 | if(it.key()->isOwner(i)) |
319 | i->setModuleOwner(it.key()); | 326 | i->setModuleOwner(it.key()); |
320 | } | 327 | } |
321 | 328 | ||
322 | items.insert(i, item); | 329 | items.insert(i, item); |
323 | interfaceItems.insert(item, i); | 330 | interfaceItems.insert(item, i); |
324 | } | 331 | } |
325 | else | 332 | else |
326 | item = items[i]; | 333 | item = items[i]; |
327 | 334 | ||
328 | QString statusImage = "down"; | 335 | QString statusImage = "down"; |
329 | if(i->getStatus()) | 336 | if(i->getStatus()) |
330 | statusImage = "up"; | 337 | statusImage = "up"; |
331 | QPixmap status = (Resource::loadPixmap(statusImage)); | 338 | QPixmap status = (Resource::loadPixmap(statusImage)); |
332 | item->setPixmap(0, status); | 339 | item->setPixmap(0, status); |
333 | 340 | ||
334 | QString typeName = "lan"; | 341 | QString typeName = "lan"; |
335 | if(i->getHardwareName().contains("Local Loopback")) | 342 | if(i->getHardwareName().contains("Local Loopback")) |
336 | typeName = "lo"; | 343 | typeName = "lo"; |
337 | if(i->getInterfaceName().contains("irda")) | 344 | if(i->getInterfaceName().contains("irda")) |
338 | typeName = "irda"; | 345 | typeName = "irda"; |
339 | if(i->getInterfaceName().contains("wlan")) | 346 | if(i->getInterfaceName().contains("wlan")) |
340 | typeName = "wlan"; | 347 | typeName = "wlan"; |
341 | // Actually try to use the Module | 348 | // Actually try to use the Module |
342 | if(i->getModuleOwner() != NULL){ | 349 | if(i->getModuleOwner() != NULL){ |
343 | typeName = i->getModuleOwner()->getPixmapName(i); | 350 | typeName = i->getModuleOwner()->getPixmapName(i); |
344 | } | 351 | } |
345 | QPixmap type = (Resource::loadPixmap(typeName)); | 352 | QPixmap type = (Resource::loadPixmap(typeName)); |
346 | item->setPixmap(1, type); | 353 | item->setPixmap(1, type); |
347 | 354 | ||
348 | item->setText(2, i->getHardwareName()); | 355 | item->setText(2, i->getHardwareName()); |
349 | 356 | ||
350 | } | 357 | } |
351 | 358 | ||
352 | /** | 359 | /** |
353 | * Adds a new profile to the list of profiles. | 360 | * Adds a new profile to the list of profiles. |
354 | * Don't add profiles that already exists. | 361 | * Don't add profiles that already exists. |
355 | * Appends to the combo and QStringList | 362 | * Appends to the combo and QStringList |
356 | */ | 363 | */ |
357 | void MainWindowImp::addProfile(){ | 364 | void MainWindowImp::addProfile(){ |
358 | QString newProfileName = "New"; | 365 | QString newProfileName = "New"; |
359 | if(profiles.grep(newProfileName).count() > 0){ | 366 | if(profiles.grep(newProfileName).count() > 0){ |
360 | QMessageBox::information(this, "Can't Add.","Profile already exists.", "Ok"); | 367 | QMessageBox::information(this, "Can't Add.","Profile already exists.", "Ok"); |
361 | return; | 368 | return; |
362 | } | 369 | } |
363 | profiles.append(newProfileName); | 370 | profiles.append(newProfileName); |
364 | profilesList->insertItem(newProfileName); | 371 | profilesList->insertItem(newProfileName); |
365 | 372 | ||
366 | } | 373 | } |
367 | 374 | ||
368 | /** | 375 | /** |
369 | * Removes the currently selected profile in the combo. | 376 | * Removes the currently selected profile in the combo. |
370 | * Doesn't delete if there are less then 2 profiles. | 377 | * Doesn't delete if there are less then 2 profiles. |
371 | */ | 378 | */ |
372 | void MainWindowImp::removeProfile(){ | 379 | void MainWindowImp::removeProfile(){ |
373 | if(profilesList->count() <= 1){ | 380 | if(profilesList->count() <= 1){ |
374 | QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok"); | 381 | QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok"); |
375 | return; | 382 | return; |
376 | } | 383 | } |
377 | QString profileToRemove = profilesList->currentText(); | 384 | QString profileToRemove = profilesList->currentText(); |
378 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ | 385 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ |
379 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); | 386 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); |
380 | profilesList->clear(); | 387 | profilesList->clear(); |
381 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 388 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
382 | profilesList->insertItem((*it)); | 389 | profilesList->insertItem((*it)); |
383 | } | 390 | } |
384 | 391 | ||
385 | } | 392 | } |
386 | 393 | ||
387 | /** | 394 | /** |
388 | * A new profile has been selected, change. | 395 | * A new profile has been selected, change. |
389 | * @param newProfile the new profile. | 396 | * @param newProfile the new profile. |
390 | */ | 397 | */ |
391 | void MainWindowImp::changeProfile(const QString& newProfile){ | 398 | void MainWindowImp::changeProfile(const QString& newProfile){ |
392 | currentProfileLabel->setText(newProfile); | 399 | currentProfileLabel->setText(newProfile); |
393 | } | 400 | } |
394 | 401 | ||
395 | // mainwindowimp.cpp | 402 | // mainwindowimp.cpp |
396 | 403 | ||
diff --git a/noncore/net/networksetup/mainwindowimp.h b/noncore/net/networksetup/mainwindowimp.h index 19ebaf2..629b758 100644 --- a/noncore/net/networksetup/mainwindowimp.h +++ b/noncore/net/networksetup/mainwindowimp.h | |||
@@ -1,56 +1,57 @@ | |||
1 | #ifndef MAINWINOWIMP_H | 1 | #ifndef MAINWINOWIMP_H |
2 | #define MAINWINOWIMP_H | 2 | #define MAINWINOWIMP_H |
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | #include <qmap.h> | 5 | #include <qmap.h> |
6 | #include <qstringlist.h> | 6 | #include <qstringlist.h> |
7 | 7 | ||
8 | class Module; | 8 | class Module; |
9 | class Interface; | 9 | class Interface; |
10 | class QLibrary; | 10 | class QLibrary; |
11 | class KProcess; | 11 | class KProcess; |
12 | 12 | ||
13 | class MainWindowImp : public MainWindow { | 13 | class MainWindowImp : public MainWindow { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | MainWindowImp(QWidget *parent=0, const char *name=0); | 17 | MainWindowImp(QWidget *parent=0, const char *name=0); |
18 | ~MainWindowImp(); | 18 | ~MainWindowImp(); |
19 | 19 | ||
20 | private slots: | 20 | private slots: |
21 | void addClicked(); | 21 | void addClicked(); |
22 | void removeClicked(); | 22 | void removeClicked(); |
23 | void configureClicked(); | 23 | void configureClicked(); |
24 | void informationClicked(); | 24 | void informationClicked(); |
25 | 25 | ||
26 | void jobDone(KProcess *process); | 26 | void jobDone(KProcess *process); |
27 | void getInterfaceList(); | 27 | void getInterfaceList(); |
28 | 28 | ||
29 | void addProfile(); | 29 | void addProfile(); |
30 | void removeProfile(); | 30 | void removeProfile(); |
31 | void changeProfile(const QString&); | 31 | void changeProfile(const QString&); |
32 | 32 | ||
33 | void updateInterface(Interface *i); | 33 | void updateInterface(Interface *i); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | void loadModules(QString path); | 36 | void loadModules(QString path); |
37 | 37 | ||
38 | Module* loadPlugin(QString pluginFileName, | 38 | Module* loadPlugin(QString pluginFileName, |
39 | QString resolveString = "create_plugin"); | 39 | QString resolveString = "create_plugin"); |
40 | 40 | ||
41 | // For our local list of names | 41 | // For our local list of names |
42 | QMap<QString, Interface*> interfaceNames; | 42 | QMap<QString, Interface*> interfaceNames; |
43 | 43 | ||
44 | QMap<Module*, QLibrary*> libraries; | 44 | QMap<Module*, QLibrary*> libraries; |
45 | QMap<Interface*, QListViewItem*> items; | 45 | QMap<Interface*, QListViewItem*> items; |
46 | QMap<QListViewItem*, Interface*> interfaceItems; | 46 | QMap<QListViewItem*, Interface*> interfaceItems; |
47 | 47 | ||
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 |
54 | 55 | ||
55 | // mainwindowimp.h | 56 | // mainwindowimp.h |
56 | 57 | ||
diff --git a/noncore/net/networksetup/module.h b/noncore/net/networksetup/module.h index c1e9488..0c81928 100644 --- a/noncore/net/networksetup/module.h +++ b/noncore/net/networksetup/module.h | |||
@@ -1,34 +1,79 @@ | |||
1 | #ifndef NETCONF_MODULE_H | 1 | #ifndef NETCONF_MODULE_H |
2 | #define NETCONF_MODULE_H | 2 | #define NETCONF_MODULE_H |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include "interface.h" | 7 | #include "interface.h" |
8 | 8 | ||
9 | class QWidget; | 9 | class QWidget; |
10 | class QTabWidget; | 10 | class QTabWidget; |
11 | 11 | ||
12 | class Module : QObject{ | 12 | class Module : QObject{ |
13 | 13 | ||
14 | signals: | 14 | signals: |
15 | void updateInterface(Interface *i); | 15 | void updateInterface(Interface *i); |
16 | 16 | ||
17 | public: | 17 | public: |
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 | ||
31 | #endif | 76 | #endif |
32 | 77 | ||
33 | // module.h | 78 | // module.h |
34 | 79 | ||
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 |
8 | LIBS += -lqpe | 8 | LIBS += -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 | |||
@@ -1,248 +1,248 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>WLAN</class> | 2 | <class>WLAN</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>WLAN</cstring> | 7 | <cstring>WLAN</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>254</width> | 14 | <width>250</width> |
15 | <height>286</height> | 15 | <height>286</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>Wireless LAN Setting</string> | 20 | <string>Wireless LAN Setting</string> |
21 | </property> | 21 | </property> |
22 | <property stdset="1"> | 22 | <property stdset="1"> |
23 | <name>sizeGripEnabled</name> | 23 | <name>sizeGripEnabled</name> |
24 | <bool>true</bool> | 24 | <bool>true</bool> |
25 | </property> | 25 | </property> |
26 | <property> | 26 | <property> |
27 | <name>layoutMargin</name> | 27 | <name>layoutMargin</name> |
28 | </property> | 28 | </property> |
29 | <vbox> | 29 | <vbox> |
30 | <property stdset="1"> | 30 | <property stdset="1"> |
31 | <name>margin</name> | 31 | <name>margin</name> |
32 | <number>0</number> | 32 | <number>0</number> |
33 | </property> | 33 | </property> |
34 | <property stdset="1"> | 34 | <property stdset="1"> |
35 | <name>spacing</name> | 35 | <name>spacing</name> |
36 | <number>6</number> | 36 | <number>6</number> |
37 | </property> | 37 | </property> |
38 | <widget> | 38 | <widget> |
39 | <class>QTabWidget</class> | 39 | <class>QTabWidget</class> |
40 | <property stdset="1"> | 40 | <property stdset="1"> |
41 | <name>name</name> | 41 | <name>name</name> |
42 | <cstring>tabWidget</cstring> | 42 | <cstring>tabWidget</cstring> |
43 | </property> | 43 | </property> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>enabled</name> | 45 | <name>enabled</name> |
46 | <bool>true</bool> | 46 | <bool>true</bool> |
47 | </property> | 47 | </property> |
48 | <widget> | 48 | <widget> |
49 | <class>QWidget</class> | 49 | <class>QWidget</class> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>name</name> | 51 | <name>name</name> |
52 | <cstring>ConfigPage</cstring> | 52 | <cstring>ConfigPage</cstring> |
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"> |
60 | <name>margin</name> | 60 | <name>margin</name> |
61 | <number>11</number> | 61 | <number>11</number> |
62 | </property> | 62 | </property> |
63 | <property stdset="1"> | 63 | <property stdset="1"> |
64 | <name>spacing</name> | 64 | <name>spacing</name> |
65 | <number>6</number> | 65 | <number>6</number> |
66 | </property> | 66 | </property> |
67 | <widget> | 67 | <widget> |
68 | <class>QButtonGroup</class> | 68 | <class>QButtonGroup</class> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>name</name> | 70 | <name>name</name> |
71 | <cstring>ButtonGroup45</cstring> | 71 | <cstring>ButtonGroup45</cstring> |
72 | </property> | 72 | </property> |
73 | <property stdset="1"> | 73 | <property stdset="1"> |
74 | <name>title</name> | 74 | <name>title</name> |
75 | <string>ESS ID</string> | 75 | <string>ESS ID</string> |
76 | </property> | 76 | </property> |
77 | <vbox> | 77 | <vbox> |
78 | <property stdset="1"> | 78 | <property stdset="1"> |
79 | <name>margin</name> | 79 | <name>margin</name> |
80 | <number>11</number> | 80 | <number>11</number> |
81 | </property> | 81 | </property> |
82 | <property stdset="1"> | 82 | <property stdset="1"> |
83 | <name>spacing</name> | 83 | <name>spacing</name> |
84 | <number>6</number> | 84 | <number>6</number> |
85 | </property> | 85 | </property> |
86 | <widget> | 86 | <widget> |
87 | <class>QRadioButton</class> | 87 | <class>QRadioButton</class> |
88 | <property stdset="1"> | 88 | <property stdset="1"> |
89 | <name>name</name> | 89 | <name>name</name> |
90 | <cstring>essNon</cstring> | 90 | <cstring>essNon</cstring> |
91 | </property> | 91 | </property> |
92 | <property stdset="1"> | 92 | <property stdset="1"> |
93 | <name>text</name> | 93 | <name>text</name> |
94 | <string>Non-Spec ESSID: "ANY"</string> | 94 | <string>Non-Spec ESSID: "ANY"</string> |
95 | </property> | 95 | </property> |
96 | <property stdset="1"> | 96 | <property stdset="1"> |
97 | <name>checked</name> | 97 | <name>checked</name> |
98 | <bool>true</bool> | 98 | <bool>true</bool> |
99 | </property> | 99 | </property> |
100 | </widget> | 100 | </widget> |
101 | <widget> | 101 | <widget> |
102 | <class>QRadioButton</class> | 102 | <class>QRadioButton</class> |
103 | <property stdset="1"> | 103 | <property stdset="1"> |
104 | <name>name</name> | 104 | <name>name</name> |
105 | <cstring>essSpecific</cstring> | 105 | <cstring>essSpecific</cstring> |
106 | </property> | 106 | </property> |
107 | <property stdset="1"> | 107 | <property stdset="1"> |
108 | <name>text</name> | 108 | <name>text</name> |
109 | <string>Specific ESSID</string> | 109 | <string>Specific ESSID</string> |
110 | </property> | 110 | </property> |
111 | </widget> | 111 | </widget> |
112 | <widget> | 112 | <widget> |
113 | <class>QLineEdit</class> | 113 | <class>QLineEdit</class> |
114 | <property stdset="1"> | 114 | <property stdset="1"> |
115 | <name>name</name> | 115 | <name>name</name> |
116 | <cstring>essSpecificLineEdit</cstring> | 116 | <cstring>essSpecificLineEdit</cstring> |
117 | </property> | 117 | </property> |
118 | <property stdset="1"> | 118 | <property stdset="1"> |
119 | <name>enabled</name> | 119 | <name>enabled</name> |
120 | <bool>false</bool> | 120 | <bool>false</bool> |
121 | </property> | 121 | </property> |
122 | </widget> | 122 | </widget> |
123 | </vbox> | 123 | </vbox> |
124 | </widget> | 124 | </widget> |
125 | <widget> | 125 | <widget> |
126 | <class>QButtonGroup</class> | 126 | <class>QButtonGroup</class> |
127 | <property stdset="1"> | 127 | <property stdset="1"> |
128 | <name>name</name> | 128 | <name>name</name> |
129 | <cstring>ButtonGroup46</cstring> | 129 | <cstring>ButtonGroup46</cstring> |
130 | </property> | 130 | </property> |
131 | <property stdset="1"> | 131 | <property stdset="1"> |
132 | <name>title</name> | 132 | <name>title</name> |
133 | <string>Network Type</string> | 133 | <string>Network Type</string> |
134 | </property> | 134 | </property> |
135 | <grid> | 135 | <grid> |
136 | <property stdset="1"> | 136 | <property stdset="1"> |
137 | <name>margin</name> | 137 | <name>margin</name> |
138 | <number>11</number> | 138 | <number>11</number> |
139 | </property> | 139 | </property> |
140 | <property stdset="1"> | 140 | <property stdset="1"> |
141 | <name>spacing</name> | 141 | <name>spacing</name> |
142 | <number>6</number> | 142 | <number>6</number> |
143 | </property> | 143 | </property> |
144 | <widget row="0" column="0" rowspan="1" colspan="3" > | 144 | <widget row="0" column="0" rowspan="1" colspan="3" > |
145 | <class>QRadioButton</class> | 145 | <class>QRadioButton</class> |
146 | <property stdset="1"> | 146 | <property stdset="1"> |
147 | <name>name</name> | 147 | <name>name</name> |
148 | <cstring>networkInfrastructure</cstring> | 148 | <cstring>networkInfrastructure</cstring> |
149 | </property> | 149 | </property> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>text</name> | 151 | <name>text</name> |
152 | <string>Infrastructure</string> | 152 | <string>Infrastructure</string> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>checked</name> | 155 | <name>checked</name> |
156 | <bool>true</bool> | 156 | <bool>true</bool> |
157 | </property> | 157 | </property> |
158 | </widget> | 158 | </widget> |
159 | <widget row="2" column="0" > | 159 | <widget row="2" column="0" > |
160 | <class>QLabel</class> | 160 | <class>QLabel</class> |
161 | <property stdset="1"> | 161 | <property stdset="1"> |
162 | <name>name</name> | 162 | <name>name</name> |
163 | <cstring>TextLabel2</cstring> | 163 | <cstring>TextLabel2</cstring> |
164 | </property> | 164 | </property> |
165 | <property stdset="1"> | 165 | <property stdset="1"> |
166 | <name>enabled</name> | 166 | <name>enabled</name> |
167 | <bool>false</bool> | 167 | <bool>false</bool> |
168 | </property> | 168 | </property> |
169 | <property stdset="1"> | 169 | <property stdset="1"> |
170 | <name>text</name> | 170 | <name>text</name> |
171 | <string>Channel</string> | 171 | <string>Channel</string> |
172 | </property> | 172 | </property> |
173 | </widget> | 173 | </widget> |
174 | <widget row="1" column="0" rowspan="1" colspan="2" > | 174 | <widget row="1" column="0" rowspan="1" colspan="2" > |
175 | <class>QRadioButton</class> | 175 | <class>QRadioButton</class> |
176 | <property stdset="1"> | 176 | <property stdset="1"> |
177 | <name>name</name> | 177 | <name>name</name> |
178 | <cstring>network802</cstring> | 178 | <cstring>network802</cstring> |
179 | </property> | 179 | </property> |
180 | <property stdset="1"> | 180 | <property stdset="1"> |
181 | <name>text</name> | 181 | <name>text</name> |
182 | <string>802.11 Ad-Hoc</string> | 182 | <string>802.11 Ad-Hoc</string> |
183 | </property> | 183 | </property> |
184 | </widget> | 184 | </widget> |
185 | <widget row="2" column="1" > | 185 | <widget row="2" column="1" > |
186 | <class>QSpinBox</class> | 186 | <class>QSpinBox</class> |
187 | <property stdset="1"> | 187 | <property stdset="1"> |
188 | <name>name</name> | 188 | <name>name</name> |
189 | <cstring>networkChannel</cstring> | 189 | <cstring>networkChannel</cstring> |
190 | </property> | 190 | </property> |
191 | <property stdset="1"> | 191 | <property stdset="1"> |
192 | <name>enabled</name> | 192 | <name>enabled</name> |
193 | <bool>false</bool> | 193 | <bool>false</bool> |
194 | </property> | 194 | </property> |
195 | <property stdset="1"> | 195 | <property stdset="1"> |
196 | <name>maxValue</name> | 196 | <name>maxValue</name> |
197 | <number>11</number> | 197 | <number>11</number> |
198 | </property> | 198 | </property> |
199 | <property stdset="1"> | 199 | <property stdset="1"> |
200 | <name>minValue</name> | 200 | <name>minValue</name> |
201 | <number>1</number> | 201 | <number>1</number> |
202 | </property> | 202 | </property> |
203 | </widget> | 203 | </widget> |
204 | <spacer row="2" column="2" > | 204 | <spacer row="2" column="2" > |
205 | <property> | 205 | <property> |
206 | <name>name</name> | 206 | <name>name</name> |
207 | <cstring>Spacer32</cstring> | 207 | <cstring>Spacer32</cstring> |
208 | </property> | 208 | </property> |
209 | <property stdset="1"> | 209 | <property stdset="1"> |
210 | <name>orientation</name> | 210 | <name>orientation</name> |
211 | <enum>Horizontal</enum> | 211 | <enum>Horizontal</enum> |
212 | </property> | 212 | </property> |
213 | <property stdset="1"> | 213 | <property stdset="1"> |
214 | <name>sizeType</name> | 214 | <name>sizeType</name> |
215 | <enum>Expanding</enum> | 215 | <enum>Expanding</enum> |
216 | </property> | 216 | </property> |
217 | <property> | 217 | <property> |
218 | <name>sizeHint</name> | 218 | <name>sizeHint</name> |
219 | <size> | 219 | <size> |
220 | <width>20</width> | 220 | <width>20</width> |
221 | <height>20</height> | 221 | <height>20</height> |
222 | </size> | 222 | </size> |
223 | </property> | 223 | </property> |
224 | </spacer> | 224 | </spacer> |
225 | </grid> | 225 | </grid> |
226 | </widget> | 226 | </widget> |
227 | <spacer> | 227 | <spacer> |
228 | <property> | 228 | <property> |
229 | <name>name</name> | 229 | <name>name</name> |
230 | <cstring>Spacer31</cstring> | 230 | <cstring>Spacer31</cstring> |
231 | </property> | 231 | </property> |
232 | <property stdset="1"> | 232 | <property stdset="1"> |
233 | <name>orientation</name> | 233 | <name>orientation</name> |
234 | <enum>Vertical</enum> | 234 | <enum>Vertical</enum> |
235 | </property> | 235 | </property> |
236 | <property stdset="1"> | 236 | <property stdset="1"> |
237 | <name>sizeType</name> | 237 | <name>sizeType</name> |
238 | <enum>Expanding</enum> | 238 | <enum>Expanding</enum> |
239 | </property> | 239 | </property> |
240 | <property> | 240 | <property> |
241 | <name>sizeHint</name> | 241 | <name>sizeHint</name> |
242 | <size> | 242 | <size> |
243 | <width>20</width> | 243 | <width>20</width> |
244 | <height>20</height> | 244 | <height>20</height> |
245 | </size> | 245 | </size> |
246 | </property> | 246 | </property> |
247 | </spacer> | 247 | </spacer> |
248 | </vbox> | 248 | </vbox> |
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index 632f7e4..70b1f7a 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp | |||
@@ -1,85 +1,84 @@ | |||
1 | #include "wlanmodule.h" | 1 | #include "wlanmodule.h" |
2 | #include <qpe/config.h> | 2 | #include <qpe/config.h> |
3 | #include "wlanimp.h" | 3 | #include "wlanimp.h" |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Constructor, find all of the possible interfaces | 6 | * Constructor, find all of the possible interfaces |
7 | */ | 7 | */ |
8 | WLANModule::WLANModule() : Module() { | 8 | WLANModule::WLANModule() : Module() { |
9 | // get output from iwconfig | 9 | // get output from iwconfig |
10 | } | 10 | } |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * get the icon name for this device. | 13 | * get the icon name for this device. |
14 | * @param Interface* can be used in determining the icon. | 14 | * @param Interface* can be used in determining the icon. |
15 | * @return QString the icon name (minus .png, .gif etc) | 15 | * @return QString the icon name (minus .png, .gif etc) |
16 | */ | 16 | */ |
17 | QString WLANModule::getPixmapName(Interface* ){ | 17 | QString WLANModule::getPixmapName(Interface* ){ |
18 | return "wlan"; | 18 | return "wlan"; |
19 | } | 19 | } |
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 | */ |
25 | bool WLANModule::isOwner(Interface *i){ | 26 | bool WLANModule::isOwner(Interface *i){ |
26 | if(i->getInterfaceName() == "eth0") | 27 | if(i->getInterfaceName() == "eth0") |
27 | return true; | 28 | return true; |
28 | return false; | 29 | return false; |
29 | } | 30 | } |
30 | 31 | ||
31 | /** | 32 | /** |
32 | * Create, set tabWiget and return the WLANConfigure Module | 33 | * Create, set tabWiget and return the WLANConfigure Module |
33 | * @param tabWidget a pointer to the tab widget that this configure has. | 34 | * @param tabWidget a pointer to the tab widget that this configure has. |
34 | * @return QWidget* pointer to the tab widget in this modules configure. | 35 | * @return QWidget* pointer to the tab widget in this modules configure. |
35 | */ | 36 | */ |
36 | QWidget *WLANModule::configure(QTabWidget **tabWidget){ | 37 | QWidget *WLANModule::configure(QTabWidget **tabWidget){ |
37 | Config cfg("wireless"); | 38 | Config cfg("wireless"); |
38 | WLANImp *wlanconfig = new WLANImp(cfg); | 39 | WLANImp *wlanconfig = new WLANImp(cfg); |
39 | (*tabWidget) = wlanconfig->tabWidget; | 40 | (*tabWidget) = wlanconfig->tabWidget; |
40 | return wlanconfig; | 41 | return wlanconfig; |
41 | } | 42 | } |
42 | 43 | ||
43 | /** | 44 | /** |
44 | * Create, set tabWiget and return the Information Module | 45 | * Create, set tabWiget and return the Information Module |
45 | * @param tabWidget a pointer to the tab widget that this information has. | 46 | * @param tabWidget a pointer to the tab widget that this information has. |
46 | * @return QWidget* pointer to the tab widget in this modules info. | 47 | * @return QWidget* pointer to the tab widget in this modules info. |
47 | */ | 48 | */ |
48 | QWidget *WLANModule::information(QTabWidget **tabWidget){ | 49 | QWidget *WLANModule::information(QTabWidget **tabWidget){ |
49 | return NULL; | 50 | return NULL; |
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 | */ | ||
55 | QList<Interface> WLANModule::getInterfaces(){ | 58 | QList<Interface> WLANModule::getInterfaces(){ |
56 | return list | 59 | return list; |
57 | } | ||
58 | |||
59 | /** | ||
60 | * Return a list of possible new interfaces | ||
61 | */ | ||
62 | QMap<QString, QString> WLANModule::possibleNewInterfaces(){ | ||
63 | //return list; | ||
64 | } | 60 | } |
65 | 61 | ||
66 | /** | 62 | /** |
67 | * Attempt to add a new interface as defined by name | 63 | * Attempt to add a new interface as defined by name |
68 | * @param name the name of the type of interface that should be created given | 64 | * @param name the name of the type of interface that should be created given |
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 | */ |
72 | Interface *WLANModule::addNewInterface(QString name){ | 68 | Interface *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 | ||
76 | /** | 74 | /** |
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 | */ |
80 | bool WLANModule::remove(Interface* i){ | 78 | bool 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 | ||
84 | // wlanmodule.cpp | 83 | // wlanmodule.cpp |
85 | 84 | ||
diff --git a/noncore/net/networksetup/wlan/wlanmodule.h b/noncore/net/networksetup/wlan/wlanmodule.h index 1fbf6a9..7ebe129 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.h +++ b/noncore/net/networksetup/wlan/wlanmodule.h | |||
@@ -1,38 +1,38 @@ | |||
1 | #ifndef WLAN_MODULE_H | 1 | #ifndef WLAN_MODULE_H |
2 | #define WLAN_MODULE_H | 2 | #define WLAN_MODULE_H |
3 | 3 | ||
4 | #include "module.h" | 4 | #include "module.h" |
5 | 5 | ||
6 | class WLANModule : Module{ | 6 | class WLANModule : Module{ |
7 | 7 | ||
8 | signals: | 8 | signals: |
9 | void updateInterface(Interface *i); | 9 | void updateInterface(Interface *i); |
10 | 10 | ||
11 | public: | 11 | public: |
12 | WLANModule(); | 12 | WLANModule(); |
13 | 13 | ||
14 | virtual bool isOwner(Interface *); | 14 | virtual bool isOwner(Interface *); |
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); |
22 | 22 | ||
23 | private: | 23 | private: |
24 | QList<Interface> list; | 24 | QList<Interface> list; |
25 | 25 | ||
26 | }; | 26 | }; |
27 | 27 | ||
28 | extern "C" | 28 | extern "C" |
29 | { | 29 | { |
30 | void* create_plugin() { | 30 | void* create_plugin() { |
31 | return new WLANModule(); | 31 | return new WLANModule(); |
32 | } | 32 | } |
33 | }; | 33 | }; |
34 | 34 | ||
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | // wlanmodule.h | 37 | // wlanmodule.h |
38 | 38 | ||
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 @@ | |||
1 | Fix DHCP obtained and expoired info | ||
diff --git a/noncore/settings/networksettings/addservice.ui b/noncore/settings/networksettings/addconnection.ui index 929f4fb..a349804 100644 --- a/noncore/settings/networksettings/addservice.ui +++ b/noncore/settings/networksettings/addconnection.ui | |||
@@ -1,154 +1,153 @@ | |||
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"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>11</number> | 25 | <number>11</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget row="3" column="1" > | 31 | <widget row="3" column="1" > |
32 | <class>QPushButton</class> | 32 | <class>QPushButton</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>cancelButton</cstring> | 35 | <cstring>cancelButton</cstring> |
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>&Cancel</string> |
40 | </property> | 40 | </property> |
41 | </widget> | 41 | </widget> |
42 | <widget row="3" column="0" > | 42 | <widget row="3" column="0" > |
43 | <class>QPushButton</class> | 43 | <class>QPushButton</class> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>name</name> | 45 | <name>name</name> |
46 | <cstring>addButton</cstring> | 46 | <cstring>addButton</cstring> |
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>&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" > |
54 | <class>QListView</class> | 54 | <class>QListView</class> |
55 | <column> | 55 | <column> |
56 | <property> | 56 | <property> |
57 | <name>text</name> | 57 | <name>text</name> |
58 | <string>Services</string> | 58 | <string>Services</string> |
59 | </property> | 59 | </property> |
60 | <property> | 60 | <property> |
61 | <name>clickable</name> | 61 | <name>clickable</name> |
62 | <bool>true</bool> | 62 | <bool>true</bool> |
63 | </property> | 63 | </property> |
64 | <property> | 64 | <property> |
65 | <name>resizeable</name> | 65 | <name>resizeable</name> |
66 | <bool>true</bool> | 66 | <bool>true</bool> |
67 | </property> | 67 | </property> |
68 | </column> | 68 | </column> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>name</name> | 70 | <name>name</name> |
71 | <cstring>registeredServicesList</cstring> | 71 | <cstring>registeredServicesList</cstring> |
72 | </property> | 72 | </property> |
73 | <property stdset="1"> | 73 | <property stdset="1"> |
74 | <name>sizePolicy</name> | 74 | <name>sizePolicy</name> |
75 | <sizepolicy> | 75 | <sizepolicy> |
76 | <hsizetype>7</hsizetype> | 76 | <hsizetype>7</hsizetype> |
77 | <vsizetype>3</vsizetype> | 77 | <vsizetype>3</vsizetype> |
78 | </sizepolicy> | 78 | </sizepolicy> |
79 | </property> | 79 | </property> |
80 | <property stdset="1"> | 80 | <property stdset="1"> |
81 | <name>minimumSize</name> | 81 | <name>minimumSize</name> |
82 | <size> | 82 | <size> |
83 | <width>0</width> | 83 | <width>0</width> |
84 | <height>75</height> | 84 | <height>75</height> |
85 | </size> | 85 | </size> |
86 | </property> | 86 | </property> |
87 | </widget> | 87 | </widget> |
88 | <spacer row="2" column="1" > | 88 | <spacer row="2" column="1" > |
89 | <property> | 89 | <property> |
90 | <name>name</name> | 90 | <name>name</name> |
91 | <cstring>Spacer12</cstring> | 91 | <cstring>Spacer12</cstring> |
92 | </property> | 92 | </property> |
93 | <property stdset="1"> | 93 | <property stdset="1"> |
94 | <name>orientation</name> | 94 | <name>orientation</name> |
95 | <enum>Vertical</enum> | 95 | <enum>Vertical</enum> |
96 | </property> | 96 | </property> |
97 | <property stdset="1"> | 97 | <property stdset="1"> |
98 | <name>sizeType</name> | 98 | <name>sizeType</name> |
99 | <enum>Expanding</enum> | 99 | <enum>Expanding</enum> |
100 | </property> | 100 | </property> |
101 | <property> | 101 | <property> |
102 | <name>sizeHint</name> | 102 | <name>sizeHint</name> |
103 | <size> | 103 | <size> |
104 | <width>20</width> | 104 | <width>20</width> |
105 | <height>20</height> | 105 | <height>20</height> |
106 | </size> | 106 | </size> |
107 | </property> | 107 | </property> |
108 | </spacer> | 108 | </spacer> |
109 | <widget row="1" column="0" rowspan="1" colspan="2" > | 109 | <widget row="1" column="0" rowspan="1" colspan="2" > |
110 | <class>QLabel</class> | 110 | <class>QLabel</class> |
111 | <property stdset="1"> | 111 | <property stdset="1"> |
112 | <name>name</name> | 112 | <name>name</name> |
113 | <cstring>help</cstring> | 113 | <cstring>help</cstring> |
114 | </property> | 114 | </property> |
115 | <property stdset="1"> | 115 | <property stdset="1"> |
116 | <name>sizePolicy</name> | 116 | <name>sizePolicy</name> |
117 | <sizepolicy> | 117 | <sizepolicy> |
118 | <hsizetype>5</hsizetype> | 118 | <hsizetype>5</hsizetype> |
119 | <vsizetype>4</vsizetype> | 119 | <vsizetype>4</vsizetype> |
120 | </sizepolicy> | 120 | </sizepolicy> |
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> |
125 | For 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> |
129 | <set>WordBreak|AlignTop|AlignLeft</set> | 128 | <set>WordBreak|AlignTop|AlignLeft</set> |
130 | </property> | 129 | </property> |
131 | <property> | 130 | <property> |
132 | <name>vAlign</name> | 131 | <name>vAlign</name> |
133 | </property> | 132 | </property> |
134 | <property> | 133 | <property> |
135 | <name>wordwrap</name> | 134 | <name>wordwrap</name> |
136 | </property> | 135 | </property> |
137 | </widget> | 136 | </widget> |
138 | </grid> | 137 | </grid> |
139 | </widget> | 138 | </widget> |
140 | <connections> | 139 | <connections> |
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> |
154 | </UI> | 153 | </UI> |
diff --git a/noncore/settings/networksettings/addconnectionimp.cpp b/noncore/settings/networksettings/addconnectionimp.cpp new file mode 100644 index 0000000..ee7bd97 --- a/dev/null +++ b/noncore/settings/networksettings/addconnectionimp.cpp | |||
@@ -0,0 +1,38 @@ | |||
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 | */ | ||
10 | AddConnectionImp::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 | */ | ||
18 | void 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 | */ | ||
29 | void 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 | |||
8 | class QListViewItem; | ||
9 | |||
10 | class AddConnectionImp : public AddConnection { | ||
11 | |||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0); | ||
16 | void addConnections(QMap<QString, QString> newList); | ||
17 | |||
18 | private slots: | ||
19 | void changed(); | ||
20 | |||
21 | private: | ||
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 | |||
6 | void 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 | |||
8 | class QListViewItem; | ||
9 | |||
10 | class AddServiceImp : public AddService { | ||
11 | |||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | AddServiceImp(QWidget *parent=0, const char *name=0, WFlags f=0):AddService(parent, name, f){}; | ||
16 | void addServices(QList<QString> list); | ||
17 | |||
18 | private: | ||
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 | |||
@@ -1,66 +1,67 @@ | |||
1 | #ifndef INTERFACE_H | 1 | #ifndef INTERFACE_H |
2 | #define INTERFACE_H | 2 | #define INTERFACE_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | class Module; | 6 | class Module; |
7 | |||
7 | class Interface { | 8 | class Interface { |
8 | 9 | ||
9 | public: | 10 | public: |
10 | Interface(QString name = "unknown", bool status = false); | 11 | Interface(QString name = "unknown", bool status = false); |
11 | virtual ~Interface(){}; | 12 | virtual ~Interface(){}; |
12 | 13 | ||
13 | virtual bool getStatus(){ return status; }; | 14 | virtual bool getStatus(){ return status; }; |
14 | virtual void setStatus(bool newSatus){ status = newSatus; refresh(); }; | 15 | virtual void setStatus(bool newSatus){ status = newSatus; refresh(); }; |
15 | 16 | ||
16 | virtual bool isAttached(){ return attached; }; | 17 | virtual bool isAttached(){ return attached; }; |
17 | virtual void setAttached(bool isAttached=false){ attached = isAttached; }; | 18 | virtual void setAttached(bool isAttached=false){ attached = isAttached; }; |
18 | 19 | ||
19 | virtual QString getInterfaceName(){ return interfaceName; }; | 20 | virtual QString getInterfaceName(){ return interfaceName; }; |
20 | virtual void setInterfaceName(QString name="unknown"){ interfaceName = name; }; | 21 | virtual void setInterfaceName(QString name="unknown"){ interfaceName = name; }; |
21 | 22 | ||
22 | virtual QString getHardwareName(){ return hardareName; }; | 23 | virtual QString getHardwareName(){ return hardareName; }; |
23 | virtual void setHardwareName(QString name="Unknown"){ hardareName = name; }; | 24 | virtual void setHardwareName(QString name="Unknown"){ hardareName = name; }; |
24 | 25 | ||
25 | virtual Module* getModuleOwner(){ return moduleOwner; }; | 26 | virtual Module* getModuleOwner(){ return moduleOwner; }; |
26 | virtual void setModuleOwner(Module *owner=NULL){ moduleOwner = owner; }; | 27 | virtual void setModuleOwner(Module *owner=NULL){ moduleOwner = owner; }; |
27 | 28 | ||
28 | // inet information. | 29 | // inet information. |
29 | QString getMacAddress(){ return macAddress; }; | 30 | QString getMacAddress(){ return macAddress; }; |
30 | QString getIp(){ return ip; }; | 31 | QString getIp(){ return ip; }; |
31 | QString getSubnetMask(){ return subnetMask; }; | 32 | QString getSubnetMask(){ return subnetMask; }; |
32 | QString getBroadcast(){ return broadcast; }; | 33 | QString getBroadcast(){ return broadcast; }; |
33 | bool isDhcp(){ return dhcp; }; | 34 | bool isDhcp(){ return dhcp; }; |
34 | QString getDhcpServerIp(){ return dhcpServerIp; }; | 35 | QString getDhcpServerIp(){ return dhcpServerIp; }; |
35 | QString getLeaseObtained(){ return leaseObtained; }; | 36 | QString getLeaseObtained(){ return leaseObtained; }; |
36 | QString getLeaseExpires(){ return leaseExpires; }; | 37 | QString getLeaseExpires(){ return leaseExpires; }; |
37 | 38 | ||
38 | bool refresh(); | 39 | bool refresh(); |
39 | bool start(); | 40 | bool start(); |
40 | bool stop(); | 41 | bool stop(); |
41 | bool restart(); | 42 | bool restart(); |
42 | 43 | ||
43 | private: | 44 | private: |
44 | // Interface information | 45 | // Interface information |
45 | bool status; | 46 | bool status; |
46 | bool attached; | 47 | bool attached; |
47 | QString interfaceName; | 48 | QString interfaceName; |
48 | QString hardareName; | 49 | QString hardareName; |
49 | Module *moduleOwner; | 50 | Module *moduleOwner; |
50 | 51 | ||
51 | // Network information | 52 | // Network information |
52 | QString macAddress; | 53 | QString macAddress; |
53 | QString ip; | 54 | QString ip; |
54 | QString broadcast; | 55 | QString broadcast; |
55 | QString subnetMask; | 56 | QString subnetMask; |
56 | bool dhcp; | 57 | bool dhcp; |
57 | QString dhcpServerIp; | 58 | QString dhcpServerIp; |
58 | QString leaseObtained; | 59 | QString leaseObtained; |
59 | QString leaseExpires; | 60 | QString leaseExpires; |
60 | 61 | ||
61 | }; | 62 | }; |
62 | 63 | ||
63 | #endif | 64 | #endif |
64 | 65 | ||
65 | // interface.h | 66 | // interface.h |
66 | 67 | ||
diff --git a/noncore/settings/networksettings/interfacesetupimp.cpp b/noncore/settings/networksettings/interfacesetupimp.cpp index 6a8449d..951aeee 100644 --- a/noncore/settings/networksettings/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfacesetupimp.cpp | |||
@@ -1,147 +1,146 @@ | |||
1 | #include "interfacesetupimp.h" | 1 | #include "interfacesetupimp.h" |
2 | #include "interface.h" | 2 | #include "interface.h" |
3 | #include "interfaces.h" | 3 | #include "interfaces.h" |
4 | 4 | ||
5 | #include <qcombobox.h> | 5 | #include <qcombobox.h> |
6 | #include <qcheckbox.h> | 6 | #include <qcheckbox.h> |
7 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | #include <qspinbox.h> | 8 | #include <qspinbox.h> |
9 | #include <qgroupbox.h> | 9 | #include <qgroupbox.h> |
10 | #include <qlabel.h> | 10 | #include <qlabel.h> |
11 | 11 | ||
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
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 | /** |
20 | * Constuctor. Set up the connection and load the first profile. | 19 | * Constuctor. Set up the connection and load the first profile. |
21 | */ | 20 | */ |
22 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){ | 21 | InterfaceSetupImp::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){ |
29 | staticGroupBox->hide(); | 28 | staticGroupBox->hide(); |
30 | dhcpCheckBox->hide(); | 29 | dhcpCheckBox->hide(); |
31 | leaseTime->hide(); | 30 | leaseTime->hide(); |
32 | leaseHoursLabel->hide(); | 31 | leaseHoursLabel->hide(); |
33 | } | 32 | } |
34 | connect(profileCombo, SIGNAL(highlighted(const QString &)), this, SLOT(changeProfile(const QString &))); | 33 | connect(profileCombo, SIGNAL(highlighted(const QString &)), this, SLOT(changeProfile(const QString &))); |
35 | } | 34 | } |
36 | 35 | ||
37 | /** | 36 | /** |
38 | * Save the current settings, then write out the interfaces file and close. | 37 | * Save the current settings, then write out the interfaces file and close. |
39 | */ | 38 | */ |
40 | void InterfaceSetupImp::accept(){ | 39 | void InterfaceSetupImp::accept(){ |
41 | if(!saveSettings()) | 40 | if(!saveSettings()) |
42 | return; | 41 | return; |
43 | interfaces->write(); | 42 | interfaces->write(); |
44 | close(true); | 43 | close(true); |
45 | } | 44 | } |
46 | 45 | ||
47 | /** | 46 | /** |
48 | * Save the settings for the current Interface. | 47 | * Save the settings for the current Interface. |
49 | * @return bool true if successfull, false otherwise | 48 | * @return bool true if successfull, false otherwise |
50 | */ | 49 | */ |
51 | bool InterfaceSetupImp::saveSettings(){ | 50 | bool InterfaceSetupImp::saveSettings(){ |
52 | // eh can't really do anything about it other then return. :-D | 51 | // eh can't really do anything about it other then return. :-D |
53 | if(!interfaces->isInterfaceSet()) | 52 | if(!interfaces->isInterfaceSet()) |
54 | return true; | 53 | return true; |
55 | 54 | ||
56 | bool error = false; | 55 | bool error = false; |
57 | // Loopback case | 56 | // Loopback case |
58 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 57 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
59 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 58 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
60 | return true; | 59 | return true; |
61 | } | 60 | } |
62 | 61 | ||
63 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){ | 62 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){ |
64 | QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok"); | 63 | QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok"); |
65 | return false; | 64 | return false; |
66 | } | 65 | } |
67 | interfaces->removeAllInterfaceOptions(); | 66 | interfaces->removeAllInterfaceOptions(); |
68 | 67 | ||
69 | // DHCP | 68 | // DHCP |
70 | if(dhcpCheckBox->isChecked()){ | 69 | if(dhcpCheckBox->isChecked()){ |
71 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); | 70 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); |
72 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); | 71 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); |
73 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); | 72 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); |
74 | } | 73 | } |
75 | else{ | 74 | else{ |
76 | interfaces->setInterfaceMethod("static"); | 75 | interfaces->setInterfaceMethod("static"); |
77 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); | 76 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); |
78 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); | 77 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); |
79 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); | 78 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); |
80 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); | 79 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); |
81 | interfaces->setInterfaceOption("up "DNSSCRIPT" add ", dns); | 80 | interfaces->setInterfaceOption("up "DNSSCRIPT" add ", dns); |
82 | interfaces->setInterfaceOption("down "DNSSCRIPT" remove ", dns); | 81 | interfaces->setInterfaceOption("down "DNSSCRIPT" remove ", dns); |
83 | } | 82 | } |
84 | 83 | ||
85 | // IP Information | 84 | // IP Information |
86 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 85 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
87 | return true; | 86 | return true; |
88 | } | 87 | } |
89 | 88 | ||
90 | /** | 89 | /** |
91 | * The Profile has changed. | 90 | * The Profile has changed. |
92 | * @profile the new profile. | 91 | * @profile the new profile. |
93 | */ | 92 | */ |
94 | void InterfaceSetupImp::changeProfile(const QString &profile){ | 93 | void InterfaceSetupImp::changeProfile(const QString &profile){ |
95 | QString newInterfaceName; | 94 | QString newInterfaceName; |
96 | if(profile.lower() == "all") | 95 | if(profile.lower() == "all") |
97 | newInterfaceName = interface->getInterfaceName(); | 96 | newInterfaceName = interface->getInterfaceName(); |
98 | else | 97 | else |
99 | newInterfaceName = interface->getInterfaceName() + "_" + profile; | 98 | newInterfaceName = interface->getInterfaceName() + "_" + profile; |
100 | if(newInterfaceName == currentInterfaceName) | 99 | if(newInterfaceName == currentInterfaceName) |
101 | return; | 100 | return; |
102 | else{ | 101 | else{ |
103 | saveSettings(); | 102 | saveSettings(); |
104 | currentInterfaceName = newInterfaceName; | 103 | currentInterfaceName = newInterfaceName; |
105 | } | 104 | } |
106 | bool error = interfaces->setInterface(currentInterfaceName); | 105 | bool error = interfaces->setInterface(currentInterfaceName); |
107 | 106 | ||
108 | // See if we have to make a interface. | 107 | // See if we have to make a interface. |
109 | if(error){ | 108 | if(error){ |
110 | qDebug("InterfaceSetupImp: Adding a new interface from profile change."); | 109 | qDebug("InterfaceSetupImp: Adding a new interface from profile change."); |
111 | interfaces->addInterface(currentInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); | 110 | interfaces->addInterface(currentInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); |
112 | error = interfaces->setInterface(currentInterfaceName); | 111 | error = interfaces->setInterface(currentInterfaceName); |
113 | if(error){ | 112 | if(error){ |
114 | qDebug("InterfaceSetupImp: Added interface, but still can't set."); | 113 | qDebug("InterfaceSetupImp: Added interface, but still can't set."); |
115 | return; | 114 | return; |
116 | } | 115 | } |
117 | } | 116 | } |
118 | 117 | ||
119 | //qDebug( currentInterfaceName.latin1() ); | 118 | //qDebug( currentInterfaceName.latin1() ); |
120 | // We must have a valid interface to get this far so read some settings. | 119 | // We must have a valid interface to get this far so read some settings. |
121 | 120 | ||
122 | // DHCP | 121 | // DHCP |
123 | if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) | 122 | if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) |
124 | dhcpCheckBox->setChecked(true); | 123 | dhcpCheckBox->setChecked(true); |
125 | else | 124 | else |
126 | dhcpCheckBox->setChecked(false); | 125 | dhcpCheckBox->setChecked(false); |
127 | leaseTime->setValue(interfaces->getInterfaceOption("leasehours", error).toInt()); | 126 | leaseTime->setValue(interfaces->getInterfaceOption("leasehours", error).toInt()); |
128 | if(error) | 127 | if(error) |
129 | leaseTime->setValue(interfaces->getInterfaceOption("leasetime", error).toInt()/60/60); | 128 | leaseTime->setValue(interfaces->getInterfaceOption("leasetime", error).toInt()/60/60); |
130 | if(error) | 129 | if(error) |
131 | leaseTime->setValue(24); | 130 | leaseTime->setValue(24); |
132 | 131 | ||
133 | // IP Information | 132 | // IP Information |
134 | autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); | 133 | autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); |
135 | QString dns = interfaces->getInterfaceOption("up interfacednsscript add", error); | 134 | QString dns = interfaces->getInterfaceOption("up interfacednsscript add", error); |
136 | if(dns.contains(" ")){ | 135 | if(dns.contains(" ")){ |
137 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); | 136 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); |
138 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); | 137 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); |
139 | } | 138 | } |
140 | ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); | 139 | ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); |
141 | subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); | 140 | subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); |
142 | gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); | 141 | gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); |
143 | } | 142 | } |
144 | 143 | ||
145 | 144 | ||
146 | // interfacesetup.cpp | 145 | // interfacesetup.cpp |
147 | 146 | ||
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 | |||
@@ -1,358 +1,358 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>MainWindow</class> | 2 | <class>MainWindow</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>MainWindow</cstring> | 7 | <cstring>MainWindow</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>217</width> | 14 | <width>217</width> |
15 | <height>289</height> | 15 | <height>289</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>Network Setup</string> | 20 | <string>Network Setup</string> |
21 | </property> | 21 | </property> |
22 | <vbox> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>0</number> | 25 | <number>0</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget> | 31 | <widget> |
32 | <class>QTabWidget</class> | 32 | <class>QTabWidget</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>tabWidget</cstring> | 35 | <cstring>tabWidget</cstring> |
36 | </property> | 36 | </property> |
37 | <property> | 37 | <property> |
38 | <name>layoutMargin</name> | 38 | <name>layoutMargin</name> |
39 | </property> | 39 | </property> |
40 | <widget> | 40 | <widget> |
41 | <class>QWidget</class> | 41 | <class>QWidget</class> |
42 | <property stdset="1"> | 42 | <property stdset="1"> |
43 | <name>name</name> | 43 | <name>name</name> |
44 | <cstring>Widget3</cstring> | 44 | <cstring>Widget3</cstring> |
45 | </property> | 45 | </property> |
46 | <attribute> | 46 | <attribute> |
47 | <name>title</name> | 47 | <name>title</name> |
48 | <string>Interfaces</string> | 48 | <string>Interfaces</string> |
49 | </attribute> | 49 | </attribute> |
50 | <vbox> | 50 | <vbox> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>margin</name> | 52 | <name>margin</name> |
53 | <number>0</number> | 53 | <number>0</number> |
54 | </property> | 54 | </property> |
55 | <property stdset="1"> | 55 | <property stdset="1"> |
56 | <name>spacing</name> | 56 | <name>spacing</name> |
57 | <number>6</number> | 57 | <number>6</number> |
58 | </property> | 58 | </property> |
59 | <widget> | 59 | <widget> |
60 | <class>QListView</class> | 60 | <class>QListView</class> |
61 | <column> | 61 | <column> |
62 | <property> | 62 | <property> |
63 | <name>text</name> | 63 | <name>text</name> |
64 | <string>i</string> | 64 | <string>i</string> |
65 | </property> | 65 | </property> |
66 | <property> | 66 | <property> |
67 | <name>clickable</name> | 67 | <name>clickable</name> |
68 | <bool>true</bool> | 68 | <bool>true</bool> |
69 | </property> | 69 | </property> |
70 | <property> | 70 | <property> |
71 | <name>resizeable</name> | 71 | <name>resizeable</name> |
72 | <bool>true</bool> | 72 | <bool>true</bool> |
73 | </property> | 73 | </property> |
74 | </column> | 74 | </column> |
75 | <column> | 75 | <column> |
76 | <property> | 76 | <property> |
77 | <name>text</name> | 77 | <name>text</name> |
78 | <string>t</string> | 78 | <string>t</string> |
79 | </property> | 79 | </property> |
80 | <property> | 80 | <property> |
81 | <name>clickable</name> | 81 | <name>clickable</name> |
82 | <bool>true</bool> | 82 | <bool>true</bool> |
83 | </property> | 83 | </property> |
84 | <property> | 84 | <property> |
85 | <name>resizeable</name> | 85 | <name>resizeable</name> |
86 | <bool>true</bool> | 86 | <bool>true</bool> |
87 | </property> | 87 | </property> |
88 | </column> | 88 | </column> |
89 | <column> | 89 | <column> |
90 | <property> | 90 | <property> |
91 | <name>text</name> | 91 | <name>text</name> |
92 | <string>Name</string> | 92 | <string>Name</string> |
93 | </property> | 93 | </property> |
94 | <property> | 94 | <property> |
95 | <name>clickable</name> | 95 | <name>clickable</name> |
96 | <bool>true</bool> | 96 | <bool>true</bool> |
97 | </property> | 97 | </property> |
98 | <property> | 98 | <property> |
99 | <name>resizeable</name> | 99 | <name>resizeable</name> |
100 | <bool>true</bool> | 100 | <bool>true</bool> |
101 | </property> | 101 | </property> |
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> |
109 | <bool>true</bool> | 109 | <bool>true</bool> |
110 | </property> | 110 | </property> |
111 | </widget> | 111 | </widget> |
112 | <widget> | 112 | <widget> |
113 | <class>QLayoutWidget</class> | 113 | <class>QLayoutWidget</class> |
114 | <property stdset="1"> | 114 | <property stdset="1"> |
115 | <name>name</name> | 115 | <name>name</name> |
116 | <cstring>Layout2</cstring> | 116 | <cstring>Layout2</cstring> |
117 | </property> | 117 | </property> |
118 | <property> | 118 | <property> |
119 | <name>layoutMargin</name> | 119 | <name>layoutMargin</name> |
120 | </property> | 120 | </property> |
121 | <grid> | 121 | <grid> |
122 | <property stdset="1"> | 122 | <property stdset="1"> |
123 | <name>margin</name> | 123 | <name>margin</name> |
124 | <number>5</number> | 124 | <number>5</number> |
125 | </property> | 125 | </property> |
126 | <property stdset="1"> | 126 | <property stdset="1"> |
127 | <name>spacing</name> | 127 | <name>spacing</name> |
128 | <number>6</number> | 128 | <number>6</number> |
129 | </property> | 129 | </property> |
130 | <widget row="1" column="0" > | 130 | <widget row="1" column="0" > |
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> |
138 | <string>&Add</string> | 138 | <string>&Add</string> |
139 | </property> | 139 | </property> |
140 | </widget> | 140 | </widget> |
141 | <widget row="0" column="0" > | 141 | <widget row="0" column="0" > |
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> |
149 | <string>&Information</string> | 149 | <string>&Information</string> |
150 | </property> | 150 | </property> |
151 | </widget> | 151 | </widget> |
152 | <widget row="0" column="1" > | 152 | <widget row="0" column="1" > |
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> |
160 | <string>&Configure</string> | 160 | <string>&Configure</string> |
161 | </property> | 161 | </property> |
162 | </widget> | 162 | </widget> |
163 | <widget row="1" column="1" > | 163 | <widget row="1" column="1" > |
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> |
171 | <string>&Remove</string> | 171 | <string>&Remove</string> |
172 | </property> | 172 | </property> |
173 | </widget> | 173 | </widget> |
174 | </grid> | 174 | </grid> |
175 | </widget> | 175 | </widget> |
176 | </vbox> | 176 | </vbox> |
177 | </widget> | 177 | </widget> |
178 | <widget> | 178 | <widget> |
179 | <class>QWidget</class> | 179 | <class>QWidget</class> |
180 | <property stdset="1"> | 180 | <property stdset="1"> |
181 | <name>name</name> | 181 | <name>name</name> |
182 | <cstring>tab</cstring> | 182 | <cstring>tab</cstring> |
183 | </property> | 183 | </property> |
184 | <attribute> | 184 | <attribute> |
185 | <name>title</name> | 185 | <name>title</name> |
186 | <string>Profiles</string> | 186 | <string>Profiles</string> |
187 | </attribute> | 187 | </attribute> |
188 | <grid> | 188 | <grid> |
189 | <property stdset="1"> | 189 | <property stdset="1"> |
190 | <name>margin</name> | 190 | <name>margin</name> |
191 | <number>11</number> | 191 | <number>11</number> |
192 | </property> | 192 | </property> |
193 | <property stdset="1"> | 193 | <property stdset="1"> |
194 | <name>spacing</name> | 194 | <name>spacing</name> |
195 | <number>6</number> | 195 | <number>6</number> |
196 | </property> | 196 | </property> |
197 | <widget row="1" column="0" rowspan="1" colspan="3" > | 197 | <widget row="1" column="0" rowspan="1" colspan="3" > |
198 | <class>Line</class> | 198 | <class>Line</class> |
199 | <property stdset="1"> | 199 | <property stdset="1"> |
200 | <name>name</name> | 200 | <name>name</name> |
201 | <cstring>Line1</cstring> | 201 | <cstring>Line1</cstring> |
202 | </property> | 202 | </property> |
203 | <property stdset="1"> | 203 | <property stdset="1"> |
204 | <name>orientation</name> | 204 | <name>orientation</name> |
205 | <enum>Horizontal</enum> | 205 | <enum>Horizontal</enum> |
206 | </property> | 206 | </property> |
207 | </widget> | 207 | </widget> |
208 | <widget row="0" column="0" > | 208 | <widget row="0" column="0" > |
209 | <class>QLabel</class> | 209 | <class>QLabel</class> |
210 | <property stdset="1"> | 210 | <property stdset="1"> |
211 | <name>name</name> | 211 | <name>name</name> |
212 | <cstring>TextLabel1</cstring> | 212 | <cstring>TextLabel1</cstring> |
213 | </property> | 213 | </property> |
214 | <property stdset="1"> | 214 | <property stdset="1"> |
215 | <name>text</name> | 215 | <name>text</name> |
216 | <string>Current Profile</string> | 216 | <string>Current Profile</string> |
217 | </property> | 217 | </property> |
218 | </widget> | 218 | </widget> |
219 | <widget row="0" column="1" > | 219 | <widget row="0" column="1" > |
220 | <class>QLabel</class> | 220 | <class>QLabel</class> |
221 | <property stdset="1"> | 221 | <property stdset="1"> |
222 | <name>name</name> | 222 | <name>name</name> |
223 | <cstring>currentProfileLabel</cstring> | 223 | <cstring>currentProfileLabel</cstring> |
224 | </property> | 224 | </property> |
225 | <property stdset="1"> | 225 | <property stdset="1"> |
226 | <name>frameShape</name> | 226 | <name>frameShape</name> |
227 | <enum>Panel</enum> | 227 | <enum>Panel</enum> |
228 | </property> | 228 | </property> |
229 | <property stdset="1"> | 229 | <property stdset="1"> |
230 | <name>frameShadow</name> | 230 | <name>frameShadow</name> |
231 | <enum>Sunken</enum> | 231 | <enum>Sunken</enum> |
232 | </property> | 232 | </property> |
233 | <property stdset="1"> | 233 | <property stdset="1"> |
234 | <name>text</name> | 234 | <name>text</name> |
235 | <string>All</string> | 235 | <string>All</string> |
236 | </property> | 236 | </property> |
237 | </widget> | 237 | </widget> |
238 | <spacer row="0" column="2" > | 238 | <spacer row="0" column="2" > |
239 | <property> | 239 | <property> |
240 | <name>name</name> | 240 | <name>name</name> |
241 | <cstring>Spacer2</cstring> | 241 | <cstring>Spacer2</cstring> |
242 | </property> | 242 | </property> |
243 | <property stdset="1"> | 243 | <property stdset="1"> |
244 | <name>orientation</name> | 244 | <name>orientation</name> |
245 | <enum>Horizontal</enum> | 245 | <enum>Horizontal</enum> |
246 | </property> | 246 | </property> |
247 | <property stdset="1"> | 247 | <property stdset="1"> |
248 | <name>sizeType</name> | 248 | <name>sizeType</name> |
249 | <enum>Expanding</enum> | 249 | <enum>Expanding</enum> |
250 | </property> | 250 | </property> |
251 | <property> | 251 | <property> |
252 | <name>sizeHint</name> | 252 | <name>sizeHint</name> |
253 | <size> | 253 | <size> |
254 | <width>20</width> | 254 | <width>20</width> |
255 | <height>20</height> | 255 | <height>20</height> |
256 | </size> | 256 | </size> |
257 | </property> | 257 | </property> |
258 | </spacer> | 258 | </spacer> |
259 | <spacer row="6" column="2" > | 259 | <spacer row="6" column="2" > |
260 | <property> | 260 | <property> |
261 | <name>name</name> | 261 | <name>name</name> |
262 | <cstring>Spacer16</cstring> | 262 | <cstring>Spacer16</cstring> |
263 | </property> | 263 | </property> |
264 | <property stdset="1"> | 264 | <property stdset="1"> |
265 | <name>orientation</name> | 265 | <name>orientation</name> |
266 | <enum>Vertical</enum> | 266 | <enum>Vertical</enum> |
267 | </property> | 267 | </property> |
268 | <property stdset="1"> | 268 | <property stdset="1"> |
269 | <name>sizeType</name> | 269 | <name>sizeType</name> |
270 | <enum>Expanding</enum> | 270 | <enum>Expanding</enum> |
271 | </property> | 271 | </property> |
272 | <property> | 272 | <property> |
273 | <name>sizeHint</name> | 273 | <name>sizeHint</name> |
274 | <size> | 274 | <size> |
275 | <width>20</width> | 275 | <width>20</width> |
276 | <height>20</height> | 276 | <height>20</height> |
277 | </size> | 277 | </size> |
278 | </property> | 278 | </property> |
279 | </spacer> | 279 | </spacer> |
280 | <widget row="5" column="2" > | 280 | <widget row="5" column="2" > |
281 | <class>QPushButton</class> | 281 | <class>QPushButton</class> |
282 | <property stdset="1"> | 282 | <property stdset="1"> |
283 | <name>name</name> | 283 | <name>name</name> |
284 | <cstring>PushButton7</cstring> | 284 | <cstring>PushButton7</cstring> |
285 | </property> | 285 | </property> |
286 | <property stdset="1"> | 286 | <property stdset="1"> |
287 | <name>text</name> | 287 | <name>text</name> |
288 | <string>&Set Current</string> | 288 | <string>&Set Current</string> |
289 | </property> | 289 | </property> |
290 | </widget> | 290 | </widget> |
291 | <widget row="4" column="2" > | 291 | <widget row="4" column="2" > |
292 | <class>QPushButton</class> | 292 | <class>QPushButton</class> |
293 | <property stdset="1"> | 293 | <property stdset="1"> |
294 | <name>name</name> | 294 | <name>name</name> |
295 | <cstring>removeProfileButton</cstring> | 295 | <cstring>removeProfileButton</cstring> |
296 | </property> | 296 | </property> |
297 | <property stdset="1"> | 297 | <property stdset="1"> |
298 | <name>text</name> | 298 | <name>text</name> |
299 | <string>&Remove</string> | 299 | <string>&Remove</string> |
300 | </property> | 300 | </property> |
301 | </widget> | 301 | </widget> |
302 | <widget row="3" column="2" > | 302 | <widget row="3" column="2" > |
303 | <class>QPushButton</class> | 303 | <class>QPushButton</class> |
304 | <property stdset="1"> | 304 | <property stdset="1"> |
305 | <name>name</name> | 305 | <name>name</name> |
306 | <cstring>newProfileButton</cstring> | 306 | <cstring>newProfileButton</cstring> |
307 | </property> | 307 | </property> |
308 | <property stdset="1"> | 308 | <property stdset="1"> |
309 | <name>text</name> | 309 | <name>text</name> |
310 | <string>&New</string> | 310 | <string>&New</string> |
311 | </property> | 311 | </property> |
312 | </widget> | 312 | </widget> |
313 | <widget row="2" column="0" > | 313 | <widget row="2" column="0" > |
314 | <class>QLabel</class> | 314 | <class>QLabel</class> |
315 | <property stdset="1"> | 315 | <property stdset="1"> |
316 | <name>name</name> | 316 | <name>name</name> |
317 | <cstring>TextLabel1_2</cstring> | 317 | <cstring>TextLabel1_2</cstring> |
318 | </property> | 318 | </property> |
319 | <property stdset="1"> | 319 | <property stdset="1"> |
320 | <name>text</name> | 320 | <name>text</name> |
321 | <string>Profiles</string> | 321 | <string>Profiles</string> |
322 | </property> | 322 | </property> |
323 | </widget> | 323 | </widget> |
324 | <widget row="3" column="0" rowspan="3" colspan="2" > | 324 | <widget row="3" column="0" rowspan="3" colspan="2" > |
325 | <class>QListBox</class> | 325 | <class>QListBox</class> |
326 | <property stdset="1"> | 326 | <property stdset="1"> |
327 | <name>name</name> | 327 | <name>name</name> |
328 | <cstring>profilesList</cstring> | 328 | <cstring>profilesList</cstring> |
329 | </property> | 329 | </property> |
330 | </widget> | 330 | </widget> |
331 | </grid> | 331 | </grid> |
332 | </widget> | 332 | </widget> |
333 | </widget> | 333 | </widget> |
334 | </vbox> | 334 | </vbox> |
335 | </widget> | 335 | </widget> |
336 | <customwidgets> | 336 | <customwidgets> |
337 | <customwidget> | 337 | <customwidget> |
338 | <class>QWidget</class> | 338 | <class>QWidget</class> |
339 | <header location="local">qwidget.h</header> | 339 | <header location="local">qwidget.h</header> |
340 | <sizehint> | 340 | <sizehint> |
341 | <width>100</width> | 341 | <width>100</width> |
342 | <height>100</height> | 342 | <height>100</height> |
343 | </sizehint> | 343 | </sizehint> |
344 | <container>0</container> | 344 | <container>0</container> |
345 | <sizepolicy> | 345 | <sizepolicy> |
346 | <hordata>7</hordata> | 346 | <hordata>7</hordata> |
347 | <verdata>7</verdata> | 347 | <verdata>7</verdata> |
348 | </sizepolicy> | 348 | </sizepolicy> |
349 | <pixmap>image0</pixmap> | 349 | <pixmap>image0</pixmap> |
350 | </customwidget> | 350 | </customwidget> |
351 | </customwidgets> | 351 | </customwidgets> |
352 | <images> | 352 | <images> |
353 | <image> | 353 | <image> |
354 | <name>image0</name> | 354 | <name>image0</name> |
355 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | 355 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> |
356 | </image> | 356 | </image> |
357 | </images> | 357 | </images> |
358 | </UI> | 358 | </UI> |
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 89dac6f..66ec8b5 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -1,396 +1,403 @@ | |||
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> |
11 | #include <qlistbox.h> | 11 | #include <qlistbox.h> |
12 | #include <qlistview.h> | 12 | #include <qlistview.h> |
13 | #include <qheader.h> | 13 | #include <qheader.h> |
14 | #include <qlabel.h> | 14 | #include <qlabel.h> |
15 | 15 | ||
16 | #include <qmainwindow.h> | 16 | #include <qmainwindow.h> |
17 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | #include <qpe/qlibrary.h> | 20 | #include <qpe/qlibrary.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | 22 | ||
23 | #include <qlist.h> | 23 | #include <qlist.h> |
24 | #include <qdir.h> | 24 | #include <qdir.h> |
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 | ||
34 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) { | 31 | MainWindowImp::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 | */ |
71 | MainWindowImp::~MainWindowImp(){ | 57 | MainWindowImp::~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 | */ | ||
78 | void MainWindowImp::loadModules(QString path){ | 76 | void 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 | } |
97 | } | 93 | } |
98 | 94 | ||
99 | /** | 95 | /** |
100 | * Attempt to load a function and resolve a function. | 96 | * Attempt to load a function and resolve a function. |
101 | * @param pluginFileName - the name of the file in which to attempt to load | 97 | * @param pluginFileName - the name of the file in which to attempt to load |
102 | * @param resolveString - function pointer to resolve | 98 | * @param resolveString - function pointer to resolve |
103 | * @return pointer to the function with name resolveString or NULL | 99 | * @return pointer to the function with name resolveString or NULL |
104 | */ | 100 | */ |
105 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ | 101 | Module* 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 ){ |
110 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 106 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); |
111 | delete lib; | 107 | delete lib; |
112 | return NULL; | 108 | return NULL; |
113 | } | 109 | } |
114 | 110 | ||
115 | // Try to get an object. | 111 | // Try to get an object. |
116 | Module *object = ((Module* (*)()) functionPointer)(); | 112 | Module *object = ((Module* (*)()) functionPointer)(); |
117 | if(object == NULL){ | 113 | if(object == NULL){ |
118 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 114 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
119 | delete lib; | 115 | delete lib; |
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 | } |
127 | 123 | ||
128 | /** | 124 | /** |
129 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 125 | * The Add button was clicked. Bring up the add dialog and if OK is hit |
130 | * load the plugin and append it to the list | 126 | * load the plugin and append it to the list |
131 | */ | 127 | */ |
132 | void MainWindowImp::addClicked(){ | 128 | void 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 | /** |
144 | * Prompt the user to see if they really want to do this. | 151 | * Prompt the user to see if they really want to do this. |
145 | * If they do then remove from the list and unload. | 152 | * If they do then remove from the list and unload. |
146 | */ | 153 | */ |
147 | void MainWindowImp::removeClicked(){ | 154 | void 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; |
152 | } | 159 | } |
153 | 160 | ||
154 | if((interfaceItems[item])->getModuleOwner() == NULL){ | 161 | if((interfaceItems[item])->getModuleOwner() == NULL){ |
155 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); | 162 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); |
156 | } | 163 | } |
157 | else{ | 164 | else{ |
158 | // Try to remove. | 165 | // Try to remove. |
159 | } | 166 | } |
160 | 167 | ||
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 | */ |
167 | void MainWindowImp::configureClicked(){ | 176 | void 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 | */ |
204 | void MainWindowImp::informationClicked(){ | 209 | void 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 | /** |
237 | * Aquire the list of active interfaces from ifconfig | 237 | * Aquire the list of active interfaces from ifconfig |
238 | * Call ifconfig and ifconfig -a | 238 | * Call ifconfig and ifconfig -a |
239 | */ | 239 | */ |
240 | void MainWindowImp::getInterfaceList(){ | 240 | void MainWindowImp::getInterfaceList(){ |
241 | KShellProcess *processAll = new KShellProcess(); | 241 | KShellProcess *processAll = new KShellProcess(); |
242 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; | 242 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; |
243 | connect(processAll, SIGNAL(processExited(KProcess *)), | 243 | connect(processAll, SIGNAL(processExited(KProcess *)), |
244 | this, SLOT(jobDone(KProcess *))); | 244 | this, SLOT(jobDone(KProcess *))); |
245 | threads.insert(processAll, TEMP_ALL); | 245 | threads.insert(processAll, TEMP_ALL); |
246 | processAll->start(KShellProcess::NotifyOnExit); | 246 | processAll->start(KShellProcess::NotifyOnExit); |
247 | 247 | ||
248 | KShellProcess *process = new KShellProcess(); | 248 | KShellProcess *process = new KShellProcess(); |
249 | *process << "/sbin/ifconfig" << " > " TEMP_UP; | 249 | *process << "/sbin/ifconfig" << " > " TEMP_UP; |
250 | connect(process, SIGNAL(processExited(KProcess *)), | 250 | connect(process, SIGNAL(processExited(KProcess *)), |
251 | this, SLOT(jobDone(KProcess *))); | 251 | this, SLOT(jobDone(KProcess *))); |
252 | threads.insert(process, TEMP_UP); | 252 | threads.insert(process, TEMP_UP); |
253 | process->start(KShellProcess::NotifyOnExit); | 253 | process->start(KShellProcess::NotifyOnExit); |
254 | } | 254 | } |
255 | 255 | ||
256 | void MainWindowImp::jobDone(KProcess *process){ | 256 | void MainWindowImp::jobDone(KProcess *process){ |
257 | QString fileName = threads[process]; | 257 | QString fileName = threads[process]; |
258 | threads.remove(process); | 258 | threads.remove(process); |
259 | delete process; | 259 | delete process; |
260 | 260 | ||
261 | QFile file(fileName); | 261 | QFile file(fileName); |
262 | if (!file.open(IO_ReadOnly)){ | 262 | if (!file.open(IO_ReadOnly)){ |
263 | qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1()); | 263 | qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1()); |
264 | return; | 264 | return; |
265 | } | 265 | } |
266 | 266 | ||
267 | QTextStream stream( &file ); | 267 | QTextStream stream( &file ); |
268 | QString line; | 268 | QString line; |
269 | while ( !stream.eof() ) { | 269 | while ( !stream.eof() ) { |
270 | line = stream.readLine(); | 270 | line = stream.readLine(); |
271 | int space = line.find(" "); | 271 | int space = line.find(" "); |
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()){ |
278 | if(fileName == TEMP_ALL) | 282 | if(fileName == TEMP_ALL) |
279 | i = new Interface(interfaceName, false); | 283 | i = new Interface(interfaceName, false); |
280 | else | 284 | else |
281 | i = new Interface(interfaceName, true); | 285 | i = new Interface(interfaceName, true); |
282 | } | 286 | } |
283 | else{ | 287 | else{ |
284 | i = interfaceNames[interfaceName]; | 288 | i = interfaceNames[interfaceName]; |
285 | if(fileName != TEMP_ALL) | 289 | if(fileName != TEMP_ALL) |
286 | i->setStatus(true); | 290 | i->setStatus(true); |
287 | } | 291 | } |
288 | 292 | ||
289 | i->setAttached(true); | 293 | i->setAttached(true); |
290 | i->setInterfaceName(interfaceName); | 294 | i->setInterfaceName(interfaceName); |
291 | 295 | ||
292 | QString hardName = "Ethernet"; | 296 | QString hardName = "Ethernet"; |
293 | int hardwareName = line.find("Link encap:"); | 297 | int hardwareName = line.find("Link encap:"); |
294 | int macAddress = line.find("HWaddr"); | 298 | int macAddress = line.find("HWaddr"); |
295 | if(macAddress == -1) | 299 | if(macAddress == -1) |
296 | macAddress = line.length(); | 300 | macAddress = line.length(); |
297 | if(hardwareName != -1) | 301 | if(hardwareName != -1) |
298 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); | 302 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); |
299 | // We have found an interface | 303 | // We have found an interface |
300 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); | 304 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); |
301 | interfaceNames.insert(i->getInterfaceName(), i); | 305 | interfaceNames.insert(i->getInterfaceName(), i); |
302 | updateInterface(i); | 306 | updateInterface(i); |
303 | } | 307 | } |
304 | } | 308 | } |
305 | file.close(); | 309 | file.close(); |
306 | QFile::remove(fileName); | 310 | QFile::remove(fileName); |
307 | } | 311 | } |
308 | 312 | ||
313 | /** | ||
314 | * | ||
315 | */ | ||
309 | void MainWindowImp::updateInterface(Interface *i){ | 316 | void 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 ){ |
318 | if(it.key()->isOwner(i)) | 325 | if(it.key()->isOwner(i)) |
319 | i->setModuleOwner(it.key()); | 326 | i->setModuleOwner(it.key()); |
320 | } | 327 | } |
321 | 328 | ||
322 | items.insert(i, item); | 329 | items.insert(i, item); |
323 | interfaceItems.insert(item, i); | 330 | interfaceItems.insert(item, i); |
324 | } | 331 | } |
325 | else | 332 | else |
326 | item = items[i]; | 333 | item = items[i]; |
327 | 334 | ||
328 | QString statusImage = "down"; | 335 | QString statusImage = "down"; |
329 | if(i->getStatus()) | 336 | if(i->getStatus()) |
330 | statusImage = "up"; | 337 | statusImage = "up"; |
331 | QPixmap status = (Resource::loadPixmap(statusImage)); | 338 | QPixmap status = (Resource::loadPixmap(statusImage)); |
332 | item->setPixmap(0, status); | 339 | item->setPixmap(0, status); |
333 | 340 | ||
334 | QString typeName = "lan"; | 341 | QString typeName = "lan"; |
335 | if(i->getHardwareName().contains("Local Loopback")) | 342 | if(i->getHardwareName().contains("Local Loopback")) |
336 | typeName = "lo"; | 343 | typeName = "lo"; |
337 | if(i->getInterfaceName().contains("irda")) | 344 | if(i->getInterfaceName().contains("irda")) |
338 | typeName = "irda"; | 345 | typeName = "irda"; |
339 | if(i->getInterfaceName().contains("wlan")) | 346 | if(i->getInterfaceName().contains("wlan")) |
340 | typeName = "wlan"; | 347 | typeName = "wlan"; |
341 | // Actually try to use the Module | 348 | // Actually try to use the Module |
342 | if(i->getModuleOwner() != NULL){ | 349 | if(i->getModuleOwner() != NULL){ |
343 | typeName = i->getModuleOwner()->getPixmapName(i); | 350 | typeName = i->getModuleOwner()->getPixmapName(i); |
344 | } | 351 | } |
345 | QPixmap type = (Resource::loadPixmap(typeName)); | 352 | QPixmap type = (Resource::loadPixmap(typeName)); |
346 | item->setPixmap(1, type); | 353 | item->setPixmap(1, type); |
347 | 354 | ||
348 | item->setText(2, i->getHardwareName()); | 355 | item->setText(2, i->getHardwareName()); |
349 | 356 | ||
350 | } | 357 | } |
351 | 358 | ||
352 | /** | 359 | /** |
353 | * Adds a new profile to the list of profiles. | 360 | * Adds a new profile to the list of profiles. |
354 | * Don't add profiles that already exists. | 361 | * Don't add profiles that already exists. |
355 | * Appends to the combo and QStringList | 362 | * Appends to the combo and QStringList |
356 | */ | 363 | */ |
357 | void MainWindowImp::addProfile(){ | 364 | void MainWindowImp::addProfile(){ |
358 | QString newProfileName = "New"; | 365 | QString newProfileName = "New"; |
359 | if(profiles.grep(newProfileName).count() > 0){ | 366 | if(profiles.grep(newProfileName).count() > 0){ |
360 | QMessageBox::information(this, "Can't Add.","Profile already exists.", "Ok"); | 367 | QMessageBox::information(this, "Can't Add.","Profile already exists.", "Ok"); |
361 | return; | 368 | return; |
362 | } | 369 | } |
363 | profiles.append(newProfileName); | 370 | profiles.append(newProfileName); |
364 | profilesList->insertItem(newProfileName); | 371 | profilesList->insertItem(newProfileName); |
365 | 372 | ||
366 | } | 373 | } |
367 | 374 | ||
368 | /** | 375 | /** |
369 | * Removes the currently selected profile in the combo. | 376 | * Removes the currently selected profile in the combo. |
370 | * Doesn't delete if there are less then 2 profiles. | 377 | * Doesn't delete if there are less then 2 profiles. |
371 | */ | 378 | */ |
372 | void MainWindowImp::removeProfile(){ | 379 | void MainWindowImp::removeProfile(){ |
373 | if(profilesList->count() <= 1){ | 380 | if(profilesList->count() <= 1){ |
374 | QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok"); | 381 | QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok"); |
375 | return; | 382 | return; |
376 | } | 383 | } |
377 | QString profileToRemove = profilesList->currentText(); | 384 | QString profileToRemove = profilesList->currentText(); |
378 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ | 385 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ |
379 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); | 386 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); |
380 | profilesList->clear(); | 387 | profilesList->clear(); |
381 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 388 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
382 | profilesList->insertItem((*it)); | 389 | profilesList->insertItem((*it)); |
383 | } | 390 | } |
384 | 391 | ||
385 | } | 392 | } |
386 | 393 | ||
387 | /** | 394 | /** |
388 | * A new profile has been selected, change. | 395 | * A new profile has been selected, change. |
389 | * @param newProfile the new profile. | 396 | * @param newProfile the new profile. |
390 | */ | 397 | */ |
391 | void MainWindowImp::changeProfile(const QString& newProfile){ | 398 | void MainWindowImp::changeProfile(const QString& newProfile){ |
392 | currentProfileLabel->setText(newProfile); | 399 | currentProfileLabel->setText(newProfile); |
393 | } | 400 | } |
394 | 401 | ||
395 | // mainwindowimp.cpp | 402 | // mainwindowimp.cpp |
396 | 403 | ||
diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h index 19ebaf2..629b758 100644 --- a/noncore/settings/networksettings/mainwindowimp.h +++ b/noncore/settings/networksettings/mainwindowimp.h | |||
@@ -1,56 +1,57 @@ | |||
1 | #ifndef MAINWINOWIMP_H | 1 | #ifndef MAINWINOWIMP_H |
2 | #define MAINWINOWIMP_H | 2 | #define MAINWINOWIMP_H |
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | #include <qmap.h> | 5 | #include <qmap.h> |
6 | #include <qstringlist.h> | 6 | #include <qstringlist.h> |
7 | 7 | ||
8 | class Module; | 8 | class Module; |
9 | class Interface; | 9 | class Interface; |
10 | class QLibrary; | 10 | class QLibrary; |
11 | class KProcess; | 11 | class KProcess; |
12 | 12 | ||
13 | class MainWindowImp : public MainWindow { | 13 | class MainWindowImp : public MainWindow { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | MainWindowImp(QWidget *parent=0, const char *name=0); | 17 | MainWindowImp(QWidget *parent=0, const char *name=0); |
18 | ~MainWindowImp(); | 18 | ~MainWindowImp(); |
19 | 19 | ||
20 | private slots: | 20 | private slots: |
21 | void addClicked(); | 21 | void addClicked(); |
22 | void removeClicked(); | 22 | void removeClicked(); |
23 | void configureClicked(); | 23 | void configureClicked(); |
24 | void informationClicked(); | 24 | void informationClicked(); |
25 | 25 | ||
26 | void jobDone(KProcess *process); | 26 | void jobDone(KProcess *process); |
27 | void getInterfaceList(); | 27 | void getInterfaceList(); |
28 | 28 | ||
29 | void addProfile(); | 29 | void addProfile(); |
30 | void removeProfile(); | 30 | void removeProfile(); |
31 | void changeProfile(const QString&); | 31 | void changeProfile(const QString&); |
32 | 32 | ||
33 | void updateInterface(Interface *i); | 33 | void updateInterface(Interface *i); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | void loadModules(QString path); | 36 | void loadModules(QString path); |
37 | 37 | ||
38 | Module* loadPlugin(QString pluginFileName, | 38 | Module* loadPlugin(QString pluginFileName, |
39 | QString resolveString = "create_plugin"); | 39 | QString resolveString = "create_plugin"); |
40 | 40 | ||
41 | // For our local list of names | 41 | // For our local list of names |
42 | QMap<QString, Interface*> interfaceNames; | 42 | QMap<QString, Interface*> interfaceNames; |
43 | 43 | ||
44 | QMap<Module*, QLibrary*> libraries; | 44 | QMap<Module*, QLibrary*> libraries; |
45 | QMap<Interface*, QListViewItem*> items; | 45 | QMap<Interface*, QListViewItem*> items; |
46 | QMap<QListViewItem*, Interface*> interfaceItems; | 46 | QMap<QListViewItem*, Interface*> interfaceItems; |
47 | 47 | ||
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 |
54 | 55 | ||
55 | // mainwindowimp.h | 56 | // mainwindowimp.h |
56 | 57 | ||
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h index c1e9488..0c81928 100644 --- a/noncore/settings/networksettings/module.h +++ b/noncore/settings/networksettings/module.h | |||
@@ -1,34 +1,79 @@ | |||
1 | #ifndef NETCONF_MODULE_H | 1 | #ifndef NETCONF_MODULE_H |
2 | #define NETCONF_MODULE_H | 2 | #define NETCONF_MODULE_H |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include "interface.h" | 7 | #include "interface.h" |
8 | 8 | ||
9 | class QWidget; | 9 | class QWidget; |
10 | class QTabWidget; | 10 | class QTabWidget; |
11 | 11 | ||
12 | class Module : QObject{ | 12 | class Module : QObject{ |
13 | 13 | ||
14 | signals: | 14 | signals: |
15 | void updateInterface(Interface *i); | 15 | void updateInterface(Interface *i); |
16 | 16 | ||
17 | public: | 17 | public: |
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 | ||
31 | #endif | 76 | #endif |
32 | 77 | ||
33 | // module.h | 78 | // module.h |
34 | 79 | ||
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 |
8 | LIBS += -lqpe | 8 | LIBS += -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 | |||
@@ -1,248 +1,248 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>WLAN</class> | 2 | <class>WLAN</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>WLAN</cstring> | 7 | <cstring>WLAN</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>254</width> | 14 | <width>250</width> |
15 | <height>286</height> | 15 | <height>286</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>Wireless LAN Setting</string> | 20 | <string>Wireless LAN Setting</string> |
21 | </property> | 21 | </property> |
22 | <property stdset="1"> | 22 | <property stdset="1"> |
23 | <name>sizeGripEnabled</name> | 23 | <name>sizeGripEnabled</name> |
24 | <bool>true</bool> | 24 | <bool>true</bool> |
25 | </property> | 25 | </property> |
26 | <property> | 26 | <property> |
27 | <name>layoutMargin</name> | 27 | <name>layoutMargin</name> |
28 | </property> | 28 | </property> |
29 | <vbox> | 29 | <vbox> |
30 | <property stdset="1"> | 30 | <property stdset="1"> |
31 | <name>margin</name> | 31 | <name>margin</name> |
32 | <number>0</number> | 32 | <number>0</number> |
33 | </property> | 33 | </property> |
34 | <property stdset="1"> | 34 | <property stdset="1"> |
35 | <name>spacing</name> | 35 | <name>spacing</name> |
36 | <number>6</number> | 36 | <number>6</number> |
37 | </property> | 37 | </property> |
38 | <widget> | 38 | <widget> |
39 | <class>QTabWidget</class> | 39 | <class>QTabWidget</class> |
40 | <property stdset="1"> | 40 | <property stdset="1"> |
41 | <name>name</name> | 41 | <name>name</name> |
42 | <cstring>tabWidget</cstring> | 42 | <cstring>tabWidget</cstring> |
43 | </property> | 43 | </property> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>enabled</name> | 45 | <name>enabled</name> |
46 | <bool>true</bool> | 46 | <bool>true</bool> |
47 | </property> | 47 | </property> |
48 | <widget> | 48 | <widget> |
49 | <class>QWidget</class> | 49 | <class>QWidget</class> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>name</name> | 51 | <name>name</name> |
52 | <cstring>ConfigPage</cstring> | 52 | <cstring>ConfigPage</cstring> |
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"> |
60 | <name>margin</name> | 60 | <name>margin</name> |
61 | <number>11</number> | 61 | <number>11</number> |
62 | </property> | 62 | </property> |
63 | <property stdset="1"> | 63 | <property stdset="1"> |
64 | <name>spacing</name> | 64 | <name>spacing</name> |
65 | <number>6</number> | 65 | <number>6</number> |
66 | </property> | 66 | </property> |
67 | <widget> | 67 | <widget> |
68 | <class>QButtonGroup</class> | 68 | <class>QButtonGroup</class> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>name</name> | 70 | <name>name</name> |
71 | <cstring>ButtonGroup45</cstring> | 71 | <cstring>ButtonGroup45</cstring> |
72 | </property> | 72 | </property> |
73 | <property stdset="1"> | 73 | <property stdset="1"> |
74 | <name>title</name> | 74 | <name>title</name> |
75 | <string>ESS ID</string> | 75 | <string>ESS ID</string> |
76 | </property> | 76 | </property> |
77 | <vbox> | 77 | <vbox> |
78 | <property stdset="1"> | 78 | <property stdset="1"> |
79 | <name>margin</name> | 79 | <name>margin</name> |
80 | <number>11</number> | 80 | <number>11</number> |
81 | </property> | 81 | </property> |
82 | <property stdset="1"> | 82 | <property stdset="1"> |
83 | <name>spacing</name> | 83 | <name>spacing</name> |
84 | <number>6</number> | 84 | <number>6</number> |
85 | </property> | 85 | </property> |
86 | <widget> | 86 | <widget> |
87 | <class>QRadioButton</class> | 87 | <class>QRadioButton</class> |
88 | <property stdset="1"> | 88 | <property stdset="1"> |
89 | <name>name</name> | 89 | <name>name</name> |
90 | <cstring>essNon</cstring> | 90 | <cstring>essNon</cstring> |
91 | </property> | 91 | </property> |
92 | <property stdset="1"> | 92 | <property stdset="1"> |
93 | <name>text</name> | 93 | <name>text</name> |
94 | <string>Non-Spec ESSID: "ANY"</string> | 94 | <string>Non-Spec ESSID: "ANY"</string> |
95 | </property> | 95 | </property> |
96 | <property stdset="1"> | 96 | <property stdset="1"> |
97 | <name>checked</name> | 97 | <name>checked</name> |
98 | <bool>true</bool> | 98 | <bool>true</bool> |
99 | </property> | 99 | </property> |
100 | </widget> | 100 | </widget> |
101 | <widget> | 101 | <widget> |
102 | <class>QRadioButton</class> | 102 | <class>QRadioButton</class> |
103 | <property stdset="1"> | 103 | <property stdset="1"> |
104 | <name>name</name> | 104 | <name>name</name> |
105 | <cstring>essSpecific</cstring> | 105 | <cstring>essSpecific</cstring> |
106 | </property> | 106 | </property> |
107 | <property stdset="1"> | 107 | <property stdset="1"> |
108 | <name>text</name> | 108 | <name>text</name> |
109 | <string>Specific ESSID</string> | 109 | <string>Specific ESSID</string> |
110 | </property> | 110 | </property> |
111 | </widget> | 111 | </widget> |
112 | <widget> | 112 | <widget> |
113 | <class>QLineEdit</class> | 113 | <class>QLineEdit</class> |
114 | <property stdset="1"> | 114 | <property stdset="1"> |
115 | <name>name</name> | 115 | <name>name</name> |
116 | <cstring>essSpecificLineEdit</cstring> | 116 | <cstring>essSpecificLineEdit</cstring> |
117 | </property> | 117 | </property> |
118 | <property stdset="1"> | 118 | <property stdset="1"> |
119 | <name>enabled</name> | 119 | <name>enabled</name> |
120 | <bool>false</bool> | 120 | <bool>false</bool> |
121 | </property> | 121 | </property> |
122 | </widget> | 122 | </widget> |
123 | </vbox> | 123 | </vbox> |
124 | </widget> | 124 | </widget> |
125 | <widget> | 125 | <widget> |
126 | <class>QButtonGroup</class> | 126 | <class>QButtonGroup</class> |
127 | <property stdset="1"> | 127 | <property stdset="1"> |
128 | <name>name</name> | 128 | <name>name</name> |
129 | <cstring>ButtonGroup46</cstring> | 129 | <cstring>ButtonGroup46</cstring> |
130 | </property> | 130 | </property> |
131 | <property stdset="1"> | 131 | <property stdset="1"> |
132 | <name>title</name> | 132 | <name>title</name> |
133 | <string>Network Type</string> | 133 | <string>Network Type</string> |
134 | </property> | 134 | </property> |
135 | <grid> | 135 | <grid> |
136 | <property stdset="1"> | 136 | <property stdset="1"> |
137 | <name>margin</name> | 137 | <name>margin</name> |
138 | <number>11</number> | 138 | <number>11</number> |
139 | </property> | 139 | </property> |
140 | <property stdset="1"> | 140 | <property stdset="1"> |
141 | <name>spacing</name> | 141 | <name>spacing</name> |
142 | <number>6</number> | 142 | <number>6</number> |
143 | </property> | 143 | </property> |
144 | <widget row="0" column="0" rowspan="1" colspan="3" > | 144 | <widget row="0" column="0" rowspan="1" colspan="3" > |
145 | <class>QRadioButton</class> | 145 | <class>QRadioButton</class> |
146 | <property stdset="1"> | 146 | <property stdset="1"> |
147 | <name>name</name> | 147 | <name>name</name> |
148 | <cstring>networkInfrastructure</cstring> | 148 | <cstring>networkInfrastructure</cstring> |
149 | </property> | 149 | </property> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>text</name> | 151 | <name>text</name> |
152 | <string>Infrastructure</string> | 152 | <string>Infrastructure</string> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>checked</name> | 155 | <name>checked</name> |
156 | <bool>true</bool> | 156 | <bool>true</bool> |
157 | </property> | 157 | </property> |
158 | </widget> | 158 | </widget> |
159 | <widget row="2" column="0" > | 159 | <widget row="2" column="0" > |
160 | <class>QLabel</class> | 160 | <class>QLabel</class> |
161 | <property stdset="1"> | 161 | <property stdset="1"> |
162 | <name>name</name> | 162 | <name>name</name> |
163 | <cstring>TextLabel2</cstring> | 163 | <cstring>TextLabel2</cstring> |
164 | </property> | 164 | </property> |
165 | <property stdset="1"> | 165 | <property stdset="1"> |
166 | <name>enabled</name> | 166 | <name>enabled</name> |
167 | <bool>false</bool> | 167 | <bool>false</bool> |
168 | </property> | 168 | </property> |
169 | <property stdset="1"> | 169 | <property stdset="1"> |
170 | <name>text</name> | 170 | <name>text</name> |
171 | <string>Channel</string> | 171 | <string>Channel</string> |
172 | </property> | 172 | </property> |
173 | </widget> | 173 | </widget> |
174 | <widget row="1" column="0" rowspan="1" colspan="2" > | 174 | <widget row="1" column="0" rowspan="1" colspan="2" > |
175 | <class>QRadioButton</class> | 175 | <class>QRadioButton</class> |
176 | <property stdset="1"> | 176 | <property stdset="1"> |
177 | <name>name</name> | 177 | <name>name</name> |
178 | <cstring>network802</cstring> | 178 | <cstring>network802</cstring> |
179 | </property> | 179 | </property> |
180 | <property stdset="1"> | 180 | <property stdset="1"> |
181 | <name>text</name> | 181 | <name>text</name> |
182 | <string>802.11 Ad-Hoc</string> | 182 | <string>802.11 Ad-Hoc</string> |
183 | </property> | 183 | </property> |
184 | </widget> | 184 | </widget> |
185 | <widget row="2" column="1" > | 185 | <widget row="2" column="1" > |
186 | <class>QSpinBox</class> | 186 | <class>QSpinBox</class> |
187 | <property stdset="1"> | 187 | <property stdset="1"> |
188 | <name>name</name> | 188 | <name>name</name> |
189 | <cstring>networkChannel</cstring> | 189 | <cstring>networkChannel</cstring> |
190 | </property> | 190 | </property> |
191 | <property stdset="1"> | 191 | <property stdset="1"> |
192 | <name>enabled</name> | 192 | <name>enabled</name> |
193 | <bool>false</bool> | 193 | <bool>false</bool> |
194 | </property> | 194 | </property> |
195 | <property stdset="1"> | 195 | <property stdset="1"> |
196 | <name>maxValue</name> | 196 | <name>maxValue</name> |
197 | <number>11</number> | 197 | <number>11</number> |
198 | </property> | 198 | </property> |
199 | <property stdset="1"> | 199 | <property stdset="1"> |
200 | <name>minValue</name> | 200 | <name>minValue</name> |
201 | <number>1</number> | 201 | <number>1</number> |
202 | </property> | 202 | </property> |
203 | </widget> | 203 | </widget> |
204 | <spacer row="2" column="2" > | 204 | <spacer row="2" column="2" > |
205 | <property> | 205 | <property> |
206 | <name>name</name> | 206 | <name>name</name> |
207 | <cstring>Spacer32</cstring> | 207 | <cstring>Spacer32</cstring> |
208 | </property> | 208 | </property> |
209 | <property stdset="1"> | 209 | <property stdset="1"> |
210 | <name>orientation</name> | 210 | <name>orientation</name> |
211 | <enum>Horizontal</enum> | 211 | <enum>Horizontal</enum> |
212 | </property> | 212 | </property> |
213 | <property stdset="1"> | 213 | <property stdset="1"> |
214 | <name>sizeType</name> | 214 | <name>sizeType</name> |
215 | <enum>Expanding</enum> | 215 | <enum>Expanding</enum> |
216 | </property> | 216 | </property> |
217 | <property> | 217 | <property> |
218 | <name>sizeHint</name> | 218 | <name>sizeHint</name> |
219 | <size> | 219 | <size> |
220 | <width>20</width> | 220 | <width>20</width> |
221 | <height>20</height> | 221 | <height>20</height> |
222 | </size> | 222 | </size> |
223 | </property> | 223 | </property> |
224 | </spacer> | 224 | </spacer> |
225 | </grid> | 225 | </grid> |
226 | </widget> | 226 | </widget> |
227 | <spacer> | 227 | <spacer> |
228 | <property> | 228 | <property> |
229 | <name>name</name> | 229 | <name>name</name> |
230 | <cstring>Spacer31</cstring> | 230 | <cstring>Spacer31</cstring> |
231 | </property> | 231 | </property> |
232 | <property stdset="1"> | 232 | <property stdset="1"> |
233 | <name>orientation</name> | 233 | <name>orientation</name> |
234 | <enum>Vertical</enum> | 234 | <enum>Vertical</enum> |
235 | </property> | 235 | </property> |
236 | <property stdset="1"> | 236 | <property stdset="1"> |
237 | <name>sizeType</name> | 237 | <name>sizeType</name> |
238 | <enum>Expanding</enum> | 238 | <enum>Expanding</enum> |
239 | </property> | 239 | </property> |
240 | <property> | 240 | <property> |
241 | <name>sizeHint</name> | 241 | <name>sizeHint</name> |
242 | <size> | 242 | <size> |
243 | <width>20</width> | 243 | <width>20</width> |
244 | <height>20</height> | 244 | <height>20</height> |
245 | </size> | 245 | </size> |
246 | </property> | 246 | </property> |
247 | </spacer> | 247 | </spacer> |
248 | </vbox> | 248 | </vbox> |
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index 632f7e4..70b1f7a 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -1,85 +1,84 @@ | |||
1 | #include "wlanmodule.h" | 1 | #include "wlanmodule.h" |
2 | #include <qpe/config.h> | 2 | #include <qpe/config.h> |
3 | #include "wlanimp.h" | 3 | #include "wlanimp.h" |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Constructor, find all of the possible interfaces | 6 | * Constructor, find all of the possible interfaces |
7 | */ | 7 | */ |
8 | WLANModule::WLANModule() : Module() { | 8 | WLANModule::WLANModule() : Module() { |
9 | // get output from iwconfig | 9 | // get output from iwconfig |
10 | } | 10 | } |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * get the icon name for this device. | 13 | * get the icon name for this device. |
14 | * @param Interface* can be used in determining the icon. | 14 | * @param Interface* can be used in determining the icon. |
15 | * @return QString the icon name (minus .png, .gif etc) | 15 | * @return QString the icon name (minus .png, .gif etc) |
16 | */ | 16 | */ |
17 | QString WLANModule::getPixmapName(Interface* ){ | 17 | QString WLANModule::getPixmapName(Interface* ){ |
18 | return "wlan"; | 18 | return "wlan"; |
19 | } | 19 | } |
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 | */ |
25 | bool WLANModule::isOwner(Interface *i){ | 26 | bool WLANModule::isOwner(Interface *i){ |
26 | if(i->getInterfaceName() == "eth0") | 27 | if(i->getInterfaceName() == "eth0") |
27 | return true; | 28 | return true; |
28 | return false; | 29 | return false; |
29 | } | 30 | } |
30 | 31 | ||
31 | /** | 32 | /** |
32 | * Create, set tabWiget and return the WLANConfigure Module | 33 | * Create, set tabWiget and return the WLANConfigure Module |
33 | * @param tabWidget a pointer to the tab widget that this configure has. | 34 | * @param tabWidget a pointer to the tab widget that this configure has. |
34 | * @return QWidget* pointer to the tab widget in this modules configure. | 35 | * @return QWidget* pointer to the tab widget in this modules configure. |
35 | */ | 36 | */ |
36 | QWidget *WLANModule::configure(QTabWidget **tabWidget){ | 37 | QWidget *WLANModule::configure(QTabWidget **tabWidget){ |
37 | Config cfg("wireless"); | 38 | Config cfg("wireless"); |
38 | WLANImp *wlanconfig = new WLANImp(cfg); | 39 | WLANImp *wlanconfig = new WLANImp(cfg); |
39 | (*tabWidget) = wlanconfig->tabWidget; | 40 | (*tabWidget) = wlanconfig->tabWidget; |
40 | return wlanconfig; | 41 | return wlanconfig; |
41 | } | 42 | } |
42 | 43 | ||
43 | /** | 44 | /** |
44 | * Create, set tabWiget and return the Information Module | 45 | * Create, set tabWiget and return the Information Module |
45 | * @param tabWidget a pointer to the tab widget that this information has. | 46 | * @param tabWidget a pointer to the tab widget that this information has. |
46 | * @return QWidget* pointer to the tab widget in this modules info. | 47 | * @return QWidget* pointer to the tab widget in this modules info. |
47 | */ | 48 | */ |
48 | QWidget *WLANModule::information(QTabWidget **tabWidget){ | 49 | QWidget *WLANModule::information(QTabWidget **tabWidget){ |
49 | return NULL; | 50 | return NULL; |
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 | */ | ||
55 | QList<Interface> WLANModule::getInterfaces(){ | 58 | QList<Interface> WLANModule::getInterfaces(){ |
56 | return list | 59 | return list; |
57 | } | ||
58 | |||
59 | /** | ||
60 | * Return a list of possible new interfaces | ||
61 | */ | ||
62 | QMap<QString, QString> WLANModule::possibleNewInterfaces(){ | ||
63 | //return list; | ||
64 | } | 60 | } |
65 | 61 | ||
66 | /** | 62 | /** |
67 | * Attempt to add a new interface as defined by name | 63 | * Attempt to add a new interface as defined by name |
68 | * @param name the name of the type of interface that should be created given | 64 | * @param name the name of the type of interface that should be created given |
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 | */ |
72 | Interface *WLANModule::addNewInterface(QString name){ | 68 | Interface *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 | ||
76 | /** | 74 | /** |
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 | */ |
80 | bool WLANModule::remove(Interface* i){ | 78 | bool 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 | ||
84 | // wlanmodule.cpp | 83 | // wlanmodule.cpp |
85 | 84 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.h b/noncore/settings/networksettings/wlan/wlanmodule.h index 1fbf6a9..7ebe129 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.h +++ b/noncore/settings/networksettings/wlan/wlanmodule.h | |||
@@ -1,38 +1,38 @@ | |||
1 | #ifndef WLAN_MODULE_H | 1 | #ifndef WLAN_MODULE_H |
2 | #define WLAN_MODULE_H | 2 | #define WLAN_MODULE_H |
3 | 3 | ||
4 | #include "module.h" | 4 | #include "module.h" |
5 | 5 | ||
6 | class WLANModule : Module{ | 6 | class WLANModule : Module{ |
7 | 7 | ||
8 | signals: | 8 | signals: |
9 | void updateInterface(Interface *i); | 9 | void updateInterface(Interface *i); |
10 | 10 | ||
11 | public: | 11 | public: |
12 | WLANModule(); | 12 | WLANModule(); |
13 | 13 | ||
14 | virtual bool isOwner(Interface *); | 14 | virtual bool isOwner(Interface *); |
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); |
22 | 22 | ||
23 | private: | 23 | private: |
24 | QList<Interface> list; | 24 | QList<Interface> list; |
25 | 25 | ||
26 | }; | 26 | }; |
27 | 27 | ||
28 | extern "C" | 28 | extern "C" |
29 | { | 29 | { |
30 | void* create_plugin() { | 30 | void* create_plugin() { |
31 | return new WLANModule(); | 31 | return new WLANModule(); |
32 | } | 32 | } |
33 | }; | 33 | }; |
34 | 34 | ||
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | // wlanmodule.h | 37 | // wlanmodule.h |
38 | 38 | ||