summaryrefslogtreecommitdiff
path: root/core/launcher/documentlist.cpp
authorzecke <zecke>2004-02-21 11:32:55 (UTC)
committer zecke <zecke>2004-02-21 11:32:55 (UTC)
commitf80b38b2e348b588bf7560161d7551e6bd4939c0 (patch) (unidiff)
tree34c4359580641cb1447dab8df8731c9733e1d39f /core/launcher/documentlist.cpp
parentb38daa3f05f3a250a8c5114890158863ab02a99f (diff)
downloadopie-f80b38b2e348b588bf7560161d7551e6bd4939c0.zip
opie-f80b38b2e348b588bf7560161d7551e6bd4939c0.tar.gz
opie-f80b38b2e348b588bf7560161d7551e6bd4939c0.tar.bz2
Move to LibOpie2
remove launcher global and use OGlobal
Diffstat (limited to 'core/launcher/documentlist.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/documentlist.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index ece6931..440bf1e 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -1,51 +1,51 @@
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 "launcherglobal.h" 22
23#include <opie2/oglobal.h>
23 24
24#include <qtopia/config.h> 25#include <qtopia/config.h>
25#include <qtopia/mimetype.h> 26#include <qtopia/mimetype.h>
26#include <qtopia/resource.h> 27#include <qtopia/resource.h>
27#include <qtopia/global.h>
28#include <qtopia/private/categories.h> 28#include <qtopia/private/categories.h>
29#include <qtopia/qpeapplication.h> 29#include <qtopia/qpeapplication.h>
30#include <qtopia/applnk.h> 30#include <qtopia/applnk.h>
31#include <qtopia/storage.h> 31#include <qtopia/storage.h>
32#ifdef Q_WS_QWS 32#ifdef Q_WS_QWS
33#include <qtopia/qcopenvelope_qws.h> 33#include <qtopia/qcopenvelope_qws.h>
34#endif 34#endif
35 35
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qfileinfo.h> 37#include <qfileinfo.h>
38#include <qtextstream.h> 38#include <qtextstream.h>
39#include <qfile.h> 39#include <qfile.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qpainter.h> 41#include <qpainter.h>
42#include <qimage.h> 42#include <qimage.h>
43#include <qcopchannel_qws.h> 43#include <qcopchannel_qws.h>
44#include <qlistview.h> 44#include <qlistview.h>
45#include <qlist.h> 45#include <qlist.h>
46#include <qpixmap.h> 46#include <qpixmap.h>
47 47
48 48
49AppLnkSet *DocumentList::appLnkSet = 0; 49AppLnkSet *DocumentList::appLnkSet = 0;
50 50
51static const int MAX_SEARCH_DEPTH = 10; 51static const int MAX_SEARCH_DEPTH = 10;
@@ -69,49 +69,52 @@ public:
69 QDictIterator<void> *dit; 69 QDictIterator<void> *dit;
70 enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; 70 enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state;
71 71
72 QStringList docPaths; 72 QStringList docPaths;
73 unsigned int docPathsSearched; 73 unsigned int docPathsSearched;
74 74
75 int searchDepth; 75 int searchDepth;
76 QDir *listDirs[MAX_SEARCH_DEPTH]; 76 QDir *listDirs[MAX_SEARCH_DEPTH];
77 const QFileInfoList *lists[MAX_SEARCH_DEPTH]; 77 const QFileInfoList *lists[MAX_SEARCH_DEPTH];
78 unsigned int listPositions[MAX_SEARCH_DEPTH]; 78 unsigned int listPositions[MAX_SEARCH_DEPTH];
79 79
80 StorageInfo *storage; 80 StorageInfo *storage;
81 81
82 int tid; 82 int tid;
83 83
84 ServerInterface *serverGui; 84 ServerInterface *serverGui;
85 85
86 bool needToSendAllDocLinks; 86 bool needToSendAllDocLinks;
87 bool sendAppLnks; 87 bool sendAppLnks;
88 bool sendDocLnks; 88 bool sendDocLnks;
89 bool scanDocs; 89 bool scanDocs;
90}; 90};
91 91
92 92
93DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, 93/*
94 * scandocs will be read from Config
95 */
96DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/,
94 QObject *parent, const char *name ) 97 QObject *parent, const char *name )
95 : QObject( parent, name ) 98 : QObject( parent, name )
96{ 99{
97 appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); 100 appLnkSet = new AppLnkSet( MimeType::appsFolderName() );
98 d = new DocumentListPrivate( serverGui ); 101 d = new DocumentListPrivate( serverGui );
99 d->needToSendAllDocLinks = false; 102 d->needToSendAllDocLinks = false;
100 103
101 Config cfg( "Launcher" ); 104 Config cfg( "Launcher" );
102 cfg.setGroup( "DocTab" ); 105 cfg.setGroup( "DocTab" );
103 d->scanDocs = cfg.readBoolEntry( "Enable", true ); 106 d->scanDocs = cfg.readBoolEntry( "Enable", true );
104 qDebug( "DocumentList::DocumentList() : scanDocs = %d", d->scanDocs ); 107 qDebug( "DocumentList::DocumentList() : scanDocs = %d", d->scanDocs );
105 108
106 QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); 109 QTimer::singleShot( 10, this, SLOT( startInitialScan() ) );
107} 110}
108 111
109void DocumentList::startInitialScan() 112void DocumentList::startInitialScan()
110{ 113{
111 reloadAppLnks(); 114 reloadAppLnks();
112 reloadDocLnks(); 115 reloadDocLnks();
113} 116}
114 117
115DocumentList::~DocumentList() 118DocumentList::~DocumentList()
116{ 119{
117 delete appLnkSet; 120 delete appLnkSet;
@@ -248,49 +251,49 @@ void DocumentList::reloadAppLnks()
248 d->serverGui->applicationAdded( l->type(), *l ); 251 d->serverGui->applicationAdded( l->type(), *l );
249 } 252 }
250 253
251 if ( d->sendAppLnks && d->serverGui ) 254 if ( d->sendAppLnks && d->serverGui )
252 d->serverGui->applicationScanningProgress( 100 ); 255 d->serverGui->applicationScanningProgress( 100 );
253} 256}
254 257
255void DocumentList::reloadDocLnks() 258void DocumentList::reloadDocLnks()
256{ 259{
257 if ( !d->scanDocs ) 260 if ( !d->scanDocs )
258 return; 261 return;
259 262
260 if ( d->sendDocLnks && d->serverGui ) { 263 if ( d->sendDocLnks && d->serverGui ) {
261 d->serverGui->documentScanningProgress( 0 ); 264 d->serverGui->documentScanningProgress( 0 );
262 d->serverGui->allDocumentsRemoved(); 265 d->serverGui->allDocumentsRemoved();
263 } 266 }
264 267
265 rescan(); 268 rescan();
266} 269}
267 270
268void DocumentList::linkChanged( QString arg ) 271void DocumentList::linkChanged( QString arg )
269{ 272{
270 //qDebug( "linkchanged( %s )", arg.latin1() ); 273 //qDebug( "linkchanged( %s )", arg.latin1() );
271 274
272 if ( arg.isNull() || Opie::Global::isAppLnkFileName( arg ) ) { 275 if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) {
273 reloadAppLnks(); 276 reloadAppLnks();
274 } else { 277 } else {
275 278
276 const QList<DocLnk> &list = d->dls.children(); 279 const QList<DocLnk> &list = d->dls.children();
277 QListIterator<DocLnk> it( list ); 280 QListIterator<DocLnk> it( list );
278 while ( it.current() ) { 281 while ( it.current() ) {
279 DocLnk *doc = it.current(); 282 DocLnk *doc = it.current();
280 ++it; 283 ++it;
281 if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) 284 if ( ( doc->linkFileKnown() && doc->linkFile() == arg )
282 || ( doc->fileKnown() && doc->file() == arg ) ) { 285 || ( doc->fileKnown() && doc->file() == arg ) ) {
283 //qDebug( "found old link" ); 286 //qDebug( "found old link" );
284 DocLnk* dl = new DocLnk( arg ); 287 DocLnk* dl = new DocLnk( arg );
285 // add new one if it exists and matches the mimetype 288 // add new one if it exists and matches the mimetype
286 if ( d->store( dl ) ) { 289 if ( d->store( dl ) ) {
287 // Existing link has been changed, send old link ref and a ref 290 // Existing link has been changed, send old link ref and a ref
288 // to the new link 291 // to the new link
289 //qDebug( "change case" ); 292 //qDebug( "change case" );
290 if ( d->serverGui ) 293 if ( d->serverGui )
291 d->serverGui->documentChanged( *doc, *dl ); 294 d->serverGui->documentChanged( *doc, *dl );
292 295
293 } else { 296 } else {
294 // Link has been removed or doesn't match the mimetypes any more 297 // Link has been removed or doesn't match the mimetypes any more
295 // so we aren't interested in it, so take it away from the list 298 // so we aren't interested in it, so take it away from the list
296 //qDebug( "removal case" ); 299 //qDebug( "removal case" );