author | zecke <zecke> | 2004-06-20 19:03:56 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-06-20 19:03:56 (UTC) |
commit | 44d69b04b5257592639d2a494c448202c86978c2 (patch) (unidiff) | |
tree | 9d776e08f6efa53abc6e2658c94b9e0e18324692 /library/applnk.cpp | |
parent | 2055cb9e96b27f95720240a2035ade27cb7bc098 (diff) | |
download | opie-44d69b04b5257592639d2a494c448202c86978c2.zip opie-44d69b04b5257592639d2a494c448202c86978c2.tar.gz opie-44d69b04b5257592639d2a494c448202c86978c2.tar.bz2 |
Use A higher prime number in AppLnk
Somehow the Launcher triggers issues with libqpe and MimeType.
Due the mix of calling MimeType::clear, MimeType type(doclnk.linkFile()),
MimeType::clear
the registration of Application was cleared and not reentered due the
inner static variable in MimeType::init which was set.
Now make sure that if we clear that we will reenter the Application in all cases!
-rw-r--r-- | library/applnk.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp index 5f7da8e..e9d519e 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp | |||
@@ -1183,193 +1183,193 @@ QString AppLnkSet::typeName( const QString& t ) const | |||
1183 | return st ? *st : QString::null; | 1183 | return st ? *st : QString::null; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | /*! | 1186 | /*! |
1187 | Returns the small pixmap associated with type \a t. | 1187 | Returns the small pixmap associated with type \a t. |
1188 | 1188 | ||
1189 | For applications, games and settings the type is \c Application; | 1189 | For applications, games and settings the type is \c Application; |
1190 | for documents the type is the document's MIME type. | 1190 | for documents the type is the document's MIME type. |
1191 | */ | 1191 | */ |
1192 | QPixmap AppLnkSet::typePixmap( const QString& t ) const | 1192 | QPixmap AppLnkSet::typePixmap( const QString& t ) const |
1193 | { | 1193 | { |
1194 | QPixmap *pm = d->typPix.find(t); | 1194 | QPixmap *pm = d->typPix.find(t); |
1195 | return pm ? *pm : QPixmap(); | 1195 | return pm ? *pm : QPixmap(); |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | /*! | 1198 | /*! |
1199 | Returns the large pixmap associated with type \a t. | 1199 | Returns the large pixmap associated with type \a t. |
1200 | 1200 | ||
1201 | For applications, games and settings the type is \c Application; | 1201 | For applications, games and settings the type is \c Application; |
1202 | for documents the type is the document's MIME type. | 1202 | for documents the type is the document's MIME type. |
1203 | */ | 1203 | */ |
1204 | QPixmap AppLnkSet::typeBigPixmap( const QString& t ) const | 1204 | QPixmap AppLnkSet::typeBigPixmap( const QString& t ) const |
1205 | { | 1205 | { |
1206 | QPixmap *pm = d->typPixBig.find(t); | 1206 | QPixmap *pm = d->typPixBig.find(t); |
1207 | return pm ? *pm : QPixmap(); | 1207 | return pm ? *pm : QPixmap(); |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | /*! | 1210 | /*! |
1211 | Returns the AppLnk with the given \a id. | 1211 | Returns the AppLnk with the given \a id. |
1212 | */ | 1212 | */ |
1213 | const AppLnk *AppLnkSet::find( int id ) const | 1213 | const AppLnk *AppLnkSet::find( int id ) const |
1214 | { | 1214 | { |
1215 | QListIterator<AppLnk> it( children() ); | 1215 | QListIterator<AppLnk> it( children() ); |
1216 | 1216 | ||
1217 | for ( ; it.current(); ++it ) { | 1217 | for ( ; it.current(); ++it ) { |
1218 | const AppLnk *app = it.current(); | 1218 | const AppLnk *app = it.current(); |
1219 | if ( app->id() == id ) | 1219 | if ( app->id() == id ) |
1220 | return app; | 1220 | return app; |
1221 | } | 1221 | } |
1222 | 1222 | ||
1223 | return 0; | 1223 | return 0; |
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | /*! | 1226 | /*! |
1227 | Returns the AppLnk with the given \a exec attribute. | 1227 | Returns the AppLnk with the given \a exec attribute. |
1228 | */ | 1228 | */ |
1229 | const AppLnk *AppLnkSet::findExec( const QString& exec ) const | 1229 | const AppLnk *AppLnkSet::findExec( const QString& exec ) const |
1230 | { | 1230 | { |
1231 | QListIterator<AppLnk> it( children() ); | 1231 | QListIterator<AppLnk> it( children() ); |
1232 | 1232 | ||
1233 | for ( ; it.current(); ++it ) { | 1233 | for ( ; it.current(); ++it ) { |
1234 | const AppLnk *app = it.current(); | 1234 | const AppLnk *app = it.current(); |
1235 | if ( app->exec() == exec ) | 1235 | if ( app->exec() == exec ) |
1236 | return app; | 1236 | return app; |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | return 0; | 1239 | return 0; |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | /*! | 1242 | /*! |
1243 | \class DocLnkSet applnk.h | 1243 | \class DocLnkSet applnk.h |
1244 | \brief The DocLnkSet class is a set of DocLnk objects. | 1244 | \brief The DocLnkSet class is a set of DocLnk objects. |
1245 | */ | 1245 | */ |
1246 | 1246 | ||
1247 | /*! | 1247 | /*! |
1248 | \fn const QList<DocLnk>& DocLnkSet::children() const | 1248 | \fn const QList<DocLnk>& DocLnkSet::children() const |
1249 | 1249 | ||
1250 | Returns the members of the set. | 1250 | Returns the members of the set. |
1251 | */ | 1251 | */ |
1252 | 1252 | ||
1253 | /*! | 1253 | /*! |
1254 | Constructs an empty DocLnkSet. | 1254 | Constructs an empty DocLnkSet. |
1255 | 1255 | ||
1256 | \sa appendFrom() | 1256 | \sa appendFrom() |
1257 | */ | 1257 | */ |
1258 | DocLnkSet::DocLnkSet() | 1258 | DocLnkSet::DocLnkSet() |
1259 | { | 1259 | { |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | /*! | 1262 | /*! |
1263 | Constructs a DocLnkSet that contains DocLnk objects representing all | 1263 | Constructs a DocLnkSet that contains DocLnk objects representing all |
1264 | the files in the \a directory (and any subdirectories, recursively). | 1264 | the files in the \a directory (and any subdirectories, recursively). |
1265 | 1265 | ||
1266 | If \a mimefilter is not null, | 1266 | If \a mimefilter is not null, |
1267 | only documents with a MIME type matching \a mimefilter are selected. | 1267 | only documents with a MIME type matching \a mimefilter are selected. |
1268 | The value may contain multiple wild-card patterns separated by ";", | 1268 | The value may contain multiple wild-card patterns separated by ";", |
1269 | such as \c{*o/mpeg;audio/x-wav}. | 1269 | such as \c{*o/mpeg;audio/x-wav}. |
1270 | 1270 | ||
1271 | See also \link applnk.html#files-and-links Files and Links\endlink. | 1271 | See also \link applnk.html#files-and-links Files and Links\endlink. |
1272 | 1272 | ||
1273 | */ | 1273 | */ |
1274 | DocLnkSet::DocLnkSet( const QString &directory, const QString& mimefilter ) : | 1274 | DocLnkSet::DocLnkSet( const QString &directory, const QString& mimefilter ) : |
1275 | AppLnkSet() | 1275 | AppLnkSet() |
1276 | { | 1276 | { |
1277 | QDir dir( directory ); | 1277 | QDir dir( directory ); |
1278 | mFile = dir.dirName(); | 1278 | mFile = dir.dirName(); |
1279 | QDict<void> reference; | 1279 | QDict<void> reference(1021); |
1280 | 1280 | ||
1281 | QStringList subFilter = QStringList::split(";", mimefilter); | 1281 | QStringList subFilter = QStringList::split(";", mimefilter); |
1282 | QValueList<QRegExp> mimeFilters; | 1282 | QValueList<QRegExp> mimeFilters; |
1283 | for( QStringList::Iterator it = subFilter.begin(); it != subFilter.end(); ++ it ) | 1283 | for( QStringList::Iterator it = subFilter.begin(); it != subFilter.end(); ++ it ) |
1284 | mimeFilters.append( QRegExp(*it, FALSE, TRUE) ); | 1284 | mimeFilters.append( QRegExp(*it, FALSE, TRUE) ); |
1285 | 1285 | ||
1286 | findChildren(directory, mimeFilters, reference); | 1286 | findChildren(directory, mimeFilters, reference); |
1287 | 1287 | ||
1288 | const QList<DocLnk> &list = children(); | 1288 | const QList<DocLnk> &list = children(); |
1289 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) { | 1289 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) { |
1290 | reference.remove( (*it)->file() ); | 1290 | reference.remove( (*it)->file() ); |
1291 | } | 1291 | } |
1292 | for ( QDictIterator<void> dit(reference); dit.current(); ++dit ) { | 1292 | for ( QDictIterator<void> dit(reference); dit.current(); ++dit ) { |
1293 | if ( dit.current() == (void*)2 ) { | 1293 | if ( dit.current() == (void*)2 ) { |
1294 | // Unreferenced, make an unwritten link | 1294 | // Unreferenced, make an unwritten link |
1295 | DocLnk* dl = new DocLnk; | 1295 | DocLnk* dl = new DocLnk; |
1296 | QFileInfo fi( dit.currentKey() ); | 1296 | QFileInfo fi( dit.currentKey() ); |
1297 | dl->setFile(fi.filePath()); | 1297 | dl->setFile(fi.filePath()); |
1298 | dl->setName(fi.baseName()); | 1298 | dl->setName(fi.baseName()); |
1299 | // #### default to current path? | 1299 | // #### default to current path? |
1300 | // dl->setCategories( ... ); | 1300 | // dl->setCategories( ... ); |
1301 | bool match = mimefilter.isNull(); | 1301 | bool match = mimefilter.isNull(); |
1302 | if ( !match ) | 1302 | if ( !match ) |
1303 | for( QValueList<QRegExp>::Iterator it = mimeFilters.begin(); it != mimeFilters.end() && !match; ++ it ) | 1303 | for( QValueList<QRegExp>::Iterator it = mimeFilters.begin(); it != mimeFilters.end() && !match; ++ it ) |
1304 | if ( (*it).match(dl->type()) >= 0 ) | 1304 | if ( (*it).match(dl->type()) >= 0 ) |
1305 | match = TRUE; | 1305 | match = TRUE; |
1306 | if ( match /* && dl->type() != "application/octet-stream" */ | 1306 | if ( match /* && dl->type() != "application/octet-stream" */ |
1307 | && !!dl->exec() ) | 1307 | && !!dl->exec() ) |
1308 | add(dl); | 1308 | add(dl); |
1309 | else | 1309 | else |
1310 | delete dl; | 1310 | delete dl; |
1311 | } | 1311 | } |
1312 | } | 1312 | } |
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | // other becomes empty | 1315 | // other becomes empty |
1316 | /*! | 1316 | /*! |
1317 | Transfers all DocLnk objects from \a other to this set. \a other becomes | 1317 | Transfers all DocLnk objects from \a other to this set. \a other becomes |
1318 | empty. | 1318 | empty. |
1319 | */ | 1319 | */ |
1320 | void DocLnkSet::appendFrom( DocLnkSet& other ) | 1320 | void DocLnkSet::appendFrom( DocLnkSet& other ) |
1321 | { | 1321 | { |
1322 | if ( &other == this ) | 1322 | if ( &other == this ) |
1323 | return; | 1323 | return; |
1324 | QListIterator<AppLnk> it( other.mApps ); | 1324 | QListIterator<AppLnk> it( other.mApps ); |
1325 | for ( ; it.current(); ) { | 1325 | for ( ; it.current(); ) { |
1326 | mApps.append(*it); | 1326 | mApps.append(*it); |
1327 | ++it; | 1327 | ++it; |
1328 | } | 1328 | } |
1329 | other.mApps.clear(); | 1329 | other.mApps.clear(); |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | void DocLnkSet::findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth) | 1332 | void DocLnkSet::findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth) |
1333 | { | 1333 | { |
1334 | depth++; | 1334 | depth++; |
1335 | if ( depth > 10 ) | 1335 | if ( depth > 10 ) |
1336 | return; | 1336 | return; |
1337 | 1337 | ||
1338 | QDir dir( dr ); | 1338 | QDir dir( dr ); |
1339 | 1339 | ||
1340 | /* Opie got a different approach | 1340 | /* Opie got a different approach |
1341 | * I guess it's geek vs. consumer | 1341 | * I guess it's geek vs. consumer |
1342 | * in this case to be discussed | 1342 | * in this case to be discussed |
1343 | */ | 1343 | */ |
1344 | if ( dir.exists( ".Qtopia-ignore" ) ) | 1344 | if ( dir.exists( ".Qtopia-ignore" ) ) |
1345 | return; | 1345 | return; |
1346 | 1346 | ||
1347 | const QFileInfoList *list = dir.entryInfoList(); | 1347 | const QFileInfoList *list = dir.entryInfoList(); |
1348 | if ( list ) { | 1348 | if ( list ) { |
1349 | QFileInfo* fi; | 1349 | QFileInfo* fi; |
1350 | for ( QFileInfoListIterator it(*list); (fi=*it); ++it ) { | 1350 | for ( QFileInfoListIterator it(*list); (fi=*it); ++it ) { |
1351 | QString bn = fi->fileName(); | 1351 | QString bn = fi->fileName(); |
1352 | if ( bn[0] != '.' ) { | 1352 | if ( bn[0] != '.' ) { |
1353 | if ( fi->isDir() ) { | 1353 | if ( fi->isDir() ) { |
1354 | if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) | 1354 | if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) |
1355 | findChildren(fi->filePath(), mimeFilters, reference, depth); | 1355 | findChildren(fi->filePath(), mimeFilters, reference, depth); |
1356 | } else { | 1356 | } else { |
1357 | if ( fi->extension(FALSE) == "desktop" ) { | 1357 | if ( fi->extension(FALSE) == "desktop" ) { |
1358 | DocLnk* dl = new DocLnk( fi->filePath() ); | 1358 | DocLnk* dl = new DocLnk( fi->filePath() ); |
1359 | QFileInfo fi2(dl->file()); | 1359 | QFileInfo fi2(dl->file()); |
1360 | bool match = FALSE; | 1360 | bool match = FALSE; |
1361 | if ( !fi2.exists() ) { | 1361 | if ( !fi2.exists() ) { |
1362 | dir.remove( dl->file() ); | 1362 | dir.remove( dl->file() ); |
1363 | } | 1363 | } |
1364 | if ( mimeFilters.count() == 0 ) { | 1364 | if ( mimeFilters.count() == 0 ) { |
1365 | add( dl ); | 1365 | add( dl ); |
1366 | match = TRUE; | 1366 | match = TRUE; |
1367 | } else { | 1367 | } else { |
1368 | for( QValueList<QRegExp>::ConstIterator it = mimeFilters.begin(); it != mimeFilters.end(); ++ it ) { | 1368 | for( QValueList<QRegExp>::ConstIterator it = mimeFilters.begin(); it != mimeFilters.end(); ++ it ) { |
1369 | if ( (*it).match(dl->type()) >= 0 ) { | 1369 | if ( (*it).match(dl->type()) >= 0 ) { |
1370 | add(dl); | 1370 | add(dl); |
1371 | match = TRUE; | 1371 | match = TRUE; |
1372 | } | 1372 | } |
1373 | } | 1373 | } |
1374 | } | 1374 | } |
1375 | if ( !match ) | 1375 | if ( !match ) |