summaryrefslogtreecommitdiff
path: root/core/launcher/mrulist.cpp
Unidiff
Diffstat (limited to 'core/launcher/mrulist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/mrulist.cpp46
1 files changed, 19 insertions, 27 deletions
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
@@ -54,60 +54,52 @@ MRUList::~MRUList()
54 if (MRUListWidgets) 54 if (MRUListWidgets)
55 MRUListWidgets->remove( this ); 55 MRUListWidgets->remove( this );
56 if (task) 56 if (task)
57 task->setAutoDelete( TRUE ); 57 task->setAutoDelete( TRUE );
58} 58}
59 59
60 60
61QSize MRUList::sizeHint() const 61QSize MRUList::sizeHint() const
62{ 62{
63 return QSize( frameWidth(), 16 ); 63 return QSize( frameWidth(), 16 );
64} 64}
65 65
66// thanks to John from Trolltech
67void MRUList::removeTask(const QString &appName )
68{
69 qWarning("MRULList::removeTask( %s)", appName.latin1() );
70 if(appName.isEmpty() )
71 return;
72
73 if(!task ) // at least it should be called once before
74 return;
75 unsigned int i= 0;
76 for ( ; i < task->count(); i++ ) {
77 AppLnk *t = task->at(i);
78 if ( t->exec() == appName )
79 task->remove();
80 }
81 for (unsigned i = 0; i < MRUListWidgets->count(); i++ )
82 MRUListWidgets->at(i)->update();
83}
66 84
67void MRUList::addTask( const AppLnk *appLnk ) 85void MRUList::addTask( const AppLnk *appLnk )
68{ 86{
87 qWarning("Add Task" );
69 if ( !appLnk ) 88 if ( !appLnk )
70 return; 89 return;
71 unsigned int i = 0; 90 unsigned int i = 0;
72 91
73 if ( !task ) 92 if ( !task )
74 return; 93 return;
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 94
103 i = 0; 95 i = 0;
104 for ( ; i < task->count(); i++ ) { 96 for ( ; i < task->count(); i++ ) {
105 AppLnk *t = task->at(i); 97 AppLnk *t = task->at(i);
106 if ( t->exec() == appLnk->exec() ) { 98 if ( t->exec() == appLnk->exec() ) {
107 if (i != 0) { 99 if (i != 0) {
108 task->remove(); 100 task->remove();
109 task->prepend( t ); 101 task->prepend( t );
110 } 102 }
111 for (unsigned i = 0; i < MRUListWidgets->count(); i++ ) 103 for (unsigned i = 0; i < MRUListWidgets->count(); i++ )
112 MRUListWidgets->at(i)->update(); 104 MRUListWidgets->at(i)->update();
113 return; 105 return;