author | benmeyer <benmeyer> | 2003-04-09 00:18:15 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2003-04-09 00:18:15 (UTC) |
commit | cd2822e137e9a73aa2bf13f7f0dc67fda50a1879 (patch) (unidiff) | |
tree | 97febc8658a7212a01025b9e98904c9770aecf96 /noncore/settings/networksettings/mainwindowimp.cpp | |
parent | bbefacdb0099ebb8c80f40c56237c6adc18c9328 (diff) | |
download | opie-cd2822e137e9a73aa2bf13f7f0dc67fda50a1879.zip opie-cd2822e137e9a73aa2bf13f7f0dc67fda50a1879.tar.gz opie-cd2822e137e9a73aa2bf13f7f0dc67fda50a1879.tar.bz2 |
KDEafied and bugs fixes
Diffstat (limited to 'noncore/settings/networksettings/mainwindowimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 103 |
1 files changed, 86 insertions, 17 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 0ddc489..d6b708b 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -14,11 +14,26 @@ | |||
14 | 14 | ||
15 | #include <qmainwindow.h> | ||
16 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
17 | 16 | ||
18 | #include <qpe/config.h> | 17 | #ifdef QTE_VERSION |
19 | #include <qpe/qlibrary.h> | 18 | #include <qpe/config.h> |
20 | #include <qpe/resource.h> | 19 | #include <qpe/qlibrary.h> |
21 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/resource.h> |
21 | #include <qpe/qpeapplication.h> | ||
22 | #define QLibrary | ||
23 | #else | ||
24 | #include <klibloader.h> | ||
25 | #define QLibrary KLibrary | ||
26 | #include <kconfig.h> | ||
27 | #define Config KConfig | ||
28 | #include <kapplication.h> | ||
29 | #include <kstandarddirs.h> | ||
30 | #include <kiconloader.h> | ||
31 | #define showMaximized show | ||
32 | #endif | ||
22 | 33 | ||
34 | #if QT_VERSION < 300 | ||
23 | #include <qlist.h> | 35 | #include <qlist.h> |
36 | #else | ||
37 | #include <qptrlist.h> | ||
38 | #endif | ||
24 | #include <qdir.h> | 39 | #include <qdir.h> |
@@ -26,2 +41,3 @@ | |||
26 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
42 | #include <qregexp.h> | ||
27 | 43 | ||
@@ -32,3 +48,3 @@ | |||
32 | 48 | ||
33 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false), scheme(DEFAULT_SCHEME){ | 49 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name), advancedUserMode(true), scheme(DEFAULT_SCHEME){ |
34 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); | 50 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); |
@@ -44,3 +60,9 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par | |||
44 | // Load connections. | 60 | // Load connections. |
45 | loadModules(QPEApplication::qpeDir() + "/plugins/networksettings"); | 61 | // /usr/local/kde/lib/libinterfaces.la |
62 | #ifdef QTE_VERSION | ||
63 | loadModules(QPEApplication::kdeDir() + "/plugins/networksettings"); | ||
64 | #else | ||
65 | loader = KLibLoader::self(); | ||
66 | loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); | ||
67 | #endif | ||
46 | getAllInterfaces(); | 68 | getAllInterfaces(); |
@@ -110,2 +132,3 @@ MainWindowImp::~MainWindowImp(){ | |||
110 | 132 | ||
133 | #ifdef QTE_VERSION | ||
111 | // Delete Modules and Libraries | 134 | // Delete Modules and Libraries |
@@ -118,2 +141,5 @@ MainWindowImp::~MainWindowImp(){ | |||
118 | } | 141 | } |
142 | #else | ||
143 | // klibloader automaticly deletes the libraries for us... | ||
144 | #endif | ||
119 | } | 145 | } |
@@ -192,3 +218,5 @@ void MainWindowImp::getAllInterfaces(){ | |||
192 | void MainWindowImp::loadModules(const QString &path){ | 218 | void MainWindowImp::loadModules(const QString &path){ |
193 | //qDebug(path.latin1()); | 219 | #ifdef DEBUG |
220 | qDebug("MainWindowImp::loadModules: %s", path.latin1()); | ||
221 | #endif | ||
194 | QDir d(path); | 222 | QDir d(path); |
@@ -203,3 +231,3 @@ void MainWindowImp::loadModules(const QString &path){ | |||
203 | while ( (fi=it.current()) ) { | 231 | while ( (fi=it.current()) ) { |
204 | if(fi->fileName().contains(".so")){ | 232 | if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")){ |
205 | loadPlugin(path + "/" + fi->fileName()); | 233 | loadPlugin(path + "/" + fi->fileName()); |
@@ -217,3 +245,6 @@ void MainWindowImp::loadModules(const QString &path){ | |||
217 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){ | 245 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){ |
218 | //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); | 246 | #ifdef DEBUG |
247 | qDebug("MainWindowImp::loadPlugin: %s", pluginFileName.latin1()); | ||
248 | #endif | ||
249 | #ifdef QTE_VERSION | ||
219 | QLibrary *lib = new QLibrary(pluginFileName); | 250 | QLibrary *lib = new QLibrary(pluginFileName); |
@@ -221,3 +252,5 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
221 | if( !functionPointer ){ | 252 | if( !functionPointer ){ |
222 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 253 | #ifdef DEBUG |
254 | qDebug("MainWindowImp::loadPlugin: File: %s is not a plugin, but though was.", pluginFileName.latin1()); | ||
255 | #endif | ||
223 | delete lib; | 256 | delete lib; |
@@ -225,3 +258,2 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
225 | } | 258 | } |
226 | |||
227 | // Try to get an object. | 259 | // Try to get an object. |
@@ -229,3 +261,5 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
229 | if(object == NULL){ | 261 | if(object == NULL){ |
262 | #ifdef DEBUG | ||
230 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 263 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
264 | #endif | ||
231 | delete lib; | 265 | delete lib; |
@@ -237,2 +271,26 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
237 | return object; | 271 | return object; |
272 | |||
273 | #else | ||
274 | QLibrary *lib = loader->library(pluginFileName); | ||
275 | if( !lib || !lib->hasSymbol(resolveString) ){ | ||
276 | #ifdef DEBUG | ||
277 | qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | ||
278 | #endif | ||
279 | return NULL; | ||
280 | } | ||
281 | // Try to get an object. | ||
282 | Module *object = ((Module* (*)()) lib->symbol(resolveString))(); | ||
283 | if(object == NULL){ | ||
284 | #ifdef DEBUG | ||
285 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | ||
286 | #endif | ||
287 | return NULL; | ||
288 | } | ||
289 | #ifdef DEBUG | ||
290 | qDebug("MainWindowImp::loadPlugin:: Found object, storing."); | ||
291 | #endif | ||
292 | // Store for deletion later | ||
293 | libraries.insert(object, lib); | ||
294 | return object; | ||
295 | #endif | ||
238 | } | 296 | } |
@@ -326,3 +384,3 @@ void MainWindowImp::configureClicked(){ | |||
326 | 384 | ||
327 | InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose); | 385 | InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WShowModal | Qt::WDestructiveClose | Qt::WType_Dialog); |
328 | QString currentProfileText = currentProfileLabel->text(); | 386 | QString currentProfileText = currentProfileLabel->text(); |
@@ -356,7 +414,10 @@ void MainWindowImp::informationClicked(){ | |||
356 | moduleInformation->showMaximized(); | 414 | moduleInformation->showMaximized(); |
415 | #ifdef DEBUG | ||
416 | qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); | ||
417 | #endif | ||
357 | return; | 418 | return; |
358 | } | 419 | } |
359 | } | 420 | } |
360 | InterfaceInformationImp information(0, "InterfaceSetupImp", i); | 421 | InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WShowModal | Qt::WDestructiveClose | Qt::WType_Dialog); |
361 | information.showMaximized(); | 422 | information->showMaximized(); |
362 | } | 423 | } |
@@ -391,4 +452,8 @@ void MainWindowImp::updateInterface(Interface *i){ | |||
391 | // Update the icons and information | 452 | // Update the icons and information |
453 | #ifdef QTE_VERSION | ||
392 | item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); | 454 | item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); |
393 | 455 | #else | |
456 | item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down"))); | ||
457 | #endif | ||
458 | |||
394 | QString typeName = "lan"; | 459 | QString typeName = "lan"; |
@@ -409,3 +474,7 @@ void MainWindowImp::updateInterface(Interface *i){ | |||
409 | 474 | ||
475 | #ifdef QTE_VERSION | ||
410 | item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); | 476 | item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); |
477 | #else | ||
478 | item->setPixmap(1, (SmallIcon(typeName))); | ||
479 | #endif | ||
411 | item->setText(2, i->getHardwareName()); | 480 | item->setText(2, i->getHardwareName()); |