From 055874e92c95c1efad81d950f964c498da621d5d Mon Sep 17 00:00:00 2001 From: peijiankang Date: Wed, 4 Sep 2024 17:57:36 +0800 Subject: [PATCH] fix peony-extensions-4.0.0.0 open terminal invalid --- ...nsions-4.0.0.0-open-terminal-invalid.patch | 69 +++++++++++++++++++ peony-extensions.spec | 8 ++- 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 0001-fix-peony-extensions-4.0.0.0-open-terminal-invalid.patch diff --git a/0001-fix-peony-extensions-4.0.0.0-open-terminal-invalid.patch b/0001-fix-peony-extensions-4.0.0.0-open-terminal-invalid.patch new file mode 100644 index 0000000..c0967d4 --- /dev/null +++ b/0001-fix-peony-extensions-4.0.0.0-open-terminal-invalid.patch @@ -0,0 +1,69 @@ +From 74ca150ea9047de8aae7642f6474c9909be02ae4 Mon Sep 17 00:00:00 2001 +From: peijiankang +Date: Wed, 4 Sep 2024 17:55:19 +0800 +Subject: [PATCH] fix peony-extensions-4.0.0.0 open terminal invalid + +--- + .../mate-terminal-menu-plugin.cpp | 38 ++++++++++--------- + 1 file changed, 20 insertions(+), 18 deletions(-) + +diff --git a/peony-menu-plugin-mate-terminal/mate-terminal-menu-plugin.cpp b/peony-menu-plugin-mate-terminal/mate-terminal-menu-plugin.cpp +index 6437f58..ebc2387 100644 +--- a/peony-menu-plugin-mate-terminal/mate-terminal-menu-plugin.cpp ++++ b/peony-menu-plugin-mate-terminal/mate-terminal-menu-plugin.cpp +@@ -34,9 +34,6 @@ + #include + #include + #include +-#include +-#include +-#include + #include + + #ifdef KYLIN_COMMON +@@ -85,22 +82,27 @@ MateTerminalMenuPlugin::MateTerminalMenuPlugin(QObject *parent) : QObject (paren + + void MateTerminalMenuPlugin::openTerminal(){ + QUrl url = m_uri; +- auto dir = url.path(); +- +- QStringList args; +- args << "--working-directory" << dir; +- QString terminal_path = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, "mate-terminal.desktop"); +- if (terminal_path.isEmpty()) { +- terminal_path = QFile(terminal_cmd).fileName() + ".desktop"; +- terminal_path = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, terminal_path); +- if (!QFile(terminal_path).exists()) { +- return; +- } ++ auto directory = url.path().toUtf8().constData(); ++ gchar **argv = nullptr; ++ g_shell_parse_argv (terminal_cmd.toUtf8().constData(), nullptr, &argv, nullptr); ++ GError *err = nullptr; ++ g_spawn_async (directory, ++ argv, ++ nullptr, ++ G_SPAWN_SEARCH_PATH, ++ nullptr, ++ nullptr, ++ nullptr, ++ &err); ++ if (err) { ++ qDebug()<<"openTerminal failed:"<message; ++ g_error_free(err); ++ err = nullptr; ++ //try again to open terminal ++ //maybe this method is better,but still need more test to confirm ++ tryOpenAgain(); + } +- +- QDBusMessage msg = QDBusMessage::createMethodCall("com.kylin.AppManager", "/com/kylin/AppManager", "com.kylin.AppManager", "LaunchAppWithArguments"); +- msg << terminal_path << args; +- QDBusConnection::sessionBus().asyncCall(msg); ++ g_strfreev (argv); + } + + void MateTerminalMenuPlugin::tryOpenAgain() +-- +2.25.1 + diff --git a/peony-extensions.spec b/peony-extensions.spec index 5dbdae3..0d0965e 100644 --- a/peony-extensions.spec +++ b/peony-extensions.spec @@ -1,10 +1,11 @@ Name: peony-extensions Version: 4.0.0.0 -Release: 1 +Release: 2 Summary: adds extended functionality to the Peony file manager. License: GPLv3 and LGPLv3 URL: http://www.ukui.org Source0: %{name}-%{version}.tar.gz +Patch01: 0001-fix-peony-extensions-4.0.0.0-open-terminal-invalid.patch BuildRequires: cmake BuildRequires: glib2-devel @@ -104,7 +105,7 @@ to rename it use other tools like gparted. %prep -%setup -q +%autosetup -n %{name}-%{version} -p1 %build export PATH=%{_qt5_bindir}:$PATH @@ -166,6 +167,9 @@ chmod +t /var/lib/samba/usershares %{_libdir}/peony-extensions/libpeony-drive-rename.so %changelog +* Wed Sep 04 2024 peijiankang - 4.0.0.0-2 +- add 0001-fix-peony-extensions-4.0.0.0-open-terminal-invalid.patch + * Wed Jun 05 2024 peijiankang - 4.0.0.0-1 - update version to 4.0.0.0 -- Gitee