diff --git a/cuttlefish/autotests/CMakeLists.txt b/cuttlefish/autotests/CMakeLists.txt --- a/cuttlefish/autotests/CMakeLists.txt +++ b/cuttlefish/autotests/CMakeLists.txt @@ -12,6 +12,7 @@ Qt5::Test KF5::ConfigCore KF5::IconThemes + KF5::KIOWidgets KF5::Package KF5::Service KF5::Plasma diff --git a/cuttlefish/package/contents/ui/Actions.qml b/cuttlefish/package/contents/ui/Actions.qml --- a/cuttlefish/package/contents/ui/Actions.qml +++ b/cuttlefish/package/contents/ui/Actions.qml @@ -32,6 +32,11 @@ iconName: "document-open" onTriggered: Qt.openUrlExternally(preview.fullPath) }, + Kirigami.Action { + iconName: "document-open-folder" + text: i18n("Open containing folder") + onTriggered: iconModel.openContainingFolder(preview.fullPath) + }, Kirigami.Action { text: pickerMode ? i18n("Insert icon name") : i18n("Copy icon name to clipboard") iconName: "edit-copy" diff --git a/cuttlefish/src/iconmodel.h b/cuttlefish/src/iconmodel.h --- a/cuttlefish/src/iconmodel.h +++ b/cuttlefish/src/iconmodel.h @@ -61,6 +61,7 @@ explicit IconModel(QObject *parent = nullptr); Q_INVOKABLE QVariantList inOtherThemes(const QString& iconName, int size); + Q_INVOKABLE void openContainingFolder(const QString &path); QHash roleNames() const override; int rowCount(const QModelIndex &parent) const override; diff --git a/cuttlefish/src/iconmodel.cpp b/cuttlefish/src/iconmodel.cpp --- a/cuttlefish/src/iconmodel.cpp +++ b/cuttlefish/src/iconmodel.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -420,3 +421,8 @@ } return list; } + +void IconModel::openContainingFolder(const QString& path) +{ + KIO::highlightInFileManager({QUrl::fromLocalFile(path)}); +}