author | benmeyer <benmeyer> | 2003-04-09 00:18:15 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2003-04-09 00:18:15 (UTC) |
commit | cd2822e137e9a73aa2bf13f7f0dc67fda50a1879 (patch) (unidiff) | |
tree | 97febc8658a7212a01025b9e98904c9770aecf96 | |
parent | bbefacdb0099ebb8c80f40c56237c6adc18c9328 (diff) | |
download | opie-cd2822e137e9a73aa2bf13f7f0dc67fda50a1879.zip opie-cd2822e137e9a73aa2bf13f7f0dc67fda50a1879.tar.gz opie-cd2822e137e9a73aa2bf13f7f0dc67fda50a1879.tar.bz2 |
KDEafied and bugs fixes
-rw-r--r-- | noncore/settings/networksettings/.cvsignore | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/addconnectionimp.cpp | 4 | ||||
-rw-r--r-- | noncore/settings/networksettings/addconnectionimp.h | 1 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindow.ui | 22 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 103 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.h | 11 | ||||
-rw-r--r-- | noncore/settings/networksettings/module.h | 4 |
7 files changed, 111 insertions, 40 deletions
diff --git a/noncore/settings/networksettings/.cvsignore b/noncore/settings/networksettings/.cvsignore index 1ba7ac7..e000724 100644 --- a/noncore/settings/networksettings/.cvsignore +++ b/noncore/settings/networksettings/.cvsignore | |||
@@ -1,23 +1,29 @@ | |||
1 | *.moc | 1 | *.moc |
2 | *.moc.o | 2 | *.moc.o |
3 | *.o | 3 | *.o |
4 | .deps | 4 | .deps |
5 | .libs | 5 | .libs |
6 | .moc.cpp | 6 | .moc.cpp |
7 | .moc.o | 7 | .moc.o |
8 | .o | 8 | .o |
9 | Makefile* | 9 | Makefile* |
10 | addconnection.cpp | 10 | addconnection.cpp |
11 | addconnection.h | 11 | addconnection.h |
12 | interfaceadvanced.cpp | 12 | interfaceadvanced.cpp |
13 | interfaceadvanced.h | 13 | interfaceadvanced.h |
14 | interfaceinformation.cpp | 14 | interfaceinformation.cpp |
15 | interfaceinformation.h | 15 | interfaceinformation.h |
16 | interfacesetup.cpp | 16 | interfacesetup.cpp |
17 | interfacesetup.h | 17 | interfacesetup.h |
18 | mainwindow.cpp | 18 | mainwindow.cpp |
19 | mainwindow.h | 19 | mainwindow.h |
20 | moc_*.cpp | 20 | moc_*.cpp |
21 | networksetup | 21 | networksetup |
22 | systemadvanced.cpp | 22 | systemadvanced.cpp |
23 | systemadvanced.h | 23 | systemadvanced.h |
24 | hosts.h | ||
25 | hosts.cpp | ||
26 | vpn.h | ||
27 | vpn.cpp | ||
28 | dns.h | ||
29 | dns.cpp | ||
diff --git a/noncore/settings/networksettings/addconnectionimp.cpp b/noncore/settings/networksettings/addconnectionimp.cpp index 07545f7..f18d8d1 100644 --- a/noncore/settings/networksettings/addconnectionimp.cpp +++ b/noncore/settings/networksettings/addconnectionimp.cpp | |||
@@ -1,37 +1,41 @@ | |||
1 | #include "addconnectionimp.h" | 1 | #include "addconnectionimp.h" |
2 | #include <qlistview.h> | 2 | #include <qlistview.h> |
3 | #if QT_VERSION < 300 | ||
3 | #include <qlist.h> | 4 | #include <qlist.h> |
5 | #else | ||
6 | #include <qptrlist.h> | ||
7 | #endif | ||
4 | #include <qlabel.h> | 8 | #include <qlabel.h> |
5 | #include <qheader.h> | 9 | #include <qheader.h> |
6 | 10 | ||
7 | /** | 11 | /** |
8 | * Constructor | 12 | * Constructor |
9 | */ | 13 | */ |
10 | AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f):AddConnection(parent, name, f){ | 14 | AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f):AddConnection(parent, name, f){ |
11 | connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed())); | 15 | connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed())); |
12 | registeredServicesList->header()->hide(); | 16 | registeredServicesList->header()->hide(); |
13 | }; | 17 | }; |
14 | 18 | ||
15 | /** | 19 | /** |
16 | * The current item changed, update the discription. | 20 | * The current item changed, update the discription. |
17 | */ | 21 | */ |
18 | void AddConnectionImp::changed(){ | 22 | void AddConnectionImp::changed(){ |
19 | QListViewItem *item = registeredServicesList->currentItem(); | 23 | QListViewItem *item = registeredServicesList->currentItem(); |
20 | if(item) | 24 | if(item) |
21 | help->setText(list[item->text(0)]); | 25 | help->setText(list[item->text(0)]); |
22 | } | 26 | } |
23 | 27 | ||
24 | /** | 28 | /** |
25 | * Save a copy of newList for the discriptions and append them all to the view | 29 | * Save a copy of newList for the discriptions and append them all to the view |
26 | * @param newList the new list of possible interfaces | 30 | * @param newList the new list of possible interfaces |
27 | */ | 31 | */ |
28 | void AddConnectionImp::addConnections(const QMap<QString, QString> &newList){ | 32 | void AddConnectionImp::addConnections(const QMap<QString, QString> &newList){ |
29 | list = newList; | 33 | list = newList; |
30 | QMap<QString, QString>::Iterator it; | 34 | QMap<QString, QString>::Iterator it; |
31 | for( it = list.begin(); it != list.end(); ++it ) | 35 | for( it = list.begin(); it != list.end(); ++it ) |
32 | QListViewItem *item = new QListViewItem(registeredServicesList, it.key()); | 36 | QListViewItem *item = new QListViewItem(registeredServicesList, it.key()); |
33 | registeredServicesList->setCurrentItem(registeredServicesList->firstChild()); | 37 | registeredServicesList->setCurrentItem(registeredServicesList->firstChild()); |
34 | } | 38 | } |
35 | 39 | ||
36 | // addserviceimp.cpp | 40 | // addserviceimp.cpp |
37 | 41 | ||
diff --git a/noncore/settings/networksettings/addconnectionimp.h b/noncore/settings/networksettings/addconnectionimp.h index 680a502..57e6b20 100644 --- a/noncore/settings/networksettings/addconnectionimp.h +++ b/noncore/settings/networksettings/addconnectionimp.h | |||
@@ -1,29 +1,28 @@ | |||
1 | #ifndef ADDCONNECTIONIMP_H | 1 | #ifndef ADDCONNECTIONIMP_H |
2 | #define ADDCONNECTIONIMP_H | 2 | #define ADDCONNECTIONIMP_H |
3 | 3 | ||
4 | #include "addconnection.h" | 4 | #include "addconnection.h" |
5 | #include <qmap.h> | 5 | #include <qmap.h> |
6 | #include <qlist.h> | ||
7 | 6 | ||
8 | class QListViewItem; | 7 | class QListViewItem; |
9 | 8 | ||
10 | class AddConnectionImp : public AddConnection { | 9 | class AddConnectionImp : public AddConnection { |
11 | 10 | ||
12 | Q_OBJECT | 11 | Q_OBJECT |
13 | 12 | ||
14 | public: | 13 | public: |
15 | AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0); | 14 | AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0); |
16 | void addConnections(const QMap<QString, QString> &newList); | 15 | void addConnections(const QMap<QString, QString> &newList); |
17 | 16 | ||
18 | private slots: | 17 | private slots: |
19 | void changed(); | 18 | void changed(); |
20 | 19 | ||
21 | private: | 20 | private: |
22 | QMap<QString, QString> list; | 21 | QMap<QString, QString> list; |
23 | 22 | ||
24 | }; | 23 | }; |
25 | 24 | ||
26 | #endif | 25 | #endif |
27 | 26 | ||
28 | // addconectionimp.h | 27 | // addconectionimp.h |
29 | 28 | ||
diff --git a/noncore/settings/networksettings/mainwindow.ui b/noncore/settings/networksettings/mainwindow.ui index dcabc52..8e17cb3 100644 --- a/noncore/settings/networksettings/mainwindow.ui +++ b/noncore/settings/networksettings/mainwindow.ui | |||
@@ -1,449 +1,427 @@ | |||
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>240</width> | 14 | <width>240</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 Settings</string> | 20 | <string>Network Settings</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>Connections</string> | 48 | <string>Connections</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>s</string> | 64 | <string>s</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 | <column> | 103 | <column> |
104 | <property> | 104 | <property> |
105 | <name>text</name> | 105 | <name>text</name> |
106 | <string>in</string> | 106 | <string>in</string> |
107 | </property> | 107 | </property> |
108 | <property> | 108 | <property> |
109 | <name>clickable</name> | 109 | <name>clickable</name> |
110 | <bool>true</bool> | 110 | <bool>true</bool> |
111 | </property> | 111 | </property> |
112 | <property> | 112 | <property> |
113 | <name>resizeable</name> | 113 | <name>resizeable</name> |
114 | <bool>true</bool> | 114 | <bool>true</bool> |
115 | </property> | 115 | </property> |
116 | </column> | 116 | </column> |
117 | <column> | 117 | <column> |
118 | <property> | 118 | <property> |
119 | <name>text</name> | 119 | <name>text</name> |
120 | <string>IP</string> | 120 | <string>IP</string> |
121 | </property> | 121 | </property> |
122 | <property> | 122 | <property> |
123 | <name>clickable</name> | 123 | <name>clickable</name> |
124 | <bool>true</bool> | 124 | <bool>true</bool> |
125 | </property> | 125 | </property> |
126 | <property> | 126 | <property> |
127 | <name>resizeable</name> | 127 | <name>resizeable</name> |
128 | <bool>true</bool> | 128 | <bool>true</bool> |
129 | </property> | 129 | </property> |
130 | </column> | 130 | </column> |
131 | <property stdset="1"> | 131 | <property stdset="1"> |
132 | <name>name</name> | 132 | <name>name</name> |
133 | <cstring>connectionList</cstring> | 133 | <cstring>connectionList</cstring> |
134 | </property> | 134 | </property> |
135 | <property stdset="1"> | 135 | <property stdset="1"> |
136 | <name>allColumnsShowFocus</name> | 136 | <name>allColumnsShowFocus</name> |
137 | <bool>true</bool> | 137 | <bool>true</bool> |
138 | </property> | 138 | </property> |
139 | </widget> | 139 | </widget> |
140 | <widget> | 140 | <widget> |
141 | <class>QLayoutWidget</class> | 141 | <class>QLayoutWidget</class> |
142 | <property stdset="1"> | 142 | <property stdset="1"> |
143 | <name>name</name> | 143 | <name>name</name> |
144 | <cstring>Layout2</cstring> | 144 | <cstring>Layout2</cstring> |
145 | </property> | 145 | </property> |
146 | <property> | 146 | <property> |
147 | <name>layoutMargin</name> | 147 | <name>layoutMargin</name> |
148 | </property> | 148 | </property> |
149 | <grid> | 149 | <grid> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>margin</name> | 151 | <name>margin</name> |
152 | <number>5</number> | 152 | <number>5</number> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>spacing</name> | 155 | <name>spacing</name> |
156 | <number>6</number> | 156 | <number>6</number> |
157 | </property> | 157 | </property> |
158 | <widget row="1" column="0" > | 158 | <widget row="1" column="0" > |
159 | <class>QPushButton</class> | 159 | <class>QPushButton</class> |
160 | <property stdset="1"> | 160 | <property stdset="1"> |
161 | <name>name</name> | 161 | <name>name</name> |
162 | <cstring>addConnectionButton</cstring> | 162 | <cstring>addConnectionButton</cstring> |
163 | </property> | 163 | </property> |
164 | <property stdset="1"> | 164 | <property stdset="1"> |
165 | <name>text</name> | 165 | <name>text</name> |
166 | <string>&Add</string> | 166 | <string>&Add</string> |
167 | </property> | 167 | </property> |
168 | </widget> | 168 | </widget> |
169 | <widget row="0" column="0" > | 169 | <widget row="0" column="0" > |
170 | <class>QPushButton</class> | 170 | <class>QPushButton</class> |
171 | <property stdset="1"> | 171 | <property stdset="1"> |
172 | <name>name</name> | 172 | <name>name</name> |
173 | <cstring>informationConnectionButton</cstring> | 173 | <cstring>informationConnectionButton</cstring> |
174 | </property> | 174 | </property> |
175 | <property stdset="1"> | 175 | <property stdset="1"> |
176 | <name>text</name> | 176 | <name>text</name> |
177 | <string>&Information</string> | 177 | <string>&Information</string> |
178 | </property> | 178 | </property> |
179 | </widget> | 179 | </widget> |
180 | <widget row="0" column="1" > | 180 | <widget row="0" column="1" > |
181 | <class>QPushButton</class> | 181 | <class>QPushButton</class> |
182 | <property stdset="1"> | 182 | <property stdset="1"> |
183 | <name>name</name> | 183 | <name>name</name> |
184 | <cstring>configureConnectionButton</cstring> | 184 | <cstring>configureConnectionButton</cstring> |
185 | </property> | 185 | </property> |
186 | <property stdset="1"> | 186 | <property stdset="1"> |
187 | <name>text</name> | 187 | <name>text</name> |
188 | <string>&Configure</string> | 188 | <string>&Configure</string> |
189 | </property> | 189 | </property> |
190 | </widget> | 190 | </widget> |
191 | <widget row="1" column="1" > | 191 | <widget row="1" column="1" > |
192 | <class>QPushButton</class> | 192 | <class>QPushButton</class> |
193 | <property stdset="1"> | 193 | <property stdset="1"> |
194 | <name>name</name> | 194 | <name>name</name> |
195 | <cstring>removeConnectionButton</cstring> | 195 | <cstring>removeConnectionButton</cstring> |
196 | </property> | 196 | </property> |
197 | <property stdset="1"> | 197 | <property stdset="1"> |
198 | <name>text</name> | 198 | <name>text</name> |
199 | <string>&Remove</string> | 199 | <string>&Remove</string> |
200 | </property> | 200 | </property> |
201 | </widget> | 201 | </widget> |
202 | </grid> | 202 | </grid> |
203 | </widget> | 203 | </widget> |
204 | </vbox> | 204 | </vbox> |
205 | </widget> | 205 | </widget> |
206 | <widget> | 206 | <widget> |
207 | <class>QWidget</class> | 207 | <class>QWidget</class> |
208 | <property stdset="1"> | 208 | <property stdset="1"> |
209 | <name>name</name> | 209 | <name>name</name> |
210 | <cstring>tab</cstring> | 210 | <cstring>tab</cstring> |
211 | </property> | 211 | </property> |
212 | <attribute> | 212 | <attribute> |
213 | <name>title</name> | 213 | <name>title</name> |
214 | <string>Profiles</string> | 214 | <string>Profiles</string> |
215 | </attribute> | 215 | </attribute> |
216 | <grid> | 216 | <grid> |
217 | <property stdset="1"> | 217 | <property stdset="1"> |
218 | <name>margin</name> | 218 | <name>margin</name> |
219 | <number>11</number> | 219 | <number>11</number> |
220 | </property> | 220 | </property> |
221 | <property stdset="1"> | 221 | <property stdset="1"> |
222 | <name>spacing</name> | 222 | <name>spacing</name> |
223 | <number>6</number> | 223 | <number>6</number> |
224 | </property> | 224 | </property> |
225 | <spacer row="7" column="2" > | 225 | <spacer row="7" column="2" > |
226 | <property> | 226 | <property> |
227 | <name>name</name> | 227 | <name>name</name> |
228 | <cstring>Spacer16</cstring> | 228 | <cstring>Spacer16</cstring> |
229 | </property> | 229 | </property> |
230 | <property stdset="1"> | 230 | <property stdset="1"> |
231 | <name>orientation</name> | 231 | <name>orientation</name> |
232 | <enum>Vertical</enum> | 232 | <enum>Vertical</enum> |
233 | </property> | 233 | </property> |
234 | <property stdset="1"> | 234 | <property stdset="1"> |
235 | <name>sizeType</name> | 235 | <name>sizeType</name> |
236 | <enum>Expanding</enum> | 236 | <enum>Expanding</enum> |
237 | </property> | 237 | </property> |
238 | <property> | 238 | <property> |
239 | <name>sizeHint</name> | 239 | <name>sizeHint</name> |
240 | <size> | 240 | <size> |
241 | <width>20</width> | 241 | <width>20</width> |
242 | <height>20</height> | 242 | <height>20</height> |
243 | </size> | 243 | </size> |
244 | </property> | 244 | </property> |
245 | </spacer> | 245 | </spacer> |
246 | <widget row="0" column="1" > | 246 | <widget row="0" column="1" > |
247 | <class>QLabel</class> | 247 | <class>QLabel</class> |
248 | <property stdset="1"> | 248 | <property stdset="1"> |
249 | <name>name</name> | 249 | <name>name</name> |
250 | <cstring>currentProfileLabel</cstring> | 250 | <cstring>currentProfileLabel</cstring> |
251 | </property> | 251 | </property> |
252 | <property stdset="1"> | 252 | <property stdset="1"> |
253 | <name>frameShape</name> | 253 | <name>frameShape</name> |
254 | <enum>Panel</enum> | 254 | <enum>Panel</enum> |
255 | </property> | 255 | </property> |
256 | <property stdset="1"> | 256 | <property stdset="1"> |
257 | <name>frameShadow</name> | 257 | <name>frameShadow</name> |
258 | <enum>Sunken</enum> | 258 | <enum>Sunken</enum> |
259 | </property> | 259 | </property> |
260 | <property stdset="1"> | 260 | <property stdset="1"> |
261 | <name>text</name> | 261 | <name>text</name> |
262 | <string>All</string> | 262 | <string>All</string> |
263 | </property> | 263 | </property> |
264 | </widget> | 264 | </widget> |
265 | <widget row="3" column="2" > | 265 | <widget row="3" column="2" > |
266 | <class>QPushButton</class> | 266 | <class>QPushButton</class> |
267 | <property stdset="1"> | 267 | <property stdset="1"> |
268 | <name>name</name> | 268 | <name>name</name> |
269 | <cstring>setCurrentProfileButton</cstring> | 269 | <cstring>setCurrentProfileButton</cstring> |
270 | </property> | 270 | </property> |
271 | <property stdset="1"> | 271 | <property stdset="1"> |
272 | <name>text</name> | 272 | <name>text</name> |
273 | <string>&Set Current</string> | 273 | <string>&Set Current</string> |
274 | </property> | 274 | </property> |
275 | </widget> | 275 | </widget> |
276 | <widget row="5" column="0" rowspan="1" colspan="3" > | 276 | <widget row="5" column="0" rowspan="1" colspan="3" > |
277 | <class>Line</class> | 277 | <class>Line</class> |
278 | <property stdset="1"> | 278 | <property stdset="1"> |
279 | <name>name</name> | 279 | <name>name</name> |
280 | <cstring>Line6</cstring> | 280 | <cstring>Line6</cstring> |
281 | </property> | 281 | </property> |
282 | <property stdset="1"> | 282 | <property stdset="1"> |
283 | <name>orientation</name> | 283 | <name>orientation</name> |
284 | <enum>Horizontal</enum> | 284 | <enum>Horizontal</enum> |
285 | </property> | 285 | </property> |
286 | </widget> | 286 | </widget> |
287 | <widget row="1" column="0" rowspan="1" colspan="3" > | 287 | <widget row="1" column="0" rowspan="1" colspan="3" > |
288 | <class>Line</class> | 288 | <class>Line</class> |
289 | <property stdset="1"> | 289 | <property stdset="1"> |
290 | <name>name</name> | 290 | <name>name</name> |
291 | <cstring>Line1</cstring> | 291 | <cstring>Line1</cstring> |
292 | </property> | 292 | </property> |
293 | <property stdset="1"> | 293 | <property stdset="1"> |
294 | <name>orientation</name> | 294 | <name>orientation</name> |
295 | <enum>Horizontal</enum> | 295 | <enum>Horizontal</enum> |
296 | </property> | 296 | </property> |
297 | </widget> | 297 | </widget> |
298 | <widget row="0" column="0" > | 298 | <widget row="0" column="0" > |
299 | <class>QLabel</class> | 299 | <class>QLabel</class> |
300 | <property stdset="1"> | 300 | <property stdset="1"> |
301 | <name>name</name> | 301 | <name>name</name> |
302 | <cstring>TextLabel1</cstring> | 302 | <cstring>TextLabel1</cstring> |
303 | </property> | 303 | </property> |
304 | <property stdset="1"> | 304 | <property stdset="1"> |
305 | <name>text</name> | 305 | <name>text</name> |
306 | <string>Current Profile</string> | 306 | <string>Current Profile</string> |
307 | </property> | 307 | </property> |
308 | </widget> | 308 | </widget> |
309 | <widget row="4" column="2" > | 309 | <widget row="4" column="2" > |
310 | <class>QPushButton</class> | 310 | <class>QPushButton</class> |
311 | <property stdset="1"> | 311 | <property stdset="1"> |
312 | <name>name</name> | 312 | <name>name</name> |
313 | <cstring>removeProfileButton</cstring> | 313 | <cstring>removeProfileButton</cstring> |
314 | </property> | 314 | </property> |
315 | <property stdset="1"> | 315 | <property stdset="1"> |
316 | <name>text</name> | 316 | <name>text</name> |
317 | <string>&Remove</string> | 317 | <string>&Remove</string> |
318 | </property> | 318 | </property> |
319 | </widget> | 319 | </widget> |
320 | <widget row="3" column="0" rowspan="2" colspan="2" > | 320 | <widget row="3" column="0" rowspan="2" colspan="2" > |
321 | <class>QListBox</class> | 321 | <class>QListBox</class> |
322 | <property stdset="1"> | 322 | <property stdset="1"> |
323 | <name>name</name> | 323 | <name>name</name> |
324 | <cstring>profilesList</cstring> | 324 | <cstring>profilesList</cstring> |
325 | </property> | 325 | </property> |
326 | </widget> | 326 | </widget> |
327 | <spacer row="0" column="2" > | 327 | <spacer row="0" column="2" > |
328 | <property> | 328 | <property> |
329 | <name>name</name> | 329 | <name>name</name> |
330 | <cstring>Spacer2</cstring> | 330 | <cstring>Spacer2</cstring> |
331 | </property> | 331 | </property> |
332 | <property stdset="1"> | 332 | <property stdset="1"> |
333 | <name>orientation</name> | 333 | <name>orientation</name> |
334 | <enum>Horizontal</enum> | 334 | <enum>Horizontal</enum> |
335 | </property> | 335 | </property> |
336 | <property stdset="1"> | 336 | <property stdset="1"> |
337 | <name>sizeType</name> | 337 | <name>sizeType</name> |
338 | <enum>Expanding</enum> | 338 | <enum>Expanding</enum> |
339 | </property> | 339 | </property> |
340 | <property> | 340 | <property> |
341 | <name>sizeHint</name> | 341 | <name>sizeHint</name> |
342 | <size> | 342 | <size> |
343 | <width>20</width> | 343 | <width>20</width> |
344 | <height>20</height> | 344 | <height>20</height> |
345 | </size> | 345 | </size> |
346 | </property> | 346 | </property> |
347 | </spacer> | 347 | </spacer> |
348 | <widget row="2" column="0" > | 348 | <widget row="2" column="0" > |
349 | <class>QLabel</class> | 349 | <class>QLabel</class> |
350 | <property stdset="1"> | 350 | <property stdset="1"> |
351 | <name>name</name> | 351 | <name>name</name> |
352 | <cstring>TextLabel1_2</cstring> | 352 | <cstring>TextLabel1_2</cstring> |
353 | </property> | 353 | </property> |
354 | <property stdset="1"> | 354 | <property stdset="1"> |
355 | <name>text</name> | 355 | <name>text</name> |
356 | <string>Profiles</string> | 356 | <string>Profiles</string> |
357 | </property> | 357 | </property> |
358 | </widget> | 358 | </widget> |
359 | <widget row="6" column="0" rowspan="1" colspan="3" > | 359 | <widget row="6" column="0" rowspan="1" colspan="3" > |
360 | <class>QLayoutWidget</class> | 360 | <class>QLayoutWidget</class> |
361 | <property stdset="1"> | 361 | <property stdset="1"> |
362 | <name>name</name> | 362 | <name>name</name> |
363 | <cstring>Layout6</cstring> | 363 | <cstring>Layout6</cstring> |
364 | </property> | 364 | </property> |
365 | <hbox> | 365 | <hbox> |
366 | <property stdset="1"> | 366 | <property stdset="1"> |
367 | <name>margin</name> | 367 | <name>margin</name> |
368 | <number>0</number> | 368 | <number>0</number> |
369 | </property> | 369 | </property> |
370 | <property stdset="1"> | 370 | <property stdset="1"> |
371 | <name>spacing</name> | 371 | <name>spacing</name> |
372 | <number>6</number> | 372 | <number>6</number> |
373 | </property> | 373 | </property> |
374 | <widget> | 374 | <widget> |
375 | <class>QLabel</class> | 375 | <class>QLabel</class> |
376 | <property stdset="1"> | 376 | <property stdset="1"> |
377 | <name>name</name> | 377 | <name>name</name> |
378 | <cstring>TextLabel1_3</cstring> | 378 | <cstring>TextLabel1_3</cstring> |
379 | </property> | 379 | </property> |
380 | <property stdset="1"> | 380 | <property stdset="1"> |
381 | <name>text</name> | 381 | <name>text</name> |
382 | <string>New Profile</string> | 382 | <string>New Profile</string> |
383 | </property> | 383 | </property> |
384 | </widget> | 384 | </widget> |
385 | <widget> | 385 | <widget> |
386 | <class>QLineEdit</class> | 386 | <class>QLineEdit</class> |
387 | <property stdset="1"> | 387 | <property stdset="1"> |
388 | <name>name</name> | 388 | <name>name</name> |
389 | <cstring>newProfile</cstring> | 389 | <cstring>newProfile</cstring> |
390 | </property> | 390 | </property> |
391 | </widget> | 391 | </widget> |
392 | <widget> | 392 | <widget> |
393 | <class>QPushButton</class> | 393 | <class>QPushButton</class> |
394 | <property stdset="1"> | 394 | <property stdset="1"> |
395 | <name>name</name> | 395 | <name>name</name> |
396 | <cstring>newProfileButton</cstring> | 396 | <cstring>newProfileButton</cstring> |
397 | </property> | 397 | </property> |
398 | <property stdset="1"> | 398 | <property stdset="1"> |
399 | <name>enabled</name> | 399 | <name>enabled</name> |
400 | <bool>false</bool> | 400 | <bool>false</bool> |
401 | </property> | 401 | </property> |
402 | <property stdset="1"> | 402 | <property stdset="1"> |
403 | <name>text</name> | 403 | <name>text</name> |
404 | <string>&Add</string> | 404 | <string>&Add</string> |
405 | </property> | 405 | </property> |
406 | </widget> | 406 | </widget> |
407 | </hbox> | 407 | </hbox> |
408 | </widget> | 408 | </widget> |
409 | </grid> | 409 | </grid> |
410 | </widget> | 410 | </widget> |
411 | </widget> | 411 | </widget> |
412 | </vbox> | 412 | </vbox> |
413 | </widget> | 413 | </widget> |
414 | <customwidgets> | ||
415 | <customwidget> | ||
416 | <class>QWidget</class> | ||
417 | <header location="local">qwidget.h</header> | ||
418 | <sizehint> | ||
419 | <width>100</width> | ||
420 | <height>100</height> | ||
421 | </sizehint> | ||
422 | <container>0</container> | ||
423 | <sizepolicy> | ||
424 | <hordata>7</hordata> | ||
425 | <verdata>7</verdata> | ||
426 | </sizepolicy> | ||
427 | <pixmap>image0</pixmap> | ||
428 | </customwidget> | ||
429 | </customwidgets> | ||
430 | <images> | ||
431 | <image> | ||
432 | <name>image0</name> | ||
433 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | ||
434 | </image> | ||
435 | </images> | ||
436 | <tabstops> | 414 | <tabstops> |
437 | <tabstop>tabWidget</tabstop> | 415 | <tabstop>tabWidget</tabstop> |
438 | <tabstop>connectionList</tabstop> | 416 | <tabstop>connectionList</tabstop> |
439 | <tabstop>informationConnectionButton</tabstop> | 417 | <tabstop>informationConnectionButton</tabstop> |
440 | <tabstop>configureConnectionButton</tabstop> | 418 | <tabstop>configureConnectionButton</tabstop> |
441 | <tabstop>addConnectionButton</tabstop> | 419 | <tabstop>addConnectionButton</tabstop> |
442 | <tabstop>removeConnectionButton</tabstop> | 420 | <tabstop>removeConnectionButton</tabstop> |
443 | <tabstop>profilesList</tabstop> | 421 | <tabstop>profilesList</tabstop> |
444 | <tabstop>setCurrentProfileButton</tabstop> | 422 | <tabstop>setCurrentProfileButton</tabstop> |
445 | <tabstop>removeProfileButton</tabstop> | 423 | <tabstop>removeProfileButton</tabstop> |
446 | <tabstop>newProfile</tabstop> | 424 | <tabstop>newProfile</tabstop> |
447 | <tabstop>newProfileButton</tabstop> | 425 | <tabstop>newProfileButton</tabstop> |
448 | </tabstops> | 426 | </tabstops> |
449 | </UI> | 427 | </UI> |
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 0ddc489..d6b708b 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -1,521 +1,590 @@ | |||
1 | #include "mainwindowimp.h" | 1 | #include "mainwindowimp.h" |
2 | #include "addconnectionimp.h" | 2 | #include "addconnectionimp.h" |
3 | #include "interfaceinformationimp.h" | 3 | #include "interfaceinformationimp.h" |
4 | #include "interfacesetupimp.h" | 4 | #include "interfacesetupimp.h" |
5 | #include "interfaces.h" | 5 | #include "interfaces.h" |
6 | #include "module.h" | 6 | #include "module.h" |
7 | 7 | ||
8 | #include <qpushbutton.h> | 8 | #include <qpushbutton.h> |
9 | #include <qlistbox.h> | 9 | #include <qlistbox.h> |
10 | #include <qlineedit.h> | 10 | #include <qlineedit.h> |
11 | #include <qlistview.h> | 11 | #include <qlistview.h> |
12 | #include <qheader.h> | 12 | #include <qheader.h> |
13 | #include <qlabel.h> | 13 | #include <qlabel.h> |
14 | 14 | ||
15 | #include <qmainwindow.h> | ||
16 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
17 | 16 | ||
18 | #include <qpe/config.h> | 17 | #ifdef QTE_VERSION |
19 | #include <qpe/qlibrary.h> | 18 | #include <qpe/config.h> |
20 | #include <qpe/resource.h> | 19 | #include <qpe/qlibrary.h> |
21 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/resource.h> |
21 | #include <qpe/qpeapplication.h> | ||
22 | #define QLibrary | ||
23 | #else | ||
24 | #include <klibloader.h> | ||
25 | #define QLibrary KLibrary | ||
26 | #include <kconfig.h> | ||
27 | #define Config KConfig | ||
28 | #include <kapplication.h> | ||
29 | #include <kstandarddirs.h> | ||
30 | #include <kiconloader.h> | ||
31 | #define showMaximized show | ||
32 | #endif | ||
22 | 33 | ||
34 | #if QT_VERSION < 300 | ||
23 | #include <qlist.h> | 35 | #include <qlist.h> |
36 | #else | ||
37 | #include <qptrlist.h> | ||
38 | #endif | ||
24 | #include <qdir.h> | 39 | #include <qdir.h> |
25 | #include <qfile.h> | 40 | #include <qfile.h> |
26 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
42 | #include <qregexp.h> | ||
27 | 43 | ||
28 | #include <net/if.h> | 44 | #include <net/if.h> |
29 | #include <sys/ioctl.h> | 45 | #include <sys/ioctl.h> |
30 | 46 | ||
31 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" | 47 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" |
32 | 48 | ||
33 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false), scheme(DEFAULT_SCHEME){ | 49 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name), advancedUserMode(true), scheme(DEFAULT_SCHEME){ |
34 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); | 50 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); |
35 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); | 51 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); |
36 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); | 52 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); |
37 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); | 53 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); |
38 | 54 | ||
39 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); | 55 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); |
40 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); | 56 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); |
41 | connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); | 57 | connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); |
42 | 58 | ||
43 | connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); | 59 | connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); |
44 | // Load connections. | 60 | // Load connections. |
45 | loadModules(QPEApplication::qpeDir() + "/plugins/networksettings"); | 61 | // /usr/local/kde/lib/libinterfaces.la |
62 | #ifdef QTE_VERSION | ||
63 | loadModules(QPEApplication::kdeDir() + "/plugins/networksettings"); | ||
64 | #else | ||
65 | loader = KLibLoader::self(); | ||
66 | loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); | ||
67 | #endif | ||
46 | getAllInterfaces(); | 68 | getAllInterfaces(); |
47 | 69 | ||
48 | Interfaces i; | 70 | Interfaces i; |
49 | QStringList list = i.getInterfaceList(); | 71 | QStringList list = i.getInterfaceList(); |
50 | QMap<QString, Interface*>::Iterator it; | 72 | QMap<QString, Interface*>::Iterator it; |
51 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { | 73 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { |
52 | bool found = false; | 74 | bool found = false; |
53 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ | 75 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ |
54 | if(it.key() == (*ni)) | 76 | if(it.key() == (*ni)) |
55 | found = true; | 77 | found = true; |
56 | } | 78 | } |
57 | if(!found){ | 79 | if(!found){ |
58 | if(!(*ni).contains("_")){ | 80 | if(!(*ni).contains("_")){ |
59 | Interface *i = new Interface(this, *ni, false); | 81 | Interface *i = new Interface(this, *ni, false); |
60 | i->setAttached(false); | 82 | i->setAttached(false); |
61 | i->setHardwareName("Disconnected"); | 83 | i->setHardwareName("Disconnected"); |
62 | interfaceNames.insert(i->getInterfaceName(), i); | 84 | interfaceNames.insert(i->getInterfaceName(), i); |
63 | updateInterface(i); | 85 | updateInterface(i); |
64 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 86 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
65 | } | 87 | } |
66 | } | 88 | } |
67 | } | 89 | } |
68 | 90 | ||
69 | //getInterfaceList(); | 91 | //getInterfaceList(); |
70 | connectionList->header()->hide(); | 92 | connectionList->header()->hide(); |
71 | 93 | ||
72 | Config cfg("NetworkSetup"); | 94 | Config cfg("NetworkSetup"); |
73 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); | 95 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); |
74 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 96 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
75 | profilesList->insertItem((*it)); | 97 | profilesList->insertItem((*it)); |
76 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); | 98 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); |
77 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); | 99 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); |
78 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); | 100 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); |
79 | 101 | ||
80 | QFile file(scheme); | 102 | QFile file(scheme); |
81 | if ( file.open(IO_ReadOnly) ) { // file opened successfully | 103 | if ( file.open(IO_ReadOnly) ) { // file opened successfully |
82 | QTextStream stream( &file ); // use a text stream | 104 | QTextStream stream( &file ); // use a text stream |
83 | while ( !stream.eof() ) { // until end of file... | 105 | while ( !stream.eof() ) { // until end of file... |
84 | QString line = stream.readLine(); // line of text excluding '\n' | 106 | QString line = stream.readLine(); // line of text excluding '\n' |
85 | if(line.contains("SCHEME")){ | 107 | if(line.contains("SCHEME")){ |
86 | line = line.mid(7, line.length()); | 108 | line = line.mid(7, line.length()); |
87 | currentProfileLabel->setText(line); | 109 | currentProfileLabel->setText(line); |
88 | break; | 110 | break; |
89 | } | 111 | } |
90 | } | 112 | } |
91 | file.close(); | 113 | file.close(); |
92 | } | 114 | } |
93 | } | 115 | } |
94 | 116 | ||
95 | /** | 117 | /** |
96 | * Deconstructor. Save profiles. Delete loaded libraries. | 118 | * Deconstructor. Save profiles. Delete loaded libraries. |
97 | */ | 119 | */ |
98 | MainWindowImp::~MainWindowImp(){ | 120 | MainWindowImp::~MainWindowImp(){ |
99 | // Save profiles. | 121 | // Save profiles. |
100 | Config cfg("NetworkSetup"); | 122 | Config cfg("NetworkSetup"); |
101 | cfg.setGroup("General"); | 123 | cfg.setGroup("General"); |
102 | cfg.writeEntry("Profiles", profiles.join(" ")); | 124 | cfg.writeEntry("Profiles", profiles.join(" ")); |
103 | 125 | ||
104 | // Delete all interfaces that don't have owners. | 126 | // Delete all interfaces that don't have owners. |
105 | QMap<Interface*, QListViewItem*>::Iterator iIt; | 127 | QMap<Interface*, QListViewItem*>::Iterator iIt; |
106 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ | 128 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ |
107 | if(iIt.key()->getModuleOwner() == NULL) | 129 | if(iIt.key()->getModuleOwner() == NULL) |
108 | delete iIt.key(); | 130 | delete iIt.key(); |
109 | } | 131 | } |
110 | 132 | ||
133 | #ifdef QTE_VERSION | ||
111 | // Delete Modules and Libraries | 134 | // Delete Modules and Libraries |
112 | QMap<Module*, QLibrary*>::Iterator it; | 135 | QMap<Module*, QLibrary*>::Iterator it; |
113 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 136 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
114 | delete it.key(); | 137 | delete it.key(); |
115 | // I wonder why I can't delete the libraries | 138 | // I wonder why I can't delete the libraries |
116 | // What fucking shit this is. | 139 | // What fucking shit this is. |
117 | //delete it.data(); | 140 | //delete it.data(); |
118 | } | 141 | } |
142 | #else | ||
143 | // klibloader automaticly deletes the libraries for us... | ||
144 | #endif | ||
119 | } | 145 | } |
120 | 146 | ||
121 | /** | 147 | /** |
122 | * Query the kernel for all of the interfaces. | 148 | * Query the kernel for all of the interfaces. |
123 | */ | 149 | */ |
124 | void MainWindowImp::getAllInterfaces(){ | 150 | void MainWindowImp::getAllInterfaces(){ |
125 | int sockfd = socket(AF_INET, SOCK_DGRAM, 0); | 151 | int sockfd = socket(AF_INET, SOCK_DGRAM, 0); |
126 | if(sockfd == -1) | 152 | if(sockfd == -1) |
127 | return; | 153 | return; |
128 | 154 | ||
129 | char buf[8*1024]; | 155 | char buf[8*1024]; |
130 | struct ifconf ifc; | 156 | struct ifconf ifc; |
131 | ifc.ifc_len = sizeof(buf); | 157 | ifc.ifc_len = sizeof(buf); |
132 | ifc.ifc_req = (struct ifreq *) buf; | 158 | ifc.ifc_req = (struct ifreq *) buf; |
133 | int result=ioctl(sockfd, SIOCGIFCONF, &ifc); | 159 | int result=ioctl(sockfd, SIOCGIFCONF, &ifc); |
134 | 160 | ||
135 | for (char* ptr = buf; ptr < buf + ifc.ifc_len; ){ | 161 | for (char* ptr = buf; ptr < buf + ifc.ifc_len; ){ |
136 | struct ifreq *ifr =(struct ifreq *) ptr; | 162 | struct ifreq *ifr =(struct ifreq *) ptr; |
137 | int len = sizeof(struct sockaddr); | 163 | int len = sizeof(struct sockaddr); |
138 | #ifdef HAVE_SOCKADDR_SA_LEN | 164 | #ifdef HAVE_SOCKADDR_SA_LEN |
139 | if (ifr->ifr_addr.sa_len > len) | 165 | if (ifr->ifr_addr.sa_len > len) |
140 | len = ifr->ifr_addr.sa_len; /* length > 16 */ | 166 | len = ifr->ifr_addr.sa_len; /* length > 16 */ |
141 | #endif | 167 | #endif |
142 | ptr += sizeof(ifr->ifr_name) + len; /* for next one in buffer */ | 168 | ptr += sizeof(ifr->ifr_name) + len; /* for next one in buffer */ |
143 | 169 | ||
144 | int flags; | 170 | int flags; |
145 | struct sockaddr_in *sinptr; | 171 | struct sockaddr_in *sinptr; |
146 | Interface *i = NULL; | 172 | Interface *i = NULL; |
147 | switch (ifr->ifr_addr.sa_family){ | 173 | switch (ifr->ifr_addr.sa_family){ |
148 | case AF_INET: | 174 | case AF_INET: |
149 | sinptr = (struct sockaddr_in *) &ifr->ifr_addr; | 175 | sinptr = (struct sockaddr_in *) &ifr->ifr_addr; |
150 | flags=0; | 176 | flags=0; |
151 | 177 | ||
152 | struct ifreq ifcopy; | 178 | struct ifreq ifcopy; |
153 | ifcopy=*ifr; | 179 | ifcopy=*ifr; |
154 | result=ioctl(sockfd,SIOCGIFFLAGS,&ifcopy); | 180 | result=ioctl(sockfd,SIOCGIFFLAGS,&ifcopy); |
155 | flags=ifcopy.ifr_flags; | 181 | flags=ifcopy.ifr_flags; |
156 | i = new Interface(this, ifr->ifr_name, false); | 182 | i = new Interface(this, ifr->ifr_name, false); |
157 | i->setAttached(true); | 183 | i->setAttached(true); |
158 | if ((flags & IFF_UP) == IFF_UP) | 184 | if ((flags & IFF_UP) == IFF_UP) |
159 | i->setStatus(true); | 185 | i->setStatus(true); |
160 | else | 186 | else |
161 | i->setStatus(false); | 187 | i->setStatus(false); |
162 | 188 | ||
163 | if ((flags & IFF_BROADCAST) == IFF_BROADCAST) | 189 | if ((flags & IFF_BROADCAST) == IFF_BROADCAST) |
164 | i->setHardwareName("Ethernet"); | 190 | i->setHardwareName("Ethernet"); |
165 | else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) | 191 | else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) |
166 | i->setHardwareName("Point to Point"); | 192 | i->setHardwareName("Point to Point"); |
167 | else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) | 193 | else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) |
168 | i->setHardwareName("Multicast"); | 194 | i->setHardwareName("Multicast"); |
169 | else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) | 195 | else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) |
170 | i->setHardwareName("Loopback"); | 196 | i->setHardwareName("Loopback"); |
171 | else | 197 | else |
172 | i->setHardwareName("Unknown"); | 198 | i->setHardwareName("Unknown"); |
173 | 199 | ||
174 | interfaceNames.insert(i->getInterfaceName(), i); | 200 | interfaceNames.insert(i->getInterfaceName(), i); |
175 | updateInterface(i); | 201 | updateInterface(i); |
176 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 202 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
177 | break; | 203 | break; |
178 | 204 | ||
179 | default: | 205 | default: |
180 | qDebug(ifr->ifr_name); | 206 | qDebug(ifr->ifr_name); |
181 | qDebug(QString("%1").arg(ifr->ifr_addr.sa_family).latin1()); | 207 | qDebug(QString("%1").arg(ifr->ifr_addr.sa_family).latin1()); |
182 | break; | 208 | break; |
183 | } | 209 | } |
184 | } | 210 | } |
185 | } | 211 | } |
186 | 212 | ||
187 | /** | 213 | /** |
188 | * Load all modules that are found in the path | 214 | * Load all modules that are found in the path |
189 | * @param path a directory that is scaned for any plugins that can be loaded | 215 | * @param path a directory that is scaned for any plugins that can be loaded |
190 | * and attempts to load them | 216 | * and attempts to load them |
191 | */ | 217 | */ |
192 | void MainWindowImp::loadModules(const QString &path){ | 218 | void MainWindowImp::loadModules(const QString &path){ |
193 | //qDebug(path.latin1()); | 219 | #ifdef DEBUG |
220 | qDebug("MainWindowImp::loadModules: %s", path.latin1()); | ||
221 | #endif | ||
194 | QDir d(path); | 222 | QDir d(path); |
195 | if(!d.exists()) | 223 | if(!d.exists()) |
196 | return; | 224 | return; |
197 | 225 | ||
198 | // Don't want sym links | 226 | // Don't want sym links |
199 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 227 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
200 | const QFileInfoList *list = d.entryInfoList(); | 228 | const QFileInfoList *list = d.entryInfoList(); |
201 | QFileInfoListIterator it( *list ); | 229 | QFileInfoListIterator it( *list ); |
202 | QFileInfo *fi; | 230 | QFileInfo *fi; |
203 | while ( (fi=it.current()) ) { | 231 | while ( (fi=it.current()) ) { |
204 | if(fi->fileName().contains(".so")){ | 232 | if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")){ |
205 | loadPlugin(path + "/" + fi->fileName()); | 233 | loadPlugin(path + "/" + fi->fileName()); |
206 | } | 234 | } |
207 | ++it; | 235 | ++it; |
208 | } | 236 | } |
209 | } | 237 | } |
210 | 238 | ||
211 | /** | 239 | /** |
212 | * Attempt to load a function and resolve a function. | 240 | * Attempt to load a function and resolve a function. |
213 | * @param pluginFileName - the name of the file in which to attempt to load | 241 | * @param pluginFileName - the name of the file in which to attempt to load |
214 | * @param resolveString - function pointer to resolve | 242 | * @param resolveString - function pointer to resolve |
215 | * @return pointer to the function with name resolveString or NULL | 243 | * @return pointer to the function with name resolveString or NULL |
216 | */ | 244 | */ |
217 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){ | 245 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){ |
218 | //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); | 246 | #ifdef DEBUG |
247 | qDebug("MainWindowImp::loadPlugin: %s", pluginFileName.latin1()); | ||
248 | #endif | ||
249 | #ifdef QTE_VERSION | ||
219 | QLibrary *lib = new QLibrary(pluginFileName); | 250 | QLibrary *lib = new QLibrary(pluginFileName); |
220 | void *functionPointer = lib->resolve(resolveString); | 251 | void *functionPointer = lib->resolve(resolveString); |
221 | if( !functionPointer ){ | 252 | if( !functionPointer ){ |
222 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 253 | #ifdef DEBUG |
254 | qDebug("MainWindowImp::loadPlugin: File: %s is not a plugin, but though was.", pluginFileName.latin1()); | ||
255 | #endif | ||
223 | delete lib; | 256 | delete lib; |
224 | return NULL; | 257 | return NULL; |
225 | } | 258 | } |
226 | |||
227 | // Try to get an object. | 259 | // Try to get an object. |
228 | Module *object = ((Module* (*)()) functionPointer)(); | 260 | Module *object = ((Module* (*)()) functionPointer)(); |
229 | if(object == NULL){ | 261 | if(object == NULL){ |
262 | #ifdef DEBUG | ||
230 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 263 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
264 | #endif | ||
231 | delete lib; | 265 | delete lib; |
232 | return NULL; | 266 | return NULL; |
233 | } | 267 | } |
234 | 268 | ||
235 | // Store for deletion later | 269 | // Store for deletion later |
236 | libraries.insert(object, lib); | 270 | libraries.insert(object, lib); |
237 | return object; | 271 | return object; |
272 | |||
273 | #else | ||
274 | QLibrary *lib = loader->library(pluginFileName); | ||
275 | if( !lib || !lib->hasSymbol(resolveString) ){ | ||
276 | #ifdef DEBUG | ||
277 | qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | ||
278 | #endif | ||
279 | return NULL; | ||
280 | } | ||
281 | // Try to get an object. | ||
282 | Module *object = ((Module* (*)()) lib->symbol(resolveString))(); | ||
283 | if(object == NULL){ | ||
284 | #ifdef DEBUG | ||
285 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | ||
286 | #endif | ||
287 | return NULL; | ||
288 | } | ||
289 | #ifdef DEBUG | ||
290 | qDebug("MainWindowImp::loadPlugin:: Found object, storing."); | ||
291 | #endif | ||
292 | // Store for deletion later | ||
293 | libraries.insert(object, lib); | ||
294 | return object; | ||
295 | #endif | ||
238 | } | 296 | } |
239 | 297 | ||
240 | /** | 298 | /** |
241 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 299 | * The Add button was clicked. Bring up the add dialog and if OK is hit |
242 | * load the plugin and append it to the list | 300 | * load the plugin and append it to the list |
243 | */ | 301 | */ |
244 | void MainWindowImp::addClicked(){ | 302 | void MainWindowImp::addClicked(){ |
245 | QMap<Module*, QLibrary*>::Iterator it; | 303 | QMap<Module*, QLibrary*>::Iterator it; |
246 | QMap<QString, QString> list; | 304 | QMap<QString, QString> list; |
247 | QMap<QString, Module*> newInterfaceOwners; | 305 | QMap<QString, Module*> newInterfaceOwners; |
248 | //list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); | 306 | //list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); |
249 | //list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port"); | 307 | //list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port"); |
250 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 308 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
251 | if(it.key()){ | 309 | if(it.key()){ |
252 | (it.key())->possibleNewInterfaces(list); | 310 | (it.key())->possibleNewInterfaces(list); |
253 | } | 311 | } |
254 | } | 312 | } |
255 | // See if the list has anything that we can add. | 313 | // See if the list has anything that we can add. |
256 | if(list.count() == 0){ | 314 | if(list.count() == 0){ |
257 | QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok); | 315 | QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok); |
258 | return; | 316 | return; |
259 | } | 317 | } |
260 | AddConnectionImp addNewConnection(this, "AddConnectionImp", true); | 318 | AddConnectionImp addNewConnection(this, "AddConnectionImp", true); |
261 | addNewConnection.addConnections(list); | 319 | addNewConnection.addConnections(list); |
262 | addNewConnection.showMaximized(); | 320 | addNewConnection.showMaximized(); |
263 | if(QDialog::Accepted == addNewConnection.exec()){ | 321 | if(QDialog::Accepted == addNewConnection.exec()){ |
264 | QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); | 322 | QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); |
265 | if(!item) | 323 | if(!item) |
266 | return; | 324 | return; |
267 | 325 | ||
268 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 326 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
269 | if(it.key()){ | 327 | if(it.key()){ |
270 | Interface *i = (it.key())->addNewInterface(item->text(0)); | 328 | Interface *i = (it.key())->addNewInterface(item->text(0)); |
271 | if(i){ | 329 | if(i){ |
272 | interfaceNames.insert(i->getInterfaceName(), i); | 330 | interfaceNames.insert(i->getInterfaceName(), i); |
273 | updateInterface(i); | 331 | updateInterface(i); |
274 | } | 332 | } |
275 | } | 333 | } |
276 | } | 334 | } |
277 | } | 335 | } |
278 | } | 336 | } |
279 | 337 | ||
280 | /** | 338 | /** |
281 | * Prompt the user to see if they really want to do this. | 339 | * Prompt the user to see if they really want to do this. |
282 | * If they do then remove from the list and unload. | 340 | * If they do then remove from the list and unload. |
283 | */ | 341 | */ |
284 | void MainWindowImp::removeClicked(){ | 342 | void MainWindowImp::removeClicked(){ |
285 | QListViewItem *item = connectionList->currentItem(); | 343 | QListViewItem *item = connectionList->currentItem(); |
286 | if(!item) { | 344 | if(!item) { |
287 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); | 345 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |
288 | return; | 346 | return; |
289 | } | 347 | } |
290 | 348 | ||
291 | Interface *i = interfaceItems[item]; | 349 | Interface *i = interfaceItems[item]; |
292 | if(i->getModuleOwner() == NULL){ | 350 | if(i->getModuleOwner() == NULL){ |
293 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); | 351 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); |
294 | } | 352 | } |
295 | else{ | 353 | else{ |
296 | if(!i->getModuleOwner()->remove(i)) | 354 | if(!i->getModuleOwner()->remove(i)) |
297 | QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok); | 355 | QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok); |
298 | else{ | 356 | else{ |
299 | QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); | 357 | QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); |
300 | // TODO memory managment.... | 358 | // TODO memory managment.... |
301 | // who deletes the interface? | 359 | // who deletes the interface? |
302 | } | 360 | } |
303 | } | 361 | } |
304 | } | 362 | } |
305 | 363 | ||
306 | /** | 364 | /** |
307 | * Pull up the configure about the currently selected interface. | 365 | * Pull up the configure about the currently selected interface. |
308 | * Report an error if no interface is selected. | 366 | * Report an error if no interface is selected. |
309 | * If the interface has a module owner then request its configure. | 367 | * If the interface has a module owner then request its configure. |
310 | */ | 368 | */ |
311 | void MainWindowImp::configureClicked(){ | 369 | void MainWindowImp::configureClicked(){ |
312 | QListViewItem *item = connectionList->currentItem(); | 370 | QListViewItem *item = connectionList->currentItem(); |
313 | if(!item){ | 371 | if(!item){ |
314 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); | 372 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); |
315 | return; | 373 | return; |
316 | } | 374 | } |
317 | 375 | ||
318 | Interface *i = interfaceItems[item]; | 376 | Interface *i = interfaceItems[item]; |
319 | if(i->getModuleOwner()){ | 377 | if(i->getModuleOwner()){ |
320 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i); | 378 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i); |
321 | if(moduleConfigure != NULL){ | 379 | if(moduleConfigure != NULL){ |
322 | moduleConfigure->showMaximized(); | 380 | moduleConfigure->showMaximized(); |
323 | return; | 381 | return; |
324 | } | 382 | } |
325 | } | 383 | } |
326 | 384 | ||
327 | InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose); | 385 | InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WShowModal | Qt::WDestructiveClose | Qt::WType_Dialog); |
328 | QString currentProfileText = currentProfileLabel->text(); | 386 | QString currentProfileText = currentProfileLabel->text(); |
329 | if(currentProfileText.upper() == "ALL"); | 387 | if(currentProfileText.upper() == "ALL"); |
330 | currentProfileText = ""; | 388 | currentProfileText = ""; |
331 | configure->setProfile(currentProfileText); | 389 | configure->setProfile(currentProfileText); |
332 | configure->showMaximized(); | 390 | configure->showMaximized(); |
333 | } | 391 | } |
334 | 392 | ||
335 | /** | 393 | /** |
336 | * Pull up the information about the currently selected interface. | 394 | * Pull up the information about the currently selected interface. |
337 | * Report an error if no interface is selected. | 395 | * Report an error if no interface is selected. |
338 | * If the interface has a module owner then request its configure. | 396 | * If the interface has a module owner then request its configure. |
339 | */ | 397 | */ |
340 | void MainWindowImp::informationClicked(){ | 398 | void MainWindowImp::informationClicked(){ |
341 | QListViewItem *item = connectionList->currentItem(); | 399 | QListViewItem *item = connectionList->currentItem(); |
342 | if(!item){ | 400 | if(!item){ |
343 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); | 401 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |
344 | return; | 402 | return; |
345 | } | 403 | } |
346 | 404 | ||
347 | Interface *i = interfaceItems[item]; | 405 | Interface *i = interfaceItems[item]; |
348 | if(!i->isAttached()){ | 406 | if(!i->isAttached()){ |
349 | QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); | 407 | QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); |
350 | return; | 408 | return; |
351 | } | 409 | } |
352 | 410 | ||
353 | if(i->getModuleOwner()){ | 411 | if(i->getModuleOwner()){ |
354 | QWidget *moduleInformation = i->getModuleOwner()->information(i); | 412 | QWidget *moduleInformation = i->getModuleOwner()->information(i); |
355 | if(moduleInformation != NULL){ | 413 | if(moduleInformation != NULL){ |
356 | moduleInformation->showMaximized(); | 414 | moduleInformation->showMaximized(); |
415 | #ifdef DEBUG | ||
416 | qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); | ||
417 | #endif | ||
357 | return; | 418 | return; |
358 | } | 419 | } |
359 | } | 420 | } |
360 | InterfaceInformationImp information(0, "InterfaceSetupImp", i); | 421 | InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WShowModal | Qt::WDestructiveClose | Qt::WType_Dialog); |
361 | information.showMaximized(); | 422 | information->showMaximized(); |
362 | } | 423 | } |
363 | 424 | ||
364 | /** | 425 | /** |
365 | * Update this interface. If no QListViewItem exists create one. | 426 | * Update this interface. If no QListViewItem exists create one. |
366 | * @param Interface* pointer to the interface that needs to be updated. | 427 | * @param Interface* pointer to the interface that needs to be updated. |
367 | */ | 428 | */ |
368 | void MainWindowImp::updateInterface(Interface *i){ | 429 | void MainWindowImp::updateInterface(Interface *i){ |
369 | if(!advancedUserMode){ | 430 | if(!advancedUserMode){ |
370 | if(i->getInterfaceName() == "lo") | 431 | if(i->getInterfaceName() == "lo") |
371 | return; | 432 | return; |
372 | } | 433 | } |
373 | 434 | ||
374 | QListViewItem *item = NULL; | 435 | QListViewItem *item = NULL; |
375 | 436 | ||
376 | // Find the interface, making it if needed. | 437 | // Find the interface, making it if needed. |
377 | if(items.find(i) == items.end()){ | 438 | if(items.find(i) == items.end()){ |
378 | item = new QListViewItem(connectionList, "", "", ""); | 439 | item = new QListViewItem(connectionList, "", "", ""); |
379 | // See if you can't find a module owner for this interface | 440 | // See if you can't find a module owner for this interface |
380 | QMap<Module*, QLibrary*>::Iterator it; | 441 | QMap<Module*, QLibrary*>::Iterator it; |
381 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 442 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
382 | if(it.key()->isOwner(i)) | 443 | if(it.key()->isOwner(i)) |
383 | i->setModuleOwner(it.key()); | 444 | i->setModuleOwner(it.key()); |
384 | } | 445 | } |
385 | items.insert(i, item); | 446 | items.insert(i, item); |
386 | interfaceItems.insert(item, i); | 447 | interfaceItems.insert(item, i); |
387 | } | 448 | } |
388 | else | 449 | else |
389 | item = items[i]; | 450 | item = items[i]; |
390 | 451 | ||
391 | // Update the icons and information | 452 | // Update the icons and information |
453 | #ifdef QTE_VERSION | ||
392 | item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); | 454 | item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); |
393 | 455 | #else | |
456 | item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down"))); | ||
457 | #endif | ||
458 | |||
394 | QString typeName = "lan"; | 459 | QString typeName = "lan"; |
395 | if(i->getHardwareName().contains("Local Loopback")) | 460 | if(i->getHardwareName().contains("Local Loopback")) |
396 | typeName = "lo"; | 461 | typeName = "lo"; |
397 | if(i->getInterfaceName().contains("irda")) | 462 | if(i->getInterfaceName().contains("irda")) |
398 | typeName = "irda"; | 463 | typeName = "irda"; |
399 | if(i->getInterfaceName().contains("wlan")) | 464 | if(i->getInterfaceName().contains("wlan")) |
400 | typeName = "wlan"; | 465 | typeName = "wlan"; |
401 | if(i->getInterfaceName().contains("usb")) | 466 | if(i->getInterfaceName().contains("usb")) |
402 | typeName = "usb"; | 467 | typeName = "usb"; |
403 | 468 | ||
404 | if(!i->isAttached()) | 469 | if(!i->isAttached()) |
405 | typeName = "connect_no"; | 470 | typeName = "connect_no"; |
406 | // Actually try to use the Module | 471 | // Actually try to use the Module |
407 | if(i->getModuleOwner() != NULL) | 472 | if(i->getModuleOwner() != NULL) |
408 | typeName = i->getModuleOwner()->getPixmapName(i); | 473 | typeName = i->getModuleOwner()->getPixmapName(i); |
409 | 474 | ||
475 | #ifdef QTE_VERSION | ||
410 | item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); | 476 | item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); |
477 | #else | ||
478 | item->setPixmap(1, (SmallIcon(typeName))); | ||
479 | #endif | ||
411 | item->setText(2, i->getHardwareName()); | 480 | item->setText(2, i->getHardwareName()); |
412 | item->setText(3, QString("(%1)").arg(i->getInterfaceName())); | 481 | item->setText(3, QString("(%1)").arg(i->getInterfaceName())); |
413 | item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); | 482 | item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); |
414 | } | 483 | } |
415 | 484 | ||
416 | void MainWindowImp::newProfileChanged(const QString& newText){ | 485 | void MainWindowImp::newProfileChanged(const QString& newText){ |
417 | if(newText.length() > 0) | 486 | if(newText.length() > 0) |
418 | newProfileButton->setEnabled(true); | 487 | newProfileButton->setEnabled(true); |
419 | else | 488 | else |
420 | newProfileButton->setEnabled(false); | 489 | newProfileButton->setEnabled(false); |
421 | } | 490 | } |
422 | 491 | ||
423 | /** | 492 | /** |
424 | * Adds a new profile to the list of profiles. | 493 | * Adds a new profile to the list of profiles. |
425 | * Don't add profiles that already exists. | 494 | * Don't add profiles that already exists. |
426 | * Appends to the list and QStringList | 495 | * Appends to the list and QStringList |
427 | */ | 496 | */ |
428 | void MainWindowImp::addProfile(){ | 497 | void MainWindowImp::addProfile(){ |
429 | QString newProfileName = newProfile->text(); | 498 | QString newProfileName = newProfile->text(); |
430 | if(profiles.grep(newProfileName).count() > 0){ | 499 | if(profiles.grep(newProfileName).count() > 0){ |
431 | QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); | 500 | QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); |
432 | return; | 501 | return; |
433 | } | 502 | } |
434 | profiles.append(newProfileName); | 503 | profiles.append(newProfileName); |
435 | profilesList->insertItem(newProfileName); | 504 | profilesList->insertItem(newProfileName); |
436 | } | 505 | } |
437 | 506 | ||
438 | /** | 507 | /** |
439 | * Removes the currently selected profile in the combo. | 508 | * Removes the currently selected profile in the combo. |
440 | * Doesn't delete if there are less then 2 profiles. | 509 | * Doesn't delete if there are less then 2 profiles. |
441 | */ | 510 | */ |
442 | void MainWindowImp::removeProfile(){ | 511 | void MainWindowImp::removeProfile(){ |
443 | if(profilesList->count() <= 1){ | 512 | if(profilesList->count() <= 1){ |
444 | QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok); | 513 | QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok); |
445 | return; | 514 | return; |
446 | } | 515 | } |
447 | QString profileToRemove = profilesList->currentText(); | 516 | QString profileToRemove = profilesList->currentText(); |
448 | if(profileToRemove == "All"){ | 517 | if(profileToRemove == "All"){ |
449 | QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok); | 518 | QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok); |
450 | return; | 519 | return; |
451 | } | 520 | } |
452 | // Can't remove the curent profile | 521 | // Can't remove the curent profile |
453 | if(profileToRemove == currentProfileLabel->text()){ | 522 | if(profileToRemove == currentProfileLabel->text()){ |
454 | QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok); | 523 | QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok); |
455 | return; | 524 | return; |
456 | 525 | ||
457 | } | 526 | } |
458 | 527 | ||
459 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ | 528 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ |
460 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); | 529 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); |
461 | profilesList->clear(); | 530 | profilesList->clear(); |
462 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 531 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
463 | profilesList->insertItem((*it)); | 532 | profilesList->insertItem((*it)); |
464 | 533 | ||
465 | // Remove any interface settings and mappings. | 534 | // Remove any interface settings and mappings. |
466 | Interfaces interfaces; | 535 | Interfaces interfaces; |
467 | // Go through them one by one | 536 | // Go through them one by one |
468 | QMap<Interface*, QListViewItem*>::Iterator it; | 537 | QMap<Interface*, QListViewItem*>::Iterator it; |
469 | for( it = items.begin(); it != items.end(); ++it ){ | 538 | for( it = items.begin(); it != items.end(); ++it ){ |
470 | QString interfaceName = it.key()->getInterfaceName(); | 539 | QString interfaceName = it.key()->getInterfaceName(); |
471 | qDebug(interfaceName.latin1()); | 540 | qDebug(interfaceName.latin1()); |
472 | if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){ | 541 | if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){ |
473 | interfaces.removeInterface(); | 542 | interfaces.removeInterface(); |
474 | if(interfaces.setMapping(interfaceName)){ | 543 | if(interfaces.setMapping(interfaceName)){ |
475 | if(profilesList->count() == 1) | 544 | if(profilesList->count() == 1) |
476 | interfaces.removeMapping(); | 545 | interfaces.removeMapping(); |
477 | else{ | 546 | else{ |
478 | interfaces.removeMap("map", interfaceName + "_" + profileToRemove); | 547 | interfaces.removeMap("map", interfaceName + "_" + profileToRemove); |
479 | } | 548 | } |
480 | } | 549 | } |
481 | interfaces.write(); | 550 | interfaces.write(); |
482 | break; | 551 | break; |
483 | } | 552 | } |
484 | } | 553 | } |
485 | } | 554 | } |
486 | } | 555 | } |
487 | 556 | ||
488 | /** | 557 | /** |
489 | * A new profile has been selected, change. | 558 | * A new profile has been selected, change. |
490 | * @param newProfile the new profile. | 559 | * @param newProfile the new profile. |
491 | */ | 560 | */ |
492 | void MainWindowImp::changeProfile(){ | 561 | void MainWindowImp::changeProfile(){ |
493 | if(profilesList->currentItem() == -1){ | 562 | if(profilesList->currentItem() == -1){ |
494 | QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); | 563 | QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); |
495 | return; | 564 | return; |
496 | } | 565 | } |
497 | QString newProfile = profilesList->text(profilesList->currentItem()); | 566 | QString newProfile = profilesList->text(profilesList->currentItem()); |
498 | if(newProfile != currentProfileLabel->text()){ | 567 | if(newProfile != currentProfileLabel->text()){ |
499 | currentProfileLabel->setText(newProfile); | 568 | currentProfileLabel->setText(newProfile); |
500 | QFile::remove(scheme); | 569 | QFile::remove(scheme); |
501 | QFile file(scheme); | 570 | QFile file(scheme); |
502 | if ( file.open(IO_ReadWrite) ) { | 571 | if ( file.open(IO_ReadWrite) ) { |
503 | QTextStream stream( &file ); | 572 | QTextStream stream( &file ); |
504 | stream << QString("SCHEME=%1").arg(newProfile); | 573 | stream << QString("SCHEME=%1").arg(newProfile); |
505 | file.close(); | 574 | file.close(); |
506 | } | 575 | } |
507 | // restart all up devices? | 576 | // restart all up devices? |
508 | if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ | 577 | if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ |
509 | // Go through them one by one | 578 | // Go through them one by one |
510 | QMap<Interface*, QListViewItem*>::Iterator it; | 579 | QMap<Interface*, QListViewItem*>::Iterator it; |
511 | for( it = items.begin(); it != items.end(); ++it ){ | 580 | for( it = items.begin(); it != items.end(); ++it ){ |
512 | if(it.key()->getStatus() == true) | 581 | if(it.key()->getStatus() == true) |
513 | it.key()->restart(); | 582 | it.key()->restart(); |
514 | } | 583 | } |
515 | } | 584 | } |
516 | } | 585 | } |
517 | // TODO change the profile in the modules | 586 | // TODO change the profile in the modules |
518 | } | 587 | } |
519 | 588 | ||
520 | // mainwindowimp.cpp | 589 | // mainwindowimp.cpp |
521 | 590 | ||
diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h index 4f09d6c..2ebf304 100644 --- a/noncore/settings/networksettings/mainwindowimp.h +++ b/noncore/settings/networksettings/mainwindowimp.h | |||
@@ -1,58 +1,69 @@ | |||
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 | #ifdef QTE_VERSION | ||
13 | class QLibrary; | ||
14 | #else | ||
15 | class KLibrary; | ||
16 | class KLibLoader; | ||
17 | #define QLibrary KLibrary | ||
18 | #endif | ||
19 | |||
12 | 20 | ||
13 | class MainWindowImp : public MainWindow { | 21 | class MainWindowImp : public MainWindow { |
14 | Q_OBJECT | 22 | Q_OBJECT |
15 | 23 | ||
16 | public: | 24 | public: |
17 | MainWindowImp(QWidget *parent=0, const char *name=0); | 25 | MainWindowImp(QWidget *parent=0, const char *name=0); |
18 | ~MainWindowImp(); | 26 | ~MainWindowImp(); |
19 | 27 | ||
20 | private slots: | 28 | private slots: |
21 | void getAllInterfaces(); | 29 | void getAllInterfaces(); |
22 | 30 | ||
23 | void addClicked(); | 31 | void addClicked(); |
24 | void removeClicked(); | 32 | void removeClicked(); |
25 | void configureClicked(); | 33 | void configureClicked(); |
26 | void informationClicked(); | 34 | void informationClicked(); |
27 | 35 | ||
28 | void addProfile(); | 36 | void addProfile(); |
29 | void removeProfile(); | 37 | void removeProfile(); |
30 | void changeProfile(); | 38 | void changeProfile(); |
31 | 39 | ||
32 | void updateInterface(Interface *i); | 40 | void updateInterface(Interface *i); |
33 | void newProfileChanged(const QString& newText); | 41 | void newProfileChanged(const QString& newText); |
34 | 42 | ||
35 | private: | 43 | private: |
36 | void loadModules(const QString &path); | 44 | void loadModules(const QString &path); |
37 | 45 | ||
38 | Module* loadPlugin(const QString &pluginFileName, | 46 | Module* loadPlugin(const QString &pluginFileName, |
39 | const QString &resolveString = "create_plugin"); | 47 | const QString &resolveString = "create_plugin"); |
40 | 48 | ||
41 | // For our local list of names | 49 | // For our local list of names |
42 | QMap<QString, Interface*> interfaceNames; | 50 | QMap<QString, Interface*> interfaceNames; |
43 | 51 | ||
44 | QMap<Module*, QLibrary*> libraries; | 52 | QMap<Module*, QLibrary*> libraries; |
45 | QMap<Interface*, QListViewItem*> items; | 53 | QMap<Interface*, QListViewItem*> items; |
46 | QMap<QListViewItem*, Interface*> interfaceItems; | 54 | QMap<QListViewItem*, Interface*> interfaceItems; |
47 | 55 | ||
48 | QMap<KProcess*, QString> threads; | 56 | QMap<KProcess*, QString> threads; |
49 | QStringList profiles; | 57 | QStringList profiles; |
50 | 58 | ||
51 | bool advancedUserMode; | 59 | bool advancedUserMode; |
52 | QString scheme; | 60 | QString scheme; |
61 | #ifndef QTE_VERSION | ||
62 | KLibLoader *loader; | ||
63 | #endif | ||
53 | }; | 64 | }; |
54 | 65 | ||
55 | #endif | 66 | #endif |
56 | 67 | ||
57 | // mainwindowimp.h | 68 | // mainwindowimp.h |
58 | 69 | ||
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h index 2e6272b..46a3c77 100644 --- a/noncore/settings/networksettings/module.h +++ b/noncore/settings/networksettings/module.h | |||
@@ -1,86 +1,90 @@ | |||
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 | #if QT_VERSION < 300 | ||
5 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | #else | ||
8 | #include <qptrlist.h> | ||
9 | #endif | ||
6 | #include <qmap.h> | 10 | #include <qmap.h> |
7 | #include "interface.h" | 11 | #include "interface.h" |
8 | 12 | ||
9 | class QWidget; | 13 | class QWidget; |
10 | class QTabWidget; | 14 | class QTabWidget; |
11 | 15 | ||
12 | class Module : QObject{ | 16 | class Module : QObject{ |
13 | 17 | ||
14 | signals: | 18 | signals: |
15 | void updateInterface(Interface *i); | 19 | void updateInterface(Interface *i); |
16 | 20 | ||
17 | public: | 21 | public: |
18 | Module(){}; | 22 | Module(){}; |
19 | 23 | ||
20 | /** | 24 | /** |
21 | * The current profile has been changed and the module should do any | 25 | * The current profile has been changed and the module should do any |
22 | * neccesary changes also. | 26 | * neccesary changes also. |
23 | * @param newProfile what the profile should be changed to. | 27 | * @param newProfile what the profile should be changed to. |
24 | */ | 28 | */ |
25 | virtual void setProfile(const QString &newProfile) = 0; | 29 | virtual void setProfile(const QString &newProfile) = 0; |
26 | 30 | ||
27 | /** | 31 | /** |
28 | * get the icon name for this device. | 32 | * get the icon name for this device. |
29 | * @param Interface* can be used in determining the icon. | 33 | * @param Interface* can be used in determining the icon. |
30 | * @return QString the icon name (minus .png, .gif etc) | 34 | * @return QString the icon name (minus .png, .gif etc) |
31 | */ | 35 | */ |
32 | virtual QString getPixmapName(Interface *) = 0; | 36 | virtual QString getPixmapName(Interface *) = 0; |
33 | 37 | ||
34 | /** | 38 | /** |
35 | * Check to see if the interface i is owned by this module. | 39 | * Check to see if the interface i is owned by this module. |
36 | * @param Interface* interface to check against | 40 | * @param Interface* interface to check against |
37 | * @return bool true if i is owned by this module, false otherwise. | 41 | * @return bool true if i is owned by this module, false otherwise. |
38 | */ | 42 | */ |
39 | virtual bool isOwner(Interface *){ return false; }; | 43 | virtual bool isOwner(Interface *){ return false; }; |
40 | 44 | ||
41 | /** | 45 | /** |
42 | * Create and return the WLANConfigure Module | 46 | * Create and return the WLANConfigure Module |
43 | * @param Interface *i the interface to configure. | 47 | * @param Interface *i the interface to configure. |
44 | * @return QWidget* pointer to this modules configure. | 48 | * @return QWidget* pointer to this modules configure. |
45 | */ | 49 | */ |
46 | virtual QWidget *configure(Interface *){ return NULL; } ; | 50 | virtual QWidget *configure(Interface *){ return NULL; } ; |
47 | 51 | ||
48 | /** | 52 | /** |
49 | * Create, and return the Information Module | 53 | * Create, and return the Information Module |
50 | * @param Interface *i the interface to get info on. | 54 | * @param Interface *i the interface to get info on. |
51 | * @return QWidget* pointer to this modules info. | 55 | * @return QWidget* pointer to this modules info. |
52 | */ | 56 | */ |
53 | virtual QWidget *information(Interface *){ return NULL; }; | 57 | virtual QWidget *information(Interface *){ return NULL; }; |
54 | 58 | ||
55 | /** | 59 | /** |
56 | * Get all active (up or down) interfaces | 60 | * Get all active (up or down) interfaces |
57 | * @return QList<Interface> A list of interfaces that exsist that havn't | 61 | * @return QList<Interface> A list of interfaces that exsist that havn't |
58 | * been called by isOwner() | 62 | * been called by isOwner() |
59 | */ | 63 | */ |
60 | virtual QList<Interface> getInterfaces() = 0; | 64 | virtual QList<Interface> getInterfaces() = 0; |
61 | 65 | ||
62 | /** | 66 | /** |
63 | * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp), | 67 | * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp), |
64 | * modem ppp) | 68 | * modem ppp) |
65 | */ | 69 | */ |
66 | virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0; | 70 | virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0; |
67 | 71 | ||
68 | /** | 72 | /** |
69 | * Attempts to create a new interface from name | 73 | * Attempts to create a new interface from name |
70 | * @return Interface* NULL if it was unable to be created. | 74 | * @return Interface* NULL if it was unable to be created. |
71 | * @param name the type of interface to create | 75 | * @param name the type of interface to create |
72 | */ | 76 | */ |
73 | virtual Interface *addNewInterface(const QString &name) = 0; | 77 | virtual Interface *addNewInterface(const QString &name) = 0; |
74 | 78 | ||
75 | /** | 79 | /** |
76 | * Attempts to remove the interface, doesn't delete i | 80 | * Attempts to remove the interface, doesn't delete i |
77 | * @return bool true if successfull, false otherwise. | 81 | * @return bool true if successfull, false otherwise. |
78 | */ | 82 | */ |
79 | virtual bool remove(Interface* i) = 0; | 83 | virtual bool remove(Interface* i) = 0; |
80 | 84 | ||
81 | }; | 85 | }; |
82 | 86 | ||
83 | #endif | 87 | #endif |
84 | 88 | ||
85 | // module.h | 89 | // module.h |
86 | 90 | ||