72 lines
2.7 KiB
Diff
72 lines
2.7 KiB
Diff
From 66f70196d984ce19a9f18a7ebe4ed567534aa3f6 Mon Sep 17 00:00:00 2001
|
|
From: tanyulong2021 <tanyulong@kylinos.cn>
|
|
Date: Tue, 2 Aug 2022 10:29:15 +0800
|
|
Subject: [PATCH] fix the problem that the probability window is not displayed
|
|
in the center of screen
|
|
|
|
---
|
|
.../polkit-ukui-authentication-agent-1.desktop.in | 2 +-
|
|
polkit-agent/src/PolkitListener.cpp | 12 ++++++++----
|
|
2 files changed, 9 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/polkit-agent/data/polkit-ukui-authentication-agent-1.desktop.in b/polkit-agent/data/polkit-ukui-authentication-agent-1.desktop.in
|
|
index d9b9c45..f2f08fd 100755
|
|
--- a/polkit-agent/data/polkit-ukui-authentication-agent-1.desktop.in
|
|
+++ b/polkit-agent/data/polkit-ukui-authentication-agent-1.desktop.in
|
|
@@ -81,7 +81,7 @@ Categories=
|
|
OnlyShowIn=UKUI;MATE
|
|
X-UKUI-StartupNotify=false
|
|
X-UKUI-AutoRestart=true
|
|
-X-UKUI-Autostart-Phase=Initialization
|
|
+X-UKUI-Autostart-Phase=Application
|
|
NoDisplay=true
|
|
X-DBUS-StartupType=Unique
|
|
X-MATE-Autostart-Phase=Initialization
|
|
diff --git a/polkit-agent/src/PolkitListener.cpp b/polkit-agent/src/PolkitListener.cpp
|
|
index 634b1db..ed0f805 100755
|
|
--- a/polkit-agent/src/PolkitListener.cpp
|
|
+++ b/polkit-agent/src/PolkitListener.cpp
|
|
@@ -27,7 +27,7 @@
|
|
#include <QDebug>
|
|
#include <QDesktopWidget>
|
|
#include <QApplication>
|
|
-
|
|
+#include <QScreen>
|
|
#include <fcntl.h>
|
|
|
|
#include "PolkitListener.h"
|
|
@@ -121,8 +121,9 @@ void PolkitListener::initiateAuthentication(
|
|
actionDesc.vendorUrl());
|
|
|
|
/* set the position of the mainwindow */
|
|
- QDesktopWidget *desktop = QApplication::desktop();
|
|
- QRect desktopRect = desktop->screen(desktop->primaryScreen())->geometry();
|
|
+ //QDesktopWidget *desktop = QApplication::desktop();
|
|
+ //QRect desktopRect = desktop->screen(desktop->primaryScreen())->geometry();
|
|
+ QRect desktopRect = QApplication::primaryScreen()->geometry();
|
|
mainWindow->move(desktopRect.left() + (desktopRect.width() - mainWindow->width()) / 2,
|
|
desktopRect.top() + (desktopRect.height() - mainWindow->height()) / 2);
|
|
|
|
@@ -288,6 +289,10 @@ void PolkitListener::onShowPrompt(const QString &prompt, bool echo)
|
|
}
|
|
|
|
mainWindow->show();
|
|
+ QRect desktopRect = QApplication::primaryScreen()->geometry();
|
|
+ mainWindow->move(desktopRect.left() + (desktopRect.width() - mainWindow->width()) / 2,
|
|
+ desktopRect.top() + (desktopRect.height() - mainWindow->height()) / 2);
|
|
+
|
|
mainWindow->activateWindow();
|
|
}
|
|
|
|
@@ -296,7 +301,6 @@ void PolkitListener::onShowError(const QString &text)
|
|
qDebug() << "[Polkit]:" << "Error:" << text;
|
|
|
|
if(mainWindow){
|
|
- qDebug() << "aaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
|
mainWindow->setMessage(text);
|
|
}
|
|
}
|
|
--
|
|
2.33.0
|
|
|