fix(kiran-session-guard):fits the Qt5.9.7 interface
- 适配Qt5.9.7接口,修复编译报错 Closes:#15019
This commit is contained in:
parent
6ed416bc75
commit
b3fa6e10f8
121
0007-fix-kiran-session-guard-fits-the-Qt5.9.7-interface.patch
Normal file
121
0007-fix-kiran-session-guard-fits-the-Qt5.9.7-interface.patch
Normal file
@ -0,0 +1,121 @@
|
||||
From af28157ad311c38ab8990b1abd2b1a3041c65a22 Mon Sep 17 00:00:00 2001
|
||||
From: niko_yhc <yinhongchang@kylinsec.com.cn>
|
||||
Date: Tue, 12 Sep 2023 19:20:14 +0800
|
||||
Subject: [PATCH] fix(kiran-session-guard):fits the Qt5.9.7 interface
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 适配Qt5.9.7接口,修复编译报错
|
||||
|
||||
Closes:#15019
|
||||
---
|
||||
lib/auth-proxy/auth-controller.cpp | 21 +++++++++++++++++++++
|
||||
src/polkit-agent/listener.cpp | 26 ++++++++++++++++++++++++++
|
||||
2 files changed, 47 insertions(+)
|
||||
|
||||
diff --git a/lib/auth-proxy/auth-controller.cpp b/lib/auth-proxy/auth-controller.cpp
|
||||
index ce574a2..9d7acd4 100644
|
||||
--- a/lib/auth-proxy/auth-controller.cpp
|
||||
+++ b/lib/auth-proxy/auth-controller.cpp
|
||||
@@ -145,7 +145,12 @@ bool AuthController::processAuthDaemonCommand(const QString& msg)
|
||||
auto cmdStr = msg.midRef(strlen(KAP_PROTO_JSON_PREFIX), -1);
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(cmdStr.toUtf8());
|
||||
|
||||
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
int protoID = jsonDoc[KAP_PJK_KEY_HEAD][KAP_PJK_KEY_CMD].toInt(-1);
|
||||
+#else
|
||||
+ QJsonValue val = jsonDoc.object()[KAP_PJK_KEY_HEAD];
|
||||
+ int protoID = val.toObject()[KAP_PJK_KEY_CMD].toInt(-1);
|
||||
+#endif
|
||||
if (protoID == -1)
|
||||
{
|
||||
return false;
|
||||
@@ -155,7 +160,12 @@ bool AuthController::processAuthDaemonCommand(const QString& msg)
|
||||
{
|
||||
case KAP_REQ_CMD_NOTIFY_AUTH_MODE:
|
||||
{
|
||||
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
auto authMode = jsonDoc[KAP_PJK_KEY_BODY][KAP_PJK_KEY_AUTH_MODE].toInt(-1);
|
||||
+#else
|
||||
+ QJsonValue val = jsonDoc.object()[KAP_PJK_KEY_BODY];
|
||||
+ auto authMode = val.toObject()[KAP_PJK_KEY_AUTH_MODE].toInt(-1);
|
||||
+#endif
|
||||
if (authMode < KAD_AUTH_MODE_NONE || authMode > KAD_AUTH_MODE_LAST)
|
||||
{
|
||||
KLOG_WARNING() << "invalid auth mode" << authMode;
|
||||
@@ -171,7 +181,13 @@ bool AuthController::processAuthDaemonCommand(const QString& msg)
|
||||
}
|
||||
case KAP_REQ_CMD_NOTIFY_SUPPORT_AUTH_TYPE:
|
||||
{
|
||||
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
auto authTypesArray = jsonDoc[KAP_PJK_KEY_BODY][KAP_PJK_KEY_AUTH_TYPES].toArray(QJsonArray());
|
||||
+#else
|
||||
+ QJsonValue val = jsonDoc.object()[KAP_PJK_KEY_BODY];
|
||||
+ const QJsonObject object = val.toObject();
|
||||
+ auto authTypesArray = object[KAP_PJK_KEY_AUTH_TYPES].toArray(QJsonArray());
|
||||
+#endif
|
||||
if (authTypesArray.isEmpty())
|
||||
{
|
||||
KLOG_WARNING() << "invalid auth types";
|
||||
@@ -202,7 +218,12 @@ bool AuthController::processAuthDaemonCommand(const QString& msg)
|
||||
}
|
||||
case KAP_REQ_CMD_NOTIFY_AUTH_TYPE:
|
||||
{
|
||||
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
auto authType = jsonDoc[KAP_PJK_KEY_BODY][KAP_PJK_KEY_AUTH_TYPE].toInt(-1);
|
||||
+#else
|
||||
+ QJsonValue val = jsonDoc.object()[KAP_PJK_KEY_BODY];
|
||||
+ auto authType = val.toObject()[KAP_PJK_KEY_AUTH_TYPES].toInt(-1);
|
||||
+#endif
|
||||
if (authType <= KAD_AUTH_TYPE_NONE || authType >= KAD_AUTH_TYPE_LAST)
|
||||
{
|
||||
KLOG_WARNING() << "invalid auth types";
|
||||
diff --git a/src/polkit-agent/listener.cpp b/src/polkit-agent/listener.cpp
|
||||
index fbcd66a..7474329 100644
|
||||
--- a/src/polkit-agent/listener.cpp
|
||||
+++ b/src/polkit-agent/listener.cpp
|
||||
@@ -38,6 +38,28 @@ Listener::~Listener()
|
||||
{
|
||||
}
|
||||
|
||||
+#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
|
||||
+static QScreen *screenAt(const QPoint &point)
|
||||
+{
|
||||
+ QVarLengthArray<const QScreen *, 8> visitedScreens;
|
||||
+ for (const QScreen *screen : QGuiApplication::screens()) {
|
||||
+ if (visitedScreens.contains(screen))
|
||||
+ continue;
|
||||
+
|
||||
+ // The virtual siblings include the screen itself, so iterate directly
|
||||
+ for (QScreen *sibling : screen->virtualSiblings()) {
|
||||
+ if (sibling->geometry().contains(point))
|
||||
+ return sibling;
|
||||
+
|
||||
+ visitedScreens.append(sibling);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return nullptr;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
void Listener::initiateAuthentication(const QString &actionId,
|
||||
const QString &message,
|
||||
const QString &iconName,
|
||||
@@ -83,7 +105,11 @@ void Listener::initiateAuthentication(const QString &actionId,
|
||||
connect(m_authDialog, &Dialog::completed, this, &Listener::onAuthDialogCompleted);
|
||||
connect(m_authDialog, &Dialog::cancelled, this, &Listener::onAuthDialogCancelled);
|
||||
|
||||
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
auto screen = QApplication::screenAt(QCursor::pos());
|
||||
+#else
|
||||
+ auto screen = screenAt(QCursor::pos());
|
||||
+#endif
|
||||
if (screen != nullptr)
|
||||
{
|
||||
QRect screenGeometry = screen->geometry();
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: kiran-session-guard
|
||||
Version: 2.5.1
|
||||
Release: 5
|
||||
Release: 6
|
||||
Summary: Kiran desktop environment login and lock screen dialog
|
||||
Summary(zh_CN): Kiran桌面环境登录和解锁框
|
||||
|
||||
@ -13,6 +13,8 @@ Patch0003: 0003-feat-jump-login-open-greeter-jump-login.patch
|
||||
Patch0004: 0004-fix-crash-block-Fixed-the-crash-caused-by-the-exit-s.patch
|
||||
Patch0005: 0005-fix-avatar-Update-authentication-users-and-user-list.patch
|
||||
Patch0006: 0006-fix-compile-warning-Fixed-some-compilation-warnings.patch
|
||||
Patch0007: 0007-fix-kiran-session-guard-fits-the-Qt5.9.7-interface.patch
|
||||
|
||||
|
||||
%define SHOW_VIRTUAL_KEYBOARD 0
|
||||
|
||||
@ -150,6 +152,9 @@ gtk-update-icon-cache -f /usr/share/icons/hicolor/
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%changelog
|
||||
* Tue Sep 12 2023 yinhongchang <yinhongchang@kylinsec.com.cn> - 2.5.1-6
|
||||
- KYOS-F: fits the Qt5.9.7 interface(#15019)
|
||||
|
||||
* Tue Aug 22 2023 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.5.1-5
|
||||
- KYOS-B: update authentication users and user list avatars(#12711)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user