Christophe Giboudeaux 2022-06-29 14:05:21 +00:00 committed by Git OBS Bridge
parent 744ed662c0
commit d09af4e748
3 changed files with 126 additions and 2 deletions

View File

@ -0,0 +1,116 @@
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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jun 29 14:04:17 UTC 2022 - Christophe Giboudeaux <christophe@krop.fr>
- Add patch to fix the 'Compress' menu (boo#1198725)
* 0001-Fixed-non-working-actions-for-create-extract-archive.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Aug 27 12:56:33 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr> Thu Aug 27 12:56:33 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>

View File

@ -1,7 +1,7 @@
# #
# spec file for package krusader # spec file for package krusader
# #
# Copyright (c) 2020 SUSE LLC # Copyright (c) 2022 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -26,6 +26,8 @@ URL: https://krusader.org/
Source: https://download.kde.org/stable/krusader/%{version}/%{name}-%{version}.tar.xz Source: https://download.kde.org/stable/krusader/%{version}/%{name}-%{version}.tar.xz
Source1: krusader_browse_iso.desktop Source1: krusader_browse_iso.desktop
Source2: org.kde.krusader.root-mode.desktop Source2: org.kde.krusader.root-mode.desktop
# PATCH-FIX-UPSTREAM
Patch0: 0001-Fixed-non-working-actions-for-create-extract-archive.patch
BuildRequires: extra-cmake-modules >= 1.7.0 BuildRequires: extra-cmake-modules >= 1.7.0
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: libacl-devel BuildRequires: libacl-devel
@ -82,7 +84,7 @@ Group: Productivity/File utilities
An advanced twin panel (commander style) file manager for KDE. An advanced twin panel (commander style) file manager for KDE.
%prep %prep
%setup -q %autosetup -p1
%build %build
%cmake_kf5 -d build %cmake_kf5 -d build