summaryrefslogtreecommitdiff
path: root/library/network.cpp
Side-by-side diff
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()
{
return ns && ns->networkOnline();
}
/*!
\internal
*/
void Network::createServer(QObject* parent)
{
ns = new NetworkServer(parent);
}
/*!
\internal
*/
int Network::addStateWidgets(QWidget* parent)
{
int n=0;
QStringList l = Network::choices();
QVBoxLayout* vb = new QVBoxLayout(parent);
for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) {
Config cfg(*it,Config::File);
cfg.setGroup("Info");
QString type = cfg.readEntry("Type");
NetworkInterface* plugin = Network::loadPlugin(type);
cfg.setGroup("Properties");
if ( plugin ) {
QWidget* w;
if ( (w=plugin->addStateWidget(parent,cfg)) ) {
n++;
vb->addWidget(w);
}
}
}
return n;
}
static QDict<NetworkInterface> *ifaces;
/*!
\internal
*/
NetworkInterface* Network::loadPlugin(const QString& type)
{
#ifndef QT_NO_COMPONENT
if ( !ifaces ) ifaces = new QDict<NetworkInterface>;
NetworkInterface *iface = ifaces->find(type);
if ( !iface ) {
+#ifdef Q_OS_MACX
+ QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".dylib";
+#else
QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".so";
+#endif
QLibrary lib(libfile);
if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK )
return 0;
ifaces->insert(type,iface);
QStringList langs = Global::languageList();
for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
QString lang = *it;
QTranslator * trans = new QTranslator(qApp);
QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm";
if ( trans->load( tfn ))
qApp->installTranslator( trans );
else
delete trans;
}
}
return iface;
#else
return 0;
#endif
}
#include "network.moc"
#endif // QT_NO_COP