summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetup.ui6
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp2
-rw-r--r--noncore/settings/networksettings/opie-networksettings.control2
3 files changed, 7 insertions, 3 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfacesetup.ui b/noncore/settings/networksettings/interfaces/interfacesetup.ui
index efcab8b..fa2db40 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetup.ui
+++ b/noncore/settings/networksettings/interfaces/interfacesetup.ui
@@ -1,220 +1,224 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>InterfaceSetup</class> 2<class>InterfaceSetup</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>InterfaceSetup</cstring> 7 <cstring>InterfaceSetup</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>286</width> 14 <width>282</width>
15 <height>280</height> 15 <height>280</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>Interface Configuration</string> 20 <string>Interface Configuration</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>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> 31 <widget>
32 <class>QCheckBox</class> 32 <class>QCheckBox</class>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>name</name> 34 <name>name</name>
35 <cstring>autoStart</cstring> 35 <cstring>autoStart</cstring>
36 </property> 36 </property>
37 <property stdset="1"> 37 <property stdset="1">
38 <name>text</name> 38 <name>text</name>
39 <string>Automatically bring up</string> 39 <string>Automatically bring up</string>
40 </property> 40 </property>
41 </widget> 41 </widget>
42 <widget> 42 <widget>
43 <class>QCheckBox</class> 43 <class>QCheckBox</class>
44 <property stdset="1"> 44 <property stdset="1">
45 <name>name</name> 45 <name>name</name>
46 <cstring>dhcpCheckBox</cstring> 46 <cstring>dhcpCheckBox</cstring>
47 </property> 47 </property>
48 <property stdset="1"> 48 <property stdset="1">
49 <name>text</name> 49 <name>text</name>
50 <string>DHCP</string> 50 <string>DHCP</string>
51 </property> 51 </property>
52 <property stdset="1"> 52 <property stdset="1">
53 <name>checked</name> 53 <name>checked</name>
54 <bool>true</bool> 54 <bool>true</bool>
55 </property> 55 </property>
56 </widget> 56 </widget>
57 <widget> 57 <widget>
58 <class>QGroupBox</class> 58 <class>QGroupBox</class>
59 <property stdset="1"> 59 <property stdset="1">
60 <name>name</name> 60 <name>name</name>
61 <cstring>staticGroupBox</cstring> 61 <cstring>staticGroupBox</cstring>
62 </property> 62 </property>
63 <property stdset="1"> 63 <property stdset="1">
64 <name>enabled</name> 64 <name>enabled</name>
65 <bool>false</bool> 65 <bool>false</bool>
66 </property> 66 </property>
67 <property stdset="1"> 67 <property stdset="1">
68 <name>frameShape</name> 68 <name>frameShape</name>
69 <enum>Box</enum> 69 <enum>Box</enum>
70 </property> 70 </property>
71 <property stdset="1"> 71 <property stdset="1">
72 <name>frameShadow</name> 72 <name>frameShadow</name>
73 <enum>Sunken</enum> 73 <enum>Sunken</enum>
74 </property> 74 </property>
75 <property stdset="1"> 75 <property stdset="1">
76 <name>title</name> 76 <name>title</name>
77 <string>Static Ip Configuration</string> 77 <string>Static Ip Configuration</string>
78 </property> 78 </property>
79 <grid> 79 <grid>
80 <property stdset="1"> 80 <property stdset="1">
81 <name>margin</name> 81 <name>margin</name>
82 <number>11</number> 82 <number>11</number>
83 </property> 83 </property>
84 <property stdset="1"> 84 <property stdset="1">
85 <name>spacing</name> 85 <name>spacing</name>
86 <number>6</number> 86 <number>6</number>
87 </property> 87 </property>
88 <widget row="1" column="0" > 88 <widget row="1" column="0" >
89 <class>QLabel</class> 89 <class>QLabel</class>
90 <property stdset="1"> 90 <property stdset="1">
91 <name>name</name> 91 <name>name</name>
92 <cstring>TextLabel5</cstring> 92 <cstring>TextLabel5</cstring>
93 </property> 93 </property>
94 <property stdset="1"> 94 <property stdset="1">
95 <name>text</name> 95 <name>text</name>
96 <string>Subnet Mask</string> 96 <string>Subnet Mask</string>
97 </property> 97 </property>
98 </widget> 98 </widget>
99 <widget row="2" column="1" > 99 <widget row="2" column="1" >
100 <class>QLineEdit</class> 100 <class>QLineEdit</class>
101 <property stdset="1"> 101 <property stdset="1">
102 <name>name</name> 102 <name>name</name>
103 <cstring>gatewayEdit</cstring> 103 <cstring>gatewayEdit</cstring>
104 </property> 104 </property>
105 </widget> 105 </widget>
106 <widget row="1" column="1" > 106 <widget row="1" column="1" >
107 <class>QLineEdit</class> 107 <class>QLineEdit</class>
108 <property stdset="1"> 108 <property stdset="1">
109 <name>name</name> 109 <name>name</name>
110 <cstring>subnetMaskEdit</cstring> 110 <cstring>subnetMaskEdit</cstring>
111 </property> 111 </property>
112 <property stdset="1">
113 <name>text</name>
114 <string>255.255.255.0</string>
115 </property>
112 </widget> 116 </widget>
113 <widget row="0" column="1" > 117 <widget row="0" column="1" >
114 <class>QLineEdit</class> 118 <class>QLineEdit</class>
115 <property stdset="1"> 119 <property stdset="1">
116 <name>name</name> 120 <name>name</name>
117 <cstring>ipAddressEdit</cstring> 121 <cstring>ipAddressEdit</cstring>
118 </property> 122 </property>
119 </widget> 123 </widget>
120 <widget row="3" column="0" > 124 <widget row="3" column="0" >
121 <class>QLabel</class> 125 <class>QLabel</class>
122 <property stdset="1"> 126 <property stdset="1">
123 <name>name</name> 127 <name>name</name>
124 <cstring>TextLabel2</cstring> 128 <cstring>TextLabel2</cstring>
125 </property> 129 </property>
126 <property stdset="1"> 130 <property stdset="1">
127 <name>text</name> 131 <name>text</name>
128 <string>First DNS</string> 132 <string>First DNS</string>
129 </property> 133 </property>
130 </widget> 134 </widget>
131 <widget row="0" column="0" > 135 <widget row="0" column="0" >
132 <class>QLabel</class> 136 <class>QLabel</class>
133 <property stdset="1"> 137 <property stdset="1">
134 <name>name</name> 138 <name>name</name>
135 <cstring>TextLabel4</cstring> 139 <cstring>TextLabel4</cstring>
136 </property> 140 </property>
137 <property stdset="1"> 141 <property stdset="1">
138 <name>text</name> 142 <name>text</name>
139 <string>IP Address</string> 143 <string>IP Address</string>
140 </property> 144 </property>
141 </widget> 145 </widget>
142 <widget row="2" column="0" > 146 <widget row="2" column="0" >
143 <class>QLabel</class> 147 <class>QLabel</class>
144 <property stdset="1"> 148 <property stdset="1">
145 <name>name</name> 149 <name>name</name>
146 <cstring>TextLabel1_2</cstring> 150 <cstring>TextLabel1_2</cstring>
147 </property> 151 </property>
148 <property stdset="1"> 152 <property stdset="1">
149 <name>text</name> 153 <name>text</name>
150 <string>Gateway</string> 154 <string>Gateway</string>
151 </property> 155 </property>
152 </widget> 156 </widget>
153 <widget row="4" column="0" > 157 <widget row="4" column="0" >
154 <class>QLabel</class> 158 <class>QLabel</class>
155 <property stdset="1"> 159 <property stdset="1">
156 <name>name</name> 160 <name>name</name>
157 <cstring>TextLabel3</cstring> 161 <cstring>TextLabel3</cstring>
158 </property> 162 </property>
159 <property stdset="1"> 163 <property stdset="1">
160 <name>text</name> 164 <name>text</name>
161 <string>Second DNS</string> 165 <string>Second DNS</string>
162 </property> 166 </property>
163 </widget> 167 </widget>
164 <widget row="3" column="1" > 168 <widget row="3" column="1" >
165 <class>QLineEdit</class> 169 <class>QLineEdit</class>
166 <property stdset="1"> 170 <property stdset="1">
167 <name>name</name> 171 <name>name</name>
168 <cstring>firstDNSLineEdit</cstring> 172 <cstring>firstDNSLineEdit</cstring>
169 </property> 173 </property>
170 </widget> 174 </widget>
171 <widget row="4" column="1" > 175 <widget row="4" column="1" >
172 <class>QLineEdit</class> 176 <class>QLineEdit</class>
173 <property stdset="1"> 177 <property stdset="1">
174 <name>name</name> 178 <name>name</name>
175 <cstring>secondDNSLineEdit</cstring> 179 <cstring>secondDNSLineEdit</cstring>
176 </property> 180 </property>
177 </widget> 181 </widget>
178 </grid> 182 </grid>
179 </widget> 183 </widget>
180 <spacer> 184 <spacer>
181 <property> 185 <property>
182 <name>name</name> 186 <name>name</name>
183 <cstring>Spacer9</cstring> 187 <cstring>Spacer9</cstring>
184 </property> 188 </property>
185 <property stdset="1"> 189 <property stdset="1">
186 <name>orientation</name> 190 <name>orientation</name>
187 <enum>Vertical</enum> 191 <enum>Vertical</enum>
188 </property> 192 </property>
189 <property stdset="1"> 193 <property stdset="1">
190 <name>sizeType</name> 194 <name>sizeType</name>
191 <enum>Expanding</enum> 195 <enum>Expanding</enum>
192 </property> 196 </property>
193 <property> 197 <property>
194 <name>sizeHint</name> 198 <name>sizeHint</name>
195 <size> 199 <size>
196 <width>20</width> 200 <width>20</width>
197 <height>20</height> 201 <height>20</height>
198 </size> 202 </size>
199 </property> 203 </property>
200 </spacer> 204 </spacer>
201 </vbox> 205 </vbox>
202</widget> 206</widget>
203<connections> 207<connections>
204 <connection> 208 <connection>
205 <sender>dhcpCheckBox</sender> 209 <sender>dhcpCheckBox</sender>
206 <signal>toggled(bool)</signal> 210 <signal>toggled(bool)</signal>
207 <receiver>staticGroupBox</receiver> 211 <receiver>staticGroupBox</receiver>
208 <slot>setDisabled(bool)</slot> 212 <slot>setDisabled(bool)</slot>
209 </connection> 213 </connection>
210</connections> 214</connections>
211<tabstops> 215<tabstops>
212 <tabstop>autoStart</tabstop> 216 <tabstop>autoStart</tabstop>
213 <tabstop>dhcpCheckBox</tabstop> 217 <tabstop>dhcpCheckBox</tabstop>
214 <tabstop>ipAddressEdit</tabstop> 218 <tabstop>ipAddressEdit</tabstop>
215 <tabstop>subnetMaskEdit</tabstop> 219 <tabstop>subnetMaskEdit</tabstop>
216 <tabstop>gatewayEdit</tabstop> 220 <tabstop>gatewayEdit</tabstop>
217 <tabstop>firstDNSLineEdit</tabstop> 221 <tabstop>firstDNSLineEdit</tabstop>
218 <tabstop>secondDNSLineEdit</tabstop> 222 <tabstop>secondDNSLineEdit</tabstop>
219</tabstops> 223</tabstops>
220</UI> 224</UI>
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index a0b3113..4119490 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -306,321 +306,321 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &
306 306
307 // Store for deletion later 307 // Store for deletion later
308 libraries.insert(object, lib); 308 libraries.insert(object, lib);
309 return object; 309 return object;
310 310
311#else 311#else
312 QLibrary *lib = loader->library(pluginFileName); 312 QLibrary *lib = loader->library(pluginFileName);
313 if( !lib || !lib->hasSymbol(resolveString) ){ 313 if( !lib || !lib->hasSymbol(resolveString) ){
314 qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); 314 qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
315 return NULL; 315 return NULL;
316 } 316 }
317 // Try to get an object. 317 // Try to get an object.
318 Module *object = ((Module* (*)()) lib->symbol(resolveString))(); 318 Module *object = ((Module* (*)()) lib->symbol(resolveString))();
319 if(object == NULL){ 319 if(object == NULL){
320#ifdef DEBUG 320#ifdef DEBUG
321 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 321 qDebug("MainWindowImp: Couldn't create object, but did load library!");
322#endif 322#endif
323 return NULL; 323 return NULL;
324 } 324 }
325#ifdef DEBUG 325#ifdef DEBUG
326 qDebug("MainWindowImp::loadPlugin:: Found object, storing."); 326 qDebug("MainWindowImp::loadPlugin:: Found object, storing.");
327#endif 327#endif
328 // Store for deletion later 328 // Store for deletion later
329 libraries.insert(object, lib); 329 libraries.insert(object, lib);
330 return object; 330 return object;
331#endif 331#endif
332} 332}
333 333
334/** 334/**
335 * The Add button was clicked. Bring up the add dialog and if OK is hit 335 * The Add button was clicked. Bring up the add dialog and if OK is hit
336 * load the plugin and append it to the list 336 * load the plugin and append it to the list
337 */ 337 */
338void MainWindowImp::addClicked(){ 338void MainWindowImp::addClicked(){
339 QMap<Module*, QLibrary*>::Iterator it; 339 QMap<Module*, QLibrary*>::Iterator it;
340 QMap<QString, QString> list; 340 QMap<QString, QString> list;
341 QMap<QString, Module*> newInterfaceOwners; 341 QMap<QString, Module*> newInterfaceOwners;
342 342
343 for( it = libraries.begin(); it != libraries.end(); ++it ){ 343 for( it = libraries.begin(); it != libraries.end(); ++it ){
344 if(it.key()){ 344 if(it.key()){
345 (it.key())->possibleNewInterfaces(list); 345 (it.key())->possibleNewInterfaces(list);
346 } 346 }
347 } 347 }
348 // See if the list has anything that we can add. 348 // See if the list has anything that we can add.
349 if(list.count() == 0){ 349 if(list.count() == 0){
350 QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok); 350 QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok);
351 return; 351 return;
352 } 352 }
353 AddConnectionImp addNewConnection(this, "AddConnectionImp", true); 353 AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
354 addNewConnection.addConnections(list); 354 addNewConnection.addConnections(list);
355 addNewConnection.showMaximized(); 355 addNewConnection.showMaximized();
356 if(QDialog::Accepted == addNewConnection.exec()){ 356 if(QDialog::Accepted == addNewConnection.exec()){
357 QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); 357 QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
358 if(!item) 358 if(!item)
359 return; 359 return;
360 360
361 for( it = libraries.begin(); it != libraries.end(); ++it ){ 361 for( it = libraries.begin(); it != libraries.end(); ++it ){
362 if(it.key()){ 362 if(it.key()){
363 Interface *i = (it.key())->addNewInterface(item->text(0)); 363 Interface *i = (it.key())->addNewInterface(item->text(0));
364 if(i){ 364 if(i){
365 qDebug("iface name %s",i->getInterfaceName().latin1()); 365 qDebug("iface name %s",i->getInterfaceName().latin1());
366 interfaceNames.insert(i->getInterfaceName(), i); 366 interfaceNames.insert(i->getInterfaceName(), i);
367 updateInterface(i); 367 updateInterface(i);
368 } 368 }
369 } 369 }
370 } 370 }
371 } 371 }
372} 372}
373 373
374/** 374/**
375 * Prompt the user to see if they really want to do this. 375 * Prompt the user to see if they really want to do this.
376 * If they do then remove from the list and unload. 376 * If they do then remove from the list and unload.
377 */ 377 */
378void MainWindowImp::removeClicked(){ 378void MainWindowImp::removeClicked(){
379 QListViewItem *item = connectionList->currentItem(); 379 QListViewItem *item = connectionList->currentItem();
380 if(!item) { 380 if(!item) {
381 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 381 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
382 return; 382 return;
383 } 383 }
384 384
385 Interface *i = interfaceItems[item]; 385 Interface *i = interfaceItems[item];
386 if(i->getModuleOwner() == NULL){ 386 if(i->getModuleOwner() == NULL){
387 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); 387 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok);
388 } 388 }
389 else{ 389 else{
390 if(!i->getModuleOwner()->remove(i)) 390 if(!i->getModuleOwner()->remove(i))
391 QMessageBox::information(this, tr("Error"), tr("Unable to remove."), QMessageBox::Ok); 391 QMessageBox::information(this, tr("Error"), tr("Unable to remove."), QMessageBox::Ok);
392 else{ 392 else{
393 delete item; 393 delete item;
394// QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); 394// QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok);
395 } 395 }
396 } 396 }
397} 397}
398 398
399/** 399/**
400 * Pull up the configure about the currently selected interface. 400 * Pull up the configure about the currently selected interface.
401 * Report an error if no interface is selected. 401 * Report an error if no interface is selected.
402 * If the interface has a module owner then request its configure. 402 * If the interface has a module owner then request its configure.
403 */ 403 */
404void MainWindowImp::configureClicked(){ 404void MainWindowImp::configureClicked(){
405 QListViewItem *item = connectionList->currentItem(); 405 QListViewItem *item = connectionList->currentItem();
406 if(!item){ 406 if(!item){
407 QMessageBox::information(this, tr("Sorry"),tr("Please select an interface first."), QMessageBox::Ok); 407 QMessageBox::information(this, tr("Sorry"),tr("Please select an interface first."), QMessageBox::Ok);
408 return; 408 return;
409 } 409 }
410 410
411 QString currentProfileText = currentProfileLabel->text(); 411 QString currentProfileText = currentProfileLabel->text();
412 if(currentProfileText.upper() == "ALL"); 412 if(currentProfileText.upper() == "ALL");
413 currentProfileText = ""; 413 currentProfileText = "";
414 414
415 Interface *i = interfaceItems[item]; 415 Interface *i = interfaceItems[item];
416 416
417 if(i->getModuleOwner()){ 417 if(i->getModuleOwner()){
418 QWidget *moduleConfigure = i->getModuleOwner()->configure(i); 418 QWidget *moduleConfigure = i->getModuleOwner()->configure(i);
419 if(moduleConfigure != NULL){ 419 if(moduleConfigure != NULL){
420 i->getModuleOwner()->setProfile(currentProfileText); 420 i->getModuleOwner()->setProfile(currentProfileText);
421 moduleConfigure->showMaximized(); 421 moduleConfigure->showMaximized();
422 return; 422 return;
423 } 423 }
424 } 424 }
425 425
426 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose ); 426 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose );
427 configure->setProfile(currentProfileText); 427 configure->setProfile(currentProfileText);
428 configure->showMaximized(); 428 configure->showMaximized();
429} 429}
430 430
431/** 431/**
432 * Pull up the information about the currently selected interface. 432 * Pull up the information about the currently selected interface.
433 * Report an error if no interface is selected. 433 * Report an error if no interface is selected.
434 * If the interface has a module owner then request its configure. 434 * If the interface has a module owner then request its configure.
435 */ 435 */
436void MainWindowImp::informationClicked(){ 436void MainWindowImp::informationClicked(){
437 QListViewItem *item = connectionList->currentItem(); 437 QListViewItem *item = connectionList->currentItem();
438 if(!item){ 438 if(!item){
439 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 439 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
440 return; 440 return;
441 } 441 }
442 442
443 Interface *i = interfaceItems[item]; 443 Interface *i = interfaceItems[item];
444// if(!i->isAttached()){ 444// if(!i->isAttached()){
445// QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); 445// QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
446// return; 446// return;
447// } 447// }
448 448
449 if(i->getModuleOwner()){ 449 if(i->getModuleOwner()){
450 QWidget *moduleInformation = i->getModuleOwner()->information(i); 450 QWidget *moduleInformation = i->getModuleOwner()->information(i);
451 if(moduleInformation != NULL){ 451 if(moduleInformation != NULL){
452 moduleInformation->showMaximized(); 452 moduleInformation->showMaximized();
453#ifdef DEBUG 453#ifdef DEBUG
454 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); 454 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed.");
455#endif 455#endif
456 return; 456 return;
457 } 457 }
458 } 458 }
459 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); 459 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
460 information->showMaximized(); 460 information->showMaximized();
461} 461}
462 462
463/** 463/**
464 * Update this interface. If no QListViewItem exists create one. 464 * Update this interface. If no QListViewItem exists create one.
465 * @param Interface* pointer to the interface that needs to be updated. 465 * @param Interface* pointer to the interface that needs to be updated.
466 */ 466 */
467void MainWindowImp::updateInterface(Interface *i){ 467void MainWindowImp::updateInterface(Interface *i){
468 if(!advancedUserMode){ 468 if(!advancedUserMode){
469 if(i->getInterfaceName() == "lo") 469 if(i->getInterfaceName() == "lo")
470 return; 470 return;
471 } 471 }
472 472
473 QListViewItem *item = NULL; 473 QListViewItem *item = NULL;
474 474
475 // Find the interface, making it if needed. 475 // Find the interface, making it if needed.
476 if(items.find(i) == items.end()){ 476 if(items.find(i) == items.end()){
477 item = new QListViewItem(connectionList, "", "", ""); 477 item = new QListViewItem(connectionList, "", "", "");
478 // See if you can't find a module owner for this interface 478 // See if you can't find a module owner for this interface
479 QMap<Module*, QLibrary*>::Iterator it; 479 QMap<Module*, QLibrary*>::Iterator it;
480 for( it = libraries.begin(); it != libraries.end(); ++it ){ 480 for( it = libraries.begin(); it != libraries.end(); ++it ){
481 if(it.key()->isOwner(i)) 481 if(it.key()->isOwner(i))
482 i->setModuleOwner(it.key()); 482 i->setModuleOwner(it.key());
483 } 483 }
484 items.insert(i, item); 484 items.insert(i, item);
485 interfaceItems.insert(item, i); 485 interfaceItems.insert(item, i);
486 } 486 }
487 else 487 else
488 item = items[i]; 488 item = items[i];
489 489
490 // Update the icons and information 490 // Update the icons and information
491#ifdef QWS 491#ifdef QWS
492 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); 492 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down")));
493#else 493#else
494 item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down"))); 494 item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down")));
495#endif 495#endif
496 496
497 QString typeName = "lan"; 497 QString typeName = "lan";
498 if(i->getHardwareName().contains("Local Loopback")) 498 if(i->getInterfaceName() == "lo")
499 typeName = "lo"; 499 typeName = "lo";
500 if(i->getInterfaceName().contains("irda")) 500 if(i->getInterfaceName().contains("irda"))
501 typeName = "irda"; 501 typeName = "irda";
502 if(i->getInterfaceName().contains("wlan")) 502 if(i->getInterfaceName().contains("wlan"))
503 typeName = "wlan"; 503 typeName = "wlan";
504 if(i->getInterfaceName().contains("usb")) 504 if(i->getInterfaceName().contains("usb"))
505 typeName = "usb"; 505 typeName = "usb";
506 506
507 if(!i->isAttached()) 507 if(!i->isAttached())
508 typeName = "connect_no"; 508 typeName = "connect_no";
509 // Actually try to use the Module 509 // Actually try to use the Module
510 if(i->getModuleOwner() != NULL) 510 if(i->getModuleOwner() != NULL)
511 typeName = i->getModuleOwner()->getPixmapName(i); 511 typeName = i->getModuleOwner()->getPixmapName(i);
512 512
513#ifdef QWS 513#ifdef QWS
514 item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); 514 item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName)));
515#else 515#else
516 item->setPixmap(1, (SmallIcon(typeName))); 516 item->setPixmap(1, (SmallIcon(typeName)));
517#endif 517#endif
518 item->setText(2, i->getHardwareName()); 518 item->setText(2, i->getHardwareName());
519 item->setText(3, QString("(%1)").arg(i->getInterfaceName())); 519 item->setText(3, QString("(%1)").arg(i->getInterfaceName()));
520 item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); 520 item->setText(4, (i->getStatus()) ? i->getIp() : QString(""));
521} 521}
522 522
523void MainWindowImp::newProfileChanged(const QString& newText){ 523void MainWindowImp::newProfileChanged(const QString& newText){
524 if(newText.length() > 0) 524 if(newText.length() > 0)
525 newProfileButton->setEnabled(true); 525 newProfileButton->setEnabled(true);
526 else 526 else
527 newProfileButton->setEnabled(false); 527 newProfileButton->setEnabled(false);
528} 528}
529 529
530/** 530/**
531 * Adds a new profile to the list of profiles. 531 * Adds a new profile to the list of profiles.
532 * Don't add profiles that already exists. 532 * Don't add profiles that already exists.
533 * Appends to the list and QStringList 533 * Appends to the list and QStringList
534 */ 534 */
535void MainWindowImp::addProfile(){ 535void MainWindowImp::addProfile(){
536 QString newProfileName = newProfile->text(); 536 QString newProfileName = newProfile->text();
537 if(profiles.grep(newProfileName).count() > 0){ 537 if(profiles.grep(newProfileName).count() > 0){
538 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); 538 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok);
539 return; 539 return;
540 } 540 }
541 profiles.append(newProfileName); 541 profiles.append(newProfileName);
542 profilesList->insertItem(newProfileName); 542 profilesList->insertItem(newProfileName);
543} 543}
544 544
545/** 545/**
546 * Removes the currently selected profile in the combo. 546 * Removes the currently selected profile in the combo.
547 * Doesn't delete if there are less then 2 profiles. 547 * Doesn't delete if there are less then 2 profiles.
548 */ 548 */
549void MainWindowImp::removeProfile(){ 549void MainWindowImp::removeProfile(){
550 if(profilesList->count() <= 1){ 550 if(profilesList->count() <= 1){
551 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok); 551 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok);
552 return; 552 return;
553 } 553 }
554 QString profileToRemove = profilesList->currentText(); 554 QString profileToRemove = profilesList->currentText();
555 if(profileToRemove == "All"){ 555 if(profileToRemove == "All"){
556 QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok); 556 QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok);
557 return; 557 return;
558 } 558 }
559 // Can't remove the curent profile 559 // Can't remove the curent profile
560 if(profileToRemove == currentProfileLabel->text()){ 560 if(profileToRemove == currentProfileLabel->text()){
561 QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok); 561 QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok);
562 return; 562 return;
563 563
564 } 564 }
565 565
566 if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ 566 if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){
567 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); 567 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
568 profilesList->clear(); 568 profilesList->clear();
569 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 569 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
570 profilesList->insertItem((*it)); 570 profilesList->insertItem((*it));
571 571
572 // Remove any interface settings and mappings. 572 // Remove any interface settings and mappings.
573 Interfaces interfaces; 573 Interfaces interfaces;
574 // Go through them one by one 574 // Go through them one by one
575 QMap<Interface*, QListViewItem*>::Iterator it; 575 QMap<Interface*, QListViewItem*>::Iterator it;
576 for( it = items.begin(); it != items.end(); ++it ){ 576 for( it = items.begin(); it != items.end(); ++it ){
577 QString interfaceName = it.key()->getInterfaceName(); 577 QString interfaceName = it.key()->getInterfaceName();
578 qDebug(interfaceName.latin1()); 578 qDebug(interfaceName.latin1());
579 if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){ 579 if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){
580 interfaces.removeInterface(); 580 interfaces.removeInterface();
581 if(interfaces.setMapping(interfaceName)){ 581 if(interfaces.setMapping(interfaceName)){
582 if(profilesList->count() == 1) 582 if(profilesList->count() == 1)
583 interfaces.removeMapping(); 583 interfaces.removeMapping();
584 else{ 584 else{
585 interfaces.removeMap("map", interfaceName + "_" + profileToRemove); 585 interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
586 } 586 }
587 } 587 }
588 interfaces.write(); 588 interfaces.write();
589 break; 589 break;
590 } 590 }
591 } 591 }
592 } 592 }
593} 593}
594 594
595/** 595/**
596 * A new profile has been selected, change. 596 * A new profile has been selected, change.
597 * @param newProfile the new profile. 597 * @param newProfile the new profile.
598 */ 598 */
599void MainWindowImp::changeProfile(){ 599void MainWindowImp::changeProfile(){
600 if(profilesList->currentItem() == -1){ 600 if(profilesList->currentItem() == -1){
601 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); 601 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok);
602 return; 602 return;
603 } 603 }
604 QString newProfile = profilesList->text(profilesList->currentItem()); 604 QString newProfile = profilesList->text(profilesList->currentItem());
605 if(newProfile != currentProfileLabel->text()){ 605 if(newProfile != currentProfileLabel->text()){
606 currentProfileLabel->setText(newProfile); 606 currentProfileLabel->setText(newProfile);
607 QFile::remove(scheme); 607 QFile::remove(scheme);
608 QFile file(scheme); 608 QFile file(scheme);
609 if ( file.open(IO_ReadWrite) ) { 609 if ( file.open(IO_ReadWrite) ) {
610 QTextStream stream( &file ); 610 QTextStream stream( &file );
611 stream << QString("SCHEME=%1").arg(newProfile); 611 stream << QString("SCHEME=%1").arg(newProfile);
612 file.close(); 612 file.close();
613 } 613 }
614 // restart all up devices? 614 // restart all up devices?
615 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ 615 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){
616 // Go through them one by one 616 // Go through them one by one
617 QMap<Interface*, QListViewItem*>::Iterator it; 617 QMap<Interface*, QListViewItem*>::Iterator it;
618 for( it = items.begin(); it != items.end(); ++it ){ 618 for( it = items.begin(); it != items.end(); ++it ){
619 if(it.key()->getStatus() == true) 619 if(it.key()->getStatus() == true)
620 it.key()->restart(); 620 it.key()->restart();
621 } 621 }
622 } 622 }
623 } 623 }
624 // TODO change the profile in the modules 624 // TODO change the profile in the modules
625} 625}
626 626
diff --git a/noncore/settings/networksettings/opie-networksettings.control b/noncore/settings/networksettings/opie-networksettings.control
index e2db92f..182615f 100644
--- a/noncore/settings/networksettings/opie-networksettings.control
+++ b/noncore/settings/networksettings/opie-networksettings.control
@@ -1,10 +1,10 @@
1Package: opie-networksettings 1Package: opie-networksettings
2Files: bin/networksettings apps/Settings/networksettings.desktop plugins/networksettings/* pics/networksettings/* pics/Network/PPPConnect.png $OPIEDIR/lib/libinterfaces.so.1.0.0 $OPIEDIR/lib/libinterfaces.so.1.0 $OPIEDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile 2Files: bin/networksettings apps/Settings/networksettings.desktop plugins/networksettings/* pics/networksettings/* pics/Network/PPPConnect.png $OPIEDIR/lib/libinterfaces.so.1.0.0 $OPIEDIR/lib/libinterfaces.so.1.0 $OPIEDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile
3Priority: optional 3Priority: optional
4Section: opie/settings 4Section: opie/settings
5Maintainer: Ben Meyer <meyerb@sharpsec.com> 5Maintainer: Patrick S. Vogt <tille@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: $QPE_VERSION-$SUB_VERSION 7Version: $QPE_VERSION-$SUB_VERSION
8Depends: task-opie-minimal 8Depends: task-opie-minimal
9Description: Network settings. 9Description: Network settings.
10Replaces: opie-networksetup 10Replaces: opie-networksetup