-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 | |||
@@ -583,25 +583,25 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
583 | }else{ // we checked | 583 | }else{ // we checked |
584 | // do something different see what we need to do | 584 | // do something different see what we need to do |
585 | // let's see if we should check the device | 585 | // let's see if we should check the device |
586 | cfg.setGroup("main" ); | 586 | cfg.setGroup("main" ); |
587 | bool check = cfg.readBoolEntry("autocheck", true ); | 587 | bool check = cfg.readBoolEntry("autocheck", true ); |
588 | if( check ){ // find the documents | 588 | if( check ){ // find the documents |
589 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); | 589 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); |
590 | docsFolder->appendFrom( *tmp ); | 590 | docsFolder->appendFrom( *tmp ); |
591 | delete tmp; | 591 | delete tmp; |
592 | } | 592 | } |
593 | } | 593 | } |
594 | } | 594 | } |
595 | } | 595 | } |
596 | } | 596 | } |
597 | m_timeStamp = newStamp; | 597 | m_timeStamp = newStamp; |
598 | } | 598 | } |
599 | 599 | ||
600 | void Launcher::updateTabs() | 600 | void Launcher::updateTabs() |
601 | { | 601 | { |
602 | MimeType::updateApplications(); // ### reads all applnks twice | 602 | MimeType::updateApplications(); // ### reads all applnks twice |
603 | 603 | ||
604 | delete rootFolder; | 604 | delete rootFolder; |
605 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); | 605 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); |
606 | 606 | ||
607 | loadDocs(); | 607 | loadDocs(); |
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,13 +1,14 @@ | |||
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. |
5 | ** | 6 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 10 | ** packaging of this file. |
10 | ** | 11 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 14 | ** |
@@ -62,38 +63,66 @@ QSize MRUList::sizeHint() const | |||
62 | return QSize( frameWidth(), 16 ); | 63 | return QSize( frameWidth(), 16 ); |
63 | } | 64 | } |
64 | 65 | ||
65 | 66 | ||
66 | void MRUList::addTask( const AppLnk *appLnk ) | 67 | void MRUList::addTask( const AppLnk *appLnk ) |
67 | { | 68 | { |
68 | if ( !appLnk ) | 69 | if ( !appLnk ) |
69 | return; | 70 | return; |
70 | unsigned int i = 0; | 71 | unsigned int i = 0; |
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() ) { |
78 | if (i != 0) { | 107 | if (i != 0) { |
79 | task->remove(); | 108 | task->remove(); |
80 | task->prepend( t ); | 109 | task->prepend( t ); |
81 | } | 110 | } |
82 | for (unsigned i = 0; i < MRUListWidgets->count(); i++ ) | 111 | for (unsigned i = 0; i < MRUListWidgets->count(); i++ ) |
83 | MRUListWidgets->at(i)->update(); | 112 | MRUListWidgets->at(i)->update(); |
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() ); |
91 | task->prepend( t ); | 120 | task->prepend( t ); |
92 | 121 | ||
93 | if ( task->count() > 6 ) { | 122 | if ( task->count() > 6 ) { |
94 | t = task->last(); | 123 | t = task->last(); |
95 | task->remove(); | 124 | task->remove(); |
96 | Global::terminate(t); | 125 | Global::terminate(t); |
97 | delete t; | 126 | delete t; |
98 | } | 127 | } |
99 | 128 | ||
@@ -104,37 +133,40 @@ void MRUList::addTask( const AppLnk *appLnk ) | |||
104 | bool MRUList::quitOldApps() | 133 | bool MRUList::quitOldApps() |
105 | { | 134 | { |
106 | QStringList appsstarted; | 135 | QStringList appsstarted; |
107 | QStringList appsrunning; | 136 | QStringList appsrunning; |
108 | for ( int i=task->count()-1; i>=0; --i ) { | 137 | for ( int i=task->count()-1; i>=0; --i ) { |
109 | AppLnk *t = task->at(i); | 138 | AppLnk *t = task->at(i); |
110 | appsstarted.append(t->exec()); | 139 | appsstarted.append(t->exec()); |
111 | } | 140 | } |
112 | 141 | ||
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 | } |
120 | 149 | ||
121 | if ( appsrunning.count() > 1 ) { | 150 | if ( appsrunning.count() > 1 ) { |
122 | QStringList::ConstIterator it = appsrunning.begin(); | 151 | QStringList::ConstIterator it = appsrunning.begin(); |
123 | ++it; // top stays running! | 152 | ++it; // top stays running! |
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; |
132 | } else { | 164 | } else { |
133 | return FALSE; | 165 | return FALSE; |
134 | } | 166 | } |
135 | } | 167 | } |
136 | 168 | ||
137 | 169 | ||
138 | void MRUList::mousePressEvent(QMouseEvent *e) | 170 | void MRUList::mousePressEvent(QMouseEvent *e) |
139 | { | 171 | { |
140 | selected = 0; | 172 | selected = 0; |