summaryrefslogtreecommitdiff
authorzecke <zecke>2004-06-20 19:03:56 (UTC)
committer zecke <zecke>2004-06-20 19:03:56 (UTC)
commit44d69b04b5257592639d2a494c448202c86978c2 (patch) (side-by-side diff)
tree9d776e08f6efa53abc6e2658c94b9e0e18324692
parent2055cb9e96b27f95720240a2035ade27cb7bc098 (diff)
downloadopie-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!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.cpp2
-rw-r--r--library/mimetype.cpp10
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
@@ -1267,25 +1267,25 @@ DocLnkSet::DocLnkSet()
only documents with a MIME type matching \a mimefilter are selected.
The value may contain multiple wild-card patterns separated by ";",
such as \c{*o/mpeg;audio/x-wav}.
See also \link applnk.html#files-and-links Files and Links\endlink.
*/
DocLnkSet::DocLnkSet( const QString &directory, const QString& mimefilter ) :
AppLnkSet()
{
QDir dir( directory );
mFile = dir.dirName();
- QDict<void> reference;
+ QDict<void> reference(1021);
QStringList subFilter = QStringList::split(";", mimefilter);
QValueList<QRegExp> mimeFilters;
for( QStringList::Iterator it = subFilter.begin(); it != subFilter.end(); ++ it )
mimeFilters.append( QRegExp(*it, FALSE, TRUE) );
findChildren(directory, mimeFilters, reference);
const QList<DocLnk> &list = children();
for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) {
reference.remove( (*it)->file() );
}
diff --git a/library/mimetype.cpp b/library/mimetype.cpp
index 23de70b..ec45794 100644
--- a/library/mimetype.cpp
+++ b/library/mimetype.cpp
@@ -102,24 +102,25 @@ private:
class MimeType::Private : public QDict<MimeTypeData> {
public:
Private() {}
~Private() {}
// ...
};
MimeType::Private* MimeType::d=0;
static QMap<QString,QString> *typeFor = 0;
static QMap<QString,QStringList> *extFor = 0;
+static bool appsUpdated = FALSE;
MimeType::Private& MimeType::data()
{
if ( !d ) {
d = new Private;
d->setAutoDelete(TRUE);
static bool setCleanup = FALSE;
if ( !setCleanup ) {
qAddPostRoutine( cleanupMime );
setCleanup = TRUE;
}
}
@@ -262,24 +263,27 @@ void MimeType::registerApp( const AppLnk& lnk )
cur->apps.append(l);
}
}
}
/*!
\internal
*/
void MimeType::clear()
{
delete d;
d = 0;
+ delete typeFor; typeFor = 0;
+ delete extFor ; extFor = 0;
+ appsUpdated = FALSE;
}
void MimeType::loadExtensions()
{
if ( !typeFor ) {
extFor = new QMap<QString,QStringList>;
typeFor = new QMap<QString,QString>;
loadExtensions("/etc/mime.types");
loadExtensions(QPEApplication::qpeDir()+"etc/mime.types");
}
}
@@ -313,27 +317,26 @@ void MimeType::loadExtensions(const QString& filename)
void MimeType::init( const QString& ext_or_id )
{
if ( ext_or_id[0] != '/' && ext_or_id.contains('/') ) {
i = ext_or_id.lower();
} else {
loadExtensions();
int dot = ext_or_id.findRev('.');
QString ext = dot >= 0 ? ext_or_id.mid(dot+1) : ext_or_id;
i = (*typeFor)[ext.lower()];
if ( i.isNull() )
i = "application/octet-stream";
}
- static bool appsUpdated = FALSE;
+
if ( !appsUpdated ) {
- appsUpdated = TRUE;
updateApplications();
}
}
MimeTypeData* MimeType::data(const QString& id)
{
MimeTypeData* d = data()[id];
if ( !d ) {
int s = id.find('/');
QString idw = id.left(s)+"/*";
d = data()[idw];
}
@@ -344,23 +347,24 @@ MimeTypeData* MimeType::data(const QString& id)
Returns a Qtopia folder containing application definitions.
*/
QString MimeType::appsFolderName()
{
return QPEApplication::qpeDir() + "apps";
}
/*!
Reloads application definitions.
*/
void MimeType::updateApplications()
{
- clear();
+// clear();
+ appsUpdated = true;
AppLnkSet apps( appsFolderName() );
updateApplications(&apps);
}
void MimeType::updateApplications(AppLnkSet* folder)
{
for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) {
registerApp(*it.current());
}
}