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 /core/launcher/documentlist.cpp | |
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
Diffstat (limited to 'core/launcher/documentlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/documentlist.cpp | 72 |
1 files changed, 37 insertions, 35 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,53 +1,61 @@ | |||
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; |
@@ -211,64 +219,61 @@ void DocumentList::timerEvent( QTimerEvent *te ) | |||
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 ); |
@@ -336,64 +341,61 @@ void DocumentList::linkChanged( QString arg ) | |||
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 ); |