summaryrefslogtreecommitdiff
path: root/noncore
authortille <tille>2003-05-25 00:51:44 (UTC)
committer tille <tille>2003-05-25 00:51:44 (UTC)
commitf6d835c4846f48d33f0ba9e86707c4ec23544182 (patch) (unidiff)
tree65d9019f52445054331ba3a30277ca41abb0feca /noncore
parent672a9a2ecd1132aadcf1043946e27339693145a4 (diff)
downloadopie-f6d835c4846f48d33f0ba9e86707c4ec23544182.zip
opie-f6d835c4846f48d33f0ba9e86707c4ec23544182.tar.gz
opie-f6d835c4846f48d33f0ba9e86707c4ec23544182.tar.bz2
ask plugins for interfaces...
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index a61f620..63b9603 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -154,12 +154,13 @@ void MainWindowImp::getAllInterfaces(){
154 return; 154 return;
155 155
156 struct ifreq ifr; 156 struct ifreq ifr;
157 QStringList ifaces; 157 QStringList ifaces;
158 QFile procFile(QString(_PROCNETDEV)); 158 QFile procFile(QString(_PROCNETDEV));
159 int result; 159 int result;
160 Interface *i;
160 161
161 if (! procFile.exists()) { 162 if (! procFile.exists()) {
162 struct ifreq ifrs[100]; 163 struct ifreq ifrs[100];
163 struct ifconf ifc; 164 struct ifconf ifc;
164 ifc.ifc_len = sizeof(ifrs); 165 ifc.ifc_len = sizeof(ifrs);
165 ifc.ifc_req = ifrs; 166 ifc.ifc_req = ifrs;
@@ -184,13 +185,13 @@ void MainWindowImp::getAllInterfaces(){
184 } 185 }
185 } 186 }
186 } 187 }
187 188
188 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) { 189 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) {
189 int flags = 0, family; 190 int flags = 0, family;
190 Interface *i = NULL; 191 i = NULL;
191 192
192 strcpy(ifr.ifr_name, (*it).latin1()); 193 strcpy(ifr.ifr_name, (*it).latin1());
193 194
194 struct ifreq ifcopy; 195 struct ifreq ifcopy;
195 ifcopy = ifr; 196 ifcopy = ifr;
196 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy); 197 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy);
@@ -213,13 +214,29 @@ void MainWindowImp::getAllInterfaces(){
213 else 214 else
214 i->setHardwareName("Unknown"); 215 i->setHardwareName("Unknown");
215 216
216 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name); 217 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name);
217 interfaceNames.insert(i->getInterfaceName(), i); 218 interfaceNames.insert(i->getInterfaceName(), i);
218 updateInterface(i); 219 updateInterface(i);
219 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 220 connect(i, SIGNAL(updateInterface(Interface *)),
221 this, SLOT(updateInterface(Interface *)));
222 }
223 // now lets ask the plugins too ;)
224 QMap<Module*, QLibrary*>::Iterator it;
225 QList<Interface> ilist;
226 for( it = libraries.begin(); it != libraries.end(); ++it ){
227 if(it.key()){
228 ilist = it.key()->getInterfaces();
229 for( i = ilist.first(); i != 0; i = ilist.next() ){
230 qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() );
231 interfaceNames.insert(i->getInterfaceName(), i);
232 updateInterface(i);
233 connect(i, SIGNAL(updateInterface(Interface *)),
234 this, SLOT(updateInterface(Interface *)));
235 }
236 }
220 } 237 }
221} 238}
222 239
223/** 240/**
224 * Load all modules that are found in the path 241 * Load all modules that are found in the path
225 * @param path a directory that is scaned for any plugins that can be loaded 242 * @param path a directory that is scaned for any plugins that can be loaded
@@ -313,14 +330,13 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &
313 * load the plugin and append it to the list 330 * load the plugin and append it to the list
314 */ 331 */
315void MainWindowImp::addClicked(){ 332void MainWindowImp::addClicked(){
316 QMap<Module*, QLibrary*>::Iterator it; 333 QMap<Module*, QLibrary*>::Iterator it;
317 QMap<QString, QString> list; 334 QMap<QString, QString> list;
318 QMap<QString, Module*> newInterfaceOwners; 335 QMap<QString, Module*> newInterfaceOwners;
319 //list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); 336
320 //list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
321 for( it = libraries.begin(); it != libraries.end(); ++it ){ 337 for( it = libraries.begin(); it != libraries.end(); ++it ){
322 if(it.key()){ 338 if(it.key()){
323 (it.key())->possibleNewInterfaces(list); 339 (it.key())->possibleNewInterfaces(list);
324 } 340 }
325 } 341 }
326 // See if the list has anything that we can add. 342 // See if the list has anything that we can add.