diff --git a/part.h b/part.h --- a/part.h +++ b/part.h @@ -167,6 +167,7 @@ Q_SCRIPTABLE Q_NOREPLY void enableStartWithPrint(); Q_SCRIPTABLE Q_NOREPLY void enableExitAfterPrint(); Q_SCRIPTABLE Q_NOREPLY void enableStartWithFind(const QString &text); + Q_SCRIPTABLE void slotOpenContainingFolder(); Q_SIGNALS: void enablePrintAction(bool enable); @@ -374,6 +375,7 @@ QAction *m_share; #endif QAction *m_showPresentation; + QAction *m_openContainingFolder; KToggleAction* m_showMenuBarAction; KToggleAction* m_showLeftPanel; KToggleAction* m_showBottomBar; diff --git a/part.cpp b/part.cpp --- a/part.cpp +++ b/part.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -737,6 +738,7 @@ m_save = nullptr; m_saveAs = nullptr; + m_openContainingFolder = nullptr; QAction * prefs = KStandardAction::preferences( this, SLOT(slotPreferences()), ac); if ( m_embedMode == NativeShellMode ) @@ -913,6 +915,12 @@ ac->setDefaultShortcut(m_showPresentation, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P)); m_showPresentation->setEnabled( false ); + m_openContainingFolder = ac->addAction(QStringLiteral("open_containing_folder")); + m_openContainingFolder->setText(i18n("Open Con&taining Folder")); + m_openContainingFolder->setIcon( QIcon::fromTheme( QStringLiteral("document-open-folder") ) ); + connect(m_openContainingFolder, &QAction::triggered, this, &Part::slotOpenContainingFolder); + m_openContainingFolder->setEnabled( false ); + QAction * importPS = ac->addAction(QStringLiteral("import_ps")); importPS->setText(i18n("&Import PostScript as PDF...")); importPS->setIcon(QIcon::fromTheme(QStringLiteral("document-import"))); @@ -1571,6 +1579,7 @@ emit enablePrintAction( ok && m_document->printingSupport() != Okular::Document::NoPrinting ); m_printPreview->setEnabled( ok && m_document->printingSupport() != Okular::Document::NoPrinting ); m_showProperties->setEnabled( ok ); + if( m_openContainingFolder ) m_openContainingFolder->setEnabled( ok ); bool hasEmbeddedFiles = ok && m_document->embeddedFiles() && m_document->embeddedFiles()->count() > 0; if ( m_showEmbeddedFiles ) m_showEmbeddedFiles->setEnabled( hasEmbeddedFiles ); m_topMessage->setVisible( hasEmbeddedFiles && Okular::Settings::showOSD() ); @@ -3698,6 +3707,11 @@ m_textToFindOnOpen = QString(text); } +void Part::slotOpenContainingFolder() +{ + KIO::highlightInFileManager( { QUrl(localFilePath()) } ); +} + } // namespace Okular #include "part.moc" diff --git a/part.rc b/part.rc --- a/part.rc +++ b/part.rc @@ -1,5 +1,5 @@ - + &File @@ -9,6 +9,7 @@ +