]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Add a 'Properties' entry in the Places panel context menu
authorThomas Surrel <thomas.surrel@hd-wireless.se>
Wed, 3 Oct 2018 20:20:37 +0000 (22:20 +0200)
committerThomas Surrel <thomas.surrel@protonmail.com>
Sun, 14 Oct 2018 10:23:25 +0000 (12:23 +0200)
Summary: BUG: 181880

Test Plan:
Right-click on a place or on a device in the Places panel now show a Properties entry.
Clicking on it will open its folder property.

Reviewers: #dolphin, #plasma, #vdg, ngraham, elvisangelaccio

Reviewed By: #dolphin, #vdg, ngraham, elvisangelaccio

Subscribers: anthonyfieroni, elvisangelaccio, cfeck, ngraham, abetts, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D15929

src/panels/places/placespanel.cpp

index 8a8fa8a7da5bbf3463b2e43add1b215bfdf1a854..7b4900f7c3a1795c424c0f3dc9abd0a72de8361b 100644 (file)
@@ -45,6 +45,7 @@
 #include <KIconLoader>
 #include <KLocalizedString>
 #include <KMountPoint>
+#include <KPropertiesDialog>
 
 #include <QGraphicsSceneDragDropEvent>
 #include <QIcon>
@@ -214,6 +215,10 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
 
     QAction* openInNewWindowAction = menu.addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@item:inmenu", "Open in New Window"));
     QAction* openInNewTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@item:inmenu", "Open in New Tab"));
+    QAction* propertiesAction = nullptr;
+    if (item->url().isLocalFile()) {
+        propertiesAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-properties")), i18nc("@action:inmenu", "Properties"));
+    }
     if (!isDevice && !isTrash) {
         menu.addSeparator();
     }
@@ -265,6 +270,10 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
                 m_model->requestTearDown(index);
             } else if (action == ejectAction) {
                 m_model->requestEject(index);
+            } else if (action == propertiesAction) {
+                KPropertiesDialog* dialog = new KPropertiesDialog(item->url(), this);
+                dialog->setAttribute(Qt::WA_DeleteOnClose);
+                dialog->show();
             }
         }
     }