Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 01001d2c authored by Pino Toscano's avatar Pino Toscano

Add a D-Bus function 'documentMetaData(QString)' to get a metadata of the open...

Add a D-Bus function 'documentMetaData(QString)' to get a metadata of the open document, if available.

svn path=/trunk/KDE/kdegraphics/okular/; revision=975670
parent ae2fecbb
......@@ -835,6 +835,24 @@ QString Part::currentDocument()
}
QString Part::documentMetaData( const QString &metaData ) const
{
const Okular::DocumentInfo * info = m_document->documentInfo();
if ( info )
{
QDomElement docElement = info->documentElement();
for ( QDomNode node = docElement.firstChild(); !node.isNull(); node = node.nextSibling() )
{
const QDomElement element = node.toElement();
if ( metaData.compare( element.tagName(), Qt::CaseInsensitive ) == 0 )
return element.attribute( "value" );
}
}
return QString();
}
bool Part::slotImportPSFile()
{
QString app = KStandardDirs::findExe( "ps2pdf" );
......
......@@ -111,6 +111,7 @@ class Part : public KParts::ReadOnlyPart, public Okular::DocumentObserver, publi
Q_SCRIPTABLE uint pages();
Q_SCRIPTABLE uint currentPage();
Q_SCRIPTABLE QString currentDocument();
Q_SCRIPTABLE QString documentMetaData( const QString &metaData ) const;
Q_SCRIPTABLE void slotPreferences();
Q_SCRIPTABLE void slotFind();
Q_SCRIPTABLE void slotPrintPreview();
......
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