Commit 0a86c4de authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Image Wallpaper] Add "Open Containing Folder" button

This allows to open the location of the folder the wallpaper is in.

BUG: 371247
FIXED-IN: 5.11.0

Differential Revision: https://phabricator.kde.org/D6450
parent bdaaaedb
......@@ -44,6 +44,8 @@
#include <KPackage/PackageStructure>
#include <KPackage/PackageLoader>
#include <KIO/OpenFileManagerWindowJob>
#include "image.h"
QStringList BackgroundFinder::m_suffixes;
......@@ -470,6 +472,11 @@ KPackage::Package BackgroundListModel::package(int index) const
return m_packages.at(index);
}
void BackgroundListModel::openContainingFolder(int rowIndex)
{
KIO::highlightInFileManager({index(rowIndex, 0).data(PathRole).toUrl()});
}
void BackgroundListModel::setPendingDeletion(int rowIndex, bool pendingDeletion)
{
setData(index(rowIndex, 0), pendingDeletion, PendingDeletionRole);
......
......@@ -90,6 +90,7 @@ public:
int count() const {return m_packages.size();};
Q_INVOKABLE void openContainingFolder(int rowIndex);
Q_INVOKABLE void setPendingDeletion(int rowIndex, bool pendingDeletion);
const QStringList wallpapersAwaitingDeletion();
......
......@@ -107,6 +107,25 @@ MouseArea {
}
}
PlasmaComponents.ToolButton {
anchors {
top: parent.top
left: parent.left
margins: units.smallSpacing
}
iconSource: "document-open-folder"
tooltip: i18nd("plasma_applet_org.kde.image", "Open Containing Folder")
flat: false
onClicked: imageWallpaper.wallpaperModel.openContainingFolder(index)
opacity: wallpaperDelegate.containsMouse ? 1 : 0
Behavior on opacity {
PropertyAnimation {
duration: units.longDuration
easing.type: Easing.OutQuad
}
}
}
PlasmaComponents.ToolButton {
anchors {
top: parent.top
......
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