Diffstat (limited to 'noncore/settings/networksettings/mainwindowimp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 272 |
1 files changed, 171 insertions, 101 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index d9752ce..b0a1dd9 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -1,59 +1,52 @@ | |||
1 | |||
1 | #include "mainwindowimp.h" | 2 | #include "mainwindowimp.h" |
2 | #include "addconnectionimp.h" | 3 | #include "addconnectionimp.h" |
3 | #include "interfaceinformationimp.h" | 4 | #include "interfaceinformationimp.h" |
4 | #include "interfacesetupimp.h" | 5 | #include "interfacesetupimp.h" |
5 | #include "interfaces.h" | 6 | #include "interfaces.h" |
6 | #include "module.h" | 7 | #include "module.h" |
7 | 8 | ||
9 | /* OPIE */ | ||
10 | #include <qpe/qcopenvelope_qws.h> | ||
11 | #include <qpe/qpeapplication.h> | ||
12 | #include <qpe/config.h> | ||
13 | #include <qpe/qlibrary.h> | ||
14 | #include <qpe/resource.h> | ||
15 | |||
16 | /* QT */ | ||
8 | #include <qpushbutton.h> | 17 | #include <qpushbutton.h> |
9 | #include <qlistbox.h> | 18 | #include <qlistbox.h> |
10 | #include <qlineedit.h> | 19 | #include <qlineedit.h> |
11 | #include <qlistview.h> | 20 | #include <qlistview.h> |
12 | #include <qheader.h> | 21 | #include <qheader.h> |
13 | #include <qlabel.h> | 22 | #include <qlabel.h> |
14 | #include <qpe/qcopenvelope_qws.h> | ||
15 | #include <qtabwidget.h> // in order to disable the profiles tab | 23 | #include <qtabwidget.h> // in order to disable the profiles tab |
16 | #include <qpe/qpeapplication.h> | ||
17 | |||
18 | #include <qmessagebox.h> | 24 | #include <qmessagebox.h> |
19 | 25 | ||
20 | #ifdef QWS | ||
21 | #include <qpe/config.h> | ||
22 | #include <qpe/qlibrary.h> | ||
23 | #include <qpe/resource.h> | ||
24 | #include <qpe/qpeapplication.h> | ||
25 | #else | ||
26 | #include <klibloader.h> | ||
27 | #define QLibrary KLibrary | ||
28 | #include <kconfig.h> | ||
29 | #define Config KConfig | ||
30 | #include <kapplication.h> | ||
31 | #include <kstandarddirs.h> | ||
32 | #include <kiconloader.h> | ||
33 | #define showMaximized show | ||
34 | #endif | ||
35 | 26 | ||
36 | #if QT_VERSION < 300 | 27 | #if QT_VERSION < 300 |
37 | #include <qlist.h> | 28 | #include <qlist.h> |
38 | #else | 29 | #else |
39 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
40 | #endif | 31 | #endif |
41 | #include <qdir.h> | 32 | #include <qdir.h> |
42 | #include <qfile.h> | 33 | #include <qfile.h> |
43 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
44 | #include <qregexp.h> | 35 | #include <qregexp.h> |
45 | 36 | ||
37 | /* STD */ | ||
46 | #include <net/if.h> | 38 | #include <net/if.h> |
47 | #include <sys/ioctl.h> | 39 | #include <sys/ioctl.h> |
48 | #include <sys/socket.h> | 40 | #include <sys/socket.h> |
49 | 41 | ||
50 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" | 42 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" |
51 | #define _PROCNETDEV "/proc/net/dev" | 43 | #define _PROCNETDEV "/proc/net/dev" |
52 | 44 | ||
53 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME){ | 45 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME) |
46 | { | ||
54 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); | 47 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); |
55 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); | 48 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); |
56 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); | 49 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); |
57 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); | 50 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); |
58 | 51 | ||
59 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); | 52 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); |
@@ -75,28 +68,33 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi | |||
75 | #endif | 68 | #endif |
76 | getAllInterfaces(); | 69 | getAllInterfaces(); |
77 | 70 | ||
78 | Interfaces i; | 71 | Interfaces i; |
79 | QStringList list = i.getInterfaceList(); | 72 | QStringList list = i.getInterfaceList(); |
80 | QMap<QString, Interface*>::Iterator it; | 73 | QMap<QString, Interface*>::Iterator it; |
81 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { | 74 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) |
75 | { | ||
82 | /* | 76 | /* |
83 | * we skipped it in getAllInterfaces now | 77 | * we skipped it in getAllInterfaces now |
84 | * we need to ignore it as well | 78 | * we need to ignore it as well |
85 | */ | 79 | */ |
86 | if (m_handledIfaces.contains( *ni) ) { | 80 | if (m_handledIfaces.contains( *ni) ) |
81 | { | ||
87 | qDebug("Not up iface handled by module"); | 82 | qDebug("Not up iface handled by module"); |
88 | continue; | 83 | continue; |
89 | } | 84 | } |
90 | bool found = false; | 85 | bool found = false; |
91 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ | 86 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) |
87 | { | ||
92 | if(it.key() == (*ni)) | 88 | if(it.key() == (*ni)) |
93 | found = true; | 89 | found = true; |
94 | } | 90 | } |
95 | if(!found){ | 91 | if(!found) |
96 | if(!(*ni).contains("_")){ | 92 | { |
93 | if(!(*ni).contains("_")) | ||
94 | { | ||
97 | Interface *i = new Interface(this, *ni, false); | 95 | Interface *i = new Interface(this, *ni, false); |
98 | i->setAttached(false); | 96 | i->setAttached(false); |
99 | i->setHardwareName(tr("Disconnected")); | 97 | i->setHardwareName(tr("Disconnected")); |
100 | interfaceNames.insert(i->getInterfaceName(), i); | 98 | interfaceNames.insert(i->getInterfaceName(), i); |
101 | updateInterface(i); | 99 | updateInterface(i); |
102 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 100 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
@@ -114,17 +112,20 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi | |||
114 | profilesList->insertItem((*it)); | 112 | profilesList->insertItem((*it)); |
115 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); | 113 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); |
116 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); | 114 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); |
117 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); | 115 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); |
118 | 116 | ||
119 | QFile file(scheme); | 117 | QFile file(scheme); |
120 | if ( file.open(IO_ReadOnly) ) { // file opened successfully | 118 | if ( file.open(IO_ReadOnly) ) |
119 | { // file opened successfully | ||
121 | QTextStream stream( &file ); // use a text stream | 120 | QTextStream stream( &file ); // use a text stream |
122 | while ( !stream.eof() ) { // until end of file... | 121 | while ( !stream.eof() ) |
122 | { // until end of file... | ||
123 | QString line = stream.readLine(); // line of text excluding '\n' | 123 | QString line = stream.readLine(); // line of text excluding '\n' |
124 | if(line.contains("SCHEME")){ | 124 | if(line.contains("SCHEME")) |
125 | { | ||
125 | line = line.mid(7, line.length()); | 126 | line = line.mid(7, line.length()); |
126 | currentProfileLabel->setText(line); | 127 | currentProfileLabel->setText(line); |
127 | break; | 128 | break; |
128 | } | 129 | } |
129 | } | 130 | } |
130 | file.close(); | 131 | file.close(); |
@@ -132,29 +133,32 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi | |||
132 | makeChannel(); | 133 | makeChannel(); |
133 | } | 134 | } |
134 | 135 | ||
135 | /** | 136 | /** |
136 | * Deconstructor. Save profiles. Delete loaded libraries. | 137 | * Deconstructor. Save profiles. Delete loaded libraries. |
137 | */ | 138 | */ |
138 | MainWindowImp::~MainWindowImp(){ | 139 | MainWindowImp::~MainWindowImp() |
140 | { | ||
139 | // Save profiles. | 141 | // Save profiles. |
140 | Config cfg("NetworkSetup"); | 142 | Config cfg("NetworkSetup"); |
141 | cfg.setGroup("General"); | 143 | cfg.setGroup("General"); |
142 | cfg.writeEntry("Profiles", profiles.join(" ")); | 144 | cfg.writeEntry("Profiles", profiles.join(" ")); |
143 | 145 | ||
144 | // Delete all interfaces that don't have owners. | 146 | // Delete all interfaces that don't have owners. |
145 | QMap<Interface*, QListViewItem*>::Iterator iIt; | 147 | QMap<Interface*, QListViewItem*>::Iterator iIt; |
146 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ | 148 | for( iIt = items.begin(); iIt != items.end(); ++iIt ) |
149 | { | ||
147 | if(iIt.key()->getModuleOwner() == NULL) | 150 | if(iIt.key()->getModuleOwner() == NULL) |
148 | delete iIt.key(); | 151 | delete iIt.key(); |
149 | } | 152 | } |
150 | 153 | ||
151 | #ifdef QWS | 154 | #ifdef QWS |
152 | // Delete Modules and Libraries | 155 | // Delete Modules and Libraries |
153 | QMap<Module*, QLibrary*>::Iterator it; | 156 | QMap<Module*, QLibrary*>::Iterator it; |
154 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 157 | for( it = libraries.begin(); it != libraries.end(); ++it ) |
158 | { | ||
155 | delete it.key(); | 159 | delete it.key(); |
156 | // I wonder why I can't delete the libraries | 160 | // I wonder why I can't delete the libraries |
157 | // What fucking shit this is. | 161 | // What fucking shit this is. |
158 | //delete it.data(); | 162 | //delete it.data(); |
159 | } | 163 | } |
160 | #else | 164 | #else |
@@ -162,53 +166,62 @@ MainWindowImp::~MainWindowImp(){ | |||
162 | #endif | 166 | #endif |
163 | } | 167 | } |
164 | 168 | ||
165 | /** | 169 | /** |
166 | * Query the kernel for all of the interfaces. | 170 | * Query the kernel for all of the interfaces. |
167 | */ | 171 | */ |
168 | void MainWindowImp::getAllInterfaces(){ | 172 | void MainWindowImp::getAllInterfaces() |
173 | { | ||
169 | int sockfd = socket(PF_INET, SOCK_DGRAM, 0); | 174 | int sockfd = socket(PF_INET, SOCK_DGRAM, 0); |
170 | if(sockfd == -1) | 175 | if(sockfd == -1) |
171 | return; | 176 | return; |
172 | 177 | ||
173 | struct ifreq ifr; | 178 | struct ifreq ifr; |
174 | QStringList ifaces; | 179 | QStringList ifaces; |
175 | QFile procFile(QString(_PROCNETDEV)); | 180 | QFile procFile(QString(_PROCNETDEV)); |
176 | int result; | 181 | int result; |
177 | Interface *i; | 182 | Interface *i; |
178 | 183 | ||
179 | if (! procFile.exists()) { | 184 | if (! procFile.exists()) |
185 | { | ||
180 | struct ifreq ifrs[100]; | 186 | struct ifreq ifrs[100]; |
181 | struct ifconf ifc; | 187 | struct ifconf ifc; |
182 | ifc.ifc_len = sizeof(ifrs); | 188 | ifc.ifc_len = sizeof(ifrs); |
183 | ifc.ifc_req = ifrs; | 189 | ifc.ifc_req = ifrs; |
184 | result = ioctl(sockfd, SIOCGIFCONF, &ifc); | 190 | result = ioctl(sockfd, SIOCGIFCONF, &ifc); |
185 | 191 | ||
186 | for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++) { | 192 | for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++) |
193 | { | ||
187 | struct ifreq *pifr = &ifrs[i]; | 194 | struct ifreq *pifr = &ifrs[i]; |
188 | 195 | ||
189 | ifaces += pifr->ifr_name; | 196 | ifaces += pifr->ifr_name; |
190 | } | 197 | } |
191 | } else { | 198 | } |
199 | else | ||
200 | { | ||
192 | procFile.open(IO_ReadOnly); | 201 | procFile.open(IO_ReadOnly); |
193 | QString line; | 202 | QString line; |
194 | QTextStream procTs(&procFile); | 203 | QTextStream procTs(&procFile); |
195 | int loc = -1; | 204 | int loc = -1; |
196 | 205 | ||
197 | procTs.readLine(); // eat a line | 206 | procTs.readLine(); // eat a line |
198 | procTs.readLine(); // eat a line | 207 | procTs.readLine(); // eat a line |
199 | while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { | 208 | while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) |
200 | if((loc = line.find(":")) != -1) { | 209 | { |
210 | if((loc = line.find(":")) != -1) | ||
211 | { | ||
201 | ifaces += line.left(loc); | 212 | ifaces += line.left(loc); |
202 | } | 213 | } |
203 | } | 214 | } |
204 | } | 215 | } |
205 | 216 | ||
206 | for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) { | 217 | for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) |
218 | { | ||
207 | int flags = 0; | 219 | int flags = 0; |
208 | if ( m_handledIfaces.contains( (*it) ) ) { | 220 | if ( m_handledIfaces.contains( (*it) ) ) |
221 | { | ||
209 | qDebug(" %s is handled by a module", (*it).latin1() ); | 222 | qDebug(" %s is handled by a module", (*it).latin1() ); |
210 | continue; | 223 | continue; |
211 | } | 224 | } |
212 | // int family; | 225 | // int family; |
213 | i = NULL; | 226 | i = NULL; |
214 | 227 | ||
@@ -242,16 +255,19 @@ void MainWindowImp::getAllInterfaces(){ | |||
242 | connect(i, SIGNAL(updateInterface(Interface *)), | 255 | connect(i, SIGNAL(updateInterface(Interface *)), |
243 | this, SLOT(updateInterface(Interface *))); | 256 | this, SLOT(updateInterface(Interface *))); |
244 | } | 257 | } |
245 | // now lets ask the plugins too ;) | 258 | // now lets ask the plugins too ;) |
246 | QMap<Module*, QLibrary*>::Iterator it; | 259 | QMap<Module*, QLibrary*>::Iterator it; |
247 | QList<Interface> ilist; | 260 | QList<Interface> ilist; |
248 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 261 | for( it = libraries.begin(); it != libraries.end(); ++it ) |
249 | if(it.key()){ | 262 | { |
263 | if(it.key()) | ||
264 | { | ||
250 | ilist = it.key()->getInterfaces(); | 265 | ilist = it.key()->getInterfaces(); |
251 | for( i = ilist.first(); i != 0; i = ilist.next() ){ | 266 | for( i = ilist.first(); i != 0; i = ilist.next() ) |
267 | { | ||
252 | qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() ); | 268 | qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() ); |
253 | interfaceNames.insert(i->getInterfaceName(), i); | 269 | interfaceNames.insert(i->getInterfaceName(), i); |
254 | updateInterface(i); | 270 | updateInterface(i); |
255 | connect(i, SIGNAL(updateInterface(Interface *)), | 271 | connect(i, SIGNAL(updateInterface(Interface *)), |
256 | this, SLOT(updateInterface(Interface *))); | 272 | this, SLOT(updateInterface(Interface *))); |
257 | } | 273 | } |
@@ -261,30 +277,34 @@ void MainWindowImp::getAllInterfaces(){ | |||
261 | 277 | ||
262 | /** | 278 | /** |
263 | * Load all modules that are found in the path | 279 | * Load all modules that are found in the path |
264 | * @param path a directory that is scaned for any plugins that can be loaded | 280 | * @param path a directory that is scaned for any plugins that can be loaded |
265 | * and attempts to load them | 281 | * and attempts to load them |
266 | */ | 282 | */ |
267 | void MainWindowImp::loadModules(const QString &path){ | 283 | void MainWindowImp::loadModules(const QString &path) |
284 | { | ||
268 | #ifdef DEBUG | 285 | #ifdef DEBUG |
269 | qDebug("MainWindowImp::loadModules: %s", path.latin1()); | 286 | qDebug("MainWindowImp::loadModules: %s", path.latin1()); |
270 | #endif | 287 | #endif |
271 | QDir d(path); | 288 | QDir d(path); |
272 | if(!d.exists()) | 289 | if(!d.exists()) |
273 | return; | 290 | return; |
274 | 291 | ||
275 | // Don't want sym links | 292 | // Don't want sym links |
276 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 293 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
277 | const QFileInfoList *list = d.entryInfoList(); | 294 | const QFileInfoList *list = d.entryInfoList(); |
278 | QFileInfoListIterator it( *list ); | 295 | QFileInfoListIterator it( *list ); |
279 | QFileInfo *fi; | 296 | QFileInfo *fi; |
280 | while ( (fi=it.current()) ) { | 297 | while ( (fi=it.current()) ) |
298 | { | ||
281 | #ifdef QWS | 299 | #ifdef QWS |
282 | if(fi->fileName().contains(".so")){ | 300 | if(fi->fileName().contains(".so")) |
301 | { | ||
283 | #else | 302 | #else |
284 | if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")){ | 303 | if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")) |
304 | { | ||
285 | #endif | 305 | #endif |
286 | loadPlugin(path + "/" + fi->fileName()); | 306 | loadPlugin(path + "/" + fi->fileName()); |
287 | qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1()); | 307 | qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1()); |
288 | } | 308 | } |
289 | ++it; | 309 | ++it; |
290 | } | 310 | } |
@@ -293,29 +313,32 @@ void MainWindowImp::loadModules(const QString &path){ | |||
293 | /** | 313 | /** |
294 | * Attempt to load a function and resolve a function. | 314 | * Attempt to load a function and resolve a function. |
295 | * @param pluginFileName - the name of the file in which to attempt to load | 315 | * @param pluginFileName - the name of the file in which to attempt to load |
296 | * @param resolveString - function pointer to resolve | 316 | * @param resolveString - function pointer to resolve |
297 | * @return pointer to the function with name resolveString or NULL | 317 | * @return pointer to the function with name resolveString or NULL |
298 | */ | 318 | */ |
299 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){ | 319 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) |
320 | { | ||
300 | #ifdef DEBUG | 321 | #ifdef DEBUG |
301 | qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1()); | 322 | qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1()); |
302 | #endif | 323 | #endif |
303 | #ifdef QWS | 324 | #ifdef QWS |
304 | QLibrary *lib = new QLibrary(pluginFileName); | 325 | QLibrary *lib = new QLibrary(pluginFileName); |
305 | void *functionPointer = lib->resolve(resolveString); | 326 | void *functionPointer = lib->resolve(resolveString); |
306 | if( !functionPointer ){ | 327 | if( !functionPointer ) |
328 | { | ||
307 | #ifdef DEBUG | 329 | #ifdef DEBUG |
308 | qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1()); | 330 | qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1()); |
309 | #endif | 331 | #endif |
310 | delete lib; | 332 | delete lib; |
311 | return NULL; | 333 | return NULL; |
312 | } | 334 | } |
313 | // Try to get an object. | 335 | // Try to get an object. |
314 | Module *object = ((Module* (*)()) functionPointer)(); | 336 | Module *object = ((Module* (*)()) functionPointer)(); |
315 | if(object == NULL){ | 337 | if(object == NULL) |
338 | { | ||
316 | #ifdef DEBUG | 339 | #ifdef DEBUG |
317 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 340 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
318 | #endif | 341 | #endif |
319 | delete lib; | 342 | delete lib; |
320 | return NULL; | 343 | return NULL; |
321 | } | 344 | } |
@@ -324,19 +347,21 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
324 | // Store for deletion later | 347 | // Store for deletion later |
325 | libraries.insert(object, lib); | 348 | libraries.insert(object, lib); |
326 | return object; | 349 | return object; |
327 | 350 | ||
328 | #else | 351 | #else |
329 | QLibrary *lib = loader->library(pluginFileName); | 352 | QLibrary *lib = loader->library(pluginFileName); |
330 | if( !lib || !lib->hasSymbol(resolveString) ){ | 353 | if( !lib || !lib->hasSymbol(resolveString) ) |
354 | { | ||
331 | qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 355 | qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); |
332 | return NULL; | 356 | return NULL; |
333 | } | 357 | } |
334 | // Try to get an object. | 358 | // Try to get an object. |
335 | Module *object = ((Module* (*)()) lib->symbol(resolveString))(); | 359 | Module *object = ((Module* (*)()) lib->symbol(resolveString))(); |
336 | if(object == NULL){ | 360 | if(object == NULL) |
361 | { | ||
337 | #ifdef DEBUG | 362 | #ifdef DEBUG |
338 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 363 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
339 | #endif | 364 | #endif |
340 | return NULL; | 365 | return NULL; |
341 | } | 366 | } |
342 | #ifdef DEBUG | 367 | #ifdef DEBUG |
@@ -349,39 +374,46 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
349 | } | 374 | } |
350 | 375 | ||
351 | /** | 376 | /** |
352 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 377 | * The Add button was clicked. Bring up the add dialog and if OK is hit |
353 | * load the plugin and append it to the list | 378 | * load the plugin and append it to the list |
354 | */ | 379 | */ |
355 | void MainWindowImp::addClicked(){ | 380 | void MainWindowImp::addClicked() |
381 | { | ||
356 | QMap<Module*, QLibrary*>::Iterator it; | 382 | QMap<Module*, QLibrary*>::Iterator it; |
357 | QMap<QString, QString> list; | 383 | QMap<QString, QString> list; |
358 | QMap<QString, Module*> newInterfaceOwners; | 384 | QMap<QString, Module*> newInterfaceOwners; |
359 | 385 | ||
360 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 386 | for( it = libraries.begin(); it != libraries.end(); ++it ) |
361 | if(it.key()){ | 387 | { |
388 | if(it.key()) | ||
389 | { | ||
362 | (it.key())->possibleNewInterfaces(list); | 390 | (it.key())->possibleNewInterfaces(list); |
363 | } | 391 | } |
364 | } | 392 | } |
365 | // See if the list has anything that we can add. | 393 | // See if the list has anything that we can add. |
366 | if(list.count() == 0){ | 394 | if(list.count() == 0) |
395 | { | ||
367 | QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok); | 396 | QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok); |
368 | return; | 397 | return; |
369 | } | 398 | } |
370 | AddConnectionImp addNewConnection(this, "AddConnectionImp", true); | 399 | AddConnectionImp addNewConnection(this, "AddConnectionImp", true); |
371 | addNewConnection.addConnections(list); | 400 | addNewConnection.addConnections(list); |
372 | addNewConnection.showMaximized(); | 401 | if( QDialog::Accepted == QPEApplication::execDialog( &addNewConnection ) ) |
373 | if(QDialog::Accepted == addNewConnection.exec()){ | 402 | { |
374 | QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); | 403 | QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); |
375 | if(!item) | 404 | if(!item) |
376 | return; | 405 | return; |
377 | 406 | ||
378 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 407 | for( it = libraries.begin(); it != libraries.end(); ++it ) |
379 | if(it.key()){ | 408 | { |
409 | if(it.key()) | ||
410 | { | ||
380 | Interface *i = (it.key())->addNewInterface(item->text(0)); | 411 | Interface *i = (it.key())->addNewInterface(item->text(0)); |
381 | if(i){ | 412 | if(i) |
413 | { | ||
382 | qDebug("iface name %s",i->getInterfaceName().latin1()); | 414 | qDebug("iface name %s",i->getInterfaceName().latin1()); |
383 | interfaceNames.insert(i->getInterfaceName(), i); | 415 | interfaceNames.insert(i->getInterfaceName(), i); |
384 | updateInterface(i); | 416 | updateInterface(i); |
385 | } | 417 | } |
386 | } | 418 | } |
387 | } | 419 | } |
@@ -389,115 +421,132 @@ void MainWindowImp::addClicked(){ | |||
389 | } | 421 | } |
390 | 422 | ||
391 | /** | 423 | /** |
392 | * Prompt the user to see if they really want to do this. | 424 | * Prompt the user to see if they really want to do this. |
393 | * If they do then remove from the list and unload. | 425 | * If they do then remove from the list and unload. |
394 | */ | 426 | */ |
395 | void MainWindowImp::removeClicked(){ | 427 | void MainWindowImp::removeClicked() |
428 | { | ||
396 | QListViewItem *item = connectionList->currentItem(); | 429 | QListViewItem *item = connectionList->currentItem(); |
397 | if(!item) { | 430 | if(!item) |
431 | { | ||
398 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); | 432 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |
399 | return; | 433 | return; |
400 | } | 434 | } |
401 | 435 | ||
402 | Interface *i = interfaceItems[item]; | 436 | Interface *i = interfaceItems[item]; |
403 | if(i->getModuleOwner() == NULL){ | 437 | if(i->getModuleOwner() == NULL) |
438 | { | ||
404 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); | 439 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); |
405 | } | 440 | } |
406 | else{ | 441 | else |
442 | { | ||
407 | if(!i->getModuleOwner()->remove(i)) | 443 | if(!i->getModuleOwner()->remove(i)) |
408 | QMessageBox::information(this, tr("Error"), tr("Unable to remove."), QMessageBox::Ok); | 444 | QMessageBox::information(this, tr("Error"), tr("Unable to remove."), QMessageBox::Ok); |
409 | else{ | 445 | else |
446 | { | ||
410 | delete item; | 447 | delete item; |
411 | // QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); | 448 | // QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); |
412 | } | 449 | } |
413 | } | 450 | } |
414 | } | 451 | } |
415 | 452 | ||
416 | /** | 453 | /** |
417 | * Pull up the configure about the currently selected interface. | 454 | * Pull up the configure about the currently selected interface. |
418 | * Report an error if no interface is selected. | 455 | * Report an error if no interface is selected. |
419 | * If the interface has a module owner then request its configure. | 456 | * If the interface has a module owner then request its configure. |
420 | */ | 457 | */ |
421 | void MainWindowImp::configureClicked(){ | 458 | void MainWindowImp::configureClicked() |
459 | { | ||
422 | QListViewItem *item = connectionList->currentItem(); | 460 | QListViewItem *item = connectionList->currentItem(); |
423 | if(!item){ | 461 | if(!item) |
462 | { | ||
424 | QMessageBox::information(this, tr("Sorry"),tr("Please select an interface first."), QMessageBox::Ok); | 463 | QMessageBox::information(this, tr("Sorry"),tr("Please select an interface first."), QMessageBox::Ok); |
425 | return; | 464 | return; |
426 | } | 465 | } |
427 | 466 | ||
428 | QString currentProfileText = currentProfileLabel->text(); | 467 | QString currentProfileText = currentProfileLabel->text(); |
429 | if(currentProfileText.upper() == "ALL"); | 468 | if(currentProfileText.upper() == "ALL"); |
430 | currentProfileText = ""; | 469 | currentProfileText = ""; |
431 | 470 | ||
432 | Interface *i = interfaceItems[item]; | 471 | Interface *i = interfaceItems[item]; |
433 | 472 | ||
434 | if(i->getModuleOwner()){ | 473 | if(i->getModuleOwner()) |
474 | { | ||
435 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i); | 475 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i); |
436 | if(moduleConfigure != NULL){ | 476 | if(moduleConfigure != NULL) |
477 | { | ||
437 | i->getModuleOwner()->setProfile(currentProfileText); | 478 | i->getModuleOwner()->setProfile(currentProfileText); |
438 | moduleConfigure->showMaximized(); | 479 | QPEApplication::showWidget( moduleConfigure ); |
439 | return; | 480 | return; |
440 | } | 481 | } |
441 | } | 482 | } |
442 | 483 | ||
443 | InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose | Qt::WStyle_ContextHelp ); | 484 | InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose | Qt::WStyle_ContextHelp ); |
444 | configure->setProfile(currentProfileText); | 485 | configure->setProfile(currentProfileText); |
445 | configure->showMaximized(); | 486 | QPEApplication::showDialog( configure ); |
446 | } | 487 | } |
447 | 488 | ||
448 | /** | 489 | /** |
449 | * Pull up the information about the currently selected interface. | 490 | * Pull up the information about the currently selected interface. |
450 | * Report an error if no interface is selected. | 491 | * Report an error if no interface is selected. |
451 | * If the interface has a module owner then request its configure. | 492 | * If the interface has a module owner then request its configure. |
452 | */ | 493 | */ |
453 | void MainWindowImp::informationClicked(){ | 494 | void MainWindowImp::informationClicked() |
495 | { | ||
454 | QListViewItem *item = connectionList->currentItem(); | 496 | QListViewItem *item = connectionList->currentItem(); |
455 | if(!item){ | 497 | if(!item) |
498 | { | ||
456 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); | 499 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |
457 | return; | 500 | return; |
458 | } | 501 | } |
459 | 502 | ||
460 | Interface *i = interfaceItems[item]; | 503 | Interface *i = interfaceItems[item]; |
461 | // if(!i->isAttached()){ | 504 | // if(!i->isAttached()){ |
462 | // QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); | 505 | // QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); |
463 | // return; | 506 | // return; |
464 | // } | 507 | // } |
465 | 508 | ||
466 | if(i->getModuleOwner()){ | 509 | if(i->getModuleOwner()) |
510 | { | ||
467 | QWidget *moduleInformation = i->getModuleOwner()->information(i); | 511 | QWidget *moduleInformation = i->getModuleOwner()->information(i); |
468 | if(moduleInformation != NULL){ | 512 | if(moduleInformation != NULL) |
469 | moduleInformation->showMaximized(); | 513 | { |
514 | QPEApplication::showWidget( moduleInformation ); | ||
470 | #ifdef DEBUG | 515 | #ifdef DEBUG |
471 | qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); | 516 | qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); |
472 | #endif | 517 | #endif |
473 | return; | 518 | return; |
474 | } | 519 | } |
475 | } | 520 | } |
476 | InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp); | 521 | InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp); |
477 | information->showMaximized(); | 522 | QPEApplication::showWidget( information ); |
478 | } | 523 | } |
479 | 524 | ||
480 | /** | 525 | /** |
481 | * Update this interface. If no QListViewItem exists create one. | 526 | * Update this interface. If no QListViewItem exists create one. |
482 | * @param Interface* pointer to the interface that needs to be updated. | 527 | * @param Interface* pointer to the interface that needs to be updated. |
483 | */ | 528 | */ |
484 | void MainWindowImp::updateInterface(Interface *i){ | 529 | void MainWindowImp::updateInterface(Interface *i) |
485 | if(!advancedUserMode){ | 530 | { |
531 | if(!advancedUserMode) | ||
532 | { | ||
486 | if(i->getInterfaceName() == "lo") | 533 | if(i->getInterfaceName() == "lo") |
487 | return; | 534 | return; |
488 | } | 535 | } |
489 | 536 | ||
490 | QListViewItem *item = NULL; | 537 | QListViewItem *item = NULL; |
491 | 538 | ||
492 | // Find the interface, making it if needed. | 539 | // Find the interface, making it if needed. |
493 | if(items.find(i) == items.end()){ | 540 | if(items.find(i) == items.end()) |
541 | { | ||
494 | item = new QListViewItem(connectionList, "", "", ""); | 542 | item = new QListViewItem(connectionList, "", "", ""); |
495 | // See if you can't find a module owner for this interface | 543 | // See if you can't find a module owner for this interface |
496 | QMap<Module*, QLibrary*>::Iterator it; | 544 | QMap<Module*, QLibrary*>::Iterator it; |
497 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 545 | for( it = libraries.begin(); it != libraries.end(); ++it ) |
546 | { | ||
498 | if(it.key()->isOwner(i)) | 547 | if(it.key()->isOwner(i)) |
499 | i->setModuleOwner(it.key()); | 548 | i->setModuleOwner(it.key()); |
500 | } | 549 | } |
501 | items.insert(i, item); | 550 | items.insert(i, item); |
502 | interfaceItems.insert(item, i); | 551 | interfaceItems.insert(item, i); |
503 | } | 552 | } |
@@ -534,74 +583,86 @@ void MainWindowImp::updateInterface(Interface *i){ | |||
534 | #endif | 583 | #endif |
535 | item->setText(2, i->getHardwareName()); | 584 | item->setText(2, i->getHardwareName()); |
536 | item->setText(3, QString("(%1)").arg(i->getInterfaceName())); | 585 | item->setText(3, QString("(%1)").arg(i->getInterfaceName())); |
537 | item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); | 586 | item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); |
538 | } | 587 | } |
539 | 588 | ||
540 | void MainWindowImp::newProfileChanged(const QString& newText){ | 589 | void MainWindowImp::newProfileChanged(const QString& newText) |
590 | { | ||
541 | if(newText.length() > 0) | 591 | if(newText.length() > 0) |
542 | newProfileButton->setEnabled(true); | 592 | newProfileButton->setEnabled(true); |
543 | else | 593 | else |
544 | newProfileButton->setEnabled(false); | 594 | newProfileButton->setEnabled(false); |
545 | } | 595 | } |
546 | 596 | ||
547 | /** | 597 | /** |
548 | * Adds a new profile to the list of profiles. | 598 | * Adds a new profile to the list of profiles. |
549 | * Don't add profiles that already exists. | 599 | * Don't add profiles that already exists. |
550 | * Appends to the list and QStringList | 600 | * Appends to the list and QStringList |
551 | */ | 601 | */ |
552 | void MainWindowImp::addProfile(){ | 602 | void MainWindowImp::addProfile() |
603 | { | ||
553 | QString newProfileName = newProfile->text(); | 604 | QString newProfileName = newProfile->text(); |
554 | if(profiles.grep(newProfileName).count() > 0){ | 605 | if(profiles.grep(newProfileName).count() > 0) |
606 | { | ||
555 | QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); | 607 | QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); |
556 | return; | 608 | return; |
557 | } | 609 | } |
558 | profiles.append(newProfileName); | 610 | profiles.append(newProfileName); |
559 | profilesList->insertItem(newProfileName); | 611 | profilesList->insertItem(newProfileName); |
560 | } | 612 | } |
561 | 613 | ||
562 | /** | 614 | /** |
563 | * Removes the currently selected profile in the combo. | 615 | * Removes the currently selected profile in the combo. |
564 | * Doesn't delete if there are less then 2 profiles. | 616 | * Doesn't delete if there are less then 2 profiles. |
565 | */ | 617 | */ |
566 | void MainWindowImp::removeProfile(){ | 618 | void MainWindowImp::removeProfile() |
567 | if(profilesList->count() <= 1){ | 619 | { |
620 | if(profilesList->count() <= 1) | ||
621 | { | ||
568 | QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok); | 622 | QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok); |
569 | return; | 623 | return; |
570 | } | 624 | } |
571 | QString profileToRemove = profilesList->currentText(); | 625 | QString profileToRemove = profilesList->currentText(); |
572 | if(profileToRemove == "All"){ | 626 | if(profileToRemove == "All") |
627 | { | ||
573 | QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok); | 628 | QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok); |
574 | return; | 629 | return; |
575 | } | 630 | } |
576 | // Can't remove the curent profile | 631 | // Can't remove the curent profile |
577 | if(profileToRemove == currentProfileLabel->text()){ | 632 | if(profileToRemove == currentProfileLabel->text()) |
633 | { | ||
578 | QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok); | 634 | QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok); |
579 | return; | 635 | return; |
580 | 636 | ||
581 | } | 637 | } |
582 | 638 | ||
583 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ | 639 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) |
640 | { | ||
584 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); | 641 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); |
585 | profilesList->clear(); | 642 | profilesList->clear(); |
586 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 643 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
587 | profilesList->insertItem((*it)); | 644 | profilesList->insertItem((*it)); |
588 | 645 | ||
589 | // Remove any interface settings and mappings. | 646 | // Remove any interface settings and mappings. |
590 | Interfaces interfaces; | 647 | Interfaces interfaces; |
591 | // Go through them one by one | 648 | // Go through them one by one |
592 | QMap<Interface*, QListViewItem*>::Iterator it; | 649 | QMap<Interface*, QListViewItem*>::Iterator it; |
593 | for( it = items.begin(); it != items.end(); ++it ){ | 650 | for( it = items.begin(); it != items.end(); ++it ) |
651 | { | ||
594 | QString interfaceName = it.key()->getInterfaceName(); | 652 | QString interfaceName = it.key()->getInterfaceName(); |
595 | qDebug(interfaceName.latin1()); | 653 | qDebug(interfaceName.latin1()); |
596 | if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){ | 654 | if(interfaces.setInterface(interfaceName + "_" + profileToRemove)) |
655 | { | ||
597 | interfaces.removeInterface(); | 656 | interfaces.removeInterface(); |
598 | if(interfaces.setMapping(interfaceName)){ | 657 | if(interfaces.setMapping(interfaceName)) |
658 | { | ||
599 | if(profilesList->count() == 1) | 659 | if(profilesList->count() == 1) |
600 | interfaces.removeMapping(); | 660 | interfaces.removeMapping(); |
601 | else{ | 661 | else |
662 | { | ||
602 | interfaces.removeMap("map", interfaceName + "_" + profileToRemove); | 663 | interfaces.removeMap("map", interfaceName + "_" + profileToRemove); |
603 | } | 664 | } |
604 | } | 665 | } |
605 | interfaces.write(); | 666 | interfaces.write(); |
606 | break; | 667 | break; |
607 | } | 668 | } |
@@ -610,32 +671,38 @@ void MainWindowImp::removeProfile(){ | |||
610 | } | 671 | } |
611 | 672 | ||
612 | /** | 673 | /** |
613 | * A new profile has been selected, change. | 674 | * A new profile has been selected, change. |
614 | * @param newProfile the new profile. | 675 | * @param newProfile the new profile. |
615 | */ | 676 | */ |
616 | void MainWindowImp::changeProfile(){ | 677 | void MainWindowImp::changeProfile() |
617 | if(profilesList->currentItem() == -1){ | 678 | { |
679 | if(profilesList->currentItem() == -1) | ||
680 | { | ||
618 | QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); | 681 | QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); |
619 | return; | 682 | return; |
620 | } | 683 | } |
621 | QString newProfile = profilesList->text(profilesList->currentItem()); | 684 | QString newProfile = profilesList->text(profilesList->currentItem()); |
622 | if(newProfile != currentProfileLabel->text()){ | 685 | if(newProfile != currentProfileLabel->text()) |
686 | { | ||
623 | currentProfileLabel->setText(newProfile); | 687 | currentProfileLabel->setText(newProfile); |
624 | QFile::remove(scheme); | 688 | QFile::remove(scheme); |
625 | QFile file(scheme); | 689 | QFile file(scheme); |
626 | if ( file.open(IO_ReadWrite) ) { | 690 | if ( file.open(IO_ReadWrite) ) |
691 | { | ||
627 | QTextStream stream( &file ); | 692 | QTextStream stream( &file ); |
628 | stream << QString("SCHEME=%1").arg(newProfile); | 693 | stream << QString("SCHEME=%1").arg(newProfile); |
629 | file.close(); | 694 | file.close(); |
630 | } | 695 | } |
631 | // restart all up devices? | 696 | // restart all up devices? |
632 | if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ | 697 | if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok) |
698 | { | ||
633 | // Go through them one by one | 699 | // Go through them one by one |
634 | QMap<Interface*, QListViewItem*>::Iterator it; | 700 | QMap<Interface*, QListViewItem*>::Iterator it; |
635 | for( it = items.begin(); it != items.end(); ++it ){ | 701 | for( it = items.begin(); it != items.end(); ++it ) |
702 | { | ||
636 | if(it.key()->getStatus() == true) | 703 | if(it.key()->getStatus() == true) |
637 | it.key()->restart(); | 704 | it.key()->restart(); |
638 | } | 705 | } |
639 | } | 706 | } |
640 | } | 707 | } |
641 | // TODO change the profile in the modules | 708 | // TODO change the profile in the modules |
@@ -650,26 +717,29 @@ void MainWindowImp::makeChannel() | |||
650 | } | 717 | } |
651 | 718 | ||
652 | void MainWindowImp::receive(const QCString &msg, const QByteArray &arg) | 719 | void MainWindowImp::receive(const QCString &msg, const QByteArray &arg) |
653 | { | 720 | { |
654 | bool found = false; | 721 | bool found = false; |
655 | qDebug("MainWindowImp::receive QCop msg >"+msg+"<"); | 722 | qDebug("MainWindowImp::receive QCop msg >"+msg+"<"); |
656 | if (msg == "raise") { | 723 | if (msg == "raise") |
724 | { | ||
657 | raise(); | 725 | raise(); |
658 | return; | 726 | return; |
659 | } | 727 | } |
660 | 728 | ||
661 | QString dest = msg.left(msg.find("(")); | 729 | QString dest = msg.left(msg.find("(")); |
662 | QCString param = msg.right(msg.length() - msg.find("(") - 1); | 730 | QCString param = msg.right(msg.length() - msg.find("(") - 1); |
663 | param = param.left( param.length() - 1 ); | 731 | param = param.left( param.length() - 1 ); |
664 | qDebug("dest >%s< param >"+param+"<",dest.latin1()); | 732 | qDebug("dest >%s< param >"+param+"<",dest.latin1()); |
665 | 733 | ||
666 | QMap<Module*, QLibrary*>::Iterator it; | 734 | QMap<Module*, QLibrary*>::Iterator it; |
667 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 735 | for( it = libraries.begin(); it != libraries.end(); ++it ) |
736 | { | ||
668 | qDebug("plugin >%s<", it.key()->type().latin1() ); | 737 | qDebug("plugin >%s<", it.key()->type().latin1() ); |
669 | if(it.key()->type() == dest){ | 738 | if(it.key()->type() == dest) |
739 | { | ||
670 | it.key()->receive( param, arg ); | 740 | it.key()->receive( param, arg ); |
671 | found = true; | 741 | found = true; |
672 | } | 742 | } |
673 | } | 743 | } |
674 | 744 | ||
675 | 745 | ||