Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 1db8e895 authored by Rodrigo Pelorosso's avatar Rodrigo Pelorosso Committed by Nathaniel Graham

Add option to show file in File Manager

This patch adds an option to show the selected file(s), or the file currently being viewed in the file browser. It opens the default file browser and highlights the files.


Test Plan:
  - Select a file and right click on it, opening the contextual menu. Select the "Show in File Manager" option. The default file manager should open and highlight the file.
  - While viewing a file, right click on it, opening the contextual menu. Select the "Show in File Manager" option. The default file manager should open and highlight the file.

It also shows the option under the File menu.

Reviewers: ngraham, #kde_applications, rkflx

Reviewed By: ngraham, rkflx

Subscribers: rkflx, ngraham

Differential Revision:
parent ed945a4b
......@@ -49,6 +49,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <KUrlMimeData>
#include <KFileItemActions>
#include <KFileItemListProperties>
#include <KIO/OpenFileManagerWindowJob>
// Local
#include <lib/contextmanager.h>
......@@ -187,6 +188,9 @@ FileOpsContextManagerItem::FileOpsContextManagerItem(ContextManager* manager, QL
connect(menu, &QMenu::aboutToShow, this, &FileOpsContextManagerItem::populateOpenMenu);
connect(menu, &QMenu::triggered, this, &FileOpsContextManagerItem::openWith);
mOpenContainingFolderAction = file->addAction("file_open_containing_folder", this, SLOT(openContainingFolder()));
mOpenContainingFolderAction->setText(i18n("Open Containing Folder"));
<< mRenameAction
<< mTrashAction
......@@ -197,6 +201,7 @@ FileOpsContextManagerItem::FileOpsContextManagerItem(ContextManager* manager, QL
<< mLinkToAction
<< createSeparator(this)
<< mOpenWithAction
<< mOpenContainingFolderAction
<< mShowPropertiesAction
<< createSeparator(this)
<< mCreateFolderAction
......@@ -243,6 +248,7 @@ void FileOpsContextManagerItem::updateActions()
mRenameAction->setEnabled(count == 1);
mShowPropertiesAction->setEnabled(dirUrlIsValid || urlIsValid);
......@@ -412,4 +418,9 @@ void FileOpsContextManagerItem::openWith(QAction* action)
KRun::runService(*service, list, mGroup);
void FileOpsContextManagerItem::openContainingFolder()
} // namespace
......@@ -66,6 +66,7 @@ private Q_SLOTS:
void createFolder();
void populateOpenMenu();
void openWith(QAction* action);
void openContainingFolder();
QList<QUrl> urlList() const;
......@@ -89,6 +90,7 @@ private:
QAction * mShowPropertiesAction;
QAction * mCreateFolderAction;
QAction * mOpenWithAction;
QAction * mOpenContainingFolderAction;
QList<QAction*> mRegularFileActionList;
QList<QAction*> mTrashFileActionList;
KService::List mServiceList;
......@@ -94,6 +94,7 @@ void ThumbnailViewHelper::showContextMenu(QWidget* parent)
d->addActionToMenu(popup, "file_link_to");
d->addActionToMenu(popup, "file_open_with");
d->addActionToMenu(popup, "file_open_containing_folder");
d->addActionToMenu(popup, "edit_tags");
......@@ -567,6 +567,8 @@ void ViewMainPage::showContextMenu()
addActionToMenu(&menu, d->mActionCollection, "file_link_to");
addActionToMenu(&menu, d->mActionCollection, "file_open_with");
addActionToMenu(&menu, d->mActionCollection, "file_open_containing_folder");
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