summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <arichardson.kde@gmail.com>2015-12-08 16:22:33 (GMT)
committerAlex Richardson <arichardson.kde@gmail.com>2016-01-04 14:59:07 (GMT)
commit93b94161f27e4fd23efc2d6643cd07c716c57676 (patch)
tree1fe443cf82ddd2cafc226abf9bffaef386bf03d1
parent2f9246ae42ce6276002641ac02d9c6b880bcf7a3 (diff)
Bring back the about backend dialog
REVIEW: 126193
-rw-r--r--part.cpp51
1 files changed, 22 insertions, 29 deletions
diff --git a/part.cpp b/part.cpp
index 3fa1170..0dd663d 100644
--- a/part.cpp
+++ b/part.cpp
@@ -43,6 +43,7 @@
#include <kdirwatch.h>
#include <kstandardaction.h>
#include <kpluginfactory.h>
+#include <KPluginMetaData>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <knuminput.h>
@@ -2577,26 +2578,27 @@ void Part::enableStartWithPrint()
void Part::slotAboutBackend()
{
-#pragma message("KF5 bring back about data")
-// const KComponentData *data = m_document->componentData();
-// if ( !data )
-// return;
-
-// KAboutData aboutData( *data->aboutData() );
+ const KPluginMetaData data = m_document->generatorInfo();
+ if (!data.isValid())
+ return;
-// if ( aboutData.programIconName().isEmpty() || aboutData.programIconName() == aboutData.appName() )
-// {
-// const Okular::DocumentInfo documentInfo = m_document->documentInfo(QSet<DocumentInfo::Key>() << DocumentInfo::MimeType);
-// const QString mimeTypeName = documentInfo.get(DocumentInfo::MimeType);
-// if ( !mimeTypeName.isEmpty() )
-// {
-// if ( QMimeType type = db.mimeTypeForName( mimeTypeName ) )
-// aboutData.setProgramIconName( type->iconName() );
-// }
-// }
+ KAboutData aboutData = KAboutData::fromPluginMetaData(data);
-// KAboutApplicationDialog dlg( &aboutData, widget() );
-// dlg.exec();
+ if (data.iconName().isEmpty())
+ {
+ // fall back to mime type icon
+ const Okular::DocumentInfo documentInfo = m_document->documentInfo(QSet<DocumentInfo::Key>() << DocumentInfo::MimeType);
+ const QString mimeTypeName = documentInfo.get(DocumentInfo::MimeType);
+ if (!mimeTypeName.isEmpty())
+ {
+ QMimeDatabase db;
+ QMimeType type = db.mimeTypeForName(mimeTypeName);
+ if (type.isValid())
+ aboutData.setProgramIconName(type.iconName());
+ }
+ }
+ KAboutApplicationDialog dlg(aboutData, widget());
+ dlg.exec();
}
@@ -2972,17 +2974,8 @@ void Part::rebuildBookmarkMenu( bool unplugActions )
void Part::updateAboutBackendAction()
{
-#warning "FIXME!! Component data"
- void* data = nullptr;
- // const KComponentData *data = m_document->componentData();
- if ( data )
- {
- m_aboutBackend->setEnabled( true );
- }
- else
- {
- m_aboutBackend->setEnabled( false );
- }
+ const KPluginMetaData data = m_document->generatorInfo();
+ m_aboutBackend->setEnabled(data.isValid());
}
void Part::resetStartArguments()