summaryrefslogtreecommitdiff
authorbrad <brad>2004-04-12 07:01:55 (UTC)
committer brad <brad>2004-04-12 07:01:55 (UTC)
commit2c087dc52d50eb9b13670254f70347d7b1147b20 (patch) (unidiff)
tree79814aa2618a6a512a0e669ba2b6829ca13b7bdd
parent66f497a5c7990d7e54cc1ae26995231ade55b86c (diff)
downloadopie-2c087dc52d50eb9b13670254f70347d7b1147b20.zip
opie-2c087dc52d50eb9b13670254f70347d7b1147b20.tar.gz
opie-2c087dc52d50eb9b13670254f70347d7b1147b20.tar.bz2
Changed launcher to only add/remove icons/tabs that have changed when removable
media is mounted/unmounted. A card insert on my machine used to take 7500ms. It now takes 548ms. Same with card removal. Old code has been left as is an can be re-enabled with a simple comment.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/documentlist.cpp92
-rw-r--r--core/launcher/documentlist.h1
2 files changed, 91 insertions, 2 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index 92b8c25..59dd721 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -1,700 +1,788 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** 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 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "documentlist.h" 20#include "documentlist.h"
21#include "serverinterface.h" 21#include "serverinterface.h"
22#include "mediadlg.h" 22#include "mediadlg.h"
23 23
24/* OPIE */ 24/* OPIE */
25#include <opie2/oglobal.h> 25#include <opie2/oglobal.h>
26#include <opie2/odebug.h> 26#include <opie2/odebug.h>
27#include <qtopia/config.h> 27#include <qtopia/config.h>
28#include <qtopia/mimetype.h> 28#include <qtopia/mimetype.h>
29#include <qtopia/resource.h> 29#include <qtopia/resource.h>
30#include <qtopia/private/categories.h> 30#include <qtopia/private/categories.h>
31#include <qtopia/qpeapplication.h> 31#include <qtopia/qpeapplication.h>
32#include <qtopia/applnk.h> 32#include <qtopia/applnk.h>
33#include <qtopia/storage.h> 33#include <qtopia/storage.h>
34#ifdef Q_WS_QWS 34#ifdef Q_WS_QWS
35#include <qtopia/qcopenvelope_qws.h> 35#include <qtopia/qcopenvelope_qws.h>
36#endif 36#endif
37using namespace Opie::Core; 37using namespace Opie::Core;
38 38
39/* QT */ 39/* QT */
40#include <qtimer.h> 40#include <qtimer.h>
41#include <qfileinfo.h> 41#include <qfileinfo.h>
42#include <qtextstream.h> 42#include <qtextstream.h>
43#include <qfile.h> 43#include <qfile.h>
44#include <qdir.h> 44#include <qdir.h>
45#include <qpainter.h> 45#include <qpainter.h>
46#include <qimage.h> 46#include <qimage.h>
47#include <qcopchannel_qws.h> 47#include <qcopchannel_qws.h>
48#include <qlistview.h> 48#include <qlistview.h>
49#include <qlist.h> 49#include <qlist.h>
50#include <qpixmap.h> 50#include <qpixmap.h>
51 51
52 52
53AppLnkSet *DocumentList::appLnkSet = 0; 53AppLnkSet *DocumentList::appLnkSet = 0;
54 54
55static const int MAX_SEARCH_DEPTH = 10; 55static const int MAX_SEARCH_DEPTH = 10;
56 56
57 57
58class DocumentListPrivate : public QObject { 58class DocumentListPrivate : public QObject {
59 Q_OBJECT 59 Q_OBJECT
60public: 60public:
61 DocumentListPrivate( ServerInterface *gui ); 61 DocumentListPrivate( ServerInterface *gui );
62 ~DocumentListPrivate(); 62 ~DocumentListPrivate();
63 63
64 void initialize(); 64 void initialize();
65 65
66 const QString nextFile(); 66 const QString nextFile();
67 const DocLnk *iterate(); 67 const DocLnk *iterate();
68 bool store( DocLnk* dl ); 68 bool store( DocLnk* dl );
69 void estimatedPercentScanned(); 69 void estimatedPercentScanned();
70 void appendDocpath(FileSystem*); 70 void appendDocpath(FileSystem*);
71 71
72 72
73 DocLnkSet dls; 73 DocLnkSet dls;
74 QDict<void> reference; 74 QDict<void> reference;
75 QDictIterator<void> *dit; 75 QDictIterator<void> *dit;
76 enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; 76 enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state;
77 77
78 QStringList docPaths; 78 QStringList docPaths;
79 unsigned int docPathsSearched; 79 unsigned int docPathsSearched;
80 80
81 int searchDepth; 81 int searchDepth;
82 QDir *listDirs[MAX_SEARCH_DEPTH]; 82 QDir *listDirs[MAX_SEARCH_DEPTH];
83 const QFileInfoList *lists[MAX_SEARCH_DEPTH]; 83 const QFileInfoList *lists[MAX_SEARCH_DEPTH];
84 unsigned int listPositions[MAX_SEARCH_DEPTH]; 84 unsigned int listPositions[MAX_SEARCH_DEPTH];
85 85
86 StorageInfo *storage; 86 StorageInfo *storage;
87 87
88 int tid; 88 int tid;
89 89
90 ServerInterface *serverGui; 90 ServerInterface *serverGui;
91 91
92 bool needToSendAllDocLinks; 92 bool needToSendAllDocLinks;
93 bool sendAppLnks; 93 bool sendAppLnks;
94 bool sendDocLnks; 94 bool sendDocLnks;
95 bool scanDocs; 95 bool scanDocs;
96}; 96};
97 97
98 98
99/* 99/*
100 * scandocs will be read from Config 100 * scandocs will be read from Config
101 */ 101 */
102DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/, 102DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/,
103 QObject *parent, const char *name ) 103 QObject *parent, const char *name )
104 : QObject( parent, name ) 104 : QObject( parent, name )
105{ 105{
106 appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); 106 appLnkSet = new AppLnkSet( MimeType::appsFolderName() );
107 d = new DocumentListPrivate( serverGui ); 107 d = new DocumentListPrivate( serverGui );
108 d->needToSendAllDocLinks = false; 108 d->needToSendAllDocLinks = false;
109 109
110 Config cfg( "Launcher" ); 110 Config cfg( "Launcher" );
111 cfg.setGroup( "DocTab" ); 111 cfg.setGroup( "DocTab" );
112 d->scanDocs = cfg.readBoolEntry( "Enable", true ); 112 d->scanDocs = cfg.readBoolEntry( "Enable", true );
113 odebug << "DocumentList::DocumentList() : scanDocs = " << d->scanDocs << "" << oendl; 113 odebug << "DocumentList::DocumentList() : scanDocs = " << d->scanDocs << "" << oendl;
114 114
115 QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); 115 QTimer::singleShot( 10, this, SLOT( startInitialScan() ) );
116} 116}
117 117
118void DocumentList::startInitialScan() 118void DocumentList::startInitialScan()
119{ 119{
120 reloadAppLnks(); 120 reloadAppLnks();
121 reloadDocLnks(); 121 reloadDocLnks();
122} 122}
123 123
124DocumentList::~DocumentList() 124DocumentList::~DocumentList()
125{ 125{
126 delete appLnkSet; 126 delete appLnkSet;
127 delete d; 127 delete d;
128} 128}
129 129
130 130
131void DocumentList::add( const DocLnk& doc ) 131void DocumentList::add( const DocLnk& doc )
132{ 132{
133 if ( d->serverGui && QFile::exists( doc.file() ) ) 133 if ( d->serverGui && QFile::exists( doc.file() ) )
134 d->serverGui->documentAdded( doc ); 134 d->serverGui->documentAdded( doc );
135} 135}
136 136
137 137
138void DocumentList::start() 138void DocumentList::start()
139{ 139{
140 resume(); 140 resume();
141} 141}
142 142
143 143
144void DocumentList::pause() 144void DocumentList::pause()
145{ 145{
146 //odebug << "pause " << d->tid << "" << oendl; 146 //odebug << "pause " << d->tid << "" << oendl;
147 killTimer( d->tid ); 147 killTimer( d->tid );
148 d->tid = 0; 148 d->tid = 0;
149} 149}
150 150
151 151
152void DocumentList::resume() 152void DocumentList::resume()
153{ 153{
154 if ( d->tid == 0 ) { 154 if ( d->tid == 0 ) {
155 d->tid = startTimer( 20 ); 155 d->tid = startTimer( 20 );
156 //odebug << "resumed " << d->tid << "" << oendl; 156 //odebug << "resumed " << d->tid << "" << oendl;
157 } 157 }
158} 158}
159 159
160/* 160/*
161void DocumentList::resend() 161void DocumentList::resend()
162{ 162{
163 // Re-emits all the added items to the list (firstly letting everyone know to 163 // Re-emits all the added items to the list (firstly letting everyone know to
164 // clear what they have as it is being sent again) 164 // clear what they have as it is being sent again)
165 pause(); 165 pause();
166 emit allRemoved(); 166 emit allRemoved();
167 QTimer::singleShot( 5, this, SLOT( resendWorker() ) ); 167 QTimer::singleShot( 5, this, SLOT( resendWorker() ) );
168} 168}
169 169
170 170
171void DocumentList::resendWorker() 171void DocumentList::resendWorker()
172{ 172{
173 const QList<DocLnk> &list = d->dls.children(); 173 const QList<DocLnk> &list = d->dls.children();
174 for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) 174 for ( QListIterator<DocLnk> it( list ); it.current(); ++it )
175 add( *(*it) ); 175 add( *(*it) );
176 resume(); 176 resume();
177} 177}
178*/ 178*/
179 179
180void DocumentList::rescan() 180void DocumentList::rescan()
181{ 181{
182 //odebug << "rescan" << oendl; 182 //odebug << "rescan" << oendl;
183 pause(); 183 pause();
184 d->initialize(); 184 d->initialize();
185 resume(); 185 resume();
186} 186}
187 187
188 188
189void DocumentList::timerEvent( QTimerEvent *te ) 189void DocumentList::timerEvent( QTimerEvent *te )
190{ 190{
191 if ( te->timerId() == d->tid ) { 191 if ( te->timerId() == d->tid ) {
192 // Do 3 at a time 192 // Do 3 at a time
193 for (int i = 0; i < 3; i++ ) { 193 for (int i = 0; i < 3; i++ ) {
194 const DocLnk *lnk = d->iterate(); 194 const DocLnk *lnk = d->iterate();
195 if ( lnk ) { 195 if ( lnk ) {
196 add( *lnk ); 196 add( *lnk );
197 } else { 197 } else {
198 // stop when done 198 // stop when done
199 pause(); 199 pause();
200 if ( d->serverGui ) 200 if ( d->serverGui )
201 d->serverGui->documentScanningProgress( 100 ); 201 d->serverGui->documentScanningProgress( 100 );
202 if ( d->needToSendAllDocLinks ) 202 if ( d->needToSendAllDocLinks )
203 sendAllDocLinks(); 203 sendAllDocLinks();
204 break; 204 break;
205 } 205 }
206 } 206 }
207 } 207 }
208} 208}
209 209
210 210
211void DocumentList::reloadAppLnks() 211void DocumentList::reloadAppLnks()
212{ 212{
213 if ( d->sendAppLnks && d->serverGui ) { 213 if ( d->sendAppLnks && d->serverGui ) {
214 d->serverGui->applicationScanningProgress( 0 ); 214 d->serverGui->applicationScanningProgress( 0 );
215 d->serverGui->allApplicationsRemoved(); 215 d->serverGui->allApplicationsRemoved();
216 } 216 }
217 217
218 delete appLnkSet; 218 delete appLnkSet;
219 appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); 219 appLnkSet = new AppLnkSet( MimeType::appsFolderName() );
220 220
221 if ( d->sendAppLnks && d->serverGui ) { 221 if ( d->sendAppLnks && d->serverGui ) {
222 static QStringList prevTypeList; 222 static QStringList prevTypeList;
223 QStringList types = appLnkSet->types(); 223 QStringList types = appLnkSet->types();
224 for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { 224 for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
225 if ( !(*ittypes).isEmpty() ) { 225 if ( !(*ittypes).isEmpty() ) {
226 if ( !prevTypeList.contains(*ittypes) ) { 226 if ( !prevTypeList.contains(*ittypes) ) {
227 QString name = appLnkSet->typeName(*ittypes); 227 QString name = appLnkSet->typeName(*ittypes);
228 QPixmap pm = appLnkSet->typePixmap(*ittypes); 228 QPixmap pm = appLnkSet->typePixmap(*ittypes);
229 QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); 229 QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes);
230 230
231 if (pm.isNull()) { 231 if (pm.isNull()) {
232 QImage img( Resource::loadImage( "UnknownDocument" ) ); 232 QImage img( Resource::loadImage( "UnknownDocument" ) );
233 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 233 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
234 bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); 234 bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
235 } 235 }
236 236
237 //odebug << "adding type " << (*ittypes) << "" << oendl; 237 //odebug << "adding type " << (*ittypes) << "" << oendl;
238 238
239 // ### our current launcher expects docs tab to be last 239 // ### our current launcher expects docs tab to be last
240 d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); 240 d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm );
241 } 241 }
242 prevTypeList.remove(*ittypes); 242 prevTypeList.remove(*ittypes);
243 } 243 }
244 } 244 }
245 for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { 245 for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) {
246 //odebug << "removing type " << (*ittypes) << "" << oendl; 246 //odebug << "removing type " << (*ittypes) << "" << oendl;
247 d->serverGui->typeRemoved(*ittypes); 247 d->serverGui->typeRemoved(*ittypes);
248 } 248 }
249 prevTypeList = types; 249 prevTypeList = types;
250 } 250 }
251 251
252 QListIterator<AppLnk> itapp( appLnkSet->children() ); 252 QListIterator<AppLnk> itapp( appLnkSet->children() );
253 AppLnk* l; 253 AppLnk* l;
254 while ( (l=itapp.current()) ) { 254 while ( (l=itapp.current()) ) {
255 ++itapp; 255 ++itapp;
256 if ( d->sendAppLnks && d->serverGui ) 256 if ( d->sendAppLnks && d->serverGui )
257 d->serverGui->applicationAdded( l->type(), *l ); 257 d->serverGui->applicationAdded( l->type(), *l );
258 } 258 }
259 259
260 if ( d->sendAppLnks && d->serverGui ) 260 if ( d->sendAppLnks && d->serverGui )
261 d->serverGui->applicationScanningProgress( 100 ); 261 d->serverGui->applicationScanningProgress( 100 );
262} 262}
263 263
264void DocumentList::reloadDocLnks() 264void DocumentList::reloadDocLnks()
265{ 265{
266 if ( !d->scanDocs ) 266 if ( !d->scanDocs )
267 return; 267 return;
268 268
269 if ( d->sendDocLnks && d->serverGui ) { 269 if ( d->sendDocLnks && d->serverGui ) {
270 d->serverGui->documentScanningProgress( 0 ); 270 d->serverGui->documentScanningProgress( 0 );
271 d->serverGui->allDocumentsRemoved(); 271 d->serverGui->allDocumentsRemoved();
272 } 272 }
273 273
274 rescan(); 274 rescan();
275} 275}
276 276
277void DocumentList::linkChanged( QString arg ) 277void DocumentList::linkChanged( QString arg )
278{ 278{
279 //odebug << "linkchanged( " << arg << " )" << oendl; 279 //odebug << "linkchanged( " << arg << " )" << oendl;
280 280
281 if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) { 281 if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) {
282 reloadAppLnks(); 282 reloadAppLnks();
283 } else { 283 } else {
284 284
285 const QList<DocLnk> &list = d->dls.children(); 285 const QList<DocLnk> &list = d->dls.children();
286 QListIterator<DocLnk> it( list ); 286 QListIterator<DocLnk> it( list );
287 while ( it.current() ) { 287 while ( it.current() ) {
288 DocLnk *doc = it.current(); 288 DocLnk *doc = it.current();
289 ++it; 289 ++it;
290 if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) 290 if ( ( doc->linkFileKnown() && doc->linkFile() == arg )
291 || ( doc->fileKnown() && doc->file() == arg ) ) { 291 || ( doc->fileKnown() && doc->file() == arg ) ) {
292 //odebug << "found old link" << oendl; 292 //odebug << "found old link" << oendl;
293 DocLnk* dl = new DocLnk( arg ); 293 DocLnk* dl = new DocLnk( arg );
294 // add new one if it exists and matches the mimetype 294 // add new one if it exists and matches the mimetype
295 if ( d->store( dl ) ) { 295 if ( d->store( dl ) ) {
296 // Existing link has been changed, send old link ref and a ref 296 // Existing link has been changed, send old link ref and a ref
297 // to the new link 297 // to the new link
298 //odebug << "change case" << oendl; 298 //odebug << "change case" << oendl;
299 if ( d->serverGui ) 299 if ( d->serverGui )
300 d->serverGui->documentChanged( *doc, *dl ); 300 d->serverGui->documentChanged( *doc, *dl );
301 301
302 } else { 302 } else {
303 // Link has been removed or doesn't match the mimetypes any more 303 // Link has been removed or doesn't match the mimetypes any more
304 // so we aren't interested in it, so take it away from the list 304 // so we aren't interested in it, so take it away from the list
305 //odebug << "removal case" << oendl; 305 //odebug << "removal case" << oendl;
306 if ( d->serverGui ) 306 if ( d->serverGui )
307 d->serverGui->documentRemoved( *doc ); 307 d->serverGui->documentRemoved( *doc );
308 308
309 } 309 }
310 d->dls.remove( doc ); // remove old link from docLnkSet 310 d->dls.remove( doc ); // remove old link from docLnkSet
311 delete doc; 311 delete doc;
312 return; 312 return;
313 } 313 }
314 } 314 }
315 // Didn't find existing link, must be new 315 // Didn't find existing link, must be new
316 DocLnk* dl = new DocLnk( arg ); 316 DocLnk* dl = new DocLnk( arg );
317 if ( d->store( dl ) ) { 317 if ( d->store( dl ) ) {
318 // Add if it's a link we are interested in 318 // Add if it's a link we are interested in
319 //odebug << "add case" << oendl; 319 //odebug << "add case" << oendl;
320 add( *dl ); 320 add( *dl );
321 } 321 }
322 322
323 } 323 }
324} 324}
325 325
326void DocumentList::restoreDone() 326void DocumentList::restoreDone()
327{ 327{
328 reloadAppLnks(); 328 reloadAppLnks();
329 reloadDocLnks(); 329 reloadDocLnks();
330} 330}
331 331
332void DocumentList::DiffAppLnks()
333{
334 static AppLnkSet *appLnkSet2;
335
336 appLnkSet2 = new AppLnkSet( MimeType::appsFolderName() );
337
338 if ( d->sendAppLnks && d->serverGui ) {
339 static QStringList prevTypeList = appLnkSet->types();
340 QStringList types = appLnkSet2->types();
341 for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
342 if ( !(*ittypes).isEmpty() ) {
343 if ( !prevTypeList.contains(*ittypes) ) {
344 QString name = appLnkSet2->typeName(*ittypes);
345 QPixmap pm = appLnkSet2->typePixmap(*ittypes);
346 QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes);
347
348 if (pm.isNull()) {
349 QImage img( Resource::loadImage( "UnknownDocument" ) );
350 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
351 bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
352 }
353
354 odebug << "adding type " << (*ittypes) << "" << oendl;
355
356 // ### our current launcher expects docs tab to be last
357 d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm );
358 }
359 prevTypeList.remove(*ittypes);
360 }
361 }
362 for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) {
363 odebug << "removing type " << (*ittypes) << "" << oendl;
364 d->serverGui->typeRemoved(*ittypes);
365 }
366 prevTypeList = types;
367 }
368
369
370 QListIterator<AppLnk> it1( appLnkSet->children() );
371 QListIterator<AppLnk> it2( appLnkSet2->children() );
372
373 AppLnk *i;
374 AppLnk *j;
375 bool found;
376
377 while ( (j=it2.current()) ) {
378 it1 = appLnkSet->children();
379 found = false;
380 while ( (i=it1.current()) ){
381 if (strcmp(i->name().ascii(),j->name().ascii()) == 0)
382 found = true;
383 ++it1;
384 }
385 if (!found) {
386 qDebug("Item %s needs to be added",j->name().ascii() );
387 d->serverGui->applicationAdded( j->type(), *j );
388 }
389 ++it2;
390 }
391
392 it1 = appLnkSet->children();
393 while ( (i=it1.current()) ) {
394 it2 = appLnkSet2->children();
395 found = false;
396 while ( (j=it2.current()) ){
397 if (strcmp(i->name().ascii(),j->name().ascii()) == 0)
398 found = true;
399 ++it2;
400 }
401 if (!found) {
402 qDebug("Item %s needs to be removed",i->name().ascii() );
403 d->serverGui->applicationRemoved( i->type(), *i );
404 }
405
406 ++it1;
407 }
408
409 delete appLnkSet;
410 appLnkSet = appLnkSet2;
411
412}
332void DocumentList::storageChanged() 413void DocumentList::storageChanged()
333{ 414{
415 QTime t;
334 // ### can implement better 416 // ### can implement better
335 reloadAppLnks(); 417
418 t.start();
419 DiffAppLnks();
420// reloadAppLnks();
421 qDebug("Reload App links took %i ms",t.elapsed() );
336 reloadDocLnks(); 422 reloadDocLnks();
337 // ### Optimization opportunity 423// odebug << "Reload links took " << t.elapsed() << " ms " << oendl;
424 qDebug("Reload All links took %i ms",t.elapsed() );
425// ### Optimization opportunity
338 // Could be a bit more intelligent and somehow work out which 426 // Could be a bit more intelligent and somehow work out which
339 // mtab entry has changed and then only scan that and add and remove 427 // mtab entry has changed and then only scan that and add and remove
340 // links appropriately. 428 // links appropriately.
341// rescan(); 429// rescan();
342} 430}
343 431
344void DocumentList::sendAllDocLinks() 432void DocumentList::sendAllDocLinks()
345{ 433{
346 if ( d->tid != 0 ) { 434 if ( d->tid != 0 ) {
347 // We are in the middle of scanning, set a flag so 435 // We are in the middle of scanning, set a flag so
348 // we do this when we finish our scanning 436 // we do this when we finish our scanning
349 d->needToSendAllDocLinks = true; 437 d->needToSendAllDocLinks = true;
350 return; 438 return;
351 } 439 }
352 440
353 QString contents; 441 QString contents;
354 Categories cats; 442 Categories cats;
355 for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { 443 for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) {
356 DocLnk *doc = it.current(); 444 DocLnk *doc = it.current();
357 QFileInfo fi( doc->file() ); 445 QFileInfo fi( doc->file() );
358 if ( !fi.exists() ) 446 if ( !fi.exists() )
359 continue; 447 continue;
360 448
361 bool fake = !doc->linkFileKnown(); 449 bool fake = !doc->linkFileKnown();
362 if ( !fake ) { 450 if ( !fake ) {
363 QFile f( doc->linkFile() ); 451 QFile f( doc->linkFile() );
364 if ( f.open( IO_ReadOnly ) ) { 452 if ( f.open( IO_ReadOnly ) ) {
365 QTextStream ts( &f ); 453 QTextStream ts( &f );
366 ts.setEncoding( QTextStream::UnicodeUTF8 ); 454 ts.setEncoding( QTextStream::UnicodeUTF8 );
367 contents += ts.read(); 455 contents += ts.read();
368 f.close(); 456 f.close();
369 } else 457 } else
370 fake = TRUE; 458 fake = TRUE;
371 } 459 }
372 if (fake) { 460 if (fake) {
373 contents += "[Desktop Entry]\n"; // No tr 461 contents += "[Desktop Entry]\n"; // No tr
374 contents += "Categories = " + // No tr 462 contents += "Categories = " + // No tr
375 cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr 463 cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr
376 contents += "Name = "+doc->name()+"\n"; // No tr 464 contents += "Name = "+doc->name()+"\n"; // No tr
377 contents += "Type = "+doc->type()+"\n"; // No tr 465 contents += "Type = "+doc->type()+"\n"; // No tr
378 } 466 }
379 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) 467 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)
380 contents += QString("Size = %1\n").arg( fi.size() ); // No tr 468 contents += QString("Size = %1\n").arg( fi.size() ); // No tr
381 } 469 }
382 470
383 //odebug << "sending length " << contents.length() << "" << oendl; 471 //odebug << "sending length " << contents.length() << "" << oendl;
384#ifndef QT_NO_COP 472#ifndef QT_NO_COP
385 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); 473 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
386 e << contents; 474 e << contents;
387#endif 475#endif
388 //odebug << "================ \n\n" << contents << "\n\n===============" << oendl; 476 //odebug << "================ \n\n" << contents << "\n\n===============" << oendl;
389 477
390 d->needToSendAllDocLinks = false; 478 d->needToSendAllDocLinks = false;
391} 479}
392 480
393 481
394 482
395 483
396 484
397 485
398 486
399 487
400 488
401 489
402 490
403 491
404 492
405 493
406 494
407 495
408 496
409 497
410 498
411 499
412 500
413 501
414 502
415 503
416DocumentListPrivate::DocumentListPrivate( ServerInterface *gui ) 504DocumentListPrivate::DocumentListPrivate( ServerInterface *gui )
417{ 505{
418 storage = new StorageInfo( this ); 506 storage = new StorageInfo( this );
419 serverGui = gui; 507 serverGui = gui;
420 if ( serverGui ) { 508 if ( serverGui ) {
421 sendAppLnks = serverGui->requiresApplications(); 509 sendAppLnks = serverGui->requiresApplications();
422 sendDocLnks = serverGui->requiresDocuments(); 510 sendDocLnks = serverGui->requiresDocuments();
423 } else { 511 } else {
424 sendAppLnks = false; 512 sendAppLnks = false;
425 sendDocLnks = false; 513 sendDocLnks = false;
426 } 514 }
427 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) { 515 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) {
428 listDirs[i] = 0; 516 listDirs[i] = 0;
429 lists[i] = 0; 517 lists[i] = 0;
430 listPositions[i] = 0; 518 listPositions[i] = 0;
431 } 519 }
432 initialize(); 520 initialize();
433 tid = 0; 521 tid = 0;
434} 522}
435 523
436void DocumentListPrivate::appendDocpath(FileSystem*fs) 524void DocumentListPrivate::appendDocpath(FileSystem*fs)
437{ 525{
438 QDir defPath(fs->path()+"/Documents"); 526 QDir defPath(fs->path()+"/Documents");
439 QFileInfo f(fs->path()+"/.opiestorage.cf"); 527 QFileInfo f(fs->path()+"/.opiestorage.cf");
440 if (!f.exists()) { 528 if (!f.exists()) {
441 Mediadlg dlg(fs); 529 Mediadlg dlg(fs);
442 if (QDialog::Accepted != QPEApplication::execDialog( &dlg )) { 530 if (QDialog::Accepted != QPEApplication::execDialog( &dlg )) {
443 return; 531 return;
444 } 532 }
445 } 533 }
446 Config conf(f.filePath(), Config::File ); 534 Config conf(f.filePath(), Config::File );
447 conf.setGroup("main"); 535 conf.setGroup("main");
448 if (!conf.readBoolEntry("check",false)) { 536 if (!conf.readBoolEntry("check",false)) {
449 return; 537 return;
450 } 538 }
451 conf.setGroup("subdirs"); 539 conf.setGroup("subdirs");
452 bool read_all = conf.readBoolEntry("wholemedia",true); 540 bool read_all = conf.readBoolEntry("wholemedia",true);
453 if (read_all) { 541 if (read_all) {
454 docPaths+=fs->path(); 542 docPaths+=fs->path();
455 return; 543 return;
456 } 544 }
457 QStringList subDirs = conf.readListEntry("subdirs",':'); 545 QStringList subDirs = conf.readListEntry("subdirs",':');
458 if (subDirs.isEmpty()) { 546 if (subDirs.isEmpty()) {
459 if (defPath.exists()) { 547 if (defPath.exists()) {
460 docPaths+=defPath.path(); 548 docPaths+=defPath.path();
461 } 549 }
462 return; 550 return;
463 } 551 }
464 for (unsigned c = 0; c < subDirs.count();++c) { 552 for (unsigned c = 0; c < subDirs.count();++c) {
465 QDir docDir(QString(fs->path()+"/"+subDirs[c])); 553 QDir docDir(QString(fs->path()+"/"+subDirs[c]));
466 if (docDir.exists()) { 554 if (docDir.exists()) {
467 docPaths+=docDir.path(); 555 docPaths+=docDir.path();
468 } 556 }
469 } 557 }
470} 558}
471 559
472void DocumentListPrivate::initialize() 560void DocumentListPrivate::initialize()
473{ 561{
474 // Reset 562 // Reset
475 dls.clear(); 563 dls.clear();
476 docPaths.clear(); 564 docPaths.clear();
477 reference.clear(); 565 reference.clear();
478 566
479 QDir docDir( QPEApplication::documentDir() ); 567 QDir docDir( QPEApplication::documentDir() );
480 if ( docDir.exists() ) 568 if ( docDir.exists() )
481 docPaths += QPEApplication::documentDir(); 569 docPaths += QPEApplication::documentDir();
482 int i = 1; 570 int i = 1;
483 const QList<FileSystem> &fs = storage->fileSystems(); 571 const QList<FileSystem> &fs = storage->fileSystems();
484 QListIterator<FileSystem> it( fs ); 572 QListIterator<FileSystem> it( fs );
485 for ( ; it.current(); ++it ) { 573 for ( ; it.current(); ++it ) {
486 if ( (*it)->isRemovable() ) { 574 if ( (*it)->isRemovable() ) {
487 appendDocpath((*it)); 575 appendDocpath((*it));
488 ++i; 576 ++i;
489 } 577 }
490 } 578 }
491 579
492 for ( int i = 0; i < MAX_SEARCH_DEPTH; ++i ) { 580 for ( int i = 0; i < MAX_SEARCH_DEPTH; ++i ) {
493 if ( listDirs[i] ) { 581 if ( listDirs[i] ) {
494 delete listDirs[i]; 582 delete listDirs[i];
495 listDirs[i] = 0; 583 listDirs[i] = 0;
496 } 584 }
497 lists[i] = 0; 585 lists[i] = 0;
498 listPositions[i] = 0; 586 listPositions[i] = 0;
499 } 587 }
500 588
501 docPathsSearched = 0; 589 docPathsSearched = 0;
502 searchDepth = -1; 590 searchDepth = -1;
503 state = Find; 591 state = Find;
504 dit = 0; 592 dit = 0;
505} 593}
506 594
507 595
508DocumentListPrivate::~DocumentListPrivate() 596DocumentListPrivate::~DocumentListPrivate()
509{ 597{
510 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) 598 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ )
511 if ( listDirs[i] ) 599 if ( listDirs[i] )
512 delete listDirs[i]; 600 delete listDirs[i];
513 delete dit; 601 delete dit;
514} 602}
515 603
516 604
517void DocumentListPrivate::estimatedPercentScanned() 605void DocumentListPrivate::estimatedPercentScanned()
518{ 606{
519 double overallProgress = 0.0; 607 double overallProgress = 0.0;
520 double levelWeight = 75.0; 608 double levelWeight = 75.0;
521 609
522 int topCount = docPaths.count(); 610 int topCount = docPaths.count();
523 if ( topCount > 1 ) { 611 if ( topCount > 1 ) {
524 levelWeight = levelWeight / topCount; 612 levelWeight = levelWeight / topCount;
525 overallProgress += (docPathsSearched - 1) * levelWeight; 613 overallProgress += (docPathsSearched - 1) * levelWeight;
526 } 614 }
527 615
528 for ( int d = 0; d <= searchDepth; d++ ) { 616 for ( int d = 0; d <= searchDepth; d++ ) {
529 if ( listDirs[d] ) { 617 if ( listDirs[d] ) {
530 int items = lists[d]->count(); 618 int items = lists[d]->count();
531 if ( items > 1 ) { 619 if ( items > 1 ) {
532 levelWeight = levelWeight / items; 620 levelWeight = levelWeight / items;
533 // Take in to account "." and ".." 621 // Take in to account "." and ".."
534 overallProgress += (listPositions[d] - 3) * levelWeight; 622 overallProgress += (listPositions[d] - 3) * levelWeight;
535 } 623 }
536 } else { 624 } else {
537 break; 625 break;
538 } 626 }
539 } 627 }
540 628
541 // odebug << "overallProgress: " << overallProgress << "" << oendl; 629 // odebug << "overallProgress: " << overallProgress << "" << oendl;
542 630
543 if ( serverGui ) 631 if ( serverGui )
544 serverGui->documentScanningProgress( (int)overallProgress ); 632 serverGui->documentScanningProgress( (int)overallProgress );
545} 633}
546 634
547 635
548const QString DocumentListPrivate::nextFile() 636const QString DocumentListPrivate::nextFile()
549{ 637{
550 while ( TRUE ) { 638 while ( TRUE ) {
551 while ( searchDepth < 0 ) { 639 while ( searchDepth < 0 ) {
552 // go to next base path 640 // go to next base path
553 if ( docPathsSearched >= docPaths.count() ) { 641 if ( docPathsSearched >= docPaths.count() ) {
554 // end of base paths 642 // end of base paths
555 return QString::null; 643 return QString::null;
556 } else { 644 } else {
557 QDir dir( docPaths[docPathsSearched] ); 645 QDir dir( docPaths[docPathsSearched] );
558 // odebug << "now using base path: " << docPaths[docPathsSearched] << "" << oendl; 646 // odebug << "now using base path: " << docPaths[docPathsSearched] << "" << oendl;
559 docPathsSearched++; 647 docPathsSearched++;
560 if ( !dir.exists( ".Qtopia-ignore" ) ) { 648 if ( !dir.exists( ".Qtopia-ignore" ) ) {
561 listDirs[0] = new QDir( dir ); 649 listDirs[0] = new QDir( dir );
562 lists[0] = listDirs[0]->entryInfoList(); 650 lists[0] = listDirs[0]->entryInfoList();
563 listPositions[0] = 0; 651 listPositions[0] = 0;
564 searchDepth = 0; 652 searchDepth = 0;
565 } 653 }
566 } 654 }
567 } 655 }
568 656
569 const QFileInfoList *fil = lists[searchDepth]; 657 const QFileInfoList *fil = lists[searchDepth];
570 if (!fil) { 658 if (!fil) {
571 return QString::null; 659 return QString::null;
572 } 660 }
573 QFileInfoList *fl = (QFileInfoList *)fil; 661 QFileInfoList *fl = (QFileInfoList *)fil;
574 unsigned int pos = listPositions[searchDepth]; 662 unsigned int pos = listPositions[searchDepth];
575 663
576 if ( pos >= fl->count() ) { 664 if ( pos >= fl->count() ) {
577 // go up a depth 665 // go up a depth
578 delete listDirs[searchDepth]; 666 delete listDirs[searchDepth];
579 listDirs[searchDepth] = 0; 667 listDirs[searchDepth] = 0;
580 lists[searchDepth] = 0; 668 lists[searchDepth] = 0;
581 listPositions[searchDepth] = 0; 669 listPositions[searchDepth] = 0;
582 searchDepth--; 670 searchDepth--;
583 } else { 671 } else {
584 const QFileInfo *fi = fl->at(pos); 672 const QFileInfo *fi = fl->at(pos);
585 listPositions[searchDepth]++; 673 listPositions[searchDepth]++;
586 QString bn = fi->fileName(); 674 QString bn = fi->fileName();
587 if ( bn[0] != '.' ) { 675 if ( bn[0] != '.' ) {
588 if ( fi->isDir() ) { 676 if ( fi->isDir() ) {
589 if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) { 677 if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) {
590 // go down a depth 678 // go down a depth
591 QDir dir( fi->filePath() ); 679 QDir dir( fi->filePath() );
592 // odebug << "now going in to path: " << bn << "" << oendl; 680 // odebug << "now going in to path: " << bn << "" << oendl;
593 if ( !dir.exists( ".Qtopia-ignore" ) ) { 681 if ( !dir.exists( ".Qtopia-ignore" ) ) {
594 if ( searchDepth < MAX_SEARCH_DEPTH - 1) { 682 if ( searchDepth < MAX_SEARCH_DEPTH - 1) {
595 searchDepth++; 683 searchDepth++;
596 listDirs[searchDepth] = new QDir( dir ); 684 listDirs[searchDepth] = new QDir( dir );
597 lists[searchDepth] = listDirs[searchDepth]->entryInfoList(); 685 lists[searchDepth] = listDirs[searchDepth]->entryInfoList();
598 listPositions[searchDepth] = 0; 686 listPositions[searchDepth] = 0;
599 } 687 }
600 } 688 }
601 } 689 }
602 } else { 690 } else {
603 estimatedPercentScanned(); 691 estimatedPercentScanned();
604 return fl->at(pos)->filePath(); 692 return fl->at(pos)->filePath();
605 } 693 }
606 } 694 }
607 } 695 }
608 } 696 }
609 697
610 return QString::null; 698 return QString::null;
611} 699}
612 700
613 701
614bool DocumentListPrivate::store( DocLnk* dl ) 702bool DocumentListPrivate::store( DocLnk* dl )
615{ 703{
616 // if ( dl->fileKnown() && !dl->file().isEmpty() ) { 704 // if ( dl->fileKnown() && !dl->file().isEmpty() ) {
617 if ( dl && dl->fileKnown() ) { 705 if ( dl && dl->fileKnown() ) {
618 dls.add( dl ); // store 706 dls.add( dl ); // store
619 return TRUE; 707 return TRUE;
620 } 708 }
621 709
622 // don't store - delete 710 // don't store - delete
623 delete dl; 711 delete dl;
624 return FALSE; 712 return FALSE;
625} 713}
626 714
627 715
628 #define MAGIC_NUMBER((void*)2) 716 #define MAGIC_NUMBER((void*)2)
629 717
630const DocLnk *DocumentListPrivate::iterate() 718const DocLnk *DocumentListPrivate::iterate()
631{ 719{
632 if ( state == Find ) { 720 if ( state == Find ) {
633 //odebug << "state Find" << oendl; 721 //odebug << "state Find" << oendl;
634 QString file = nextFile(); 722 QString file = nextFile();
635 while ( !file.isNull() ) { 723 while ( !file.isNull() ) {
636 if ( file.right(8) == ".desktop" ) { // No tr 724 if ( file.right(8) == ".desktop" ) { // No tr
637 DocLnk* dl = new DocLnk( file ); 725 DocLnk* dl = new DocLnk( file );
638 if ( store(dl) ) 726 if ( store(dl) )
639 return dl; 727 return dl;
640 } else { 728 } else {
641 reference.insert( file, MAGIC_NUMBER ); 729 reference.insert( file, MAGIC_NUMBER );
642 } 730 }
643 file = nextFile(); 731 file = nextFile();
644 } 732 }
645 state = RemoveKnownFiles; 733 state = RemoveKnownFiles;
646 734
647 if ( serverGui ) 735 if ( serverGui )
648 serverGui->documentScanningProgress( 75 ); 736 serverGui->documentScanningProgress( 75 );
649 } 737 }
650 738
651 static int iterationI; 739 static int iterationI;
652 static int iterationCount; 740 static int iterationCount;
653 741
654 if ( state == RemoveKnownFiles ) { 742 if ( state == RemoveKnownFiles ) {
655 //odebug << "state RemoveKnownFiles" << oendl; 743 //odebug << "state RemoveKnownFiles" << oendl;
656 const QList<DocLnk> &list = dls.children(); 744 const QList<DocLnk> &list = dls.children();
657 for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) { 745 for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) {
658 reference.remove( (*it)->file() ); 746 reference.remove( (*it)->file() );
659 // ### does this need to be deleted? 747 // ### does this need to be deleted?
660 } 748 }
661 dit = new QDictIterator<void>(reference); 749 dit = new QDictIterator<void>(reference);
662 state = MakeUnknownFiles; 750 state = MakeUnknownFiles;
663 751
664 iterationI = 0; 752 iterationI = 0;
665 iterationCount = dit->count(); 753 iterationCount = dit->count();
666 } 754 }
667 755
668 if ( state == MakeUnknownFiles ) { 756 if ( state == MakeUnknownFiles ) {
669 //odebug << "state MakeUnknownFiles" << oendl; 757 //odebug << "state MakeUnknownFiles" << oendl;
670 for (void* c; (c=dit->current()); ++(*dit) ) { 758 for (void* c; (c=dit->current()); ++(*dit) ) {
671 if ( c == MAGIC_NUMBER ) { 759 if ( c == MAGIC_NUMBER ) {
672 DocLnk* dl = new DocLnk; 760 DocLnk* dl = new DocLnk;
673 QFileInfo fi( dit->currentKey() ); 761 QFileInfo fi( dit->currentKey() );
674 dl->setFile( fi.filePath() ); 762 dl->setFile( fi.filePath() );
675 dl->setName( fi.baseName() ); 763 dl->setName( fi.baseName() );
676 if ( store(dl) ) { 764 if ( store(dl) ) {
677 ++*dit; 765 ++*dit;
678 iterationI++; 766 iterationI++;
679 if ( serverGui ) 767 if ( serverGui )
680 serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount ); 768 serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount );
681 return dl; 769 return dl;
682 } 770 }
683 } 771 }
684 iterationI++; 772 iterationI++;
685 } 773 }
686 774
687 delete dit; 775 delete dit;
688 dit = 0; 776 dit = 0;
689 state = Done; 777 state = Done;
690 } 778 }
691 779
692 //odebug << "state Done" << oendl; 780 //odebug << "state Done" << oendl;
693 return NULL; 781 return NULL;
694} 782}
695 783
696 784
697#include "documentlist.moc" 785#include "documentlist.moc"
698 786
699 787
700 788
diff --git a/core/launcher/documentlist.h b/core/launcher/documentlist.h
index bd5c031..232bb6a 100644
--- a/core/launcher/documentlist.h
+++ b/core/launcher/documentlist.h
@@ -1,77 +1,78 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** 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 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef DOCUMENT_LIST_H 20#ifndef DOCUMENT_LIST_H
21#define DOCUMENT_LIST_H 21#define DOCUMENT_LIST_H
22 22
23 23
24#include <qobject.h> 24#include <qobject.h>
25#include <qtopia/applnk.h> 25#include <qtopia/applnk.h>
26 26
27 27
28class DocumentListPrivate; 28class DocumentListPrivate;
29class ServerInterface; 29class ServerInterface;
30 30
31class DocumentList : public QObject { 31class DocumentList : public QObject {
32 Q_OBJECT 32 Q_OBJECT
33public: 33public:
34 DocumentList( ServerInterface *serverGui, bool scanDocs = TRUE, 34 DocumentList( ServerInterface *serverGui, bool scanDocs = TRUE,
35 QObject *parent = 0, const char *name = 0 ); 35 QObject *parent = 0, const char *name = 0 );
36 ~DocumentList(); 36 ~DocumentList();
37 37
38 void linkChanged( QString link ); 38 void linkChanged( QString link );
39 void restoreDone(); 39 void restoreDone();
40 void storageChanged(); 40 void storageChanged();
41 void sendAllDocLinks(); 41 void sendAllDocLinks();
42 42
43 void reloadAppLnks(); 43 void reloadAppLnks();
44 void reloadDocLnks(); 44 void reloadDocLnks();
45 void DiffAppLnks();
45 46
46// Orig DocList stuff 47// Orig DocList stuff
47 void start(); 48 void start();
48 void pause(); 49 void pause();
49 void resume(); 50 void resume();
50 void rescan(); 51 void rescan();
51 52
52 static AppLnkSet *appLnkSet; 53 static AppLnkSet *appLnkSet;
53 54
54/* 55/*
55 void resend(); 56 void resend();
56signals: 57signals:
57 void added( const DocLnk& doc ); 58 void added( const DocLnk& doc );
58 void removed( const DocLnk& doc ); 59 void removed( const DocLnk& doc );
59 void changed( const DocLnk& oldDoc, const DocLnk& newDoc ); 60 void changed( const DocLnk& oldDoc, const DocLnk& newDoc );
60 void allRemoved(); 61 void allRemoved();
61 void doneForNow(); 62 void doneForNow();
62private slots: 63private slots:
63 void resendWorker(); 64 void resendWorker();
64*/ 65*/
65private slots: 66private slots:
66 void startInitialScan(); 67 void startInitialScan();
67protected: 68protected:
68 void timerEvent( QTimerEvent *te ); 69 void timerEvent( QTimerEvent *te );
69private: 70private:
70 void add( const DocLnk& doc ); 71 void add( const DocLnk& doc );
71 DocumentListPrivate *d; 72 DocumentListPrivate *d;
72 73
73}; 74};
74 75
75 76
76#endif 77#endif
77 78