summaryrefslogtreecommitdiff
path: root/library/network.cpp
authoreilers <eilers>2003-11-03 16:52:18 (UTC)
committer eilers <eilers>2003-11-03 16:52:18 (UTC)
commitd34dc773591a2d467c68875a68a671d6a809f861 (patch) (unidiff)
treeb57e5ae15c51e3d87ca95d57aedfd1ca3db57bfe /library/network.cpp
parentce84f2d8bdd65c438821f0457cdad6bbbfa73380 (diff)
downloadopie-d34dc773591a2d467c68875a68a671d6a809f861.zip
opie-d34dc773591a2d467c68875a68a671d6a809f861.tar.gz
opie-d34dc773591a2d467c68875a68a671d6a809f861.tar.bz2
Porting Opie to MacOS-X.
The base system and all platform independent applications and platforms should work. Please see $OPIEDIR/development/macosx for details
Diffstat (limited to 'library/network.cpp') (more/less context) (show whitespace changes)
-rw-r--r--library/network.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/network.cpp b/library/network.cpp
index 3568809..991e11a 100644
--- a/library/network.cpp
+++ b/library/network.cpp
@@ -373,72 +373,76 @@ bool Network::networkOnline()
373{ 373{
374 return ns && ns->networkOnline(); 374 return ns && ns->networkOnline();
375} 375}
376 376
377/*! 377/*!
378 \internal 378 \internal
379*/ 379*/
380void Network::createServer(QObject* parent) 380void Network::createServer(QObject* parent)
381{ 381{
382 ns = new NetworkServer(parent); 382 ns = new NetworkServer(parent);
383} 383}
384 384
385/*! 385/*!
386 \internal 386 \internal
387*/ 387*/
388int Network::addStateWidgets(QWidget* parent) 388int Network::addStateWidgets(QWidget* parent)
389{ 389{
390 int n=0; 390 int n=0;
391 QStringList l = Network::choices(); 391 QStringList l = Network::choices();
392 QVBoxLayout* vb = new QVBoxLayout(parent); 392 QVBoxLayout* vb = new QVBoxLayout(parent);
393 for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) { 393 for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) {
394 Config cfg(*it,Config::File); 394 Config cfg(*it,Config::File);
395 cfg.setGroup("Info"); 395 cfg.setGroup("Info");
396 QString type = cfg.readEntry("Type"); 396 QString type = cfg.readEntry("Type");
397 NetworkInterface* plugin = Network::loadPlugin(type); 397 NetworkInterface* plugin = Network::loadPlugin(type);
398 cfg.setGroup("Properties"); 398 cfg.setGroup("Properties");
399 if ( plugin ) { 399 if ( plugin ) {
400 QWidget* w; 400 QWidget* w;
401 if ( (w=plugin->addStateWidget(parent,cfg)) ) { 401 if ( (w=plugin->addStateWidget(parent,cfg)) ) {
402 n++; 402 n++;
403 vb->addWidget(w); 403 vb->addWidget(w);
404 } 404 }
405 } 405 }
406 } 406 }
407 return n; 407 return n;
408} 408}
409 409
410static QDict<NetworkInterface> *ifaces; 410static QDict<NetworkInterface> *ifaces;
411 411
412/*! 412/*!
413 \internal 413 \internal
414*/ 414*/
415NetworkInterface* Network::loadPlugin(const QString& type) 415NetworkInterface* Network::loadPlugin(const QString& type)
416{ 416{
417#ifndef QT_NO_COMPONENT 417#ifndef QT_NO_COMPONENT
418 if ( !ifaces ) ifaces = new QDict<NetworkInterface>; 418 if ( !ifaces ) ifaces = new QDict<NetworkInterface>;
419 NetworkInterface *iface = ifaces->find(type); 419 NetworkInterface *iface = ifaces->find(type);
420 if ( !iface ) { 420 if ( !iface ) {
421#ifdef Q_OS_MACX
422 QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".dylib";
423#else
421 QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".so"; 424 QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".so";
425#endif
422 QLibrary lib(libfile); 426 QLibrary lib(libfile);
423 if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK ) 427 if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK )
424 return 0; 428 return 0;
425 ifaces->insert(type,iface); 429 ifaces->insert(type,iface);
426 QStringList langs = Global::languageList(); 430 QStringList langs = Global::languageList();
427 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { 431 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
428 QString lang = *it; 432 QString lang = *it;
429 QTranslator * trans = new QTranslator(qApp); 433 QTranslator * trans = new QTranslator(qApp);
430 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm"; 434 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm";
431 if ( trans->load( tfn )) 435 if ( trans->load( tfn ))
432 qApp->installTranslator( trans ); 436 qApp->installTranslator( trans );
433 else 437 else
434 delete trans; 438 delete trans;
435 } 439 }
436 } 440 }
437 return iface; 441 return iface;
438#else 442#else
439 return 0; 443 return 0;
440#endif 444#endif
441} 445}
442 446
443#include "network.moc" 447#include "network.moc"
444 #endif// QT_NO_COP 448 #endif// QT_NO_COP