author | benmeyer <benmeyer> | 2002-09-30 19:41:41 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-09-30 19:41:41 (UTC) |
commit | a0f88d7d0fb0ffaf8d1aa7b753b0d48ee344e34f (patch) (unidiff) | |
tree | 10e1141777f657881af01cab036962c128109ec2 /noncore/net/networksetup/mainwindowimp.cpp | |
parent | d49bd63f3b15795a1ee2497960f00eb3fb075e69 (diff) | |
download | opie-a0f88d7d0fb0ffaf8d1aa7b753b0d48ee344e34f.zip opie-a0f88d7d0fb0ffaf8d1aa7b753b0d48ee344e34f.tar.gz opie-a0f88d7d0fb0ffaf8d1aa7b753b0d48ee344e34f.tar.bz2 |
ui cleanup with groupboxes
Diffstat (limited to 'noncore/net/networksetup/mainwindowimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/networksetup/mainwindowimp.cpp | 76 |
1 files changed, 37 insertions, 39 deletions
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index 2f821a9..0f48a4b 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp | |||
@@ -2,10 +2,10 @@ | |||
2 | #include "addserviceimp.h" | 2 | #include "addserviceimp.h" |
3 | #include "interfaceinformationimp.h" | 3 | #include "interfaceinformationimp.h" |
4 | #include "interfacesetupimp.h" | 4 | #include "interfacesetupimp.h" |
5 | #include "interface.h" | ||
6 | #include "kprocess.h" | 5 | #include "kprocess.h" |
7 | #include "module.h" | 6 | #include "module.h" |
8 | 7 | ||
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> |
@@ -31,11 +31,6 @@ | |||
31 | #define TEMP_ALL "/tmp/ifconfig-a" | 31 | #define TEMP_ALL "/tmp/ifconfig-a" |
32 | #define TEMP_UP "/tmp/ifconfig" | 32 | #define TEMP_UP "/tmp/ifconfig" |
33 | 33 | ||
34 | #define NO_SELECT_ERROR_AND_RETURN { \ | ||
35 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); \ | ||
36 | return; \ | ||
37 | } | ||
38 | |||
39 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) { | 34 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) { |
40 | connect(addServiceButton, SIGNAL(clicked()), this, SLOT(addClicked())); | 35 | connect(addServiceButton, SIGNAL(clicked()), this, SLOT(addClicked())); |
41 | connect(removeServiceButton, SIGNAL(clicked()), this, SLOT(removeClicked())); | 36 | connect(removeServiceButton, SIGNAL(clicked()), this, SLOT(removeClicked())); |
@@ -81,6 +76,24 @@ MainWindowImp::~MainWindowImp(){ | |||
81 | } | 76 | } |
82 | 77 | ||
83 | void MainWindowImp::loadModules(QString path){ | 78 | void MainWindowImp::loadModules(QString path){ |
79 | qDebug(path.latin1()); | ||
80 | QDir d; | ||
81 | d.setPath(path); | ||
82 | if(!d.exists()){ | ||
83 | qDebug("MainWindowImp:: Path doesn't exists"); | ||
84 | return; | ||
85 | } | ||
86 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | ||
87 | const QFileInfoList *list = d.entryInfoList(); | ||
88 | QFileInfoListIterator it( *list ); | ||
89 | QFileInfo *fi; | ||
90 | while ( (fi=it.current()) ) { | ||
91 | if(fi->fileName().contains(".so")){ | ||
92 | qDebug("Found"); | ||
93 | Module *foo = loadPlugin(path + "/" + fi->fileName()); | ||
94 | } | ||
95 | ++it; | ||
96 | } | ||
84 | } | 97 | } |
85 | 98 | ||
86 | /** | 99 | /** |
@@ -90,7 +103,7 @@ void MainWindowImp::loadModules(QString path){ | |||
90 | * @return pointer to the function with name resolveString or NULL | 103 | * @return pointer to the function with name resolveString or NULL |
91 | */ | 104 | */ |
92 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ | 105 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ |
93 | //qDebug(pluginFileName.latin1()); | 106 | qDebug(pluginFileName.latin1()); |
94 | QLibrary *lib = new QLibrary(pluginFileName); | 107 | QLibrary *lib = new QLibrary(pluginFileName); |
95 | void *functionPointer = lib->resolve(resolveString); | 108 | void *functionPointer = lib->resolve(resolveString); |
96 | if( !functionPointer ){ | 109 | if( !functionPointer ){ |
@@ -112,34 +125,6 @@ Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString) | |||
112 | return object; | 125 | return object; |
113 | } | 126 | } |
114 | 127 | ||
115 | /* | ||
116 | QList<QString> MainWindowImp::retrieveUnloadedPluginList(){ | ||
117 | QString DirStr = QDir::homeDirPath() + "/.networksetup/" ; | ||
118 | QString path = DirStr + "plugins"; | ||
119 | QDir d(path); | ||
120 | d.setFilter( QDir::Files | QDir::Hidden ); | ||
121 | |||
122 | QMap<QObject*, QLibrary*>::Iterator libraryIt; | ||
123 | QList<QString> rlist; | ||
124 | rlist.setAutoDelete(false); | ||
125 | |||
126 | const QFileInfoList *list = d.entryInfoList(); | ||
127 | QFileInfoListIterator it( *list ); | ||
128 | QFileInfo *fi; | ||
129 | while ( (fi=it.current()) ) { | ||
130 | if(fi->fileName().contains(".so")){ | ||
131 | for( libraryIt = libraries.begin(); libraryIt != libraries.end(); ++libraryIt ) | ||
132 | if((path + "/" + fi->fileName()) != (libraryIt.data())->library()){ | ||
133 | QString *s = new QString(path + "/" + fi->fileName()); | ||
134 | rlist.append(s); | ||
135 | } | ||
136 | } | ||
137 | ++it; | ||
138 | } | ||
139 | return rlist; | ||
140 | } | ||
141 | */ | ||
142 | |||
143 | /** | 128 | /** |
144 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 129 | * The Add button was clicked. Bring up the add dialog and if OK is hit |
145 | * load the plugin and append it to the list | 130 | * load the plugin and append it to the list |
@@ -161,7 +146,10 @@ void MainWindowImp::addClicked(){ | |||
161 | */ | 146 | */ |
162 | void MainWindowImp::removeClicked(){ | 147 | void MainWindowImp::removeClicked(){ |
163 | QListViewItem *item = serviceList->currentItem(); | 148 | QListViewItem *item = serviceList->currentItem(); |
164 | if(item == NULL) NO_SELECT_ERROR_AND_RETURN | 149 | if(item == NULL) { |
150 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | ||
151 | return; | ||
152 | } | ||
165 | 153 | ||
166 | if(modules.find(interfaceItems[item]) == modules.end()){ | 154 | if(modules.find(interfaceItems[item]) == modules.end()){ |
167 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); | 155 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); |
@@ -178,7 +166,10 @@ void MainWindowImp::removeClicked(){ | |||
178 | */ | 166 | */ |
179 | void MainWindowImp::configureClicked(){ | 167 | void MainWindowImp::configureClicked(){ |
180 | QListViewItem *item = serviceList->currentItem(); | 168 | QListViewItem *item = serviceList->currentItem(); |
181 | if(item == NULL) NO_SELECT_ERROR_AND_RETURN | 169 | if(item == NULL){ |
170 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | ||
171 | return; | ||
172 | } | ||
182 | 173 | ||
183 | if(modules.find(interfaceItems[item]) == modules.end()){ | 174 | if(modules.find(interfaceItems[item]) == modules.end()){ |
184 | InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]); | 175 | InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]); |
@@ -197,8 +188,11 @@ void MainWindowImp::configureClicked(){ | |||
197 | */ | 188 | */ |
198 | void MainWindowImp::informationClicked(){ | 189 | void MainWindowImp::informationClicked(){ |
199 | QListViewItem *item = serviceList->currentItem(); | 190 | QListViewItem *item = serviceList->currentItem(); |
200 | if(item == NULL)NO_SELECT_ERROR_AND_RETURN | 191 | if(item == NULL){ |
201 | 192 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | |
193 | return; | ||
194 | } | ||
195 | |||
202 | if(modules.find(interfaceItems[item]) == modules.end()){ | 196 | if(modules.find(interfaceItems[item]) == modules.end()){ |
203 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]); | 197 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]); |
204 | i->showMaximized(); | 198 | i->showMaximized(); |
@@ -311,6 +305,10 @@ void MainWindowImp::updateInterface(Interface *i){ | |||
311 | QString typeName = "lan"; | 305 | QString typeName = "lan"; |
312 | if(i->getHardwareName().contains("Local Loopback")) | 306 | if(i->getHardwareName().contains("Local Loopback")) |
313 | typeName = "lo"; | 307 | typeName = "lo"; |
308 | if(i->getInterfaceName().contains("irda")) | ||
309 | typeName = "irda"; | ||
310 | if(i->getInterfaceName().contains("wlan")) | ||
311 | typeName = "wlan"; | ||
314 | QPixmap type = (Resource::loadPixmap(typeName)); | 312 | QPixmap type = (Resource::loadPixmap(typeName)); |
315 | item->setPixmap(1, type); | 313 | item->setPixmap(1, type); |
316 | 314 | ||