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 | |
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 | ||||
-rw-r--r-- | library/mimetype.cpp | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp index 5f7da8e..e9d519e 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp | |||
@@ -1271,17 +1271,17 @@ DocLnkSet::DocLnkSet() | |||
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 | ||
diff --git a/library/mimetype.cpp b/library/mimetype.cpp index 23de70b..ec45794 100644 --- a/library/mimetype.cpp +++ b/library/mimetype.cpp | |||
@@ -106,16 +106,17 @@ public: | |||
106 | ~Private() {} | 106 | ~Private() {} |
107 | 107 | ||
108 | // ... | 108 | // ... |
109 | }; | 109 | }; |
110 | 110 | ||
111 | MimeType::Private* MimeType::d=0; | 111 | MimeType::Private* MimeType::d=0; |
112 | static QMap<QString,QString> *typeFor = 0; | 112 | static QMap<QString,QString> *typeFor = 0; |
113 | static QMap<QString,QStringList> *extFor = 0; | 113 | static QMap<QString,QStringList> *extFor = 0; |
114 | static bool appsUpdated = FALSE; | ||
114 | 115 | ||
115 | MimeType::Private& MimeType::data() | 116 | MimeType::Private& MimeType::data() |
116 | { | 117 | { |
117 | if ( !d ) { | 118 | if ( !d ) { |
118 | d = new Private; | 119 | d = new Private; |
119 | d->setAutoDelete(TRUE); | 120 | d->setAutoDelete(TRUE); |
120 | static bool setCleanup = FALSE; | 121 | static bool setCleanup = FALSE; |
121 | if ( !setCleanup ) { | 122 | if ( !setCleanup ) { |
@@ -266,16 +267,19 @@ void MimeType::registerApp( const AppLnk& lnk ) | |||
266 | 267 | ||
267 | /*! | 268 | /*! |
268 | \internal | 269 | \internal |
269 | */ | 270 | */ |
270 | void MimeType::clear() | 271 | void MimeType::clear() |
271 | { | 272 | { |
272 | delete d; | 273 | delete d; |
273 | d = 0; | 274 | d = 0; |
275 | delete typeFor; typeFor = 0; | ||
276 | delete extFor ; extFor = 0; | ||
277 | appsUpdated = FALSE; | ||
274 | } | 278 | } |
275 | 279 | ||
276 | void MimeType::loadExtensions() | 280 | void MimeType::loadExtensions() |
277 | { | 281 | { |
278 | if ( !typeFor ) { | 282 | if ( !typeFor ) { |
279 | extFor = new QMap<QString,QStringList>; | 283 | extFor = new QMap<QString,QStringList>; |
280 | typeFor = new QMap<QString,QString>; | 284 | typeFor = new QMap<QString,QString>; |
281 | loadExtensions("/etc/mime.types"); | 285 | loadExtensions("/etc/mime.types"); |
@@ -317,19 +321,18 @@ void MimeType::init( const QString& ext_or_id ) | |||
317 | } else { | 321 | } else { |
318 | loadExtensions(); | 322 | loadExtensions(); |
319 | int dot = ext_or_id.findRev('.'); | 323 | int dot = ext_or_id.findRev('.'); |
320 | QString ext = dot >= 0 ? ext_or_id.mid(dot+1) : ext_or_id; | 324 | QString ext = dot >= 0 ? ext_or_id.mid(dot+1) : ext_or_id; |
321 | i = (*typeFor)[ext.lower()]; | 325 | i = (*typeFor)[ext.lower()]; |
322 | if ( i.isNull() ) | 326 | if ( i.isNull() ) |
323 | i = "application/octet-stream"; | 327 | i = "application/octet-stream"; |
324 | } | 328 | } |
325 | static bool appsUpdated = FALSE; | 329 | |
326 | if ( !appsUpdated ) { | 330 | if ( !appsUpdated ) { |
327 | appsUpdated = TRUE; | ||
328 | updateApplications(); | 331 | updateApplications(); |
329 | } | 332 | } |
330 | } | 333 | } |
331 | 334 | ||
332 | MimeTypeData* MimeType::data(const QString& id) | 335 | MimeTypeData* MimeType::data(const QString& id) |
333 | { | 336 | { |
334 | MimeTypeData* d = data()[id]; | 337 | MimeTypeData* d = data()[id]; |
335 | if ( !d ) { | 338 | if ( !d ) { |
@@ -348,17 +351,18 @@ QString MimeType::appsFolderName() | |||
348 | return QPEApplication::qpeDir() + "apps"; | 351 | return QPEApplication::qpeDir() + "apps"; |
349 | } | 352 | } |
350 | 353 | ||
351 | /*! | 354 | /*! |
352 | Reloads application definitions. | 355 | Reloads application definitions. |
353 | */ | 356 | */ |
354 | void MimeType::updateApplications() | 357 | void MimeType::updateApplications() |
355 | { | 358 | { |
356 | clear(); | 359 | // clear(); |
360 | appsUpdated = true; | ||
357 | AppLnkSet apps( appsFolderName() ); | 361 | AppLnkSet apps( appsFolderName() ); |
358 | updateApplications(&apps); | 362 | updateApplications(&apps); |
359 | } | 363 | } |
360 | 364 | ||
361 | void MimeType::updateApplications(AppLnkSet* folder) | 365 | void MimeType::updateApplications(AppLnkSet* folder) |
362 | { | 366 | { |
363 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { | 367 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { |
364 | registerApp(*it.current()); | 368 | registerApp(*it.current()); |