author | benmeyer <benmeyer> | 2002-10-21 15:59:21 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-10-21 15:59:21 (UTC) |
commit | bb135a644e61cbc30116b96ff8fb24dfb7576a21 (patch) (unidiff) | |
tree | 5b3114322ba7f552512925e3247f77588d53bbbb | |
parent | d9ddcd0eb7608321eb2b94ad427868948ea627c2 (diff) | |
download | opie-bb135a644e61cbc30116b96ff8fb24dfb7576a21.zip opie-bb135a644e61cbc30116b96ff8fb24dfb7576a21.tar.gz opie-bb135a644e61cbc30116b96ff8fb24dfb7576a21.tar.bz2 |
Some deletion coverage
-rw-r--r-- | noncore/net/networksetup/mainwindowimp.cpp | 7 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 5 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 7 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 5 |
4 files changed, 18 insertions, 6 deletions
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index 843f630..9d81ab1 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp | |||
@@ -70,32 +70,39 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par | |||
70 | break; | 70 | break; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | file.close(); | 73 | file.close(); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Deconstructor. Save profiles. Delete loaded libraries. | 78 | * Deconstructor. Save profiles. Delete loaded libraries. |
79 | */ | 79 | */ |
80 | MainWindowImp::~MainWindowImp(){ | 80 | MainWindowImp::~MainWindowImp(){ |
81 | // Save profiles. | 81 | // Save profiles. |
82 | Config cfg("NetworkSetup"); | 82 | Config cfg("NetworkSetup"); |
83 | cfg.setGroup("General"); | 83 | cfg.setGroup("General"); |
84 | cfg.writeEntry("Profiles", profiles.join(" ")); | 84 | cfg.writeEntry("Profiles", profiles.join(" ")); |
85 | 85 | ||
86 | // Delete all interfaces that don't have owners. | ||
87 | QMap<Interface*, QListViewItem*>::Iterator iIt; | ||
88 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ | ||
89 | if(iIt.key()->getModuleOwner() == NULL) | ||
90 | delete iIt.key(); | ||
91 | } | ||
92 | |||
86 | // Delete Modules and Libraries | 93 | // Delete Modules and Libraries |
87 | QMap<Module*, QLibrary*>::Iterator it; | 94 | QMap<Module*, QLibrary*>::Iterator it; |
88 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 95 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
89 | delete it.key(); | 96 | delete it.key(); |
90 | delete it.data(); | 97 | delete it.data(); |
91 | } | 98 | } |
92 | } | 99 | } |
93 | 100 | ||
94 | /** | 101 | /** |
95 | * Load all modules that are found in the path | 102 | * Load all modules that are found in the path |
96 | * @param path a directory that is scaned for any plugins that can be loaded | 103 | * @param path a directory that is scaned for any plugins that can be loaded |
97 | * and attempts to load them | 104 | * and attempts to load them |
98 | */ | 105 | */ |
99 | void MainWindowImp::loadModules(QString path){ | 106 | void MainWindowImp::loadModules(QString path){ |
100 | //qDebug(path.latin1()); | 107 | //qDebug(path.latin1()); |
101 | QDir d(path); | 108 | QDir d(path); |
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index cbb520d..24cb1cd 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp | |||
@@ -1,22 +1,20 @@ | |||
1 | #include "wlanmodule.h" | 1 | #include "wlanmodule.h" |
2 | #include <qpe/config.h> | ||
3 | #include "wlanimp.h" | 2 | #include "wlanimp.h" |
4 | #include "info.h" | 3 | #include "info.h" |
5 | 4 | ||
6 | |||
7 | #include <arpa/inet.h> | 5 | #include <arpa/inet.h> |
8 | #include <sys/socket.h> | 6 | #include <sys/socket.h> |
9 | #include <linux/if_ether.h> | 7 | #include <linux/if_ether.h> |
10 | #include <netinet/ip.h> | 8 | #include <netinet/ip.h> |
11 | #include <sys/ioctl.h> | 9 | #include <sys/ioctl.h> |
12 | #include <linux/wireless.h> | 10 | #include <linux/wireless.h> |
13 | 11 | ||
14 | #include <unistd.h> | 12 | #include <unistd.h> |
15 | #include <math.h> | 13 | #include <math.h> |
16 | #include <errno.h> | 14 | #include <errno.h> |
17 | #include <string.h> | 15 | #include <string.h> |
18 | #include <stdio.h> | 16 | #include <stdio.h> |
19 | 17 | ||
20 | #include <stdlib.h> | 18 | #include <stdlib.h> |
21 | 19 | ||
22 | #include <qlabel.h> | 20 | #include <qlabel.h> |
@@ -50,43 +48,44 @@ QString WLANModule::getPixmapName(Interface* ){ | |||
50 | * @return bool true if i is owned by this module, false otherwise. | 48 | * @return bool true if i is owned by this module, false otherwise. |
51 | */ | 49 | */ |
52 | bool WLANModule::isOwner(Interface *i){ | 50 | bool WLANModule::isOwner(Interface *i){ |
53 | if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ | 51 | if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ |
54 | i->setHardwareName("802.11b"); | 52 | i->setHardwareName("802.11b"); |
55 | return true; | 53 | return true; |
56 | } | 54 | } |
57 | return false; | 55 | return false; |
58 | } | 56 | } |
59 | 57 | ||
60 | /** | 58 | /** |
61 | * Create, set tabWiget and return the WLANConfigure Module | 59 | * Create, set tabWiget and return the WLANConfigure Module |
62 | * @param tabWidget a pointer to the tab widget that this configure has. | 60 | * @param tabWidget a pointer to the tab widget that this configure has. |
63 | * @return QWidget* pointer to the tab widget in this modules configure. | 61 | * @return QWidget* pointer to the tab widget in this modules configure. |
64 | */ | 62 | */ |
65 | QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ | 63 | QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ |
66 | WLANImp *wlanconfig = new WLANImp( ); | 64 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig"); |
67 | (*tabWidget) = wlanconfig->tabWidget; | 65 | (*tabWidget) = wlanconfig->tabWidget; |
68 | return wlanconfig; | 66 | return wlanconfig; |
69 | } | 67 | } |
70 | 68 | ||
71 | /** | 69 | /** |
72 | * Create, set tabWiget and return the Information Module | 70 | * Create, set tabWiget and return the Information Module |
73 | * @param tabWidget a pointer to the tab widget that this information has. | 71 | * @param tabWidget a pointer to the tab widget that this information has. |
74 | * @return QWidget* pointer to the tab widget in this modules info. | 72 | * @return QWidget* pointer to the tab widget in this modules info. |
75 | */ | 73 | */ |
76 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ | 74 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ |
75 | return NULL; | ||
77 | WlanInfo *info = new WlanInfo(0, "wireless info"); | 76 | WlanInfo *info = new WlanInfo(0, "wireless info"); |
78 | (*tabWidget) = info->tabWidget; | 77 | (*tabWidget) = info->tabWidget; |
79 | 78 | ||
80 | struct ifreq ifr; | 79 | struct ifreq ifr; |
81 | struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; | 80 | struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; |
82 | int fd = socket( AF_INET, SOCK_DGRAM, 0 ); | 81 | int fd = socket( AF_INET, SOCK_DGRAM, 0 ); |
83 | 82 | ||
84 | const char* buffer[200]; | 83 | const char* buffer[200]; |
85 | struct iwreq iwr; | 84 | struct iwreq iwr; |
86 | memset( &iwr, 0, sizeof( iwr ) ); | 85 | memset( &iwr, 0, sizeof( iwr ) ); |
87 | iwr.u.essid.pointer = (caddr_t) buffer; | 86 | iwr.u.essid.pointer = (caddr_t) buffer; |
88 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; | 87 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; |
89 | iwr.u.essid.flags = 0; | 88 | iwr.u.essid.flags = 0; |
90 | 89 | ||
91 | // check if it is an IEEE 802.11 standard conform | 90 | // check if it is an IEEE 802.11 standard conform |
92 | // wireless device by sending SIOCGIWESSID | 91 | // wireless device by sending SIOCGIWESSID |
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 843f630..9d81ab1 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -70,32 +70,39 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par | |||
70 | break; | 70 | break; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | file.close(); | 73 | file.close(); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Deconstructor. Save profiles. Delete loaded libraries. | 78 | * Deconstructor. Save profiles. Delete loaded libraries. |
79 | */ | 79 | */ |
80 | MainWindowImp::~MainWindowImp(){ | 80 | MainWindowImp::~MainWindowImp(){ |
81 | // Save profiles. | 81 | // Save profiles. |
82 | Config cfg("NetworkSetup"); | 82 | Config cfg("NetworkSetup"); |
83 | cfg.setGroup("General"); | 83 | cfg.setGroup("General"); |
84 | cfg.writeEntry("Profiles", profiles.join(" ")); | 84 | cfg.writeEntry("Profiles", profiles.join(" ")); |
85 | 85 | ||
86 | // Delete all interfaces that don't have owners. | ||
87 | QMap<Interface*, QListViewItem*>::Iterator iIt; | ||
88 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ | ||
89 | if(iIt.key()->getModuleOwner() == NULL) | ||
90 | delete iIt.key(); | ||
91 | } | ||
92 | |||
86 | // Delete Modules and Libraries | 93 | // Delete Modules and Libraries |
87 | QMap<Module*, QLibrary*>::Iterator it; | 94 | QMap<Module*, QLibrary*>::Iterator it; |
88 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 95 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
89 | delete it.key(); | 96 | delete it.key(); |
90 | delete it.data(); | 97 | delete it.data(); |
91 | } | 98 | } |
92 | } | 99 | } |
93 | 100 | ||
94 | /** | 101 | /** |
95 | * Load all modules that are found in the path | 102 | * Load all modules that are found in the path |
96 | * @param path a directory that is scaned for any plugins that can be loaded | 103 | * @param path a directory that is scaned for any plugins that can be loaded |
97 | * and attempts to load them | 104 | * and attempts to load them |
98 | */ | 105 | */ |
99 | void MainWindowImp::loadModules(QString path){ | 106 | void MainWindowImp::loadModules(QString path){ |
100 | //qDebug(path.latin1()); | 107 | //qDebug(path.latin1()); |
101 | QDir d(path); | 108 | QDir d(path); |
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index cbb520d..24cb1cd 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -1,22 +1,20 @@ | |||
1 | #include "wlanmodule.h" | 1 | #include "wlanmodule.h" |
2 | #include <qpe/config.h> | ||
3 | #include "wlanimp.h" | 2 | #include "wlanimp.h" |
4 | #include "info.h" | 3 | #include "info.h" |
5 | 4 | ||
6 | |||
7 | #include <arpa/inet.h> | 5 | #include <arpa/inet.h> |
8 | #include <sys/socket.h> | 6 | #include <sys/socket.h> |
9 | #include <linux/if_ether.h> | 7 | #include <linux/if_ether.h> |
10 | #include <netinet/ip.h> | 8 | #include <netinet/ip.h> |
11 | #include <sys/ioctl.h> | 9 | #include <sys/ioctl.h> |
12 | #include <linux/wireless.h> | 10 | #include <linux/wireless.h> |
13 | 11 | ||
14 | #include <unistd.h> | 12 | #include <unistd.h> |
15 | #include <math.h> | 13 | #include <math.h> |
16 | #include <errno.h> | 14 | #include <errno.h> |
17 | #include <string.h> | 15 | #include <string.h> |
18 | #include <stdio.h> | 16 | #include <stdio.h> |
19 | 17 | ||
20 | #include <stdlib.h> | 18 | #include <stdlib.h> |
21 | 19 | ||
22 | #include <qlabel.h> | 20 | #include <qlabel.h> |
@@ -50,43 +48,44 @@ QString WLANModule::getPixmapName(Interface* ){ | |||
50 | * @return bool true if i is owned by this module, false otherwise. | 48 | * @return bool true if i is owned by this module, false otherwise. |
51 | */ | 49 | */ |
52 | bool WLANModule::isOwner(Interface *i){ | 50 | bool WLANModule::isOwner(Interface *i){ |
53 | if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ | 51 | if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ |
54 | i->setHardwareName("802.11b"); | 52 | i->setHardwareName("802.11b"); |
55 | return true; | 53 | return true; |
56 | } | 54 | } |
57 | return false; | 55 | return false; |
58 | } | 56 | } |
59 | 57 | ||
60 | /** | 58 | /** |
61 | * Create, set tabWiget and return the WLANConfigure Module | 59 | * Create, set tabWiget and return the WLANConfigure Module |
62 | * @param tabWidget a pointer to the tab widget that this configure has. | 60 | * @param tabWidget a pointer to the tab widget that this configure has. |
63 | * @return QWidget* pointer to the tab widget in this modules configure. | 61 | * @return QWidget* pointer to the tab widget in this modules configure. |
64 | */ | 62 | */ |
65 | QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ | 63 | QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ |
66 | WLANImp *wlanconfig = new WLANImp( ); | 64 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig"); |
67 | (*tabWidget) = wlanconfig->tabWidget; | 65 | (*tabWidget) = wlanconfig->tabWidget; |
68 | return wlanconfig; | 66 | return wlanconfig; |
69 | } | 67 | } |
70 | 68 | ||
71 | /** | 69 | /** |
72 | * Create, set tabWiget and return the Information Module | 70 | * Create, set tabWiget and return the Information Module |
73 | * @param tabWidget a pointer to the tab widget that this information has. | 71 | * @param tabWidget a pointer to the tab widget that this information has. |
74 | * @return QWidget* pointer to the tab widget in this modules info. | 72 | * @return QWidget* pointer to the tab widget in this modules info. |
75 | */ | 73 | */ |
76 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ | 74 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ |
75 | return NULL; | ||
77 | WlanInfo *info = new WlanInfo(0, "wireless info"); | 76 | WlanInfo *info = new WlanInfo(0, "wireless info"); |
78 | (*tabWidget) = info->tabWidget; | 77 | (*tabWidget) = info->tabWidget; |
79 | 78 | ||
80 | struct ifreq ifr; | 79 | struct ifreq ifr; |
81 | struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; | 80 | struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; |
82 | int fd = socket( AF_INET, SOCK_DGRAM, 0 ); | 81 | int fd = socket( AF_INET, SOCK_DGRAM, 0 ); |
83 | 82 | ||
84 | const char* buffer[200]; | 83 | const char* buffer[200]; |
85 | struct iwreq iwr; | 84 | struct iwreq iwr; |
86 | memset( &iwr, 0, sizeof( iwr ) ); | 85 | memset( &iwr, 0, sizeof( iwr ) ); |
87 | iwr.u.essid.pointer = (caddr_t) buffer; | 86 | iwr.u.essid.pointer = (caddr_t) buffer; |
88 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; | 87 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; |
89 | iwr.u.essid.flags = 0; | 88 | iwr.u.essid.flags = 0; |
90 | 89 | ||
91 | // check if it is an IEEE 802.11 standard conform | 90 | // check if it is an IEEE 802.11 standard conform |
92 | // wireless device by sending SIOCGIWESSID | 91 | // wireless device by sending SIOCGIWESSID |