summaryrefslogtreecommitdiff
authorkergoth <kergoth>2002-10-15 22:26:57 (UTC)
committer kergoth <kergoth>2002-10-15 22:26:57 (UTC)
commit9e38d78e1c1bcdd3841cc0edfacad731814754ba (patch) (unidiff)
tree312bc9d2adae9206db2d2f23d8acbe1ff4372a42
parentfcc5702d6c6b4d6ecba51451ea491bcc4799b88a (diff)
downloadopie-9e38d78e1c1bcdd3841cc0edfacad731814754ba.zip
opie-9e38d78e1c1bcdd3841cc0edfacad731814754ba.tar.gz
opie-9e38d78e1c1bcdd3841cc0edfacad731814754ba.tar.bz2
Change plugin path to QPEApplication::qpeDir + /plugins/networksetup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/mainwindowimp.cpp2
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp
index e895971..3715da0 100644
--- a/noncore/net/networksetup/mainwindowimp.cpp
+++ b/noncore/net/networksetup/mainwindowimp.cpp
@@ -1,140 +1,140 @@
1#include "mainwindowimp.h" 1#include "mainwindowimp.h"
2#include "addconnectionimp.h" 2#include "addconnectionimp.h"
3#include "interfaceinformationimp.h" 3#include "interfaceinformationimp.h"
4#include "interfacesetupimp.h" 4#include "interfacesetupimp.h"
5#include "module.h" 5#include "module.h"
6 6
7#include "kprocess.h" 7#include "kprocess.h"
8 8
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qtabwidget.h> 10#include <qtabwidget.h>
11#include <qlistbox.h> 11#include <qlistbox.h>
12#include <qlineedit.h> 12#include <qlineedit.h>
13#include <qlistview.h> 13#include <qlistview.h>
14#include <qheader.h> 14#include <qheader.h>
15#include <qlabel.h> 15#include <qlabel.h>
16 16
17#include <qmainwindow.h> 17#include <qmainwindow.h>
18#include <qmessagebox.h> 18#include <qmessagebox.h>
19 19
20#include <qpe/config.h> 20#include <qpe/config.h>
21#include <qpe/qlibrary.h> 21#include <qpe/qlibrary.h>
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23 23
24#include <qlist.h> 24#include <qlist.h>
25#include <qdir.h> 25#include <qdir.h>
26#include <qfile.h> 26#include <qfile.h>
27#include <qtextstream.h> 27#include <qtextstream.h>
28 28
29#define TEMP_ALL "/tmp/ifconfig-a" 29#define TEMP_ALL "/tmp/ifconfig-a"
30#define TEMP_UP "/tmp/ifconfig" 30#define TEMP_UP "/tmp/ifconfig"
31 31
32MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){ 32MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
33 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 33 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
34 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 34 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
35 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 35 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
36 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 36 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
37 37
38 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 38 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
39 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 39 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
40 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); 40 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
41 41
42 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); 42 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
43 // Load connections. 43 // Load connections.
44 loadModules(QDir::homeDirPath() + "/.networksetup/plugins"); 44 loadModules(QPEApplication::qpeDir() + "/plugins/networksetup");
45 getInterfaceList(); 45 getInterfaceList();
46 connectionList->header()->hide(); 46 connectionList->header()->hide();
47 47
48 48
49 Config cfg("NetworkSetup"); 49 Config cfg("NetworkSetup");
50 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 50 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
51 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 51 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
52 profilesList->insertItem((*it)); 52 profilesList->insertItem((*it));
53 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); 53 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
54} 54}
55 55
56/** 56/**
57 * Deconstructor. Save profiles. Delete loaded libraries. 57 * Deconstructor. Save profiles. Delete loaded libraries.
58 */ 58 */
59MainWindowImp::~MainWindowImp(){ 59MainWindowImp::~MainWindowImp(){
60 // Save profiles. 60 // Save profiles.
61 if(profiles.count() > 1){ 61 if(profiles.count() > 1){
62 Config cfg("NetworkSetup"); 62 Config cfg("NetworkSetup");
63 cfg.setGroup("General"); 63 cfg.setGroup("General");
64 cfg.writeEntry("Profiles", profiles.join(" ")); 64 cfg.writeEntry("Profiles", profiles.join(" "));
65 } 65 }
66 // Delete Modules and Libraries 66 // Delete Modules and Libraries
67 QMap<Module*, QLibrary*>::Iterator it; 67 QMap<Module*, QLibrary*>::Iterator it;
68 for( it = libraries.begin(); it != libraries.end(); ++it ){ 68 for( it = libraries.begin(); it != libraries.end(); ++it ){
69 delete it.key(); 69 delete it.key();
70 delete it.data(); 70 delete it.data();
71 } 71 }
72} 72}
73 73
74/** 74/**
75 * Load all modules that are found in the path 75 * Load all modules that are found in the path
76 * @param path a directory that is scaned for any plugins that can be loaded 76 * @param path a directory that is scaned for any plugins that can be loaded
77 * and attempts to load them 77 * and attempts to load them
78 */ 78 */
79void MainWindowImp::loadModules(QString path){ 79void MainWindowImp::loadModules(QString path){
80 qDebug(path.latin1()); 80 qDebug(path.latin1());
81 QDir d(path); 81 QDir d(path);
82 if(!d.exists()) 82 if(!d.exists())
83 return; 83 return;
84 84
85 // Don't want sym links 85 // Don't want sym links
86 d.setFilter( QDir::Files | QDir::NoSymLinks ); 86 d.setFilter( QDir::Files | QDir::NoSymLinks );
87 const QFileInfoList *list = d.entryInfoList(); 87 const QFileInfoList *list = d.entryInfoList();
88 QFileInfoListIterator it( *list ); 88 QFileInfoListIterator it( *list );
89 QFileInfo *fi; 89 QFileInfo *fi;
90 while ( (fi=it.current()) ) { 90 while ( (fi=it.current()) ) {
91 if(fi->fileName().contains(".so")){ 91 if(fi->fileName().contains(".so")){
92 loadPlugin(path + "/" + fi->fileName()); 92 loadPlugin(path + "/" + fi->fileName());
93 } 93 }
94 ++it; 94 ++it;
95 } 95 }
96} 96}
97 97
98/** 98/**
99 * Attempt to load a function and resolve a function. 99 * Attempt to load a function and resolve a function.
100 * @param pluginFileName - the name of the file in which to attempt to load 100 * @param pluginFileName - the name of the file in which to attempt to load
101 * @param resolveString - function pointer to resolve 101 * @param resolveString - function pointer to resolve
102 * @return pointer to the function with name resolveString or NULL 102 * @return pointer to the function with name resolveString or NULL
103 */ 103 */
104Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ 104Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
105 qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); 105 qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
106 QLibrary *lib = new QLibrary(pluginFileName); 106 QLibrary *lib = new QLibrary(pluginFileName);
107 void *functionPointer = lib->resolve(resolveString); 107 void *functionPointer = lib->resolve(resolveString);
108 if( !functionPointer ){ 108 if( !functionPointer ){
109 qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); 109 qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
110 delete lib; 110 delete lib;
111 return NULL; 111 return NULL;
112 } 112 }
113 113
114 // Try to get an object. 114 // Try to get an object.
115 Module *object = ((Module* (*)()) functionPointer)(); 115 Module *object = ((Module* (*)()) functionPointer)();
116 if(object == NULL){ 116 if(object == NULL){
117 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 117 qDebug("MainWindowImp: Couldn't create object, but did load library!");
118 delete lib; 118 delete lib;
119 return NULL; 119 return NULL;
120 } 120 }
121 121
122 // Store for deletion later 122 // Store for deletion later
123 libraries.insert(object, lib); 123 libraries.insert(object, lib);
124 return object; 124 return object;
125} 125}
126 126
127/** 127/**
128 * The Add button was clicked. Bring up the add dialog and if OK is hit 128 * The Add button was clicked. Bring up the add dialog and if OK is hit
129 * load the plugin and append it to the list 129 * load the plugin and append it to the list
130 */ 130 */
131void MainWindowImp::addClicked(){ 131void MainWindowImp::addClicked(){
132 QMap<Module*, QLibrary*>::Iterator it; 132 QMap<Module*, QLibrary*>::Iterator it;
133 QMap<QString, QString> list; 133 QMap<QString, QString> list;
134 QMap<QString, Module*> newInterfaceOwners; 134 QMap<QString, Module*> newInterfaceOwners;
135 list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); 135 list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
136 list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port"); 136 list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
137 for( it = libraries.begin(); it != libraries.end(); ++it ){ 137 for( it = libraries.begin(); it != libraries.end(); ++it ){
138 if(it.key()){ 138 if(it.key()){
139 (it.key())->possibleNewInterfaces(list); 139 (it.key())->possibleNewInterfaces(list);
140 } 140 }
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index e895971..3715da0 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -1,140 +1,140 @@
1#include "mainwindowimp.h" 1#include "mainwindowimp.h"
2#include "addconnectionimp.h" 2#include "addconnectionimp.h"
3#include "interfaceinformationimp.h" 3#include "interfaceinformationimp.h"
4#include "interfacesetupimp.h" 4#include "interfacesetupimp.h"
5#include "module.h" 5#include "module.h"
6 6
7#include "kprocess.h" 7#include "kprocess.h"
8 8
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qtabwidget.h> 10#include <qtabwidget.h>
11#include <qlistbox.h> 11#include <qlistbox.h>
12#include <qlineedit.h> 12#include <qlineedit.h>
13#include <qlistview.h> 13#include <qlistview.h>
14#include <qheader.h> 14#include <qheader.h>
15#include <qlabel.h> 15#include <qlabel.h>
16 16
17#include <qmainwindow.h> 17#include <qmainwindow.h>
18#include <qmessagebox.h> 18#include <qmessagebox.h>
19 19
20#include <qpe/config.h> 20#include <qpe/config.h>
21#include <qpe/qlibrary.h> 21#include <qpe/qlibrary.h>
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23 23
24#include <qlist.h> 24#include <qlist.h>
25#include <qdir.h> 25#include <qdir.h>
26#include <qfile.h> 26#include <qfile.h>
27#include <qtextstream.h> 27#include <qtextstream.h>
28 28
29#define TEMP_ALL "/tmp/ifconfig-a" 29#define TEMP_ALL "/tmp/ifconfig-a"
30#define TEMP_UP "/tmp/ifconfig" 30#define TEMP_UP "/tmp/ifconfig"
31 31
32MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){ 32MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
33 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 33 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
34 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 34 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
35 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 35 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
36 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 36 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
37 37
38 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 38 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
39 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 39 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
40 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); 40 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
41 41
42 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); 42 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
43 // Load connections. 43 // Load connections.
44 loadModules(QDir::homeDirPath() + "/.networksetup/plugins"); 44 loadModules(QPEApplication::qpeDir() + "/plugins/networksetup");
45 getInterfaceList(); 45 getInterfaceList();
46 connectionList->header()->hide(); 46 connectionList->header()->hide();
47 47
48 48
49 Config cfg("NetworkSetup"); 49 Config cfg("NetworkSetup");
50 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 50 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
51 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 51 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
52 profilesList->insertItem((*it)); 52 profilesList->insertItem((*it));
53 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); 53 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
54} 54}
55 55
56/** 56/**
57 * Deconstructor. Save profiles. Delete loaded libraries. 57 * Deconstructor. Save profiles. Delete loaded libraries.
58 */ 58 */
59MainWindowImp::~MainWindowImp(){ 59MainWindowImp::~MainWindowImp(){
60 // Save profiles. 60 // Save profiles.
61 if(profiles.count() > 1){ 61 if(profiles.count() > 1){
62 Config cfg("NetworkSetup"); 62 Config cfg("NetworkSetup");
63 cfg.setGroup("General"); 63 cfg.setGroup("General");
64 cfg.writeEntry("Profiles", profiles.join(" ")); 64 cfg.writeEntry("Profiles", profiles.join(" "));
65 } 65 }
66 // Delete Modules and Libraries 66 // Delete Modules and Libraries
67 QMap<Module*, QLibrary*>::Iterator it; 67 QMap<Module*, QLibrary*>::Iterator it;
68 for( it = libraries.begin(); it != libraries.end(); ++it ){ 68 for( it = libraries.begin(); it != libraries.end(); ++it ){
69 delete it.key(); 69 delete it.key();
70 delete it.data(); 70 delete it.data();
71 } 71 }
72} 72}
73 73
74/** 74/**
75 * Load all modules that are found in the path 75 * Load all modules that are found in the path
76 * @param path a directory that is scaned for any plugins that can be loaded 76 * @param path a directory that is scaned for any plugins that can be loaded
77 * and attempts to load them 77 * and attempts to load them
78 */ 78 */
79void MainWindowImp::loadModules(QString path){ 79void MainWindowImp::loadModules(QString path){
80 qDebug(path.latin1()); 80 qDebug(path.latin1());
81 QDir d(path); 81 QDir d(path);
82 if(!d.exists()) 82 if(!d.exists())
83 return; 83 return;
84 84
85 // Don't want sym links 85 // Don't want sym links
86 d.setFilter( QDir::Files | QDir::NoSymLinks ); 86 d.setFilter( QDir::Files | QDir::NoSymLinks );
87 const QFileInfoList *list = d.entryInfoList(); 87 const QFileInfoList *list = d.entryInfoList();
88 QFileInfoListIterator it( *list ); 88 QFileInfoListIterator it( *list );
89 QFileInfo *fi; 89 QFileInfo *fi;
90 while ( (fi=it.current()) ) { 90 while ( (fi=it.current()) ) {
91 if(fi->fileName().contains(".so")){ 91 if(fi->fileName().contains(".so")){
92 loadPlugin(path + "/" + fi->fileName()); 92 loadPlugin(path + "/" + fi->fileName());
93 } 93 }
94 ++it; 94 ++it;
95 } 95 }
96} 96}
97 97
98/** 98/**
99 * Attempt to load a function and resolve a function. 99 * Attempt to load a function and resolve a function.
100 * @param pluginFileName - the name of the file in which to attempt to load 100 * @param pluginFileName - the name of the file in which to attempt to load
101 * @param resolveString - function pointer to resolve 101 * @param resolveString - function pointer to resolve
102 * @return pointer to the function with name resolveString or NULL 102 * @return pointer to the function with name resolveString or NULL
103 */ 103 */
104Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ 104Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
105 qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); 105 qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
106 QLibrary *lib = new QLibrary(pluginFileName); 106 QLibrary *lib = new QLibrary(pluginFileName);
107 void *functionPointer = lib->resolve(resolveString); 107 void *functionPointer = lib->resolve(resolveString);
108 if( !functionPointer ){ 108 if( !functionPointer ){
109 qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); 109 qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
110 delete lib; 110 delete lib;
111 return NULL; 111 return NULL;
112 } 112 }
113 113
114 // Try to get an object. 114 // Try to get an object.
115 Module *object = ((Module* (*)()) functionPointer)(); 115 Module *object = ((Module* (*)()) functionPointer)();
116 if(object == NULL){ 116 if(object == NULL){
117 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 117 qDebug("MainWindowImp: Couldn't create object, but did load library!");
118 delete lib; 118 delete lib;
119 return NULL; 119 return NULL;
120 } 120 }
121 121
122 // Store for deletion later 122 // Store for deletion later
123 libraries.insert(object, lib); 123 libraries.insert(object, lib);
124 return object; 124 return object;
125} 125}
126 126
127/** 127/**
128 * The Add button was clicked. Bring up the add dialog and if OK is hit 128 * The Add button was clicked. Bring up the add dialog and if OK is hit
129 * load the plugin and append it to the list 129 * load the plugin and append it to the list
130 */ 130 */
131void MainWindowImp::addClicked(){ 131void MainWindowImp::addClicked(){
132 QMap<Module*, QLibrary*>::Iterator it; 132 QMap<Module*, QLibrary*>::Iterator it;
133 QMap<QString, QString> list; 133 QMap<QString, QString> list;
134 QMap<QString, Module*> newInterfaceOwners; 134 QMap<QString, Module*> newInterfaceOwners;
135 list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); 135 list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
136 list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port"); 136 list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
137 for( it = libraries.begin(); it != libraries.end(); ++it ){ 137 for( it = libraries.begin(); it != libraries.end(); ++it ){
138 if(it.key()){ 138 if(it.key()){
139 (it.key())->possibleNewInterfaces(list); 139 (it.key())->possibleNewInterfaces(list);
140 } 140 }