Commit b441bb3a authored by Boudewijn Rempt's avatar Boudewijn Rempt

Fix finding the filter plugin for a certain mimetype

The default weight is 0, so start looking from -1
parent 6e147983
......@@ -262,14 +262,14 @@ QStringList KisImportExportManager::mimeFilter(Direction direction)
KisImportExportFilter *KisImportExportManager::filterForMimeType(const QString &mimetype, KisImportExportManager::Direction direction)
{
int weight = 0;
int weight = -1;
KisImportExportFilter *filter = 0;
KoJsonTrader trader;
QList<QPluginLoader *>list = trader.query("Krita/FileFilter", "");
Q_FOREACH(QPluginLoader *loader, list) {
QJsonObject json = loader->metaData().value("MetaData").toObject();
if (json.value("X-KDE-Export").toString().split(",").contains(mimetype)) {
QString directionKey = direction == Export ? "X-KDE-Export" : "X-KDE-Import";
if (json.value(directionKey).toString().split(",").contains(mimetype)) {
KLibFactory *factory = qobject_cast<KLibFactory *>(loader->instance());
if (!factory) {
......@@ -291,11 +291,14 @@ KisImportExportFilter *KisImportExportManager::filterForMimeType(const QString &
int w = json.value("X-KDE-Weight").toInt();
if (w > weight) {
delete filter;
filter = f;
f->setObjectName(loader->fileName());
weight = w;
}
}
}
qDeleteAll(list);
return filter;
}
......
......@@ -112,7 +112,7 @@ DlgAnimaterionRenderer::DlgAnimaterionRenderer(KisImageWSP image, QWidget *paren
m_page->cmbRenderType->addItem(KisMimeDatabase::descriptionForMimeType(mimetype));
}
}
qDeleteAll(list);
connect(m_page->cmbRenderType, SIGNAL(activated(int)), this, SLOT(selectRenderType(int)));
selectRenderType(m_page->cmbRenderType->currentIndex());
connect(m_page->grpRender, SIGNAL(toggled(bool)), this, SLOT(toggleSequenceType(bool)));
......@@ -224,11 +224,9 @@ void DlgAnimaterionRenderer::toggleSequenceType(bool toggle)
void DlgAnimaterionRenderer::sequenceMimeTypeSelected(int index)
{
qDebug() << ">>>>" << m_page->cmbMimetype->currentText() << m_page->cmbMimetype->currentIndex() << index;
if (m_frameExportConfigurationWidget) {
m_sequenceConfigLayout->removeWidget(m_frameExportConfigurationWidget);
delete m_frameExportConfigurationWidget;
m_frameExportConfigurationWidget->hide();
m_frameExportConfigurationWidget = 0;
}
QString mimetype = m_page->cmbMimetype->itemData(index).toString();
......@@ -242,6 +240,9 @@ void DlgAnimaterionRenderer::sequenceMimeTypeSelected(int index)
m_frameExportConfigurationWidget->show();
resize(sizeHint());
}
else {
m_frameExportConfigurationWidget = 0;
}
delete filter;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment