summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-04-03 08:12:17 (UTC)
committer harlekin <harlekin>2002-04-03 08:12:17 (UTC)
commit48f7cbcb23cfd4daff6218d8902e0049af674b9f (patch) (side-by-side diff)
tree49cbc6aa015290a143ff3c0652de906ad3c8fc71
parent14acfe3608e8c57e5cacb08daed8944946e03d42 (diff)
downloadopie-48f7cbcb23cfd4daff6218d8902e0049af674b9f.zip
opie-48f7cbcb23cfd4daff6218d8902e0049af674b9f.tar.gz
opie-48f7cbcb23cfd4daff6218d8902e0049af674b9f.tar.bz2
changed MRUlist to a taskbar, only running apps are shown
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcher.cpp7
-rw-r--r--core/launcher/mrulist.cpp46
-rw-r--r--core/launcher/mrulist.h1
3 files changed, 26 insertions, 28 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 17a30e6..1449269 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -679,9 +679,14 @@ void Launcher::updateLink(const QString& link)
void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
{
QDataStream stream( data, IO_ReadOnly );
- if ( msg == "linkChanged(QString)" ) {
+ if ( msg == "closing(QString)" ){
+ QString app;
+ stream >> app;
+ qWarning("app closed %s", app.latin1() );
+ MRUList::removeTask( app );
+ }else if ( msg == "linkChanged(QString)" ) {
QString link;
stream >> link;
if ( in_lnk_props ) {
got_lnk_change = TRUE;
diff --git a/core/launcher/mrulist.cpp b/core/launcher/mrulist.cpp
index 6066dac..5590d38 100644
--- a/core/launcher/mrulist.cpp
+++ b/core/launcher/mrulist.cpp
@@ -62,44 +62,36 @@ QSize MRUList::sizeHint() const
{
return QSize( frameWidth(), 16 );
}
+// thanks to John from Trolltech
+void MRUList::removeTask(const QString &appName )
+{
+ qWarning("MRULList::removeTask( %s)", appName.latin1() );
+ if(appName.isEmpty() )
+ return;
+
+ if(!task ) // at least it should be called once before
+ return;
+ unsigned int i= 0;
+ for ( ; i < task->count(); i++ ) {
+ AppLnk *t = task->at(i);
+ if ( t->exec() == appName )
+ task->remove();
+ }
+ for (unsigned i = 0; i < MRUListWidgets->count(); i++ )
+ MRUListWidgets->at(i)->update();
+}
void MRUList::addTask( const AppLnk *appLnk )
{
+ qWarning("Add Task" );
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);
diff --git a/core/launcher/mrulist.h b/core/launcher/mrulist.h
index 141a09b..ff111ce 100644
--- a/core/launcher/mrulist.h
+++ b/core/launcher/mrulist.h
@@ -35,8 +35,9 @@ public:
MRUList( QWidget *parent );
~MRUList();
virtual QSize sizeHint() const;
static void addTask( const AppLnk *appLnk );
+ static void removeTask(const QString &appName );
bool quitOldApps();
protected:
void mousePressEvent(QMouseEvent *e);