author | zecke <zecke> | 2002-03-25 20:17:29 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-03-25 20:17:29 (UTC) |
commit | b001d834cd1259ea17fd1faf82111a1efdf607db (patch) (unidiff) | |
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 | |||
@@ -592,7 +592,7 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
592 | } | 592 | } |
593 | } | 593 | } |
594 | } | 594 | } |
595 | } | 595 | } |
596 | } | 596 | } |
597 | m_timeStamp = newStamp; | 597 | m_timeStamp = newStamp; |
598 | } | 598 | } |
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,4 +1,5 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Holger 'zecke' Freyther | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 4 | ** |
4 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
@@ -71,7 +72,35 @@ void MRUList::addTask( const AppLnk *appLnk ) | |||
71 | 72 | ||
72 | if ( !task ) | 73 | if ( !task ) |
73 | return; | 74 | return; |
74 | 75 | // ok we wan't to delete old icons from the taskbar | |
76 | // get the window list and see which windows aren't there any more | ||
77 | QList<AppLnk> cleanUp; | ||
78 | cleanUp.setAutoDelete( TRUE ); | ||
79 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | ||
80 | QWSWindow* w; | ||
81 | bool running = false; // to see what we should do | ||
82 | for ( ; i < task->count(); i++ ) { | ||
83 | AppLnk *t = task->at(i); | ||
84 | running = false; | ||
85 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | ||
86 | QString app = w->client()->identity(); | ||
87 | if( app == t->exec( ) ){ | ||
88 | running = true; | ||
89 | break; | ||
90 | } | ||
91 | } | ||
92 | if(!running ) { // gues what we do now | ||
93 | cleanUp.append( t); | ||
94 | } | ||
95 | } | ||
96 | // no do a clean up of these old icons | ||
97 | AppLnk *lnk; | ||
98 | for( lnk = cleanUp.first(); lnk != 0; lnk = cleanUp.next() ){ | ||
99 | task->remove( lnk ); | ||
100 | } | ||
101 | cleanUp.clear(); // should be deleted too | ||
102 | |||
103 | i = 0; | ||
75 | for ( ; i < task->count(); i++ ) { | 104 | for ( ; i < task->count(); i++ ) { |
76 | AppLnk *t = task->at(i); | 105 | AppLnk *t = task->at(i); |
77 | if ( t->exec() == appLnk->exec() ) { | 106 | if ( t->exec() == appLnk->exec() ) { |
@@ -84,7 +113,7 @@ void MRUList::addTask( const AppLnk *appLnk ) | |||
84 | return; | 113 | return; |
85 | } | 114 | } |
86 | } | 115 | } |
87 | 116 | // check which tasks are running and delete them from the list | |
88 | AppLnk *t = new AppLnk( *appLnk ); | 117 | AppLnk *t = new AppLnk( *appLnk ); |
89 | // DocLnks have an overloaded virtual function exec() | 118 | // DocLnks have an overloaded virtual function exec() |
90 | t->setExec( appLnk->exec() ); | 119 | t->setExec( appLnk->exec() ); |
@@ -113,7 +142,7 @@ bool MRUList::quitOldApps() | |||
113 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 142 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
114 | QWSWindow* w; | 143 | QWSWindow* w; |
115 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 144 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
116 | QString app = w->client()->identity(); | 145 | QString app = w->client()->identity(); |
117 | if ( appsstarted.contains(app) && !appsrunning.contains(app) ) | 146 | if ( appsstarted.contains(app) && !appsrunning.contains(app) ) |
118 | appsrunning.append(app); | 147 | appsrunning.append(app); |
119 | } | 148 | } |
@@ -124,8 +153,11 @@ bool MRUList::quitOldApps() | |||
124 | for (; it != appsrunning.end(); it++) { | 153 | for (; it != appsrunning.end(); it++) { |
125 | for ( int i=task->count()-1; i>=0; --i ) { | 154 | for ( int i=task->count()-1; i>=0; --i ) { |
126 | AppLnk *t = task->at(i); | 155 | AppLnk *t = task->at(i); |
127 | if ( t->exec() == *it ) | 156 | if ( t->exec() == *it ){ |
128 | Global::terminate(t); | 157 | task->remove(i ); |
158 | delete t; | ||
159 | Global::terminate(t); | ||
160 | } | ||
129 | } | 161 | } |
130 | } | 162 | } |
131 | return TRUE; | 163 | return TRUE; |