<table><tr><td style="">pino added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D17887">View Revision</a></tr></table><br /><div><div><p>Another option could be to resolve the mimetypes when loading the metadata of the plugins, in <tt style="background: #ebebeb; font-size: 13px;">DriverManagerInternal::lookupDriversInternal()</tt>.</p>

<p>An untested patch can be:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="diff" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><span style="color: #000080">diff --git a/src/KDbDriverManager.cpp b/src/KDbDriverManager.cpp</span>
<span style="color: #000080">index 0d35729c..1de8e9fe 100644</span>
<span style="color: #a00000">--- a/src/KDbDriverManager.cpp</span>
<span style="color: #00a000">+++ b/src/KDbDriverManager.cpp</span>
<span style="color: #800080">@@ -30,6 +30,9 @@</span>
 #include <KPluginFactory>
 
 #include <QApplication>
<span style="color: #00a000">+#include <QMimeDatabase></span>
<span style="color: #00a000">+#include <QMimeType></span>
<span style="color: #00a000">+#include <QSet></span>
 #include <QTime>
 #include <QWidget>
 
<span style="color: #800080">@@ -102,6 +105,7 @@ void DriverManagerInternal::lookupDriversInternal()</span>
             = KDbJsonTrader::self()->query(QLatin1String("KDb/Driver"));
     const QString expectedVersion = QString::fromLatin1("%1.%2")
             .arg(KDB_STABLE_VERSION_MAJOR).arg(KDB_STABLE_VERSION_MINOR);
<span style="color: #00a000">+    QMimeDatabase mimedb;</span>
     foreach(const QPluginLoader *loader, offers) {
         //QJsonObject json = loader->metaData();
         //drivermanagerDebug() << json;
<span style="color: #800080">@@ -123,7 +127,18 @@ void DriverManagerInternal::lookupDriversInternal()</span>
             }
             continue;
         }
<span style="color: #00a000">+        QSet<QString> resolvedMimeTypes;</span>
         foreach (const QString& mimeType, metaData->mimeTypes()) {
<span style="color: #00a000">+            const QMimeType mime = mimedb.mimeTypeForName(mimeType);</span>
<span style="color: #00a000">+            if (!mime.isValid()) {</span>
<span style="color: #00a000">+                kdbWarning() << "Driver with ID" << metaData->id()</span>
<span style="color: #00a000">+                             << "supports the unknown mimetype"</span>
<span style="color: #00a000">+                             << mimeType << "-- skipping it";</span>
<span style="color: #00a000">+                continue;</span>
<span style="color: #00a000">+            }</span>
<span style="color: #00a000">+            resolvedMimeTypes.insert(mime.name());</span>
<span style="color: #00a000">+        }</span>
<span style="color: #00a000">+        foreach (const QString& mimeType, resolvedMimeTypes) {</span>
             m_metadata_by_mimetype.insertMulti(mimeType, metaData.data());
         }
         m_driversMetaData.insert(metaData->id(), metaData.data());</pre></div>

<p>The QSet is used to avoid that the same metadats is registered twice in <tt style="background: #ebebeb; font-size: 13px;">m_metadata_by_mimetype</tt> for the same mimetype, in case a plugin specifies two entries (mime name and one alias of it).</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R15 KDb</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D17887">https://phabricator.kde.org/D17887</a></div></div><br /><div><strong>To: </strong>staniek, piggz<br /><strong>Cc: </strong>pino, Kexi-Devel-list, barman, wicik, staniek<br /></div>