-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/opie-networksettings.control | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 9a17743..9efc8c2 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -1,301 +1,301 @@ | |||
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> | 15 | #include <qmainwindow.h> |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | 17 | ||
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpe/qlibrary.h> | 19 | #include <qpe/qlibrary.h> |
20 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | 22 | ||
23 | #include <qlist.h> | 23 | #include <qlist.h> |
24 | #include <qdir.h> | 24 | #include <qdir.h> |
25 | #include <qfile.h> | 25 | #include <qfile.h> |
26 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
27 | 27 | ||
28 | #include <net/if.h> | 28 | #include <net/if.h> |
29 | #include <sys/ioctl.h> | 29 | #include <sys/ioctl.h> |
30 | 30 | ||
31 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" | 31 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" |
32 | 32 | ||
33 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false), scheme(DEFAULT_SCHEME){ | 33 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false), scheme(DEFAULT_SCHEME){ |
34 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); | 34 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); |
35 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); | 35 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); |
36 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); | 36 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); |
37 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); | 37 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); |
38 | 38 | ||
39 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); | 39 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); |
40 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); | 40 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); |
41 | connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); | 41 | connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); |
42 | 42 | ||
43 | connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); | 43 | connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); |
44 | // Load connections. | 44 | // Load connections. |
45 | loadModules(QPEApplication::qpeDir() + "/plugins/networksetup"); | 45 | loadModules(QPEApplication::qpeDir() + "/plugins/networksettings"); |
46 | getAllInterfaces(); | 46 | getAllInterfaces(); |
47 | 47 | ||
48 | Interfaces i; | 48 | Interfaces i; |
49 | QStringList list = i.getInterfaceList(); | 49 | QStringList list = i.getInterfaceList(); |
50 | QMap<QString, Interface*>::Iterator it; | 50 | QMap<QString, Interface*>::Iterator it; |
51 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { | 51 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { |
52 | bool found = false; | 52 | bool found = false; |
53 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ | 53 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ |
54 | if(it.key() == (*ni)) | 54 | if(it.key() == (*ni)) |
55 | found = true; | 55 | found = true; |
56 | } | 56 | } |
57 | if(!found){ | 57 | if(!found){ |
58 | if(!(*ni).contains("_")){ | 58 | if(!(*ni).contains("_")){ |
59 | Interface *i = new Interface(this, *ni, false); | 59 | Interface *i = new Interface(this, *ni, false); |
60 | i->setAttached(false); | 60 | i->setAttached(false); |
61 | i->setHardwareName("Disconnected"); | 61 | i->setHardwareName("Disconnected"); |
62 | interfaceNames.insert(i->getInterfaceName(), i); | 62 | interfaceNames.insert(i->getInterfaceName(), i); |
63 | updateInterface(i); | 63 | updateInterface(i); |
64 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 64 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | //getInterfaceList(); | 69 | //getInterfaceList(); |
70 | connectionList->header()->hide(); | 70 | connectionList->header()->hide(); |
71 | 71 | ||
72 | Config cfg("NetworkSetup"); | 72 | Config cfg("NetworkSetup"); |
73 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); | 73 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); |
74 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 74 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
75 | profilesList->insertItem((*it)); | 75 | profilesList->insertItem((*it)); |
76 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); | 76 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); |
77 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); | 77 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); |
78 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); | 78 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); |
79 | 79 | ||
80 | QFile file(scheme); | 80 | QFile file(scheme); |
81 | if ( file.open(IO_ReadOnly) ) { // file opened successfully | 81 | if ( file.open(IO_ReadOnly) ) { // file opened successfully |
82 | QTextStream stream( &file ); // use a text stream | 82 | QTextStream stream( &file ); // use a text stream |
83 | while ( !stream.eof() ) { // until end of file... | 83 | while ( !stream.eof() ) { // until end of file... |
84 | QString line = stream.readLine(); // line of text excluding '\n' | 84 | QString line = stream.readLine(); // line of text excluding '\n' |
85 | if(line.contains("SCHEME")){ | 85 | if(line.contains("SCHEME")){ |
86 | line = line.mid(7, line.length()); | 86 | line = line.mid(7, line.length()); |
87 | currentProfileLabel->setText(line); | 87 | currentProfileLabel->setText(line); |
88 | break; | 88 | break; |
89 | } | 89 | } |
90 | } | 90 | } |
91 | file.close(); | 91 | file.close(); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * Deconstructor. Save profiles. Delete loaded libraries. | 96 | * Deconstructor. Save profiles. Delete loaded libraries. |
97 | */ | 97 | */ |
98 | MainWindowImp::~MainWindowImp(){ | 98 | MainWindowImp::~MainWindowImp(){ |
99 | // Save profiles. | 99 | // Save profiles. |
100 | Config cfg("NetworkSetup"); | 100 | Config cfg("NetworkSetup"); |
101 | cfg.setGroup("General"); | 101 | cfg.setGroup("General"); |
102 | cfg.writeEntry("Profiles", profiles.join(" ")); | 102 | cfg.writeEntry("Profiles", profiles.join(" ")); |
103 | 103 | ||
104 | // Delete all interfaces that don't have owners. | 104 | // Delete all interfaces that don't have owners. |
105 | QMap<Interface*, QListViewItem*>::Iterator iIt; | 105 | QMap<Interface*, QListViewItem*>::Iterator iIt; |
106 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ | 106 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ |
107 | if(iIt.key()->getModuleOwner() == NULL) | 107 | if(iIt.key()->getModuleOwner() == NULL) |
108 | delete iIt.key(); | 108 | delete iIt.key(); |
109 | } | 109 | } |
110 | 110 | ||
111 | // Delete Modules and Libraries | 111 | // Delete Modules and Libraries |
112 | QMap<Module*, QLibrary*>::Iterator it; | 112 | QMap<Module*, QLibrary*>::Iterator it; |
113 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 113 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
114 | delete it.key(); | 114 | delete it.key(); |
115 | // I wonder why I can't delete the libraries | 115 | // I wonder why I can't delete the libraries |
116 | // What fucking shit this is. | 116 | // What fucking shit this is. |
117 | //delete it.data(); | 117 | //delete it.data(); |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * Query the kernel for all of the interfaces. | 122 | * Query the kernel for all of the interfaces. |
123 | */ | 123 | */ |
124 | void MainWindowImp::getAllInterfaces(){ | 124 | void MainWindowImp::getAllInterfaces(){ |
125 | int sockfd = socket(AF_INET, SOCK_DGRAM, 0); | 125 | int sockfd = socket(AF_INET, SOCK_DGRAM, 0); |
126 | if(sockfd == -1) | 126 | if(sockfd == -1) |
127 | return; | 127 | return; |
128 | 128 | ||
129 | char buf[8*1024]; | 129 | char buf[8*1024]; |
130 | struct ifconf ifc; | 130 | struct ifconf ifc; |
131 | ifc.ifc_len = sizeof(buf); | 131 | ifc.ifc_len = sizeof(buf); |
132 | ifc.ifc_req = (struct ifreq *) buf; | 132 | ifc.ifc_req = (struct ifreq *) buf; |
133 | int result=ioctl(sockfd, SIOCGIFCONF, &ifc); | 133 | int result=ioctl(sockfd, SIOCGIFCONF, &ifc); |
134 | 134 | ||
135 | for (char* ptr = buf; ptr < buf + ifc.ifc_len; ){ | 135 | for (char* ptr = buf; ptr < buf + ifc.ifc_len; ){ |
136 | struct ifreq *ifr =(struct ifreq *) ptr; | 136 | struct ifreq *ifr =(struct ifreq *) ptr; |
137 | int len = sizeof(struct sockaddr); | 137 | int len = sizeof(struct sockaddr); |
138 | #ifdef HAVE_SOCKADDR_SA_LEN | 138 | #ifdef HAVE_SOCKADDR_SA_LEN |
139 | if (ifr->ifr_addr.sa_len > len) | 139 | if (ifr->ifr_addr.sa_len > len) |
140 | len = ifr->ifr_addr.sa_len; /* length > 16 */ | 140 | len = ifr->ifr_addr.sa_len; /* length > 16 */ |
141 | #endif | 141 | #endif |
142 | ptr += sizeof(ifr->ifr_name) + len; /* for next one in buffer */ | 142 | ptr += sizeof(ifr->ifr_name) + len; /* for next one in buffer */ |
143 | 143 | ||
144 | int flags; | 144 | int flags; |
145 | struct sockaddr_in *sinptr; | 145 | struct sockaddr_in *sinptr; |
146 | Interface *i = NULL; | 146 | Interface *i = NULL; |
147 | switch (ifr->ifr_addr.sa_family){ | 147 | switch (ifr->ifr_addr.sa_family){ |
148 | case AF_INET: | 148 | case AF_INET: |
149 | sinptr = (struct sockaddr_in *) &ifr->ifr_addr; | 149 | sinptr = (struct sockaddr_in *) &ifr->ifr_addr; |
150 | flags=0; | 150 | flags=0; |
151 | 151 | ||
152 | struct ifreq ifcopy; | 152 | struct ifreq ifcopy; |
153 | ifcopy=*ifr; | 153 | ifcopy=*ifr; |
154 | result=ioctl(sockfd,SIOCGIFFLAGS,&ifcopy); | 154 | result=ioctl(sockfd,SIOCGIFFLAGS,&ifcopy); |
155 | flags=ifcopy.ifr_flags; | 155 | flags=ifcopy.ifr_flags; |
156 | i = new Interface(this, ifr->ifr_name, false); | 156 | i = new Interface(this, ifr->ifr_name, false); |
157 | i->setAttached(true); | 157 | i->setAttached(true); |
158 | if ((flags & IFF_UP) == IFF_UP) | 158 | if ((flags & IFF_UP) == IFF_UP) |
159 | i->setStatus(true); | 159 | i->setStatus(true); |
160 | else | 160 | else |
161 | i->setStatus(false); | 161 | i->setStatus(false); |
162 | 162 | ||
163 | if ((flags & IFF_BROADCAST) == IFF_BROADCAST) | 163 | if ((flags & IFF_BROADCAST) == IFF_BROADCAST) |
164 | i->setHardwareName("Ethernet"); | 164 | i->setHardwareName("Ethernet"); |
165 | else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) | 165 | else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) |
166 | i->setHardwareName("Point to Point"); | 166 | i->setHardwareName("Point to Point"); |
167 | else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) | 167 | else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) |
168 | i->setHardwareName("Multicast"); | 168 | i->setHardwareName("Multicast"); |
169 | else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) | 169 | else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) |
170 | i->setHardwareName("Loopback"); | 170 | i->setHardwareName("Loopback"); |
171 | else | 171 | else |
172 | i->setHardwareName("Unknown"); | 172 | i->setHardwareName("Unknown"); |
173 | 173 | ||
174 | interfaceNames.insert(i->getInterfaceName(), i); | 174 | interfaceNames.insert(i->getInterfaceName(), i); |
175 | updateInterface(i); | 175 | updateInterface(i); |
176 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 176 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
177 | break; | 177 | break; |
178 | 178 | ||
179 | default: | 179 | default: |
180 | qDebug(ifr->ifr_name); | 180 | qDebug(ifr->ifr_name); |
181 | qDebug(QString("%1").arg(ifr->ifr_addr.sa_family).latin1()); | 181 | qDebug(QString("%1").arg(ifr->ifr_addr.sa_family).latin1()); |
182 | break; | 182 | break; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | /** | 187 | /** |
188 | * Load all modules that are found in the path | 188 | * Load all modules that are found in the path |
189 | * @param path a directory that is scaned for any plugins that can be loaded | 189 | * @param path a directory that is scaned for any plugins that can be loaded |
190 | * and attempts to load them | 190 | * and attempts to load them |
191 | */ | 191 | */ |
192 | void MainWindowImp::loadModules(const QString &path){ | 192 | void MainWindowImp::loadModules(const QString &path){ |
193 | //qDebug(path.latin1()); | 193 | //qDebug(path.latin1()); |
194 | QDir d(path); | 194 | QDir d(path); |
195 | if(!d.exists()) | 195 | if(!d.exists()) |
196 | return; | 196 | return; |
197 | 197 | ||
198 | // Don't want sym links | 198 | // Don't want sym links |
199 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 199 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
200 | const QFileInfoList *list = d.entryInfoList(); | 200 | const QFileInfoList *list = d.entryInfoList(); |
201 | QFileInfoListIterator it( *list ); | 201 | QFileInfoListIterator it( *list ); |
202 | QFileInfo *fi; | 202 | QFileInfo *fi; |
203 | while ( (fi=it.current()) ) { | 203 | while ( (fi=it.current()) ) { |
204 | if(fi->fileName().contains(".so")){ | 204 | if(fi->fileName().contains(".so")){ |
205 | loadPlugin(path + "/" + fi->fileName()); | 205 | loadPlugin(path + "/" + fi->fileName()); |
206 | } | 206 | } |
207 | ++it; | 207 | ++it; |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | /** | 211 | /** |
212 | * Attempt to load a function and resolve a function. | 212 | * Attempt to load a function and resolve a function. |
213 | * @param pluginFileName - the name of the file in which to attempt to load | 213 | * @param pluginFileName - the name of the file in which to attempt to load |
214 | * @param resolveString - function pointer to resolve | 214 | * @param resolveString - function pointer to resolve |
215 | * @return pointer to the function with name resolveString or NULL | 215 | * @return pointer to the function with name resolveString or NULL |
216 | */ | 216 | */ |
217 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){ | 217 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){ |
218 | //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); | 218 | //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); |
219 | QLibrary *lib = new QLibrary(pluginFileName); | 219 | QLibrary *lib = new QLibrary(pluginFileName); |
220 | void *functionPointer = lib->resolve(resolveString); | 220 | void *functionPointer = lib->resolve(resolveString); |
221 | if( !functionPointer ){ | 221 | if( !functionPointer ){ |
222 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 222 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); |
223 | delete lib; | 223 | delete lib; |
224 | return NULL; | 224 | return NULL; |
225 | } | 225 | } |
226 | 226 | ||
227 | // Try to get an object. | 227 | // Try to get an object. |
228 | Module *object = ((Module* (*)()) functionPointer)(); | 228 | Module *object = ((Module* (*)()) functionPointer)(); |
229 | if(object == NULL){ | 229 | if(object == NULL){ |
230 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 230 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
231 | delete lib; | 231 | delete lib; |
232 | return NULL; | 232 | return NULL; |
233 | } | 233 | } |
234 | 234 | ||
235 | // Store for deletion later | 235 | // Store for deletion later |
236 | libraries.insert(object, lib); | 236 | libraries.insert(object, lib); |
237 | return object; | 237 | return object; |
238 | } | 238 | } |
239 | 239 | ||
240 | /** | 240 | /** |
241 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 241 | * 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 | 242 | * load the plugin and append it to the list |
243 | */ | 243 | */ |
244 | void MainWindowImp::addClicked(){ | 244 | void MainWindowImp::addClicked(){ |
245 | QMap<Module*, QLibrary*>::Iterator it; | 245 | QMap<Module*, QLibrary*>::Iterator it; |
246 | QMap<QString, QString> list; | 246 | QMap<QString, QString> list; |
247 | QMap<QString, Module*> newInterfaceOwners; | 247 | QMap<QString, Module*> newInterfaceOwners; |
248 | //list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); | 248 | //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"); | 249 | //list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port"); |
250 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 250 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
251 | if(it.key()){ | 251 | if(it.key()){ |
252 | (it.key())->possibleNewInterfaces(list); | 252 | (it.key())->possibleNewInterfaces(list); |
253 | } | 253 | } |
254 | } | 254 | } |
255 | // See if the list has anything that we can add. | 255 | // See if the list has anything that we can add. |
256 | if(list.count() == 0){ | 256 | if(list.count() == 0){ |
257 | QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok); | 257 | QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok); |
258 | return; | 258 | return; |
259 | } | 259 | } |
260 | AddConnectionImp addNewConnection(this, "AddConnectionImp", true); | 260 | AddConnectionImp addNewConnection(this, "AddConnectionImp", true); |
261 | addNewConnection.addConnections(list); | 261 | addNewConnection.addConnections(list); |
262 | addNewConnection.showMaximized(); | 262 | addNewConnection.showMaximized(); |
263 | if(QDialog::Accepted == addNewConnection.exec()){ | 263 | if(QDialog::Accepted == addNewConnection.exec()){ |
264 | QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); | 264 | QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); |
265 | if(!item) | 265 | if(!item) |
266 | return; | 266 | return; |
267 | 267 | ||
268 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 268 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
269 | if(it.key()){ | 269 | if(it.key()){ |
270 | Interface *i = (it.key())->addNewInterface(item->text(0)); | 270 | Interface *i = (it.key())->addNewInterface(item->text(0)); |
271 | if(i){ | 271 | if(i){ |
272 | interfaceNames.insert(i->getInterfaceName(), i); | 272 | interfaceNames.insert(i->getInterfaceName(), i); |
273 | updateInterface(i); | 273 | updateInterface(i); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | } | 276 | } |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * Prompt the user to see if they really want to do this. | 281 | * Prompt the user to see if they really want to do this. |
282 | * If they do then remove from the list and unload. | 282 | * If they do then remove from the list and unload. |
283 | */ | 283 | */ |
284 | void MainWindowImp::removeClicked(){ | 284 | void MainWindowImp::removeClicked(){ |
285 | QListViewItem *item = connectionList->currentItem(); | 285 | QListViewItem *item = connectionList->currentItem(); |
286 | if(!item) { | 286 | if(!item) { |
287 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); | 287 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |
288 | return; | 288 | return; |
289 | } | 289 | } |
290 | 290 | ||
291 | Interface *i = interfaceItems[item]; | 291 | Interface *i = interfaceItems[item]; |
292 | if(i->getModuleOwner() == NULL){ | 292 | if(i->getModuleOwner() == NULL){ |
293 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); | 293 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); |
294 | } | 294 | } |
295 | else{ | 295 | else{ |
296 | if(!i->getModuleOwner()->remove(i)) | 296 | if(!i->getModuleOwner()->remove(i)) |
297 | QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok); | 297 | QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok); |
298 | else{ | 298 | else{ |
299 | QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); | 299 | QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); |
300 | // TODO memory managment.... | 300 | // TODO memory managment.... |
301 | // who deletes the interface? | 301 | // who deletes the interface? |
diff --git a/noncore/settings/networksettings/opie-networksettings.control b/noncore/settings/networksettings/opie-networksettings.control index 585e50e..8fa40c7 100644 --- a/noncore/settings/networksettings/opie-networksettings.control +++ b/noncore/settings/networksettings/opie-networksettings.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Files: bin/networksetup apps/Settings/networksetup.desktop plugins/networksetup/* pics/networksetup/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile | 1 | Files: bin/networksettings apps/Settings/networksettings.desktop plugins/networksettings/* pics/networksettings/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/settings | 3 | Section: opie/settings |
4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> | 4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: Network settings | 8 | Description: Network settings |