summaryrefslogtreecommitdiff
authorar <ar>2004-08-20 21:16:56 (UTC)
committer ar <ar>2004-08-20 21:16:56 (UTC)
commitda08f45abfb5e74c390d12736d3db9e8050068a2 (patch) (unidiff)
tree121d6a2e1ee83ffa8d568eb633c0ab3bb2510dd2
parenta0520b8e1012bec8a2f2e7fe1d15e6fd1d38f0b0 (diff)
downloadopie-da08f45abfb5e74c390d12736d3db9e8050068a2.zip
opie-da08f45abfb5e74c390d12736d3db9e8050068a2.tar.gz
opie-da08f45abfb5e74c390d12736d3db9e8050068a2.tar.bz2
- remove unnecessary tab.
this hack is only a dirty work-around to prevent some confusion. networksetting is unmaintained and should be replaced by networksettings2, when it's done.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindow/mainwindowimp.cpp48
1 files changed, 21 insertions, 27 deletions
diff --git a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
index 5184630..a4a2875 100644
--- a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
@@ -47,20 +47,14 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi
47{ 47{
48 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 48 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
49 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 49 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
50 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 50 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
51 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 51 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
52 52
53 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 53 //remove tab with no function
54 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 54 tabWidget->removePage( tab );
55 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
56
57 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
58
59 //FIXME: disable profiles for the moment:
60 tabWidget->setTabEnabled( tab, false );
61 55
62 // Load connections. 56 // Load connections.
63 // /usr/local/kde/lib/libinterfaces.la 57 // /usr/local/kde/lib/libinterfaces.la
64#ifdef QWS 58#ifdef QWS
65 loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); 59 loadModules(QPEApplication::qpeDir() + "plugins/networksettings");
66#else 60#else
@@ -77,13 +71,13 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi
77 /* 71 /*
78 * we skipped it in getAllInterfaces now 72 * we skipped it in getAllInterfaces now
79 * we need to ignore it as well 73 * we need to ignore it as well
80 */ 74 */
81 if (m_handledIfaces.contains( *ni) ) 75 if (m_handledIfaces.contains( *ni) )
82 { 76 {
83 odebug << "Not up iface handled by module" << oendl; 77 odebug << "Not up iface handled by module" << oendl;
84 continue; 78 continue;
85 } 79 }
86 bool found = false; 80 bool found = false;
87 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) 81 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it )
88 { 82 {
89 if(it.key() == (*ni)) 83 if(it.key() == (*ni))
@@ -217,13 +211,13 @@ void MainWindowImp::getAllInterfaces()
217 211
218 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) 212 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it)
219 { 213 {
220 int flags = 0; 214 int flags = 0;
221 if ( m_handledIfaces.contains( (*it) ) ) 215 if ( m_handledIfaces.contains( (*it) ) )
222 { 216 {
223 odebug << " " << (*it).latin1() << " is handled by a module" << oendl; 217 odebug << " " << (*it).latin1() << " is handled by a module" << oendl;
224 continue; 218 continue;
225 } 219 }
226 // int family; 220 // int family;
227 i = NULL; 221 i = NULL;
228 222
229 strcpy(ifr.ifr_name, (*it).latin1()); 223 strcpy(ifr.ifr_name, (*it).latin1());
@@ -247,13 +241,13 @@ void MainWindowImp::getAllInterfaces()
247 i->setHardwareName("Multicast"); 241 i->setHardwareName("Multicast");
248 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) 242 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
249 i->setHardwareName("Loopback"); 243 i->setHardwareName("Loopback");
250 else 244 else
251 i->setHardwareName("Unknown"); 245 i->setHardwareName("Unknown");
252 246
253 owarn << "Adding interface " << ifr.ifr_name << " to interfaceNames\n" << oendl; 247 owarn << "Adding interface " << ifr.ifr_name << " to interfaceNames\n" << oendl;
254 interfaceNames.insert(i->getInterfaceName(), i); 248 interfaceNames.insert(i->getInterfaceName(), i);
255 updateInterface(i); 249 updateInterface(i);
256 connect(i, SIGNAL(updateInterface(Interface*)), 250 connect(i, SIGNAL(updateInterface(Interface*)),
257 this, SLOT(updateInterface(Interface*))); 251 this, SLOT(updateInterface(Interface*)));
258 } 252 }
259 // now lets ask the plugins too ;) 253 // now lets ask the plugins too ;)
@@ -263,13 +257,13 @@ void MainWindowImp::getAllInterfaces()
263 { 257 {
264 if(it.key()) 258 if(it.key())
265 { 259 {
266 ilist = it.key()->getInterfaces(); 260 ilist = it.key()->getInterfaces();
267 for( i = ilist.first(); i != 0; i = ilist.next() ) 261 for( i = ilist.first(); i != 0; i = ilist.next() )
268 { 262 {
269 owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl; 263 owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl;
270 interfaceNames.insert(i->getInterfaceName(), i); 264 interfaceNames.insert(i->getInterfaceName(), i);
271 updateInterface(i); 265 updateInterface(i);
272 connect(i, SIGNAL(updateInterface(Interface*)), 266 connect(i, SIGNAL(updateInterface(Interface*)),
273 this, SLOT(updateInterface(Interface*))); 267 this, SLOT(updateInterface(Interface*)));
274 } 268 }
275 } 269 }
@@ -281,13 +275,13 @@ void MainWindowImp::getAllInterfaces()
281 * @param path a directory that is scaned for any plugins that can be loaded 275 * @param path a directory that is scaned for any plugins that can be loaded
282 * and attempts to load them 276 * and attempts to load them
283 */ 277 */
284void MainWindowImp::loadModules(const QString &path) 278void MainWindowImp::loadModules(const QString &path)
285{ 279{
286#ifdef DEBUG 280#ifdef DEBUG
287 odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl; 281 odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl;
288#endif 282#endif
289 QDir d(path); 283 QDir d(path);
290 if(!d.exists()) 284 if(!d.exists())
291 return; 285 return;
292 286
293 // Don't want sym links 287 // Don't want sym links
@@ -302,13 +296,13 @@ void MainWindowImp::loadModules(const QString &path)
302 { 296 {
303#else 297#else
304 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")) 298 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_"))
305 { 299 {
306#endif 300#endif
307 loadPlugin(path + "/" + fi->fileName()); 301 loadPlugin(path + "/" + fi->fileName());
308 odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl; 302 odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl;
309 } 303 }
310 ++it; 304 ++it;
311 } 305 }
312} 306}
313 307
314/** 308/**
@@ -317,31 +311,31 @@ void MainWindowImp::loadModules(const QString &path)
317 * @param resolveString - function pointer to resolve 311 * @param resolveString - function pointer to resolve
318 * @return pointer to the function with name resolveString or NULL 312 * @return pointer to the function with name resolveString or NULL
319 */ 313 */
320Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) 314Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString)
321{ 315{
322#ifdef DEBUG 316#ifdef DEBUG
323 odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl; 317 odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl;
324#endif 318#endif
325#ifdef QWS 319#ifdef QWS
326 QLibrary *lib = new QLibrary(pluginFileName); 320 QLibrary *lib = new QLibrary(pluginFileName);
327 void *functionPointer = lib->resolve(resolveString); 321 void *functionPointer = lib->resolve(resolveString);
328 if( !functionPointer ) 322 if( !functionPointer )
329 { 323 {
330#ifdef DEBUG 324#ifdef DEBUG
331 odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl; 325 odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl;
332#endif 326#endif
333 delete lib; 327 delete lib;
334 return NULL; 328 return NULL;
335 } 329 }
336 // Try to get an object. 330 // Try to get an object.
337 Module *object = ((Module* (*)()) functionPointer)(); 331 Module *object = ((Module* (*)()) functionPointer)();
338 if(object == NULL) 332 if(object == NULL)
339 { 333 {
340#ifdef DEBUG 334#ifdef DEBUG
341 odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; 335 odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl;
342#endif 336#endif
343 delete lib; 337 delete lib;
344 return NULL; 338 return NULL;
345 } 339 }
346 340
347 m_handledIfaces += object->handledInterfaceNames(); 341 m_handledIfaces += object->handledInterfaceNames();
@@ -350,26 +344,26 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &
350 return object; 344 return object;
351 345
352#else 346#else
353 QLibrary *lib = loader->library(pluginFileName); 347 QLibrary *lib = loader->library(pluginFileName);
354 if( !lib || !lib->hasSymbol(resolveString) ) 348 if( !lib || !lib->hasSymbol(resolveString) )
355 { 349 {
356 odebug << QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1() << oendl; 350 odebug << QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1() << oendl;
357 return NULL; 351 return NULL;
358 } 352 }
359 // Try to get an object. 353 // Try to get an object.
360 Module *object = ((Module* (*)()) lib->symbol(resolveString))(); 354 Module *object = ((Module* (*)()) lib->symbol(resolveString))();
361 if(object == NULL) 355 if(object == NULL)
362 { 356 {
363#ifdef DEBUG 357#ifdef DEBUG
364 odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; 358 odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl;
365#endif 359#endif
366 return NULL; 360 return NULL;
367 } 361 }
368#ifdef DEBUG 362#ifdef DEBUG
369 odebug << "MainWindowImp::loadPlugin:: Found object, storing." << oendl; 363 odebug << "MainWindowImp::loadPlugin:: Found object, storing." << oendl;
370#endif 364#endif
371 // Store for deletion later 365 // Store for deletion later
372 libraries.insert(object, lib); 366 libraries.insert(object, lib);
373 return object; 367 return object;
374#endif 368#endif
375} 369}
@@ -409,13 +403,13 @@ void MainWindowImp::addClicked()
409 { 403 {
410 if(it.key()) 404 if(it.key())
411 { 405 {
412 Interface *i = (it.key())->addNewInterface(item->text(0)); 406 Interface *i = (it.key())->addNewInterface(item->text(0));
413 if(i) 407 if(i)
414 { 408 {
415 odebug << "iface name " << i->getInterfaceName().latin1() << "" << oendl; 409 odebug << "iface name " << i->getInterfaceName().latin1() << "" << oendl;
416 interfaceNames.insert(i->getInterfaceName(), i); 410 interfaceNames.insert(i->getInterfaceName(), i);
417 updateInterface(i); 411 updateInterface(i);
418 } 412 }
419 } 413 }
420 } 414 }
421 } 415 }
@@ -511,13 +505,13 @@ void MainWindowImp::informationClicked()
511 { 505 {
512 QWidget *moduleInformation = i->getModuleOwner()->information(i); 506 QWidget *moduleInformation = i->getModuleOwner()->information(i);
513 if(moduleInformation != NULL) 507 if(moduleInformation != NULL)
514 { 508 {
515 QPEApplication::showWidget( moduleInformation ); 509 QPEApplication::showWidget( moduleInformation );
516#ifdef DEBUG 510#ifdef DEBUG
517 odebug << "MainWindowImp::informationClicked:: Module owner has created, we showed." << oendl; 511 odebug << "MainWindowImp::informationClicked:: Module owner has created, we showed." << oendl;
518#endif 512#endif
519 return; 513 return;
520 } 514 }
521 } 515 }
522 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp); 516 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp);
523 QPEApplication::showWidget( information ); 517 QPEApplication::showWidget( information );
@@ -648,13 +642,13 @@ void MainWindowImp::removeProfile()
648 Interfaces interfaces; 642 Interfaces interfaces;
649 // Go through them one by one 643 // Go through them one by one
650 QMap<Interface*, QListViewItem*>::Iterator it; 644 QMap<Interface*, QListViewItem*>::Iterator it;
651 for( it = items.begin(); it != items.end(); ++it ) 645 for( it = items.begin(); it != items.end(); ++it )
652 { 646 {
653 QString interfaceName = it.key()->getInterfaceName(); 647 QString interfaceName = it.key()->getInterfaceName();
654 odebug << interfaceName.latin1() << oendl; 648 odebug << interfaceName.latin1() << oendl;
655 if(interfaces.setInterface(interfaceName + "_" + profileToRemove)) 649 if(interfaces.setInterface(interfaceName + "_" + profileToRemove))
656 { 650 {
657 interfaces.removeInterface(); 651 interfaces.removeInterface();
658 if(interfaces.setMapping(interfaceName)) 652 if(interfaces.setMapping(interfaceName))
659 { 653 {
660 if(profilesList->count() == 1) 654 if(profilesList->count() == 1)
@@ -717,33 +711,33 @@ void MainWindowImp::makeChannel()
717 this, SLOT(receive(const QCString&,const QByteArray&)) ); 711 this, SLOT(receive(const QCString&,const QByteArray&)) );
718} 712}
719 713
720void MainWindowImp::receive(const QCString &msg, const QByteArray &arg) 714void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
721{ 715{
722 bool found = false; 716 bool found = false;
723 odebug << "MainWindowImp::receive QCop msg >"+msg+"<" << oendl; 717 odebug << "MainWindowImp::receive QCop msg >"+msg+"<" << oendl;
724 if (msg == "raise") 718 if (msg == "raise")
725 { 719 {
726 raise(); 720 raise();
727 return; 721 return;
728 } 722 }
729 723
730 QString dest = msg.left(msg.find("(")); 724 QString dest = msg.left(msg.find("("));
731 QCString param = msg.right(msg.length() - msg.find("(") - 1); 725 QCString param = msg.right(msg.length() - msg.find("(") - 1);
732 param = param.left( param.length() - 1 ); 726 param = param.left( param.length() - 1 );
733 odebug << "dest >" << dest.latin1() << "< param >"+param+"<" << oendl; 727 odebug << "dest >" << dest.latin1() << "< param >"+param+"<" << oendl;
734 728
735 QMap<Module*, QLibrary*>::Iterator it; 729 QMap<Module*, QLibrary*>::Iterator it;
736 for( it = libraries.begin(); it != libraries.end(); ++it ) 730 for( it = libraries.begin(); it != libraries.end(); ++it )
737 { 731 {
738 odebug << "plugin >" << it.key()->type().latin1() << "<" << oendl; 732 odebug << "plugin >" << it.key()->type().latin1() << "<" << oendl;
739 if(it.key()->type() == dest) 733 if(it.key()->type() == dest)
740 { 734 {
741 it.key()->receive( param, arg ); 735 it.key()->receive( param, arg );
742 found = true; 736 found = true;
743 } 737 }
744 } 738 }
745 739
746 740
747 if (found) QPEApplication::setKeepRunning(); 741 if (found) QPEApplication::setKeepRunning();
748 else odebug << "Huh what do ya want" << oendl; 742 else odebug << "Huh what do ya want" << oendl;
749} 743}