author | zecke <zecke> | 2002-03-25 20:17:29 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-03-25 20:17:29 (UTC) |
commit | b001d834cd1259ea17fd1faf82111a1efdf607db (patch) (side-by-side diff) | |
tree | 35da1df30a27e18837d317d949db234015cfdf32 | |
parent | 56f2a47633046a7b08fe59acfe646a648c006230 (diff) | |
download | opie-b001d834cd1259ea17fd1faf82111a1efdf607db.zip opie-b001d834cd1259ea17fd1faf82111a1efdf607db.tar.gz opie-b001d834cd1259ea17fd1faf82111a1efdf607db.tar.bz2 |
- remove old Icons from the taskbar (only when you start a new app )
-rw-r--r-- | core/launcher/launcher.cpp | 2 | ||||
-rw-r--r-- | core/launcher/mrulist.cpp | 42 |
2 files changed, 38 insertions, 6 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index cf1a3c8..17a30e6 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -589,13 +589,13 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); docsFolder->appendFrom( *tmp ); delete tmp; } } } - } + } } m_timeStamp = newStamp; } void Launcher::updateTabs() { diff --git a/core/launcher/mrulist.cpp b/core/launcher/mrulist.cpp index 4daf7d2..6066dac 100644 --- a/core/launcher/mrulist.cpp +++ b/core/launcher/mrulist.cpp @@ -1,7 +1,8 @@ /********************************************************************** +** Copyright (C) 2002 Holger 'zecke' Freyther ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software @@ -68,26 +69,54 @@ void MRUList::addTask( const AppLnk *appLnk ) if ( !appLnk ) return; unsigned int i = 0; if ( !task ) return; - + // ok we wan't to delete old icons from the taskbar + // get the window list and see which windows aren't there any more + QList<AppLnk> cleanUp; + cleanUp.setAutoDelete( TRUE ); + const QList<QWSWindow> &list = qwsServer->clientWindows(); + QWSWindow* w; + bool running = false; // to see what we should do + for ( ; i < task->count(); i++ ) { + AppLnk *t = task->at(i); + running = false; + for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { + QString app = w->client()->identity(); + if( app == t->exec( ) ){ + running = true; + break; + } + } + if(!running ) { // gues what we do now + cleanUp.append( t); + } + } + // no do a clean up of these old icons + AppLnk *lnk; + for( lnk = cleanUp.first(); lnk != 0; lnk = cleanUp.next() ){ + task->remove( lnk ); + } + cleanUp.clear(); // should be deleted too + + i = 0; for ( ; i < task->count(); i++ ) { AppLnk *t = task->at(i); if ( t->exec() == appLnk->exec() ) { if (i != 0) { task->remove(); task->prepend( t ); } for (unsigned i = 0; i < MRUListWidgets->count(); i++ ) MRUListWidgets->at(i)->update(); return; } } - + // check which tasks are running and delete them from the list AppLnk *t = new AppLnk( *appLnk ); // DocLnks have an overloaded virtual function exec() t->setExec( appLnk->exec() ); task->prepend( t ); if ( task->count() > 6 ) { @@ -110,25 +139,28 @@ bool MRUList::quitOldApps() appsstarted.append(t->exec()); } const QList<QWSWindow> &list = qwsServer->clientWindows(); QWSWindow* w; for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { - QString app = w->client()->identity(); + QString app = w->client()->identity(); if ( appsstarted.contains(app) && !appsrunning.contains(app) ) appsrunning.append(app); } if ( appsrunning.count() > 1 ) { QStringList::ConstIterator it = appsrunning.begin(); ++it; // top stays running! for (; it != appsrunning.end(); it++) { for ( int i=task->count()-1; i>=0; --i ) { AppLnk *t = task->at(i); - if ( t->exec() == *it ) - Global::terminate(t); + if ( t->exec() == *it ){ + task->remove(i ); + delete t; + Global::terminate(t); + } } } return TRUE; } else { return FALSE; } |