-rw-r--r-- | library/mimetype.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/library/mimetype.cpp b/library/mimetype.cpp index c6a4453..9fab160 100644 --- a/library/mimetype.cpp +++ b/library/mimetype.cpp @@ -20,2 +20,3 @@ +#define QTOPIA_INTERNAL_MIMEEXT #include "mimetype.h" @@ -48,2 +49,3 @@ public: QString id; + QString extension; QString desc; @@ -61,2 +63,3 @@ MimeType::Dict* MimeType::d=0; static QMap<QString,QString> *typeFor = 0; +static QMap<QString,QString> *extFor = 0; @@ -98,2 +101,8 @@ QPixmap MimeType::pixmap() const +QString MimeType::extension() const +{ + loadExtensions(); + return *(*extFor).find(i); +} + QPixmap MimeType::bigPixmap() const @@ -130,2 +139,3 @@ void MimeType::loadExtensions() if ( !typeFor ) { + extFor = new QMap<QString,QString>; typeFor = new QMap<QString,QString>; @@ -147,5 +157,8 @@ void MimeType::loadExtensions(const QString& filename) QString id = *it; ++it; - while (it != tokens.end()) { - (*typeFor)[*it] = id; - ++it; + if ( it != tokens.end() ) { + (*extFor)[id] = *it; + while (it != tokens.end()) { + (*typeFor)[*it] = id; + ++it; + } } |