1 Star 0 Fork 9

Hs_openeuler_20_03_SP4/polkit-qt-1

forked from src-openEuler/polkit-qt-1 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-add-setCancel-method.patch 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
Venland 提交于 2022-07-21 10:37 . add setCancel method and modify URL
From a029a2c04e6bb51c1e9591ddcc44ce736ac969b0 Mon Sep 17 00:00:00 2001
From: loong_C <loong_c@yeah.net>
Date: Thu, 21 Jul 2022 10:31:44 +0800
Subject: [PATCH] add setCancel method
---
agent/polkitqt1-agent-session.cpp | 6 ++++++
agent/polkitqt1-agent-session.h | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/agent/polkitqt1-agent-session.cpp b/agent/polkitqt1-agent-session.cpp
index e70ace0..6092fa4 100644
--- a/agent/polkitqt1-agent-session.cpp
+++ b/agent/polkitqt1-agent-session.cpp
@@ -150,6 +150,12 @@ void AsyncResult::setCompleted()
d->result = nullptr;
}
+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 42b30e8..d0ff89c 100644
--- a/agent/polkitqt1-agent-session.h
+++ b/agent/polkitqt1-agent-session.h
@@ -44,6 +44,11 @@ public:
*/
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.
* Method complete() must be called anyway.
--
2.20.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Hs_openeuler_20_03_SP4/polkit-qt-1.git
git@gitee.com:Hs_openeuler_20_03_SP4/polkit-qt-1.git
Hs_openeuler_20_03_SP4
polkit-qt-1
polkit-qt-1
master

搜索帮助