summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/opie-taskbar.control2
-rw-r--r--core/launcher/startmenu.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/core/launcher/opie-taskbar.control b/core/launcher/opie-taskbar.control
index 8b88ec6..13e5715 100644
--- a/core/launcher/opie-taskbar.control
+++ b/core/launcher/opie-taskbar.control
@@ -1,9 +1,9 @@
1Files: bin/qpe apps/Settings/Calibrate.desktop pics/launcher plugins/applets/libsuspendapplet.so* plugins/applets/libhomeapplet.so* 1Files: bin/qpe apps/Settings/Calibrate.desktop pics/launcher plugins/applets/libsuspendapplet.so* plugins/applets/libhomeapplet.so* plugins/applets/liblogoutapplet.so*
2Priority: required 2Priority: required
3Section: opie/system 3Section: opie/system
4Maintainer: Project Opie <opie@handhelds.org> 4Maintainer: Project Opie <opie@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION.1 6Version: $QPE_VERSION-$SUB_VERSION.1
7Depends: qt-embedded (>=$QTE_VERSION) 7Depends: qt-embedded (>=$QTE_VERSION)
8Description: Launcher for Opie 8Description: Launcher for Opie
9 The "finder" or "explorer", or whatever you want to call it. 9 The "finder" or "explorer", or whatever you want to call it.
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index 647d0f2..917f4c1 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -147,239 +147,239 @@ void StartMenu::reloadApplets()
147 clearApplets ( ); 147 clearApplets ( );
148 loadApplets ( ); 148 loadApplets ( );
149 } 149 }
150 else 150 else
151 createMenu ( ); 151 createMenu ( );
152} 152}
153 153
154void StartMenu::itemSelected( int id ) 154void StartMenu::itemSelected( int id )
155{ 155{
156 const AppLnk *app = apps->find( id ); 156 const AppLnk *app = apps->find( id );
157 if ( app ) 157 if ( app )
158 app->execute(); 158 app->execute();
159 else { 159 else {
160 MenuApplet *applet = applets. find ( id ); 160 MenuApplet *applet = applets. find ( id );
161 161
162 if ( applet ) 162 if ( applet )
163 applet-> iface-> activated ( ); 163 applet-> iface-> activated ( );
164 } 164 }
165} 165}
166 166
167bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) 167bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu )
168{ 168{
169 bool result = FALSE; 169 bool result = FALSE;
170 170
171 Config cfg("StartMenu"); 171 Config cfg("StartMenu");
172 cfg.setGroup("Menu"); 172 cfg.setGroup("Menu");
173 173
174 bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); 174 bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE);
175 bool lot = cfg.readBoolEntry("LauncherOther",TRUE); 175 bool lot = cfg.readBoolEntry("LauncherOther",TRUE);
176 176
177 tabdict. clear ( ); 177 tabdict. clear ( );
178 178
179 if ( sepId ) 179 if ( sepId )
180 menu-> removeItem ( sepId ); 180 menu-> removeItem ( sepId );
181 sepId = ( menu-> count ( )) ? menu-> insertSeparator ( 0 ) : 0; 181 sepId = ( menu-> count ( )) ? menu-> insertSeparator ( 0 ) : 0;
182 182
183 if ( ltabs || lot ) { 183 if ( ltabs || lot ) {
184 QDict<QPopupMenu> typpop; 184 QDict<QPopupMenu> typpop;
185 QStringList typs = folder->types(); 185 QStringList typs = folder->types();
186 for (QStringList::Iterator tit=typs.fromLast(); ; --tit) { 186 for (QStringList::Iterator tit=typs.fromLast(); ; --tit) {
187 if ( !(*tit).isEmpty() ) { 187 if ( !(*tit).isEmpty() ) {
188 QPopupMenu *new_menu; 188 QPopupMenu *new_menu;
189 if ( ltabs ) { 189 if ( ltabs ) {
190 new_menu = new StartPopupMenu( menu ); 190 new_menu = new StartPopupMenu( menu );
191 connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); 191 connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) );
192 int id = menu->insertItem( folder->typePixmap(*tit), folder->typeName(*tit), new_menu, -1, 0 ); 192 int id = menu->insertItem( folder->typePixmap(*tit), folder->typeName(*tit), new_menu, -1, 0 );
193 tabdict. insert ( id, new_menu ); 193 tabdict. insert ( id, new_menu );
194 } else { 194 } else {
195 new_menu = (QPopupMenu*)1; 195 new_menu = (QPopupMenu*)1;
196 } 196 }
197 typpop.insert(*tit, new_menu); 197 typpop.insert(*tit, new_menu);
198 } 198 }
199 if ( tit == typs. begin ( )) 199 if ( tit == typs. begin ( ))
200 break; 200 break;
201 } 201 }
202 QListIterator<AppLnk> it( folder->children() ); 202 QListIterator<AppLnk> it( folder->children() );
203 bool f=TRUE; 203 bool f=TRUE;
204 for ( ; it.current(); ++it ) { 204 for ( ; it.current(); ++it ) {
205 AppLnk *app = it.current(); 205 AppLnk *app = it.current();
206 if ( app->type() == "Separator" ) { // No tr 206 if ( app->type() == "Separator" ) { // No tr
207 if ( lot ) { 207 if ( lot ) {
208 menu->insertSeparator(); 208 menu->insertSeparator();
209 } 209 }
210 } else { 210 } else {
211 f = FALSE; 211 f = FALSE;
212 QString t = app->type(); 212 QString t = app->type();
213 QPopupMenu* pmenu = typpop.find(t); 213 QPopupMenu* pmenu = typpop.find(t);
214 if ( ltabs ) { 214 if ( ltabs ) {
215 if ( !pmenu && lot ) 215 if ( !pmenu && lot )
216 pmenu = menu; 216 pmenu = menu;
217 } else { 217 } else {
218 if ( !pmenu ) 218 if ( !pmenu )
219 pmenu = menu; 219 pmenu = menu;
220 else 220 else
221 pmenu = 0; 221 pmenu = 0;
222 } 222 }
223 if ( pmenu ) { 223 if ( pmenu ) {
224 QString t = app->name(); 224 QString t = app->name();
225 t.replace(QRegExp("&"),"&&"); // escape shortcut character 225 t.replace(QRegExp("&"),"&&"); // escape shortcut character
226 pmenu->insertItem( app->pixmap(), t, app->id() ); 226 pmenu->insertItem( app->pixmap(), t, app->id() );
227 } 227 }
228 result=TRUE; 228 result=TRUE;
229 } 229 }
230 } 230 }
231 } 231 }
232 232
233 if ( sepId && ( menu-> idAt ( 0 ) == sepId )) { // no tabs entries 233 if ( sepId && ( menu-> idAt ( 0 ) == sepId )) { // no tabs entries
234 menu-> removeItem ( sepId ); 234 menu-> removeItem ( sepId );
235 sepId = 0; 235 sepId = 0;
236 } 236 }
237 if ( !menu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later 237 if ( !menu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later
238 sepId = menu-> insertSeparator ( ); 238 sepId = menu-> insertSeparator ( );
239 239
240 return result; 240 return result;
241} 241}
242 242
243 243
244void StartMenu::launch() 244void StartMenu::launch()
245{ 245{
246 int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); 246 int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height();
247 247
248 if ( launchMenu->isVisible() ) 248 if ( launchMenu->isVisible() )
249 launchMenu->hide(); 249 launchMenu->hide();
250 else 250 else
251 launchMenu->popup( QPoint( 1, y ) ); 251 launchMenu->popup( QPoint( 1, y ) );
252} 252}
253 253
254const AppLnk* StartMenu::execToLink(const QString& appname) 254const AppLnk* StartMenu::execToLink(const QString& appname)
255{ 255{
256 const AppLnk* a = apps->findExec( appname ); 256 const AppLnk* a = apps->findExec( appname );
257 return a; 257 return a;
258} 258}
259 259
260void StartPopupMenu::keyPressEvent( QKeyEvent *e ) 260void StartPopupMenu::keyPressEvent( QKeyEvent *e )
261{ 261{
262 if ( e->key() == Key_F33 || e->key() == Key_Space ) { 262 if ( e->key() == Key_F33 || e->key() == Key_Space ) {
263 // "OK" button, little hacky 263 // "OK" button, little hacky
264 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); 264 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0);
265 QPopupMenu::keyPressEvent( &ke ); 265 QPopupMenu::keyPressEvent( &ke );
266 } else { 266 } else {
267 QPopupMenu::keyPressEvent( e ); 267 QPopupMenu::keyPressEvent( e );
268 } 268 }
269} 269}
270 270
271static int compareAppletPositions(const void *a, const void *b) 271static int compareAppletPositions(const void *a, const void *b)
272{ 272{
273 const MenuApplet* aa = *(const MenuApplet**)a; 273 const MenuApplet* aa = *(const MenuApplet**)a;
274 const MenuApplet* ab = *(const MenuApplet**)b; 274 const MenuApplet* ab = *(const MenuApplet**)b;
275 int d = ab->iface->position() - aa->iface->position(); 275 int d = aa->iface->position() - ab->iface->position();
276 if ( d ) return d; 276 if ( d ) return d;
277 return QString::compare(ab->library->library(),aa->library->library()); 277 return QString::compare(aa->library->library(),ab->library->library());
278} 278}
279 279
280void StartMenu::clearApplets() 280void StartMenu::clearApplets()
281{ 281{
282 launchMenu-> hide(); 282 launchMenu-> hide();
283 283
284 for ( QIntDictIterator<MenuApplet> it ( applets ); it. current ( ); ++it ) { 284 for ( QIntDictIterator<MenuApplet> it ( applets ); it. current ( ); ++it ) {
285 MenuApplet *applet = it. current ( ); 285 MenuApplet *applet = it. current ( );
286 if ( launchMenu ) { 286 if ( launchMenu ) {
287 launchMenu-> removeItem ( applet-> id ); 287 launchMenu-> removeItem ( applet-> id );
288 delete applet-> popup; 288 delete applet-> popup;
289 } 289 }
290 290
291 applet-> iface-> release(); 291 applet-> iface-> release();
292 applet-> library-> unload(); 292 applet-> library-> unload();
293 delete applet-> library; 293 delete applet-> library;
294 } 294 }
295 applets.clear(); 295 applets.clear();
296} 296}
297 297
298 298
299 299
300void StartMenu::loadApplets() 300void StartMenu::loadApplets()
301{ 301{
302 Config cfg( "StartMenu" ); 302 Config cfg( "StartMenu" );
303 cfg.setGroup( "Applets" ); 303 cfg.setGroup( "Applets" );
304 304
305 // SafeMode causes too much problems, so we disable it for now -- 305 // SafeMode causes too much problems, so we disable it for now --
306 // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 306 // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02
307 307
308 bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE); 308 bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE);
309 if ( safe && !safety_tid ) 309 if ( safe && !safety_tid )
310 return; 310 return;
311 cfg.writeEntry("SafeMode",TRUE); 311 cfg.writeEntry("SafeMode",TRUE);
312 cfg.write(); 312 cfg.write();
313 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); 313 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
314 314
315 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 315 QString path = QPEApplication::qpeDir() + "/plugins/applets";
316 QDir dir( path, "lib*.so" ); 316 QDir dir( path, "lib*.so" );
317 QStringList list = dir.entryList(); 317 QStringList list = dir.entryList();
318 QStringList::Iterator it; 318 QStringList::Iterator it;
319 int napplets=0; 319 int napplets=0;
320 MenuApplet* *xapplets = new MenuApplet*[list.count()]; 320 MenuApplet* *xapplets = new MenuApplet*[list.count()];
321 for ( it = list.begin(); it != list.end(); ++it ) { 321 for ( it = list.begin(); it != list.end(); ++it ) {
322 if ( exclude.find( *it ) != exclude.end() ) 322 if ( exclude.find( *it ) != exclude.end() )
323 continue; 323 continue;
324 MenuAppletInterface *iface = 0; 324 MenuAppletInterface *iface = 0;
325 QLibrary *lib = new QLibrary( path + "/" + *it ); 325 QLibrary *lib = new QLibrary( path + "/" + *it );
326 if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { 326 if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
327 MenuApplet *applet = new MenuApplet; 327 MenuApplet *applet = new MenuApplet;
328 xapplets[napplets++] = applet; 328 xapplets[napplets++] = applet;
329 applet->library = lib; 329 applet->library = lib;
330 applet->iface = iface; 330 applet->iface = iface;
331 } else { 331 } else {
332 exclude += *it; 332 exclude += *it;
333 delete lib; 333 delete lib;
334 } 334 }
335 } 335 }
336 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 336 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
337 qsort(xapplets,napplets,sizeof(applets[0]),compareAppletPositions); 337 qsort(xapplets,napplets,sizeof(applets[0]),compareAppletPositions);
338 338
339 if ( sepId ) 339 if ( sepId )
340 launchMenu-> removeItem ( sepId ); 340 launchMenu-> removeItem ( sepId );
341 sepId = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0; 341 sepId = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0;
342 342
343 while (napplets--) { 343 while (napplets--) {
344 MenuApplet *applet = xapplets[napplets]; 344 MenuApplet *applet = xapplets[napplets];
345 QString lang = getenv( "LANG" ); 345 QString lang = getenv( "LANG" );
346 QTranslator * trans = new QTranslator(qApp); 346 QTranslator * trans = new QTranslator(qApp);
347 QString type = (*it).left( (*it).find(".") ); 347 QString type = (*it).left( (*it).find(".") );
348 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 348 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
349 if ( trans->load( tfn )) 349 if ( trans->load( tfn ))
350 qApp->installTranslator( trans ); 350 qApp->installTranslator( trans );
351 else 351 else
352 delete trans; 352 delete trans;
353 353
354 applet-> popup = applet-> iface-> popup ( this ); 354 applet-> popup = applet-> iface-> popup ( this );
355 355
356 if ( applet-> popup ) 356 if ( applet-> popup )
357 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup ); 357 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup );
358 else 358 else
359 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); 359 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) );
360 applets.insert ( applet-> id, new MenuApplet(*applet)); 360 applets.insert ( applet-> id, new MenuApplet(*applet));
361 } 361 }
362 delete xapplets; 362 delete xapplets;
363 363
364 if ( sepId && ( launchMenu-> idAt ( launchMenu-> count ( ) - 1 ) == sepId )) { // no applets 364 if ( sepId && ( launchMenu-> idAt ( launchMenu-> count ( ) - 1 ) == sepId )) { // no applets
365 launchMenu-> removeItem ( sepId ); 365 launchMenu-> removeItem ( sepId );
366 sepId = 0; 366 sepId = 0;
367 } 367 }
368 if ( !launchMenu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later 368 if ( !launchMenu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later
369 sepId = launchMenu-> insertSeparator ( ); 369 sepId = launchMenu-> insertSeparator ( );
370 370
371 if ( !safety_tid ) 371 if ( !safety_tid )
372 safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman) 372 safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman)
373} 373}
374 374
375void StartMenu::timerEvent(QTimerEvent* e) 375void StartMenu::timerEvent(QTimerEvent* e)
376{ 376{
377 if ( e->timerId() == safety_tid ) { 377 if ( e->timerId() == safety_tid ) {
378 Config cfg( "StartMenu" ); 378 Config cfg( "StartMenu" );
379 cfg.setGroup( "Applets" ); 379 cfg.setGroup( "Applets" );
380 cfg.writeEntry( "SafeMode", FALSE ); 380 cfg.writeEntry( "SafeMode", FALSE );
381 killTimer(safety_tid); 381 killTimer(safety_tid);
382 safety_tid = 0; 382 safety_tid = 0;
383 } 383 }
384} 384}
385 385