!18 fix dde-polkit-agent compile problem add setCancel-method

From: @hanshuang123456 
Reviewed-by: @peijiankang 
Signed-off-by: @peijiankang
This commit is contained in:
openeuler-ci-bot 2023-11-15 06:36:59 +00:00 committed by Gitee
commit 2d92f77b6f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From c1871601dd00f87f075e72df7d9f07fd2d85db19 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Tue, 7 Nov 2023 15:34:59 +0800
Subject: [PATCH] add setCancel method
---
agent/polkitqt1-agent-session.cpp | 6 ++++++
agent/polkitqt1-agent-session.h | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/agent/polkitqt1-agent-session.cpp b/agent/polkitqt1-agent-session.cpp
index 7aea332..c76c871 100644
--- a/agent/polkitqt1-agent-session.cpp
+++ b/agent/polkitqt1-agent-session.cpp
@@ -163,6 +163,12 @@ void AsyncResult::setCompleted()
d->result = NULL;
}
+void AsyncResult::setCancel(const QString &text)
+{
+ Q_ASSERT(d->result);
+ g_simple_async_result_set_error(d->result, POLKIT_ERROR, POLKIT_ERROR_CANCELLED, "%s", text.toUtf8().data());
+}
+
void AsyncResult::setError(const QString &text)
{
Q_ASSERT(d->result);
diff --git a/agent/polkitqt1-agent-session.h b/agent/polkitqt1-agent-session.h
index 0f763e8..8999bca 100644
--- a/agent/polkitqt1-agent-session.h
+++ b/agent/polkitqt1-agent-session.h
@@ -55,6 +55,10 @@ public:
* \brief Mark the action that is tied to this result as completed.
*/
void setCompleted();
+ /**
+ * \brief Mark the action that is tied to this result as cancelled.
+ */
+ void setCancel(const QString &text);
/**
* \brief Sets an error for the asynchronous result.
--
2.27.0

View File

@ -1,12 +1,13 @@
Name: polkit-qt-1
Version: 0.113.0
Release: 3
Release: 4
Summary: Qt bindings for PolicyKit
License: GPLv2+
URL: https://api.kde.org/kdesupport-api/polkit-qt-1-apidocs/
Source0: http://download.kde.org/stable/%{name}/polkit-qt-1-%{version}.tar.xz
Source1: macros.polkit-qt
Patch1: 0001-add-setCancel-method.patch
BuildRequires: cmake
BuildRequires: gcc-c++
@ -95,6 +96,9 @@ install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_rpmmacrodir}/macros.polkit-qt
%changelog
* Wed Nov 15 2023 hanshuang <hanshuang@uniontech.com> - 0.113.0-4
- add setCancel method fix dde-polkit-agent compile problem
* Sat Jan 29 2022 herengui <herengui@uniontech.com> - 0.113.0-3
- add rpm macros