summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-19 07:12:16 (UTC)
committer zecke <zecke>2004-04-19 07:12:16 (UTC)
commit0b59a16b5a5a179c46ddb3f8c585dbca59b2826e (patch) (unidiff)
tree3780a3ae09806e781582aefb23ad3040bc15d816
parent359b681f32d5c3ac2ea3bfd39a3637d211338bf7 (diff)
downloadopie-0b59a16b5a5a179c46ddb3f8c585dbca59b2826e.zip
opie-0b59a16b5a5a179c46ddb3f8c585dbca59b2826e.tar.gz
opie-0b59a16b5a5a179c46ddb3f8c585dbca59b2826e.tar.bz2
Small interface update. If we add doctypes disable the viewport() for
updates
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/documentlist.cpp8
-rw-r--r--core/launcher/launcher.cpp10
-rw-r--r--core/launcher/launcher.h2
-rw-r--r--core/launcher/serverinterface.h2
4 files changed, 20 insertions, 2 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index 59dd721..19ceb0f 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -1,302 +1,306 @@
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 if ( d->serverGui )
194 d->serverGui->aboutToAddBegin();
193 for (int i = 0; i < 3; i++ ) { 195 for (int i = 0; i < 3; i++ ) {
194 const DocLnk *lnk = d->iterate(); 196 const DocLnk *lnk = d->iterate();
195 if ( lnk ) { 197 if ( lnk ) {
196 add( *lnk ); 198 add( *lnk );
197 } else { 199 } else {
198 // stop when done 200 // stop when done
199 pause(); 201 pause();
200 if ( d->serverGui ) 202 if ( d->serverGui )
201 d->serverGui->documentScanningProgress( 100 ); 203 d->serverGui->documentScanningProgress( 100 );
202 if ( d->needToSendAllDocLinks ) 204 if ( d->needToSendAllDocLinks )
203 sendAllDocLinks(); 205 sendAllDocLinks();
204 break; 206 break;
205 } 207 }
206 } 208 }
209 if ( d->serverGui )
210 d->serverGui->aboutToAddEnd();
207 } 211 }
208} 212}
209 213
210 214
211void DocumentList::reloadAppLnks() 215void DocumentList::reloadAppLnks()
212{ 216{
213 if ( d->sendAppLnks && d->serverGui ) { 217 if ( d->sendAppLnks && d->serverGui ) {
214 d->serverGui->applicationScanningProgress( 0 ); 218 d->serverGui->applicationScanningProgress( 0 );
215 d->serverGui->allApplicationsRemoved(); 219 d->serverGui->allApplicationsRemoved();
216 } 220 }
217 221
218 delete appLnkSet; 222 delete appLnkSet;
219 appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); 223 appLnkSet = new AppLnkSet( MimeType::appsFolderName() );
220 224
221 if ( d->sendAppLnks && d->serverGui ) { 225 if ( d->sendAppLnks && d->serverGui ) {
222 static QStringList prevTypeList; 226 static QStringList prevTypeList;
223 QStringList types = appLnkSet->types(); 227 QStringList types = appLnkSet->types();
224 for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { 228 for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
225 if ( !(*ittypes).isEmpty() ) { 229 if ( !(*ittypes).isEmpty() ) {
226 if ( !prevTypeList.contains(*ittypes) ) { 230 if ( !prevTypeList.contains(*ittypes) ) {
227 QString name = appLnkSet->typeName(*ittypes); 231 QString name = appLnkSet->typeName(*ittypes);
228 QPixmap pm = appLnkSet->typePixmap(*ittypes); 232 QPixmap pm = appLnkSet->typePixmap(*ittypes);
229 QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); 233 QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes);
230 234
231 if (pm.isNull()) { 235 if (pm.isNull()) {
232 QImage img( Resource::loadImage( "UnknownDocument" ) ); 236 QImage img( Resource::loadImage( "UnknownDocument" ) );
233 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 237 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
234 bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); 238 bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
235 } 239 }
236 240
237 //odebug << "adding type " << (*ittypes) << "" << oendl; 241 //odebug << "adding type " << (*ittypes) << "" << oendl;
238 242
239 // ### our current launcher expects docs tab to be last 243 // ### our current launcher expects docs tab to be last
240 d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); 244 d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm );
241 } 245 }
242 prevTypeList.remove(*ittypes); 246 prevTypeList.remove(*ittypes);
243 } 247 }
244 } 248 }
245 for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { 249 for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) {
246 //odebug << "removing type " << (*ittypes) << "" << oendl; 250 //odebug << "removing type " << (*ittypes) << "" << oendl;
247 d->serverGui->typeRemoved(*ittypes); 251 d->serverGui->typeRemoved(*ittypes);
248 } 252 }
249 prevTypeList = types; 253 prevTypeList = types;
250 } 254 }
251 255
252 QListIterator<AppLnk> itapp( appLnkSet->children() ); 256 QListIterator<AppLnk> itapp( appLnkSet->children() );
253 AppLnk* l; 257 AppLnk* l;
254 while ( (l=itapp.current()) ) { 258 while ( (l=itapp.current()) ) {
255 ++itapp; 259 ++itapp;
256 if ( d->sendAppLnks && d->serverGui ) 260 if ( d->sendAppLnks && d->serverGui )
257 d->serverGui->applicationAdded( l->type(), *l ); 261 d->serverGui->applicationAdded( l->type(), *l );
258 } 262 }
259 263
260 if ( d->sendAppLnks && d->serverGui ) 264 if ( d->sendAppLnks && d->serverGui )
261 d->serverGui->applicationScanningProgress( 100 ); 265 d->serverGui->applicationScanningProgress( 100 );
262} 266}
263 267
264void DocumentList::reloadDocLnks() 268void DocumentList::reloadDocLnks()
265{ 269{
266 if ( !d->scanDocs ) 270 if ( !d->scanDocs )
267 return; 271 return;
268 272
269 if ( d->sendDocLnks && d->serverGui ) { 273 if ( d->sendDocLnks && d->serverGui ) {
270 d->serverGui->documentScanningProgress( 0 ); 274 d->serverGui->documentScanningProgress( 0 );
271 d->serverGui->allDocumentsRemoved(); 275 d->serverGui->allDocumentsRemoved();
272 } 276 }
273 277
274 rescan(); 278 rescan();
275} 279}
276 280
277void DocumentList::linkChanged( QString arg ) 281void DocumentList::linkChanged( QString arg )
278{ 282{
279 //odebug << "linkchanged( " << arg << " )" << oendl; 283 //odebug << "linkchanged( " << arg << " )" << oendl;
280 284
281 if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) { 285 if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) {
282 reloadAppLnks(); 286 reloadAppLnks();
283 } else { 287 } else {
284 288
285 const QList<DocLnk> &list = d->dls.children(); 289 const QList<DocLnk> &list = d->dls.children();
286 QListIterator<DocLnk> it( list ); 290 QListIterator<DocLnk> it( list );
287 while ( it.current() ) { 291 while ( it.current() ) {
288 DocLnk *doc = it.current(); 292 DocLnk *doc = it.current();
289 ++it; 293 ++it;
290 if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) 294 if ( ( doc->linkFileKnown() && doc->linkFile() == arg )
291 || ( doc->fileKnown() && doc->file() == arg ) ) { 295 || ( doc->fileKnown() && doc->file() == arg ) ) {
292 //odebug << "found old link" << oendl; 296 //odebug << "found old link" << oendl;
293 DocLnk* dl = new DocLnk( arg ); 297 DocLnk* dl = new DocLnk( arg );
294 // add new one if it exists and matches the mimetype 298 // add new one if it exists and matches the mimetype
295 if ( d->store( dl ) ) { 299 if ( d->store( dl ) ) {
296 // Existing link has been changed, send old link ref and a ref 300 // Existing link has been changed, send old link ref and a ref
297 // to the new link 301 // to the new link
298 //odebug << "change case" << oendl; 302 //odebug << "change case" << oendl;
299 if ( d->serverGui ) 303 if ( d->serverGui )
300 d->serverGui->documentChanged( *doc, *dl ); 304 d->serverGui->documentChanged( *doc, *dl );
301 305
302 } else { 306 } else {
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index bf2287d..6afbcd8 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -603,174 +603,184 @@ void Launcher::select( const AppLnk *appLnk )
603void Launcher::properties( AppLnk *appLnk ) 603void Launcher::properties( AppLnk *appLnk )
604{ 604{
605 if ( appLnk->type() == "Folder" ) { // No tr 605 if ( appLnk->type() == "Folder" ) { // No tr
606 // Not supported: flat is simpler for the user 606 // Not supported: flat is simpler for the user
607 } else { 607 } else {
608/* ### libqtopia FIXME also moving docLnks... */ 608/* ### libqtopia FIXME also moving docLnks... */
609 LnkProperties prop(appLnk,0 ); 609 LnkProperties prop(appLnk,0 );
610 610
611 QPEApplication::execDialog( &prop ); 611 QPEApplication::execDialog( &prop );
612 } 612 }
613} 613}
614 614
615void Launcher::storageChanged( const QList<FileSystem> &fs ) 615void Launcher::storageChanged( const QList<FileSystem> &fs )
616{ 616{
617 // ### update combo boxes if we had a combo box for the storage type 617 // ### update combo boxes if we had a combo box for the storage type
618} 618}
619 619
620void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 620void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
621{ 621{
622 QDataStream stream( data, IO_ReadOnly ); 622 QDataStream stream( data, IO_ReadOnly );
623 if ( msg == "busy()" ) { 623 if ( msg == "busy()" ) {
624 tb->startWait(); 624 tb->startWait();
625 } else if ( msg == "notBusy(QString)" ) { 625 } else if ( msg == "notBusy(QString)" ) {
626 QString app; 626 QString app;
627 stream >> app; 627 stream >> app;
628 tabs->setBusy(FALSE); 628 tabs->setBusy(FALSE);
629 tb->stopWait(app); 629 tb->stopWait(app);
630 } else if (msg == "applyStyle()") { 630 } else if (msg == "applyStyle()") {
631 tabs->currentView()->relayout(); 631 tabs->currentView()->relayout();
632 } 632 }
633} 633}
634 634
635// These are the update functions from the server 635// These are the update functions from the server
636void Launcher::typeAdded( const QString& type, const QString& name, 636void Launcher::typeAdded( const QString& type, const QString& name,
637 const QPixmap& pixmap, const QPixmap& ) 637 const QPixmap& pixmap, const QPixmap& )
638{ 638{
639 tabs->newView( type, pixmap, name ); 639 tabs->newView( type, pixmap, name );
640 ids.append( type ); 640 ids.append( type );
641 /* this will be called in applicationScanningProgress with value 100! */ 641 /* this will be called in applicationScanningProgress with value 100! */
642// tb->refreshStartMenu(); 642// tb->refreshStartMenu();
643 643
644 static bool first = TRUE; 644 static bool first = TRUE;
645 if ( first ) { 645 if ( first ) {
646 first = FALSE; 646 first = FALSE;
647 tabs->categoryBar->showTab(type); 647 tabs->categoryBar->showTab(type);
648 } 648 }
649 649
650 tabs->view( type )->setUpdatesEnabled( FALSE ); 650 tabs->view( type )->setUpdatesEnabled( FALSE );
651 tabs->view( type )->setSortEnabled( FALSE ); 651 tabs->view( type )->setSortEnabled( FALSE );
652} 652}
653 653
654void Launcher::typeRemoved( const QString& type ) 654void Launcher::typeRemoved( const QString& type )
655{ 655{
656 tabs->view( type )->removeAllItems(); 656 tabs->view( type )->removeAllItems();
657 tabs->deleteView( type ); 657 tabs->deleteView( type );
658 ids.remove( type ); 658 ids.remove( type );
659 /* this will be called in applicationScanningProgress with value 100! */ 659 /* this will be called in applicationScanningProgress with value 100! */
660// tb->refreshStartMenu(); 660// tb->refreshStartMenu();
661} 661}
662 662
663void Launcher::applicationAdded( const QString& type, const AppLnk& app ) 663void Launcher::applicationAdded( const QString& type, const AppLnk& app )
664{ 664{
665 if ( app.type() == "Separator" ) // No tr 665 if ( app.type() == "Separator" ) // No tr
666 return; 666 return;
667 667
668 LauncherView *view = tabs->view( type ); 668 LauncherView *view = tabs->view( type );
669 if ( view ) 669 if ( view )
670 view->addItem( new AppLnk( app ), FALSE ); 670 view->addItem( new AppLnk( app ), FALSE );
671 else 671 else
672 qWarning("addAppLnk: No view for type %s. Can't add app %s!", 672 qWarning("addAppLnk: No view for type %s. Can't add app %s!",
673 type.latin1(),app.name().latin1() ); 673 type.latin1(),app.name().latin1() );
674 674
675 MimeType::registerApp( app ); 675 MimeType::registerApp( app );
676} 676}
677 677
678void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) 678void Launcher::applicationRemoved( const QString& type, const AppLnk& app )
679{ 679{
680 LauncherView *view = tabs->view( type ); 680 LauncherView *view = tabs->view( type );
681 if ( view ) 681 if ( view )
682 view->removeLink( app.linkFile() ); 682 view->removeLink( app.linkFile() );
683 else 683 else
684 owarn << "removeAppLnk: No view for " << type << "!" << oendl; 684 owarn << "removeAppLnk: No view for " << type << "!" << oendl;
685} 685}
686 686
687void Launcher::allApplicationsRemoved() 687void Launcher::allApplicationsRemoved()
688{ 688{
689 MimeType::clear(); 689 MimeType::clear();
690 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) 690 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it)
691 tabs->view( (*it) )->removeAllItems(); 691 tabs->view( (*it) )->removeAllItems();
692} 692}
693 693
694void Launcher::documentAdded( const DocLnk& doc ) 694void Launcher::documentAdded( const DocLnk& doc )
695{ 695{
696 tabs->docView()->addItem( new DocLnk( doc ), FALSE ); 696 tabs->docView()->addItem( new DocLnk( doc ), FALSE );
697} 697}
698 698
699void Launcher::aboutToAddBegin()
700{
701 tabs->docView()->setUpdatesEnabled( false );
702}
703
704void Launcher::aboutToAddEnd()
705{
706 tabs->docView()->setUpdatesEnabled( true );
707}
708
699void Launcher::showLoadingDocs() 709void Launcher::showLoadingDocs()
700{ 710{
701 tabs->docView()->hide(); 711 tabs->docView()->hide();
702} 712}
703 713
704void Launcher::showDocTab() 714void Launcher::showDocTab()
705{ 715{
706 if ( tabs->categoryBar->currentView() == tabs->docView() ) 716 if ( tabs->categoryBar->currentView() == tabs->docView() )
707 tabs->docView()->show(); 717 tabs->docView()->show();
708} 718}
709 719
710void Launcher::documentRemoved( const DocLnk& doc ) 720void Launcher::documentRemoved( const DocLnk& doc )
711{ 721{
712 tabs->docView()->removeLink( doc.linkFile() ); 722 tabs->docView()->removeLink( doc.linkFile() );
713} 723}
714 724
715void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) 725void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc )
716{ 726{
717 documentRemoved( oldDoc ); 727 documentRemoved( oldDoc );
718 documentAdded( newDoc ); 728 documentAdded( newDoc );
719} 729}
720 730
721void Launcher::allDocumentsRemoved() 731void Launcher::allDocumentsRemoved()
722{ 732{
723 tabs->docView()->removeAllItems(); 733 tabs->docView()->removeAllItems();
724} 734}
725 735
726void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) 736void Launcher::applicationStateChanged( const QString& name, ApplicationState state )
727{ 737{
728 tb->setApplicationState( name, state ); 738 tb->setApplicationState( name, state );
729} 739}
730 740
731void Launcher::applicationScanningProgress( int percent ) 741void Launcher::applicationScanningProgress( int percent )
732{ 742{
733 switch ( percent ) { 743 switch ( percent ) {
734 case 0: { 744 case 0: {
735 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { 745 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) {
736 tabs->view( (*it) )->setUpdatesEnabled( FALSE ); 746 tabs->view( (*it) )->setUpdatesEnabled( FALSE );
737 tabs->view( (*it) )->setSortEnabled( FALSE ); 747 tabs->view( (*it) )->setSortEnabled( FALSE );
738 } 748 }
739 break; 749 break;
740 } 750 }
741 case 100: { 751 case 100: {
742 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { 752 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) {
743 tabs->view( (*it) )->setUpdatesEnabled( TRUE ); 753 tabs->view( (*it) )->setUpdatesEnabled( TRUE );
744 tabs->view( (*it) )->setSortEnabled( TRUE ); 754 tabs->view( (*it) )->setSortEnabled( TRUE );
745 } 755 }
746 tb->refreshStartMenu(); 756 tb->refreshStartMenu();
747 break; 757 break;
748 } 758 }
749 default: 759 default:
750 break; 760 break;
751 } 761 }
752} 762}
753 763
754void Launcher::documentScanningProgress( int percent ) 764void Launcher::documentScanningProgress( int percent )
755{ 765{
756 switch ( percent ) { 766 switch ( percent ) {
757 case 0: { 767 case 0: {
758 tabs->setLoadingProgress( 0 ); 768 tabs->setLoadingProgress( 0 );
759 tabs->setLoadingWidgetEnabled( TRUE ); 769 tabs->setLoadingWidgetEnabled( TRUE );
760 tabs->docView()->setUpdatesEnabled( FALSE ); 770 tabs->docView()->setUpdatesEnabled( FALSE );
761 tabs->docView()->setSortEnabled( FALSE ); 771 tabs->docView()->setSortEnabled( FALSE );
762 break; 772 break;
763 } 773 }
764 case 100: { 774 case 100: {
765 tabs->docView()->updateTools(); 775 tabs->docView()->updateTools();
766 tabs->docView()->setSortEnabled( TRUE ); 776 tabs->docView()->setSortEnabled( TRUE );
767 tabs->docView()->setUpdatesEnabled( TRUE ); 777 tabs->docView()->setUpdatesEnabled( TRUE );
768 tabs->setLoadingWidgetEnabled( FALSE ); 778 tabs->setLoadingWidgetEnabled( FALSE );
769 break; 779 break;
770 } 780 }
771 default: 781 default:
772 tabs->setLoadingProgress( percent ); 782 tabs->setLoadingProgress( percent );
773 break; 783 break;
774 } 784 }
775} 785}
776 786
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h
index 4f3ff8c..29bd7db 100644
--- a/core/launcher/launcher.h
+++ b/core/launcher/launcher.h
@@ -17,141 +17,143 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef LAUNCHER_H 20#ifndef LAUNCHER_H
21#define LAUNCHER_H 21#define LAUNCHER_H
22 22
23#include <qtopia/config.h> 23#include <qtopia/config.h>
24#include <qtopia/storage.h> 24#include <qtopia/storage.h>
25#include <qtopia/applnk.h> 25#include <qtopia/applnk.h>
26#include <qmainwindow.h> 26#include <qmainwindow.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28#include <qprogressbar.h> 28#include <qprogressbar.h>
29#include <qvbox.h> 29#include <qvbox.h>
30#include <qlist.h> 30#include <qlist.h>
31#include <qdict.h> 31#include <qdict.h>
32#include "launcherview.h" 32#include "launcherview.h"
33#include "launchertab.h" 33#include "launchertab.h"
34#include "serverinterface.h" 34#include "serverinterface.h"
35 35
36class QWidgetStack; 36class QWidgetStack;
37class TaskBar; 37class TaskBar;
38class Launcher; 38class Launcher;
39 39
40class LauncherTabWidget : public QVBox { 40class LauncherTabWidget : public QVBox {
41 // can't use a QTabWidget, since it won't let us set the frame style. 41 // can't use a QTabWidget, since it won't let us set the frame style.
42 Q_OBJECT 42 Q_OBJECT
43public: 43public:
44 LauncherTabWidget( Launcher* parent ); 44 LauncherTabWidget( Launcher* parent );
45 45
46 void updateDocs(AppLnkSet* docFolder); 46 void updateDocs(AppLnkSet* docFolder);
47 void setBusy(bool on); 47 void setBusy(bool on);
48 LauncherView *currentView(void); 48 LauncherView *currentView(void);
49 49
50 LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); 50 LauncherView* newView( const QString&, const QPixmap& pm, const QString& label );
51 void deleteView( const QString& ); 51 void deleteView( const QString& );
52 void setTabViewAppearance( LauncherView *v, Config &cfg ); 52 void setTabViewAppearance( LauncherView *v, Config &cfg );
53 void setTabAppearance( LauncherTab *, Config &cfg ); 53 void setTabAppearance( LauncherTab *, Config &cfg );
54 54
55 LauncherView *view( const QString & ); 55 LauncherView *view( const QString & );
56 LauncherView *docView(); 56 LauncherView *docView();
57 57
58 void createDocLoadingWidget(); 58 void createDocLoadingWidget();
59 void setLoadingWidgetEnabled( bool v ); 59 void setLoadingWidgetEnabled( bool v );
60 void setLoadingProgress( int percent ); 60 void setLoadingProgress( int percent );
61 61
62 LauncherTabBar* categoryBar; 62 LauncherTabBar* categoryBar;
63 63
64 void setBusyIndicatorType( const QString& type ); 64 void setBusyIndicatorType( const QString& type );
65 65
66signals: 66signals:
67 void selected(const QString&); 67 void selected(const QString&);
68 void clicked(const AppLnk*); 68 void clicked(const AppLnk*);
69 void rightPressed(AppLnk*); 69 void rightPressed(AppLnk*);
70 70
71protected slots: 71protected slots:
72 void raiseTabWidget(); 72 void raiseTabWidget();
73 void tabProperties(); 73 void tabProperties();
74 void initLayout(); 74 void initLayout();
75 75
76private slots: 76private slots:
77 void launcherMessage( const QCString &, const QByteArray &); 77 void launcherMessage( const QCString &, const QByteArray &);
78 void appMessage( const QCString &, const QByteArray &); 78 void appMessage( const QCString &, const QByteArray &);
79 void setProgressStyle(); 79 void setProgressStyle();
80 80
81protected: 81protected:
82 void paletteChange( const QPalette &p ); 82 void paletteChange( const QPalette &p );
83 void styleChange( QStyle & ); 83 void styleChange( QStyle & );
84 84
85private: 85private:
86 Launcher *launcher; 86 Launcher *launcher;
87 LauncherView *docview; 87 LauncherView *docview;
88 88
89 QWidgetStack *stack; 89 QWidgetStack *stack;
90 LauncherView *docLoadingWidget; 90 LauncherView *docLoadingWidget;
91 QProgressBar *docLoadingWidgetProgress; 91 QProgressBar *docLoadingWidgetProgress;
92 bool docLoadingWidgetEnabled; 92 bool docLoadingWidgetEnabled;
93}; 93};
94 94
95class Launcher : public QMainWindow, public ServerInterface 95class Launcher : public QMainWindow, public ServerInterface
96{ 96{
97 Q_OBJECT 97 Q_OBJECT
98public: 98public:
99 Launcher(); 99 Launcher();
100 ~Launcher(); 100 ~Launcher();
101 101
102 // implementing ServerInterface 102 // implementing ServerInterface
103 void createGUI(); 103 void createGUI();
104 void destroyGUI(); 104 void destroyGUI();
105 void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ); 105 void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap );
106 void typeRemoved( const QString& type ); 106 void typeRemoved( const QString& type );
107 void applicationAdded( const QString& type, const AppLnk& doc ); 107 void applicationAdded( const QString& type, const AppLnk& doc );
108 void applicationRemoved( const QString& type, const AppLnk& doc ); 108 void applicationRemoved( const QString& type, const AppLnk& doc );
109 void allApplicationsRemoved(); 109 void allApplicationsRemoved();
110 void applicationStateChanged( const QString& name, ApplicationState state ); 110 void applicationStateChanged( const QString& name, ApplicationState state );
111 void documentAdded( const DocLnk& doc ); 111 void documentAdded( const DocLnk& doc );
112 void documentRemoved( const DocLnk& doc ); 112 void documentRemoved( const DocLnk& doc );
113 void aboutToAddBegin();
114 void aboutToAddEnd();
113 void allDocumentsRemoved(); 115 void allDocumentsRemoved();
114 void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); 116 void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc );
115 void storageChanged( const QList<FileSystem> & ); 117 void storageChanged( const QList<FileSystem> & );
116 void applicationScanningProgress( int percent ); 118 void applicationScanningProgress( int percent );
117 void documentScanningProgress( int percent ); 119 void documentScanningProgress( int percent );
118 bool requiresApplications() const { return TRUE; } 120 bool requiresApplications() const { return TRUE; }
119 bool requiresDocuments() const; 121 bool requiresDocuments() const;
120 void showLoadingDocs(); 122 void showLoadingDocs();
121 void showDocTab(); 123 void showDocTab();
122 124
123 QStringList idList() const { return ids; } 125 QStringList idList() const { return ids; }
124 126
125public slots: 127public slots:
126 void viewSelected(const QString&); 128 void viewSelected(const QString&);
127 void showTab(const QString&); 129 void showTab(const QString&);
128 void select( const AppLnk * ); 130 void select( const AppLnk * );
129 void properties( AppLnk * ); 131 void properties( AppLnk * );
130 void makeVisible(); 132 void makeVisible();
131 133
132signals: 134signals:
133 void executing( const AppLnk * ); 135 void executing( const AppLnk * );
134 136
135private slots: 137private slots:
136 void systemMessage( const QCString &, const QByteArray &); 138 void systemMessage( const QCString &, const QByteArray &);
137 void toggleSymbolInput(); 139 void toggleSymbolInput();
138 void toggleNumLockState(); 140 void toggleNumLockState();
139 void toggleCapsLockState(); 141 void toggleCapsLockState();
140 142
141protected: 143protected:
142 bool eventFilter( QObject *o, QEvent *ev ); 144 bool eventFilter( QObject *o, QEvent *ev );
143 145
144private: 146private:
145 void updateApps(); 147 void updateApps();
146 void loadDocs(); 148 void loadDocs();
147 void updateDocs(); 149 void updateDocs();
148 void updateTabs(); 150 void updateTabs();
149 151
150 LauncherTabWidget *tabs; 152 LauncherTabWidget *tabs;
151 QStringList ids; 153 QStringList ids;
152 TaskBar *tb; 154 TaskBar *tb;
153 155
154 bool docTabEnabled; 156 bool docTabEnabled;
155}; 157};
156 158
157#endif // LAUNCHERVIEW_H 159#endif // LAUNCHERVIEW_H
diff --git a/core/launcher/serverinterface.h b/core/launcher/serverinterface.h
index e57ea51..132766f 100644
--- a/core/launcher/serverinterface.h
+++ b/core/launcher/serverinterface.h
@@ -1,72 +1,74 @@
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 SERVER_INTERFACE_H 20#ifndef SERVER_INTERFACE_H
21#define SERVER_INTERFACE_H 21#define SERVER_INTERFACE_H
22 22
23 23
24#include <qstring.h> 24#include <qstring.h>
25#include <qpixmap.h> 25#include <qpixmap.h>
26#include <qwidget.h> 26#include <qwidget.h>
27#include <qtopia/applnk.h> 27#include <qtopia/applnk.h>
28#include <qtopia/storage.h> 28#include <qtopia/storage.h>
29 29
30 30
31class ServerInterface { 31class ServerInterface {
32public: 32public:
33 virtual ~ServerInterface(); 33 virtual ~ServerInterface();
34 34
35 virtual void createGUI() = 0; 35 virtual void createGUI() = 0;
36 virtual void destroyGUI() = 0; 36 virtual void destroyGUI() = 0;
37 37
38 // These notify of the application categories, like what is used in the current launcher tabs, 38 // These notify of the application categories, like what is used in the current launcher tabs,
39 // for example "Applications", "Games" etc. 39 // for example "Applications", "Games" etc.
40 virtual void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ) = 0; 40 virtual void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ) = 0;
41 virtual void typeRemoved( const QString& type ) = 0; 41 virtual void typeRemoved( const QString& type ) = 0;
42 42
43 // These functions notify when an application is added or removed and to which category it belongs 43 // These functions notify when an application is added or removed and to which category it belongs
44 virtual void applicationAdded( const QString& type, const AppLnk& doc ) = 0; 44 virtual void applicationAdded( const QString& type, const AppLnk& doc ) = 0;
45 virtual void applicationRemoved( const QString& type, const AppLnk& doc ) = 0; 45 virtual void applicationRemoved( const QString& type, const AppLnk& doc ) = 0;
46 virtual void allApplicationsRemoved() = 0; 46 virtual void allApplicationsRemoved() = 0;
47 // Useful for wait icons, or running application lists etc 47 // Useful for wait icons, or running application lists etc
48 enum ApplicationState { Launching, Running, Terminated }; 48 enum ApplicationState { Launching, Running, Terminated };
49 virtual void applicationStateChanged( const QString& name, ApplicationState state ) = 0; 49 virtual void applicationStateChanged( const QString& name, ApplicationState state ) = 0;
50 static const AppLnkSet& appLnks(); 50 static const AppLnkSet& appLnks();
51 51
52 // These functions notify of adding, removal and changes of document links used in the documents tab for example 52 // These functions notify of adding, removal and changes of document links used in the documents tab for example
53 virtual void aboutToAddBegin() {}
54 virtual void aboutToAddEnd() {}
53 virtual void documentAdded( const DocLnk& doc ) = 0; 55 virtual void documentAdded( const DocLnk& doc ) = 0;
54 virtual void documentRemoved( const DocLnk& doc ) = 0; 56 virtual void documentRemoved( const DocLnk& doc ) = 0;
55 virtual void allDocumentsRemoved() = 0; 57 virtual void allDocumentsRemoved() = 0;
56 virtual void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) = 0; 58 virtual void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) = 0;
57 59
58 virtual void storageChanged( const QList<FileSystem> & ) = 0; 60 virtual void storageChanged( const QList<FileSystem> & ) = 0;
59 61
60 virtual void applicationScanningProgress( int percent ) = 0; 62 virtual void applicationScanningProgress( int percent ) = 0;
61 virtual void documentScanningProgress( int percent ) = 0; 63 virtual void documentScanningProgress( int percent ) = 0;
62 64
63 // Tells the server if the GUI needs to be updated about documents or applnks 65 // Tells the server if the GUI needs to be updated about documents or applnks
64 virtual bool requiresApplications() const = 0; 66 virtual bool requiresApplications() const = 0;
65 virtual bool requiresDocuments() const = 0; 67 virtual bool requiresDocuments() const = 0;
66 68
67 enum DockArea { Top, Bottom, Left, Right }; 69 enum DockArea { Top, Bottom, Left, Right };
68 static void dockWidget( QWidget *w, DockArea placement ); 70 static void dockWidget( QWidget *w, DockArea placement );
69}; 71};
70 72
71 73
72#endif // SERVER_INTERFACE_H 74#endif // SERVER_INTERFACE_H