-rw-r--r-- | core/launcher/startmenu.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp index 014418d..08ae885 100644 --- a/core/launcher/startmenu.cpp +++ b/core/launcher/startmenu.cpp | |||
@@ -211,97 +211,101 @@ void StartMenu::launch() | |||
211 | 211 | ||
212 | 212 | ||
213 | 213 | ||
214 | static int compareAppletPositions(const void *a, const void *b) | 214 | static int compareAppletPositions(const void *a, const void *b) |
215 | { | 215 | { |
216 | const MenuApplet* aa = *(const MenuApplet**)a; | 216 | const MenuApplet* aa = *(const MenuApplet**)a; |
217 | const MenuApplet* ab = *(const MenuApplet**)b; | 217 | const MenuApplet* ab = *(const MenuApplet**)b; |
218 | int d = aa->iface->position() - ab->iface->position(); | 218 | int d = aa->iface->position() - ab->iface->position(); |
219 | if ( d ) return d; | 219 | if ( d ) return d; |
220 | return QString::compare(aa->library->library(),ab->library->library()); | 220 | return QString::compare(aa->library->library(),ab->library->library()); |
221 | } | 221 | } |
222 | 222 | ||
223 | void StartMenu::clearApplets() | 223 | void StartMenu::clearApplets() |
224 | { | 224 | { |
225 | if (launchMenu ) | 225 | if (launchMenu ) |
226 | launchMenu-> hide(); | 226 | launchMenu-> hide(); |
227 | 227 | ||
228 | for ( QIntDictIterator<MenuApplet> it ( m_applets ); it. current ( ); ++it ) { | 228 | for ( QIntDictIterator<MenuApplet> it ( m_applets ); it. current ( ); ++it ) { |
229 | MenuApplet *applet = it. current ( ); | 229 | MenuApplet *applet = it. current ( ); |
230 | if ( launchMenu ) { | 230 | if ( launchMenu ) { |
231 | launchMenu-> removeItem ( applet-> id ); | 231 | launchMenu-> removeItem ( applet-> id ); |
232 | delete applet-> popup; | 232 | delete applet-> popup; |
233 | } | 233 | } |
234 | 234 | ||
235 | applet-> iface-> release(); | 235 | applet-> iface-> release(); |
236 | applet-> library-> unload(); | 236 | applet-> library-> unload(); |
237 | delete applet-> library; | 237 | delete applet-> library; |
238 | } | 238 | } |
239 | m_applets.clear(); | 239 | m_applets.clear(); |
240 | } | 240 | } |
241 | 241 | ||
242 | 242 | ||
243 | 243 | ||
244 | 244 | ||
245 | void StartMenu::loadApplets() | 245 | void StartMenu::loadApplets() |
246 | { | 246 | { |
247 | Config cfg( "StartMenu" ); | 247 | Config cfg( "StartMenu" ); |
248 | cfg.setGroup( "Applets" ); | 248 | cfg.setGroup( "Applets" ); |
249 | 249 | ||
250 | // SafeMode causes too much problems, so we disable it for now -- | 250 | // SafeMode causes too much problems, so we disable it for now -- |
251 | // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 | 251 | // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 |
252 | // removed in the remerge PluginManager could handle it | 252 | // removed in the remerge PluginManager could handle it |
253 | // we don't currently use it -zecke | 253 | // we don't currently use it -zecke |
254 | 254 | ||
255 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); | 255 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); |
256 | 256 | ||
257 | QString lang = getenv( "LANG" ); | 257 | QString lang = getenv( "LANG" ); |
258 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; | 258 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; |
259 | #ifdef Q_OS_MACX | ||
260 | QDir dir( path, "lib*.dylib" ); | ||
261 | #else | ||
259 | QDir dir( path, "lib*.so" ); | 262 | QDir dir( path, "lib*.so" ); |
263 | #endif /* Q_OS_MACX */ | ||
260 | QStringList list = dir.entryList(); | 264 | QStringList list = dir.entryList(); |
261 | QStringList::Iterator it; | 265 | QStringList::Iterator it; |
262 | int napplets=0; | 266 | int napplets=0; |
263 | MenuApplet* *xapplets = new MenuApplet*[list.count()]; | 267 | MenuApplet* *xapplets = new MenuApplet*[list.count()]; |
264 | for ( it = list.begin(); it != list.end(); ++it ) { | 268 | for ( it = list.begin(); it != list.end(); ++it ) { |
265 | if ( exclude.find( *it ) != exclude.end() ) | 269 | if ( exclude.find( *it ) != exclude.end() ) |
266 | continue; | 270 | continue; |
267 | MenuAppletInterface *iface = 0; | 271 | MenuAppletInterface *iface = 0; |
268 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 272 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
269 | if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { | 273 | if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { |
270 | MenuApplet *applet = new MenuApplet; | 274 | MenuApplet *applet = new MenuApplet; |
271 | xapplets[napplets++] = applet; | 275 | xapplets[napplets++] = applet; |
272 | applet->library = lib; | 276 | applet->library = lib; |
273 | applet->iface = iface; | 277 | applet->iface = iface; |
274 | 278 | ||
275 | QTranslator *trans = new QTranslator(qApp); | 279 | QTranslator *trans = new QTranslator(qApp); |
276 | QString type = (*it).left( (*it).find(".") ); | 280 | QString type = (*it).left( (*it).find(".") ); |
277 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | 281 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; |
278 | if ( trans->load( tfn )) | 282 | if ( trans->load( tfn )) |
279 | qApp->installTranslator( trans ); | 283 | qApp->installTranslator( trans ); |
280 | else | 284 | else |
281 | delete trans; | 285 | delete trans; |
282 | } else { | 286 | } else { |
283 | exclude += *it; | 287 | exclude += *it; |
284 | delete lib; | 288 | delete lib; |
285 | } | 289 | } |
286 | } | 290 | } |
287 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 291 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
288 | qsort(xapplets,napplets,sizeof(m_applets[0]),compareAppletPositions); | 292 | qsort(xapplets,napplets,sizeof(m_applets[0]),compareAppletPositions); |
289 | 293 | ||
290 | 294 | ||
291 | int foo = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0; | 295 | int foo = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0; |
292 | 296 | ||
293 | while (napplets--) { | 297 | while (napplets--) { |
294 | MenuApplet *applet = xapplets[napplets]; | 298 | MenuApplet *applet = xapplets[napplets]; |
295 | 299 | ||
296 | applet-> popup = applet-> iface-> popup ( this ); | 300 | applet-> popup = applet-> iface-> popup ( this ); |
297 | 301 | ||
298 | if ( applet-> popup ) | 302 | if ( applet-> popup ) |
299 | applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup ); | 303 | applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup ); |
300 | else | 304 | else |
301 | applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); | 305 | applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); |
302 | 306 | ||
303 | 307 | ||
304 | m_applets.insert ( applet-> id, new MenuApplet(*applet)); | 308 | m_applets.insert ( applet-> id, new MenuApplet(*applet)); |
305 | } | 309 | } |
306 | delete [] xapplets; | 310 | delete [] xapplets; |
307 | 311 | ||