Commit 5ec86324 authored by Gregor Mi's avatar Gregor Mi

Add 'File Properties' to Project plugin's tree context menu

Summary:
This adds a menu item which opens the default File Properties dialog.

It can be used to change access permissions or calculate checksums for
the current file.

Screenshot:

{F6414570}

Reviewers: #kate, cullmann

Reviewed By: #kate, cullmann

Subscribers: cullmann, kwrite-devel

Tags: #kate

Differential Revision: https://phabricator.kde.org/D16823
parent d0a98dfd
......@@ -23,6 +23,7 @@
#include <klocalizedstring.h>
#include <KIO/OpenFileManagerWindowJob>
#include <KMimeTypeTrader>
#include <KPropertiesDialog>
#include <KRun>
#include <KNS3/KMoreTools>
#include <KNS3/KMoreToolsMenuFactory>
......@@ -100,6 +101,11 @@ void KateProjectTreeViewContextMenu::exec(const QString &filename, const QPoint
*/
auto openContaingFolderAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18n("&Open Containing Folder"));
/**
* File Properties Dialog
*/
auto filePropertiesAction = menu.addAction(QIcon::fromTheme(QStringLiteral("dialog-object-properties")), i18n("Properties"));
/**
* Git menu
*/
......@@ -133,6 +139,13 @@ void KateProjectTreeViewContextMenu::exec(const QString &filename, const QPoint
else if (action == openContaingFolderAction) {
KIO::highlightInFileManager({ QUrl::fromLocalFile(filename) });
}
else if (action == filePropertiesAction) {
// code copied and adapted from frameworks/kio/src/filewidgets/knewfilemenu.cpp
KFileItem fileItem(QUrl::fromLocalFile(filename));
QDialog* dlg = new KPropertiesDialog(fileItem);
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->show();
}
else {
// One of the git actions was triggered
}
......
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