-rw-r--r-- | core/launcher/inputmethods.cpp | 6 | ||||
-rw-r--r-- | core/launcher/irserver.cpp | 4 | ||||
-rw-r--r-- | core/launcher/startmenu.cpp | 4 | ||||
-rw-r--r-- | core/launcher/systray.cpp | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index 586628b..24669ac 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp | |||
@@ -172,156 +172,156 @@ void InputMethods::showInputMethod(const QString& name) | |||
172 | { | 172 | { |
173 | int i = 0; | 173 | int i = 0; |
174 | QValueList<InputMethod>::Iterator it; | 174 | QValueList<InputMethod>::Iterator it; |
175 | InputMethod *im = 0; | 175 | InputMethod *im = 0; |
176 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { | 176 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { |
177 | QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); | 177 | QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); |
178 | if ( (*it).name() == name || lname == name ) { | 178 | if ( (*it).name() == name || lname == name ) { |
179 | im = &(*it); | 179 | im = &(*it); |
180 | break; | 180 | break; |
181 | } | 181 | } |
182 | } | 182 | } |
183 | if ( im ) | 183 | if ( im ) |
184 | chooseKeyboard(im); | 184 | chooseKeyboard(im); |
185 | } | 185 | } |
186 | 186 | ||
187 | void InputMethods::resetStates() | 187 | void InputMethods::resetStates() |
188 | { | 188 | { |
189 | if ( mkeyboard && !mkeyboard->newIM ) | 189 | if ( mkeyboard && !mkeyboard->newIM ) |
190 | mkeyboard->interface->resetState(); | 190 | mkeyboard->interface->resetState(); |
191 | } | 191 | } |
192 | 192 | ||
193 | QRect InputMethods::inputRect() const | 193 | QRect InputMethods::inputRect() const |
194 | { | 194 | { |
195 | if ( !mkeyboard || !mkeyboard->widget || !mkeyboard->widget->isVisible() ) | 195 | if ( !mkeyboard || !mkeyboard->widget || !mkeyboard->widget->isVisible() ) |
196 | return QRect(); | 196 | return QRect(); |
197 | else | 197 | else |
198 | return mkeyboard->widget->geometry(); | 198 | return mkeyboard->widget->geometry(); |
199 | } | 199 | } |
200 | 200 | ||
201 | void InputMethods::unloadInputMethods() | 201 | void InputMethods::unloadInputMethods() |
202 | { | 202 | { |
203 | unloadMethod( inputMethodList ); | 203 | unloadMethod( inputMethodList ); |
204 | unloadMethod( inputModifierList ); | 204 | unloadMethod( inputModifierList ); |
205 | inputMethodList.clear(); | 205 | inputMethodList.clear(); |
206 | inputModifierList.clear(); | 206 | inputModifierList.clear(); |
207 | 207 | ||
208 | } | 208 | } |
209 | 209 | ||
210 | void InputMethods::unloadMethod( QValueList<InputMethod>& list ) { | 210 | void InputMethods::unloadMethod( QValueList<InputMethod>& list ) { |
211 | QValueList<InputMethod>::Iterator it; | 211 | QValueList<InputMethod>::Iterator it; |
212 | 212 | ||
213 | for (it = list.begin(); it != list.end(); ++it ) | 213 | for (it = list.begin(); it != list.end(); ++it ) |
214 | (*it).releaseInterface(); | 214 | (*it).releaseInterface(); |
215 | 215 | ||
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | QStringList InputMethods::plugins()const { | 219 | QStringList InputMethods::plugins()const { |
220 | QString path = QPEApplication::qpeDir() + "/plugins/inputmethods"; | 220 | QString path = QPEApplication::qpeDir() + "plugins/inputmethods"; |
221 | #ifdef Q_OS_MACX | 221 | #ifdef Q_OS_MACX |
222 | QDir dir( path, "lib*.dylib" ); | 222 | QDir dir( path, "lib*.dylib" ); |
223 | #else | 223 | #else |
224 | QDir dir( path, "lib*.so" ); | 224 | QDir dir( path, "lib*.so" ); |
225 | #endif /* Q_OS_MACX */ | 225 | #endif /* Q_OS_MACX */ |
226 | return dir.entryList(); | 226 | return dir.entryList(); |
227 | } | 227 | } |
228 | 228 | ||
229 | void InputMethods::installTranslator( const QString& type ) { | 229 | void InputMethods::installTranslator( const QString& type ) { |
230 | QStringList langs = Global::languageList(); | 230 | QStringList langs = Global::languageList(); |
231 | QStringList::ConstIterator lit; | 231 | QStringList::ConstIterator lit; |
232 | for ( lit= langs.begin(); lit!=langs.end(); ++lit) { | 232 | for ( lit= langs.begin(); lit!=langs.end(); ++lit) { |
233 | QString lang = *lit; | 233 | QString lang = *lit; |
234 | QTranslator * trans = new QTranslator(qApp); | 234 | QTranslator * trans = new QTranslator(qApp); |
235 | 235 | ||
236 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | 236 | QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm"; |
237 | 237 | ||
238 | if ( trans->load( tfn )) | 238 | if ( trans->load( tfn )) |
239 | qApp->installTranslator( trans ); | 239 | qApp->installTranslator( trans ); |
240 | else | 240 | else |
241 | delete trans; | 241 | delete trans; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | void InputMethods::setPreferedHandlers() { | 245 | void InputMethods::setPreferedHandlers() { |
246 | Config cfg("qpe"); | 246 | Config cfg("qpe"); |
247 | cfg.setGroup("InputMethod"); | 247 | cfg.setGroup("InputMethod"); |
248 | QString current = cfg.readEntry("current"); | 248 | QString current = cfg.readEntry("current"); |
249 | QString im = cfg.readEntry("im"); | 249 | QString im = cfg.readEntry("im"); |
250 | 250 | ||
251 | QValueList<InputMethod>::Iterator it; | 251 | QValueList<InputMethod>::Iterator it; |
252 | if (!inputModifierList.isEmpty() && !im.isEmpty() ) { | 252 | if (!inputModifierList.isEmpty() && !im.isEmpty() ) { |
253 | for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it ) | 253 | for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it ) |
254 | if ( (*it).name() == im ) { | 254 | if ( (*it).name() == im ) { |
255 | imethod = &(*it); break; | 255 | imethod = &(*it); break; |
256 | } | 256 | } |
257 | 257 | ||
258 | } | 258 | } |
259 | if (!inputMethodList.isEmpty() && !current.isEmpty() ) { | 259 | if (!inputMethodList.isEmpty() && !current.isEmpty() ) { |
260 | for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) | 260 | for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) |
261 | if ( (*it).name() == current ) { | 261 | if ( (*it).name() == current ) { |
262 | owarn << "preferred keyboard is " << current << "" << oendl; | 262 | owarn << "preferred keyboard is " << current << "" << oendl; |
263 | mkeyboard = &(*it); | 263 | mkeyboard = &(*it); |
264 | kbdButton->setPixmap( *mkeyboard->icon() ); | 264 | kbdButton->setPixmap( *mkeyboard->icon() ); |
265 | break; | 265 | break; |
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
269 | } | 269 | } |
270 | 270 | ||
271 | void InputMethods::loadInputMethods() | 271 | void InputMethods::loadInputMethods() |
272 | { | 272 | { |
273 | #ifndef QT_NO_COMPONENT | 273 | #ifndef QT_NO_COMPONENT |
274 | hideInputMethod(); | 274 | hideInputMethod(); |
275 | mkeyboard = 0; | 275 | mkeyboard = 0; |
276 | 276 | ||
277 | unloadInputMethods(); | 277 | unloadInputMethods(); |
278 | 278 | ||
279 | QString path = QPEApplication::qpeDir() + "/plugins/inputmethods"; | 279 | QString path = QPEApplication::qpeDir() + "plugins/inputmethods"; |
280 | QStringList list = plugins(); | 280 | QStringList list = plugins(); |
281 | QStringList::Iterator it; | 281 | QStringList::Iterator it; |
282 | for ( it = list.begin(); it != list.end(); ++it ) { | 282 | for ( it = list.begin(); it != list.end(); ++it ) { |
283 | InputMethodInterface *iface = 0; | 283 | InputMethodInterface *iface = 0; |
284 | ExtInputMethodInterface *eface = 0; | 284 | ExtInputMethodInterface *eface = 0; |
285 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 285 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
286 | 286 | ||
287 | if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) { | 287 | if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) { |
288 | InputMethod input; | 288 | InputMethod input; |
289 | input.newIM = FALSE; | 289 | input.newIM = FALSE; |
290 | input.library = lib; | 290 | input.library = lib; |
291 | input.libName = *it; | 291 | input.libName = *it; |
292 | input.interface = iface; | 292 | input.interface = iface; |
293 | input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); | 293 | input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); |
294 | input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); | 294 | input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); |
295 | inputMethodList.append( input ); | 295 | inputMethodList.append( input ); |
296 | } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) { | 296 | } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) { |
297 | InputMethod input; | 297 | InputMethod input; |
298 | input.newIM = TRUE; | 298 | input.newIM = TRUE; |
299 | input.library = lib; | 299 | input.library = lib; |
300 | input.libName = *it; | 300 | input.libName = *it; |
301 | input.extInterface = eface; | 301 | input.extInterface = eface; |
302 | input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); | 302 | input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); |
303 | // may be either a simple, or advanced. | 303 | // may be either a simple, or advanced. |
304 | if (input.widget) { | 304 | if (input.widget) { |
305 | //odebug << "its a keyboard" << oendl; | 305 | //odebug << "its a keyboard" << oendl; |
306 | inputMethodList.append( input ); | 306 | inputMethodList.append( input ); |
307 | } else { | 307 | } else { |
308 | //odebug << "its a real im" << oendl; | 308 | //odebug << "its a real im" << oendl; |
309 | input.widget = input.extInterface->statusWidget( 0, 0 ); | 309 | input.widget = input.extInterface->statusWidget( 0, 0 ); |
310 | if (input.widget) { | 310 | if (input.widget) { |
311 | //odebug << "blah" << oendl; | 311 | //odebug << "blah" << oendl; |
312 | inputModifierList.append( input ); | 312 | inputModifierList.append( input ); |
313 | imButton->addWidget(input.widget, inputModifierList.count()); | 313 | imButton->addWidget(input.widget, inputModifierList.count()); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | }else{ | 316 | }else{ |
317 | delete lib; | 317 | delete lib; |
318 | lib = 0l; | 318 | lib = 0l; |
319 | } | 319 | } |
320 | installTranslator( (*it).left( (*it).find(".") ) ); | 320 | installTranslator( (*it).left( (*it).find(".") ) ); |
321 | } | 321 | } |
322 | qHeapSort( inputMethodList ); | 322 | qHeapSort( inputMethodList ); |
323 | #endif /* killed BUILT in cause they would not compile */ | 323 | #endif /* killed BUILT in cause they would not compile */ |
324 | 324 | ||
325 | QWSServer::setCurrentInputMethod( 0 ); | 325 | QWSServer::setCurrentInputMethod( 0 ); |
326 | 326 | ||
327 | /* set the prefered IM + handler */ | 327 | /* set the prefered IM + handler */ |
diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp index 092eb0c..19cf904 100644 --- a/core/launcher/irserver.cpp +++ b/core/launcher/irserver.cpp | |||
@@ -1,76 +1,76 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "irserver.h" | 21 | #include "irserver.h" |
22 | #include "obexinterface.h" | 22 | #include "obexinterface.h" |
23 | 23 | ||
24 | /* OPIE */ | 24 | /* OPIE */ |
25 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
26 | #include <qtopia/qlibrary.h> | 26 | #include <qtopia/qlibrary.h> |
27 | #include <qtopia/qpeapplication.h> | 27 | #include <qtopia/qpeapplication.h> |
28 | 28 | ||
29 | /* QT */ | 29 | /* QT */ |
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | 31 | ||
32 | IrServer::IrServer( QObject *parent, const char *name ) | 32 | IrServer::IrServer( QObject *parent, const char *name ) |
33 | : QObject( parent, name ), obexIface(0) | 33 | : QObject( parent, name ), obexIface(0) |
34 | { | 34 | { |
35 | lib = 0; | 35 | lib = 0; |
36 | obexIface = 0; | 36 | obexIface = 0; |
37 | QString path = QPEApplication::qpeDir() + "/plugins/obex/"; | 37 | QString path = QPEApplication::qpeDir() + "plugins/obex/"; |
38 | #ifdef Q_OS_MACX | 38 | #ifdef Q_OS_MACX |
39 | QDir dir( path, "lib*.dylib" ); | 39 | QDir dir( path, "lib*.dylib" ); |
40 | #else | 40 | #else |
41 | QDir dir( path, "lib*.so" ); | 41 | QDir dir( path, "lib*.so" ); |
42 | #endif /* Q_OS_MACX */ | 42 | #endif /* Q_OS_MACX */ |
43 | QStringList list = dir.entryList(); | 43 | QStringList list = dir.entryList(); |
44 | QStringList::Iterator it; | 44 | QStringList::Iterator it; |
45 | for ( it = list.begin(); it != list.end(); ++it ) { | 45 | for ( it = list.begin(); it != list.end(); ++it ) { |
46 | QLibrary *trylib = new QLibrary( path + *it ); | 46 | QLibrary *trylib = new QLibrary( path + *it ); |
47 | //odebug << "trying lib " << (path + (*it)) << "" << oendl; | 47 | //odebug << "trying lib " << (path + (*it)) << "" << oendl; |
48 | if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) { | 48 | if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) { |
49 | lib = trylib; | 49 | lib = trylib; |
50 | //odebug << "found obex lib" << oendl; | 50 | //odebug << "found obex lib" << oendl; |
51 | QString lang = getenv( "LANG" ); | 51 | QString lang = getenv( "LANG" ); |
52 | QTranslator * trans = new QTranslator(qApp); | 52 | QTranslator * trans = new QTranslator(qApp); |
53 | QString type = (*it).left( (*it).find(".") ); | 53 | QString type = (*it).left( (*it).find(".") ); |
54 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | 54 | QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm"; |
55 | //odebug << "tr fpr obex: " << tfn << "" << oendl; | 55 | //odebug << "tr fpr obex: " << tfn << "" << oendl; |
56 | if ( trans->load( tfn )) | 56 | if ( trans->load( tfn )) |
57 | qApp->installTranslator( trans ); | 57 | qApp->installTranslator( trans ); |
58 | else | 58 | else |
59 | delete trans; | 59 | delete trans; |
60 | 60 | ||
61 | break; | 61 | break; |
62 | } else { | 62 | } else { |
63 | delete lib; | 63 | delete lib; |
64 | } | 64 | } |
65 | } | 65 | } |
66 | if ( !lib ) | 66 | if ( !lib ) |
67 | odebug << "could not load IR plugin" << oendl; | 67 | odebug << "could not load IR plugin" << oendl; |
68 | } | 68 | } |
69 | 69 | ||
70 | IrServer::~IrServer() | 70 | IrServer::~IrServer() |
71 | { | 71 | { |
72 | if ( obexIface ) | 72 | if ( obexIface ) |
73 | obexIface->release(); | 73 | obexIface->release(); |
74 | delete lib; | 74 | delete lib; |
75 | } | 75 | } |
76 | 76 | ||
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp index f3a7651..66f665f 100644 --- a/core/launcher/startmenu.cpp +++ b/core/launcher/startmenu.cpp | |||
@@ -270,116 +270,116 @@ void StartMenu::launch() | |||
270 | 270 | ||
271 | 271 | ||
272 | 272 | ||
273 | 273 | ||
274 | static int compareAppletPositions(const void *b, const void *a) | 274 | static int compareAppletPositions(const void *b, const void *a) |
275 | { | 275 | { |
276 | const MenuApplet* aa = *(const MenuApplet**)a; | 276 | const MenuApplet* aa = *(const MenuApplet**)a; |
277 | const MenuApplet* ab = *(const MenuApplet**)b; | 277 | const MenuApplet* ab = *(const MenuApplet**)b; |
278 | int d = aa->iface->position() - ab->iface->position(); | 278 | int d = aa->iface->position() - ab->iface->position(); |
279 | if ( d ) return d; | 279 | if ( d ) return d; |
280 | return QString::compare(aa->library->library(),ab->library->library()); | 280 | return QString::compare(aa->library->library(),ab->library->library()); |
281 | } | 281 | } |
282 | 282 | ||
283 | void StartMenu::clearApplets() | 283 | void StartMenu::clearApplets() |
284 | { | 284 | { |
285 | if ( launchMenu ) | 285 | if ( launchMenu ) |
286 | launchMenu-> hide(); | 286 | launchMenu-> hide(); |
287 | 287 | ||
288 | for ( QIntDictIterator<MenuApplet> it( menuApplets ); it.current(); ++it ) { | 288 | for ( QIntDictIterator<MenuApplet> it( menuApplets ); it.current(); ++it ) { |
289 | MenuApplet *applet = it.current(); | 289 | MenuApplet *applet = it.current(); |
290 | if ( launchMenu ) { | 290 | if ( launchMenu ) { |
291 | launchMenu->removeItem( applet-> id ); | 291 | launchMenu->removeItem( applet-> id ); |
292 | delete applet->popup; | 292 | delete applet->popup; |
293 | } | 293 | } |
294 | 294 | ||
295 | applet->iface->release(); | 295 | applet->iface->release(); |
296 | applet->library->unload(); | 296 | applet->library->unload(); |
297 | delete applet-> library; | 297 | delete applet-> library; |
298 | } | 298 | } |
299 | menuApplets.clear(); | 299 | menuApplets.clear(); |
300 | } | 300 | } |
301 | 301 | ||
302 | 302 | ||
303 | 303 | ||
304 | 304 | ||
305 | void StartMenu::loadApplets() | 305 | void StartMenu::loadApplets() |
306 | { | 306 | { |
307 | Config cfg( "StartMenu" ); | 307 | Config cfg( "StartMenu" ); |
308 | cfg.setGroup( "Applets" ); | 308 | cfg.setGroup( "Applets" ); |
309 | 309 | ||
310 | // SafeMode causes too much problems, so we disable it for now -- | 310 | // SafeMode causes too much problems, so we disable it for now -- |
311 | // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 | 311 | // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 |
312 | // removed in the remerge PluginManager could handle it | 312 | // removed in the remerge PluginManager could handle it |
313 | // we don't currently use it -zecke | 313 | // we don't currently use it -zecke |
314 | 314 | ||
315 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); | 315 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); |
316 | 316 | ||
317 | QString lang = getenv( "LANG" ); | 317 | QString lang = getenv( "LANG" ); |
318 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; | 318 | QString path = QPEApplication::qpeDir() + "plugins/applets"; |
319 | QDir dir( path, "lib*.so" ); | 319 | QDir dir( path, "lib*.so" ); |
320 | QStringList list = dir.entryList(); | 320 | QStringList list = dir.entryList(); |
321 | QStringList::Iterator it; | 321 | QStringList::Iterator it; |
322 | int napplets = 0; | 322 | int napplets = 0; |
323 | MenuApplet* *xapplets = new MenuApplet*[list.count()]; | 323 | MenuApplet* *xapplets = new MenuApplet*[list.count()]; |
324 | for ( it = list.begin(); it != list.end(); ++it ) { | 324 | for ( it = list.begin(); it != list.end(); ++it ) { |
325 | if ( exclude.find( *it ) != exclude.end() ) | 325 | if ( exclude.find( *it ) != exclude.end() ) |
326 | continue; | 326 | continue; |
327 | MenuAppletInterface *iface = 0; | 327 | MenuAppletInterface *iface = 0; |
328 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 328 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
329 | if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { | 329 | if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { |
330 | MenuApplet *applet = new MenuApplet; | 330 | MenuApplet *applet = new MenuApplet; |
331 | xapplets[napplets++] = applet; | 331 | xapplets[napplets++] = applet; |
332 | applet->library = lib; | 332 | applet->library = lib; |
333 | applet->iface = iface; | 333 | applet->iface = iface; |
334 | 334 | ||
335 | QTranslator *trans = new QTranslator(qApp); | 335 | QTranslator *trans = new QTranslator(qApp); |
336 | QString type = (*it).left( (*it).find(".") ); | 336 | QString type = (*it).left( (*it).find(".") ); |
337 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | 337 | QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm"; |
338 | if ( trans->load( tfn )) | 338 | if ( trans->load( tfn )) |
339 | qApp->installTranslator( trans ); | 339 | qApp->installTranslator( trans ); |
340 | else | 340 | else |
341 | delete trans; | 341 | delete trans; |
342 | } else { | 342 | } else { |
343 | exclude += *it; | 343 | exclude += *it; |
344 | delete lib; | 344 | delete lib; |
345 | } | 345 | } |
346 | } | 346 | } |
347 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 347 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
348 | qsort(xapplets, napplets, sizeof(menuApplets[0]), compareAppletPositions); | 348 | qsort(xapplets, napplets, sizeof(menuApplets[0]), compareAppletPositions); |
349 | 349 | ||
350 | 350 | ||
351 | while ( napplets-- ) { | 351 | while ( napplets-- ) { |
352 | MenuApplet *applet = xapplets[napplets]; | 352 | MenuApplet *applet = xapplets[napplets]; |
353 | applet->popup = applet->iface->popup( this ); | 353 | applet->popup = applet->iface->popup( this ); |
354 | 354 | ||
355 | // menuApplets got an id < -1 | 355 | // menuApplets got an id < -1 |
356 | menuApplets.insert( -( currentItem + 2 ), new MenuApplet( *applet ) ); | 356 | menuApplets.insert( -( currentItem + 2 ), new MenuApplet( *applet ) ); |
357 | currentItem++; | 357 | currentItem++; |
358 | } | 358 | } |
359 | delete [] xapplets; | 359 | delete [] xapplets; |
360 | 360 | ||
361 | addApplets( launchMenu ); | 361 | addApplets( launchMenu ); |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | /* | 365 | /* |
366 | * Launcher calls loadMenu too often fix that | 366 | * Launcher calls loadMenu too often fix that |
367 | */ | 367 | */ |
368 | void StartMenu::addApplets(QPopupMenu* pop) { | 368 | void StartMenu::addApplets(QPopupMenu* pop) { |
369 | QIntDict<MenuApplet> dict; | 369 | QIntDict<MenuApplet> dict; |
370 | if( pop-> count ( )) | 370 | if( pop-> count ( )) |
371 | pop-> insertSeparator ( ); | 371 | pop-> insertSeparator ( ); |
372 | 372 | ||
373 | for ( QIntDictIterator<MenuApplet> it( menuApplets ); it.current(); ++it ) { | 373 | for ( QIntDictIterator<MenuApplet> it( menuApplets ); it.current(); ++it ) { |
374 | MenuApplet *applet = it.current(); | 374 | MenuApplet *applet = it.current(); |
375 | if ( applet->popup ) | 375 | if ( applet->popup ) |
376 | applet->id = pop->insertItem( applet->iface->icon(), | 376 | applet->id = pop->insertItem( applet->iface->icon(), |
377 | applet->iface->text(), applet->popup ); | 377 | applet->iface->text(), applet->popup ); |
378 | else | 378 | else |
379 | applet->id = pop->insertItem( applet->iface->icon(), | 379 | applet->id = pop->insertItem( applet->iface->icon(), |
380 | applet->iface->text() ); | 380 | applet->iface->text() ); |
381 | 381 | ||
382 | 382 | ||
383 | dict.insert( applet->id, new MenuApplet( *applet ) ); | 383 | dict.insert( applet->id, new MenuApplet( *applet ) ); |
384 | } | 384 | } |
385 | /* need to update the key */ | 385 | /* need to update the key */ |
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index 3c72d25..d0f1808 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp | |||
@@ -52,99 +52,99 @@ static int compareAppletPositions(const void *a, const void *b) | |||
52 | int d = ab->iface->position() - aa->iface->position(); | 52 | int d = ab->iface->position() - aa->iface->position(); |
53 | if ( d ) return d; | 53 | if ( d ) return d; |
54 | return QString::compare(ab->name,aa->name); | 54 | return QString::compare(ab->name,aa->name); |
55 | } | 55 | } |
56 | 56 | ||
57 | void SysTray::loadApplets() | 57 | void SysTray::loadApplets() |
58 | { | 58 | { |
59 | hide(); | 59 | hide(); |
60 | clearApplets(); | 60 | clearApplets(); |
61 | addApplets(); | 61 | addApplets(); |
62 | } | 62 | } |
63 | 63 | ||
64 | void SysTray::clearApplets() | 64 | void SysTray::clearApplets() |
65 | { | 65 | { |
66 | #ifndef QT_NO_COMPONENTS | 66 | #ifndef QT_NO_COMPONENTS |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * Note on clearing. SOme applets delete their | 69 | * Note on clearing. SOme applets delete their |
70 | * applets themselves some don't do it | 70 | * applets themselves some don't do it |
71 | * and on restart this can crash. If we delete it | 71 | * and on restart this can crash. If we delete it |
72 | * here we might end up in a double deletion. We could | 72 | * here we might end up in a double deletion. We could |
73 | * use QGuardedPtr but that would be one QOBject | 73 | * use QGuardedPtr but that would be one QOBject |
74 | * for every applet more but only useful for restart | 74 | * for every applet more but only useful for restart |
75 | */ | 75 | */ |
76 | QValueList<TaskbarApplet>::Iterator mit; | 76 | QValueList<TaskbarApplet>::Iterator mit; |
77 | for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { | 77 | for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { |
78 | (*mit).iface->release(); | 78 | (*mit).iface->release(); |
79 | (*mit).library->unload(); | 79 | (*mit).library->unload(); |
80 | delete (*mit).library; | 80 | delete (*mit).library; |
81 | } | 81 | } |
82 | 82 | ||
83 | #endif | 83 | #endif |
84 | appletList.clear(); | 84 | appletList.clear(); |
85 | if ( layout ) | 85 | if ( layout ) |
86 | delete layout; | 86 | delete layout; |
87 | layout = new QHBoxLayout( this, 0, 1 ); | 87 | layout = new QHBoxLayout( this, 0, 1 ); |
88 | layout->setAutoAdd(TRUE); | 88 | layout->setAutoAdd(TRUE); |
89 | } | 89 | } |
90 | 90 | ||
91 | void SysTray::addApplets() | 91 | void SysTray::addApplets() |
92 | { | 92 | { |
93 | hide(); | 93 | hide(); |
94 | #ifndef QT_NO_COMPONENTS | 94 | #ifndef QT_NO_COMPONENTS |
95 | Config cfg( "Taskbar" ); | 95 | Config cfg( "Taskbar" ); |
96 | cfg.setGroup( "Applets" ); | 96 | cfg.setGroup( "Applets" ); |
97 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); | 97 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); |
98 | 98 | ||
99 | QString lang = getenv( "LANG" ); | 99 | QString lang = getenv( "LANG" ); |
100 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; | 100 | QString path = QPEApplication::qpeDir() + "plugins/applets"; |
101 | #ifdef Q_OS_MACX | 101 | #ifdef Q_OS_MACX |
102 | QDir dir( path, "lib*.dylib" ); | 102 | QDir dir( path, "lib*.dylib" ); |
103 | #else | 103 | #else |
104 | QDir dir( path, "lib*.so" ); | 104 | QDir dir( path, "lib*.so" ); |
105 | #endif /* Q_OS_MACX */ | 105 | #endif /* Q_OS_MACX */ |
106 | QStringList list = dir.entryList(); | 106 | QStringList list = dir.entryList(); |
107 | QStringList::Iterator it; | 107 | QStringList::Iterator it; |
108 | int napplets=0; | 108 | int napplets=0; |
109 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; | 109 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; |
110 | for ( it = list.begin(); it != list.end(); ++it ) { | 110 | for ( it = list.begin(); it != list.end(); ++it ) { |
111 | if ( exclude.find( *it ) != exclude.end() ) | 111 | if ( exclude.find( *it ) != exclude.end() ) |
112 | continue; | 112 | continue; |
113 | owarn << "Found Applet: " << (*it) << "" << oendl; | 113 | owarn << "Found Applet: " << (*it) << "" << oendl; |
114 | TaskbarAppletInterface *iface = 0; | 114 | TaskbarAppletInterface *iface = 0; |
115 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 115 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
116 | if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { | 116 | if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { |
117 | TaskbarApplet *applet = new TaskbarApplet; | 117 | TaskbarApplet *applet = new TaskbarApplet; |
118 | applets[napplets++] = applet; | 118 | applets[napplets++] = applet; |
119 | applet->library = lib; | 119 | applet->library = lib; |
120 | applet->iface = iface; | 120 | applet->iface = iface; |
121 | 121 | ||
122 | QTranslator *trans = new QTranslator(qApp); | 122 | QTranslator *trans = new QTranslator(qApp); |
123 | QString type = (*it).left( (*it).find(".") ); | 123 | QString type = (*it).left( (*it).find(".") ); |
124 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | 124 | QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm"; |
125 | if ( trans->load( tfn )) | 125 | if ( trans->load( tfn )) |
126 | qApp->installTranslator( trans ); | 126 | qApp->installTranslator( trans ); |
127 | else | 127 | else |
128 | delete trans; | 128 | delete trans; |
129 | } else { | 129 | } else { |
130 | exclude += *it; | 130 | exclude += *it; |
131 | delete lib; | 131 | delete lib; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 134 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
135 | qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); | 135 | qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); |
136 | while (napplets--) { | 136 | while (napplets--) { |
137 | TaskbarApplet *applet = applets[napplets]; | 137 | TaskbarApplet *applet = applets[napplets]; |
138 | applet->applet = applet->iface->applet( this ); | 138 | applet->applet = applet->iface->applet( this ); |
139 | appletList.append(*applet); | 139 | appletList.append(*applet); |
140 | } | 140 | } |
141 | delete [] applets; | 141 | delete [] applets; |
142 | #else /* ## FIXME single app */ | 142 | #else /* ## FIXME single app */ |
143 | TaskbarApplet * const applet = new TaskbarApplet(); | 143 | TaskbarApplet * const applet = new TaskbarApplet(); |
144 | applet->iface = new ClockAppletImpl(); | 144 | applet->iface = new ClockAppletImpl(); |
145 | applet->applet = applet->iface->applet( this ); | 145 | applet->applet = applet->iface->applet( this ); |
146 | appletList.append( applet ); | 146 | appletList.append( applet ); |
147 | #endif | 147 | #endif |
148 | show(); | 148 | show(); |
149 | } | 149 | } |
150 | 150 | ||