forked from pool/krusader
117 lines
3.9 KiB
Diff
117 lines
3.9 KiB
Diff
|
From 3d7ae219e8df07861d9a68d6f25a8f861f48ea9b Mon Sep 17 00:00:00 2001
|
||
|
From: Yaroslav Sidlovsky <zawertun@gmail.com>
|
||
|
Date: Sat, 20 Nov 2021 19:16:02 +0300
|
||
|
Subject: [PATCH] Fixed non working actions for create / extract archives
|
||
|
|
||
|
PanelContextMenu instance created in PanelContextMenu::run now lives long
|
||
|
enough so that create / extract archive actions won't be deleted right after
|
||
|
PanelContextMenu::run call.
|
||
|
|
||
|
Important note: after this patch I've spotted crash, same as in the bug
|
||
|
https://bugs.kde.org/show_bug.cgi?id=443540.
|
||
|
|
||
|
Looks like this crash has been fixed in the KF5 5.89(git).
|
||
|
|
||
|
BUG: 441376
|
||
|
---
|
||
|
krusader/Panel/listpanel.cpp | 7 ++++---
|
||
|
krusader/Panel/listpanel.h | 2 ++
|
||
|
krusader/Panel/panelcontextmenu.cpp | 9 +++++----
|
||
|
krusader/Panel/panelcontextmenu.h | 5 +++--
|
||
|
4 files changed, 14 insertions(+), 9 deletions(-)
|
||
|
|
||
|
diff --git a/krusader/Panel/listpanel.cpp b/krusader/Panel/listpanel.cpp
|
||
|
index 5789d22..4278eb7 100644
|
||
|
--- a/krusader/Panel/listpanel.cpp
|
||
|
+++ b/krusader/Panel/listpanel.cpp
|
||
|
@@ -60,7 +60,6 @@
|
||
|
#include "krpreviewpopup.h"
|
||
|
#include "krsearchbar.h"
|
||
|
#include "listpanelactions.h"
|
||
|
-#include "panelcontextmenu.h"
|
||
|
#include "panelfunc.h"
|
||
|
#include "sidebar.h"
|
||
|
#include "viewactions.h"
|
||
|
@@ -873,12 +872,14 @@ void ListPanel::popRightClickMenu(const QPoint &loc)
|
||
|
{
|
||
|
// run it, on the mouse location
|
||
|
int j = QFontMetrics(font()).height() * 2;
|
||
|
- PanelContextMenu::run(QPoint(loc.x() + 5, loc.y() + j), this);
|
||
|
+ auto menu = PanelContextMenu::run(QPoint(loc.x() + 5, loc.y() + j), this);
|
||
|
+ _contextMenu.reset(menu);
|
||
|
}
|
||
|
|
||
|
void ListPanel::popEmptyRightClickMenu(const QPoint &loc)
|
||
|
{
|
||
|
- PanelContextMenu::run(loc, this);
|
||
|
+ auto menu = PanelContextMenu::run(loc, this);
|
||
|
+ _contextMenu.reset(menu);
|
||
|
}
|
||
|
|
||
|
QString ListPanel::getCurrentName() const
|
||
|
diff --git a/krusader/Panel/listpanel.h b/krusader/Panel/listpanel.h
|
||
|
index b1633dc..5180e8a 100644
|
||
|
--- a/krusader/Panel/listpanel.h
|
||
|
+++ b/krusader/Panel/listpanel.h
|
||
|
@@ -54,6 +54,7 @@
|
||
|
#include <KIOFileWidgets/KUrlNavigator>
|
||
|
|
||
|
#include "krpanel.h"
|
||
|
+#include "panelcontextmenu.h"
|
||
|
|
||
|
#define PROP_SYNC_BUTTON_ON 1
|
||
|
#define PROP_LOCKED 2
|
||
|
@@ -253,6 +254,7 @@ private:
|
||
|
QUrl _pinnedUrl; // only for TabState::PINNED
|
||
|
TabState _tabState;
|
||
|
QList<int> sidebarSplitterSizes;
|
||
|
+ QScopedPointer<PanelContextMenu> _contextMenu;
|
||
|
};
|
||
|
|
||
|
#endif
|
||
|
diff --git a/krusader/Panel/panelcontextmenu.cpp b/krusader/Panel/panelcontextmenu.cpp
|
||
|
index ec7b172..8b0239e 100644
|
||
|
--- a/krusader/Panel/panelcontextmenu.cpp
|
||
|
+++ b/krusader/Panel/panelcontextmenu.cpp
|
||
|
@@ -55,14 +55,15 @@
|
||
|
#include "../MountMan/kmountman.h"
|
||
|
#include "../UserAction/useractionpopupmenu.h"
|
||
|
|
||
|
-void PanelContextMenu::run(const QPoint &pos, KrPanel *panel)
|
||
|
+PanelContextMenu* PanelContextMenu::run(const QPoint &pos, KrPanel *panel)
|
||
|
{
|
||
|
- PanelContextMenu menu(panel);
|
||
|
- QAction * res = menu.exec(pos);
|
||
|
+ auto menu = new PanelContextMenu(panel);
|
||
|
+ QAction * res = menu->exec(pos);
|
||
|
int result = res && res->data().canConvert<int>() ?
|
||
|
res->data().toInt() :
|
||
|
-1;
|
||
|
- menu.performAction(result);
|
||
|
+ menu->performAction(result);
|
||
|
+ return menu;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
diff --git a/krusader/Panel/panelcontextmenu.h b/krusader/Panel/panelcontextmenu.h
|
||
|
index cd37a00..7199af4 100644
|
||
|
--- a/krusader/Panel/panelcontextmenu.h
|
||
|
+++ b/krusader/Panel/panelcontextmenu.h
|
||
|
@@ -40,10 +40,11 @@ class PanelContextMenu : public QMenu
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
- static void run(const QPoint &pos, KrPanel *panel);
|
||
|
+ static PanelContextMenu* run(const QPoint &pos, KrPanel *panel);
|
||
|
|
||
|
private:
|
||
|
- explicit PanelContextMenu(KrPanel *thePanel, QWidget *parent = 0);
|
||
|
+ explicit PanelContextMenu(KrPanel *thePanel, QWidget *parent = nullptr);
|
||
|
+
|
||
|
void performAction(int id);
|
||
|
void addEmptyMenuEntries(); // adds the choices for a menu without selected items
|
||
|
void addCreateNewMenu(); // adds a "create new" submenu
|
||
|
--
|
||
|
2.36.1
|
||
|
|