author | zecke <zecke> | 2004-04-19 07:12:16 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-19 07:12:16 (UTC) |
commit | 0b59a16b5a5a179c46ddb3f8c585dbca59b2826e (patch) (unidiff) | |
tree | 3780a3ae09806e781582aefb23ad3040bc15d816 | |
parent | 359b681f32d5c3ac2ea3bfd39a3637d211338bf7 (diff) | |
download | opie-0b59a16b5a5a179c46ddb3f8c585dbca59b2826e.zip opie-0b59a16b5a5a179c46ddb3f8c585dbca59b2826e.tar.gz opie-0b59a16b5a5a179c46ddb3f8c585dbca59b2826e.tar.bz2 |
Small interface update. If we add doctypes disable the viewport() for
updates
-rw-r--r-- | core/launcher/documentlist.cpp | 8 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 10 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 | ||||
-rw-r--r-- | core/launcher/serverinterface.h | 2 |
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,398 +1,402 @@ | |||
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 |
37 | using namespace Opie::Core; | 37 | using 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 | ||
53 | AppLnkSet *DocumentList::appLnkSet = 0; | 53 | AppLnkSet *DocumentList::appLnkSet = 0; |
54 | 54 | ||
55 | static const int MAX_SEARCH_DEPTH = 10; | 55 | static const int MAX_SEARCH_DEPTH = 10; |
56 | 56 | ||
57 | 57 | ||
58 | class DocumentListPrivate : public QObject { | 58 | class DocumentListPrivate : public QObject { |
59 | Q_OBJECT | 59 | Q_OBJECT |
60 | public: | 60 | public: |
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 | */ |
102 | DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/, | 102 | DocumentList::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 | ||
118 | void DocumentList::startInitialScan() | 118 | void DocumentList::startInitialScan() |
119 | { | 119 | { |
120 | reloadAppLnks(); | 120 | reloadAppLnks(); |
121 | reloadDocLnks(); | 121 | reloadDocLnks(); |
122 | } | 122 | } |
123 | 123 | ||
124 | DocumentList::~DocumentList() | 124 | DocumentList::~DocumentList() |
125 | { | 125 | { |
126 | delete appLnkSet; | 126 | delete appLnkSet; |
127 | delete d; | 127 | delete d; |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
131 | void DocumentList::add( const DocLnk& doc ) | 131 | void 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 | ||
138 | void DocumentList::start() | 138 | void DocumentList::start() |
139 | { | 139 | { |
140 | resume(); | 140 | resume(); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | void DocumentList::pause() | 144 | void 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 | ||
152 | void DocumentList::resume() | 152 | void 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 | /* |
161 | void DocumentList::resend() | 161 | void 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 | ||
171 | void DocumentList::resendWorker() | 171 | void 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 | ||
180 | void DocumentList::rescan() | 180 | void 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 | ||
189 | void DocumentList::timerEvent( QTimerEvent *te ) | 189 | void 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 | ||
211 | void DocumentList::reloadAppLnks() | 215 | void 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 | ||
264 | void DocumentList::reloadDocLnks() | 268 | void 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 | ||
277 | void DocumentList::linkChanged( QString arg ) | 281 | void 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 { |
303 | // Link has been removed or doesn't match the mimetypes any more | 307 | // 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 | 308 | // so we aren't interested in it, so take it away from the list |
305 | //odebug << "removal case" << oendl; | 309 | //odebug << "removal case" << oendl; |
306 | if ( d->serverGui ) | 310 | if ( d->serverGui ) |
307 | d->serverGui->documentRemoved( *doc ); | 311 | d->serverGui->documentRemoved( *doc ); |
308 | 312 | ||
309 | } | 313 | } |
310 | d->dls.remove( doc ); // remove old link from docLnkSet | 314 | d->dls.remove( doc ); // remove old link from docLnkSet |
311 | delete doc; | 315 | delete doc; |
312 | return; | 316 | return; |
313 | } | 317 | } |
314 | } | 318 | } |
315 | // Didn't find existing link, must be new | 319 | // Didn't find existing link, must be new |
316 | DocLnk* dl = new DocLnk( arg ); | 320 | DocLnk* dl = new DocLnk( arg ); |
317 | if ( d->store( dl ) ) { | 321 | if ( d->store( dl ) ) { |
318 | // Add if it's a link we are interested in | 322 | // Add if it's a link we are interested in |
319 | //odebug << "add case" << oendl; | 323 | //odebug << "add case" << oendl; |
320 | add( *dl ); | 324 | add( *dl ); |
321 | } | 325 | } |
322 | 326 | ||
323 | } | 327 | } |
324 | } | 328 | } |
325 | 329 | ||
326 | void DocumentList::restoreDone() | 330 | void DocumentList::restoreDone() |
327 | { | 331 | { |
328 | reloadAppLnks(); | 332 | reloadAppLnks(); |
329 | reloadDocLnks(); | 333 | reloadDocLnks(); |
330 | } | 334 | } |
331 | 335 | ||
332 | void DocumentList::DiffAppLnks() | 336 | void DocumentList::DiffAppLnks() |
333 | { | 337 | { |
334 | static AppLnkSet *appLnkSet2; | 338 | static AppLnkSet *appLnkSet2; |
335 | 339 | ||
336 | appLnkSet2 = new AppLnkSet( MimeType::appsFolderName() ); | 340 | appLnkSet2 = new AppLnkSet( MimeType::appsFolderName() ); |
337 | 341 | ||
338 | if ( d->sendAppLnks && d->serverGui ) { | 342 | if ( d->sendAppLnks && d->serverGui ) { |
339 | static QStringList prevTypeList = appLnkSet->types(); | 343 | static QStringList prevTypeList = appLnkSet->types(); |
340 | QStringList types = appLnkSet2->types(); | 344 | QStringList types = appLnkSet2->types(); |
341 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { | 345 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { |
342 | if ( !(*ittypes).isEmpty() ) { | 346 | if ( !(*ittypes).isEmpty() ) { |
343 | if ( !prevTypeList.contains(*ittypes) ) { | 347 | if ( !prevTypeList.contains(*ittypes) ) { |
344 | QString name = appLnkSet2->typeName(*ittypes); | 348 | QString name = appLnkSet2->typeName(*ittypes); |
345 | QPixmap pm = appLnkSet2->typePixmap(*ittypes); | 349 | QPixmap pm = appLnkSet2->typePixmap(*ittypes); |
346 | QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes); | 350 | QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes); |
347 | 351 | ||
348 | if (pm.isNull()) { | 352 | if (pm.isNull()) { |
349 | QImage img( Resource::loadImage( "UnknownDocument" ) ); | 353 | QImage img( Resource::loadImage( "UnknownDocument" ) ); |
350 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 354 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
351 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); | 355 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); |
352 | } | 356 | } |
353 | 357 | ||
354 | odebug << "adding type " << (*ittypes) << "" << oendl; | 358 | odebug << "adding type " << (*ittypes) << "" << oendl; |
355 | 359 | ||
356 | // ### our current launcher expects docs tab to be last | 360 | // ### our current launcher expects docs tab to be last |
357 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); | 361 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); |
358 | } | 362 | } |
359 | prevTypeList.remove(*ittypes); | 363 | prevTypeList.remove(*ittypes); |
360 | } | 364 | } |
361 | } | 365 | } |
362 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { | 366 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { |
363 | odebug << "removing type " << (*ittypes) << "" << oendl; | 367 | odebug << "removing type " << (*ittypes) << "" << oendl; |
364 | d->serverGui->typeRemoved(*ittypes); | 368 | d->serverGui->typeRemoved(*ittypes); |
365 | } | 369 | } |
366 | prevTypeList = types; | 370 | prevTypeList = types; |
367 | } | 371 | } |
368 | 372 | ||
369 | 373 | ||
370 | QListIterator<AppLnk> it1( appLnkSet->children() ); | 374 | QListIterator<AppLnk> it1( appLnkSet->children() ); |
371 | QListIterator<AppLnk> it2( appLnkSet2->children() ); | 375 | QListIterator<AppLnk> it2( appLnkSet2->children() ); |
372 | 376 | ||
373 | AppLnk *i; | 377 | AppLnk *i; |
374 | AppLnk *j; | 378 | AppLnk *j; |
375 | bool found; | 379 | bool found; |
376 | 380 | ||
377 | while ( (j=it2.current()) ) { | 381 | while ( (j=it2.current()) ) { |
378 | it1 = appLnkSet->children(); | 382 | it1 = appLnkSet->children(); |
379 | found = false; | 383 | found = false; |
380 | while ( (i=it1.current()) ){ | 384 | while ( (i=it1.current()) ){ |
381 | if (strcmp(i->name().ascii(),j->name().ascii()) == 0) | 385 | if (strcmp(i->name().ascii(),j->name().ascii()) == 0) |
382 | found = true; | 386 | found = true; |
383 | ++it1; | 387 | ++it1; |
384 | } | 388 | } |
385 | if (!found) { | 389 | if (!found) { |
386 | qDebug("Item %s needs to be added",j->name().ascii() ); | 390 | qDebug("Item %s needs to be added",j->name().ascii() ); |
387 | d->serverGui->applicationAdded( j->type(), *j ); | 391 | d->serverGui->applicationAdded( j->type(), *j ); |
388 | } | 392 | } |
389 | ++it2; | 393 | ++it2; |
390 | } | 394 | } |
391 | 395 | ||
392 | it1 = appLnkSet->children(); | 396 | it1 = appLnkSet->children(); |
393 | while ( (i=it1.current()) ) { | 397 | while ( (i=it1.current()) ) { |
394 | it2 = appLnkSet2->children(); | 398 | it2 = appLnkSet2->children(); |
395 | found = false; | 399 | found = false; |
396 | while ( (j=it2.current()) ){ | 400 | while ( (j=it2.current()) ){ |
397 | if (strcmp(i->name().ascii(),j->name().ascii()) == 0) | 401 | if (strcmp(i->name().ascii(),j->name().ascii()) == 0) |
398 | found = true; | 402 | found = true; |
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 | |||
@@ -507,270 +507,280 @@ Launcher::~Launcher() | |||
507 | void Launcher::makeVisible() | 507 | void Launcher::makeVisible() |
508 | { | 508 | { |
509 | showMaximized(); | 509 | showMaximized(); |
510 | } | 510 | } |
511 | 511 | ||
512 | void Launcher::destroyGUI() | 512 | void Launcher::destroyGUI() |
513 | { | 513 | { |
514 | delete tb; | 514 | delete tb; |
515 | tb = 0; | 515 | tb = 0; |
516 | delete tabs; | 516 | delete tabs; |
517 | tabs =0; | 517 | tabs =0; |
518 | } | 518 | } |
519 | 519 | ||
520 | bool Launcher::eventFilter( QObject*, QEvent *ev ) | 520 | bool Launcher::eventFilter( QObject*, QEvent *ev ) |
521 | { | 521 | { |
522 | #ifdef QT_QWS_CUSTOM | 522 | #ifdef QT_QWS_CUSTOM |
523 | if ( ev->type() == QEvent::KeyPress ) { | 523 | if ( ev->type() == QEvent::KeyPress ) { |
524 | QKeyEvent *ke = (QKeyEvent *)ev; | 524 | QKeyEvent *ke = (QKeyEvent *)ev; |
525 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 525 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
526 | QWidget *active = qApp->activeWindow(); | 526 | QWidget *active = qApp->activeWindow(); |
527 | if ( active && active->isPopup() ) | 527 | if ( active && active->isPopup() ) |
528 | active->close(); | 528 | active->close(); |
529 | else { | 529 | else { |
530 | Global::terminateBuiltin("calibrate"); // No tr | 530 | Global::terminateBuiltin("calibrate"); // No tr |
531 | tb->launchStartMenu(); | 531 | tb->launchStartMenu(); |
532 | } | 532 | } |
533 | return TRUE; | 533 | return TRUE; |
534 | } | 534 | } |
535 | } | 535 | } |
536 | #else | 536 | #else |
537 | Q_UNUSED(ev); | 537 | Q_UNUSED(ev); |
538 | #endif | 538 | #endif |
539 | return FALSE; | 539 | return FALSE; |
540 | } | 540 | } |
541 | 541 | ||
542 | void Launcher::toggleSymbolInput() | 542 | void Launcher::toggleSymbolInput() |
543 | { | 543 | { |
544 | tb->toggleSymbolInput(); | 544 | tb->toggleSymbolInput(); |
545 | } | 545 | } |
546 | 546 | ||
547 | void Launcher::toggleNumLockState() | 547 | void Launcher::toggleNumLockState() |
548 | { | 548 | { |
549 | tb->toggleNumLockState(); | 549 | tb->toggleNumLockState(); |
550 | } | 550 | } |
551 | 551 | ||
552 | void Launcher::toggleCapsLockState() | 552 | void Launcher::toggleCapsLockState() |
553 | { | 553 | { |
554 | tb->toggleCapsLockState(); | 554 | tb->toggleCapsLockState(); |
555 | } | 555 | } |
556 | 556 | ||
557 | static bool isVisibleWindow(int wid) | 557 | static bool isVisibleWindow(int wid) |
558 | { | 558 | { |
559 | #ifdef Q_WS_QWS | 559 | #ifdef Q_WS_QWS |
560 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 560 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
561 | QWSWindow* w; | 561 | QWSWindow* w; |
562 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 562 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
563 | if ( w->winId() == wid ) | 563 | if ( w->winId() == wid ) |
564 | return !w->isFullyObscured(); | 564 | return !w->isFullyObscured(); |
565 | } | 565 | } |
566 | #endif | 566 | #endif |
567 | return FALSE; | 567 | return FALSE; |
568 | } | 568 | } |
569 | 569 | ||
570 | void Launcher::viewSelected(const QString& s) | 570 | void Launcher::viewSelected(const QString& s) |
571 | { | 571 | { |
572 | setCaption( s + tr(" - Launcher") ); | 572 | setCaption( s + tr(" - Launcher") ); |
573 | } | 573 | } |
574 | 574 | ||
575 | void Launcher::showTab(const QString& id) | 575 | void Launcher::showTab(const QString& id) |
576 | { | 576 | { |
577 | tabs->categoryBar->showTab(id); | 577 | tabs->categoryBar->showTab(id); |
578 | raise(); | 578 | raise(); |
579 | } | 579 | } |
580 | 580 | ||
581 | void Launcher::select( const AppLnk *appLnk ) | 581 | void Launcher::select( const AppLnk *appLnk ) |
582 | { | 582 | { |
583 | if ( appLnk->type() == "Folder" ) { // No tr | 583 | if ( appLnk->type() == "Folder" ) { // No tr |
584 | // Not supported: flat is simpler for the user | 584 | // Not supported: flat is simpler for the user |
585 | } else { | 585 | } else { |
586 | if ( appLnk->exec().isNull() ) { | 586 | if ( appLnk->exec().isNull() ) { |
587 | int i = QMessageBox::information(this,tr("No application"), | 587 | int i = QMessageBox::information(this,tr("No application"), |
588 | tr("<p>No application is defined for this document." | 588 | tr("<p>No application is defined for this document." |
589 | "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); | 589 | "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); |
590 | 590 | ||
591 | /* ### Fixme */ | 591 | /* ### Fixme */ |
592 | if ( i == 1 ) | 592 | if ( i == 1 ) |
593 | Global::execute("textedit",appLnk->file()); | 593 | Global::execute("textedit",appLnk->file()); |
594 | 594 | ||
595 | return; | 595 | return; |
596 | } | 596 | } |
597 | tabs->setBusy(TRUE); | 597 | tabs->setBusy(TRUE); |
598 | emit executing( appLnk ); | 598 | emit executing( appLnk ); |
599 | appLnk->execute(); | 599 | appLnk->execute(); |
600 | } | 600 | } |
601 | } | 601 | } |
602 | 602 | ||
603 | void Launcher::properties( AppLnk *appLnk ) | 603 | void 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 | ||
615 | void Launcher::storageChanged( const QList<FileSystem> &fs ) | 615 | void 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 | ||
620 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | 620 | void 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 |
636 | void Launcher::typeAdded( const QString& type, const QString& name, | 636 | void 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 | ||
654 | void Launcher::typeRemoved( const QString& type ) | 654 | void 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 | ||
663 | void Launcher::applicationAdded( const QString& type, const AppLnk& app ) | 663 | void 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 | ||
678 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) | 678 | void 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 | ||
687 | void Launcher::allApplicationsRemoved() | 687 | void 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 | ||
694 | void Launcher::documentAdded( const DocLnk& doc ) | 694 | void 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 | ||
699 | void Launcher::aboutToAddBegin() | ||
700 | { | ||
701 | tabs->docView()->setUpdatesEnabled( false ); | ||
702 | } | ||
703 | |||
704 | void Launcher::aboutToAddEnd() | ||
705 | { | ||
706 | tabs->docView()->setUpdatesEnabled( true ); | ||
707 | } | ||
708 | |||
699 | void Launcher::showLoadingDocs() | 709 | void Launcher::showLoadingDocs() |
700 | { | 710 | { |
701 | tabs->docView()->hide(); | 711 | tabs->docView()->hide(); |
702 | } | 712 | } |
703 | 713 | ||
704 | void Launcher::showDocTab() | 714 | void 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 | ||
710 | void Launcher::documentRemoved( const DocLnk& doc ) | 720 | void Launcher::documentRemoved( const DocLnk& doc ) |
711 | { | 721 | { |
712 | tabs->docView()->removeLink( doc.linkFile() ); | 722 | tabs->docView()->removeLink( doc.linkFile() ); |
713 | } | 723 | } |
714 | 724 | ||
715 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) | 725 | void 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 | ||
721 | void Launcher::allDocumentsRemoved() | 731 | void Launcher::allDocumentsRemoved() |
722 | { | 732 | { |
723 | tabs->docView()->removeAllItems(); | 733 | tabs->docView()->removeAllItems(); |
724 | } | 734 | } |
725 | 735 | ||
726 | void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) | 736 | void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) |
727 | { | 737 | { |
728 | tb->setApplicationState( name, state ); | 738 | tb->setApplicationState( name, state ); |
729 | } | 739 | } |
730 | 740 | ||
731 | void Launcher::applicationScanningProgress( int percent ) | 741 | void 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 | ||
754 | void Launcher::documentScanningProgress( int percent ) | 764 | void 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 | |||
@@ -1,157 +1,159 @@ | |||
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 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 | ||
36 | class QWidgetStack; | 36 | class QWidgetStack; |
37 | class TaskBar; | 37 | class TaskBar; |
38 | class Launcher; | 38 | class Launcher; |
39 | 39 | ||
40 | class LauncherTabWidget : public QVBox { | 40 | class 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 |
43 | public: | 43 | public: |
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 | ||
66 | signals: | 66 | signals: |
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 | ||
71 | protected slots: | 71 | protected slots: |
72 | void raiseTabWidget(); | 72 | void raiseTabWidget(); |
73 | void tabProperties(); | 73 | void tabProperties(); |
74 | void initLayout(); | 74 | void initLayout(); |
75 | 75 | ||
76 | private slots: | 76 | private 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 | ||
81 | protected: | 81 | protected: |
82 | void paletteChange( const QPalette &p ); | 82 | void paletteChange( const QPalette &p ); |
83 | void styleChange( QStyle & ); | 83 | void styleChange( QStyle & ); |
84 | 84 | ||
85 | private: | 85 | private: |
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 | ||
95 | class Launcher : public QMainWindow, public ServerInterface | 95 | class Launcher : public QMainWindow, public ServerInterface |
96 | { | 96 | { |
97 | Q_OBJECT | 97 | Q_OBJECT |
98 | public: | 98 | public: |
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 | ||
125 | public slots: | 127 | public 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 | ||
132 | signals: | 134 | signals: |
133 | void executing( const AppLnk * ); | 135 | void executing( const AppLnk * ); |
134 | 136 | ||
135 | private slots: | 137 | private 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 | ||
141 | protected: | 143 | protected: |
142 | bool eventFilter( QObject *o, QEvent *ev ); | 144 | bool eventFilter( QObject *o, QEvent *ev ); |
143 | 145 | ||
144 | private: | 146 | private: |
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 | ||
31 | class ServerInterface { | 31 | class ServerInterface { |
32 | public: | 32 | public: |
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 |