Changeset View
Changeset View
Standalone View
Standalone View
addons/project/kateprojecttreeviewcontextmenu.cpp
Show All 16 Lines | |||||
17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | * Boston, MA 02110-1301, USA. | 18 | * Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "kateprojecttreeviewcontextmenu.h" | 21 | #include "kateprojecttreeviewcontextmenu.h" | ||
22 | 22 | | |||
23 | #include <klocalizedstring.h> | 23 | #include <klocalizedstring.h> | ||
24 | #include <KMimeTypeTrader> | 24 | #include <KMimeTypeTrader> | ||
25 | #include <KPropertiesDialog> | ||||
25 | #include <KRun> | 26 | #include <KRun> | ||
26 | #include <KNS3/KMoreTools> | 27 | #include <KNS3/KMoreTools> | ||
27 | #include <KNS3/KMoreToolsMenuFactory> | 28 | #include <KNS3/KMoreToolsMenuFactory> | ||
28 | 29 | | |||
29 | #include <QApplication> | 30 | #include <QApplication> | ||
30 | #include <QClipboard> | 31 | #include <QClipboard> | ||
31 | #include <QDebug> | 32 | #include <QDebug> | ||
32 | #include <QDesktopServices> | 33 | #include <QDesktopServices> | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | 69 | { | |||
96 | openWithMenu->setEnabled(!openWithMenu->isEmpty()); | 97 | openWithMenu->setEnabled(!openWithMenu->isEmpty()); | ||
97 | 98 | | |||
98 | /** | 99 | /** | ||
99 | * Open Containing folder | 100 | * Open Containing folder | ||
100 | */ | 101 | */ | ||
101 | auto openContaingFolderAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18n("&Open Containing Folder")); | 102 | auto openContaingFolderAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18n("&Open Containing Folder")); | ||
102 | 103 | | |||
103 | /** | 104 | /** | ||
105 | * File Properties Dialog | ||||
106 | */ | ||||
107 | auto filePropertiesAction = menu.addAction(QIcon::fromTheme(QStringLiteral("dialog-object-properties")), i18n("Properties")); | ||||
108 | | ||||
109 | /** | ||||
104 | * Git menu | 110 | * Git menu | ||
105 | */ | 111 | */ | ||
106 | KMoreToolsMenuFactory menuFactory(QLatin1String("kate/addons/project/git-tools")); | 112 | KMoreToolsMenuFactory menuFactory(QLatin1String("kate/addons/project/git-tools")); | ||
107 | QMenu gitMenu; // must live as long as the maybe filled menu items should live | 113 | QMenu gitMenu; // must live as long as the maybe filled menu items should live | ||
108 | if (isGit(filename)) { | 114 | if (isGit(filename)) { | ||
109 | menuFactory.fillMenuFromGroupingNames(&gitMenu, { QLatin1String("git-clients-and-actions") }, | 115 | menuFactory.fillMenuFromGroupingNames(&gitMenu, { QLatin1String("git-clients-and-actions") }, | ||
110 | QUrl::fromLocalFile(filename)); | 116 | QUrl::fromLocalFile(filename)); | ||
111 | menu.addSection(i18n("Git:")); | 117 | menu.addSection(i18n("Git:")); | ||
Show All 21 Lines | 126 | if (QAction* const action = menu.exec(pos)) { | |||
133 | else if (action == openContaingFolderAction) { | 139 | else if (action == openContaingFolderAction) { | ||
134 | // code copied from kateviewspace.cpp, see question there | 140 | // code copied from kateviewspace.cpp, see question there | ||
135 | //#if KIO_VERSION >= QT_VERSION_CHECK(5, 24, 0) | 141 | //#if KIO_VERSION >= QT_VERSION_CHECK(5, 24, 0) | ||
136 | // KIO::highlightInFileManager(filename); | 142 | // KIO::highlightInFileManager(filename); | ||
137 | //#else | 143 | //#else | ||
138 | QDesktopServices::openUrl(QUrl::fromLocalFile(filename).adjusted(QUrl::RemoveFilename)); | 144 | QDesktopServices::openUrl(QUrl::fromLocalFile(filename).adjusted(QUrl::RemoveFilename)); | ||
139 | //#endif | 145 | //#endif | ||
140 | } | 146 | } | ||
147 | else if (action == filePropertiesAction) { | ||||
148 | // code copied and adapted from frameworks/kio/src/filewidgets/knewfilemenu.cpp | ||||
149 | KFileItem fileItem(QUrl::fromLocalFile(filename)); | ||||
150 | QDialog* dlg = new KPropertiesDialog(fileItem); | ||||
151 | dlg->setAttribute(Qt::WA_DeleteOnClose); | ||||
152 | dlg->show(); | ||||
153 | } | ||||
141 | else { | 154 | else { | ||
142 | // One of the git actions was triggered | 155 | // One of the git actions was triggered | ||
143 | } | 156 | } | ||
144 | } | 157 | } | ||
145 | } | 158 | } |