fix(UI issue): The authorization box appears in the upper left corner and is not centered
Description: The authorization box appears in the upper left corner and is not centered Log: 授权框出现在左上角不居中 Bug: bug#I90LU8【次要】【提权】需要提权框进行授权时(如添加新用户、生物特征管理工具中录入指纹提权),授权框出现在左上角不居中
This commit is contained in:
parent
cdf118e254
commit
6bc0453c2e
|
@ -18,7 +18,9 @@ Build-Depends: cmake (>= 2.6),
|
||||||
libkysdk-sysinfo-dev,
|
libkysdk-sysinfo-dev,
|
||||||
libukui-log4qt-dev,
|
libukui-log4qt-dev,
|
||||||
libssl-dev,
|
libssl-dev,
|
||||||
liblightdm-qt5-3-dev
|
liblightdm-qt5-3-dev,
|
||||||
|
libkf5windowsystem-dev (>= 5.92.0-ok5),
|
||||||
|
libx11-dev
|
||||||
Standards-Version: 4.5.0
|
Standards-Version: 4.5.0
|
||||||
Rules-Requires-Root: no
|
Rules-Requires-Root: no
|
||||||
Homepage: https://github.com/ukui/ukui-biometric-auth
|
Homepage: https://github.com/ukui/ukui-biometric-auth
|
||||||
|
|
|
@ -3,9 +3,12 @@ project(ukui-polkit-agent)
|
||||||
|
|
||||||
pkg_check_modules(QGS REQUIRED gsettings-qt)
|
pkg_check_modules(QGS REQUIRED gsettings-qt)
|
||||||
pkg_check_modules(KDKINFO REQUIRED kysdk-sysinfo)
|
pkg_check_modules(KDKINFO REQUIRED kysdk-sysinfo)
|
||||||
|
pkg_check_modules(KYSDKWAYLANDHELPER_PKG REQUIRED kysdk-waylandhelper)
|
||||||
|
|
||||||
find_package(PolkitQt5-1 REQUIRED 0.103.0)
|
find_package(PolkitQt5-1 REQUIRED 0.103.0)
|
||||||
find_package(Qt5 COMPONENTS Core Widgets DBus X11Extras Xml Network Svg)
|
find_package(Qt5 COMPONENTS Core Widgets DBus X11Extras Xml Network Svg)
|
||||||
|
find_package(KF5WindowSystem)
|
||||||
|
find_package(X11 REQUIRED)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTOUIC ON)
|
set(CMAKE_AUTOUIC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
|
@ -58,10 +61,14 @@ set(polkit_SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(polkit-ukui-authentication-agent-1 ${polkit_SRCS})
|
add_executable(polkit-ukui-authentication-agent-1 ${polkit_SRCS})
|
||||||
|
target_include_directories(polkit-ukui-authentication-agent-1 PRIVATE ${KYSDKWAYLANDHELPER_PKG_INCLUDE_DIRS})
|
||||||
|
target_link_directories(polkit-ukui-authentication-agent-1 PRIVATE ${KYSDKWAYLANDHELPER_PKG_LIBRARY_DIRS})
|
||||||
target_link_libraries(polkit-ukui-authentication-agent-1
|
target_link_libraries(polkit-ukui-authentication-agent-1
|
||||||
Qt5::Core Qt5::Widgets Qt5::DBus ${EXTRA_LIBS}
|
Qt5::Core Qt5::Widgets Qt5::DBus ${EXTRA_LIBS}
|
||||||
${POLKITQT-1_LIBRARIES}
|
${POLKITQT-1_LIBRARIES}
|
||||||
|
${KYSDKWAYLANDHELPER_PKG_LIBRARIES}
|
||||||
BioAuthWidgets
|
BioAuthWidgets
|
||||||
|
KF5::WindowSystem
|
||||||
-lrt
|
-lrt
|
||||||
-lukui-log4qt
|
-lukui-log4qt
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <kysdk/kysdk-system/libkysysinfo.h>
|
||||||
|
|
||||||
#include "PolkitListener.h"
|
#include "PolkitListener.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "generic.h"
|
#include "generic.h"
|
||||||
#include <libkysysinfo.h>
|
#include <libkysysinfo.h>
|
||||||
|
#include "windowmanager/windowmanager.h"
|
||||||
|
|
||||||
PolkitListener::PolkitListener(QObject *parent)
|
PolkitListener::PolkitListener(QObject *parent)
|
||||||
: Listener(parent),
|
: Listener(parent),
|
||||||
|
@ -171,9 +173,12 @@ void PolkitListener::initiateAuthentication(
|
||||||
if (desScreenGeometry.isEmpty()) {
|
if (desScreenGeometry.isEmpty()) {
|
||||||
desScreenGeometry = qApp->primaryScreen()->geometry();
|
desScreenGeometry = qApp->primaryScreen()->geometry();
|
||||||
}
|
}
|
||||||
mainWindow->move(desScreenGeometry.x() + (desScreenGeometry.width() - mainWindow->width())/2,
|
// mainWindow->move(desScreenGeometry.x() + (desScreenGeometry.width() - mainWindow->width())/2,
|
||||||
desScreenGeometry.y() + (desScreenGeometry.height() - mainWindow->height())/2);
|
// desScreenGeometry.y() + (desScreenGeometry.height() - mainWindow->height())/2);
|
||||||
qDebug()<<"MoveWindow to center1:"<<desScreenGeometry<<","<<mainWindow->geometry()<<QGuiApplication::platformName();;
|
// qDebug()<<"MoveWindow to center1:"<<desScreenGeometry<<","<<mainWindow->geometry()<<QGuiApplication::platformName();;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
connect(mainWindow, &MainWindow::accept, this, &PolkitListener::onResponse);
|
connect(mainWindow, &MainWindow::accept, this, &PolkitListener::onResponse);
|
||||||
connect(mainWindow, &MainWindow::canceled, this, [&]{
|
connect(mainWindow, &MainWindow::canceled, this, [&]{
|
||||||
wasCancelled = true;
|
wasCancelled = true;
|
||||||
|
@ -360,8 +365,26 @@ void PolkitListener::onShowPrompt(const QString &prompt, bool echo)
|
||||||
mainWindow->switchAuthMode(MainWindow::PASSWORD);
|
mainWindow->switchAuthMode(MainWindow::PASSWORD);
|
||||||
mainWindow->setPrompt(prompt, echo);
|
mainWindow->setPrompt(prompt, echo);
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow->setFixedSize(mainWindow->width(),mainWindow->height());
|
mainWindow->setFixedSize(mainWindow->width(),mainWindow->height());
|
||||||
|
|
||||||
|
/* set the position of the mainwindow */
|
||||||
|
QPoint pos = QCursor::pos();
|
||||||
|
QRect desScreenGeometry;
|
||||||
|
for (QScreen *screen : qApp->screens()) {
|
||||||
|
if (screen->geometry().contains(pos)) {
|
||||||
|
desScreenGeometry = screen->geometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desScreenGeometry.isEmpty()) {
|
||||||
|
desScreenGeometry = qApp->primaryScreen()->geometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
kdk::WindowManager::setGeometry(mainWindow->windowHandle(),
|
||||||
|
QRect(desScreenGeometry.left() + (desScreenGeometry.width() - mainWindow->width())/2,
|
||||||
|
desScreenGeometry.top() + (desScreenGeometry.height() - mainWindow->height())/2,
|
||||||
|
mainWindow->width(), mainWindow->height()));
|
||||||
|
|
||||||
mainWindow->show();
|
mainWindow->show();
|
||||||
// 重新开始认证不调整窗口位置
|
// 重新开始认证不调整窗口位置
|
||||||
// QPoint pos = QCursor::pos();
|
// QPoint pos = QCursor::pos();
|
||||||
|
|
Loading…
Reference in New Issue