summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/.cvsignore6
-rw-r--r--noncore/settings/networksettings/addconnectionimp.cpp4
-rw-r--r--noncore/settings/networksettings/addconnectionimp.h1
-rw-r--r--noncore/settings/networksettings/mainwindow.ui22
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp103
-rw-r--r--noncore/settings/networksettings/mainwindowimp.h11
-rw-r--r--noncore/settings/networksettings/module.h4
7 files changed, 111 insertions, 40 deletions
diff --git a/noncore/settings/networksettings/.cvsignore b/noncore/settings/networksettings/.cvsignore
index 1ba7ac7..e000724 100644
--- a/noncore/settings/networksettings/.cvsignore
+++ b/noncore/settings/networksettings/.cvsignore
@@ -18,6 +18,12 @@ interfacesetup.h
18mainwindow.cpp 18mainwindow.cpp
19mainwindow.h 19mainwindow.h
20moc_*.cpp 20moc_*.cpp
21networksetup 21networksetup
22systemadvanced.cpp 22systemadvanced.cpp
23systemadvanced.h 23systemadvanced.h
24hosts.h
25hosts.cpp
26vpn.h
27vpn.cpp
28dns.h
29dns.cpp
diff --git a/noncore/settings/networksettings/addconnectionimp.cpp b/noncore/settings/networksettings/addconnectionimp.cpp
index 07545f7..f18d8d1 100644
--- a/noncore/settings/networksettings/addconnectionimp.cpp
+++ b/noncore/settings/networksettings/addconnectionimp.cpp
@@ -1,9 +1,13 @@
1#include "addconnectionimp.h" 1#include "addconnectionimp.h"
2#include <qlistview.h> 2#include <qlistview.h>
3#if QT_VERSION < 300
3#include <qlist.h> 4#include <qlist.h>
5#else
6#include <qptrlist.h>
7#endif
4#include <qlabel.h> 8#include <qlabel.h>
5#include <qheader.h> 9#include <qheader.h>
6 10
7/** 11/**
8 * Constructor 12 * Constructor
9 */ 13 */
diff --git a/noncore/settings/networksettings/addconnectionimp.h b/noncore/settings/networksettings/addconnectionimp.h
index 680a502..57e6b20 100644
--- a/noncore/settings/networksettings/addconnectionimp.h
+++ b/noncore/settings/networksettings/addconnectionimp.h
@@ -1,12 +1,11 @@
1#ifndef ADDCONNECTIONIMP_H 1#ifndef ADDCONNECTIONIMP_H
2#define ADDCONNECTIONIMP_H 2#define ADDCONNECTIONIMP_H
3 3
4#include "addconnection.h" 4#include "addconnection.h"
5#include <qmap.h> 5#include <qmap.h>
6#include <qlist.h>
7 6
8class QListViewItem; 7class QListViewItem;
9 8
10class AddConnectionImp : public AddConnection { 9class AddConnectionImp : public AddConnection {
11 10
12Q_OBJECT 11Q_OBJECT
diff --git a/noncore/settings/networksettings/mainwindow.ui b/noncore/settings/networksettings/mainwindow.ui
index dcabc52..8e17cb3 100644
--- a/noncore/settings/networksettings/mainwindow.ui
+++ b/noncore/settings/networksettings/mainwindow.ui
@@ -408,34 +408,12 @@
408 </widget> 408 </widget>
409 </grid> 409 </grid>
410 </widget> 410 </widget>
411 </widget> 411 </widget>
412 </vbox> 412 </vbox>
413</widget> 413</widget>
414<customwidgets>
415 <customwidget>
416 <class>QWidget</class>
417 <header location="local">qwidget.h</header>
418 <sizehint>
419 <width>100</width>
420 <height>100</height>
421 </sizehint>
422 <container>0</container>
423 <sizepolicy>
424 <hordata>7</hordata>
425 <verdata>7</verdata>
426 </sizepolicy>
427 <pixmap>image0</pixmap>
428 </customwidget>
429</customwidgets>
430<images>
431 <image>
432 <name>image0</name>
433 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
434 </image>
435</images>
436<tabstops> 414<tabstops>
437 <tabstop>tabWidget</tabstop> 415 <tabstop>tabWidget</tabstop>
438 <tabstop>connectionList</tabstop> 416 <tabstop>connectionList</tabstop>
439 <tabstop>informationConnectionButton</tabstop> 417 <tabstop>informationConnectionButton</tabstop>
440 <tabstop>configureConnectionButton</tabstop> 418 <tabstop>configureConnectionButton</tabstop>
441 <tabstop>addConnectionButton</tabstop> 419 <tabstop>addConnectionButton</tabstop>
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
@@ -9,43 +9,65 @@
9#include <qlistbox.h> 9#include <qlistbox.h>
10#include <qlineedit.h> 10#include <qlineedit.h>
11#include <qlistview.h> 11#include <qlistview.h>
12#include <qheader.h> 12#include <qheader.h>
13#include <qlabel.h> 13#include <qlabel.h>
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>
25#include <qfile.h> 40#include <qfile.h>
26#include <qtextstream.h> 41#include <qtextstream.h>
42#include <qregexp.h>
27 43
28#include <net/if.h> 44#include <net/if.h>
29#include <sys/ioctl.h> 45#include <sys/ioctl.h>
30 46
31#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" 47#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
32 48
33MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false), scheme(DEFAULT_SCHEME){ 49MainWindowImp::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()));
35 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 51 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
36 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 52 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
37 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 53 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
38 54
39 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 55 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
40 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 56 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
41 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); 57 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
42 58
43 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); 59 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
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();
47 69
48 Interfaces i; 70 Interfaces i;
49 QStringList list = i.getInterfaceList(); 71 QStringList list = i.getInterfaceList();
50 QMap<QString, Interface*>::Iterator it; 72 QMap<QString, Interface*>::Iterator it;
51 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { 73 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) {
@@ -105,20 +127,24 @@ MainWindowImp::~MainWindowImp(){
105 QMap<Interface*, QListViewItem*>::Iterator iIt; 127 QMap<Interface*, QListViewItem*>::Iterator iIt;
106 for( iIt = items.begin(); iIt != items.end(); ++iIt ){ 128 for( iIt = items.begin(); iIt != items.end(); ++iIt ){
107 if(iIt.key()->getModuleOwner() == NULL) 129 if(iIt.key()->getModuleOwner() == NULL)
108 delete iIt.key(); 130 delete iIt.key();
109 } 131 }
110 132
133#ifdef QTE_VERSION
111 // Delete Modules and Libraries 134 // Delete Modules and Libraries
112 QMap<Module*, QLibrary*>::Iterator it; 135 QMap<Module*, QLibrary*>::Iterator it;
113 for( it = libraries.begin(); it != libraries.end(); ++it ){ 136 for( it = libraries.begin(); it != libraries.end(); ++it ){
114 delete it.key(); 137 delete it.key();
115 // I wonder why I can't delete the libraries 138 // I wonder why I can't delete the libraries
116 // What fucking shit this is. 139 // What fucking shit this is.
117 //delete it.data(); 140 //delete it.data();
118 } 141 }
142#else
143 // klibloader automaticly deletes the libraries for us...
144#endif
119} 145}
120 146
121/** 147/**
122 * Query the kernel for all of the interfaces. 148 * Query the kernel for all of the interfaces.
123 */ 149 */
124void MainWindowImp::getAllInterfaces(){ 150void MainWindowImp::getAllInterfaces(){
@@ -187,24 +213,26 @@ void MainWindowImp::getAllInterfaces(){
187/** 213/**
188 * Load all modules that are found in the path 214 * Load all modules that are found in the path
189 * @param path a directory that is scaned for any plugins that can be loaded 215 * @param path a directory that is scaned for any plugins that can be loaded
190 * and attempts to load them 216 * and attempts to load them
191 */ 217 */
192void MainWindowImp::loadModules(const QString &path){ 218void 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);
195 if(!d.exists()) 223 if(!d.exists())
196 return; 224 return;
197 225
198 // Don't want sym links 226 // Don't want sym links
199 d.setFilter( QDir::Files | QDir::NoSymLinks ); 227 d.setFilter( QDir::Files | QDir::NoSymLinks );
200 const QFileInfoList *list = d.entryInfoList(); 228 const QFileInfoList *list = d.entryInfoList();
201 QFileInfoListIterator it( *list ); 229 QFileInfoListIterator it( *list );
202 QFileInfo *fi; 230 QFileInfo *fi;
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());
206 } 234 }
207 ++it; 235 ++it;
208 } 236 }
209} 237}
210 238
@@ -212,32 +240,62 @@ void MainWindowImp::loadModules(const QString &path){
212 * Attempt to load a function and resolve a function. 240 * Attempt to load a function and resolve a function.
213 * @param pluginFileName - the name of the file in which to attempt to load 241 * @param pluginFileName - the name of the file in which to attempt to load
214 * @param resolveString - function pointer to resolve 242 * @param resolveString - function pointer to resolve
215 * @return pointer to the function with name resolveString or NULL 243 * @return pointer to the function with name resolveString or NULL
216 */ 244 */
217Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){ 245Module* 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);
220 void *functionPointer = lib->resolve(resolveString); 251 void *functionPointer = lib->resolve(resolveString);
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;
224 return NULL; 257 return NULL;
225 } 258 }
226
227 // Try to get an object. 259 // Try to get an object.
228 Module *object = ((Module* (*)()) functionPointer)(); 260 Module *object = ((Module* (*)()) functionPointer)();
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;
232 return NULL; 266 return NULL;
233 } 267 }
234 268
235 // Store for deletion later 269 // Store for deletion later
236 libraries.insert(object, lib); 270 libraries.insert(object, lib);
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}
239 297
240/** 298/**
241 * The Add button was clicked. Bring up the add dialog and if OK is hit 299 * The Add button was clicked. Bring up the add dialog and if OK is hit
242 * load the plugin and append it to the list 300 * load the plugin and append it to the list
243 */ 301 */
@@ -321,13 +379,13 @@ void MainWindowImp::configureClicked(){
321 if(moduleConfigure != NULL){ 379 if(moduleConfigure != NULL){
322 moduleConfigure->showMaximized(); 380 moduleConfigure->showMaximized();
323 return; 381 return;
324 } 382 }
325 } 383 }
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();
329 if(currentProfileText.upper() == "ALL"); 387 if(currentProfileText.upper() == "ALL");
330 currentProfileText = ""; 388 currentProfileText = "";
331 configure->setProfile(currentProfileText); 389 configure->setProfile(currentProfileText);
332 configure->showMaximized(); 390 configure->showMaximized();
333} 391}
@@ -351,17 +409,20 @@ void MainWindowImp::informationClicked(){
351 } 409 }
352 410
353 if(i->getModuleOwner()){ 411 if(i->getModuleOwner()){
354 QWidget *moduleInformation = i->getModuleOwner()->information(i); 412 QWidget *moduleInformation = i->getModuleOwner()->information(i);
355 if(moduleInformation != NULL){ 413 if(moduleInformation != NULL){
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}
363 424
364/** 425/**
365 * Update this interface. If no QListViewItem exists create one. 426 * Update this interface. If no QListViewItem exists create one.
366 * @param Interface* pointer to the interface that needs to be updated. 427 * @param Interface* pointer to the interface that needs to be updated.
367 */ 428 */
@@ -386,14 +447,18 @@ void MainWindowImp::updateInterface(Interface *i){
386 interfaceItems.insert(item, i); 447 interfaceItems.insert(item, i);
387 } 448 }
388 else 449 else
389 item = items[i]; 450 item = items[i];
390 451
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";
395 if(i->getHardwareName().contains("Local Loopback")) 460 if(i->getHardwareName().contains("Local Loopback"))
396 typeName = "lo"; 461 typeName = "lo";
397 if(i->getInterfaceName().contains("irda")) 462 if(i->getInterfaceName().contains("irda"))
398 typeName = "irda"; 463 typeName = "irda";
399 if(i->getInterfaceName().contains("wlan")) 464 if(i->getInterfaceName().contains("wlan"))
@@ -404,13 +469,17 @@ void MainWindowImp::updateInterface(Interface *i){
404 if(!i->isAttached()) 469 if(!i->isAttached())
405 typeName = "connect_no"; 470 typeName = "connect_no";
406 // Actually try to use the Module 471 // Actually try to use the Module
407 if(i->getModuleOwner() != NULL) 472 if(i->getModuleOwner() != NULL)
408 typeName = i->getModuleOwner()->getPixmapName(i); 473 typeName = i->getModuleOwner()->getPixmapName(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());
412 item->setText(3, QString("(%1)").arg(i->getInterfaceName())); 481 item->setText(3, QString("(%1)").arg(i->getInterfaceName()));
413 item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); 482 item->setText(4, (i->getStatus()) ? i->getIp() : QString(""));
414} 483}
415 484
416void MainWindowImp::newProfileChanged(const QString& newText){ 485void MainWindowImp::newProfileChanged(const QString& newText){
diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h
index 4f09d6c..2ebf304 100644
--- a/noncore/settings/networksettings/mainwindowimp.h
+++ b/noncore/settings/networksettings/mainwindowimp.h
@@ -6,12 +6,20 @@
6#include <qstringlist.h> 6#include <qstringlist.h>
7 7
8class Module; 8class Module;
9class Interface; 9class Interface;
10class QLibrary; 10class QLibrary;
11class KProcess; 11class KProcess;
12#ifdef QTE_VERSION
13class QLibrary;
14#else
15class KLibrary;
16class KLibLoader;
17#define QLibrary KLibrary
18#endif
19
12 20
13class MainWindowImp : public MainWindow { 21class MainWindowImp : public MainWindow {
14 Q_OBJECT 22 Q_OBJECT
15 23
16public: 24public:
17 MainWindowImp(QWidget *parent=0, const char *name=0); 25 MainWindowImp(QWidget *parent=0, const char *name=0);
@@ -47,12 +55,15 @@ private:
47 55
48 QMap<KProcess*, QString> threads; 56 QMap<KProcess*, QString> threads;
49 QStringList profiles; 57 QStringList profiles;
50 58
51 bool advancedUserMode; 59 bool advancedUserMode;
52 QString scheme; 60 QString scheme;
61#ifndef QTE_VERSION
62 KLibLoader *loader;
63#endif
53}; 64};
54 65
55#endif 66#endif
56 67
57// mainwindowimp.h 68// mainwindowimp.h
58 69
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h
index 2e6272b..46a3c77 100644
--- a/noncore/settings/networksettings/module.h
+++ b/noncore/settings/networksettings/module.h
@@ -1,11 +1,15 @@
1#ifndef NETCONF_MODULE_H 1#ifndef NETCONF_MODULE_H
2#define NETCONF_MODULE_H 2#define NETCONF_MODULE_H
3 3
4#include <qobject.h> 4#include <qobject.h>
5#if QT_VERSION < 300
5#include <qlist.h> 6#include <qlist.h>
7#else
8#include <qptrlist.h>
9#endif
6#include <qmap.h> 10#include <qmap.h>
7#include "interface.h" 11#include "interface.h"
8 12
9class QWidget; 13class QWidget;
10class QTabWidget; 14class QTabWidget;
11 15