author | mickeyl <mickeyl> | 2005-07-03 22:13:00 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-07-03 22:13:00 (UTC) |
commit | 2cabd9ad4b49eefccdf99ad59550c76546b473c9 (patch) (unidiff) | |
tree | 00bab275ac356aecc5a39b86ca22ce172d01f622 | |
parent | 47011752d4457a1055894479e5bf855e100fddac (diff) | |
download | opie-2cabd9ad4b49eefccdf99ad59550c76546b473c9.zip opie-2cabd9ad4b49eefccdf99ad59550c76546b473c9.tar.gz opie-2cabd9ad4b49eefccdf99ad59550c76546b473c9.tar.bz2 |
Resource -> OResource
This is a large diff and I'd appreciate some additional pairs of eyes checking it
-rw-r--r-- | core/launcher/documentlist.cpp | 72 | ||||
-rw-r--r-- | core/launcher/firstuse.cpp | 62 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 60 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 53 | ||||
-rw-r--r-- | core/launcher/startmenu.cpp | 79 | ||||
-rw-r--r-- | core/launcher/syncdialog.cpp | 59 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 52 | ||||
-rw-r--r-- | core/launcher/wait.cpp | 54 |
8 files changed, 260 insertions, 231 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index b8bf4e0..fd385d6 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp | |||
@@ -1,77 +1,85 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | =. (C) 2000-2002 Trolltech AS |
4 | ** This file is part of the Qtopia Environment. | 4 | .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This program is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ** | 18 | ..}^=.= = ; Library General Public License for more |
19 | **********************************************************************/ | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
20 | #include "documentlist.h" | 28 | #include "documentlist.h" |
21 | #include "serverinterface.h" | 29 | #include "serverinterface.h" |
22 | #include "mediadlg.h" | 30 | #include "mediadlg.h" |
23 | 31 | ||
24 | /* OPIE */ | 32 | /* OPIE */ |
25 | #include <opie2/oglobal.h> | 33 | #include <opie2/oglobal.h> |
26 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <opie2/oresource.h> | ||
27 | #include <qtopia/config.h> | 36 | #include <qtopia/config.h> |
28 | #include <qtopia/mimetype.h> | 37 | #include <qtopia/mimetype.h> |
29 | #include <qtopia/resource.h> | ||
30 | #include <qtopia/private/categories.h> | 38 | #include <qtopia/private/categories.h> |
31 | #include <qtopia/qpeapplication.h> | 39 | #include <qtopia/qpeapplication.h> |
32 | #include <qtopia/applnk.h> | 40 | #include <qtopia/applnk.h> |
33 | #include <qtopia/storage.h> | 41 | #include <qtopia/storage.h> |
34 | #ifdef Q_WS_QWS | 42 | #ifdef Q_WS_QWS |
35 | #include <qtopia/qcopenvelope_qws.h> | 43 | #include <qtopia/qcopenvelope_qws.h> |
36 | #endif | 44 | #endif |
37 | using namespace Opie::Core; | 45 | using namespace Opie::Core; |
38 | 46 | ||
39 | /* QT */ | 47 | /* QT */ |
40 | #include <qtimer.h> | 48 | #include <qtimer.h> |
41 | #include <qfileinfo.h> | 49 | #include <qfileinfo.h> |
42 | #include <qtextstream.h> | 50 | #include <qtextstream.h> |
43 | #include <qfile.h> | 51 | #include <qfile.h> |
44 | #include <qdir.h> | 52 | #include <qdir.h> |
45 | #include <qpainter.h> | 53 | #include <qpainter.h> |
46 | #include <qimage.h> | 54 | #include <qimage.h> |
47 | #include <qcopchannel_qws.h> | 55 | #include <qcopchannel_qws.h> |
48 | #include <qlistview.h> | 56 | #include <qlistview.h> |
49 | #include <qlist.h> | 57 | #include <qlist.h> |
50 | #include <qpixmap.h> | 58 | #include <qpixmap.h> |
51 | 59 | ||
52 | 60 | ||
53 | AppLnkSet *DocumentList::appLnkSet = 0; | 61 | AppLnkSet *DocumentList::appLnkSet = 0; |
54 | 62 | ||
55 | static const int MAX_SEARCH_DEPTH = 10; | 63 | static const int MAX_SEARCH_DEPTH = 10; |
56 | 64 | ||
57 | 65 | ||
58 | class DocumentListPrivate : public QObject { | 66 | class DocumentListPrivate : public QObject { |
59 | Q_OBJECT | 67 | Q_OBJECT |
60 | public: | 68 | public: |
61 | DocumentListPrivate( ServerInterface *gui ); | 69 | DocumentListPrivate( ServerInterface *gui ); |
62 | ~DocumentListPrivate(); | 70 | ~DocumentListPrivate(); |
63 | 71 | ||
64 | void initialize(); | 72 | void initialize(); |
65 | 73 | ||
66 | const QString nextFile(); | 74 | const QString nextFile(); |
67 | const DocLnk *iterate(); | 75 | const DocLnk *iterate(); |
68 | bool store( DocLnk* dl ); | 76 | bool store( DocLnk* dl ); |
69 | void estimatedPercentScanned(); | 77 | void estimatedPercentScanned(); |
70 | void appendDocpath(FileSystem*); | 78 | void appendDocpath(FileSystem*); |
71 | 79 | ||
72 | 80 | ||
73 | DocLnkSet dls; | 81 | DocLnkSet dls; |
74 | QDict<void> reference; | 82 | QDict<void> reference; |
75 | QDictIterator<void> *dit; | 83 | QDictIterator<void> *dit; |
76 | enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; | 84 | enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; |
77 | 85 | ||
@@ -187,112 +195,109 @@ void DocumentList::rescan() | |||
187 | 195 | ||
188 | 196 | ||
189 | void DocumentList::timerEvent( QTimerEvent *te ) | 197 | void DocumentList::timerEvent( QTimerEvent *te ) |
190 | { | 198 | { |
191 | if ( te->timerId() == d->tid ) { | 199 | if ( te->timerId() == d->tid ) { |
192 | // Do 3 at a time | 200 | // Do 3 at a time |
193 | if ( d->serverGui ) | 201 | if ( d->serverGui ) |
194 | d->serverGui->aboutToAddBegin(); | 202 | d->serverGui->aboutToAddBegin(); |
195 | for (int i = 0; i < 3; i++ ) { | 203 | for (int i = 0; i < 3; i++ ) { |
196 | const DocLnk *lnk = d->iterate(); | 204 | const DocLnk *lnk = d->iterate(); |
197 | if ( lnk ) { | 205 | if ( lnk ) { |
198 | add( *lnk ); | 206 | add( *lnk ); |
199 | } else { | 207 | } else { |
200 | // stop when done | 208 | // stop when done |
201 | pause(); | 209 | pause(); |
202 | if ( d->serverGui ) | 210 | if ( d->serverGui ) |
203 | d->serverGui->documentScanningProgress( 100 ); | 211 | d->serverGui->documentScanningProgress( 100 ); |
204 | if ( d->needToSendAllDocLinks ) | 212 | if ( d->needToSendAllDocLinks ) |
205 | sendAllDocLinks(); | 213 | sendAllDocLinks(); |
206 | break; | 214 | break; |
207 | } | 215 | } |
208 | } | 216 | } |
209 | if ( d->serverGui ) | 217 | if ( d->serverGui ) |
210 | d->serverGui->aboutToAddEnd(); | 218 | d->serverGui->aboutToAddEnd(); |
211 | } | 219 | } |
212 | } | 220 | } |
213 | 221 | ||
214 | 222 | ||
215 | void DocumentList::reloadAppLnks() | 223 | void DocumentList::reloadAppLnks() |
216 | { | 224 | { |
217 | if ( d->sendAppLnks && d->serverGui ) { | 225 | if ( d->sendAppLnks && d->serverGui ) { |
218 | d->serverGui->applicationScanningProgress( 0 ); | 226 | d->serverGui->applicationScanningProgress( 0 ); |
219 | d->serverGui->allApplicationsRemoved(); | 227 | d->serverGui->allApplicationsRemoved(); |
220 | } | 228 | } |
221 | 229 | ||
222 | delete appLnkSet; | 230 | delete appLnkSet; |
223 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); | 231 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); |
224 | 232 | ||
225 | if ( d->sendAppLnks && d->serverGui ) { | 233 | if ( d->sendAppLnks && d->serverGui ) { |
226 | static QStringList prevTypeList; | 234 | static QStringList prevTypeList; |
227 | QStringList types = appLnkSet->types(); | 235 | QStringList types = appLnkSet->types(); |
228 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { | 236 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { |
229 | if ( !(*ittypes).isEmpty() ) { | 237 | if ( !(*ittypes).isEmpty() ) { |
230 | if ( !prevTypeList.contains(*ittypes) ) { | 238 | if ( !prevTypeList.contains(*ittypes) ) { |
231 | QString name = appLnkSet->typeName(*ittypes); | 239 | QString name = appLnkSet->typeName(*ittypes); |
232 | QPixmap pm = appLnkSet->typePixmap(*ittypes); | 240 | QPixmap pm = appLnkSet->typePixmap(*ittypes); |
233 | QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); | 241 | QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); |
234 | 242 | ||
235 | if (pm.isNull()) { | 243 | if (pm.isNull()) |
236 | QImage img( Resource::loadImage( "UnknownDocument" ) ); | 244 | { |
237 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 245 | pm = OResource::loadImage( "UnknownDocument", OResource::SmallIcon ); |
238 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); | 246 | bgPm = OResource::loadImage( "UnknownDocument", OResource::BigIcon ); |
239 | } | 247 | } |
240 | 248 | ||
241 | //odebug << "adding type " << (*ittypes) << "" << oendl; | 249 | //FIXME our current launcher expects docs tab to be last |
242 | |||
243 | // ### our current launcher expects docs tab to be last | ||
244 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); | 250 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); |
245 | } | 251 | } |
246 | prevTypeList.remove(*ittypes); | 252 | prevTypeList.remove(*ittypes); |
247 | } | 253 | } |
248 | } | 254 | } |
249 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { | 255 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { |
250 | //odebug << "removing type " << (*ittypes) << "" << oendl; | ||
251 | d->serverGui->typeRemoved(*ittypes); | 256 | d->serverGui->typeRemoved(*ittypes); |
252 | } | 257 | } |
253 | prevTypeList = types; | 258 | prevTypeList = types; |
254 | } | 259 | } |
255 | 260 | ||
256 | QListIterator<AppLnk> itapp( appLnkSet->children() ); | 261 | QListIterator<AppLnk> itapp( appLnkSet->children() ); |
257 | AppLnk* l; | 262 | AppLnk* l; |
258 | while ( (l=itapp.current()) ) { | 263 | while ( (l=itapp.current()) ) { |
259 | ++itapp; | 264 | ++itapp; |
260 | if ( d->sendAppLnks && d->serverGui ) | 265 | if ( d->sendAppLnks && d->serverGui ) |
261 | d->serverGui->applicationAdded( l->type(), *l ); | 266 | d->serverGui->applicationAdded( l->type(), *l ); |
262 | } | 267 | } |
263 | 268 | ||
264 | if ( d->sendAppLnks && d->serverGui ) | 269 | if ( d->sendAppLnks && d->serverGui ) |
265 | d->serverGui->applicationScanningProgress( 100 ); | 270 | d->serverGui->applicationScanningProgress( 100 ); |
266 | } | 271 | } |
267 | 272 | ||
268 | void DocumentList::reloadDocLnks() | 273 | void DocumentList::reloadDocLnks() |
269 | { | 274 | { |
270 | if ( !d->scanDocs ) | 275 | if ( !d->scanDocs ) |
271 | return; | 276 | return; |
272 | 277 | ||
273 | if ( d->sendDocLnks && d->serverGui ) { | 278 | if ( d->sendDocLnks && d->serverGui ) { |
274 | d->serverGui->documentScanningProgress( 0 ); | 279 | d->serverGui->documentScanningProgress( 0 ); |
275 | d->serverGui->allDocumentsRemoved(); | 280 | d->serverGui->allDocumentsRemoved(); |
276 | } | 281 | } |
277 | 282 | ||
278 | rescan(); | 283 | rescan(); |
279 | } | 284 | } |
280 | 285 | ||
281 | void DocumentList::reforceDocuments() | 286 | void DocumentList::reforceDocuments() |
282 | { | 287 | { |
283 | Config cfg( "Launcher" ); | 288 | Config cfg( "Launcher" ); |
284 | cfg.setGroup( "DocTab" ); | 289 | cfg.setGroup( "DocTab" ); |
285 | d->scanDocs = cfg.readBoolEntry( "Enable", true ); | 290 | d->scanDocs = cfg.readBoolEntry( "Enable", true ); |
286 | reloadDocLnks(); | 291 | reloadDocLnks(); |
287 | } | 292 | } |
288 | 293 | ||
289 | void DocumentList::linkChanged( QString arg ) | 294 | void DocumentList::linkChanged( QString arg ) |
290 | { | 295 | { |
291 | odebug << "linkchanged( " << arg << " )" << oendl; | 296 | odebug << "linkchanged( " << arg << " )" << oendl; |
292 | 297 | ||
293 | if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) { | 298 | if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) { |
294 | reloadAppLnks(); | 299 | reloadAppLnks(); |
295 | } else { | 300 | } else { |
296 | 301 | ||
297 | const QList<DocLnk> &list = d->dls.children(); | 302 | const QList<DocLnk> &list = d->dls.children(); |
298 | QListIterator<DocLnk> it( list ); | 303 | QListIterator<DocLnk> it( list ); |
@@ -312,112 +317,109 @@ void DocumentList::linkChanged( QString arg ) | |||
312 | d->serverGui->documentChanged( *doc, *dl ); | 317 | d->serverGui->documentChanged( *doc, *dl ); |
313 | 318 | ||
314 | } else { | 319 | } else { |
315 | // Link has been removed or doesn't match the mimetypes any more | 320 | // Link has been removed or doesn't match the mimetypes any more |
316 | // so we aren't interested in it, so take it away from the list | 321 | // so we aren't interested in it, so take it away from the list |
317 | //odebug << "removal case" << oendl; | 322 | //odebug << "removal case" << oendl; |
318 | if ( d->serverGui ) | 323 | if ( d->serverGui ) |
319 | d->serverGui->documentRemoved( *doc ); | 324 | d->serverGui->documentRemoved( *doc ); |
320 | 325 | ||
321 | } | 326 | } |
322 | d->dls.remove( doc ); // remove old link from docLnkSet | 327 | d->dls.remove( doc ); // remove old link from docLnkSet |
323 | delete doc; | 328 | delete doc; |
324 | return; | 329 | return; |
325 | } | 330 | } |
326 | } | 331 | } |
327 | // Didn't find existing link, must be new | 332 | // Didn't find existing link, must be new |
328 | DocLnk* dl = new DocLnk( arg ); | 333 | DocLnk* dl = new DocLnk( arg ); |
329 | if ( d->store( dl ) ) { | 334 | if ( d->store( dl ) ) { |
330 | // Add if it's a link we are interested in | 335 | // Add if it's a link we are interested in |
331 | //odebug << "add case" << oendl; | 336 | //odebug << "add case" << oendl; |
332 | add( *dl ); | 337 | add( *dl ); |
333 | } | 338 | } |
334 | 339 | ||
335 | } | 340 | } |
336 | } | 341 | } |
337 | 342 | ||
338 | void DocumentList::restoreDone() | 343 | void DocumentList::restoreDone() |
339 | { | 344 | { |
340 | reloadAppLnks(); | 345 | reloadAppLnks(); |
341 | reloadDocLnks(); | 346 | reloadDocLnks(); |
342 | } | 347 | } |
343 | 348 | ||
344 | void DocumentList::DiffAppLnks() | 349 | void DocumentList::DiffAppLnks() |
345 | { | 350 | { |
346 | static AppLnkSet *appLnkSet2; | 351 | static AppLnkSet *appLnkSet2; |
347 | 352 | ||
348 | appLnkSet2 = new AppLnkSet( MimeType::appsFolderName() ); | 353 | appLnkSet2 = new AppLnkSet( MimeType::appsFolderName() ); |
349 | 354 | ||
350 | if ( d->sendAppLnks && d->serverGui ) { | 355 | if ( d->sendAppLnks && d->serverGui ) { |
351 | static QStringList prevTypeList = appLnkSet->types(); | 356 | static QStringList prevTypeList = appLnkSet->types(); |
352 | QStringList types = appLnkSet2->types(); | 357 | QStringList types = appLnkSet2->types(); |
353 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { | 358 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { |
354 | if ( !(*ittypes).isEmpty() ) { | 359 | if ( !(*ittypes).isEmpty() ) { |
355 | if ( !prevTypeList.contains(*ittypes) ) { | 360 | if ( !prevTypeList.contains(*ittypes) ) { |
356 | QString name = appLnkSet2->typeName(*ittypes); | 361 | QString name = appLnkSet2->typeName(*ittypes); |
357 | QPixmap pm = appLnkSet2->typePixmap(*ittypes); | 362 | QPixmap pm = appLnkSet2->typePixmap(*ittypes); |
358 | QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes); | 363 | QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes); |
359 | 364 | ||
360 | if (pm.isNull()) { | 365 | if (pm.isNull()) |
361 | QImage img( Resource::loadImage( "UnknownDocument" ) ); | 366 | { |
362 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 367 | pm = OResource::loadImage( "UnknownDocument", OResource::SmallIcon ); |
363 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); | 368 | bgPm = OResource::loadImage( "UnknownDocument", OResource::BigIcon ); |
364 | } | 369 | } |
365 | 370 | ||
366 | odebug << "adding type " << (*ittypes) << "" << oendl; | ||
367 | |||
368 | // ### our current launcher expects docs tab to be last | 371 | // ### our current launcher expects docs tab to be last |
369 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); | 372 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); |
370 | } | 373 | } |
371 | prevTypeList.remove(*ittypes); | 374 | prevTypeList.remove(*ittypes); |
372 | } | 375 | } |
373 | } | 376 | } |
374 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { | 377 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { |
375 | odebug << "removing type " << (*ittypes) << "" << oendl; | ||
376 | d->serverGui->typeRemoved(*ittypes); | 378 | d->serverGui->typeRemoved(*ittypes); |
377 | } | 379 | } |
378 | prevTypeList = types; | 380 | prevTypeList = types; |
379 | } | 381 | } |
380 | 382 | ||
381 | 383 | ||
382 | QListIterator<AppLnk> it1( appLnkSet->children() ); | 384 | QListIterator<AppLnk> it1( appLnkSet->children() ); |
383 | QListIterator<AppLnk> it2( appLnkSet2->children() ); | 385 | QListIterator<AppLnk> it2( appLnkSet2->children() ); |
384 | 386 | ||
385 | AppLnk *i; | 387 | AppLnk *i; |
386 | AppLnk *j; | 388 | AppLnk *j; |
387 | bool found; | 389 | bool found; |
388 | 390 | ||
389 | while ( (j=it2.current()) ) { | 391 | while ( (j=it2.current()) ) { |
390 | it1 = appLnkSet->children(); | 392 | it1 = appLnkSet->children(); |
391 | found = false; | 393 | found = false; |
392 | while ( (i=it1.current()) ){ | 394 | while ( (i=it1.current()) ){ |
393 | if (j->name().ascii() && i->name().ascii() && strcmp(i->name().ascii(),j->name().ascii()) == 0) | 395 | if (j->name().ascii() && i->name().ascii() && strcmp(i->name().ascii(),j->name().ascii()) == 0) |
394 | found = true; | 396 | found = true; |
395 | ++it1; | 397 | ++it1; |
396 | } | 398 | } |
397 | if (!found) { | 399 | if (!found) { |
398 | odebug << "Item " << j->name().ascii() << " needs to be added" << oendl; | 400 | odebug << "Item " << j->name().ascii() << " needs to be added" << oendl; |
399 | d->serverGui->applicationAdded( j->type(), *j ); | 401 | d->serverGui->applicationAdded( j->type(), *j ); |
400 | } | 402 | } |
401 | ++it2; | 403 | ++it2; |
402 | } | 404 | } |
403 | 405 | ||
404 | it1 = appLnkSet->children(); | 406 | it1 = appLnkSet->children(); |
405 | while ( (i=it1.current()) ) { | 407 | while ( (i=it1.current()) ) { |
406 | it2 = appLnkSet2->children(); | 408 | it2 = appLnkSet2->children(); |
407 | found = false; | 409 | found = false; |
408 | while ( (j=it2.current()) ){ | 410 | while ( (j=it2.current()) ){ |
409 | if (j->name().ascii() && i->name().ascii() && strcmp(i->name().ascii(),j->name().ascii()) == 0) | 411 | if (j->name().ascii() && i->name().ascii() && strcmp(i->name().ascii(),j->name().ascii()) == 0) |
410 | found = true; | 412 | found = true; |
411 | ++it2; | 413 | ++it2; |
412 | } | 414 | } |
413 | if (!found) { | 415 | if (!found) { |
414 | odebug << "Item " << i->name().ascii() << " needs to be removed" << oendl; | 416 | odebug << "Item " << i->name().ascii() << " needs to be removed" << oendl; |
415 | d->serverGui->applicationRemoved( i->type(), *i ); | 417 | d->serverGui->applicationRemoved( i->type(), *i ); |
416 | } | 418 | } |
417 | 419 | ||
418 | ++it1; | 420 | ++it1; |
419 | } | 421 | } |
420 | 422 | ||
421 | delete appLnkSet; | 423 | delete appLnkSet; |
422 | appLnkSet = appLnkSet2; | 424 | appLnkSet = appLnkSet2; |
423 | 425 | ||
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp index 8344787..8c02ab0 100644 --- a/core/launcher/firstuse.cpp +++ b/core/launcher/firstuse.cpp | |||
@@ -1,85 +1,92 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | =. (C) 2000-2002 Trolltech AS |
4 | ** This file is part of the Qtopia Environment. | 4 | .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This program is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ** | 18 | ..}^=.= = ; Library General Public License for more |
19 | **********************************************************************/ | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
20 | 28 | ||
21 | // I need access to some things you don't normally get access to. | 29 | // I need access to some things you don't normally get access to. |
22 | |||
23 | #ifndef _MSC_VER | 30 | #ifndef _MSC_VER |
24 | //### revise to allow removal of translators under MSVC | 31 | //### revise to allow removal of translators under MSVC |
25 | #define private public | 32 | #define private public |
26 | #define protected public | 33 | #define protected public |
27 | #endif | 34 | #endif |
28 | #include "firstuse.h" | 35 | #include "firstuse.h" |
29 | #include "inputmethods.h" | 36 | #include "inputmethods.h" |
30 | #include "applauncher.h" | 37 | #include "applauncher.h" |
31 | #include "serverapp.h" | 38 | #include "serverapp.h" |
32 | #include "calibrate.h" | 39 | #include "calibrate.h" |
33 | #include "documentlist.h" | 40 | #include "documentlist.h" |
34 | 41 | ||
35 | /* OPIE */ | 42 | /* OPIE */ |
36 | #include <opie2/odebug.h> | 43 | #include <opie2/odebug.h> |
37 | #include <qtopia/resource.h> | 44 | #include <opie2/oresource.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 45 | #include <qtopia/qcopenvelope_qws.h> |
39 | #include <qtopia/config.h> | 46 | #include <qtopia/config.h> |
40 | #include <qtopia/fontmanager.h> | 47 | #include <qtopia/fontmanager.h> |
41 | using namespace Opie::Core; | 48 | using namespace Opie::Core; |
42 | 49 | ||
43 | /* QT */ | 50 | /* QT */ |
44 | #include <qfile.h> | 51 | #include <qfile.h> |
45 | #include <qpainter.h> | 52 | #include <qpainter.h> |
46 | #include <qsimplerichtext.h> | 53 | #include <qsimplerichtext.h> |
47 | #include <qpushbutton.h> | 54 | #include <qpushbutton.h> |
48 | #include <qlabel.h> | 55 | #include <qlabel.h> |
49 | #include <qtimer.h> | 56 | #include <qtimer.h> |
50 | 57 | ||
51 | #if defined( Q_WS_QWS ) | 58 | #if defined( Q_WS_QWS ) |
52 | #include <qwsdisplay_qws.h> | 59 | #include <qwsdisplay_qws.h> |
53 | #include <qgfx_qws.h> | 60 | #include <qgfx_qws.h> |
54 | #endif | 61 | #endif |
55 | 62 | ||
56 | /* STD */ | 63 | /* STD */ |
57 | #include <stdlib.h> | 64 | #include <stdlib.h> |
58 | #include <sys/types.h> | 65 | #include <sys/types.h> |
59 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) | 66 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) |
60 | #include <unistd.h> | 67 | #include <unistd.h> |
61 | #endif | 68 | #endif |
62 | 69 | ||
63 | 70 | ||
64 | struct settingsTable_t { | 71 | struct settingsTable_t { |
65 | bool enabled : 1; | 72 | bool enabled : 1; |
66 | const char *app; | 73 | const char *app; |
67 | const char *start; | 74 | const char *start; |
68 | const char *stop; | 75 | const char *stop; |
69 | const char *desc; | 76 | const char *desc; |
70 | }; | 77 | }; |
71 | 78 | ||
72 | static settingsTable_t settingsTable [] = | 79 | static settingsTable_t settingsTable [] = |
73 | { | 80 | { |
74 | { FALSE, "language", "raise()", "accept()", // No tr | 81 | { FALSE, "language", "raise()", "accept()", // No tr |
75 | QT_TR_NOOP("Language") }, | 82 | QT_TR_NOOP("Language") }, |
76 | { FALSE, "doctab", "raise()", "accept()", // No tr | 83 | { FALSE, "doctab", "raise()", "accept()", // No tr |
77 | QT_TR_NOOP("DocTab") }, | 84 | QT_TR_NOOP("DocTab") }, |
78 | #ifndef Q_OS_WIN32 | 85 | #ifndef Q_OS_WIN32 |
79 | { FALSE, "systemtime", "raise()", "accept()", // No tr | 86 | { FALSE, "systemtime", "raise()", "accept()", // No tr |
80 | QT_TR_NOOP("Time and Date") }, | 87 | QT_TR_NOOP("Time and Date") }, |
81 | #endif | 88 | #endif |
82 | { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr | 89 | { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr |
83 | QT_TR_NOOP("Personal Information") }, | 90 | QT_TR_NOOP("Personal Information") }, |
84 | { FALSE, 0, 0, 0, 0 } | 91 | { FALSE, 0, 0, 0, 0 } |
85 | }; | 92 | }; |
@@ -196,102 +203,100 @@ FirstUse::~FirstUse() | |||
196 | delete taskBar; | 203 | delete taskBar; |
197 | ServerApplication::allowRestart = TRUE; | 204 | ServerApplication::allowRestart = TRUE; |
198 | } | 205 | } |
199 | 206 | ||
200 | void FirstUse::calcMaxWindowRect() | 207 | void FirstUse::calcMaxWindowRect() |
201 | { | 208 | { |
202 | #ifdef Q_WS_QWS | 209 | #ifdef Q_WS_QWS |
203 | QRect wr; | 210 | QRect wr; |
204 | int displayWidth = qApp->desktop()->width(); | 211 | int displayWidth = qApp->desktop()->width(); |
205 | QRect ir = inputMethods->inputRect(); | 212 | QRect ir = inputMethods->inputRect(); |
206 | if ( ir.isValid() ) { | 213 | if ( ir.isValid() ) { |
207 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); | 214 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); |
208 | } else { | 215 | } else { |
209 | wr.setCoords( 0, 0, displayWidth-1, | 216 | wr.setCoords( 0, 0, displayWidth-1, |
210 | qApp->desktop()->height() - controlHeight-1); | 217 | qApp->desktop()->height() - controlHeight-1); |
211 | } | 218 | } |
212 | 219 | ||
213 | #if QT_VERSION < 0x030000 | 220 | #if QT_VERSION < 0x030000 |
214 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, | 221 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, |
215 | QSize(qt_screen->width(),qt_screen->height())) | 222 | QSize(qt_screen->width(),qt_screen->height())) |
216 | ); | 223 | ); |
217 | #else | 224 | #else |
218 | QWSServer::setMaxWindowRect( wr ); | 225 | QWSServer::setMaxWindowRect( wr ); |
219 | #endif | 226 | #endif |
220 | #endif | 227 | #endif |
221 | } | 228 | } |
222 | 229 | ||
223 | /* cancel current dialog, and bring up next */ | 230 | /* cancel current dialog, and bring up next */ |
224 | void FirstUse::nextDialog() | 231 | void FirstUse::nextDialog() |
225 | { | 232 | { |
226 | int prevApp = currApp; | 233 | int prevApp = currApp; |
227 | do { | 234 | do { |
228 | currApp++; | 235 | currApp++; |
229 | odebug << "currApp = " << currApp << "" << oendl; | 236 | odebug << "currApp = " << currApp << "" << oendl; |
230 | if ( settingsTable[currApp].app == 0 ) { | 237 | if ( settingsTable[currApp].app == 0 ) { |
231 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { | 238 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { |
232 | // The last application is still running. | 239 | // The last application is still running. |
233 | // Tell it to stop, and when its done we'll come back | 240 | // Tell it to stop, and when its done we'll come back |
234 | // to nextDialog and exit. | 241 | // to nextDialog and exit. |
235 | odebug << "Waiting for " << settingsTable[prevApp].app << " to exit" << oendl; | 242 | odebug << "Waiting for " << settingsTable[prevApp].app << " to exit" << oendl; |
236 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 243 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
237 | settingsTable[prevApp].stop ); | 244 | settingsTable[prevApp].stop ); |
238 | currApp = prevApp; | 245 | currApp = prevApp; |
239 | } else { | 246 | } else { |
240 | odebug << "Done!" << oendl; | 247 | odebug << "Done!" << oendl; |
241 | Config config( "qpe" ); | 248 | Config config( "qpe" ); |
242 | config.setGroup( "Startup" ); | 249 | config.setGroup( "Startup" ); |
243 | config.writeEntry( "FirstUse", FALSE ); | 250 | config.writeEntry( "FirstUse", FALSE ); |
244 | QPixmap pix = Resource::loadPixmap("bigwait"); | 251 | QLabel *lblWait = new QLabel("Please Wait...", 0, "wait hack!", // No tr |
245 | QLabel *lblWait = new QLabel(0, "wait hack!", // No tr | ||
246 | QWidget::WStyle_Customize | QWidget::WDestructiveClose | | 252 | QWidget::WStyle_Customize | QWidget::WDestructiveClose | |
247 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool | | 253 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool | |
248 | QWidget::WStyle_StaysOnTop); | 254 | QWidget::WStyle_StaysOnTop); |
249 | lblWait->setPixmap( pix ); | ||
250 | lblWait->setAlignment( QWidget::AlignCenter ); | 255 | lblWait->setAlignment( QWidget::AlignCenter ); |
251 | lblWait->setGeometry( qApp->desktop()->geometry() ); | 256 | lblWait->setGeometry( qApp->desktop()->geometry() ); |
252 | lblWait->show(); | 257 | lblWait->show(); |
253 | qApp->processEvents(); | 258 | qApp->processEvents(); |
254 | QTimer::singleShot( 1000, lblWait, SLOT(close()) ); | 259 | QTimer::singleShot( 1000, lblWait, SLOT(close()) ); |
255 | repaint(); | 260 | repaint(); |
256 | close(); | 261 | close(); |
257 | ServerApplication::allowRestart = TRUE; | 262 | ServerApplication::allowRestart = TRUE; |
258 | } | 263 | } |
259 | return; | 264 | return; |
260 | } | 265 | } |
261 | } while ( !settingsTable[currApp].enabled ); | 266 | } while ( !settingsTable[currApp].enabled ); |
262 | 267 | ||
263 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { | 268 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { |
264 | odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl; | 269 | odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl; |
265 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 270 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
266 | settingsTable[prevApp].stop ); | 271 | settingsTable[prevApp].stop ); |
267 | waitForExit = prevApp; | 272 | waitForExit = prevApp; |
268 | } else { | 273 | } else { |
269 | odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; | 274 | odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; |
270 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, | 275 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, |
271 | settingsTable[currApp].start ); | 276 | settingsTable[currApp].start ); |
272 | waitingForLaunch = TRUE; | 277 | waitingForLaunch = TRUE; |
273 | } | 278 | } |
274 | 279 | ||
275 | updateButtons(); | 280 | updateButtons(); |
276 | } | 281 | } |
277 | 282 | ||
278 | /* accept current dialog and bring up previous */ | 283 | /* accept current dialog and bring up previous */ |
279 | void FirstUse::previousDialog() | 284 | void FirstUse::previousDialog() |
280 | { | 285 | { |
281 | int prevApp = currApp; | 286 | int prevApp = currApp; |
282 | do { | 287 | do { |
283 | currApp--; | 288 | currApp--; |
284 | if ( currApp < 0 ) { | 289 | if ( currApp < 0 ) { |
285 | currApp = prevApp; | 290 | currApp = prevApp; |
286 | return; | 291 | return; |
287 | } | 292 | } |
288 | } while ( !settingsTable[currApp].enabled ); | 293 | } while ( !settingsTable[currApp].enabled ); |
289 | 294 | ||
290 | if ( prevApp >= 0 ) { | 295 | if ( prevApp >= 0 ) { |
291 | odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl; | 296 | odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl; |
292 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 297 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
293 | settingsTable[prevApp].stop ); | 298 | settingsTable[prevApp].stop ); |
294 | /* | 299 | /* |
295 | if (settingsTable[prevApp].app == QString("systemtime")) | 300 | if (settingsTable[prevApp].app == QString("systemtime")) |
296 | QCopEnvelope e("QPE/Application/citytime", "close()"); | 301 | QCopEnvelope e("QPE/Application/citytime", "close()"); |
297 | */ | 302 | */ |
@@ -385,118 +390,111 @@ void FirstUse::reloadLanguages() | |||
385 | // clear old translators | 390 | // clear old translators |
386 | #ifndef _MSC_VER | 391 | #ifndef _MSC_VER |
387 | //### revise to allow removal of translators under MSVC | 392 | //### revise to allow removal of translators under MSVC |
388 | if(qApp->translators) { | 393 | if(qApp->translators) { |
389 | qApp->translators->setAutoDelete(TRUE); | 394 | qApp->translators->setAutoDelete(TRUE); |
390 | delete (qApp->translators); | 395 | delete (qApp->translators); |
391 | qApp->translators = 0; | 396 | qApp->translators = 0; |
392 | } | 397 | } |
393 | #endif | 398 | #endif |
394 | 399 | ||
395 | // load translation tables | 400 | // load translation tables |
396 | transApp = new QTranslator(qApp); | 401 | transApp = new QTranslator(qApp); |
397 | QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm"; | 402 | QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm"; |
398 | owarn << "loading " + tfn << oendl; | 403 | owarn << "loading " + tfn << oendl; |
399 | if ( transApp->load(tfn) ) { | 404 | if ( transApp->load(tfn) ) { |
400 | owarn << "installing translator" << oendl; | 405 | owarn << "installing translator" << oendl; |
401 | qApp->installTranslator( transApp ); | 406 | qApp->installTranslator( transApp ); |
402 | } else { | 407 | } else { |
403 | delete transApp; | 408 | delete transApp; |
404 | transApp = 0; | 409 | transApp = 0; |
405 | } | 410 | } |
406 | 411 | ||
407 | transLib = new QTranslator(qApp); | 412 | transLib = new QTranslator(qApp); |
408 | tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm"; | 413 | tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm"; |
409 | owarn << "loading " + tfn << oendl; | 414 | owarn << "loading " + tfn << oendl; |
410 | if ( transLib->load(tfn) ) { | 415 | if ( transLib->load(tfn) ) { |
411 | owarn << "installing translator library" << oendl; | 416 | owarn << "installing translator library" << oendl; |
412 | qApp->installTranslator( transLib ); | 417 | qApp->installTranslator( transLib ); |
413 | } else { | 418 | } else { |
414 | delete transLib; | 419 | delete transLib; |
415 | transLib = 0; | 420 | transLib = 0; |
416 | } | 421 | } |
417 | loadPixmaps(); | 422 | loadPixmaps(); |
418 | //###language/font hack; should look it up somewhere | 423 | //###language/font hack; should look it up somewhere |
419 | #ifdef Q_WS_QWS | 424 | #ifdef Q_WS_QWS |
420 | if ( l == "ja" || l == "zh_CN" || l == "zh_TW" || l == "ko" ) { | 425 | if ( l == "ja" || l == "zh_CN" || l == "zh_TW" || l == "ko" ) { |
421 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 426 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
422 | qApp->setFont( fn, TRUE ); | 427 | qApp->setFont( fn, TRUE ); |
423 | } else { | 428 | } else { |
424 | qApp->setFont( defaultFont, TRUE ); | 429 | qApp->setFont( defaultFont, TRUE ); |
425 | } | 430 | } |
426 | #endif | 431 | #endif |
427 | #endif | 432 | #endif |
428 | } | 433 | } |
429 | 434 | ||
430 | void FirstUse::paintEvent( QPaintEvent * ) | 435 | void FirstUse::paintEvent( QPaintEvent * ) |
431 | { | 436 | { |
432 | QPainter p( this ); | 437 | QPainter p( this ); |
433 | |||
434 | p.drawPixmap(0,0, splash); | 438 | p.drawPixmap(0,0, splash); |
435 | 439 | ||
436 | QFont f = p.font(); | ||
437 | f.setPointSize(15); | ||
438 | f.setItalic(FALSE); | ||
439 | f.setBold(FALSE); | ||
440 | p.setFont(f); | ||
441 | |||
442 | if ( currApp < 0 ) { | 440 | if ( currApp < 0 ) { |
443 | drawText(p, tr( "Tap anywhere on the screen to continue." )); | 441 | drawText(p, tr( "Tap anywhere on the screen to continue." )); |
444 | } else if ( settingsTable[currApp].app ) { | 442 | } else if ( settingsTable[currApp].app ) { |
445 | if ( waitingForLaunch ) | 443 | if ( waitingForLaunch ) |
446 | drawText(p, tr("Please wait, loading %1 settings.").arg(tr(settingsTable[currApp].desc)) ); | 444 | drawText(p, tr("Please wait, loading %1 settings.").arg(tr(settingsTable[currApp].desc)) ); |
447 | } else { | 445 | } else { |
448 | drawText(p, tr("Please wait...")); | 446 | drawText(p, tr("Please wait...")); |
449 | } | 447 | } |
450 | } | 448 | } |
451 | 449 | ||
452 | void FirstUse::loadPixmaps() | 450 | void FirstUse::loadPixmaps() |
453 | { | 451 | { |
454 | splash.convertFromImage( Resource::loadImage("launcher/firstuse") | 452 | splash.convertFromImage( OResource::loadImage("launcher/firstuse", OResource::NoScale ) |
455 | .smoothScale( width(), height() ) ); | 453 | .smoothScale( width(), height() ) ); |
456 | 454 | ||
457 | setBackgroundPixmap(splash); | 455 | setBackgroundPixmap(splash); |
458 | } | 456 | } |
459 | 457 | ||
460 | void FirstUse::drawText(QPainter &p, const QString &text) | 458 | void FirstUse::drawText(QPainter &p, const QString &text) |
461 | { | 459 | { |
462 | QString altered = "<CENTER>" + text + "</CENTER>"; | 460 | QString altered = "<CENTER>" + text + "</CENTER>"; |
463 | 461 | ||
464 | QSimpleRichText rt(altered, p.font()); | 462 | QSimpleRichText rt(altered, p.font()); |
465 | rt.setWidth(width() - 20); | 463 | rt.setWidth(width() - 20); |
466 | 464 | ||
467 | int h = (height() * 3) / 10; // start at 30% | 465 | int h = (height() * 3) / 10; // start at 30% |
468 | if (rt.height() < height() / 2) | 466 | if (rt.height() < height() / 2) |
469 | h += ((height() / 2) - rt.height()) / 2; | 467 | h += ((height() / 2) - rt.height()) / 2; |
470 | rt.draw(&p, 10, h, QRegion(0,0, width()-20, height()), palette()); | 468 | rt.draw(&p, 10, h, QRegion(0,0, width()-20, height()), palette()); |
471 | } | 469 | } |
472 | 470 | ||
473 | void FirstUse::updateButtons() | 471 | void FirstUse::updateButtons() |
474 | { | 472 | { |
475 | if ( currApp >= 0 ) { | 473 | if ( currApp >= 0 ) { |
476 | taskBar->show(); | 474 | taskBar->show(); |
477 | } | 475 | } |
478 | 476 | ||
479 | int i = currApp-1; | 477 | int i = currApp-1; |
480 | while ( i >= 0 && !settingsTable[i].enabled ) | 478 | while ( i >= 0 && !settingsTable[i].enabled ) |
481 | i--; | 479 | i--; |
482 | back->setText(tr("<< Back")); | 480 | back->setText(tr("<< Back")); |
483 | back->setEnabled( i >= 0 && !waitingForLaunch ); | 481 | back->setEnabled( i >= 0 && !waitingForLaunch ); |
484 | 482 | ||
485 | i = currApp+1; | 483 | i = currApp+1; |
486 | while ( settingsTable[i].app && !settingsTable[i].enabled ) | 484 | while ( settingsTable[i].app && !settingsTable[i].enabled ) |
487 | i++; | 485 | i++; |
488 | if ( !settingsTable[i].app ) | 486 | if ( !settingsTable[i].app ) |
489 | next->setText(tr("Finish")); | 487 | next->setText(tr("Finish")); |
490 | else | 488 | else |
491 | next->setText(tr("Next >>")); | 489 | next->setText(tr("Next >>")); |
492 | 490 | ||
493 | next->setEnabled( !waitingForLaunch ); | 491 | next->setEnabled( !waitingForLaunch ); |
494 | } | 492 | } |
495 | 493 | ||
496 | void FirstUse::keyPressEvent( QKeyEvent *e ) | 494 | void FirstUse::keyPressEvent( QKeyEvent *e ) |
497 | { | 495 | { |
498 | // Allow cancelling at first dialog, in case display is broken. | 496 | // Allow cancelling at first dialog, in case display is broken. |
499 | if ( e->key() == Key_Escape && currApp < 0 ) | 497 | if ( e->key() == Key_Escape && currApp < 0 ) |
500 | QDialog::keyPressEvent(e); | 498 | QDialog::keyPressEvent(e); |
501 | } | 499 | } |
502 | 500 | ||
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 4ec5f4c..361a159 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1,174 +1,181 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | =. (C) 2000-2002 Trolltech AS |
4 | ** This file is part of the Qtopia Environment. | 4 | .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This program is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ** | 18 | ..}^=.= = ; Library General Public License for more |
19 | **********************************************************************/ | 19 | ++= -. .` .: details. |
20 | 20 | : = ...= . :.=- | |
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
21 | #include "startmenu.h" | 28 | #include "startmenu.h" |
22 | #include "taskbar.h" | 29 | #include "taskbar.h" |
23 | #include "serverinterface.h" | 30 | #include "serverinterface.h" |
24 | #include "launcherview.h" | 31 | #include "launcherview.h" |
25 | #include "launcher.h" | 32 | #include "launcher.h" |
26 | #include "server.h" | 33 | #include "server.h" |
27 | |||
28 | /* OPIE */ | 34 | /* OPIE */ |
29 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
36 | #include <opie2/oresource.h> | ||
37 | using namespace Opie::Core; | ||
38 | |||
30 | #include <qtopia/global.h> | 39 | #include <qtopia/global.h> |
31 | #ifdef Q_WS_QWS | 40 | #ifdef Q_WS_QWS |
32 | #include <qtopia/qcopenvelope_qws.h> | 41 | #include <qtopia/qcopenvelope_qws.h> |
33 | #endif | 42 | #endif |
34 | #include <qtopia/resource.h> | ||
35 | #include <qtopia/applnk.h> | 43 | #include <qtopia/applnk.h> |
36 | #include <qtopia/config.h> | 44 | #include <qtopia/config.h> |
37 | #include <qtopia/qpeapplication.h> | 45 | #include <qtopia/qpeapplication.h> |
38 | #include <qtopia/mimetype.h> | 46 | #include <qtopia/mimetype.h> |
39 | #include <qtopia/private/categories.h> | 47 | #include <qtopia/private/categories.h> |
40 | #define QTOPIA_INTERNAL_FSLP | 48 | #define QTOPIA_INTERNAL_FSLP |
41 | #include <qtopia/lnkproperties.h> | 49 | #include <qtopia/lnkproperties.h> |
42 | 50 | ||
43 | /* QT */ | 51 | /* QT */ |
44 | #include <qdir.h> | 52 | #include <qdir.h> |
45 | #ifdef Q_WS_QWS | 53 | #ifdef Q_WS_QWS |
46 | #include <qkeyboard_qws.h> | 54 | #include <qkeyboard_qws.h> |
47 | #include <qwindowsystem_qws.h> | 55 | #include <qwindowsystem_qws.h> |
48 | #endif | 56 | #endif |
49 | #include <qtimer.h> | 57 | #include <qtimer.h> |
50 | #include <qcombobox.h> | 58 | #include <qcombobox.h> |
51 | #include <qvbox.h> | 59 | #include <qvbox.h> |
52 | #include <qlayout.h> | 60 | #include <qlayout.h> |
53 | #include <qstyle.h> | 61 | #include <qstyle.h> |
54 | #include <qpushbutton.h> | 62 | #include <qpushbutton.h> |
55 | #include <qtabbar.h> | 63 | #include <qtabbar.h> |
56 | #include <qwidgetstack.h> | 64 | #include <qwidgetstack.h> |
57 | #include <qregexp.h> | 65 | #include <qregexp.h> |
58 | #include <qmessagebox.h> | 66 | #include <qmessagebox.h> |
59 | #include <qframe.h> | 67 | #include <qframe.h> |
60 | #include <qpainter.h> | 68 | #include <qpainter.h> |
61 | #include <qlabel.h> | 69 | #include <qlabel.h> |
62 | #include <qtextstream.h> | 70 | #include <qtextstream.h> |
63 | #include <qpopupmenu.h> | 71 | #include <qpopupmenu.h> |
64 | 72 | ||
65 | /* STD */ | 73 | /* STD */ |
66 | #include <stdlib.h> | 74 | #include <stdlib.h> |
67 | #include <assert.h> | 75 | #include <assert.h> |
68 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 76 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
69 | #include <unistd.h> | 77 | #include <unistd.h> |
70 | #include <stdio.h> | 78 | #include <stdio.h> |
71 | #include <sys/vfs.h> | 79 | #include <sys/vfs.h> |
72 | #include <mntent.h> | 80 | #include <mntent.h> |
73 | #endif | 81 | #endif |
74 | 82 | ||
75 | 83 | ||
76 | static bool isVisibleWindow( int ); | 84 | static bool isVisibleWindow( int ); |
77 | //=========================================================================== | 85 | //=========================================================================== |
78 | 86 | ||
79 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : | 87 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : |
80 | QVBox( parent ), docview( 0 ),docTabEnabled(true),m_DocumentTabId(0) | 88 | QVBox( parent ), docview( 0 ),docTabEnabled(true),m_DocumentTabId(0) |
81 | { | 89 | { |
82 | docLoadingWidgetEnabled = false; | 90 | docLoadingWidgetEnabled = false; |
83 | docLoadingWidget = 0; | 91 | docLoadingWidget = 0; |
84 | docLoadingWidgetProgress = 0; | 92 | docLoadingWidgetProgress = 0; |
85 | launcher = parent; | 93 | launcher = parent; |
86 | categoryBar = new LauncherTabBar( this ); | 94 | categoryBar = new LauncherTabBar( this ); |
87 | QPalette pal = categoryBar->palette(); | 95 | QPalette pal = categoryBar->palette(); |
88 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 96 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
89 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 97 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
90 | categoryBar->setPalette( pal ); | 98 | categoryBar->setPalette( pal ); |
91 | stack = new QWidgetStack(this); | 99 | stack = new QWidgetStack(this); |
92 | connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); | 100 | connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); |
93 | categoryBar->show(); | 101 | categoryBar->show(); |
94 | stack->show(); | 102 | stack->show(); |
95 | 103 | ||
96 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 104 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
97 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); | 105 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); |
98 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 106 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
99 | this, SLOT(launcherMessage(const QCString&,const QByteArray&)) ); | 107 | this, SLOT(launcherMessage(const QCString&,const QByteArray&)) ); |
100 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 108 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
101 | this, SLOT(appMessage(const QCString&,const QByteArray&))); | 109 | this, SLOT(appMessage(const QCString&,const QByteArray&))); |
102 | #endif | 110 | #endif |
103 | 111 | ||
104 | createDocLoadingWidget(); | 112 | createDocLoadingWidget(); |
105 | } | 113 | } |
106 | 114 | ||
107 | void LauncherTabWidget::createDocLoadingWidget() | 115 | void LauncherTabWidget::createDocLoadingWidget() |
108 | { | 116 | { |
109 | // Construct the 'doc loading widget' shown when finding documents | 117 | // Construct the 'doc loading widget' shown when finding documents |
110 | 118 | ||
111 | // ### LauncherView class needs changing to be more generic so | 119 | // ### LauncherView class needs changing to be more generic so |
112 | // this widget can change its background similar to the iconviews | 120 | // this widget can change its background similar to the iconviews |
113 | // so the background for this matches | 121 | // so the background for this matches |
114 | docLoadingWidget = new LauncherView( stack ); | 122 | docLoadingWidget = new LauncherView( stack ); |
115 | docLoadingWidget->hideIcons(); | 123 | docLoadingWidget->hideIcons(); |
116 | QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); | 124 | QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); |
117 | 125 | ||
118 | docLoadingVBox->setSpacing( 20 ); | 126 | docLoadingVBox->setSpacing( 20 ); |
119 | docLoadingVBox->setMargin( 10 ); | 127 | docLoadingVBox->setMargin( 10 ); |
120 | 128 | ||
121 | QWidget *space1 = new QWidget( docLoadingVBox ); | 129 | QWidget *space1 = new QWidget( docLoadingVBox ); |
122 | docLoadingVBox->setStretchFactor( space1, 1 ); | 130 | docLoadingVBox->setStretchFactor( space1, 1 ); |
123 | 131 | ||
124 | QLabel *waitPixmap = new QLabel( docLoadingVBox ); | 132 | QLabel *waitPixmap = new QLabel( "Please Wait...", docLoadingVBox ); |
125 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); | 133 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); |
126 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); | ||
127 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); | 134 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); |
128 | 135 | ||
129 | Config cfg( "Launcher" ); | 136 | Config cfg( "Launcher" ); |
130 | cfg.setGroup( "DocTab" ); | 137 | cfg.setGroup( "DocTab" ); |
131 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); | 138 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); |
132 | 139 | ||
133 | QLabel *textLabel = new QLabel( docLoadingVBox ); | 140 | QLabel *textLabel = new QLabel( docLoadingVBox ); |
134 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); | 141 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); |
135 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); | 142 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); |
136 | docLoadingWidgetProgress->setProgress( 0 ); | 143 | docLoadingWidgetProgress->setProgress( 0 ); |
137 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); | 144 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); |
138 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker | 145 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker |
139 | setProgressStyle(); | 146 | setProgressStyle(); |
140 | 147 | ||
141 | if ( docTabEnabled ) | 148 | if ( docTabEnabled ) |
142 | { | 149 | { |
143 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); | 150 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); |
144 | } | 151 | } |
145 | else | 152 | else |
146 | { | 153 | { |
147 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" | 154 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" |
148 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); | 155 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); |
149 | docLoadingWidgetProgress->hide(); | 156 | docLoadingWidgetProgress->hide(); |
150 | docLoadingWidgetEnabled = true; | 157 | docLoadingWidgetEnabled = true; |
151 | } | 158 | } |
152 | 159 | ||
153 | QWidget *space2 = new QWidget( docLoadingVBox ); | 160 | QWidget *space2 = new QWidget( docLoadingVBox ); |
154 | docLoadingVBox->setStretchFactor( space2, 1 ); | 161 | docLoadingVBox->setStretchFactor( space2, 1 ); |
155 | 162 | ||
156 | cfg.setGroup( "Tab Documents" ); // No tr | 163 | cfg.setGroup( "Tab Documents" ); // No tr |
157 | setTabViewAppearance( docLoadingWidget, cfg ); | 164 | setTabViewAppearance( docLoadingWidget, cfg ); |
158 | 165 | ||
159 | stack->addWidget( docLoadingWidget, 0 ); | 166 | stack->addWidget( docLoadingWidget, 0 ); |
160 | } | 167 | } |
161 | 168 | ||
162 | void LauncherTabWidget::initLayout() | 169 | void LauncherTabWidget::initLayout() |
163 | { | 170 | { |
164 | layout()->activate(); | 171 | layout()->activate(); |
165 | docView()->setFocus(); | 172 | docView()->setFocus(); |
166 | categoryBar->showTab("Documents"); | 173 | categoryBar->showTab("Documents"); |
167 | } | 174 | } |
168 | 175 | ||
169 | void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) | 176 | void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) |
170 | { | 177 | { |
171 | if ( message == "nextView()" ) | 178 | if ( message == "nextView()" ) |
172 | categoryBar->nextTab(); | 179 | categoryBar->nextTab(); |
173 | } | 180 | } |
174 | 181 | ||
@@ -484,101 +491,98 @@ void LauncherTabWidget::reCheckDoctab(int how) | |||
484 | odebug << "Sending doc rescan" << oendl; | 491 | odebug << "Sending doc rescan" << oendl; |
485 | } | 492 | } |
486 | } | 493 | } |
487 | 494 | ||
488 | //--------------------------------------------------------------------------- | 495 | //--------------------------------------------------------------------------- |
489 | 496 | ||
490 | Launcher::Launcher() | 497 | Launcher::Launcher() |
491 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) | 498 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) |
492 | { | 499 | { |
493 | tabs = 0; | 500 | tabs = 0; |
494 | tb = 0; | 501 | tb = 0; |
495 | Config cfg( "Launcher" ); | 502 | Config cfg( "Launcher" ); |
496 | cfg.setGroup( "DocTab" ); | 503 | cfg.setGroup( "DocTab" ); |
497 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); | 504 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); |
498 | } | 505 | } |
499 | 506 | ||
500 | void Launcher::createGUI() | 507 | void Launcher::createGUI() |
501 | { | 508 | { |
502 | setCaption( tr("Launcher") ); | 509 | setCaption( tr("Launcher") ); |
503 | 510 | ||
504 | // we have a pretty good idea how big we'll be | 511 | // we have a pretty good idea how big we'll be |
505 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); | 512 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); |
506 | 513 | ||
507 | tb = new TaskBar; | 514 | tb = new TaskBar; |
508 | tabs = new LauncherTabWidget( this ); | 515 | tabs = new LauncherTabWidget( this ); |
509 | setCentralWidget( tabs ); | 516 | setCentralWidget( tabs ); |
510 | 517 | ||
511 | ServerInterface::dockWidget( tb, ServerInterface::Bottom ); | 518 | ServerInterface::dockWidget( tb, ServerInterface::Bottom ); |
512 | tb->show(); | 519 | tb->show(); |
513 | 520 | ||
514 | qApp->installEventFilter( this ); | 521 | qApp->installEventFilter( this ); |
515 | 522 | ||
516 | connect( tb, SIGNAL(tabSelected(const QString&)), | 523 | connect( tb, SIGNAL(tabSelected(const QString&)), |
517 | this, SLOT(showTab(const QString&)) ); | 524 | this, SLOT(showTab(const QString&)) ); |
518 | connect( tabs, SIGNAL(selected(const QString&)), | 525 | connect( tabs, SIGNAL(selected(const QString&)), |
519 | this, SLOT(viewSelected(const QString&)) ); | 526 | this, SLOT(viewSelected(const QString&)) ); |
520 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 527 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
521 | this, SLOT(select(const AppLnk*))); | 528 | this, SLOT(select(const AppLnk*))); |
522 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 529 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
523 | this, SLOT(properties(AppLnk*))); | 530 | this, SLOT(properties(AppLnk*))); |
524 | 531 | ||
525 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 532 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
526 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 533 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
527 | connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), | 534 | connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
528 | this, SLOT(systemMessage(const QCString&,const QByteArray&)) ); | 535 | this, SLOT(systemMessage(const QCString&,const QByteArray&)) ); |
529 | #endif | 536 | #endif |
530 | 537 | ||
531 | // all documents | 538 | // all documents |
532 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 539 | QPixmap pm = OResource::loadPixmap( "DocsIcon", OResource::SmallIcon ); |
533 | QPixmap pm; | ||
534 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | ||
535 | // It could add this itself if it handles docs | 540 | // It could add this itself if it handles docs |
536 | |||
537 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); | 541 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); |
538 | 542 | ||
539 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); | 543 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); |
540 | qApp->setMainWidget( this ); | 544 | qApp->setMainWidget( this ); |
541 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); | 545 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); |
542 | } | 546 | } |
543 | 547 | ||
544 | Launcher::~Launcher() | 548 | Launcher::~Launcher() |
545 | { | 549 | { |
546 | if ( tb ) | 550 | if ( tb ) |
547 | destroyGUI(); | 551 | destroyGUI(); |
548 | } | 552 | } |
549 | 553 | ||
550 | bool Launcher::requiresDocuments() const | 554 | bool Launcher::requiresDocuments() const |
551 | { | 555 | { |
552 | Config cfg( "Launcher" ); | 556 | Config cfg( "Launcher" ); |
553 | cfg.setGroup( "DocTab" ); | 557 | cfg.setGroup( "DocTab" ); |
554 | return cfg.readBoolEntry( "Enable", true ); | 558 | return cfg.readBoolEntry( "Enable", true ); |
555 | } | 559 | } |
556 | 560 | ||
557 | void Launcher::makeVisible() | 561 | void Launcher::makeVisible() |
558 | { | 562 | { |
559 | showMaximized(); | 563 | showMaximized(); |
560 | } | 564 | } |
561 | 565 | ||
562 | void Launcher::destroyGUI() | 566 | void Launcher::destroyGUI() |
563 | { | 567 | { |
564 | delete tb; | 568 | delete tb; |
565 | tb = 0; | 569 | tb = 0; |
566 | delete tabs; | 570 | delete tabs; |
567 | tabs =0; | 571 | tabs =0; |
568 | } | 572 | } |
569 | 573 | ||
570 | bool Launcher::eventFilter( QObject*, QEvent *ev ) | 574 | bool Launcher::eventFilter( QObject*, QEvent *ev ) |
571 | { | 575 | { |
572 | #ifdef QT_QWS_CUSTOM | 576 | #ifdef QT_QWS_CUSTOM |
573 | if ( ev->type() == QEvent::KeyPress ) { | 577 | if ( ev->type() == QEvent::KeyPress ) { |
574 | QKeyEvent *ke = (QKeyEvent *)ev; | 578 | QKeyEvent *ke = (QKeyEvent *)ev; |
575 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 579 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
576 | QWidget *active = qApp->activeWindow(); | 580 | QWidget *active = qApp->activeWindow(); |
577 | if ( active && active->isPopup() ) | 581 | if ( active && active->isPopup() ) |
578 | active->close(); | 582 | active->close(); |
579 | else { | 583 | else { |
580 | Global::terminateBuiltin("calibrate"); // No tr | 584 | Global::terminateBuiltin("calibrate"); // No tr |
581 | tb->launchStartMenu(); | 585 | tb->launchStartMenu(); |
582 | } | 586 | } |
583 | return TRUE; | 587 | return TRUE; |
584 | } | 588 | } |
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index d960908..6275fcb 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -1,78 +1,85 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | =. (C) 2000-2002 Trolltech AS |
4 | ** This file is part of the Qtopia Environment. | 4 | .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This program is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ** | 18 | ..}^=.= = ; Library General Public License for more |
19 | **********************************************************************/ | 19 | ++= -. .` .: details. |
20 | 20 | : = ...= . :.=- | |
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
21 | #include "launcherview.h" | 28 | #include "launcherview.h" |
22 | 29 | ||
23 | /* OPIE */ | 30 | /* OPIE */ |
24 | #include <opie2/odebug.h> | 31 | #include <opie2/odebug.h> |
32 | #include <opie2/oresource.h> | ||
25 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
26 | #include <qtopia/qpeapplication.h> | 34 | #include <qtopia/qpeapplication.h> |
27 | #include <qtopia/private/categories.h> | 35 | #include <qtopia/private/categories.h> |
28 | #include <qtopia/categoryselect.h> | 36 | #include <qtopia/categoryselect.h> |
29 | #include <qtopia/mimetype.h> | 37 | #include <qtopia/mimetype.h> |
30 | #include <qtopia/resource.h> | ||
31 | using namespace Opie::Core; | 38 | using namespace Opie::Core; |
32 | 39 | ||
33 | #include <qpe/qcopenvelope_qws.h> | 40 | #include <qpe/qcopenvelope_qws.h> |
34 | 41 | ||
35 | /* QT */ | 42 | /* QT */ |
36 | #include <qtimer.h> | 43 | #include <qtimer.h> |
37 | #include <qfileinfo.h> | 44 | #include <qfileinfo.h> |
38 | #include <qiconview.h> | 45 | #include <qiconview.h> |
39 | #include <qobjectlist.h> | 46 | #include <qobjectlist.h> |
40 | 47 | ||
41 | 48 | ||
42 | // These define how the busy icon is animated and highlighted | 49 | // These define how the busy icon is animated and highlighted |
43 | #define BRIGHTEN_BUSY_ICON | 50 | #define BRIGHTEN_BUSY_ICON |
44 | //#define ALPHA_FADE_BUSY_ICON | 51 | //#define ALPHA_FADE_BUSY_ICON |
45 | //#define USE_ANIMATED_BUSY_ICON_OVERLAY | 52 | //#define USE_ANIMATED_BUSY_ICON_OVERLAY |
46 | #define BOUNCE_BUSY_ICON | 53 | #define BOUNCE_BUSY_ICON |
47 | 54 | ||
48 | typedef QMap<QString,QPixmap>::Iterator pixiter; | 55 | typedef QMap<QString,QPixmap>::Iterator pixiter; |
49 | 56 | ||
50 | class BgPixmap | 57 | class BgPixmap |
51 | { | 58 | { |
52 | public: | 59 | public: |
53 | BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} | 60 | BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} |
54 | QPixmap pm; | 61 | QPixmap pm; |
55 | int ref; | 62 | int ref; |
56 | }; | 63 | }; |
57 | 64 | ||
58 | 65 | ||
59 | static QMap<QString,BgPixmap*> *bgCache = 0; | 66 | static QMap<QString,BgPixmap*> *bgCache = 0; |
60 | 67 | ||
61 | static void cleanup_cache() | 68 | static void cleanup_cache() |
62 | { | 69 | { |
63 | QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); | 70 | QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); |
64 | while ( it != bgCache->end() ) { | 71 | while ( it != bgCache->end() ) { |
65 | QMap<QString,BgPixmap*>::Iterator curr = it; | 72 | QMap<QString,BgPixmap*>::Iterator curr = it; |
66 | ++it; | 73 | ++it; |
67 | delete (*curr); | 74 | delete (*curr); |
68 | bgCache->remove( curr ); | 75 | bgCache->remove( curr ); |
69 | } | 76 | } |
70 | delete bgCache; | 77 | delete bgCache; |
71 | bgCache = 0; | 78 | bgCache = 0; |
72 | } | 79 | } |
73 | 80 | ||
74 | 81 | ||
75 | class LauncherItem : public QIconViewItem | 82 | class LauncherItem : public QIconViewItem |
76 | { | 83 | { |
77 | public: | 84 | public: |
78 | enum iconstate_t { | 85 | enum iconstate_t { |
@@ -381,97 +388,97 @@ void LauncherIconView::setTypeFilter(const QString& typefilter, bool resort) | |||
381 | } | 388 | } |
382 | 389 | ||
383 | void LauncherIconView::setItemTextPos( ItemTextPos pos ) | 390 | void LauncherIconView::setItemTextPos( ItemTextPos pos ) |
384 | { | 391 | { |
385 | calculateGrid( pos ); | 392 | calculateGrid( pos ); |
386 | QIconView::setItemTextPos( pos ); | 393 | QIconView::setItemTextPos( pos ); |
387 | } | 394 | } |
388 | 395 | ||
389 | void LauncherIconView::drawBackground( QPainter *p, const QRect &r ) | 396 | void LauncherIconView::drawBackground( QPainter *p, const QRect &r ) |
390 | { | 397 | { |
391 | if ( bgPixmap.isNull() ) | 398 | if ( bgPixmap.isNull() ) |
392 | { | 399 | { |
393 | p->fillRect( r, bgColor ); | 400 | p->fillRect( r, bgColor ); |
394 | } | 401 | } |
395 | else | 402 | else |
396 | { | 403 | { |
397 | if ( staticBackground ) | 404 | if ( staticBackground ) |
398 | { | 405 | { |
399 | p->drawTiledPixmap( r, bgPixmap, QPoint( r.x() % bgPixmap.width(), r.y() % bgPixmap.height() ) ); | 406 | p->drawTiledPixmap( r, bgPixmap, QPoint( r.x() % bgPixmap.width(), r.y() % bgPixmap.height() ) ); |
400 | } | 407 | } |
401 | else | 408 | else |
402 | { | 409 | { |
403 | p->drawTiledPixmap( r, bgPixmap, QPoint( (r.x() + contentsX()) % bgPixmap.width(), | 410 | p->drawTiledPixmap( r, bgPixmap, QPoint( (r.x() + contentsX()) % bgPixmap.width(), |
404 | (r.y() + contentsY()) % bgPixmap.height() ) ); | 411 | (r.y() + contentsY()) % bgPixmap.height() ) ); |
405 | } | 412 | } |
406 | } | 413 | } |
407 | } | 414 | } |
408 | 415 | ||
409 | void LauncherIconView::addCatsAndMimes(AppLnk* app) | 416 | void LauncherIconView::addCatsAndMimes(AppLnk* app) |
410 | { | 417 | { |
411 | // QStringList c = app->categories(); | 418 | // QStringList c = app->categories(); |
412 | // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { | 419 | // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { |
413 | // cats.replace(*cit,(void*)1); | 420 | // cats.replace(*cit,(void*)1); |
414 | // } | 421 | // } |
415 | QString maj=app->type(); | 422 | QString maj=app->type(); |
416 | int sl=maj.find('/'); | 423 | int sl=maj.find('/'); |
417 | if (sl>=0) { | 424 | if (sl>=0) { |
418 | QString k; | 425 | QString k; |
419 | k = maj.left(12) == "application/" ? maj : maj.left(sl); | 426 | k = maj.left(12) == "application/" ? maj : maj.left(sl); |
420 | mimes.replace(k,(void*)1); | 427 | mimes.replace(k,(void*)1); |
421 | } | 428 | } |
422 | } | 429 | } |
423 | 430 | ||
424 | void LauncherIconView::setBusy(bool on) | 431 | void LauncherIconView::setBusy(bool on) |
425 | { | 432 | { |
426 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | 433 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY |
427 | if ( busyPix.isNull() ) { | 434 | if ( busyPix.isNull() ) { |
428 | int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); | 435 | int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); |
429 | busyPix.convertFromImage( Resource::loadImage( "busy" ).smoothScale( size * 16, size ) ); | 436 | busyPix.convertFromImage( OResource::loadImage( "busy", OResource::NoScale ).smoothScale( size * 16, size ) ); |
430 | } | 437 | } |
431 | #endif | 438 | #endif |
432 | 439 | ||
433 | if ( on ) { | 440 | if ( on ) { |
434 | busyTimer = startTimer( 100 ); | 441 | busyTimer = startTimer( 100 ); |
435 | } else { | 442 | } else { |
436 | if ( busyTimer ) { | 443 | if ( busyTimer ) { |
437 | killTimer( busyTimer ); | 444 | killTimer( busyTimer ); |
438 | busyTimer = 0; | 445 | busyTimer = 0; |
439 | } | 446 | } |
440 | } | 447 | } |
441 | 448 | ||
442 | LauncherItem *c = on ? (LauncherItem*)currentItem() : 0; | 449 | LauncherItem *c = on ? (LauncherItem*)currentItem() : 0; |
443 | 450 | ||
444 | if ( bsy != c ) { | 451 | if ( bsy != c ) { |
445 | LauncherItem *oldBusy = bsy; | 452 | LauncherItem *oldBusy = bsy; |
446 | bsy = c; | 453 | bsy = c; |
447 | if ( oldBusy ) { | 454 | if ( oldBusy ) { |
448 | oldBusy->resetIcon(); | 455 | oldBusy->resetIcon(); |
449 | } | 456 | } |
450 | if ( bsy ) { | 457 | if ( bsy ) { |
451 | bsy->setBusyIndicatorType( busyType ) ; | 458 | bsy->setBusyIndicatorType( busyType ) ; |
452 | bsy->animateIcon(); | 459 | bsy->animateIcon(); |
453 | } | 460 | } |
454 | } | 461 | } |
455 | } | 462 | } |
456 | 463 | ||
457 | void LauncherIconView::clear() | 464 | void LauncherIconView::clear() |
458 | { | 465 | { |
459 | mimes.clear(); | 466 | mimes.clear(); |
460 | cats.clear(); | 467 | cats.clear(); |
461 | QIconView::clear(); | 468 | QIconView::clear(); |
462 | hidden.clear(); | 469 | hidden.clear(); |
463 | } | 470 | } |
464 | 471 | ||
465 | QStringList LauncherIconView::mimeTypes() const | 472 | QStringList LauncherIconView::mimeTypes() const |
466 | { | 473 | { |
467 | QStringList r; | 474 | QStringList r; |
468 | QDictIterator<void> it(mimes); | 475 | QDictIterator<void> it(mimes); |
469 | while (it.current()) { | 476 | while (it.current()) { |
470 | r.append(it.currentKey()); | 477 | r.append(it.currentKey()); |
471 | ++it; | 478 | ++it; |
472 | } | 479 | } |
473 | r.sort(); | 480 | r.sort(); |
474 | return r; | 481 | return r; |
475 | } | 482 | } |
476 | 483 | ||
477 | LauncherItem*LauncherIconView::findDocItem(const QString&fname) | 484 | LauncherItem*LauncherIconView::findDocItem(const QString&fname) |
@@ -956,97 +963,97 @@ QImage LauncherView::loadBackgroundImage(QString &bgName) | |||
956 | return imgio.image(); | 963 | return imgio.image(); |
957 | } | 964 | } |
958 | 965 | ||
959 | void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) | 966 | void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) |
960 | { | 967 | { |
961 | if ( !bgCache ) { | 968 | if ( !bgCache ) { |
962 | bgCache = new QMap<QString,BgPixmap*>; | 969 | bgCache = new QMap<QString,BgPixmap*>; |
963 | qAddPostRoutine( cleanup_cache ); | 970 | qAddPostRoutine( cleanup_cache ); |
964 | } | 971 | } |
965 | 972 | ||
966 | if ( bgCache->contains( bgName ) ) | 973 | if ( bgCache->contains( bgName ) ) |
967 | (*bgCache)[bgName]->ref--; | 974 | (*bgCache)[bgName]->ref--; |
968 | bgName = ""; | 975 | bgName = ""; |
969 | 976 | ||
970 | QPixmap bg; | 977 | QPixmap bg; |
971 | 978 | ||
972 | switch ( t ) { | 979 | switch ( t ) { |
973 | case Ruled: { | 980 | case Ruled: { |
974 | bgName = QString("Ruled_%1").arg(colorGroup().background().name()); // No tr | 981 | bgName = QString("Ruled_%1").arg(colorGroup().background().name()); // No tr |
975 | if ( bgCache->contains( bgName ) ) { | 982 | if ( bgCache->contains( bgName ) ) { |
976 | (*bgCache)[bgName]->ref++; | 983 | (*bgCache)[bgName]->ref++; |
977 | bg = (*bgCache)[bgName]->pm; | 984 | bg = (*bgCache)[bgName]->pm; |
978 | } else { | 985 | } else { |
979 | bg.resize( width(), 9 ); | 986 | bg.resize( width(), 9 ); |
980 | QPainter painter( &bg ); | 987 | QPainter painter( &bg ); |
981 | for ( int i = 0; i < 3; i++ ) { | 988 | for ( int i = 0; i < 3; i++ ) { |
982 | painter.setPen( white ); | 989 | painter.setPen( white ); |
983 | painter.drawLine( 0, i*3, width()-1, i*3 ); | 990 | painter.drawLine( 0, i*3, width()-1, i*3 ); |
984 | painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); | 991 | painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); |
985 | painter.setPen( colorGroup().background().light(105) ); | 992 | painter.setPen( colorGroup().background().light(105) ); |
986 | painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); | 993 | painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); |
987 | } | 994 | } |
988 | painter.end(); | 995 | painter.end(); |
989 | bgCache->insert( bgName, new BgPixmap(bg) ); | 996 | bgCache->insert( bgName, new BgPixmap(bg) ); |
990 | } | 997 | } |
991 | break; | 998 | break; |
992 | } | 999 | } |
993 | 1000 | ||
994 | case Image: | 1001 | case Image: |
995 | if (!val.isEmpty()) { | 1002 | if (!val.isEmpty()) { |
996 | bgName = val; | 1003 | bgName = val; |
997 | if ( bgCache->contains( bgName ) ) { | 1004 | if ( bgCache->contains( bgName ) ) { |
998 | (*bgCache)[bgName]->ref++; | 1005 | (*bgCache)[bgName]->ref++; |
999 | bg = (*bgCache)[bgName]->pm; | 1006 | bg = (*bgCache)[bgName]->pm; |
1000 | } else { | 1007 | } else { |
1001 | QString imgFile = bgName; | 1008 | QString imgFile = bgName; |
1002 | bool tile = FALSE; | 1009 | bool tile = FALSE; |
1003 | if ( imgFile[0]!='/' || !QFile::exists(imgFile) ) { | 1010 | if ( imgFile[0]!='/' || !QFile::exists(imgFile) ) { |
1004 | imgFile = Resource::findPixmap( imgFile ); | 1011 | imgFile = OResource::findPixmap( imgFile ); |
1005 | tile = TRUE; | 1012 | tile = TRUE; |
1006 | } | 1013 | } |
1007 | QImage img = loadBackgroundImage(imgFile); | 1014 | QImage img = loadBackgroundImage(imgFile); |
1008 | 1015 | ||
1009 | 1016 | ||
1010 | if ( img.depth() == 1 ) | 1017 | if ( img.depth() == 1 ) |
1011 | img = img.convertDepth(8); | 1018 | img = img.convertDepth(8); |
1012 | img.setAlphaBuffer(FALSE); | 1019 | img.setAlphaBuffer(FALSE); |
1013 | bg.convertFromImage(img); | 1020 | bg.convertFromImage(img); |
1014 | bgCache->insert( bgName, new BgPixmap(bg) ); | 1021 | bgCache->insert( bgName, new BgPixmap(bg) ); |
1015 | } | 1022 | } |
1016 | } | 1023 | } |
1017 | break; | 1024 | break; |
1018 | 1025 | ||
1019 | case SolidColor: | 1026 | case SolidColor: |
1020 | default: | 1027 | default: |
1021 | break; | 1028 | break; |
1022 | } | 1029 | } |
1023 | 1030 | ||
1024 | const QObjectList *list = queryList( "QWidget", 0, FALSE ); | 1031 | const QObjectList *list = queryList( "QWidget", 0, FALSE ); |
1025 | QObject *obj; | 1032 | QObject *obj; |
1026 | for ( QObjectListIt it( *list ); (obj=it.current()); ++it ) { | 1033 | for ( QObjectListIt it( *list ); (obj=it.current()); ++it ) { |
1027 | if ( obj->isWidgetType() ) { | 1034 | if ( obj->isWidgetType() ) { |
1028 | QWidget *w = (QWidget*)obj; | 1035 | QWidget *w = (QWidget*)obj; |
1029 | w->setBackgroundPixmap( bg ); | 1036 | w->setBackgroundPixmap( bg ); |
1030 | if ( bgName.isEmpty() ) { | 1037 | if ( bgName.isEmpty() ) { |
1031 | // Solid Color | 1038 | // Solid Color |
1032 | if ( val.isEmpty() ) | 1039 | if ( val.isEmpty() ) |
1033 | w->setBackgroundColor( colorGroup().base() ); | 1040 | w->setBackgroundColor( colorGroup().base() ); |
1034 | else | 1041 | else |
1035 | w->setBackgroundColor( val ); | 1042 | w->setBackgroundColor( val ); |
1036 | } else { | 1043 | } else { |
1037 | // Ruled or Image pixmap | 1044 | // Ruled or Image pixmap |
1038 | w->setBackgroundOrigin( ParentOrigin ); | 1045 | w->setBackgroundOrigin( ParentOrigin ); |
1039 | } | 1046 | } |
1040 | } | 1047 | } |
1041 | } | 1048 | } |
1042 | delete list; | 1049 | delete list; |
1043 | 1050 | ||
1044 | bgType = t; | 1051 | bgType = t; |
1045 | icons->viewport()->update(); | 1052 | icons->viewport()->update(); |
1046 | 1053 | ||
1047 | QTimer::singleShot( 1000, this, SLOT(flushBgCache()) ); | 1054 | QTimer::singleShot( 1000, this, SLOT(flushBgCache()) ); |
1048 | } | 1055 | } |
1049 | 1056 | ||
1050 | void LauncherView::setColNumber( int num ) | 1057 | void LauncherView::setColNumber( int num ) |
1051 | { | 1058 | { |
1052 | icons->setColNumber( num ); | 1059 | icons->setColNumber( num ); |
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp index ce7840e..24a9d7e 100644 --- a/core/launcher/startmenu.cpp +++ b/core/launcher/startmenu.cpp | |||
@@ -1,259 +1,254 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | =. (C) 2000-2002 Trolltech AS |
4 | ** This file is part of the Qtopia Environment. | 4 | .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This program is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ** | 18 | ..}^=.= = ; Library General Public License for more |
19 | **********************************************************************/ | 19 | ++= -. .` .: details. |
20 | 20 | : = ...= . :.=- | |
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
21 | // TODO. During startup | 28 | // TODO. During startup |
22 | // Launcher::typeAdded | 29 | // Launcher::typeAdded |
23 | // is called for each new tab and calls then each time the refresh of startmenu | 30 | // is called for each new tab and calls then each time the refresh of startmenu |
24 | // suboptimal | 31 | // suboptimal |
25 | 32 | ||
26 | #define INCLUDE_MENUITEM_DEF | 33 | #define INCLUDE_MENUITEM_DEF |
27 | 34 | ||
28 | #include "startmenu.h" | 35 | #include "startmenu.h" |
29 | 36 | ||
37 | /* OPIE */ | ||
38 | #include <opie2/oresource.h> | ||
39 | using namespace Opie::Core; | ||
30 | #include <qtopia/qpeapplication.h> | 40 | #include <qtopia/qpeapplication.h> |
31 | #include <qtopia/config.h> | 41 | #include <qtopia/config.h> |
32 | #include <qtopia/resource.h> | ||
33 | #include <qtopia/mimetype.h> | 42 | #include <qtopia/mimetype.h> |
34 | #include <qtopia/qlibrary.h> | 43 | #include <qtopia/qlibrary.h> |
35 | 44 | ||
36 | //#include <qpainter.h> | ||
37 | |||
38 | //#include <stdlib.h> | ||
39 | |||
40 | |||
41 | #define APPLNK_ID_OFFSET 250 | 45 | #define APPLNK_ID_OFFSET 250 |
42 | #define NO_ID -1 | 46 | #define NO_ID -1 |
43 | 47 | ||
44 | 48 | ||
45 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) | 49 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) |
46 | { | 50 | { |
47 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { | 51 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { |
48 | // "OK" button, little hacky | 52 | // "OK" button, little hacky |
49 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); | 53 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); |
50 | QPopupMenu::keyPressEvent( &ke ); | 54 | QPopupMenu::keyPressEvent( &ke ); |
51 | } else { | 55 | } else { |
52 | QPopupMenu::keyPressEvent( e ); | 56 | QPopupMenu::keyPressEvent( e ); |
53 | } | 57 | } |
54 | } | 58 | } |
55 | 59 | ||
56 | //--------------------------------------------------------------------------- | 60 | //--------------------------------------------------------------------------- |
57 | 61 | ||
58 | StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) | 62 | StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) |
59 | { | 63 | { |
60 | startButtonPixmap = "go"; // No tr | 64 | startButtonPixmap = "go"; // No tr |
61 | 65 | ||
62 | int sz = AppLnk::smallIconSize()+3; | 66 | int sz = AppLnk::smallIconSize()+3; |
63 | QPixmap pm; | 67 | QPixmap pm; |
64 | pm.convertFromImage(Resource::loadImage( startButtonPixmap).smoothScale( sz,sz) ); | 68 | pm.convertFromImage(OResource::loadImage( startButtonPixmap, OResource::NoScale ).smoothScale( sz,sz) ); |
65 | setPixmap(pm); | 69 | setPixmap(pm); |
66 | setFocusPolicy( NoFocus ); | 70 | setFocusPolicy( NoFocus ); |
67 | 71 | ||
68 | useWidePopupMenu = true; | 72 | useWidePopupMenu = true; |
69 | launchMenu = 0; | 73 | launchMenu = 0; |
70 | currentItem = 0; | 74 | currentItem = 0; |
71 | refreshMenu(); | 75 | refreshMenu(); |
72 | } | 76 | } |
73 | 77 | ||
74 | 78 | ||
75 | void StartMenu::mousePressEvent( QMouseEvent * ) | 79 | void StartMenu::mousePressEvent( QMouseEvent * ) |
76 | { | 80 | { |
77 | launch(); | 81 | launch(); |
78 | } | 82 | } |
79 | 83 | ||
80 | 84 | ||
81 | StartMenu::~StartMenu() | 85 | StartMenu::~StartMenu() |
82 | { | 86 | { |
83 | clearApplets(); | 87 | clearApplets(); |
84 | } | 88 | } |
85 | 89 | ||
86 | void StartMenu::createMenu() | 90 | void StartMenu::createMenu() |
87 | { | 91 | { |
88 | clearApplets(); | 92 | clearApplets(); |
89 | delete launchMenu; | 93 | delete launchMenu; |
90 | 94 | ||
91 | launchMenu = new StartPopupMenu( this ); | 95 | launchMenu = new StartPopupMenu( this ); |
92 | loadMenu( launchMenu ); | 96 | loadMenu( launchMenu ); |
93 | loadApplets(); | 97 | loadApplets(); |
94 | 98 | ||
95 | bool result = currentItem || menuApplets.count(); | 99 | bool result = currentItem || menuApplets.count(); |
96 | if ( result ) | 100 | if ( result ) |
97 | connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); | 101 | connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); |
98 | } | 102 | } |
99 | 103 | ||
100 | void StartMenu::refreshMenu() | 104 | void StartMenu::refreshMenu() |
101 | { | 105 | { |
102 | Config cfg( "StartMenu" ); | 106 | Config cfg( "StartMenu" ); |
103 | cfg.setGroup( "Menu" ); | 107 | cfg.setGroup( "Menu" ); |
104 | bool ltabs = cfg.readBoolEntry( "LauncherTabs", TRUE ); | 108 | bool ltabs = cfg.readBoolEntry( "LauncherTabs", TRUE ); |
105 | bool lot = cfg.readBoolEntry( "LauncherOther", TRUE ); | 109 | bool lot = cfg.readBoolEntry( "LauncherOther", TRUE ); |
106 | useWidePopupMenu = cfg.readBoolEntry( "LauncherSubPopup", TRUE ); | 110 | useWidePopupMenu = cfg.readBoolEntry( "LauncherSubPopup", TRUE ); |
107 | 111 | ||
108 | if ( launchMenu && !(ltabs || lot) ) return; // nothing to do | 112 | if ( launchMenu && !(ltabs || lot) ) return; // nothing to do |
109 | 113 | ||
110 | createMenu(); | 114 | createMenu(); |
111 | } | 115 | } |
112 | 116 | ||
113 | void StartMenu::itemSelected( int id ) | 117 | void StartMenu::itemSelected( int id ) |
114 | { | 118 | { |
115 | if ( id == NO_ID ) return; | 119 | if ( id == NO_ID ) return; |
116 | 120 | ||
117 | if ( id < 0 ) { | 121 | if ( id < 0 ) { |
118 | MenuApplet *applet = menuApplets.find( id ); | 122 | MenuApplet *applet = menuApplets.find( id ); |
119 | if ( applet ) { | 123 | if ( applet ) { |
120 | applet->iface->activated(); | 124 | applet->iface->activated(); |
121 | } | 125 | } |
122 | } else if ( id >= APPLNK_ID_OFFSET ) { | 126 | } else if ( id >= APPLNK_ID_OFFSET ) { |
123 | AppLnk * appLnk = appLnks.find( id ); | 127 | AppLnk * appLnk = appLnks.find( id ); |
124 | if ( appLnk ) { | 128 | if ( appLnk ) { |
125 | appLnk->execute(); | 129 | appLnk->execute(); |
126 | } | 130 | } |
127 | } else { | 131 | } else { |
128 | QString *tabName = tabNames.find( id ); | 132 | QString *tabName = tabNames.find( id ); |
129 | if ( tabName ) { | 133 | if ( tabName ) { |
130 | emit tabSelected( *tabName ); | 134 | emit tabSelected( *tabName ); |
131 | } | 135 | } |
132 | } | 136 | } |
133 | } | 137 | } |
134 | 138 | ||
135 | void StartMenu::createAppEntry( QPopupMenu *menu, QDir dir, QString file ) | 139 | void StartMenu::createAppEntry( QPopupMenu *menu, QDir dir, QString file ) |
136 | { | 140 | { |
137 | if ( file.right(8) == ".desktop" ) { | 141 | if ( file.right(8) == ".desktop" ) { |
138 | AppLnk* applnk = new AppLnk( dir.path() + "/" + file ); | 142 | AppLnk* applnk = new AppLnk( dir.path() + "/" + file ); |
139 | if ( !applnk->isValid() ) { | 143 | if ( !applnk->isValid() ) { |
140 | delete applnk; | 144 | delete applnk; |
141 | return; | 145 | return; |
142 | } | 146 | } |
143 | 147 | ||
144 | if ( applnk->type() == "Separator" ) { // No tr | 148 | if ( applnk->type() == "Separator" ) { // No tr |
145 | menu->insertSeparator(); | 149 | menu->insertSeparator(); |
146 | delete applnk; | 150 | delete applnk; |
147 | } else { | 151 | } else { |
148 | QPixmap test; | 152 | QPixmap pixmap = OResource::loadPixmap( applnk->icon(), OResource::SmallIcon ); |
149 | QImage img = Resource::loadImage( applnk->icon() ); | ||
150 | if(!img.isNull() ) | ||
151 | test.convertFromImage( | ||
152 | img.smoothScale( | ||
153 | AppLnk::smallIconSize(), AppLnk::smallIconSize() ), 0 ); | ||
154 | |||
155 | // Insert items ordered lexically | 153 | // Insert items ordered lexically |
156 | int current, left = 0, right = currentItem; | 154 | int current, left = 0, right = currentItem; |
157 | while( left != right ) { | 155 | while( left != right ) { |
158 | current = ( left + right ) / 2; | 156 | current = ( left + right ) / 2; |
159 | if ( menu->text(menu->idAt( ( current ) ) ) < applnk->name() ) | 157 | if ( menu->text(menu->idAt( ( current ) ) ) < applnk->name() ) |
160 | left = ++current; | 158 | left = ++current; |
161 | else | 159 | else |
162 | right = current; | 160 | right = current; |
163 | } | 161 | } |
164 | 162 | ||
165 | menu->insertItem( test, applnk->name(), | 163 | menu->insertItem( pixmap, applnk->name(), |
166 | currentItem + APPLNK_ID_OFFSET, current ); | 164 | currentItem + APPLNK_ID_OFFSET, current ); |
167 | appLnks.insert( currentItem + APPLNK_ID_OFFSET, applnk ); | 165 | appLnks.insert( currentItem + APPLNK_ID_OFFSET, applnk ); |
168 | currentItem++; | 166 | currentItem++; |
169 | } | 167 | } |
170 | } | 168 | } |
171 | 169 | ||
172 | } | 170 | } |
173 | 171 | ||
174 | void StartMenu::createDirEntry( QPopupMenu *menu, QDir dir, QString file, bool lot ) | 172 | void StartMenu::createDirEntry( QPopupMenu *menu, QDir dir, QString file, bool lot ) |
175 | { | 173 | { |
176 | // do some sanity checks and collect information | 174 | // do some sanity checks and collect information |
177 | 175 | ||
178 | if ( file == "." || file == ".." ) return; | 176 | if ( file == "." || file == ".." ) return; |
179 | 177 | ||
180 | Config cfg( dir.path() + "/" + file + "/.directory", Config::File ); | 178 | Config cfg( dir.path() + "/" + file + "/.directory", Config::File ); |
181 | if ( !cfg.isValid() ) return; | 179 | if ( !cfg.isValid() ) return; |
182 | 180 | ||
183 | QString name = cfg.readEntry( "Name" ); | 181 | QString name = cfg.readEntry( "Name" ); |
184 | QString icon = cfg.readEntry( "Icon" ); | 182 | QString icon = cfg.readEntry( "Icon" ); |
185 | if ( !name || !icon ) return; | 183 | if ( !name || !icon ) return; |
186 | 184 | ||
187 | QDir subdir = QDir( dir ); | 185 | QDir subdir = QDir( dir ); |
188 | subdir.cd( file ); | 186 | subdir.cd( file ); |
189 | subdir.setFilter( QDir::Files ); | 187 | subdir.setFilter( QDir::Files ); |
190 | subdir.setNameFilter( "*.desktop" ); | 188 | subdir.setNameFilter( "*.desktop" ); |
191 | // we don' t show the menu if there are no entries | 189 | // we don' t show the menu if there are no entries |
192 | // perhaps one should check if there exist subsubdirs with entries... | 190 | // perhaps one should check if there exist subsubdirs with entries... |
193 | if ( subdir.entryList().isEmpty() ) return; | 191 | if ( subdir.entryList().isEmpty() ) return; |
194 | 192 | ||
195 | // checks were ok | 193 | // checks were ok |
196 | 194 | ||
197 | QPixmap test; | 195 | QPixmap pixmap = OResource::loadPixmap( icon, OResource::SmallIcon ); |
198 | test.convertFromImage( Resource::loadImage( icon ).smoothScale( | ||
199 | AppLnk::smallIconSize(), AppLnk::smallIconSize() ), 0 ); | ||
200 | |||
201 | if ( useWidePopupMenu ) { | 196 | if ( useWidePopupMenu ) { |
202 | // generate submenu | 197 | // generate submenu |
203 | QPopupMenu *submenu = new QPopupMenu( menu ); | 198 | QPopupMenu *submenu = new QPopupMenu( menu ); |
204 | connect( submenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); | 199 | connect( submenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); |
205 | menu->insertItem( test, name, submenu, NO_ID ); | 200 | menu->insertItem( pixmap, name, submenu, NO_ID ); |
206 | 201 | ||
207 | // ltabs is true cause else we wouldn't stuck around.. | 202 | // ltabs is true cause else we wouldn't stuck around.. |
208 | createMenuEntries( submenu, subdir, true, lot ); | 203 | createMenuEntries( submenu, subdir, true, lot ); |
209 | } else { | 204 | } else { |
210 | // no submenus - just bring corresponding tab to front | 205 | // no submenus - just bring corresponding tab to front |
211 | menu->insertItem( test, name, currentItem ); | 206 | menu->insertItem( pixmap, name, currentItem ); |
212 | tabNames.insert( currentItem, new QString( file ) ); | 207 | tabNames.insert( currentItem, new QString( file ) ); |
213 | currentItem++; | 208 | currentItem++; |
214 | } | 209 | } |
215 | } | 210 | } |
216 | 211 | ||
217 | void StartMenu::createMenuEntries( QPopupMenu *menu, QDir dir, bool ltabs, bool lot ) | 212 | void StartMenu::createMenuEntries( QPopupMenu *menu, QDir dir, bool ltabs, bool lot ) |
218 | { | 213 | { |
219 | if ( lot ) { | 214 | if ( lot ) { |
220 | dir.setFilter( QDir::Files ); | 215 | dir.setFilter( QDir::Files ); |
221 | dir.setNameFilter( "*.desktop" ); | 216 | dir.setNameFilter( "*.desktop" ); |
222 | QStringList files = dir.entryList(); | 217 | QStringList files = dir.entryList(); |
223 | files.sort(); | 218 | files.sort(); |
224 | 219 | ||
225 | for ( QStringList::Iterator it = files.begin(); it != files.end(); it++ ) { | 220 | for ( QStringList::Iterator it = files.begin(); it != files.end(); it++ ) { |
226 | createAppEntry( menu, dir, *it ); | 221 | createAppEntry( menu, dir, *it ); |
227 | } | 222 | } |
228 | } | 223 | } |
229 | if ( ltabs ) { | 224 | if ( ltabs ) { |
230 | dir.setNameFilter( "*" ); | 225 | dir.setNameFilter( "*" ); |
231 | dir.setFilter( QDir::Dirs ); | 226 | dir.setFilter( QDir::Dirs ); |
232 | QStringList dirs = dir.entryList(); | 227 | QStringList dirs = dir.entryList(); |
233 | dirs.sort(); | 228 | dirs.sort(); |
234 | 229 | ||
235 | for ( QStringList::Iterator it = dirs.begin(); it != dirs.end(); it++ ) { | 230 | for ( QStringList::Iterator it = dirs.begin(); it != dirs.end(); it++ ) { |
236 | createDirEntry( menu, dir, *it, lot ); | 231 | createDirEntry( menu, dir, *it, lot ); |
237 | } | 232 | } |
238 | } | 233 | } |
239 | } | 234 | } |
240 | 235 | ||
241 | bool StartMenu::loadMenu( QPopupMenu *menu ) | 236 | bool StartMenu::loadMenu( QPopupMenu *menu ) |
242 | { | 237 | { |
243 | Config cfg("StartMenu"); | 238 | Config cfg("StartMenu"); |
244 | cfg.setGroup("Menu"); | 239 | cfg.setGroup("Menu"); |
245 | 240 | ||
246 | bool ltabs = cfg.readBoolEntry("LauncherTabs", TRUE); | 241 | bool ltabs = cfg.readBoolEntry("LauncherTabs", TRUE); |
247 | bool lot = cfg.readBoolEntry("LauncherOther", TRUE); | 242 | bool lot = cfg.readBoolEntry("LauncherOther", TRUE); |
248 | useWidePopupMenu = cfg.readBoolEntry( "LauncherSubPopup", TRUE ); | 243 | useWidePopupMenu = cfg.readBoolEntry( "LauncherSubPopup", TRUE ); |
249 | bool sepfirst = !ltabs && !lot; | 244 | bool sepfirst = !ltabs && !lot; |
250 | 245 | ||
251 | currentItem = 0; | 246 | currentItem = 0; |
252 | launchMenu->clear(); | 247 | launchMenu->clear(); |
253 | 248 | ||
254 | appLnks.setAutoDelete( true ); | 249 | appLnks.setAutoDelete( true ); |
255 | tabNames.setAutoDelete( true ); | 250 | tabNames.setAutoDelete( true ); |
256 | appLnks.clear(); | 251 | appLnks.clear(); |
257 | tabNames.clear(); | 252 | tabNames.clear(); |
258 | appLnks.setAutoDelete( false ); | 253 | appLnks.setAutoDelete( false ); |
259 | tabNames.setAutoDelete( false ); | 254 | tabNames.setAutoDelete( false ); |
diff --git a/core/launcher/syncdialog.cpp b/core/launcher/syncdialog.cpp index 4a2b8ff..d90b2ea 100644 --- a/core/launcher/syncdialog.cpp +++ b/core/launcher/syncdialog.cpp | |||
@@ -1,169 +1,178 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | =. (C) 2000-2002 Trolltech AS |
4 | ** This file is part of the Qtopia Environment. | 4 | .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This program is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ** | 18 | ..}^=.= = ; Library General Public License for more |
19 | **********************************************************************/ | 19 | ++= -. .` .: details. |
20 | 20 | : = ...= . :.=- | |
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
21 | #include "syncdialog.h" | 28 | #include "syncdialog.h" |
22 | 29 | ||
23 | #include <qtopia/resource.h> | 30 | /* OPIE */ |
31 | #include <opie2/oresource.h> | ||
32 | using namespace Opie::Core; | ||
24 | 33 | ||
34 | /* QT */ | ||
25 | #include <qpainter.h> | 35 | #include <qpainter.h> |
26 | #include <qapplication.h> | 36 | #include <qapplication.h> |
27 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
28 | #include <qfile.h> | 38 | #include <qfile.h> |
29 | 39 | ||
30 | |||
31 | SyncDialog::SyncDialog( QWidget *parent, const QString &w ) | 40 | SyncDialog::SyncDialog( QWidget *parent, const QString &w ) |
32 | : QDialog( parent, "SyncDialog", FALSE, WStyle_Tool | WStyle_Customize | | 41 | : QDialog( parent, "SyncDialog", FALSE, WStyle_Tool | WStyle_Customize | |
33 | WStyle_StaysOnTop ), what(w), nextPt(0), rev(FALSE), hideDot(TRUE) | 42 | WStyle_StaysOnTop ), what(w), nextPt(0), rev(FALSE), hideDot(TRUE) |
34 | { | 43 | { |
35 | QFont f( font() ); | 44 | QFont f( font() ); |
36 | f.setPointSize( 16 ); | 45 | f.setPointSize( 16 ); |
37 | setFont(f); | 46 | setFont(f); |
38 | 47 | ||
39 | loadPath(); | 48 | loadPath(); |
40 | 49 | ||
41 | QSize ds = qApp->desktop()->size(); | 50 | QSize ds = qApp->desktop()->size(); |
42 | setGeometry( 0, 0, ds.width(), ds.height() ); | 51 | setGeometry( 0, 0, ds.width(), ds.height() ); |
43 | img = Resource::loadImage( "SyncScreen" ); | 52 | img = OResource::loadImage( "SyncScreen", OResource::NoScale ); |
44 | if ( img.width() > ds.width() || img.height() > ds.height() ) { | 53 | if ( img.width() > ds.width() || img.height() > ds.height() ) { |
45 | path = scalePath( path, ds.width(), img.width(), ds.height(), img.height() ); | 54 | path = scalePath( path, ds.width(), img.width(), ds.height(), img.height() ); |
46 | img = img.smoothScale( ds.width(), ds.height() ); | 55 | img = img.smoothScale( ds.width(), ds.height() ); |
47 | } | 56 | } |
48 | dot = Resource::loadImage( "syncdot" ); | 57 | dot = OResource::loadImage( "syncdot", OResource::NoScale ); |
49 | setBackgroundColor( white ); | 58 | setBackgroundColor( white ); |
50 | 59 | ||
51 | QPushButton *pb = new QPushButton( tr("Abort"), this, "CancelSync" ); | 60 | QPushButton *pb = new QPushButton( tr("Abort"), this, "CancelSync" ); |
52 | QSize bs = pb->sizeHint(); | 61 | QSize bs = pb->sizeHint(); |
53 | bs.rwidth() += 10; | 62 | bs.rwidth() += 10; |
54 | bs.rheight() += 5; | 63 | bs.rheight() += 5; |
55 | pb->setGeometry( (ds.width()-bs.width())/2, 4*ds.height()/5, | 64 | pb->setGeometry( (ds.width()-bs.width())/2, 4*ds.height()/5, |
56 | bs.width(), bs.height() ); | 65 | bs.width(), bs.height() ); |
57 | connect( pb, SIGNAL(clicked()), this, SIGNAL(cancel()) ); | 66 | connect( pb, SIGNAL(clicked()), this, SIGNAL(cancel()) ); |
58 | 67 | ||
59 | if ( path.count() >= 2 ) { | 68 | if ( path.count() >= 2 ) { |
60 | path = generatePath( path, 8 ); | 69 | path = generatePath( path, 8 ); |
61 | startTimer( 200 ); | 70 | startTimer( 200 ); |
62 | } | 71 | } |
63 | } | 72 | } |
64 | 73 | ||
65 | void SyncDialog::paintEvent( QPaintEvent *pe ) | 74 | void SyncDialog::paintEvent( QPaintEvent *pe ) |
66 | { | 75 | { |
67 | QPainter p(this ); | 76 | QPainter p(this ); |
68 | p.setClipRect( pe->rect() ); | 77 | p.setClipRect( pe->rect() ); |
69 | int ox = (width() - img.width())/2; | 78 | int ox = (width() - img.width())/2; |
70 | int oy = (height() - img.height())/2; | 79 | int oy = (height() - img.height())/2; |
71 | 80 | ||
72 | QRect ir = QRect(ox, oy, img.width(), img.height()) & pe->rect(); | 81 | QRect ir = QRect(ox, oy, img.width(), img.height()) & pe->rect(); |
73 | 82 | ||
74 | if ( ir.isValid() ) | 83 | if ( ir.isValid() ) |
75 | p.drawImage( ir.x(), ir.y(), img, ir.x()-ox, ir.y()-oy, ir.width(), ir.height() ); | 84 | p.drawImage( ir.x(), ir.y(), img, ir.x()-ox, ir.y()-oy, ir.width(), ir.height() ); |
76 | 85 | ||
77 | QString syncMsg = tr("Syncing:"); | 86 | QString syncMsg = tr("Syncing:"); |
78 | p.setPen( black ); | 87 | p.setPen( black ); |
79 | QRect r( 0, 0, width()/2-5, QMAX(oy,80) ); | 88 | QRect r( 0, 0, width()/2-5, QMAX(oy,80) ); |
80 | p.drawText( r, AlignRight | AlignVCenter, syncMsg ); | 89 | p.drawText( r, AlignRight | AlignVCenter, syncMsg ); |
81 | r.moveBy( width()/2, 0 ); | 90 | r.moveBy( width()/2, 0 ); |
82 | QFont f( font() ); | 91 | QFont f( font() ); |
83 | f.setWeight( QFont::Bold ); | 92 | f.setWeight( QFont::Bold ); |
84 | p.setFont( f ); | 93 | p.setFont( f ); |
85 | p.drawText( r, AlignLeft | AlignVCenter, what ); | 94 | p.drawText( r, AlignLeft | AlignVCenter, what ); |
86 | 95 | ||
87 | if ( !hideDot ) | 96 | if ( !hideDot ) |
88 | p.drawImage( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2, dot ); | 97 | p.drawImage( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2, dot ); |
89 | } | 98 | } |
90 | 99 | ||
91 | void SyncDialog::timerEvent( QTimerEvent * ) | 100 | void SyncDialog::timerEvent( QTimerEvent * ) |
92 | { | 101 | { |
93 | int ox = (width() - img.width())/2; | 102 | int ox = (width() - img.width())/2; |
94 | int oy = (height() - img.height())/2; | 103 | int oy = (height() - img.height())/2; |
95 | int oldPt = nextPt; | 104 | int oldPt = nextPt; |
96 | 105 | ||
97 | if ( !rev ) { | 106 | if ( !rev ) { |
98 | nextPt++; | 107 | nextPt++; |
99 | if ( nextPt == (int)path.count() ) { | 108 | if ( nextPt == (int)path.count() ) { |
100 | nextPt -= 2; | 109 | nextPt -= 2; |
101 | rev = TRUE; | 110 | rev = TRUE; |
102 | } | 111 | } |
103 | } else { | 112 | } else { |
104 | nextPt--; | 113 | nextPt--; |
105 | if ( nextPt < 0 ) { | 114 | if ( nextPt < 0 ) { |
106 | nextPt = 1; | 115 | nextPt = 1; |
107 | rev = FALSE; | 116 | rev = FALSE; |
108 | } | 117 | } |
109 | } | 118 | } |
110 | 119 | ||
111 | hideDot = FALSE; | 120 | hideDot = FALSE; |
112 | repaint( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2, | 121 | repaint( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2, |
113 | dot.width(), dot.height() ); | 122 | dot.width(), dot.height() ); |
114 | hideDot = TRUE; | 123 | hideDot = TRUE; |
115 | repaint( ox+path[oldPt].x()-dot.width()/2, oy+path[oldPt].y()-dot.height()/2, | 124 | repaint( ox+path[oldPt].x()-dot.width()/2, oy+path[oldPt].y()-dot.height()/2, |
116 | dot.width(), dot.height() ); | 125 | dot.width(), dot.height() ); |
117 | } | 126 | } |
118 | 127 | ||
119 | void SyncDialog::loadPath() | 128 | void SyncDialog::loadPath() |
120 | { | 129 | { |
121 | QString pfile = Resource::findPixmap( "syncdot" ); | 130 | QString pfile = OResource::findPixmap( "syncdot" ); |
122 | if ( pfile.isEmpty() ) | 131 | if ( pfile.isEmpty() ) |
123 | return; | 132 | return; |
124 | int dp = pfile.findRev('.'); | 133 | int dp = pfile.findRev('.'); |
125 | pfile.replace( dp, pfile.length()-dp, ".path" ); | 134 | pfile.replace( dp, pfile.length()-dp, ".path" ); |
126 | 135 | ||
127 | int count = 0; | 136 | int count = 0; |
128 | QFile file( pfile ); | 137 | QFile file( pfile ); |
129 | if ( file.open( IO_ReadOnly ) ) { | 138 | if ( file.open( IO_ReadOnly ) ) { |
130 | QString line; | 139 | QString line; |
131 | while ( file.readLine( line, 256 ) > 0 ) { | 140 | while ( file.readLine( line, 256 ) > 0 ) { |
132 | int x, y; | 141 | int x, y; |
133 | if ( sscanf( line.latin1(), "%d %d", &x, &y ) == 2 ) { | 142 | if ( sscanf( line.latin1(), "%d %d", &x, &y ) == 2 ) { |
134 | path.resize( count+1 ); | 143 | path.resize( count+1 ); |
135 | path[count++] = QPoint(x, y); | 144 | path[count++] = QPoint(x, y); |
136 | } | 145 | } |
137 | } | 146 | } |
138 | } | 147 | } |
139 | } | 148 | } |
140 | 149 | ||
141 | QPointArray SyncDialog::scalePath( const QPointArray &pa, int xn, int xd, int yn, int yd ) | 150 | QPointArray SyncDialog::scalePath( const QPointArray &pa, int xn, int xd, int yn, int yd ) |
142 | { | 151 | { |
143 | QPointArray sa( pa.size() ); | 152 | QPointArray sa( pa.size() ); |
144 | 153 | ||
145 | for ( unsigned i = 0; i < pa.count(); i++ ) { | 154 | for ( unsigned i = 0; i < pa.count(); i++ ) { |
146 | int x = xn * pa[int(i)].x() / xd; | 155 | int x = xn * pa[int(i)].x() / xd; |
147 | int y = yn * pa[int(i)].y() / yd; | 156 | int y = yn * pa[int(i)].y() / yd; |
148 | sa[int(i)] = QPoint( x, y ); | 157 | sa[int(i)] = QPoint( x, y ); |
149 | } | 158 | } |
150 | 159 | ||
151 | return sa; | 160 | return sa; |
152 | } | 161 | } |
153 | 162 | ||
154 | QPointArray SyncDialog::generatePath( const QPointArray &pa, int dist ) | 163 | QPointArray SyncDialog::generatePath( const QPointArray &pa, int dist ) |
155 | { | 164 | { |
156 | if ( pa.count() < 2 ) | 165 | if ( pa.count() < 2 ) |
157 | return pa; | 166 | return pa; |
158 | 167 | ||
159 | QPointArray fa; | 168 | QPointArray fa; |
160 | int count = 0; | 169 | int count = 0; |
161 | fa.resize( count+1 ); | 170 | fa.resize( count+1 ); |
162 | fa[count++] = pa[0]; | 171 | fa[count++] = pa[0]; |
163 | for ( unsigned i = 0; i < pa.count()-1; i++ ) { | 172 | for ( unsigned i = 0; i < pa.count()-1; i++ ) { |
164 | int x1 = pa[int(i)].x(); | 173 | int x1 = pa[int(i)].x(); |
165 | int y1 = pa[int(i)].y(); | 174 | int y1 = pa[int(i)].y(); |
166 | int x2 = pa[int(i+1)].x(); | 175 | int x2 = pa[int(i+1)].x(); |
167 | int y2 = pa[int(i+1)].y(); | 176 | int y2 = pa[int(i+1)].y(); |
168 | int dx = x2 - x1; | 177 | int dx = x2 - x1; |
169 | int dy = y2 - y1; | 178 | int dy = y2 - y1; |
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 7cbfe13..1356c77 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -1,80 +1,88 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | =. (C) 2000-2002 Trolltech AS |
4 | ** This file is part of the Qtopia Environment. | 4 | .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This program is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ** | 18 | ..}^=.= = ; Library General Public License for more |
19 | **********************************************************************/ | 19 | ++= -. .` .: details. |
20 | 20 | : = ...= . :.=- | |
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
21 | #include "startmenu.h" | 28 | #include "startmenu.h" |
22 | #include "inputmethods.h" | 29 | #include "inputmethods.h" |
23 | #include "runningappbar.h" | 30 | #include "runningappbar.h" |
24 | #include "systray.h" | 31 | #include "systray.h" |
25 | #include "wait.h" | 32 | #include "wait.h" |
26 | #include "appicons.h" | 33 | #include "appicons.h" |
27 | 34 | ||
28 | #include "taskbar.h" | 35 | #include "taskbar.h" |
29 | #include "server.h" | 36 | #include "server.h" |
30 | 37 | ||
31 | /* OPIE */ | 38 | /* OPIE */ |
32 | #include <opie2/odebug.h> | 39 | #include <opie2/odebug.h> |
40 | #include <opie2/oresource.h> | ||
33 | #include <qtopia/config.h> | 41 | #include <qtopia/config.h> |
34 | #include <qtopia/qpeapplication.h> | 42 | #include <qtopia/qpeapplication.h> |
35 | #ifdef QWS | 43 | #ifdef QWS |
36 | #include <qtopia/qcopenvelope_qws.h> | 44 | #include <qtopia/qcopenvelope_qws.h> |
37 | #endif | 45 | #endif |
38 | #include <qtopia/global.h> | 46 | #include <qtopia/global.h> |
39 | using namespace Opie::Core; | 47 | using namespace Opie::Core; |
40 | 48 | ||
41 | /* QT */ | 49 | /* QT */ |
42 | #include <qlabel.h> | 50 | #include <qlabel.h> |
43 | #include <qlayout.h> | 51 | #include <qlayout.h> |
44 | #include <qtimer.h> | 52 | #include <qtimer.h> |
45 | #ifdef QWS | 53 | #ifdef QWS |
46 | #include <qwindowsystem_qws.h> | 54 | #include <qwindowsystem_qws.h> |
47 | #endif | 55 | #endif |
48 | #include <qwidgetstack.h> | 56 | #include <qwidgetstack.h> |
49 | 57 | ||
50 | #if defined( Q_WS_QWS ) | 58 | #if defined( Q_WS_QWS ) |
51 | #include <qwsdisplay_qws.h> | 59 | #include <qwsdisplay_qws.h> |
52 | #include <qgfx_qws.h> | 60 | #include <qgfx_qws.h> |
53 | #endif | 61 | #endif |
54 | 62 | ||
55 | 63 | ||
56 | static bool initNumLock() | 64 | static bool initNumLock() |
57 | { | 65 | { |
58 | #ifdef QPE_INITIAL_NUMLOCK_STATE | 66 | #ifdef QPE_INITIAL_NUMLOCK_STATE |
59 | QPE_INITIAL_NUMLOCK_STATE | 67 | QPE_INITIAL_NUMLOCK_STATE |
60 | #endif | 68 | #endif |
61 | return FALSE; | 69 | return FALSE; |
62 | } | 70 | } |
63 | 71 | ||
64 | //--------------------------------------------------------------------------- | 72 | //--------------------------------------------------------------------------- |
65 | 73 | ||
66 | class SafeMode : public QWidget | 74 | class SafeMode : public QWidget |
67 | { | 75 | { |
68 | Q_OBJECT | 76 | Q_OBJECT |
69 | public: | 77 | public: |
70 | SafeMode( QWidget *parent ) : QWidget( parent ), menu(0) | 78 | SafeMode( QWidget *parent ) : QWidget( parent ), menu(0) |
71 | { | 79 | { |
72 | message = tr("Safe Mode"); | 80 | message = tr("Safe Mode"); |
73 | QFont f( font() ); | 81 | QFont f( font() ); |
74 | f.setWeight( QFont::Bold ); | 82 | f.setWeight( QFont::Bold ); |
75 | setFont( f ); | 83 | setFont( f ); |
76 | } | 84 | } |
77 | 85 | ||
78 | void mousePressEvent( QMouseEvent *); | 86 | void mousePressEvent( QMouseEvent *); |
79 | QSize sizeHint() const; | 87 | QSize sizeHint() const; |
80 | void paintEvent( QPaintEvent* ); | 88 | void paintEvent( QPaintEvent* ); |
@@ -93,98 +101,98 @@ void SafeMode::mousePressEvent( QMouseEvent *) | |||
93 | menu = new QPopupMenu(this); | 101 | menu = new QPopupMenu(this); |
94 | menu->insertItem( tr("Plugin Manager..."), 0 ); | 102 | menu->insertItem( tr("Plugin Manager..."), 0 ); |
95 | menu->insertItem( tr("Restart Qtopia"), 1 ); | 103 | menu->insertItem( tr("Restart Qtopia"), 1 ); |
96 | menu->insertItem( tr("Help..."), 2 ); | 104 | menu->insertItem( tr("Help..."), 2 ); |
97 | connect(menu, SIGNAL(activated(int)), this, SLOT(action(int))); | 105 | connect(menu, SIGNAL(activated(int)), this, SLOT(action(int))); |
98 | } | 106 | } |
99 | QPoint curPos = mapToGlobal( QPoint(0,0) ); | 107 | QPoint curPos = mapToGlobal( QPoint(0,0) ); |
100 | QSize sh = menu->sizeHint(); | 108 | QSize sh = menu->sizeHint(); |
101 | menu->popup( curPos-QPoint((sh.width()-width())/2,sh.height()) ); | 109 | menu->popup( curPos-QPoint((sh.width()-width())/2,sh.height()) ); |
102 | } | 110 | } |
103 | 111 | ||
104 | void SafeMode::action(int i) | 112 | void SafeMode::action(int i) |
105 | { | 113 | { |
106 | switch (i) { | 114 | switch (i) { |
107 | case 0: | 115 | case 0: |
108 | Global::execute( "pluginmanager" ); | 116 | Global::execute( "pluginmanager" ); |
109 | break; | 117 | break; |
110 | case 1: | 118 | case 1: |
111 | Global::restart(); | 119 | Global::restart(); |
112 | break; | 120 | break; |
113 | case 2: | 121 | case 2: |
114 | Global::execute( "helpbrowser", "safemode.html" ); | 122 | Global::execute( "helpbrowser", "safemode.html" ); |
115 | break; | 123 | break; |
116 | } | 124 | } |
117 | } | 125 | } |
118 | 126 | ||
119 | QSize SafeMode::sizeHint() const | 127 | QSize SafeMode::sizeHint() const |
120 | { | 128 | { |
121 | QFontMetrics fm = fontMetrics(); | 129 | QFontMetrics fm = fontMetrics(); |
122 | 130 | ||
123 | return QSize( fm.width(message), fm.height() ); | 131 | return QSize( fm.width(message), fm.height() ); |
124 | } | 132 | } |
125 | 133 | ||
126 | void SafeMode::paintEvent( QPaintEvent* ) | 134 | void SafeMode::paintEvent( QPaintEvent* ) |
127 | { | 135 | { |
128 | QPainter p(this); | 136 | QPainter p(this); |
129 | p.drawText( rect(), AlignCenter, message ); | 137 | p.drawText( rect(), AlignCenter, message ); |
130 | } | 138 | } |
131 | 139 | ||
132 | //--------------------------------------------------------------------------- | 140 | //--------------------------------------------------------------------------- |
133 | 141 | ||
134 | class LockKeyState : public QWidget | 142 | class LockKeyState : public QWidget |
135 | { | 143 | { |
136 | public: | 144 | public: |
137 | LockKeyState( QWidget *parent ) : | 145 | LockKeyState( QWidget *parent ) : |
138 | QWidget(parent), | 146 | QWidget(parent), |
139 | nl(initNumLock()), cl(FALSE) | 147 | nl(initNumLock()), cl(FALSE) |
140 | { | 148 | { |
141 | nl_pm = Resource::loadPixmap("numlock"); | 149 | nl_pm = OResource::loadPixmap("numlock", OResource::NoScale); |
142 | cl_pm = Resource::loadPixmap("capslock"); | 150 | cl_pm = OResource::loadPixmap("capslock", OResource::NoScale); |
143 | } | 151 | } |
144 | QSize sizeHint() const | 152 | QSize sizeHint() const |
145 | { | 153 | { |
146 | return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); | 154 | return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); |
147 | } | 155 | } |
148 | void toggleNumLockState() | 156 | void toggleNumLockState() |
149 | { | 157 | { |
150 | nl = !nl; repaint(); | 158 | nl = !nl; repaint(); |
151 | } | 159 | } |
152 | void toggleCapsLockState() | 160 | void toggleCapsLockState() |
153 | { | 161 | { |
154 | cl = !cl; repaint(); | 162 | cl = !cl; repaint(); |
155 | } | 163 | } |
156 | void paintEvent( QPaintEvent * ) | 164 | void paintEvent( QPaintEvent * ) |
157 | { | 165 | { |
158 | int y = (height()-sizeHint().height())/2; | 166 | int y = (height()-sizeHint().height())/2; |
159 | QPainter p(this); | 167 | QPainter p(this); |
160 | if ( nl ) | 168 | if ( nl ) |
161 | p.drawPixmap(1,y,nl_pm); | 169 | p.drawPixmap(1,y,nl_pm); |
162 | if ( cl ) | 170 | if ( cl ) |
163 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); | 171 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); |
164 | } | 172 | } |
165 | private: | 173 | private: |
166 | QPixmap nl_pm, cl_pm; | 174 | QPixmap nl_pm, cl_pm; |
167 | bool nl, cl; | 175 | bool nl, cl; |
168 | }; | 176 | }; |
169 | 177 | ||
170 | //--------------------------------------------------------------------------- | 178 | //--------------------------------------------------------------------------- |
171 | 179 | ||
172 | TaskBar::~TaskBar() | 180 | TaskBar::~TaskBar() |
173 | { | 181 | { |
174 | } | 182 | } |
175 | 183 | ||
176 | 184 | ||
177 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) | 185 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) |
178 | { | 186 | { |
179 | /* Read InputMethod Config */ | 187 | /* Read InputMethod Config */ |
180 | readConfig(); | 188 | readConfig(); |
181 | 189 | ||
182 | sm = new StartMenu( this ); | 190 | sm = new StartMenu( this ); |
183 | connect( sm, SIGNAL(tabSelected(const QString&)), this, | 191 | connect( sm, SIGNAL(tabSelected(const QString&)), this, |
184 | SIGNAL(tabSelected(const QString&)) ); | 192 | SIGNAL(tabSelected(const QString&)) ); |
185 | 193 | ||
186 | inputMethods = new InputMethods( this ); | 194 | inputMethods = new InputMethods( this ); |
187 | connect( inputMethods, SIGNAL(inputToggled(bool)), | 195 | connect( inputMethods, SIGNAL(inputToggled(bool)), |
188 | this, SLOT(calcMaxWindowRect()) ); | 196 | this, SLOT(calcMaxWindowRect()) ); |
189 | 197 | ||
190 | stack = new QWidgetStack( this ); | 198 | stack = new QWidgetStack( this ); |
diff --git a/core/launcher/wait.cpp b/core/launcher/wait.cpp index 523819d..f872218 100644 --- a/core/launcher/wait.cpp +++ b/core/launcher/wait.cpp | |||
@@ -1,81 +1,87 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | =. (C) 2000-2002 Trolltech AS |
4 | ** This file is part of the Qtopia Environment. | 4 | .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This program is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ** | 18 | ..}^=.= = ; Library General Public License for more |
19 | **********************************************************************/ | 19 | ++= -. .` .: details. |
20 | 20 | : = ...= . :.=- | |
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
21 | #include "wait.h" | 28 | #include "wait.h" |
22 | 29 | ||
23 | #include <opie2/owait.h> | 30 | #include <opie2/owait.h> |
31 | #include <opie2/oresource.h> | ||
32 | using namespace Opie::Core; | ||
24 | 33 | ||
25 | #include <qtopia/config.h> | 34 | #include <qtopia/config.h> |
26 | #include <qtopia/applnk.h> | 35 | #include <qtopia/applnk.h> |
27 | 36 | ||
28 | Wait *lastWaitObject = NULL; | 37 | Wait *lastWaitObject = NULL; |
29 | 38 | ||
30 | 39 | ||
31 | using namespace Opie::Ui; | 40 | using namespace Opie::Ui; |
32 | Wait::Wait( QWidget *parent ) : QWidget( parent ), | 41 | Wait::Wait( QWidget *parent ) : QWidget( parent ), |
33 | waiting( FALSE ) | 42 | waiting( FALSE ) |
34 | { | 43 | { |
35 | 44 | ||
36 | QSize size( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 45 | QSize size( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
37 | setFixedSize( size ); | 46 | setFixedSize( size ); |
38 | 47 | pm = OResource::loadPixmap( "wait", OResource::SmallIcon ); | |
39 | QImage img = Resource::loadImage( "wait" ); | ||
40 | img = img.smoothScale( size.width(), size.height() ); | ||
41 | pm.convertFromImage( img ); | ||
42 | 48 | ||
43 | lastWaitObject = this; | 49 | lastWaitObject = this; |
44 | m_centralWait = new OWait( 0l ); | 50 | m_centralWait = new OWait( 0l ); |
45 | m_centralWait->hide(); | 51 | m_centralWait->hide(); |
46 | hide(); | 52 | hide(); |
47 | } | 53 | } |
48 | 54 | ||
49 | 55 | ||
50 | Wait *Wait::getWaitObject() | 56 | Wait *Wait::getWaitObject() |
51 | { | 57 | { |
52 | return lastWaitObject; | 58 | return lastWaitObject; |
53 | } | 59 | } |
54 | 60 | ||
55 | 61 | ||
56 | void Wait::setWaiting( bool w ) | 62 | void Wait::setWaiting( bool w ) |
57 | { | 63 | { |
58 | Config cfg ( "Launcher" ); | 64 | Config cfg ( "Launcher" ); |
59 | cfg.setGroup("GUI"); | 65 | cfg.setGroup("GUI"); |
60 | 66 | ||
61 | 67 | ||
62 | waiting = w; | 68 | waiting = w; |
63 | if ( w ) { | 69 | if ( w ) { |
64 | if ( cfg. readBoolEntry( "BigBusy" ) ) | 70 | if ( cfg. readBoolEntry( "BigBusy" ) ) |
65 | m_centralWait->show(); | 71 | m_centralWait->show(); |
66 | else | 72 | else |
67 | show(); | 73 | show(); |
68 | }else{ | 74 | }else{ |
69 | m_centralWait->hide(); | 75 | m_centralWait->hide(); |
70 | hide(); | 76 | hide(); |
71 | } | 77 | } |
72 | } | 78 | } |
73 | 79 | ||
74 | 80 | ||
75 | void Wait::paintEvent( QPaintEvent * ) | 81 | void Wait::paintEvent( QPaintEvent * ) |
76 | { | 82 | { |
77 | QPainter p( this ); | 83 | QPainter p( this ); |
78 | p.drawPixmap( 0, 0, pm ); | 84 | p.drawPixmap( 0, 0, pm ); |
79 | } | 85 | } |
80 | 86 | ||
81 | 87 | ||