-rw-r--r-- | noncore/net/networksetup/TODO | 1 | ||||
-rw-r--r-- | noncore/net/networksetup/interfaces.cpp | 26 | ||||
-rw-r--r-- | noncore/net/networksetup/interfaces.h | 3 | ||||
-rw-r--r-- | noncore/net/networksetup/mainwindowimp.cpp | 22 | ||||
-rw-r--r-- | noncore/net/networksetup/networksetup.pro | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/TODO | 1 | ||||
-rw-r--r-- | noncore/settings/networksettings/interfaces.cpp | 26 | ||||
-rw-r--r-- | noncore/settings/networksettings/interfaces.h | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 22 | ||||
-rw-r--r-- | noncore/settings/networksettings/networksetup.pro | 6 |
10 files changed, 106 insertions, 10 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO index 70d6717..7386646 100644 --- a/noncore/net/networksetup/TODO +++ b/noncore/net/networksetup/TODO | |||
@@ -1,7 +1,8 @@ | |||
1 | [ ] Wlanmodule needs to check if an interface supports wireless | 1 | [ ] Wlanmodule needs to check if an interface supports wireless |
2 | extensions. | 2 | extensions. |
3 | [x] When you set options in wlanmodule, hit OK, it exits all of | 3 | [x] When you set options in wlanmodule, hit OK, it exits all of |
4 | networksetup, doesnt bring you back to the main screen. | 4 | networksetup, doesnt bring you back to the main screen. |
5 | [x] Wlanmodule isnt writing out wireless.opts | 5 | [x] Wlanmodule isnt writing out wireless.opts |
6 | [ ] Need a means of bringing an interface up and down (calling | 6 | [ ] Need a means of bringing an interface up and down (calling |
7 | out ifup/ifdown) from the gui. | 7 | out ifup/ifdown) from the gui. |
8 | -Ben- Click information, then click up or down... :-D | ||
diff --git a/noncore/net/networksetup/interfaces.cpp b/noncore/net/networksetup/interfaces.cpp index b8a3e7f..1287d90 100644 --- a/noncore/net/networksetup/interfaces.cpp +++ b/noncore/net/networksetup/interfaces.cpp | |||
@@ -31,28 +31,52 @@ Interfaces::Interfaces(QString useInterfacesFile){ | |||
31 | QString line; | 31 | QString line; |
32 | while ( !stream.eof() ) { | 32 | while ( !stream.eof() ) { |
33 | line += stream.readLine(); | 33 | line += stream.readLine(); |
34 | line += "\n"; | 34 | line += "\n"; |
35 | } | 35 | } |
36 | file.close(); | 36 | file.close(); |
37 | interfaces = QStringList::split("\n", line, true); | 37 | interfaces = QStringList::split("\n", line, true); |
38 | 38 | ||
39 | currentIface = interfaces.end(); | 39 | currentIface = interfaces.end(); |
40 | currentMapping = interfaces.end(); | 40 | currentMapping = interfaces.end(); |
41 | } | 41 | } |
42 | 42 | ||
43 | |||
44 | /** | ||
45 | * Get a list of all interfaces in the interface file. Usefull for | ||
46 | * hardware that is not currently connected such as an 802.11b card | ||
47 | * not plugged in, but configured for when it is plugged in. | ||
48 | * @return Return string list of interfaces. | ||
49 | **/ | ||
50 | QStringList Interfaces::getInterfaceList(){ | ||
51 | QStringList list; | ||
52 | for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { | ||
53 | QString line = (*it).simplifyWhiteSpace(); | ||
54 | if(line.contains(IFACE)){ | ||
55 | line = line.mid(QString(IFACE).length() +1, line.length()); | ||
56 | line = line.simplifyWhiteSpace(); | ||
57 | int findSpace = line.find(" "); | ||
58 | if( findSpace >= 0){ | ||
59 | line = line.mid(0, findSpace); | ||
60 | list.append(line); | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | return list; | ||
65 | } | ||
66 | |||
43 | /** | 67 | /** |
44 | * Find out if interface is in an "auto" group or not. | 68 | * Find out if interface is in an "auto" group or not. |
45 | * Report any duplicates such as eth0 being in two differnt auto's | 69 | * Report any duplicates such as eth0 being in two differnt auto's |
46 | * @param | 70 | * @param interface interface to check to see if it is on or not. |
47 | * @return true is interface is in auto | 71 | * @return true is interface is in auto |
48 | */ | 72 | */ |
49 | bool Interfaces::isAuto(QString interface){ | 73 | bool Interfaces::isAuto(QString interface){ |
50 | QStringList autoLines = interfaces.grep(QRegExp(AUTO)); | 74 | QStringList autoLines = interfaces.grep(QRegExp(AUTO)); |
51 | QStringList awi = autoLines.grep(QRegExp(interface)); | 75 | QStringList awi = autoLines.grep(QRegExp(interface)); |
52 | if(awi.count() > 1) | 76 | if(awi.count() > 1) |
53 | qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1()); | 77 | qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1()); |
54 | if(awi.count() < 1) | 78 | if(awi.count() < 1) |
55 | return false; | 79 | return false; |
56 | return true; | 80 | return true; |
57 | } | 81 | } |
58 | 82 | ||
diff --git a/noncore/net/networksetup/interfaces.h b/noncore/net/networksetup/interfaces.h index 2cc9689..8b4788c 100644 --- a/noncore/net/networksetup/interfaces.h +++ b/noncore/net/networksetup/interfaces.h | |||
@@ -14,25 +14,26 @@ | |||
14 | #define INTERFACES_METHOD_STATIC "static" | 14 | #define INTERFACES_METHOD_STATIC "static" |
15 | #define INTERFACES_METHOD_PPP "ppp" | 15 | #define INTERFACES_METHOD_PPP "ppp" |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * This class provides a clean frontend for parsing the network interfaces file. | 18 | * This class provides a clean frontend for parsing the network interfaces file. |
19 | * It provides helper functions to minipulate the options within the file. | 19 | * It provides helper functions to minipulate the options within the file. |
20 | * See the interfaces man page for the syntax rules. | 20 | * See the interfaces man page for the syntax rules. |
21 | */ | 21 | */ |
22 | class Interfaces { | 22 | class Interfaces { |
23 | 23 | ||
24 | public: | 24 | public: |
25 | Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); | 25 | Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); |
26 | 26 | QStringList getInterfaceList(); | |
27 | |||
27 | bool isAuto(QString interface); | 28 | bool isAuto(QString interface); |
28 | bool setAuto(QString interface, bool setAuto); | 29 | bool setAuto(QString interface, bool setAuto); |
29 | 30 | ||
30 | bool removeInterface(); | 31 | bool removeInterface(); |
31 | bool addInterface(QString interface, QString family, QString method); | 32 | bool addInterface(QString interface, QString family, QString method); |
32 | bool setInterface(QString interface); | 33 | bool setInterface(QString interface); |
33 | bool isInterfaceSet(); | 34 | bool isInterfaceSet(); |
34 | QString getInterfaceName(bool &error); | 35 | QString getInterfaceName(bool &error); |
35 | bool setInterfaceName(QString newName); | 36 | bool setInterfaceName(QString newName); |
36 | QString getInterfaceFamily(bool &error); | 37 | QString getInterfaceFamily(bool &error); |
37 | bool setInterfaceFamily(QString newName); | 38 | bool setInterfaceFamily(QString newName); |
38 | QString getInterfaceMethod(bool &error); | 39 | QString getInterfaceMethod(bool &error); |
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index 36f12e0..24af1ec 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp | |||
@@ -1,16 +1,18 @@ | |||
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" | ||
6 | |||
5 | #include "module.h" | 7 | #include "module.h" |
6 | 8 | ||
7 | #include "kprocess.h" | 9 | #include "kprocess.h" |
8 | 10 | ||
9 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
10 | #include <qtabwidget.h> | 12 | #include <qtabwidget.h> |
11 | #include <qlistbox.h> | 13 | #include <qlistbox.h> |
12 | #include <qlineedit.h> | 14 | #include <qlineedit.h> |
13 | #include <qlistview.h> | 15 | #include <qlistview.h> |
14 | #include <qheader.h> | 16 | #include <qheader.h> |
15 | #include <qlabel.h> | 17 | #include <qlabel.h> |
16 | 18 | ||
@@ -323,24 +325,41 @@ void MainWindowImp::jobDone(KProcess *process){ | |||
323 | if(macAddress == -1) | 325 | if(macAddress == -1) |
324 | macAddress = line.length(); | 326 | macAddress = line.length(); |
325 | if(hardwareName != -1) | 327 | if(hardwareName != -1) |
326 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); | 328 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); |
327 | // We have found an interface | 329 | // We have found an interface |
328 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); | 330 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); |
329 | interfaceNames.insert(i->getInterfaceName(), i); | 331 | interfaceNames.insert(i->getInterfaceName(), i); |
330 | updateInterface(i); | 332 | updateInterface(i); |
331 | } | 333 | } |
332 | } | 334 | } |
333 | file.close(); | 335 | file.close(); |
334 | QFile::remove(fileName); | 336 | QFile::remove(fileName); |
337 | if(threads.count() == 0){ | ||
338 | Interfaces i; | ||
339 | QStringList list = i.getInterfaceList(); | ||
340 | QMap<QString, Interface*>::Iterator it; | ||
341 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { | ||
342 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ | ||
343 | if(it.key() == (*ni)){ | ||
344 | Interface *i = new Interface(*ni, false); | ||
345 | i->setAttached(false); | ||
346 | i->setHardwareName(QString("Disconnected (%1)").arg(*ni)); | ||
347 | i->setInterfaceName(*ni); | ||
348 | interfaceNames.insert(i->getInterfaceName(), i); | ||
349 | updateInterface(i); | ||
350 | } | ||
351 | } | ||
352 | } | ||
353 | } | ||
335 | } | 354 | } |
336 | 355 | ||
337 | /** | 356 | /** |
338 | * Update this interface. If no QListViewItem exists create one. | 357 | * Update this interface. If no QListViewItem exists create one. |
339 | * @param Interface* pointer to the interface that needs to be updated. | 358 | * @param Interface* pointer to the interface that needs to be updated. |
340 | */ | 359 | */ |
341 | void MainWindowImp::updateInterface(Interface *i){ | 360 | void MainWindowImp::updateInterface(Interface *i){ |
342 | QListViewItem *item = NULL; | 361 | QListViewItem *item = NULL; |
343 | 362 | ||
344 | // Find the interface, making it if needed. | 363 | // Find the interface, making it if needed. |
345 | if(items.find(i) == items.end()){ | 364 | if(items.find(i) == items.end()){ |
346 | item = new QListViewItem(connectionList, "", "", ""); | 365 | item = new QListViewItem(connectionList, "", "", ""); |
@@ -357,24 +376,27 @@ void MainWindowImp::updateInterface(Interface *i){ | |||
357 | item = items[i]; | 376 | item = items[i]; |
358 | 377 | ||
359 | // Update the icons and information | 378 | // Update the icons and information |
360 | item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); | 379 | item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); |
361 | 380 | ||
362 | QString typeName = "lan"; | 381 | QString typeName = "lan"; |
363 | if(i->getHardwareName().contains("Local Loopback")) | 382 | if(i->getHardwareName().contains("Local Loopback")) |
364 | typeName = "lo"; | 383 | typeName = "lo"; |
365 | if(i->getInterfaceName().contains("irda")) | 384 | if(i->getInterfaceName().contains("irda")) |
366 | typeName = "irda"; | 385 | typeName = "irda"; |
367 | if(i->getInterfaceName().contains("wlan")) | 386 | if(i->getInterfaceName().contains("wlan")) |
368 | typeName = "wlan"; | 387 | typeName = "wlan"; |
388 | |||
389 | if(!i->isAttached()) | ||
390 | typeName = "connect_no"; | ||
369 | // Actually try to use the Module | 391 | // Actually try to use the Module |
370 | if(i->getModuleOwner() != NULL) | 392 | if(i->getModuleOwner() != NULL) |
371 | typeName = i->getModuleOwner()->getPixmapName(i); | 393 | typeName = i->getModuleOwner()->getPixmapName(i); |
372 | 394 | ||
373 | item->setPixmap(1, (Resource::loadPixmap(typeName))); | 395 | item->setPixmap(1, (Resource::loadPixmap(typeName))); |
374 | item->setText(2, i->getHardwareName()); | 396 | item->setText(2, i->getHardwareName()); |
375 | item->setText(3, (i->getStatus()) ? i->getIp() : QString("")); | 397 | item->setText(3, (i->getStatus()) ? i->getIp() : QString("")); |
376 | } | 398 | } |
377 | 399 | ||
378 | void MainWindowImp::newProfileChanged(const QString& newText){ | 400 | void MainWindowImp::newProfileChanged(const QString& newText){ |
379 | if(newText.length() > 0) | 401 | if(newText.length() > 0) |
380 | newProfileButton->setEnabled(true); | 402 | newProfileButton->setEnabled(true); |
diff --git a/noncore/net/networksetup/networksetup.pro b/noncore/net/networksetup/networksetup.pro index f09db93..441bbaa 100644 --- a/noncore/net/networksetup/networksetup.pro +++ b/noncore/net/networksetup/networksetup.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | #DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE= app | 2 | TEMPLATE= app |
3 | #CONFIG = qt warn_on debug | 3 | #CONFIG = qt warn_on debug |
4 | CONFIG = qt warn_on release | 4 | CONFIG = qt warn_on release |
5 | HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h | 5 | HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h |
6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp | 6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp |
7 | INCLUDEPATH+= $(OPIEDIR)/include | 7 | #INCLUDEPATH+= $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 8 | #DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | INTERFACES= mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui | 10 | INTERFACES= mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui |
11 | TARGET = networksetup | 11 | TARGET = networksetup |
diff --git a/noncore/settings/networksettings/TODO b/noncore/settings/networksettings/TODO index 70d6717..7386646 100644 --- a/noncore/settings/networksettings/TODO +++ b/noncore/settings/networksettings/TODO | |||
@@ -1,7 +1,8 @@ | |||
1 | [ ] Wlanmodule needs to check if an interface supports wireless | 1 | [ ] Wlanmodule needs to check if an interface supports wireless |
2 | extensions. | 2 | extensions. |
3 | [x] When you set options in wlanmodule, hit OK, it exits all of | 3 | [x] When you set options in wlanmodule, hit OK, it exits all of |
4 | networksetup, doesnt bring you back to the main screen. | 4 | networksetup, doesnt bring you back to the main screen. |
5 | [x] Wlanmodule isnt writing out wireless.opts | 5 | [x] Wlanmodule isnt writing out wireless.opts |
6 | [ ] Need a means of bringing an interface up and down (calling | 6 | [ ] Need a means of bringing an interface up and down (calling |
7 | out ifup/ifdown) from the gui. | 7 | out ifup/ifdown) from the gui. |
8 | -Ben- Click information, then click up or down... :-D | ||
diff --git a/noncore/settings/networksettings/interfaces.cpp b/noncore/settings/networksettings/interfaces.cpp index b8a3e7f..1287d90 100644 --- a/noncore/settings/networksettings/interfaces.cpp +++ b/noncore/settings/networksettings/interfaces.cpp | |||
@@ -31,28 +31,52 @@ Interfaces::Interfaces(QString useInterfacesFile){ | |||
31 | QString line; | 31 | QString line; |
32 | while ( !stream.eof() ) { | 32 | while ( !stream.eof() ) { |
33 | line += stream.readLine(); | 33 | line += stream.readLine(); |
34 | line += "\n"; | 34 | line += "\n"; |
35 | } | 35 | } |
36 | file.close(); | 36 | file.close(); |
37 | interfaces = QStringList::split("\n", line, true); | 37 | interfaces = QStringList::split("\n", line, true); |
38 | 38 | ||
39 | currentIface = interfaces.end(); | 39 | currentIface = interfaces.end(); |
40 | currentMapping = interfaces.end(); | 40 | currentMapping = interfaces.end(); |
41 | } | 41 | } |
42 | 42 | ||
43 | |||
44 | /** | ||
45 | * Get a list of all interfaces in the interface file. Usefull for | ||
46 | * hardware that is not currently connected such as an 802.11b card | ||
47 | * not plugged in, but configured for when it is plugged in. | ||
48 | * @return Return string list of interfaces. | ||
49 | **/ | ||
50 | QStringList Interfaces::getInterfaceList(){ | ||
51 | QStringList list; | ||
52 | for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { | ||
53 | QString line = (*it).simplifyWhiteSpace(); | ||
54 | if(line.contains(IFACE)){ | ||
55 | line = line.mid(QString(IFACE).length() +1, line.length()); | ||
56 | line = line.simplifyWhiteSpace(); | ||
57 | int findSpace = line.find(" "); | ||
58 | if( findSpace >= 0){ | ||
59 | line = line.mid(0, findSpace); | ||
60 | list.append(line); | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | return list; | ||
65 | } | ||
66 | |||
43 | /** | 67 | /** |
44 | * Find out if interface is in an "auto" group or not. | 68 | * Find out if interface is in an "auto" group or not. |
45 | * Report any duplicates such as eth0 being in two differnt auto's | 69 | * Report any duplicates such as eth0 being in two differnt auto's |
46 | * @param | 70 | * @param interface interface to check to see if it is on or not. |
47 | * @return true is interface is in auto | 71 | * @return true is interface is in auto |
48 | */ | 72 | */ |
49 | bool Interfaces::isAuto(QString interface){ | 73 | bool Interfaces::isAuto(QString interface){ |
50 | QStringList autoLines = interfaces.grep(QRegExp(AUTO)); | 74 | QStringList autoLines = interfaces.grep(QRegExp(AUTO)); |
51 | QStringList awi = autoLines.grep(QRegExp(interface)); | 75 | QStringList awi = autoLines.grep(QRegExp(interface)); |
52 | if(awi.count() > 1) | 76 | if(awi.count() > 1) |
53 | qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1()); | 77 | qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1()); |
54 | if(awi.count() < 1) | 78 | if(awi.count() < 1) |
55 | return false; | 79 | return false; |
56 | return true; | 80 | return true; |
57 | } | 81 | } |
58 | 82 | ||
diff --git a/noncore/settings/networksettings/interfaces.h b/noncore/settings/networksettings/interfaces.h index 2cc9689..8b4788c 100644 --- a/noncore/settings/networksettings/interfaces.h +++ b/noncore/settings/networksettings/interfaces.h | |||
@@ -14,25 +14,26 @@ | |||
14 | #define INTERFACES_METHOD_STATIC "static" | 14 | #define INTERFACES_METHOD_STATIC "static" |
15 | #define INTERFACES_METHOD_PPP "ppp" | 15 | #define INTERFACES_METHOD_PPP "ppp" |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * This class provides a clean frontend for parsing the network interfaces file. | 18 | * This class provides a clean frontend for parsing the network interfaces file. |
19 | * It provides helper functions to minipulate the options within the file. | 19 | * It provides helper functions to minipulate the options within the file. |
20 | * See the interfaces man page for the syntax rules. | 20 | * See the interfaces man page for the syntax rules. |
21 | */ | 21 | */ |
22 | class Interfaces { | 22 | class Interfaces { |
23 | 23 | ||
24 | public: | 24 | public: |
25 | Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); | 25 | Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); |
26 | 26 | QStringList getInterfaceList(); | |
27 | |||
27 | bool isAuto(QString interface); | 28 | bool isAuto(QString interface); |
28 | bool setAuto(QString interface, bool setAuto); | 29 | bool setAuto(QString interface, bool setAuto); |
29 | 30 | ||
30 | bool removeInterface(); | 31 | bool removeInterface(); |
31 | bool addInterface(QString interface, QString family, QString method); | 32 | bool addInterface(QString interface, QString family, QString method); |
32 | bool setInterface(QString interface); | 33 | bool setInterface(QString interface); |
33 | bool isInterfaceSet(); | 34 | bool isInterfaceSet(); |
34 | QString getInterfaceName(bool &error); | 35 | QString getInterfaceName(bool &error); |
35 | bool setInterfaceName(QString newName); | 36 | bool setInterfaceName(QString newName); |
36 | QString getInterfaceFamily(bool &error); | 37 | QString getInterfaceFamily(bool &error); |
37 | bool setInterfaceFamily(QString newName); | 38 | bool setInterfaceFamily(QString newName); |
38 | QString getInterfaceMethod(bool &error); | 39 | QString getInterfaceMethod(bool &error); |
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 36f12e0..24af1ec 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -1,16 +1,18 @@ | |||
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" | ||
6 | |||
5 | #include "module.h" | 7 | #include "module.h" |
6 | 8 | ||
7 | #include "kprocess.h" | 9 | #include "kprocess.h" |
8 | 10 | ||
9 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
10 | #include <qtabwidget.h> | 12 | #include <qtabwidget.h> |
11 | #include <qlistbox.h> | 13 | #include <qlistbox.h> |
12 | #include <qlineedit.h> | 14 | #include <qlineedit.h> |
13 | #include <qlistview.h> | 15 | #include <qlistview.h> |
14 | #include <qheader.h> | 16 | #include <qheader.h> |
15 | #include <qlabel.h> | 17 | #include <qlabel.h> |
16 | 18 | ||
@@ -323,24 +325,41 @@ void MainWindowImp::jobDone(KProcess *process){ | |||
323 | if(macAddress == -1) | 325 | if(macAddress == -1) |
324 | macAddress = line.length(); | 326 | macAddress = line.length(); |
325 | if(hardwareName != -1) | 327 | if(hardwareName != -1) |
326 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); | 328 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); |
327 | // We have found an interface | 329 | // We have found an interface |
328 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); | 330 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); |
329 | interfaceNames.insert(i->getInterfaceName(), i); | 331 | interfaceNames.insert(i->getInterfaceName(), i); |
330 | updateInterface(i); | 332 | updateInterface(i); |
331 | } | 333 | } |
332 | } | 334 | } |
333 | file.close(); | 335 | file.close(); |
334 | QFile::remove(fileName); | 336 | QFile::remove(fileName); |
337 | if(threads.count() == 0){ | ||
338 | Interfaces i; | ||
339 | QStringList list = i.getInterfaceList(); | ||
340 | QMap<QString, Interface*>::Iterator it; | ||
341 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { | ||
342 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ | ||
343 | if(it.key() == (*ni)){ | ||
344 | Interface *i = new Interface(*ni, false); | ||
345 | i->setAttached(false); | ||
346 | i->setHardwareName(QString("Disconnected (%1)").arg(*ni)); | ||
347 | i->setInterfaceName(*ni); | ||
348 | interfaceNames.insert(i->getInterfaceName(), i); | ||
349 | updateInterface(i); | ||
350 | } | ||
351 | } | ||
352 | } | ||
353 | } | ||
335 | } | 354 | } |
336 | 355 | ||
337 | /** | 356 | /** |
338 | * Update this interface. If no QListViewItem exists create one. | 357 | * Update this interface. If no QListViewItem exists create one. |
339 | * @param Interface* pointer to the interface that needs to be updated. | 358 | * @param Interface* pointer to the interface that needs to be updated. |
340 | */ | 359 | */ |
341 | void MainWindowImp::updateInterface(Interface *i){ | 360 | void MainWindowImp::updateInterface(Interface *i){ |
342 | QListViewItem *item = NULL; | 361 | QListViewItem *item = NULL; |
343 | 362 | ||
344 | // Find the interface, making it if needed. | 363 | // Find the interface, making it if needed. |
345 | if(items.find(i) == items.end()){ | 364 | if(items.find(i) == items.end()){ |
346 | item = new QListViewItem(connectionList, "", "", ""); | 365 | item = new QListViewItem(connectionList, "", "", ""); |
@@ -357,24 +376,27 @@ void MainWindowImp::updateInterface(Interface *i){ | |||
357 | item = items[i]; | 376 | item = items[i]; |
358 | 377 | ||
359 | // Update the icons and information | 378 | // Update the icons and information |
360 | item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); | 379 | item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); |
361 | 380 | ||
362 | QString typeName = "lan"; | 381 | QString typeName = "lan"; |
363 | if(i->getHardwareName().contains("Local Loopback")) | 382 | if(i->getHardwareName().contains("Local Loopback")) |
364 | typeName = "lo"; | 383 | typeName = "lo"; |
365 | if(i->getInterfaceName().contains("irda")) | 384 | if(i->getInterfaceName().contains("irda")) |
366 | typeName = "irda"; | 385 | typeName = "irda"; |
367 | if(i->getInterfaceName().contains("wlan")) | 386 | if(i->getInterfaceName().contains("wlan")) |
368 | typeName = "wlan"; | 387 | typeName = "wlan"; |
388 | |||
389 | if(!i->isAttached()) | ||
390 | typeName = "connect_no"; | ||
369 | // Actually try to use the Module | 391 | // Actually try to use the Module |
370 | if(i->getModuleOwner() != NULL) | 392 | if(i->getModuleOwner() != NULL) |
371 | typeName = i->getModuleOwner()->getPixmapName(i); | 393 | typeName = i->getModuleOwner()->getPixmapName(i); |
372 | 394 | ||
373 | item->setPixmap(1, (Resource::loadPixmap(typeName))); | 395 | item->setPixmap(1, (Resource::loadPixmap(typeName))); |
374 | item->setText(2, i->getHardwareName()); | 396 | item->setText(2, i->getHardwareName()); |
375 | item->setText(3, (i->getStatus()) ? i->getIp() : QString("")); | 397 | item->setText(3, (i->getStatus()) ? i->getIp() : QString("")); |
376 | } | 398 | } |
377 | 399 | ||
378 | void MainWindowImp::newProfileChanged(const QString& newText){ | 400 | void MainWindowImp::newProfileChanged(const QString& newText){ |
379 | if(newText.length() > 0) | 401 | if(newText.length() > 0) |
380 | newProfileButton->setEnabled(true); | 402 | newProfileButton->setEnabled(true); |
diff --git a/noncore/settings/networksettings/networksetup.pro b/noncore/settings/networksettings/networksetup.pro index f09db93..441bbaa 100644 --- a/noncore/settings/networksettings/networksetup.pro +++ b/noncore/settings/networksettings/networksetup.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | #DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE= app | 2 | TEMPLATE= app |
3 | #CONFIG = qt warn_on debug | 3 | #CONFIG = qt warn_on debug |
4 | CONFIG = qt warn_on release | 4 | CONFIG = qt warn_on release |
5 | HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h | 5 | HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h |
6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp | 6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp |
7 | INCLUDEPATH+= $(OPIEDIR)/include | 7 | #INCLUDEPATH+= $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 8 | #DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | INTERFACES= mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui | 10 | INTERFACES= mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui |
11 | TARGET = networksetup | 11 | TARGET = networksetup |