-rw-r--r-- | core/launcher/documentlist.cpp | 22 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 16 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 |
3 files changed, 15 insertions, 25 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index dcea4b9..1a7de33 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp | |||
@@ -1,378 +1,368 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "documentlist.h" | 20 | #include "documentlist.h" |
21 | #include "serverinterface.h" | 21 | #include "serverinterface.h" |
22 | #include "launcherglobal.h" | 22 | #include "launcherglobal.h" |
23 | 23 | ||
24 | #include <qtopia/config.h> | 24 | #include <qtopia/config.h> |
25 | #include <qtopia/mimetype.h> | 25 | #include <qtopia/mimetype.h> |
26 | #include <qtopia/resource.h> | 26 | #include <qtopia/resource.h> |
27 | #include <qtopia/global.h> | 27 | #include <qtopia/global.h> |
28 | #include <qtopia/private/categories.h> | 28 | #include <qtopia/private/categories.h> |
29 | #include <qtopia/qpeapplication.h> | 29 | #include <qtopia/qpeapplication.h> |
30 | #include <qtopia/applnk.h> | 30 | #include <qtopia/applnk.h> |
31 | #include <qtopia/storage.h> | 31 | #include <qtopia/storage.h> |
32 | #ifdef Q_WS_QWS | 32 | #ifdef Q_WS_QWS |
33 | #include <qtopia/qcopenvelope_qws.h> | 33 | #include <qtopia/qcopenvelope_qws.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qfileinfo.h> | 37 | #include <qfileinfo.h> |
38 | #include <qtextstream.h> | 38 | #include <qtextstream.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qdir.h> | 40 | #include <qdir.h> |
41 | #include <qpainter.h> | 41 | #include <qpainter.h> |
42 | #include <qimage.h> | 42 | #include <qimage.h> |
43 | #include <qcopchannel_qws.h> | 43 | #include <qcopchannel_qws.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | #include <qlist.h> | 45 | #include <qlist.h> |
46 | #include <qpixmap.h> | 46 | #include <qpixmap.h> |
47 | 47 | ||
48 | 48 | ||
49 | AppLnkSet *DocumentList::appLnkSet = 0; | 49 | AppLnkSet *DocumentList::appLnkSet = 0; |
50 | 50 | ||
51 | static const int MAX_SEARCH_DEPTH = 10; | 51 | static const int MAX_SEARCH_DEPTH = 10; |
52 | 52 | ||
53 | 53 | ||
54 | class DocumentListPrivate : public QObject { | 54 | class DocumentListPrivate : public QObject { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | public: | 56 | public: |
57 | DocumentListPrivate( ServerInterface *gui ); | 57 | DocumentListPrivate( ServerInterface *gui ); |
58 | ~DocumentListPrivate(); | 58 | ~DocumentListPrivate(); |
59 | 59 | ||
60 | void initialize(); | 60 | void initialize(); |
61 | 61 | ||
62 | const QString nextFile(); | 62 | const QString nextFile(); |
63 | const DocLnk *iterate(); | 63 | const DocLnk *iterate(); |
64 | bool store( DocLnk* dl ); | 64 | bool store( DocLnk* dl ); |
65 | void estimatedPercentScanned(); | 65 | void estimatedPercentScanned(); |
66 | 66 | ||
67 | DocLnkSet dls; | 67 | DocLnkSet dls; |
68 | QDict<void> reference; | 68 | QDict<void> reference; |
69 | QDictIterator<void> *dit; | 69 | QDictIterator<void> *dit; |
70 | enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; | 70 | enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; |
71 | 71 | ||
72 | QStringList docPaths; | 72 | QStringList docPaths; |
73 | unsigned int docPathsSearched; | 73 | unsigned int docPathsSearched; |
74 | 74 | ||
75 | int searchDepth; | 75 | int searchDepth; |
76 | QDir *listDirs[MAX_SEARCH_DEPTH]; | 76 | QDir *listDirs[MAX_SEARCH_DEPTH]; |
77 | const QFileInfoList *lists[MAX_SEARCH_DEPTH]; | 77 | const QFileInfoList *lists[MAX_SEARCH_DEPTH]; |
78 | unsigned int listPositions[MAX_SEARCH_DEPTH]; | 78 | unsigned int listPositions[MAX_SEARCH_DEPTH]; |
79 | 79 | ||
80 | StorageInfo *storage; | 80 | StorageInfo *storage; |
81 | 81 | ||
82 | int tid; | 82 | int tid; |
83 | 83 | ||
84 | ServerInterface *serverGui; | 84 | ServerInterface *serverGui; |
85 | 85 | ||
86 | bool needToSendAllDocLinks; | 86 | bool needToSendAllDocLinks; |
87 | bool sendAppLnks; | 87 | bool sendAppLnks; |
88 | bool sendDocLnks; | 88 | bool sendDocLnks; |
89 | bool scanDocs; | 89 | bool scanDocs; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | 92 | ||
93 | DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, | 93 | DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, |
94 | QObject *parent, const char *name ) | 94 | QObject *parent, const char *name ) |
95 | : QObject( parent, name ) | 95 | : QObject( parent, name ) |
96 | { | 96 | { |
97 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); | 97 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); |
98 | d = new DocumentListPrivate( serverGui ); | 98 | d = new DocumentListPrivate( serverGui ); |
99 | d->scanDocs = scanDocs; | ||
100 | d->needToSendAllDocLinks = false; | 99 | d->needToSendAllDocLinks = false; |
101 | 100 | ||
101 | Config cfg( "Launcher" ); | ||
102 | cfg.setGroup( "DocTab" ); | ||
103 | d->scanDocs = cfg.readBoolEntry( "Enable", true ); | ||
104 | qDebug( "DocumentList::DocumentList() : scanDocs = %d", d->scanDocs ); | ||
105 | |||
102 | QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); | 106 | QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); |
103 | } | 107 | } |
104 | 108 | ||
105 | void DocumentList::startInitialScan() | 109 | void DocumentList::startInitialScan() |
106 | { | 110 | { |
107 | reloadAppLnks(); | 111 | reloadAppLnks(); |
108 | 112 | reloadDocLnks(); | |
109 | Config cfg( "Launcher" ); | ||
110 | cfg.setGroup( "DocTab" ); | ||
111 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); | ||
112 | if ( docTabEnabled ) | ||
113 | reloadDocLnks(); | ||
114 | else | ||
115 | { | ||
116 | if ( d->sendDocLnks && d->serverGui ) | ||
117 | { | ||
118 | d->serverGui->documentScanningProgress( 0 ); | ||
119 | d->serverGui->allDocumentsRemoved(); | ||
120 | } | ||
121 | } | ||
122 | |||
123 | } | 113 | } |
124 | 114 | ||
125 | DocumentList::~DocumentList() | 115 | DocumentList::~DocumentList() |
126 | { | 116 | { |
127 | delete appLnkSet; | 117 | delete appLnkSet; |
128 | delete d; | 118 | delete d; |
129 | } | 119 | } |
130 | 120 | ||
131 | 121 | ||
132 | void DocumentList::add( const DocLnk& doc ) | 122 | void DocumentList::add( const DocLnk& doc ) |
133 | { | 123 | { |
134 | if ( d->serverGui && QFile::exists( doc.file() ) ) | 124 | if ( d->serverGui && QFile::exists( doc.file() ) ) |
135 | d->serverGui->documentAdded( doc ); | 125 | d->serverGui->documentAdded( doc ); |
136 | } | 126 | } |
137 | 127 | ||
138 | 128 | ||
139 | void DocumentList::start() | 129 | void DocumentList::start() |
140 | { | 130 | { |
141 | resume(); | 131 | resume(); |
142 | } | 132 | } |
143 | 133 | ||
144 | 134 | ||
145 | void DocumentList::pause() | 135 | void DocumentList::pause() |
146 | { | 136 | { |
147 | //qDebug("pause %i", d->tid); | 137 | //qDebug("pause %i", d->tid); |
148 | killTimer( d->tid ); | 138 | killTimer( d->tid ); |
149 | d->tid = 0; | 139 | d->tid = 0; |
150 | } | 140 | } |
151 | 141 | ||
152 | 142 | ||
153 | void DocumentList::resume() | 143 | void DocumentList::resume() |
154 | { | 144 | { |
155 | if ( d->tid == 0 ) { | 145 | if ( d->tid == 0 ) { |
156 | d->tid = startTimer( 0 ); | 146 | d->tid = startTimer( 0 ); |
157 | //qDebug("resumed %i", d->tid); | 147 | //qDebug("resumed %i", d->tid); |
158 | } | 148 | } |
159 | } | 149 | } |
160 | 150 | ||
161 | /* | 151 | /* |
162 | void DocumentList::resend() | 152 | void DocumentList::resend() |
163 | { | 153 | { |
164 | // Re-emits all the added items to the list (firstly letting everyone know to | 154 | // Re-emits all the added items to the list (firstly letting everyone know to |
165 | // clear what they have as it is being sent again) | 155 | // clear what they have as it is being sent again) |
166 | pause(); | 156 | pause(); |
167 | emit allRemoved(); | 157 | emit allRemoved(); |
168 | QTimer::singleShot( 5, this, SLOT( resendWorker() ) ); | 158 | QTimer::singleShot( 5, this, SLOT( resendWorker() ) ); |
169 | } | 159 | } |
170 | 160 | ||
171 | 161 | ||
172 | void DocumentList::resendWorker() | 162 | void DocumentList::resendWorker() |
173 | { | 163 | { |
174 | const QList<DocLnk> &list = d->dls.children(); | 164 | const QList<DocLnk> &list = d->dls.children(); |
175 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) | 165 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) |
176 | add( *(*it) ); | 166 | add( *(*it) ); |
177 | resume(); | 167 | resume(); |
178 | } | 168 | } |
179 | */ | 169 | */ |
180 | 170 | ||
181 | void DocumentList::rescan() | 171 | void DocumentList::rescan() |
182 | { | 172 | { |
183 | //qDebug("rescan"); | 173 | //qDebug("rescan"); |
184 | pause(); | 174 | pause(); |
185 | d->initialize(); | 175 | d->initialize(); |
186 | resume(); | 176 | resume(); |
187 | } | 177 | } |
188 | 178 | ||
189 | 179 | ||
190 | void DocumentList::timerEvent( QTimerEvent *te ) | 180 | void DocumentList::timerEvent( QTimerEvent *te ) |
191 | { | 181 | { |
192 | if ( te->timerId() == d->tid ) { | 182 | if ( te->timerId() == d->tid ) { |
193 | // Do 3 at a time | 183 | // Do 3 at a time |
194 | for (int i = 0; i < 3; i++ ) { | 184 | for (int i = 0; i < 3; i++ ) { |
195 | const DocLnk *lnk = d->iterate(); | 185 | const DocLnk *lnk = d->iterate(); |
196 | if ( lnk ) { | 186 | if ( lnk ) { |
197 | add( *lnk ); | 187 | add( *lnk ); |
198 | } else { | 188 | } else { |
199 | // stop when done | 189 | // stop when done |
200 | pause(); | 190 | pause(); |
201 | if ( d->serverGui ) | 191 | if ( d->serverGui ) |
202 | d->serverGui->documentScanningProgress( 100 ); | 192 | d->serverGui->documentScanningProgress( 100 ); |
203 | if ( d->needToSendAllDocLinks ) | 193 | if ( d->needToSendAllDocLinks ) |
204 | sendAllDocLinks(); | 194 | sendAllDocLinks(); |
205 | break; | 195 | break; |
206 | } | 196 | } |
207 | } | 197 | } |
208 | } | 198 | } |
209 | } | 199 | } |
210 | 200 | ||
211 | 201 | ||
212 | void DocumentList::reloadAppLnks() | 202 | void DocumentList::reloadAppLnks() |
213 | { | 203 | { |
214 | if ( d->sendAppLnks && d->serverGui ) { | 204 | if ( d->sendAppLnks && d->serverGui ) { |
215 | d->serverGui->applicationScanningProgress( 0 ); | 205 | d->serverGui->applicationScanningProgress( 0 ); |
216 | d->serverGui->allApplicationsRemoved(); | 206 | d->serverGui->allApplicationsRemoved(); |
217 | } | 207 | } |
218 | 208 | ||
219 | delete appLnkSet; | 209 | delete appLnkSet; |
220 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); | 210 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); |
221 | 211 | ||
222 | if ( d->sendAppLnks && d->serverGui ) { | 212 | if ( d->sendAppLnks && d->serverGui ) { |
223 | static QStringList prevTypeList; | 213 | static QStringList prevTypeList; |
224 | QStringList types = appLnkSet->types(); | 214 | QStringList types = appLnkSet->types(); |
225 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { | 215 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { |
226 | if ( !(*ittypes).isEmpty() ) { | 216 | if ( !(*ittypes).isEmpty() ) { |
227 | if ( !prevTypeList.contains(*ittypes) ) { | 217 | if ( !prevTypeList.contains(*ittypes) ) { |
228 | QString name = appLnkSet->typeName(*ittypes); | 218 | QString name = appLnkSet->typeName(*ittypes); |
229 | QPixmap pm = appLnkSet->typePixmap(*ittypes); | 219 | QPixmap pm = appLnkSet->typePixmap(*ittypes); |
230 | QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); | 220 | QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); |
231 | 221 | ||
232 | if (pm.isNull()) { | 222 | if (pm.isNull()) { |
233 | QImage img( Resource::loadImage( "UnknownDocument" ) ); | 223 | QImage img( Resource::loadImage( "UnknownDocument" ) ); |
234 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 224 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
235 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); | 225 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); |
236 | } | 226 | } |
237 | 227 | ||
238 | //qDebug("adding type %s", (*ittypes).latin1()); | 228 | //qDebug("adding type %s", (*ittypes).latin1()); |
239 | 229 | ||
240 | // ### our current launcher expects docs tab to be last | 230 | // ### our current launcher expects docs tab to be last |
241 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); | 231 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); |
242 | } | 232 | } |
243 | prevTypeList.remove(*ittypes); | 233 | prevTypeList.remove(*ittypes); |
244 | } | 234 | } |
245 | } | 235 | } |
246 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { | 236 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { |
247 | //qDebug("removing type %s", (*ittypes).latin1()); | 237 | //qDebug("removing type %s", (*ittypes).latin1()); |
248 | d->serverGui->typeRemoved(*ittypes); | 238 | d->serverGui->typeRemoved(*ittypes); |
249 | } | 239 | } |
250 | prevTypeList = types; | 240 | prevTypeList = types; |
251 | } | 241 | } |
252 | 242 | ||
253 | QListIterator<AppLnk> itapp( appLnkSet->children() ); | 243 | QListIterator<AppLnk> itapp( appLnkSet->children() ); |
254 | AppLnk* l; | 244 | AppLnk* l; |
255 | while ( (l=itapp.current()) ) { | 245 | while ( (l=itapp.current()) ) { |
256 | ++itapp; | 246 | ++itapp; |
257 | if ( d->sendAppLnks && d->serverGui ) | 247 | if ( d->sendAppLnks && d->serverGui ) |
258 | d->serverGui->applicationAdded( l->type(), *l ); | 248 | d->serverGui->applicationAdded( l->type(), *l ); |
259 | } | 249 | } |
260 | 250 | ||
261 | if ( d->sendAppLnks && d->serverGui ) | 251 | if ( d->sendAppLnks && d->serverGui ) |
262 | d->serverGui->applicationScanningProgress( 100 ); | 252 | d->serverGui->applicationScanningProgress( 100 ); |
263 | } | 253 | } |
264 | 254 | ||
265 | void DocumentList::reloadDocLnks() | 255 | void DocumentList::reloadDocLnks() |
266 | { | 256 | { |
267 | if ( !d->scanDocs ) | 257 | if ( !d->scanDocs ) |
268 | return; | 258 | return; |
269 | 259 | ||
270 | if ( d->sendDocLnks && d->serverGui ) { | 260 | if ( d->sendDocLnks && d->serverGui ) { |
271 | d->serverGui->documentScanningProgress( 0 ); | 261 | d->serverGui->documentScanningProgress( 0 ); |
272 | d->serverGui->allDocumentsRemoved(); | 262 | d->serverGui->allDocumentsRemoved(); |
273 | } | 263 | } |
274 | 264 | ||
275 | rescan(); | 265 | rescan(); |
276 | } | 266 | } |
277 | 267 | ||
278 | void DocumentList::linkChanged( QString arg ) | 268 | void DocumentList::linkChanged( QString arg ) |
279 | { | 269 | { |
280 | //qDebug( "linkchanged( %s )", arg.latin1() ); | 270 | //qDebug( "linkchanged( %s )", arg.latin1() ); |
281 | 271 | ||
282 | if ( arg.isNull() || Opie::Global::isAppLnkFileName( arg ) ) { | 272 | if ( arg.isNull() || Opie::Global::isAppLnkFileName( arg ) ) { |
283 | reloadAppLnks(); | 273 | reloadAppLnks(); |
284 | } else { | 274 | } else { |
285 | 275 | ||
286 | const QList<DocLnk> &list = d->dls.children(); | 276 | const QList<DocLnk> &list = d->dls.children(); |
287 | QListIterator<DocLnk> it( list ); | 277 | QListIterator<DocLnk> it( list ); |
288 | while ( it.current() ) { | 278 | while ( it.current() ) { |
289 | DocLnk *doc = it.current(); | 279 | DocLnk *doc = it.current(); |
290 | ++it; | 280 | ++it; |
291 | if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) | 281 | if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) |
292 | || ( doc->fileKnown() && doc->file() == arg ) ) { | 282 | || ( doc->fileKnown() && doc->file() == arg ) ) { |
293 | //qDebug( "found old link" ); | 283 | //qDebug( "found old link" ); |
294 | DocLnk* dl = new DocLnk( arg ); | 284 | DocLnk* dl = new DocLnk( arg ); |
295 | // add new one if it exists and matches the mimetype | 285 | // add new one if it exists and matches the mimetype |
296 | if ( d->store( dl ) ) { | 286 | if ( d->store( dl ) ) { |
297 | // Existing link has been changed, send old link ref and a ref | 287 | // Existing link has been changed, send old link ref and a ref |
298 | // to the new link | 288 | // to the new link |
299 | //qDebug( "change case" ); | 289 | //qDebug( "change case" ); |
300 | if ( d->serverGui ) | 290 | if ( d->serverGui ) |
301 | d->serverGui->documentChanged( *doc, *dl ); | 291 | d->serverGui->documentChanged( *doc, *dl ); |
302 | 292 | ||
303 | } else { | 293 | } else { |
304 | // Link has been removed or doesn't match the mimetypes any more | 294 | // Link has been removed or doesn't match the mimetypes any more |
305 | // so we aren't interested in it, so take it away from the list | 295 | // so we aren't interested in it, so take it away from the list |
306 | //qDebug( "removal case" ); | 296 | //qDebug( "removal case" ); |
307 | if ( d->serverGui ) | 297 | if ( d->serverGui ) |
308 | d->serverGui->documentRemoved( *doc ); | 298 | d->serverGui->documentRemoved( *doc ); |
309 | 299 | ||
310 | } | 300 | } |
311 | d->dls.remove( doc ); // remove old link from docLnkSet | 301 | d->dls.remove( doc ); // remove old link from docLnkSet |
312 | delete doc; | 302 | delete doc; |
313 | return; | 303 | return; |
314 | } | 304 | } |
315 | } | 305 | } |
316 | // Didn't find existing link, must be new | 306 | // Didn't find existing link, must be new |
317 | DocLnk* dl = new DocLnk( arg ); | 307 | DocLnk* dl = new DocLnk( arg ); |
318 | if ( d->store( dl ) ) { | 308 | if ( d->store( dl ) ) { |
319 | // Add if it's a link we are interested in | 309 | // Add if it's a link we are interested in |
320 | //qDebug( "add case" ); | 310 | //qDebug( "add case" ); |
321 | add( *dl ); | 311 | add( *dl ); |
322 | } | 312 | } |
323 | 313 | ||
324 | } | 314 | } |
325 | } | 315 | } |
326 | 316 | ||
327 | void DocumentList::restoreDone() | 317 | void DocumentList::restoreDone() |
328 | { | 318 | { |
329 | reloadAppLnks(); | 319 | reloadAppLnks(); |
330 | reloadDocLnks(); | 320 | reloadDocLnks(); |
331 | } | 321 | } |
332 | 322 | ||
333 | void DocumentList::storageChanged() | 323 | void DocumentList::storageChanged() |
334 | { | 324 | { |
335 | // ### can implement better | 325 | // ### can implement better |
336 | reloadAppLnks(); | 326 | reloadAppLnks(); |
337 | reloadDocLnks(); | 327 | reloadDocLnks(); |
338 | // ### Optimization opportunity | 328 | // ### Optimization opportunity |
339 | // Could be a bit more intelligent and somehow work out which | 329 | // Could be a bit more intelligent and somehow work out which |
340 | // mtab entry has changed and then only scan that and add and remove | 330 | // mtab entry has changed and then only scan that and add and remove |
341 | // links appropriately. | 331 | // links appropriately. |
342 | // rescan(); | 332 | // rescan(); |
343 | } | 333 | } |
344 | 334 | ||
345 | void DocumentList::sendAllDocLinks() | 335 | void DocumentList::sendAllDocLinks() |
346 | { | 336 | { |
347 | if ( d->tid != 0 ) { | 337 | if ( d->tid != 0 ) { |
348 | // We are in the middle of scanning, set a flag so | 338 | // We are in the middle of scanning, set a flag so |
349 | // we do this when we finish our scanning | 339 | // we do this when we finish our scanning |
350 | d->needToSendAllDocLinks = true; | 340 | d->needToSendAllDocLinks = true; |
351 | return; | 341 | return; |
352 | } | 342 | } |
353 | 343 | ||
354 | QString contents; | 344 | QString contents; |
355 | Categories cats; | 345 | Categories cats; |
356 | for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { | 346 | for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { |
357 | DocLnk *doc = it.current(); | 347 | DocLnk *doc = it.current(); |
358 | QFileInfo fi( doc->file() ); | 348 | QFileInfo fi( doc->file() ); |
359 | if ( !fi.exists() ) | 349 | if ( !fi.exists() ) |
360 | continue; | 350 | continue; |
361 | 351 | ||
362 | bool fake = !doc->linkFileKnown(); | 352 | bool fake = !doc->linkFileKnown(); |
363 | if ( !fake ) { | 353 | if ( !fake ) { |
364 | QFile f( doc->linkFile() ); | 354 | QFile f( doc->linkFile() ); |
365 | if ( f.open( IO_ReadOnly ) ) { | 355 | if ( f.open( IO_ReadOnly ) ) { |
366 | QTextStream ts( &f ); | 356 | QTextStream ts( &f ); |
367 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 357 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
368 | contents += ts.read(); | 358 | contents += ts.read(); |
369 | f.close(); | 359 | f.close(); |
370 | } else | 360 | } else |
371 | fake = TRUE; | 361 | fake = TRUE; |
372 | } | 362 | } |
373 | if (fake) { | 363 | if (fake) { |
374 | contents += "[Desktop Entry]\n"; // No tr | 364 | contents += "[Desktop Entry]\n"; // No tr |
375 | contents += "Categories = " + // No tr | 365 | contents += "Categories = " + // No tr |
376 | cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr | 366 | cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr |
377 | contents += "Name = "+doc->name()+"\n"; // No tr | 367 | contents += "Name = "+doc->name()+"\n"; // No tr |
378 | contents += "Type = "+doc->type()+"\n"; // No tr | 368 | contents += "Type = "+doc->type()+"\n"; // No tr |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index b312672..344cd46 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1,780 +1,780 @@ | |||
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 | 20 | ||
21 | #include <qtopia/global.h> | 21 | #include <qtopia/global.h> |
22 | #ifdef Q_WS_QWS | 22 | #ifdef Q_WS_QWS |
23 | #include <qtopia/qcopenvelope_qws.h> | 23 | #include <qtopia/qcopenvelope_qws.h> |
24 | #endif | 24 | #endif |
25 | #include <qtopia/resource.h> | 25 | #include <qtopia/resource.h> |
26 | #include <qtopia/applnk.h> | 26 | #include <qtopia/applnk.h> |
27 | #include <qtopia/config.h> | 27 | #include <qtopia/config.h> |
28 | #include <qtopia/global.h> | 28 | #include <qtopia/global.h> |
29 | #include <qtopia/qpeapplication.h> | 29 | #include <qtopia/qpeapplication.h> |
30 | #include <qtopia/mimetype.h> | 30 | #include <qtopia/mimetype.h> |
31 | #include <qtopia/private/categories.h> | 31 | #include <qtopia/private/categories.h> |
32 | //#include <qtopia/custom.h> | 32 | //#include <qtopia/custom.h> |
33 | 33 | ||
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #ifdef Q_WS_QWS | 35 | #ifdef Q_WS_QWS |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | #endif | 37 | #endif |
38 | #include <qtimer.h> | 38 | #include <qtimer.h> |
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qvbox.h> | 40 | #include <qvbox.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qstyle.h> | 42 | #include <qstyle.h> |
43 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
44 | #include <qtabbar.h> | 44 | #include <qtabbar.h> |
45 | #include <qwidgetstack.h> | 45 | #include <qwidgetstack.h> |
46 | #include <qlayout.h> | 46 | #include <qlayout.h> |
47 | #include <qregexp.h> | 47 | #include <qregexp.h> |
48 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
49 | #include <qframe.h> | 49 | #include <qframe.h> |
50 | #include <qpainter.h> | 50 | #include <qpainter.h> |
51 | #include <qlabel.h> | 51 | #include <qlabel.h> |
52 | #include <qtextstream.h> | 52 | #include <qtextstream.h> |
53 | #include <qpopupmenu.h> | 53 | #include <qpopupmenu.h> |
54 | 54 | ||
55 | #include "startmenu.h" | 55 | #include "startmenu.h" |
56 | #include "taskbar.h" | 56 | #include "taskbar.h" |
57 | 57 | ||
58 | #include "serverinterface.h" | 58 | #include "serverinterface.h" |
59 | #include "launcherview.h" | 59 | #include "launcherview.h" |
60 | #include "launcher.h" | 60 | #include "launcher.h" |
61 | #include "server.h" | 61 | #include "server.h" |
62 | 62 | ||
63 | #define QTOPIA_INTERNAL_FSLP | 63 | #define QTOPIA_INTERNAL_FSLP |
64 | #include <qtopia/lnkproperties.h> | 64 | #include <qtopia/lnkproperties.h> |
65 | #include <stdlib.h> | 65 | #include <stdlib.h> |
66 | #include <assert.h> | 66 | #include <assert.h> |
67 | 67 | ||
68 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 68 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
69 | #include <unistd.h> | 69 | #include <unistd.h> |
70 | #include <stdio.h> | 70 | #include <stdio.h> |
71 | #include <sys/vfs.h> | 71 | #include <sys/vfs.h> |
72 | #include <mntent.h> | 72 | #include <mntent.h> |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | #ifdef Q_WS_QWS | 75 | #ifdef Q_WS_QWS |
76 | #include <qkeyboard_qws.h> | 76 | #include <qkeyboard_qws.h> |
77 | #include <qpe/lnkproperties.h> | 77 | #include <qpe/lnkproperties.h> |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | 80 | ||
81 | static bool isVisibleWindow( int ); | 81 | static bool isVisibleWindow( int ); |
82 | //=========================================================================== | 82 | //=========================================================================== |
83 | 83 | ||
84 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : | 84 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : |
85 | QVBox( parent ), docview( 0 ) | 85 | QVBox( parent ), docview( 0 ) |
86 | { | 86 | { |
87 | docLoadingWidgetEnabled = false; | 87 | docLoadingWidgetEnabled = false; |
88 | docLoadingWidget = 0; | 88 | docLoadingWidget = 0; |
89 | docLoadingWidgetProgress = 0; | 89 | docLoadingWidgetProgress = 0; |
90 | launcher = parent; | 90 | launcher = parent; |
91 | categoryBar = new LauncherTabBar( this ); | 91 | categoryBar = new LauncherTabBar( this ); |
92 | QPalette pal = categoryBar->palette(); | 92 | QPalette pal = categoryBar->palette(); |
93 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 93 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
94 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 94 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
95 | categoryBar->setPalette( pal ); | 95 | categoryBar->setPalette( pal ); |
96 | stack = new QWidgetStack(this); | 96 | stack = new QWidgetStack(this); |
97 | connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); | 97 | connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); |
98 | categoryBar->show(); | 98 | categoryBar->show(); |
99 | stack->show(); | 99 | stack->show(); |
100 | 100 | ||
101 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 101 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
102 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); | 102 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); |
103 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 103 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
104 | this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); | 104 | this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); |
105 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 105 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), |
106 | this, SLOT(appMessage(const QCString&, const QByteArray&))); | 106 | this, SLOT(appMessage(const QCString&, const QByteArray&))); |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | createDocLoadingWidget(); | 109 | createDocLoadingWidget(); |
110 | } | 110 | } |
111 | 111 | ||
112 | void LauncherTabWidget::createDocLoadingWidget() | 112 | void LauncherTabWidget::createDocLoadingWidget() |
113 | { | 113 | { |
114 | // Construct the 'doc loading widget' shown when finding documents | 114 | // Construct the 'doc loading widget' shown when finding documents |
115 | 115 | ||
116 | // ### LauncherView class needs changing to be more generic so | 116 | // ### LauncherView class needs changing to be more generic so |
117 | // this widget can change its background similar to the iconviews | 117 | // this widget can change its background similar to the iconviews |
118 | // so the background for this matches | 118 | // so the background for this matches |
119 | docLoadingWidget = new LauncherView( stack ); | 119 | docLoadingWidget = new LauncherView( stack ); |
120 | docLoadingWidget->hideIcons(); | 120 | docLoadingWidget->hideIcons(); |
121 | QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); | 121 | QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); |
122 | 122 | ||
123 | docLoadingVBox->setSpacing( 20 ); | 123 | docLoadingVBox->setSpacing( 20 ); |
124 | docLoadingVBox->setMargin( 10 ); | 124 | docLoadingVBox->setMargin( 10 ); |
125 | 125 | ||
126 | QWidget *space1 = new QWidget( docLoadingVBox ); | 126 | QWidget *space1 = new QWidget( docLoadingVBox ); |
127 | docLoadingVBox->setStretchFactor( space1, 1 ); | 127 | docLoadingVBox->setStretchFactor( space1, 1 ); |
128 | 128 | ||
129 | QLabel *waitPixmap = new QLabel( docLoadingVBox ); | 129 | QLabel *waitPixmap = new QLabel( docLoadingVBox ); |
130 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); | 130 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); |
131 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); | 131 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); |
132 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); | 132 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); |
133 | 133 | ||
134 | Config cfg( "Launcher" ); | 134 | Config cfg( "Launcher" ); |
135 | cfg.setGroup( "DocTab" ); | 135 | cfg.setGroup( "DocTab" ); |
136 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); | 136 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); |
137 | 137 | ||
138 | QLabel *textLabel = new QLabel( docLoadingVBox ); | 138 | QLabel *textLabel = new QLabel( docLoadingVBox ); |
139 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); | 139 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); |
140 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); | 140 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); |
141 | docLoadingWidgetProgress->setProgress( 0 ); | 141 | docLoadingWidgetProgress->setProgress( 0 ); |
142 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); | 142 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); |
143 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker | 143 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker |
144 | setProgressStyle(); | 144 | setProgressStyle(); |
145 | 145 | ||
146 | if ( docTabEnabled ) | 146 | if ( docTabEnabled ) |
147 | { | 147 | { |
148 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); | 148 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); |
149 | } | 149 | } |
150 | else | 150 | else |
151 | { | 151 | { |
152 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" | 152 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" |
153 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); | 153 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); |
154 | docLoadingWidgetProgress->hide(); | 154 | docLoadingWidgetProgress->hide(); |
155 | docLoadingWidgetEnabled = true; | ||
155 | } | 156 | } |
156 | 157 | ||
157 | QWidget *space2 = new QWidget( docLoadingVBox ); | 158 | QWidget *space2 = new QWidget( docLoadingVBox ); |
158 | docLoadingVBox->setStretchFactor( space2, 1 ); | 159 | docLoadingVBox->setStretchFactor( space2, 1 ); |
159 | 160 | ||
160 | cfg.setGroup( "Tab Documents" ); // No tr | 161 | cfg.setGroup( "Tab Documents" ); // No tr |
161 | setTabViewAppearance( docLoadingWidget, cfg ); | 162 | setTabViewAppearance( docLoadingWidget, cfg ); |
162 | 163 | ||
163 | stack->addWidget( docLoadingWidget, 0 ); | 164 | stack->addWidget( docLoadingWidget, 0 ); |
164 | } | 165 | } |
165 | 166 | ||
166 | void LauncherTabWidget::initLayout() | 167 | void LauncherTabWidget::initLayout() |
167 | { | 168 | { |
168 | layout()->activate(); | 169 | layout()->activate(); |
169 | docView()->setFocus(); | 170 | docView()->setFocus(); |
170 | categoryBar->showTab("Documents"); | 171 | categoryBar->showTab("Documents"); |
171 | } | 172 | } |
172 | 173 | ||
173 | void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) | 174 | void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) |
174 | { | 175 | { |
175 | if ( message == "nextView()" ) | 176 | if ( message == "nextView()" ) |
176 | categoryBar->nextTab(); | 177 | categoryBar->nextTab(); |
177 | } | 178 | } |
178 | 179 | ||
179 | void LauncherTabWidget::raiseTabWidget() | 180 | void LauncherTabWidget::raiseTabWidget() |
180 | { | 181 | { |
181 | if ( categoryBar->currentView() == docView() | 182 | if ( categoryBar->currentView() == docView() |
182 | && docLoadingWidgetEnabled ) { | 183 | && docLoadingWidgetEnabled ) { |
183 | stack->raiseWidget( docLoadingWidget ); | 184 | stack->raiseWidget( docLoadingWidget ); |
184 | docLoadingWidget->updateGeometry(); | 185 | docLoadingWidget->updateGeometry(); |
185 | } else { | 186 | } else { |
186 | stack->raiseWidget( categoryBar->currentView() ); | 187 | stack->raiseWidget( categoryBar->currentView() ); |
187 | } | 188 | } |
188 | } | 189 | } |
189 | 190 | ||
190 | void LauncherTabWidget::tabProperties() | 191 | void LauncherTabWidget::tabProperties() |
191 | { | 192 | { |
192 | LauncherView *view = categoryBar->currentView(); | 193 | LauncherView *view = categoryBar->currentView(); |
193 | QPopupMenu *m = new QPopupMenu( this ); | 194 | QPopupMenu *m = new QPopupMenu( this ); |
194 | m->insertItem( tr("Icon View"), LauncherView::Icon ); | 195 | m->insertItem( tr("Icon View"), LauncherView::Icon ); |
195 | m->insertItem( tr("List View"), LauncherView::List ); | 196 | m->insertItem( tr("List View"), LauncherView::List ); |
196 | m->setItemChecked( (int)view->viewMode(), TRUE ); | 197 | m->setItemChecked( (int)view->viewMode(), TRUE ); |
197 | int rv = m->exec( QCursor::pos() ); | 198 | int rv = m->exec( QCursor::pos() ); |
198 | if ( rv >= 0 && rv != view->viewMode() ) { | 199 | if ( rv >= 0 && rv != view->viewMode() ) { |
199 | view->setViewMode( (LauncherView::ViewMode)rv ); | 200 | view->setViewMode( (LauncherView::ViewMode)rv ); |
200 | } | 201 | } |
201 | 202 | ||
202 | delete m; | 203 | delete m; |
203 | } | 204 | } |
204 | 205 | ||
205 | void LauncherTabWidget::deleteView( const QString& id ) | 206 | void LauncherTabWidget::deleteView( const QString& id ) |
206 | { | 207 | { |
207 | LauncherTab *t = categoryBar->launcherTab(id); | 208 | LauncherTab *t = categoryBar->launcherTab(id); |
208 | if ( t ) { | 209 | if ( t ) { |
209 | stack->removeWidget( t->view ); | 210 | stack->removeWidget( t->view ); |
210 | delete t->view; | 211 | delete t->view; |
211 | categoryBar->removeTab( t ); | 212 | categoryBar->removeTab( t ); |
212 | } | 213 | } |
213 | } | 214 | } |
214 | 215 | ||
215 | LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) | 216 | LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) |
216 | { | 217 | { |
217 | LauncherView* view = new LauncherView( stack ); | 218 | LauncherView* view = new LauncherView( stack ); |
218 | connect( view, SIGNAL(clicked(const AppLnk*)), | 219 | connect( view, SIGNAL(clicked(const AppLnk*)), |
219 | this, SIGNAL(clicked(const AppLnk*))); | 220 | this, SIGNAL(clicked(const AppLnk*))); |
220 | connect( view, SIGNAL(rightPressed(AppLnk*)), | 221 | connect( view, SIGNAL(rightPressed(AppLnk*)), |
221 | this, SIGNAL(rightPressed(AppLnk*))); | 222 | this, SIGNAL(rightPressed(AppLnk*))); |
222 | 223 | ||
223 | int n = categoryBar->count(); | 224 | int n = categoryBar->count(); |
224 | stack->addWidget( view, n ); | 225 | stack->addWidget( view, n ); |
225 | 226 | ||
226 | LauncherTab *tab = new LauncherTab( id, view, pm, label ); | 227 | LauncherTab *tab = new LauncherTab( id, view, pm, label ); |
227 | categoryBar->insertTab( tab, n-1 ); | 228 | categoryBar->insertTab( tab, n-1 ); |
228 | 229 | ||
229 | if ( id == "Documents" ) | 230 | if ( id == "Documents" ) |
230 | docview = view; | 231 | docview = view; |
231 | 232 | ||
232 | qDebug("inserting %s at %d", id.latin1(), n-1 ); | 233 | qDebug("inserting %s at %d", id.latin1(), n-1 ); |
233 | 234 | ||
234 | Config cfg("Launcher"); | 235 | Config cfg("Launcher"); |
235 | setTabAppearance( tab, cfg ); | 236 | setTabAppearance( tab, cfg ); |
236 | 237 | ||
237 | cfg.setGroup( "GUI" ); | 238 | cfg.setGroup( "GUI" ); |
238 | view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); | 239 | view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); |
239 | 240 | ||
240 | return view; | 241 | return view; |
241 | } | 242 | } |
242 | 243 | ||
243 | LauncherView *LauncherTabWidget::view( const QString &id ) | 244 | LauncherView *LauncherTabWidget::view( const QString &id ) |
244 | { | 245 | { |
245 | LauncherTab *t = categoryBar->launcherTab(id); | 246 | LauncherTab *t = categoryBar->launcherTab(id); |
246 | if ( !t ) | 247 | if ( !t ) |
247 | return 0; | 248 | return 0; |
248 | return t->view; | 249 | return t->view; |
249 | } | 250 | } |
250 | 251 | ||
251 | LauncherView *LauncherTabWidget::docView() | 252 | LauncherView *LauncherTabWidget::docView() |
252 | { | 253 | { |
253 | return docview; | 254 | return docview; |
254 | } | 255 | } |
255 | 256 | ||
256 | void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) | 257 | void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) |
257 | { | 258 | { |
258 | if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { | 259 | if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { |
259 | docLoadingWidgetEnabled = v; | 260 | docLoadingWidgetEnabled = v; |
260 | raiseTabWidget(); | 261 | raiseTabWidget(); |
261 | } | 262 | } |
262 | } | 263 | } |
263 | 264 | ||
264 | void LauncherTabWidget::setLoadingProgress( int percent ) | 265 | void LauncherTabWidget::setLoadingProgress( int percent ) |
265 | { | 266 | { |
266 | docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); | 267 | docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); |
267 | } | 268 | } |
268 | 269 | ||
269 | // ### this function could more to LauncherView | 270 | // ### this function could more to LauncherView |
270 | void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) | 271 | void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) |
271 | { | 272 | { |
272 | // View | 273 | // View |
273 | QString view = cfg.readEntry( "View", "Icon" ); | 274 | QString view = cfg.readEntry( "View", "Icon" ); |
274 | if ( view == "List" ) // No tr | 275 | if ( view == "List" ) // No tr |
275 | v->setViewMode( LauncherView::List ); | 276 | v->setViewMode( LauncherView::List ); |
276 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); | 277 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); |
277 | if ( bgType == "Image" ) { // No tr | 278 | if ( bgType == "Image" ) { // No tr |
278 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); | 279 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); |
279 | v->setBackgroundType( LauncherView::Image, pm ); | 280 | v->setBackgroundType( LauncherView::Image, pm ); |
280 | } else if ( bgType == "SolidColor" ) { | 281 | } else if ( bgType == "SolidColor" ) { |
281 | QString c = cfg.readEntry( "BackgroundColor" ); | 282 | QString c = cfg.readEntry( "BackgroundColor" ); |
282 | v->setBackgroundType( LauncherView::SolidColor, c ); | 283 | v->setBackgroundType( LauncherView::SolidColor, c ); |
283 | } else { | 284 | } else { |
284 | v->setBackgroundType( LauncherView::Ruled, QString::null ); | 285 | v->setBackgroundType( LauncherView::Ruled, QString::null ); |
285 | } | 286 | } |
286 | QString textCol = cfg.readEntry( "TextColor" ); | 287 | QString textCol = cfg.readEntry( "TextColor" ); |
287 | if ( textCol.isEmpty() ) | 288 | if ( textCol.isEmpty() ) |
288 | v->setTextColor( QColor() ); | 289 | v->setTextColor( QColor() ); |
289 | else | 290 | else |
290 | v->setTextColor( QColor(textCol) ); | 291 | v->setTextColor( QColor(textCol) ); |
291 | // bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); | 292 | // bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); |
292 | 293 | ||
293 | 294 | ||
294 | QStringList font = cfg.readListEntry( "Font", ',' ); | 295 | QStringList font = cfg.readListEntry( "Font", ',' ); |
295 | if ( font.count() == 4 ) | 296 | if ( font.count() == 4 ) |
296 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); | 297 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); |
297 | 298 | ||
298 | // ### FIXME TabColor TabTextColor | 299 | // ### FIXME TabColor TabTextColor |
299 | 300 | ||
300 | } | 301 | } |
301 | 302 | ||
302 | // ### Could move to LauncherTab | 303 | // ### Could move to LauncherTab |
303 | void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) | 304 | void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) |
304 | { | 305 | { |
305 | cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr | 306 | cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr |
306 | 307 | ||
307 | setTabViewAppearance( tab->view, cfg ); | 308 | setTabViewAppearance( tab->view, cfg ); |
308 | 309 | ||
309 | // Tabs | 310 | // Tabs |
310 | QString tabCol = cfg.readEntry( "TabColor" ); | 311 | QString tabCol = cfg.readEntry( "TabColor" ); |
311 | if ( tabCol.isEmpty() ) | 312 | if ( tabCol.isEmpty() ) |
312 | tab->bgColor = QColor(); | 313 | tab->bgColor = QColor(); |
313 | else | 314 | else |
314 | tab->bgColor = QColor(tabCol); | 315 | tab->bgColor = QColor(tabCol); |
315 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); | 316 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); |
316 | if ( tabTextCol.isEmpty() ) | 317 | if ( tabTextCol.isEmpty() ) |
317 | tab->fgColor = QColor(); | 318 | tab->fgColor = QColor(); |
318 | else | 319 | else |
319 | tab->fgColor = QColor(tabTextCol); | 320 | tab->fgColor = QColor(tabTextCol); |
320 | } | 321 | } |
321 | 322 | ||
322 | void LauncherTabWidget::paletteChange( const QPalette &p ) | 323 | void LauncherTabWidget::paletteChange( const QPalette &p ) |
323 | { | 324 | { |
324 | QVBox::paletteChange( p ); | 325 | QVBox::paletteChange( p ); |
325 | QPalette pal = palette(); | 326 | QPalette pal = palette(); |
326 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 327 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
327 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 328 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
328 | categoryBar->setPalette( pal ); | 329 | categoryBar->setPalette( pal ); |
329 | categoryBar->update(); | 330 | categoryBar->update(); |
330 | } | 331 | } |
331 | 332 | ||
332 | void LauncherTabWidget::styleChange( QStyle & ) | 333 | void LauncherTabWidget::styleChange( QStyle & ) |
333 | { | 334 | { |
334 | QTimer::singleShot( 0, this, SLOT(setProgressStyle()) ); | 335 | QTimer::singleShot( 0, this, SLOT(setProgressStyle()) ); |
335 | } | 336 | } |
336 | 337 | ||
337 | void LauncherTabWidget::setProgressStyle() | 338 | void LauncherTabWidget::setProgressStyle() |
338 | { | 339 | { |
339 | if (docLoadingWidgetProgress) { | 340 | if (docLoadingWidgetProgress) { |
340 | docLoadingWidgetProgress->setFrameShape( QProgressBar::Box ); | 341 | docLoadingWidgetProgress->setFrameShape( QProgressBar::Box ); |
341 | docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain ); | 342 | docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain ); |
342 | docLoadingWidgetProgress->setMargin( 1 ); | 343 | docLoadingWidgetProgress->setMargin( 1 ); |
343 | docLoadingWidgetProgress->setLineWidth( 1 ); | 344 | docLoadingWidgetProgress->setLineWidth( 1 ); |
344 | } | 345 | } |
345 | } | 346 | } |
346 | 347 | ||
347 | void LauncherTabWidget::setBusy(bool on) | 348 | void LauncherTabWidget::setBusy(bool on) |
348 | { | 349 | { |
349 | if ( on ) | 350 | if ( on ) |
350 | currentView()->setBusy(TRUE); | 351 | currentView()->setBusy(TRUE); |
351 | else { | 352 | else { |
352 | for ( int i = 0; i < categoryBar->count(); i++ ) { | 353 | for ( int i = 0; i < categoryBar->count(); i++ ) { |
353 | LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; | 354 | LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; |
354 | view->setBusy( FALSE ); | 355 | view->setBusy( FALSE ); |
355 | } | 356 | } |
356 | } | 357 | } |
357 | } | 358 | } |
358 | 359 | ||
359 | void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { | 360 | void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { |
360 | for (int i = 0; i < categoryBar->count(); i++ ) { | 361 | for (int i = 0; i < categoryBar->count(); i++ ) { |
361 | LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; | 362 | LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; |
362 | view->setBusyIndicatorType( str ); | 363 | view->setBusyIndicatorType( str ); |
363 | } | 364 | } |
364 | } | 365 | } |
365 | 366 | ||
366 | LauncherView *LauncherTabWidget::currentView(void) | 367 | LauncherView *LauncherTabWidget::currentView(void) |
367 | { | 368 | { |
368 | return (LauncherView*)stack->visibleWidget(); | 369 | return (LauncherView*)stack->visibleWidget(); |
369 | } | 370 | } |
370 | 371 | ||
371 | 372 | ||
372 | 373 | ||
373 | void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) | 374 | void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) |
374 | { | 375 | { |
375 | QDataStream stream( data, IO_ReadOnly ); | 376 | QDataStream stream( data, IO_ReadOnly ); |
376 | if ( msg == "setTabView(QString,int)" ) { | 377 | if ( msg == "setTabView(QString,int)" ) { |
377 | QString id; | 378 | QString id; |
378 | stream >> id; | 379 | stream >> id; |
379 | int mode; | 380 | int mode; |
380 | stream >> mode; | 381 | stream >> mode; |
381 | if ( view(id) ) | 382 | if ( view(id) ) |
382 | view(id)->setViewMode( (LauncherView::ViewMode)mode ); | 383 | view(id)->setViewMode( (LauncherView::ViewMode)mode ); |
383 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { | 384 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { |
384 | QString id; | 385 | QString id; |
385 | stream >> id; | 386 | stream >> id; |
386 | int mode; | 387 | int mode; |
387 | stream >> mode; | 388 | stream >> mode; |
388 | QString pixmapOrColor; | 389 | QString pixmapOrColor; |
389 | stream >> pixmapOrColor; | 390 | stream >> pixmapOrColor; |
390 | if ( view(id) ) | 391 | if ( view(id) ) |
391 | view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 392 | view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
392 | if ( id == "Documents" ) | 393 | if ( id == "Documents" ) |
393 | docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 394 | docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
394 | } else if ( msg == "setTextColor(QString,QString)" ) { | 395 | } else if ( msg == "setTextColor(QString,QString)" ) { |
395 | QString id; | 396 | QString id; |
396 | stream >> id; | 397 | stream >> id; |
397 | QString color; | 398 | QString color; |
398 | stream >> color; | 399 | stream >> color; |
399 | if ( view(id) ) | 400 | if ( view(id) ) |
400 | view(id)->setTextColor( QColor(color) ); | 401 | view(id)->setTextColor( QColor(color) ); |
401 | if ( id == "Documents" ) | 402 | if ( id == "Documents" ) |
402 | docLoadingWidget->setTextColor( QColor(color) ); | 403 | docLoadingWidget->setTextColor( QColor(color) ); |
403 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { | 404 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { |
404 | QString id; | 405 | QString id; |
405 | stream >> id; | 406 | stream >> id; |
406 | QString fam; | 407 | QString fam; |
407 | stream >> fam; | 408 | stream >> fam; |
408 | int size; | 409 | int size; |
409 | stream >> size; | 410 | stream >> size; |
410 | int weight; | 411 | int weight; |
411 | stream >> weight; | 412 | stream >> weight; |
412 | int italic; | 413 | int italic; |
413 | stream >> italic; | 414 | stream >> italic; |
414 | if ( view(id) ) { | 415 | if ( view(id) ) { |
415 | if ( !fam.isEmpty() ) { | 416 | if ( !fam.isEmpty() ) { |
416 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 417 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); |
417 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); | 418 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); |
418 | } else { | 419 | } else { |
419 | view(id)->clearViewFont(); | 420 | view(id)->clearViewFont(); |
420 | } | 421 | } |
421 | } | 422 | } |
422 | }else if ( msg == "setBusyIndicatorType(QString)" ) { | 423 | }else if ( msg == "setBusyIndicatorType(QString)" ) { |
423 | QString type; | 424 | QString type; |
424 | stream >> type; | 425 | stream >> type; |
425 | setBusyIndicatorType( type ); | 426 | setBusyIndicatorType( type ); |
426 | }else if ( msg == "home()" ) { | 427 | }else if ( msg == "home()" ) { |
427 | if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { | 428 | if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { |
428 | if (categoryBar) | 429 | if (categoryBar) |
429 | categoryBar->nextTab(); | 430 | categoryBar->nextTab(); |
430 | }else | 431 | }else |
431 | static_cast<QWidget*>(parent())->raise(); | 432 | static_cast<QWidget*>(parent())->raise(); |
432 | } | 433 | } |
433 | } | 434 | } |
434 | 435 | ||
435 | 436 | ||
436 | 437 | ||
437 | //--------------------------------------------------------------------------- | 438 | //--------------------------------------------------------------------------- |
438 | 439 | ||
439 | Launcher::Launcher() | 440 | Launcher::Launcher() |
440 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) | 441 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) |
441 | { | 442 | { |
442 | tabs = 0; | 443 | tabs = 0; |
443 | tb = 0; | 444 | tb = 0; |
444 | Config cfg( "Launcher" ); | 445 | Config cfg( "Launcher" ); |
445 | cfg.setGroup( "DocTab" ); | 446 | cfg.setGroup( "DocTab" ); |
446 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); | 447 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); |
447 | } | 448 | } |
448 | 449 | ||
449 | void Launcher::createGUI() | 450 | void Launcher::createGUI() |
450 | { | 451 | { |
451 | setCaption( tr("Launcher") ); | 452 | setCaption( tr("Launcher") ); |
452 | 453 | ||
453 | // we have a pretty good idea how big we'll be | 454 | // we have a pretty good idea how big we'll be |
454 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); | 455 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); |
455 | 456 | ||
456 | tb = new TaskBar; | 457 | tb = new TaskBar; |
457 | tabs = new LauncherTabWidget( this ); | 458 | tabs = new LauncherTabWidget( this ); |
458 | setCentralWidget( tabs ); | 459 | setCentralWidget( tabs ); |
459 | 460 | ||
460 | ServerInterface::dockWidget( tb, ServerInterface::Bottom ); | 461 | ServerInterface::dockWidget( tb, ServerInterface::Bottom ); |
461 | tb->show(); | 462 | tb->show(); |
462 | 463 | ||
463 | qApp->installEventFilter( this ); | 464 | qApp->installEventFilter( this ); |
464 | 465 | ||
465 | 466 | ||
466 | connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); | 467 | connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); |
467 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); | 468 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); |
468 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); | 469 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); |
469 | 470 | ||
470 | connect( tb, SIGNAL(tabSelected(const QString&)), | 471 | connect( tb, SIGNAL(tabSelected(const QString&)), |
471 | this, SLOT(showTab(const QString&)) ); | 472 | this, SLOT(showTab(const QString&)) ); |
472 | connect( tabs, SIGNAL(selected(const QString&)), | 473 | connect( tabs, SIGNAL(selected(const QString&)), |
473 | this, SLOT(viewSelected(const QString&)) ); | 474 | this, SLOT(viewSelected(const QString&)) ); |
474 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 475 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
475 | this, SLOT(select(const AppLnk*))); | 476 | this, SLOT(select(const AppLnk*))); |
476 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 477 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
477 | this, SLOT(properties(AppLnk*))); | 478 | this, SLOT(properties(AppLnk*))); |
478 | 479 | ||
479 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 480 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
480 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 481 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
481 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 482 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
482 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 483 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
483 | #endif | 484 | #endif |
484 | 485 | ||
485 | // all documents | 486 | // all documents |
486 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 487 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
487 | QPixmap pm; | 488 | QPixmap pm; |
488 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 489 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
489 | // It could add this itself if it handles docs | 490 | // It could add this itself if it handles docs |
490 | 491 | ||
491 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); | 492 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); |
492 | 493 | ||
493 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); | 494 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); |
494 | qApp->setMainWidget( this ); | 495 | qApp->setMainWidget( this ); |
495 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); | 496 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); |
496 | } | 497 | } |
497 | 498 | ||
498 | Launcher::~Launcher() | 499 | Launcher::~Launcher() |
499 | { | 500 | { |
500 | if ( tb ) | 501 | if ( tb ) |
501 | destroyGUI(); | 502 | destroyGUI(); |
502 | } | 503 | } |
503 | 504 | ||
505 | bool Launcher::requiresDocuments() const | ||
506 | { | ||
507 | Config cfg( "Launcher" ); | ||
508 | cfg.setGroup( "DocTab" ); | ||
509 | return cfg.readBoolEntry( "Enable", true ); | ||
510 | } | ||
511 | |||
504 | void Launcher::makeVisible() | 512 | void Launcher::makeVisible() |
505 | { | 513 | { |
506 | showMaximized(); | 514 | showMaximized(); |
507 | } | 515 | } |
508 | 516 | ||
509 | void Launcher::destroyGUI() | 517 | void Launcher::destroyGUI() |
510 | { | 518 | { |
511 | delete tb; | 519 | delete tb; |
512 | tb = 0; | 520 | tb = 0; |
513 | delete tabs; | 521 | delete tabs; |
514 | tabs =0; | 522 | tabs =0; |
515 | } | 523 | } |
516 | 524 | ||
517 | bool Launcher::eventFilter( QObject*, QEvent *ev ) | 525 | bool Launcher::eventFilter( QObject*, QEvent *ev ) |
518 | { | 526 | { |
519 | #ifdef QT_QWS_CUSTOM | 527 | #ifdef QT_QWS_CUSTOM |
520 | if ( ev->type() == QEvent::KeyPress ) { | 528 | if ( ev->type() == QEvent::KeyPress ) { |
521 | QKeyEvent *ke = (QKeyEvent *)ev; | 529 | QKeyEvent *ke = (QKeyEvent *)ev; |
522 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 530 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
523 | QWidget *active = qApp->activeWindow(); | 531 | QWidget *active = qApp->activeWindow(); |
524 | if ( active && active->isPopup() ) | 532 | if ( active && active->isPopup() ) |
525 | active->close(); | 533 | active->close(); |
526 | else { | 534 | else { |
527 | Global::terminateBuiltin("calibrate"); // No tr | 535 | Global::terminateBuiltin("calibrate"); // No tr |
528 | tb->launchStartMenu(); | 536 | tb->launchStartMenu(); |
529 | } | 537 | } |
530 | return TRUE; | 538 | return TRUE; |
531 | } | 539 | } |
532 | } | 540 | } |
533 | #else | 541 | #else |
534 | Q_UNUSED(ev); | 542 | Q_UNUSED(ev); |
535 | #endif | 543 | #endif |
536 | return FALSE; | 544 | return FALSE; |
537 | } | 545 | } |
538 | 546 | ||
539 | void Launcher::toggleSymbolInput() | 547 | void Launcher::toggleSymbolInput() |
540 | { | 548 | { |
541 | tb->toggleSymbolInput(); | 549 | tb->toggleSymbolInput(); |
542 | } | 550 | } |
543 | 551 | ||
544 | void Launcher::toggleNumLockState() | 552 | void Launcher::toggleNumLockState() |
545 | { | 553 | { |
546 | tb->toggleNumLockState(); | 554 | tb->toggleNumLockState(); |
547 | } | 555 | } |
548 | 556 | ||
549 | void Launcher::toggleCapsLockState() | 557 | void Launcher::toggleCapsLockState() |
550 | { | 558 | { |
551 | tb->toggleCapsLockState(); | 559 | tb->toggleCapsLockState(); |
552 | } | 560 | } |
553 | 561 | ||
554 | static bool isVisibleWindow(int wid) | 562 | static bool isVisibleWindow(int wid) |
555 | { | 563 | { |
556 | #ifdef Q_WS_QWS | 564 | #ifdef Q_WS_QWS |
557 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 565 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
558 | QWSWindow* w; | 566 | QWSWindow* w; |
559 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 567 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
560 | if ( w->winId() == wid ) | 568 | if ( w->winId() == wid ) |
561 | return !w->isFullyObscured(); | 569 | return !w->isFullyObscured(); |
562 | } | 570 | } |
563 | #endif | 571 | #endif |
564 | return FALSE; | 572 | return FALSE; |
565 | } | 573 | } |
566 | 574 | ||
567 | void Launcher::viewSelected(const QString& s) | 575 | void Launcher::viewSelected(const QString& s) |
568 | { | 576 | { |
569 | setCaption( s + tr(" - Launcher") ); | 577 | setCaption( s + tr(" - Launcher") ); |
570 | } | 578 | } |
571 | 579 | ||
572 | void Launcher::showTab(const QString& id) | 580 | void Launcher::showTab(const QString& id) |
573 | { | 581 | { |
574 | tabs->categoryBar->showTab(id); | 582 | tabs->categoryBar->showTab(id); |
575 | raise(); | 583 | raise(); |
576 | } | 584 | } |
577 | 585 | ||
578 | void Launcher::select( const AppLnk *appLnk ) | 586 | void Launcher::select( const AppLnk *appLnk ) |
579 | { | 587 | { |
580 | if ( appLnk->type() == "Folder" ) { // No tr | 588 | if ( appLnk->type() == "Folder" ) { // No tr |
581 | // Not supported: flat is simpler for the user | 589 | // Not supported: flat is simpler for the user |
582 | } else { | 590 | } else { |
583 | if ( appLnk->exec().isNull() ) { | 591 | if ( appLnk->exec().isNull() ) { |
584 | int i = QMessageBox::information(this,tr("No application"), | 592 | int i = QMessageBox::information(this,tr("No application"), |
585 | tr("<p>No application is defined for this document." | 593 | tr("<p>No application is defined for this document." |
586 | "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); | 594 | "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); |
587 | 595 | ||
588 | #if 0 | 596 | #if 0 |
589 | /* ### Fixme */ | 597 | /* ### Fixme */ |
590 | if ( i == 1 ) | 598 | if ( i == 1 ) |
591 | Global::execute(Service::app("Open/text/*"),appLnk->file()); | 599 | Global::execute(Service::app("Open/text/*"),appLnk->file()); |
592 | #endif | 600 | #endif |
593 | return; | 601 | return; |
594 | } | 602 | } |
595 | tabs->setBusy(TRUE); | 603 | tabs->setBusy(TRUE); |
596 | emit executing( appLnk ); | 604 | emit executing( appLnk ); |
597 | appLnk->execute(); | 605 | appLnk->execute(); |
598 | } | 606 | } |
599 | } | 607 | } |
600 | 608 | ||
601 | void Launcher::properties( AppLnk *appLnk ) | 609 | void Launcher::properties( AppLnk *appLnk ) |
602 | { | 610 | { |
603 | if ( appLnk->type() == "Folder" ) { // No tr | 611 | if ( appLnk->type() == "Folder" ) { // No tr |
604 | // Not supported: flat is simpler for the user | 612 | // Not supported: flat is simpler for the user |
605 | } else { | 613 | } else { |
606 | /* ### libqtopia FIXME also moving docLnks... */ | 614 | /* ### libqtopia FIXME also moving docLnks... */ |
607 | LnkProperties prop(appLnk,0 ); | 615 | LnkProperties prop(appLnk,0 ); |
608 | 616 | ||
609 | prop.showMaximized(); | 617 | prop.showMaximized(); |
610 | prop.exec(); | 618 | prop.exec(); |
611 | } | 619 | } |
612 | } | 620 | } |
613 | 621 | ||
614 | void Launcher::storageChanged( const QList<FileSystem> &fs ) | 622 | void Launcher::storageChanged( const QList<FileSystem> &fs ) |
615 | { | 623 | { |
616 | // ### update combo boxes if we had a combo box for the storage type | 624 | // ### update combo boxes if we had a combo box for the storage type |
617 | } | 625 | } |
618 | 626 | ||
619 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | 627 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) |
620 | { | 628 | { |
621 | QDataStream stream( data, IO_ReadOnly ); | 629 | QDataStream stream( data, IO_ReadOnly ); |
622 | if ( msg == "busy()" ) { | 630 | if ( msg == "busy()" ) { |
623 | tb->startWait(); | 631 | tb->startWait(); |
624 | } else if ( msg == "notBusy(QString)" ) { | 632 | } else if ( msg == "notBusy(QString)" ) { |
625 | QString app; | 633 | QString app; |
626 | stream >> app; | 634 | stream >> app; |
627 | tabs->setBusy(FALSE); | 635 | tabs->setBusy(FALSE); |
628 | tb->stopWait(app); | 636 | tb->stopWait(app); |
629 | } else if (msg == "applyStyle()") { | 637 | } else if (msg == "applyStyle()") { |
630 | tabs->currentView()->relayout(); | 638 | tabs->currentView()->relayout(); |
631 | } | 639 | } |
632 | } | 640 | } |
633 | 641 | ||
634 | // These are the update functions from the server | 642 | // These are the update functions from the server |
635 | void Launcher::typeAdded( const QString& type, const QString& name, | 643 | void Launcher::typeAdded( const QString& type, const QString& name, |
636 | const QPixmap& pixmap, const QPixmap& ) | 644 | const QPixmap& pixmap, const QPixmap& ) |
637 | { | 645 | { |
638 | tabs->newView( type, pixmap, name ); | 646 | tabs->newView( type, pixmap, name ); |
639 | ids.append( type ); | 647 | ids.append( type ); |
640 | tb->refreshStartMenu(); | 648 | tb->refreshStartMenu(); |
641 | 649 | ||
642 | static bool first = TRUE; | 650 | static bool first = TRUE; |
643 | if ( first ) { | 651 | if ( first ) { |
644 | first = FALSE; | 652 | first = FALSE; |
645 | tabs->categoryBar->showTab(type); | 653 | tabs->categoryBar->showTab(type); |
646 | } | 654 | } |
647 | 655 | ||
648 | tabs->view( type )->setUpdatesEnabled( FALSE ); | 656 | tabs->view( type )->setUpdatesEnabled( FALSE ); |
649 | tabs->view( type )->setSortEnabled( FALSE ); | 657 | tabs->view( type )->setSortEnabled( FALSE ); |
650 | } | 658 | } |
651 | 659 | ||
652 | void Launcher::typeRemoved( const QString& type ) | 660 | void Launcher::typeRemoved( const QString& type ) |
653 | { | 661 | { |
654 | tabs->view( type )->removeAllItems(); | 662 | tabs->view( type )->removeAllItems(); |
655 | tabs->deleteView( type ); | 663 | tabs->deleteView( type ); |
656 | ids.remove( type ); | 664 | ids.remove( type ); |
657 | tb->refreshStartMenu(); | 665 | tb->refreshStartMenu(); |
658 | } | 666 | } |
659 | 667 | ||
660 | void Launcher::applicationAdded( const QString& type, const AppLnk& app ) | 668 | void Launcher::applicationAdded( const QString& type, const AppLnk& app ) |
661 | { | 669 | { |
662 | if ( app.type() == "Separator" ) // No tr | 670 | if ( app.type() == "Separator" ) // No tr |
663 | return; | 671 | return; |
664 | 672 | ||
665 | LauncherView *view = tabs->view( type ); | 673 | LauncherView *view = tabs->view( type ); |
666 | if ( view ) | 674 | if ( view ) |
667 | view->addItem( new AppLnk( app ), FALSE ); | 675 | view->addItem( new AppLnk( app ), FALSE ); |
668 | else | 676 | else |
669 | qWarning("addAppLnk: No view for type %s. Can't add app %s!", | 677 | qWarning("addAppLnk: No view for type %s. Can't add app %s!", |
670 | type.latin1(),app.name().latin1() ); | 678 | type.latin1(),app.name().latin1() ); |
671 | 679 | ||
672 | MimeType::registerApp( app ); | 680 | MimeType::registerApp( app ); |
673 | } | 681 | } |
674 | 682 | ||
675 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) | 683 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) |
676 | { | 684 | { |
677 | LauncherView *view = tabs->view( type ); | 685 | LauncherView *view = tabs->view( type ); |
678 | if ( view ) | 686 | if ( view ) |
679 | view->removeLink( app.linkFile() ); | 687 | view->removeLink( app.linkFile() ); |
680 | else | 688 | else |
681 | qWarning("removeAppLnk: No view for %s!", type.latin1() ); | 689 | qWarning("removeAppLnk: No view for %s!", type.latin1() ); |
682 | } | 690 | } |
683 | 691 | ||
684 | void Launcher::allApplicationsRemoved() | 692 | void Launcher::allApplicationsRemoved() |
685 | { | 693 | { |
686 | MimeType::clear(); | 694 | MimeType::clear(); |
687 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) | 695 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) |
688 | tabs->view( (*it) )->removeAllItems(); | 696 | tabs->view( (*it) )->removeAllItems(); |
689 | } | 697 | } |
690 | 698 | ||
691 | void Launcher::documentAdded( const DocLnk& doc ) | 699 | void Launcher::documentAdded( const DocLnk& doc ) |
692 | { | 700 | { |
693 | tabs->docView()->addItem( new DocLnk( doc ), FALSE ); | 701 | tabs->docView()->addItem( new DocLnk( doc ), FALSE ); |
694 | } | 702 | } |
695 | 703 | ||
696 | void Launcher::showLoadingDocs() | 704 | void Launcher::showLoadingDocs() |
697 | { | 705 | { |
698 | tabs->docView()->hide(); | 706 | tabs->docView()->hide(); |
699 | } | 707 | } |
700 | 708 | ||
701 | void Launcher::showDocTab() | 709 | void Launcher::showDocTab() |
702 | { | 710 | { |
703 | if ( tabs->categoryBar->currentView() == tabs->docView() ) | 711 | if ( tabs->categoryBar->currentView() == tabs->docView() ) |
704 | tabs->docView()->show(); | 712 | tabs->docView()->show(); |
705 | } | 713 | } |
706 | 714 | ||
707 | void Launcher::documentRemoved( const DocLnk& doc ) | 715 | void Launcher::documentRemoved( const DocLnk& doc ) |
708 | { | 716 | { |
709 | tabs->docView()->removeLink( doc.linkFile() ); | 717 | tabs->docView()->removeLink( doc.linkFile() ); |
710 | } | 718 | } |
711 | 719 | ||
712 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) | 720 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) |
713 | { | 721 | { |
714 | documentRemoved( oldDoc ); | 722 | documentRemoved( oldDoc ); |
715 | documentAdded( newDoc ); | 723 | documentAdded( newDoc ); |
716 | } | 724 | } |
717 | 725 | ||
718 | void Launcher::allDocumentsRemoved() | 726 | void Launcher::allDocumentsRemoved() |
719 | { | 727 | { |
720 | tabs->docView()->removeAllItems(); | 728 | tabs->docView()->removeAllItems(); |
721 | } | 729 | } |
722 | 730 | ||
723 | void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) | 731 | void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) |
724 | { | 732 | { |
725 | tb->setApplicationState( name, state ); | 733 | tb->setApplicationState( name, state ); |
726 | } | 734 | } |
727 | 735 | ||
728 | void Launcher::applicationScanningProgress( int percent ) | 736 | void Launcher::applicationScanningProgress( int percent ) |
729 | { | 737 | { |
730 | switch ( percent ) { | 738 | switch ( percent ) { |
731 | case 0: { | 739 | case 0: { |
732 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { | 740 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { |
733 | tabs->view( (*it) )->setUpdatesEnabled( FALSE ); | 741 | tabs->view( (*it) )->setUpdatesEnabled( FALSE ); |
734 | tabs->view( (*it) )->setSortEnabled( FALSE ); | 742 | tabs->view( (*it) )->setSortEnabled( FALSE ); |
735 | } | 743 | } |
736 | break; | 744 | break; |
737 | } | 745 | } |
738 | case 100: { | 746 | case 100: { |
739 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { | 747 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { |
740 | tabs->view( (*it) )->setUpdatesEnabled( TRUE ); | 748 | tabs->view( (*it) )->setUpdatesEnabled( TRUE ); |
741 | tabs->view( (*it) )->setSortEnabled( TRUE ); | 749 | tabs->view( (*it) )->setSortEnabled( TRUE ); |
742 | } | 750 | } |
743 | break; | 751 | break; |
744 | } | 752 | } |
745 | default: | 753 | default: |
746 | break; | 754 | break; |
747 | } | 755 | } |
748 | } | 756 | } |
749 | 757 | ||
750 | void Launcher::documentScanningProgress( int percent ) | 758 | void Launcher::documentScanningProgress( int percent ) |
751 | { | 759 | { |
752 | if ( !docTabEnabled ) | ||
753 | { | ||
754 | qDebug( "Launcher: document tab disabled!" ); | ||
755 | tabs->setLoadingProgress( 100 ); | ||
756 | tabs->setLoadingWidgetEnabled( TRUE ); | ||
757 | return; | ||
758 | } | ||
759 | |||
760 | switch ( percent ) { | 760 | switch ( percent ) { |
761 | case 0: { | 761 | case 0: { |
762 | tabs->setLoadingProgress( 0 ); | 762 | tabs->setLoadingProgress( 0 ); |
763 | tabs->setLoadingWidgetEnabled( TRUE ); | 763 | tabs->setLoadingWidgetEnabled( TRUE ); |
764 | tabs->docView()->setUpdatesEnabled( FALSE ); | 764 | tabs->docView()->setUpdatesEnabled( FALSE ); |
765 | tabs->docView()->setSortEnabled( FALSE ); | 765 | tabs->docView()->setSortEnabled( FALSE ); |
766 | break; | 766 | break; |
767 | } | 767 | } |
768 | case 100: { | 768 | case 100: { |
769 | tabs->docView()->updateTools(); | 769 | tabs->docView()->updateTools(); |
770 | tabs->docView()->setSortEnabled( TRUE ); | 770 | tabs->docView()->setSortEnabled( TRUE ); |
771 | tabs->docView()->setUpdatesEnabled( TRUE ); | 771 | tabs->docView()->setUpdatesEnabled( TRUE ); |
772 | tabs->setLoadingWidgetEnabled( FALSE ); | 772 | tabs->setLoadingWidgetEnabled( FALSE ); |
773 | break; | 773 | break; |
774 | } | 774 | } |
775 | default: | 775 | default: |
776 | tabs->setLoadingProgress( percent ); | 776 | tabs->setLoadingProgress( percent ); |
777 | break; | 777 | break; |
778 | } | 778 | } |
779 | } | 779 | } |
780 | 780 | ||
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 1d046ee..4f3ff8c 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h | |||
@@ -1,157 +1,157 @@ | |||
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 allDocumentsRemoved(); | 113 | void allDocumentsRemoved(); |
114 | void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); | 114 | void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); |
115 | void storageChanged( const QList<FileSystem> & ); | 115 | void storageChanged( const QList<FileSystem> & ); |
116 | void applicationScanningProgress( int percent ); | 116 | void applicationScanningProgress( int percent ); |
117 | void documentScanningProgress( int percent ); | 117 | void documentScanningProgress( int percent ); |
118 | bool requiresApplications() const { return TRUE; } | 118 | bool requiresApplications() const { return TRUE; } |
119 | bool requiresDocuments() const { return TRUE; } | 119 | bool requiresDocuments() const; |
120 | void showLoadingDocs(); | 120 | void showLoadingDocs(); |
121 | void showDocTab(); | 121 | void showDocTab(); |
122 | 122 | ||
123 | QStringList idList() const { return ids; } | 123 | QStringList idList() const { return ids; } |
124 | 124 | ||
125 | public slots: | 125 | public slots: |
126 | void viewSelected(const QString&); | 126 | void viewSelected(const QString&); |
127 | void showTab(const QString&); | 127 | void showTab(const QString&); |
128 | void select( const AppLnk * ); | 128 | void select( const AppLnk * ); |
129 | void properties( AppLnk * ); | 129 | void properties( AppLnk * ); |
130 | void makeVisible(); | 130 | void makeVisible(); |
131 | 131 | ||
132 | signals: | 132 | signals: |
133 | void executing( const AppLnk * ); | 133 | void executing( const AppLnk * ); |
134 | 134 | ||
135 | private slots: | 135 | private slots: |
136 | void systemMessage( const QCString &, const QByteArray &); | 136 | void systemMessage( const QCString &, const QByteArray &); |
137 | void toggleSymbolInput(); | 137 | void toggleSymbolInput(); |
138 | void toggleNumLockState(); | 138 | void toggleNumLockState(); |
139 | void toggleCapsLockState(); | 139 | void toggleCapsLockState(); |
140 | 140 | ||
141 | protected: | 141 | protected: |
142 | bool eventFilter( QObject *o, QEvent *ev ); | 142 | bool eventFilter( QObject *o, QEvent *ev ); |
143 | 143 | ||
144 | private: | 144 | private: |
145 | void updateApps(); | 145 | void updateApps(); |
146 | void loadDocs(); | 146 | void loadDocs(); |
147 | void updateDocs(); | 147 | void updateDocs(); |
148 | void updateTabs(); | 148 | void updateTabs(); |
149 | 149 | ||
150 | LauncherTabWidget *tabs; | 150 | LauncherTabWidget *tabs; |
151 | QStringList ids; | 151 | QStringList ids; |
152 | TaskBar *tb; | 152 | TaskBar *tb; |
153 | 153 | ||
154 | bool docTabEnabled; | 154 | bool docTabEnabled; |
155 | }; | 155 | }; |
156 | 156 | ||
157 | #endif // LAUNCHERVIEW_H | 157 | #endif // LAUNCHERVIEW_H |