summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -1273,13 +1273,13 @@ DocLnkSet::DocLnkSet()
*/
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) );
diff --git a/library/mimetype.cpp b/library/mimetype.cpp
index 23de70b..ec45794 100644
--- a/library/mimetype.cpp
+++ b/library/mimetype.cpp
@@ -108,12 +108,13 @@ public:
// ...
};
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);
@@ -268,12 +269,15 @@ void MimeType::registerApp( const AppLnk& lnk )
\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>;
@@ -319,15 +323,14 @@ void MimeType::init( const QString& ext_or_id )
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)
{
@@ -350,13 +353,14 @@ QString MimeType::appsFolderName()
/*!
Reloads application definitions.
*/
void MimeType::updateApplications()
{
- clear();
+// clear();
+ appsUpdated = true;
AppLnkSet apps( appsFolderName() );
updateApplications(&apps);
}
void MimeType::updateApplications(AppLnkSet* folder)
{