┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
authorAlexander Lohnau <[email protected]>2021-04-18 08:37:45 +0200
committerElvis Angelaccio <[email protected]>2021-07-04 20:33:48 +0000
commit30299e00b137fb5abf31e6f82fc8f4753f9a929a (patch)
treec6d28ce3e7da2c8f9da410b65386e52d3232382e /src/dolphinmainwindow.cpp
parentdd7f3fb783a2164e282d88140f301bf8c0af9e5b (diff)
Reuse KFileItemActions instance during lifetime of dolphin
With https://invent.kde.org/frameworks/kio/-/merge_requests/411 the plugin instances can be reused during the lifetime of the KFileItemActions object. This improves performance and also allows the plugins to emit errors, even if they run async.
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index d8c27526b..fe39d4d2f 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -65,6 +65,8 @@
#include <KWindowSystem>
#include <KXMLGUIFactory>
+#include <kio_version.h>
+
#include <QApplication>
#include <QClipboard>
#include <QCloseEvent>
@@ -207,6 +209,13 @@ DolphinMainWindow::DolphinMainWindow() :
connect(KSycoca::self(), QOverload<>::of(&KSycoca::databaseChanged), this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
QTimer::singleShot(0, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
+
+ m_fileItemActions.setParentWidget(this);
+#if KIO_VERSION >= QT_VERSION_CHECK(5, 82, 0)
+ connect(&m_fileItemActions, &KFileItemActions::error, this, [this](const QString &errorMessage) {
+ showErrorMessage(errorMessage);
+ });
+#endif
}
DolphinMainWindow::~DolphinMainWindow()
@@ -1125,7 +1134,7 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
const QUrl& url,
const QList<QAction*>& customActions)
{
- QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, pos, item, url);
+ QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, pos, item, url, &m_fileItemActions);
contextMenu.data()->setCustomActions(customActions);
const DolphinContextMenu::Command command = contextMenu.data()->open();