summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2005-02-23 22:59:25 (UTC)
committer zecke <zecke>2005-02-23 22:59:25 (UTC)
commit729a178d1da1b8f80e4b1f6b0fc2c6a4cd15a403 (patch) (unidiff)
tree968a422532f4596d2ab5530127e28cd948776778 /library
parent9e2e6d962e1e2d3e5c17641d9a9b21a5906bd262 (diff)
downloadopie-729a178d1da1b8f80e4b1f6b0fc2c6a4cd15a403.zip
opie-729a178d1da1b8f80e4b1f6b0fc2c6a4cd15a403.tar.gz
opie-729a178d1da1b8f80e4b1f6b0fc2c6a4cd15a403.tar.bz2
Fix crappy indenting on the methods I'm about to touch. Even TT fixed it...
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.cpp84
1 files changed, 43 insertions, 41 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp
index 80f2c62..c82d3b9 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -399,150 +399,152 @@ AppLnk::AppLnk( const QString &file )
399 // numeric cats in file! convert to text 399 // numeric cats in file! convert to text
400 Categories cat( 0 ); 400 Categories cat( 0 );
401 cat.load( categoryFileName() ); 401 cat.load( categoryFileName() );
402 d->mCat.resize( d->mCatList.count() ); 402 d->mCat.resize( d->mCatList.count() );
403 int i; 403 int i;
404 QStringList::ConstIterator it; 404 QStringList::ConstIterator it;
405 for ( i = 0, it = d->mCatList.begin(); it != d->mCatList.end(); 405 for ( i = 0, it = d->mCatList.begin(); it != d->mCatList.end();
406 ++it, i++ ) { 406 ++it, i++ ) {
407 bool number; 407 bool number;
408 int id = (*it).toInt( &number ); 408 int id = (*it).toInt( &number );
409 if ( !number ) { 409 if ( !number ) {
410 // convert from text 410 // convert from text
411 id = cat.id( "Document View", *it ); 411 id = cat.id( "Document View", *it );
412 if ( id == 0 ) 412 if ( id == 0 )
413 id = cat.addCategory( "Document View", *it ); 413 id = cat.addCategory( "Document View", *it );
414 } 414 }
415 d->mCat[i] = id; 415 d->mCat[i] = id;
416 } 416 }
417 d->updateCatListFromArray(); 417 d->updateCatListFromArray();
418 } 418 }
419 } 419 }
420 } 420 }
421 mId = 0; 421 mId = 0;
422} 422}
423 423
424AppLnk& AppLnk::operator=(const AppLnk &copy) 424AppLnk& AppLnk::operator=(const AppLnk &copy)
425{ 425{
426 if ( this == &copy ) return *this; 426 if ( this == &copy ) return *this;
427 if ( mId ) 427 if ( mId )
428 qWarning("Deleting AppLnk that is in an AppLnkSet"); 428 qWarning("Deleting AppLnk that is in an AppLnkSet");
429 if ( d ) 429 if ( d )
430 delete d; 430 delete d;
431 431
432 432
433 mName = copy.mName; 433 mName = copy.mName;
434 434
435 /* remove for Qtopia 3.0 -zecke */ 435 /* remove for Qtopia 3.0 -zecke */
436 mPixmap = copy.mPixmap; 436 mPixmap = copy.mPixmap;
437 mBigPixmap = copy.mBigPixmap; 437 mBigPixmap = copy.mBigPixmap;
438 438
439 mExec = copy.mExec; 439 mExec = copy.mExec;
440 mType = copy.mType; 440 mType = copy.mType;
441 mRotation = copy.mRotation; 441 mRotation = copy.mRotation;
442 mComment = copy.mComment; 442 mComment = copy.mComment;
443 mFile = copy.mFile; 443 mFile = copy.mFile;
444 mLinkFile = copy.mLinkFile; 444 mLinkFile = copy.mLinkFile;
445 mIconFile = copy.mIconFile; 445 mIconFile = copy.mIconFile;
446 mMimeTypes = copy.mMimeTypes; 446 mMimeTypes = copy.mMimeTypes;
447 mMimeTypeIcons = copy.mMimeTypeIcons; 447 mMimeTypeIcons = copy.mMimeTypeIcons;
448 mId = 0; 448 mId = 0;
449 d = new AppLnkPrivate(); 449 d = new AppLnkPrivate();
450 d->mCat = copy.d->mCat; 450 d->mCat = copy.d->mCat;
451 d->mCatList = copy.d->mCatList; 451 d->mCatList = copy.d->mCatList;
452 d->mPixmaps = copy.d->mPixmaps; 452 d->mPixmaps = copy.d->mPixmaps;
453 453
454 return *this; 454 return *this;
455} 455}
456/*! 456/*!
457 protected internally to share code 457 protected internally to share code
458 should I document that at all? 458 should I document that at all?
459 I don't know the TT style for that 459 I don't know the TT style for that
460*/ 460*/
461const QPixmap& AppLnk::pixmap( int pos, int size ) const { 461const QPixmap& AppLnk::pixmap( int pos, int size ) const {
462 if ( d->mPixmaps[pos].isNull() ) { 462 if ( d->mPixmaps[pos].isNull() ) {
463 AppLnk* that = (AppLnk*)this; 463 AppLnk* that = (AppLnk*)this;
464 if ( mIconFile.isEmpty() ) { 464 if ( mIconFile.isEmpty() ) {
465 MimeType mt(type()); 465 MimeType mt(type());
466 that->d->mPixmaps[pos] = pos ? mt.bigPixmap() : mt.pixmap(); 466 that->d->mPixmaps[pos] = pos ? mt.bigPixmap() : mt.pixmap();
467 if ( that->d->mPixmaps[pos].isNull() ) 467 if ( that->d->mPixmaps[pos].isNull() )
468 that->d->mPixmaps[pos].convertFromImage( 468 that->d->mPixmaps[pos].convertFromImage(
469 Resource::loadImage("UnknownDocument") 469 Resource::loadImage("UnknownDocument")
470 .smoothScale( size, size ) ); 470 .smoothScale( size, size ) );
471 return that->d->mPixmaps[pos]; 471 return that->d->mPixmaps[pos];
472 } 472 }
473 QImage unscaledIcon = Resource::loadImage( that->mIconFile ); 473
474 if ( unscaledIcon.isNull() ) { 474 QImage unscaledIcon = Resource::loadImage( that->mIconFile );
475 // qDebug( "Cannot find icon: %s", that->mIconFile.latin1() ); 475 if ( unscaledIcon.isNull() ) {
476 that->d->mPixmaps[pos].convertFromImage( 476 // qDebug( "Cannot find icon: %s", that->mIconFile.latin1() );
477 Resource::loadImage("UnknownDocument") 477 that->d->mPixmaps[pos].convertFromImage(
478 .smoothScale( size, size ) ); 478 Resource::loadImage("UnknownDocument")
479 } else { 479 .smoothScale( size, size ) );
480 that->d->mPixmaps[0].convertFromImage( unscaledIcon.smoothScale( smallSize, smallSize ) ); 480 } else {
481 that->d->mPixmaps[1].convertFromImage( unscaledIcon.smoothScale( bigSize, bigSize ) ); 481 that->d->mPixmaps[0].convertFromImage( unscaledIcon.smoothScale( smallSize, smallSize ) );
482 } 482 that->d->mPixmaps[1].convertFromImage( unscaledIcon.smoothScale( bigSize, bigSize ) );
483 return that->d->mPixmaps[pos]; 483 }
484 return that->d->mPixmaps[pos];
484 } 485 }
486
485 return d->mPixmaps[pos]; 487 return d->mPixmaps[pos];
486} 488}
487 489
488/*! 490/*!
489 Returns a small pixmap associated with the application. 491 Returns a small pixmap associated with the application.
490 492
491 \sa bigPixmap() setIcon() 493 \sa bigPixmap() setIcon()
492*/ 494*/
493const QPixmap& AppLnk::pixmap() const 495const QPixmap& AppLnk::pixmap() const
494{ 496{
495 if ( d->mPixmaps[0].isNull() ) { 497 if ( d->mPixmaps[0].isNull() ) {
496 return pixmap(AppLnkPrivate::Normal, smallSize ); 498 return pixmap(AppLnkPrivate::Normal, smallSize );
497 } 499 }
498 return d->mPixmaps[0]; 500 return d->mPixmaps[0];
499} 501}
500 502
501/*! 503/*!
502 Returns a large pixmap associated with the application. 504 Returns a large pixmap associated with the application.
503 505
504 \sa pixmap() setIcon() 506 \sa pixmap() setIcon()
505*/ 507*/
506const QPixmap& AppLnk::bigPixmap() const 508const QPixmap& AppLnk::bigPixmap() const
507{ 509{
508 if ( d->mPixmaps[1].isNull() ) { 510 if ( d->mPixmaps[1].isNull() ) {
509 return pixmap( AppLnkPrivate::Big, bigSize ); 511 return pixmap( AppLnkPrivate::Big, bigSize );
510 } 512 }
511 return d->mPixmaps[1]; 513 return d->mPixmaps[1];
512} 514}
513 515
514/*! 516/*!
515 Returns the type of the AppLnk. For applications, games and 517 Returns the type of the AppLnk. For applications, games and
516 settings the type is \c Application; for documents the type is the 518 settings the type is \c Application; for documents the type is the
517 document's MIME type. 519 document's MIME type.
518*/ 520*/
519QString AppLnk::type() const 521QString AppLnk::type() const
520{ 522{
521 if ( mType.isNull() ) { 523 if ( mType.isNull() ) {
522 AppLnk* that = (AppLnk*)this; 524 AppLnk* that = (AppLnk*)this;
523 QString f = file(); 525 QString f = file();
524 if ( !f.isNull() ) { 526 if ( !f.isNull() ) {
525 MimeType mt(f); 527 MimeType mt(f);
526 that->mType = mt.id(); 528 that->mType = mt.id();
527 return that->mType; 529 return that->mType;
528 } 530 }
529 } 531 }
530 return mType; 532 return mType;
531} 533}
532 534
533/*! 535/*!
534 Returns the file associated with the AppLnk. 536 Returns the file associated with the AppLnk.
535 537
536 \sa exec() name() 538 \sa exec() name()
537*/ 539*/
538QString AppLnk::file() const 540QString AppLnk::file() const
539{ 541{
540 if ( mExec.isEmpty ( ) && mFile.isNull() ) { 542 if ( mExec.isEmpty ( ) && mFile.isNull() ) {
541 AppLnk* that = (AppLnk*)this; 543 AppLnk* that = (AppLnk*)this;
542 QString ext = MimeType(mType).extension(); 544 QString ext = MimeType(mType).extension();
543 if ( !ext.isEmpty() ) 545 if ( !ext.isEmpty() )
544 ext = "." + ext; 546 ext = "." + ext;
545 if ( !mLinkFile.isEmpty() ) { 547 if ( !mLinkFile.isEmpty() ) {
546 that->mFile = 548 that->mFile =
547 mLinkFile.right(8)==".desktop" // 8 = strlen(".desktop") 549 mLinkFile.right(8)==".desktop" // 8 = strlen(".desktop")
548 ? mLinkFile.left(mLinkFile.length()-8) : mLinkFile; 550 ? mLinkFile.left(mLinkFile.length()-8) : mLinkFile;
@@ -923,270 +925,270 @@ bool AppLnk::isPreloaded() const {
923 // Preload information is stored in the Launcher config in v1.5. 925 // Preload information is stored in the Launcher config in v1.5.
924 Config cfg("Launcher"); 926 Config cfg("Launcher");
925 cfg.setGroup("Preload"); 927 cfg.setGroup("Preload");
926 QStringList apps = cfg.readListEntry("Apps",','); 928 QStringList apps = cfg.readListEntry("Apps",',');
927 if (apps.contains(exec())) 929 if (apps.contains(exec()))
928 return true; 930 return true;
929 return false; 931 return false;
930} 932}
931 933
932void AppLnk::setPreloaded(bool yesNo) { 934void AppLnk::setPreloaded(bool yesNo) {
933 // Preload information is stored in the Launcher config in v1.5. 935 // Preload information is stored in the Launcher config in v1.5.
934 Config cfg("Launcher"); 936 Config cfg("Launcher");
935 cfg.setGroup("Preload"); 937 cfg.setGroup("Preload");
936 QStringList apps = cfg.readListEntry("Apps", ','); 938 QStringList apps = cfg.readListEntry("Apps", ',');
937 if (apps.contains(exec()) && !yesNo) 939 if (apps.contains(exec()) && !yesNo)
938 apps.remove(exec()); 940 apps.remove(exec());
939 else if (yesNo && !apps.contains(exec())) 941 else if (yesNo && !apps.contains(exec()))
940 apps.append(exec()); 942 apps.append(exec());
941 cfg.writeEntry("Apps", apps, ','); 943 cfg.writeEntry("Apps", apps, ',');
942} 944}
943 945
944 946
945/*! 947/*!
946 Deletes both the linkFile() and the file() associated with this AppLnk. 948 Deletes both the linkFile() and the file() associated with this AppLnk.
947 949
948 \sa removeLinkFile() 950 \sa removeLinkFile()
949*/ 951*/
950void AppLnk::removeFiles() 952void AppLnk::removeFiles()
951{ 953{
952 bool valid = isValid(); 954 bool valid = isValid();
953 if ( !valid || !linkFileKnown() || QFile::remove(linkFile()) ) { 955 if ( !valid || !linkFileKnown() || QFile::remove(linkFile()) ) {
954 if ( QFile::remove(file()) ) { 956 if ( QFile::remove(file()) ) {
955#ifndef QT_NO_COP 957#ifndef QT_NO_COP
956 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 958 QCopEnvelope e("QPE/System", "linkChanged(QString)");
957 if ( linkFileKnown() ) 959 if ( linkFileKnown() )
958 e << linkFile(); 960 e << linkFile();
959 else 961 else
960 e << file(); 962 e << file();
961#endif 963#endif
962 } else if ( valid ) { 964 } else if ( valid ) {
963 // restore link 965 // restore link
964 writeLink(); 966 writeLink();
965 } 967 }
966 } 968 }
967} 969}
968 970
969/*! 971/*!
970 Deletes the linkFile(), leaving any file() untouched. 972 Deletes the linkFile(), leaving any file() untouched.
971 973
972 \sa removeFiles() 974 \sa removeFiles()
973*/ 975*/
974void AppLnk::removeLinkFile() 976void AppLnk::removeLinkFile()
975{ 977{
976 if ( isValid() && linkFileKnown() && QFile::remove(linkFile()) ) { 978 if ( isValid() && linkFileKnown() && QFile::remove(linkFile()) ) {
977#ifndef QT_NO_COP 979#ifndef QT_NO_COP
978 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 980 QCopEnvelope e("QPE/System", "linkChanged(QString)");
979 e << linkFile(); 981 e << linkFile();
980#endif 982#endif
981 } 983 }
982} 984}
983 985
984class AppLnkImagePrivate { 986class AppLnkImagePrivate {
985public : 987public :
986 AppLnkImagePrivate( const QString & ImageName ) { 988 AppLnkImagePrivate( const QString & ImageName ) {
987 IconName = ImageName; 989 IconName = ImageName;
988 Small = 0; 990 Small = 0;
989 Big = 0; 991 Big = 0;
990 } 992 }
991 ~AppLnkImagePrivate( ) { 993 ~AppLnkImagePrivate( ) {
992 if ( Small ) delete Small; 994 if ( Small ) delete Small;
993 if ( Big ) delete Big; 995 if ( Big ) delete Big;
994 } 996 }
995 997
996 inline QPixmap * small( void ) { 998 inline QPixmap * small( void ) {
997 if( ! Small ) { 999 if( ! Small ) {
998 QImage unscaledIcon = Resource::loadImage( IconName ); 1000 QImage unscaledIcon = Resource::loadImage( IconName );
999 // works as long as smallSize remains static 1001 // works as long as smallSize remains static
1000 Small = new QPixmap(); 1002 Small = new QPixmap();
1001 Small->convertFromImage( unscaledIcon.smoothScale( smallSize, smallSize ) ); 1003 Small->convertFromImage( unscaledIcon.smoothScale( smallSize, smallSize ) );
1002 } 1004 }
1003 return Small; 1005 return Small;
1004 } 1006 }
1005 1007
1006 inline QPixmap * big( void ) { 1008 inline QPixmap * big( void ) {
1007 if( ! Big ) { 1009 if( ! Big ) {
1008 QImage unscaledIcon = Resource::loadImage( IconName ); 1010 QImage unscaledIcon = Resource::loadImage( IconName );
1009 // works as long as bigSize remains static 1011 // works as long as bigSize remains static
1010 Big = new QPixmap(); 1012 Big = new QPixmap();
1011 Big->convertFromImage( unscaledIcon.smoothScale( bigSize, bigSize ) ); 1013 Big->convertFromImage( unscaledIcon.smoothScale( bigSize, bigSize ) );
1012 } 1014 }
1013 return Big; 1015 return Big;
1014 } 1016 }
1015 1017
1016 QString IconName; 1018 QString IconName;
1017 QPixmap * Small; 1019 QPixmap * Small;
1018 QPixmap * Big; 1020 QPixmap * Big;
1019}; 1021};
1020 1022
1021class AppLnkSetPrivate { 1023class AppLnkSetPrivate {
1022public: 1024public:
1023 AppLnkSetPrivate() 1025 AppLnkSetPrivate()
1024 { 1026 {
1025 typPix.setAutoDelete(TRUE); 1027 typPix.setAutoDelete(TRUE);
1026 typName.setAutoDelete(TRUE); 1028 typName.setAutoDelete(TRUE);
1027 } 1029 }
1028 1030
1029 QDict<AppLnkImagePrivate> typPix; 1031 QDict<AppLnkImagePrivate> typPix;
1030 QDict<QString> typName; 1032 QDict<QString> typName;
1031}; 1033};
1032 1034
1033/*! 1035/*!
1034 \class AppLnkSet applnk.h 1036 \class AppLnkSet applnk.h
1035 \brief The AppLnkSet class is a set of AppLnk objects. 1037 \brief The AppLnkSet class is a set of AppLnk objects.
1036*/ 1038*/
1037 1039
1038/*! 1040/*!
1039 \fn QStringList AppLnkSet::types() const 1041 \fn QStringList AppLnkSet::types() const
1040 1042
1041 Returns the list of \link applnk.html#Types types\endlink in the set. 1043 Returns the list of \link applnk.html#Types types\endlink in the set.
1042 1044
1043 For applications, games and settings the type is \c Application; 1045 For applications, games and settings the type is \c Application;
1044 for documents the type is the document's MIME type. 1046 for documents the type is the document's MIME type.
1045 1047
1046 \sa AppLnk::type(), typeName(), typePixmap(), typeBigPixmap() 1048 \sa AppLnk::type(), typeName(), typePixmap(), typeBigPixmap()
1047*/ 1049*/
1048 1050
1049/*! 1051/*!
1050 \fn const QList<AppLnk>& AppLnkSet::children() const 1052 \fn const QList<AppLnk>& AppLnkSet::children() const
1051 1053
1052 Returns the members of the set. 1054 Returns the members of the set.
1053*/ 1055*/
1054 1056
1055/*! 1057/*!
1056 Constructs an empty AppLnkSet. 1058 Constructs an empty AppLnkSet.
1057*/ 1059*/
1058AppLnkSet::AppLnkSet() : 1060AppLnkSet::AppLnkSet() :
1059 d(new AppLnkSetPrivate) 1061 d(new AppLnkSetPrivate)
1060{ 1062{
1061} 1063}
1062 1064
1063/*! 1065/*!
1064 Constructs an AppLnkSet that contains AppLnk objects representing 1066 Constructs an AppLnkSet that contains AppLnk objects representing
1065 all the files in the given \a directory (and any subdirectories 1067 all the files in the given \a directory (and any subdirectories
1066 recursively). 1068 recursively).
1067 1069
1068 \omit 1070 \omit
1069 The directories may contain ".directory" files which override 1071 The directories may contain ".directory" files which override
1070 any AppLnk::type() values for AppLnk objects found in the directory. 1072 any AppLnk::type() values for AppLnk objects found in the directory.
1071 This allows simple localization of application types. 1073 This allows simple localization of application types.
1072 \endomit 1074 \endomit
1073*/ 1075*/
1074AppLnkSet::AppLnkSet( const QString &directory ) : 1076AppLnkSet::AppLnkSet( const QString &directory ) :
1075 d(new AppLnkSetPrivate) 1077 d(new AppLnkSetPrivate)
1076{ 1078{
1077 QDir dir( directory ); 1079 QDir dir( directory );
1078 mFile = directory; 1080 mFile = directory;
1079 findChildren(directory,QString::null,QString::null); 1081 findChildren(directory,QString::null,QString::null);
1080} 1082}
1081 1083
1082/*! 1084/*!
1083 Detaches all AppLnk objects from the set. The set become empty and 1085 Detaches all AppLnk objects from the set. The set become empty and
1084 the caller becomes responsible for deleting the AppLnk objects. 1086 the caller becomes responsible for deleting the AppLnk objects.
1085*/ 1087*/
1086void AppLnkSet::detachChildren() 1088void AppLnkSet::detachChildren()
1087{ 1089{
1088 QListIterator<AppLnk> it( mApps ); 1090 QListIterator<AppLnk> it( mApps );
1089 for ( ; it.current(); ) { 1091 for ( ; it.current(); ) {
1090 AppLnk* a = *it; 1092 AppLnk* a = *it;
1091 ++it; 1093 ++it;
1092 a->mId = 0; 1094 a->mId = 0;
1093 } 1095 }
1094 mApps.clear(); 1096 mApps.clear();
1095} 1097}
1096 1098
1097/*! 1099/*!
1098 Destroys the set, deleting all the AppLnk objects it contains. 1100 Destroys the set, deleting all the AppLnk objects it contains.
1099 1101
1100 \sa detachChildren() 1102 \sa detachChildren()
1101*/ 1103*/
1102AppLnkSet::~AppLnkSet() 1104AppLnkSet::~AppLnkSet()
1103{ 1105{
1104 QListIterator<AppLnk> it( mApps ); 1106 QListIterator<AppLnk> it( mApps );
1105 for ( ; it.current(); ) { 1107 for ( ; it.current(); ) {
1106 AppLnk* a = *it; 1108 AppLnk* a = *it;
1107 ++it; 1109 ++it;
1108 a->mId = 0; 1110 a->mId = 0;
1109 delete a; 1111 delete a;
1110 } 1112 }
1111 delete d; 1113 delete d;
1112} 1114}
1113 1115
1114void AppLnkSet::findChildren(const QString &dr, const QString& typ, const QString& typName, int depth) 1116void AppLnkSet::findChildren(const QString &dr, const QString& typ, const QString& typName, int depth)
1115{ 1117{
1116 depth++; 1118 depth++;
1117 if ( depth > 10 ) 1119 if ( depth > 10 )
1118 return; 1120 return;
1119 1121
1120 QDir dir( dr ); 1122 QDir dir( dr );
1121 QString typNameLocal = typName; 1123 QString typNameLocal = typName;
1122 1124
1123 if ( dir.exists( ".directory" ) ) { 1125 if ( dir.exists( ".directory" ) ) {
1124 Config config( dr + "/.directory", Config::File ); 1126 Config config( dr + "/.directory", Config::File );
1125 config.setGroup( "Desktop Entry" ); 1127 config.setGroup( "Desktop Entry" );
1126 typNameLocal = config.readEntry( "Name", typNameLocal ); 1128 typNameLocal = config.readEntry( "Name", typNameLocal );
1127 if ( !typ.isEmpty() ) { 1129 if ( !typ.isEmpty() ) {
1128 d->typPix.insert( typ, 1130 d->typPix.insert( typ,
1129 new AppLnkImagePrivate( config.readEntry( "Icon", "AppsIcon" ) ) 1131 new AppLnkImagePrivate( config.readEntry( "Icon", "AppsIcon" ) )
1130 ); 1132 );
1131 d->typName.insert(typ, new QString(typNameLocal)); 1133 d->typName.insert(typ, new QString(typNameLocal));
1132 1134
1133 } 1135 }
1134 } 1136 }
1135 1137
1136 const QFileInfoList *list = dir.entryInfoList(); 1138 const QFileInfoList *list = dir.entryInfoList();
1137 if ( list ) { 1139 if ( list ) {
1138 QFileInfo* fi; 1140 QFileInfo* fi;
1139 bool cadded=FALSE; 1141 bool cadded=FALSE;
1140 for ( QFileInfoListIterator it(*list); (fi=*it); ++it ) { 1142 for ( QFileInfoListIterator it(*list); (fi=*it); ++it ) {
1141 QString bn = fi->fileName(); 1143 QString bn = fi->fileName();
1142 // qDebug("findChildren "+bn); 1144 // qDebug("findChildren "+bn);
1143 if ( bn[0] != '.' && bn != "CVS" ) { 1145 if ( bn[0] != '.' && bn != "CVS" ) {
1144 if ( fi->isDir() ) { 1146 if ( fi->isDir() ) {
1145 QString c = typ.isNull() ? bn : typ+"/"+bn; 1147 QString c = typ.isNull() ? bn : typ+"/"+bn;
1146 QString d = typNameLocal.isNull() ? bn : typNameLocal+"/"+bn; 1148 QString d = typNameLocal.isNull() ? bn : typNameLocal+"/"+bn;
1147 findChildren(fi->filePath(), c, d, depth ); 1149 findChildren(fi->filePath(), c, d, depth );
1148 } else { 1150 } else {
1149 if ( fi->extension(FALSE) == "desktop" ) { 1151 if ( fi->extension(FALSE) == "desktop" ) {
1150 AppLnk* app = new AppLnk( fi->filePath() ); 1152 AppLnk* app = new AppLnk( fi->filePath() );
1151#ifdef QT_NO_QWS_MULTIPROCESS 1153#ifdef QT_NO_QWS_MULTIPROCESS
1152 if ( !Global::isBuiltinCommand( app->exec() ) ) 1154 if ( !Global::isBuiltinCommand( app->exec() ) )
1153 delete app; 1155 delete app;
1154 else 1156 else
1155#endif 1157#endif
1156 { 1158 {
1157 if ( !typ.isEmpty() ) { 1159 if ( !typ.isEmpty() ) {
1158 if ( !cadded ) { 1160 if ( !cadded ) {
1159 typs.append(typ); 1161 typs.append(typ);
1160 cadded = TRUE; 1162 cadded = TRUE;
1161 } 1163 }
1162 app->setType(typ); 1164 app->setType(typ);
1163 } 1165 }
1164 add(app); 1166 add(app);
1165 } 1167 }
1166 } 1168 }
1167 } 1169 }
1168 } 1170 }
1169 } 1171 }
1170 } 1172 }
1171} 1173}
1172 1174
1173/*! 1175/*!
1174 Adds AppLnk \a f to the set. The set takes responsibility for 1176 Adds AppLnk \a f to the set. The set takes responsibility for
1175 deleting \a f. 1177 deleting \a f.
1176 1178
1177 \sa remove() 1179 \sa remove()
1178*/ 1180*/
1179void AppLnkSet::add( AppLnk *f ) 1181void AppLnkSet::add( AppLnk *f )
1180{ 1182{
1181 if ( f->mId == 0 ) { 1183 if ( f->mId == 0 ) {
1182 AppLnk::lastId++; 1184 AppLnk::lastId++;
1183 f->mId = AppLnk::lastId; 1185 f->mId = AppLnk::lastId;
1184 mApps.append( f ); 1186 mApps.append( f );
1185 } else { 1187 } else {
1186 qWarning("Attempt to add an AppLnk twice"); 1188 qWarning("Attempt to add an AppLnk twice");
1187 } 1189 }
1188} 1190}
1189 1191
1190/*! 1192/*!
1191 Removes AppLnk \a f to the set. The caller becomes responsible for 1193 Removes AppLnk \a f to the set. The caller becomes responsible for
1192 deleting \a f. Returns TRUE if \a f was in the set; otherwise 1194 deleting \a f. Returns TRUE if \a f was in the set; otherwise