diff --git a/bioauth-bin/src/main.cpp b/bioauth-bin/src/main.cpp index 81ffdb4..a88dfe8 100644 --- a/bioauth-bin/src/main.cpp +++ b/bioauth-bin/src/main.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -38,7 +39,7 @@ bool enableDebug; QString logPrefix; - +BioAuth bioAuth; enum MsgType { START, @@ -241,6 +242,13 @@ DeviceInfo showDevices(const QMap> &devicesMap) return DeviceInfo(); } +static void signal_handler(int signo) +{ + if (signo == SIGHUP) { + bioAuth.stopAuth(); + } +} + int main(int argc, char *argv[]) { QCoreApplication::setSetuidAllowed(true); @@ -310,7 +318,8 @@ int main(int argc, char *argv[]) showMessage(QObject::tr("Press Q or Esc to cancel"), PROMPT); } - BioAuth bioAuth(uid, deviceInfo); + bioAuth.setUid(uid); + bioAuth.setDevice(deviceInfo); KeyWatcher watcher; QMap m_failedTimes; @@ -403,7 +412,7 @@ int main(int argc, char *argv[]) bioAuth.startAuth(); - if(!isHiddenSwitchButton){ + if (!isHiddenSwitchButton) { QObject::connect(&watcher, &KeyWatcher::exit, &a, [&]{ showMessage(QObject::tr("AUTHENTICATION CANCELED"), START); bioAuth.stopAuth(); @@ -411,6 +420,7 @@ int main(int argc, char *argv[]) }); } watcher.start(); + signal(SIGHUP, signal_handler); return a.exec(); } diff --git a/bioauth/include/bioauth.h b/bioauth/include/bioauth.h index 477d3b3..bc7d325 100644 --- a/bioauth/include/bioauth.h +++ b/bioauth/include/bioauth.h @@ -36,6 +36,7 @@ public: explicit BioAuth(QObject *parent = nullptr); ~BioAuth(); void setDevice(const DeviceInfoPtr deviceInfo); + void setUid(qint32 uid); DeviceInfoPtr getDevice(); void startAuth(); void startUkeyAuth(); @@ -59,7 +60,6 @@ public: */ bool GetHasUkeyFeature(int uid, int indexStart = 0, int indexEnd = -1); - signals: void authComplete(int uid, bool result, int retErrNo); void authFinished(); diff --git a/bioauth/include/loginoptionswidget.h b/bioauth/include/loginoptionswidget.h index dbbe1af..cc8920f 100644 --- a/bioauth/include/loginoptionswidget.h +++ b/bioauth/include/loginoptionswidget.h @@ -97,6 +97,10 @@ public: void SetExtraInfo(QString extra_info,QString info_type); bool getHasUkeyOptions(); void setSelectedPassword(); + + // 设置所有生物识别的禁用状态 + void setAllDeviceDisable(bool bDisable = true); + public slots: void readDevicesInfo(); void onIdentifyComplete(int uid, bool ret, int retErrNo); diff --git a/bioauth/src/bioauth.cpp b/bioauth/src/bioauth.cpp index 98143e6..076f282 100644 --- a/bioauth/src/bioauth.cpp +++ b/bioauth/src/bioauth.cpp @@ -61,6 +61,11 @@ void BioAuth::setDevice(const DeviceInfoPtr deviceInfo) this->deviceInfo = deviceInfo; } +void BioAuth::setUid(qint32 uid) +{ + this->uid = uid; +} + void BioAuth::startUkeyAuth() { // stopAuth(); @@ -209,7 +214,6 @@ void BioAuth::onIdentityComplete(QDBusPendingCallWatcher *watcher) /* 识别生物特征成功,发送认证结果 */ if(isInAuthentication){ - isInAuthentication = false; if(result == DBUS_RESULT_SUCCESS && retUid == uid){ diff --git a/bioauth/src/loginoptionswidget.cpp b/bioauth/src/loginoptionswidget.cpp index bc54363..31cd214 100644 --- a/bioauth/src/loginoptionswidget.cpp +++ b/bioauth/src/loginoptionswidget.cpp @@ -570,7 +570,9 @@ void LoginOptionsWidget::onIdentifyComplete(int uid, bool ret, int retErrNo) qDebug()<<"StatusReslut:"<::iterator itMapBtn = m_mapOptBtns.begin(); + for (; itMapBtn != m_mapOptBtns.end(); itMapBtn++) { + + m_mapDisableDev[m_uid][itMapBtn.key()] = true; + if (itMapBtn.value()) { + itMapBtn.value()->setDisabled(true); + } + } + } else { + QMap::iterator itMapBtn = m_mapOptBtns.begin(); + for (; itMapBtn != m_mapOptBtns.end(); itMapBtn++) { + m_mapDisableDev[m_uid][itMapBtn.key()] = false; + if (itMapBtn.value()) { + itMapBtn.value()->setDisabled(false); + } + } + } +} + bool LoginOptionsWidget::isDeviceDisable(int nDevId) { if (m_mapDisableDev[m_uid].contains(nDevId)) { diff --git a/debian/changelog b/debian/changelog index fe05324..aab73ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +ukui-biometric-auth (4.10.0.0-ok10) nile; urgency=medium + + * BUG号:无 + * 需求号:无 + * 其他改动说明:补充部分哈柯语言翻译 + * 其他改动影响域:无 + + -- Yang Min Wed, 13 Nov 2024 19:45:42 +0800 + ukui-biometric-auth (4.10.0.0-ok9.1) nile; urgency=medium * BUG号:#I9RPVW [维吾尔语】启动指纹驱动时窗口提示语未适配 diff --git a/debian/control b/debian/control index 31e5126..3d6d0a3 100644 --- a/debian/control +++ b/debian/control @@ -16,6 +16,7 @@ Build-Depends: cmake (>= 2.6), qttools5-dev, qttools5-dev-tools, libkysdk-sysinfo-dev, + libkysdk-qtwidgets-dev, libukui-log4qt-dev, libssl-dev, liblightdm-qt5-3-dev, diff --git a/pam-biometric/data/org.freedesktop.plicykit.pkexec.bioctl-helper.policy.in b/pam-biometric/data/org.freedesktop.plicykit.pkexec.bioctl-helper.policy.in index 9ce5d1a..415e7cc 100644 --- a/pam-biometric/data/org.freedesktop.plicykit.pkexec.bioctl-helper.policy.in +++ b/pam-biometric/data/org.freedesktop.plicykit.pkexec.bioctl-helper.policy.in @@ -11,12 +11,16 @@ ᠠᠵᠢᠯᠯᠠᠭᠠᠨ ᠤ ᠠᠮᠢᠳᠤ ᠪᠣᠳᠠᠰ ᠢ ᠢᠯᠭᠠᠨ ᠲᠠᠨᠢᠵᠤ ᠭᠡᠷᠡᠴᠢᠯᠡᠬᠦ ᠡᠵᠡᠮᠳᠡᠯ ᠦᠨ ᠪᠠᠭᠠᠵᠢ ᠶᠢ ᠢᠯᠭᠠᠨ ᠲᠠᠨᠢᠬᠤ ᠬᠡᠷᠡᠭᠲᠡᠶ ᠃ 運行生物識別認證控制工具 بىئولوگىيەلىك پەرقلەندۈرۈش ئىسپاتلاش كونترول قىلىش قورالى + بىئولوگىيەلىك پارىقتاندىرۋ سپاتتاۋ مەڭگەرۋ ەتۋ قۇرالى + بىئولوگىيەلىك ايىرمالاندىرىش ىسپاتتوو تىزگىندۅۅ جاسوو ،اتقارۇۇ قۇرالى Authentication is required to enable or disable biometric authentication 开启或关闭生物识别认证需要进行身份验证 སྒོ་རྒྱག་པའམ་ཡང་ན་སྒོ་རྒྱག་པའི་སྐྱེ་དངོས་ངོས་འཛིན་བདེན་དཔངར་སྤྲོད་བྱེད་པར་ཐོབ་ཐང་གི་ཚོད་ལྟསར་སྤྲོད་བྱ་དགོས། ᠠᠮᠢᠳᠤ ᠪᠣᠳᠠᠰ ᠢ ᠢᠯᠭᠠᠨ ᠲᠠᠨᠢᠬᠤ ᠭᠡᠷᠡᠴᠢᠯᠡᠭᠡ ᠶᠢ ᠨᠡᠭᠡᠭᠡᠬᠦ ᠪᠤᠶᠤ ᠬᠠᠭᠠᠬᠤ ᠳᠤ ᠪᠡᠶ᠎ᠡ ᠶᠢᠨ ᠭᠠᠷᠤᠯ ᠤᠨ ᠭᠡᠷᠡᠴᠢᠯᠡᠯ ᠬᠢᠬᠦ ᠴᠢᠬᠤᠯᠠ ᠲᠠᠶ ᠪᠠᠶᠢᠨ᠎ᠠ᠃ 開啟或關閉生物識別認證需要進行身份驗證 بىئولوگىيەلىك پەرقلەندۈرۈش ئىسپاتىنى ئېچىش ياكى تاقاش ئۈچۈن دەلىللەش كېرەك + بىئولوگىيەلىك پارىقتاندىرۋ سىپاتىن ٸشٸۋ ياكي تاقاۋ ٷشٸن دالەلدەۋ كەرەك + بىئولوگىيەلىك ايىرمالاندىرىش دالىلىن اچۇۇ كۅرۉنۉشتۅرۉ بەكىتىش ۉچۉن دالىلدۅ كەرەك stock_person no diff --git a/pam-biometric/data/org.freedesktop.plicykit.pkexec.biodrvctl.policy.in b/pam-biometric/data/org.freedesktop.plicykit.pkexec.biodrvctl.policy.in index 2155e5b..476cb88 100644 --- a/pam-biometric/data/org.freedesktop.plicykit.pkexec.biodrvctl.policy.in +++ b/pam-biometric/data/org.freedesktop.plicykit.pkexec.biodrvctl.policy.in @@ -11,12 +11,16 @@ ᠠᠮᠢᠳᠤ ᠪᠣᠳᠠᠰ ᠢ ᠢᠯᠭᠠᠨ ᠲᠠᠨᠢᠬᠤ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢ ᠪᠡᠷ ᠬᠥᠳᠡᠯᠭᠡᠭᠦᠷ ᠪᠣᠯᠭᠠᠬᠤ ᠡᠵᠡᠮᠳᠡᠯ ᠦᠨ ᠪᠠᠭᠠᠵᠢ ᠶᠢ ᠠᠵᠢᠯᠯᠠᠭᠤᠯᠤᠨ᠎ᠠ ᠃ 運行生物識別設備驅動控制工具 بىئولوگىيەلىك پەرقلەندۈرۈش ئۈسكۈنىسىنى قوزغىتىش كونترول قىلىش ئەسۋابىنى يۈرگۈزۈش + شايمانىن جۉرگۅزۉ + شايمانىن جۉرگۅزۉ Authentication is required to change the status of biometric device's driver 改变生物识别设备驱动状态需要进行身份验证 སྐྱ་དངོས་དབྱེ་འབྱེད་སྒྲག་ཆས་ཀྱི་ཁ་ལོ་བའི་གནས་ཚུལ་ལ་འགྱུར་ལྡོག་གཏོང་བར་བདེན་དཔང་ར་སྤྲད་བྱ་དགོས། ᠠᠮᠢᠳᠤ ᠪᠣᠳᠠᠰ ᠢ ᠢᠯᠭᠠᠨ ᠲᠠᠨᠢᠬᠤ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢ ᠶᠢᠨ ᠬᠥᠳᠡᠯᠭᠡᠭᠦᠷ ᠪᠣᠯᠭᠠᠬᠤ ᠪᠠᠶᠢᠳᠠᠯ ᠢ ᠬᠤᠪᠢᠷᠠᠭᠤᠯᠬᠤ ᠳᠤ ᠪᠡᠶ᠎ᠡ ᠶᠢᠨ ᠭᠠᠷᠤᠯ ᠤᠨ ᠭᠡᠷᠡᠴᠢᠯᠡᠯ ᠬᠢᠬᠦ ᠴᠢᠬᠤᠯᠠ ᠲᠠᠶ ᠪᠠᠶᠢᠬᠤ ᠬᠡᠷᠡᠭᠲᠡᠶ᠃ 改變生物識別設備驅動狀態需要進行身份驗證 بىئولوگىيەلىك پەرقلەندۈرۈش ئۈسكۈنىسىنىڭ قوزغىتىش ھالىتىنى ئۆزگەرتىشتە دەلىللەش كېرەك + بىئولوگىيەلىك پارىقتاندىرۋ اسپابىنىڭ قوزعالتۋ كۇيىن وزگەتۋگە دالەلدەۋ كەرەك + بىئولوگىيەلىك ايىرمالاندىرىش شايمانىنىن قوزعوتۇۇ ابالىن ۅزگۅرتۉۉدۅ دالىلدۅ كەرەك stock_person auth_admin diff --git a/pam-biometric/data/org.freedesktop.plicykit.pkexec.biorestart.policy.in b/pam-biometric/data/org.freedesktop.plicykit.pkexec.biorestart.policy.in index 8d83424..a5f82f3 100644 --- a/pam-biometric/data/org.freedesktop.plicykit.pkexec.biorestart.policy.in +++ b/pam-biometric/data/org.freedesktop.plicykit.pkexec.biorestart.policy.in @@ -12,11 +12,15 @@ Authentication is required to restart biometric service 重啟生物特徵服務 بىئولوگىيەلىك ئالاھىدىلىك مۇلازىمىتىنى قايتىدىن قوزغىتىش + بىئولوگىيەلىك ەرەكشەلىك قىزىمەتتى قايتادان قوزعالتۋ + بىئولوگىيەلىك ۅزگۅچۅلۉك مۇلازىمەتىردى قايتادان قوزعوتۇۇ 重启生物特征服务需要身份验证 སྐྱ་དངོས་དབྱེ་འབྱེད་ཞབས་ཞུ་སླར་གསོ་བྱེད་པར་བདེན་དཔང་ར་སྤྲད་བྱ་དགོས། ᠠᠮᠢᠳᠤ ᠪᠣᠳᠠᠰ ᠤᠨ ᠣᠨᠴᠠᠯᠢᠭ ᠰᠢᠨᠵᠢ ᠲᠡᠮᠳᠡᠭ ᠦᠨ ᠦᠢᠯᠡᠴᠢᠯᠡᠭᠡ ᠶᠢ ᠳᠠᠬᠢᠨ ᠰᠡᠩᠬᠡᠷᠡᠭᠦᠯᠬᠦ ᠳᠦ ᠪᠡᠶ᠎ᠡ ᠶᠢᠨ ᠭᠠᠷᠤᠯ ᠢ ᠰᠢᠯᠭᠠᠨ ᠭᠡᠷᠡᠴᠢᠯᠡᠬᠦ ᠴᠢᠬᠤᠯᠠ ᠲᠠᠶ ᠪᠠᠶᠢᠨ᠎ᠠ ᠃ بىئولوگىيەلىك ئالاھىدىلىك مۇلازىمىتىنى قايتىدىن قوزغىتىش ئۈچۈن دەلىللەش كېرەك 重啟生物特徵服務需要身份驗證 + بىئولوگىيەلىك ەرەكشەلىك قىزىمەتتى قايتادان قوزعالتۋ ٷشٸن دالەلدەۋ كەرەك بىئولوگىيەلىك پارىقتاندىرۋ اسبابٸن قوزعالتۋ مەڭگەرۋ ەتۋ اسپاپتى جۇرگىزۋ + بىئولوگىيەلىك ۅزگۅچۅلۉك مۇلازىمەتىردى قايتادان قوزعوتۇۇ ۉچۉن دالىلدۅ كەرەك بىئولوگىيەلىك ايىرمالاندىرىش جابدۇۇسۇن قوزعوتۇۇ تىزگىندۅۅ جاسوو ،اتقارۇۇ stock_person auth_admin diff --git a/polkit-agent/CMakeLists.txt b/polkit-agent/CMakeLists.txt index cb8e3e9..2f97cad 100644 --- a/polkit-agent/CMakeLists.txt +++ b/polkit-agent/CMakeLists.txt @@ -3,7 +3,8 @@ project(ukui-polkit-agent) pkg_check_modules(QGS REQUIRED gsettings-qt) pkg_check_modules(KDKINFO REQUIRED kysdk-sysinfo) -pkg_check_modules(KYSDKWAYLANDHELPER_PKG REQUIRED kysdk-waylandhelper) +pkg_check_modules(KDKWIDGETS REQUIRED kysdk-qtwidgets) +pkg_check_modules(KYSDKWAYLANDHELPER REQUIRED kysdk-waylandhelper) find_package(PolkitQt5-1 REQUIRED 0.103.0) find_package(Qt5 COMPONENTS Core Widgets DBus X11Extras Xml Network Svg) @@ -23,16 +24,22 @@ configure_file( include_directories( ${QGS_INCLUDE_DIRS} ${KDKINFO_INCLUDE_DIRS} + ${KDKWIDGETS_INCLUDE_DIRS} + ${KYSDKWAYLANDHELPER_INCLUDE_DIRS} ) link_directories( ${KDKINFO_LIBRARY_DIRS} + ${KDKWIDGETS_LIBRARY_DIRS} + ${KYSDKWAYLANDHELPER_LIBRARY_DIRS} ) set(EXTRA_LIBS ${EXTRA_LIBS} ${QGS_LIBRARIES} ${KDKINFO_LIBRARIES} + ${KDKWIDGETS_LIBRARIES} + ${KYSDKWAYLANDHELPER_LIBRARIES} ) include_directories( @@ -58,17 +65,20 @@ set(polkit_SRCS src/modeButton.cpp src/kalabel.cpp ../common/generic.cpp + src/fullscreenbackground.h + src/fullscreenbackground.cpp + src/usdblockshortcut.h + src/usdblockshortcut.cpp ) 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_include_directories(polkit-ukui-authentication-agent-1 PRIVATE ${KYSDKQTWIDGETS_PKG_INCLUDE_DIRS}) +target_link_directories(polkit-ukui-authentication-agent-1 PRIVATE ${KYSDKQTWIDGETS_PKG_LIBRARY_DIRS}) target_link_libraries(polkit-ukui-authentication-agent-1 - Qt5::Core Qt5::Widgets Qt5::DBus ${EXTRA_LIBS} + Qt5::Core Qt5::Widgets Qt5::DBus ${EXTRA_LIBS} KF5::WindowSystem ${POLKITQT-1_LIBRARIES} - ${KYSDKWAYLANDHELPER_PKG_LIBRARIES} + ${KYSDKQTWIDGETS_PKG_LIBRARIES} BioAuthWidgets - KF5::WindowSystem -lrt -lukui-log4qt ) diff --git a/polkit-agent/i18n_ts/bo.ts b/polkit-agent/i18n_ts/bo.ts index 50e8ba8..f19a661 100644 --- a/polkit-agent/i18n_ts/bo.ts +++ b/polkit-agent/i18n_ts/bo.ts @@ -1,6 +1,14 @@ + + FullScreenBackground + + + Authentication + + + MainWindow @@ -10,8 +18,8 @@ - - + + Biometric @@ -22,192 +30,201 @@ - + Cancel - + Authenticate - + Authentication - + Insert the ukey into the USB port - + Enter the ukey password - - - + + Close + + + + + + Failed to verify %1, please enter password to unlock - - - + + + Unable to verify %1, please enter password to unlock - - + + Failed to verify %1, you still have %2 verification opportunities - + + Acquisition failure + + + + Please enter your password or enroll your fingerprint - + This operation requires the administrator's authorization. Please enter your password to allow this operation. - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. - + Password: - + _Password: - + _Password: - - - - + + + + Account locked, - + days left - + hours left - + minutes left - + seconds left - - + + Password cannot be empty - - + + Input your password to authentication - - + Use password - - - + + + Please try again in %1 minutes. - - - + + + Please try again in %1 seconds. - - - - + + + + Account locked permanently. - + Verify face recognition or enter password to unlock - + Press fingerprint or enter password to unlock - + Verify voiceprint or enter password to unlock - + Verify finger vein or enter password to unlock - + Verify iris or enter password to unlock - + Use the bound wechat scanning code or enter the password to unlock - - + + Input Password - + Abnormal network - + Authentication failed, please try again. @@ -215,17 +232,17 @@ PolkitListener - + Another client is already authenticating, please try again later. - + Authentication failure, please try again. - + Password input error! diff --git a/polkit-agent/i18n_ts/bo_CN.ts b/polkit-agent/i18n_ts/bo_CN.ts index e0a54e7..f26cc26 100644 --- a/polkit-agent/i18n_ts/bo_CN.ts +++ b/polkit-agent/i18n_ts/bo_CN.ts @@ -51,6 +51,14 @@ 二维码 + + FullScreenBackground + + + Authentication + དབང་བསྐུར། + + LoginOptionsWidget @@ -65,7 +73,7 @@ MainWindow - + Authentication དབང་བསྐུར། @@ -92,8 +100,8 @@ - - + + Biometric སྐྱེ་དངོས་དབྱེ་འབྱེད་བཀོལ་བ། @@ -148,19 +156,18 @@ - + Cancel ཕྱིར་འཐེན། - + Authenticate དབང་བསྐུར་བ། - - + Use password གསང་གྲངས་བེད་སྤྱོད་བྱ་དགོས། @@ -185,30 +192,30 @@ 认证中,请稍等... - - - + + + Please try again in %1 minutes. %1ཡང་བསྐྱར་ཚོད་ལྟ་ཞིག་བྱེད་རོགས། - - - + + + Please try again in %1 seconds. ཁྱོད་ཀྱིས་དུས་ཚོད་སྐར་ཆ་གཅིག་གི་ནང་དུ་ཡང་བསྐྱར་ཚོད་ལྟ་ཞིག་བྱེད་རོགས། - - - - + + + + Account locked permanently. དུས་གཏན་དུ་ཟྭ་བརྒྱབ་པའི་རྩིས་ཐོ། - - + + Password cannot be empty གསང་གྲངས་སྟོང་པ་ཡིན་མི་སྲིད། @@ -221,8 +228,8 @@ 无法验证%1,请输入密码. - - + + Failed to verify %1, you still have %2 verification opportunities %1ལ་ཞིབ་བཤེར་བྱེད་མ་ཐུབ་ན། ཁྱེད་ཚོར་ད་དུང་%2ལ་ཞིབ་བཤེར་བྱེད་པའི་གོ་སྐབས་ཡོད། @@ -231,42 +238,42 @@ 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作。 - + Password: གསང་གྲངས་ནི། - + Please enter your password or enroll your fingerprint ཁྱེད་ཀྱི་གསང་གྲངས་ནང་འཇུག་བྱེད་པའམ་ཡང་ན་ཁྱེད་ཀྱི་མཛུབ་རིས་ནང་འཇུག་བྱེད་པ། - + Abnormal network རྒྱུན་ལྡན་མིན་པའི་དྲ་བ། - + This operation requires the administrator's authorization. Please enter your password to allow this operation. ཐེངས་འདིའི་བཀོལ་སྤྱོད་ལ་དོ་དམ་པའི་དབང་ཆ་ཐོབ་ན་ད་གཟོད་མུ་མཐུད་དུ་ལག་བསྟར་བྱེད་ཐུབ།གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཐེངས་འདིའི་བཀོལ་སྤྱོད་བྱེད་ཆོག - + _Password: གསང་གྲངས། - + _Password: གསང་གྲངས།: - + Authentication failed, please try again. བདེན་དཔང་ར་སྤྲོད་ལ་ཕམ་ཁ་བྱུང་བས་ཡང་བསྐྱར་ཚོད་ལྟ་བྱོས། - + days left གནམ་རྒྱབ་ཟྭ་འབྱེད། @@ -279,16 +286,16 @@ 生物/扫码验证失败,您还有%1次尝试机会 - - - + + + Failed to verify %1, please enter password to unlock %1ལ་ཞིབ་བཤེར་བྱེད་མ་ཐུབ་ན། གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཟྭ་རྒྱག་རོགས། - - - + + + Unable to verify %1, please enter password to unlock %1ལ་ཞིབ་བཤེར་བྱེད་ཐབས་བྲལ་བ་དང་། གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཟྭ་རྒྱག་རོགས། @@ -297,74 +304,84 @@ 网络异常 - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. གོ་རིམ་ཞིག་གིས་ཁྱད་དབང་དགོས་པའི་འགུལ་སྟངས་ཤིག་ལག་བསྟར་བྱེད་པར་ཚོད་ལྟ་བྱེད་བཞིན་ཡོད་པ་དང་།་འགུལ་སྟངས་འདི་ལག་བསྟར་བྱེད་པའི་དབང་ཆ་སྤྲོད་དགོས་པའི་རེ་བ་བཏོན། - - + + Input Password ནང་འཇུག་གི་གསང་གྲངས། - + Insert the ukey into the USB port བདེ་འཇགས་ཀྱི་གསང་བའི་ལྡེ་མིག་དེ་USBཡི་སྣེ་འདྲེན་དུ་འཇུག་རོགས། - + Enter the ukey password གསང་བའི་ཨང་གྲངས་ནང་འཇུག་བྱེད་པ། - + + Close + སྒོ་རྒྱག་པ་ + + + + Acquisition failure + ཕམ་ཉེས་བྱུང་བ་རེད + + + hours left དུས་ཚོད་འགའ་ལས་ལྷག་མེད - + minutes left སྐར་མ་རྗེས་ནས་ཟྭ་ཕྱེ། - + seconds left སྐར་ཆའི་རྗེས་ནས་ཟྭ་ཕྱེ་བ། - - + + Input your password to authentication གསང་བའི་ཨང་གྲངས་ནང་འཇུག་བྱེད་དབང་ཡོད། - + Verify face recognition or enter password to unlock དཔང་མིའི་གདོང་ལ་ཞིབ་བཤེར་བྱེད་པའམ་ཡང་ན་གསང་གྲངས་བསྣན་ནས་ཟྭ་འབྱེད་པ། - + Press fingerprint or enter password to unlock མཛུབ་རིས་མནན་པའམ་ཡང་ན་གསང་གྲངས་བསྣན་ནས་ཟྭ་འབྱེད་པ། - + Verify voiceprint or enter password to unlock སྒྲ་རིས་ར་སྤྲོད་བྱེད་པའམ་ཡང་ན་གསང་གྲངས་བསྣན་ནས་ཟྭ་འབྱེད་པ། - + Verify finger vein or enter password to unlock ཚོད་ལྟས་ར་སྤྲོད་བྱེད་པ་ནི་སྡོད་རྩ་དང་གསང་གྲངས་བསྣན་ནས་ཟྭ་འབྱེད་པ་དེ་ཡིན། - + Verify iris or enter password to unlock འཇའ་སྐྱི་ར་སྤྲོད་བྱེད་པའམ་ཡང་ན་གསང་གྲངས་བསྣན་ནས་ཟྭ་འབྱེད་པ། - + Use the bound wechat scanning code or enter the password to unlock སྦྲེལ་ཡོད་པའི་སྐད་འཕྲིན་གྱི་ཨང་གྲངས་སམ་གསང་གྲངས་བསྣན་ནས་ཟྭ་འབྱེད་དགོས། @@ -373,10 +390,10 @@ 使用绑定的微信扫码或输入密码登录 - - - - + + + + Account locked, རྩིས་ཐོ་ཟྭ་བརྒྱབ་པ། @@ -388,17 +405,17 @@ PolkitListener - + Another client is already authenticating, please try again later. མཁོ་མཁན་གཞན་པ་ཞིག་གིས་བདེན་དཔང་ར་སྤྲོད་བྱེད་བཞིན་ཡོད།ཅུང་ཙམ་འགོར་རྗེས་ཡང་བསྐྱར་ཚོད་ལྟ་བྱོས། - + Authentication failure, please try again. བདེན་དཔང་ར་སྤྲོད་བྱེད་མ་ཐུབ་ན་ཁྱེད་ཀྱིས་ཡང་བསྐྱར་ཚོད་ལྟ་བྱེད། - + Password input error! གསང་གྲངས་ནང་འཇུག་ནོར་འཁྲུལ་བྱུང་བ་རེད། diff --git a/polkit-agent/i18n_ts/de.ts b/polkit-agent/i18n_ts/de.ts index 8521a6d..a343cdd 100644 --- a/polkit-agent/i18n_ts/de.ts +++ b/polkit-agent/i18n_ts/de.ts @@ -51,6 +51,14 @@ 二维码 + + FullScreenBackground + + + Authentication + Authentifizierung + + LoginOptionsWidget @@ -65,7 +73,7 @@ MainWindow - + Authentication Authentifizierung @@ -92,8 +100,8 @@ - - + + Biometric Biometrisch @@ -148,19 +156,18 @@ - + Cancel Abbrechen - + Authenticate Beglaubigen - - + Use password Passwort verwenden @@ -185,30 +192,30 @@ 认证中,请稍等... - - - + + + Please try again in %1 minutes. Versuchen Sie es in %1 Minuten erneut. - - - + + + Please try again in %1 seconds. Bitte versuchen Sie es in %1 Sekunden erneut. - - - - + + + + Account locked permanently. Das Konto wurde dauerhaft gesperrt. - - + + Password cannot be empty Das Kennwort darf nicht leer sein. @@ -221,8 +228,8 @@ 无法验证%1,请输入密码. - - + + Failed to verify %1, you still have %2 verification opportunities %1 konnte nicht verifiziert werden, Sie haben immer noch %2 Überprüfungsmöglichkeiten @@ -231,42 +238,42 @@ 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作。 - + Password: Passwort: - + Please enter your password or enroll your fingerprint Bitte geben Sie Ihr Passwort ein oder registrieren Sie Ihren Fingerabdruck - + Abnormal network Ungewöhnliches Netzwerk - + This operation requires the administrator's authorization. Please enter your password to allow this operation. Für diesen Vorgang ist die Autorisierung des Administrators erforderlich. Bitte geben Sie Ihr Passwort ein, um diesen Vorgang zuzulassen. - + _Password: _Passwort: - + _Password: _Passwort: - + Authentication failed, please try again. Authentifizierung fehlgeschlagen, bitte versuchen Sie es erneut. - + days left Verbleibende Tage @@ -279,16 +286,16 @@ 生物/扫码验证失败,您还有%1次尝试机会 - - - + + + Failed to verify %1, please enter password to unlock %1 konnte nicht verifiziert werden, bitte geben Sie das Kennwort zum Entsperren ein - - - + + + Unable to verify %1, please enter password to unlock %1 kann nicht verifiziert werden, bitte geben Sie das Kennwort zum Entsperren ein @@ -297,74 +304,84 @@ 网络异常 - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. Ein Programm versucht, eine Aktion auszuführen, für die Berechtigungen erforderlich sind. Zum Ausführen der Aktion ist eine Autorisierung erforderlich. - - + + Input Password Passwort eingeben - + Insert the ukey into the USB port - + Enter the ukey password - + + Close + + + + + Acquisition failure + + + + hours left Verbleibende Stunden - + minutes left Noch Minuten - + seconds left Verbleibende Sekunden - - + + Input your password to authentication - + Verify face recognition or enter password to unlock Überprüfen Sie die Gesichtserkennung oder geben Sie das Passwort ein, um zu entsperren - + Press fingerprint or enter password to unlock Drücken Sie den Fingerabdruck oder geben Sie das Passwort ein, um zu entsperren - + Verify voiceprint or enter password to unlock Überprüfen Sie den Stimmabdruck oder geben Sie das Passwort ein, um zu entsperren - + Verify finger vein or enter password to unlock Überprüfen Sie die Fingervene oder geben Sie das Passwort ein, um zu entsperren - + Verify iris or enter password to unlock Überprüfen Sie die Iris oder geben Sie das Passwort ein, um zu entsperren - + Use the bound wechat scanning code or enter the password to unlock Verwenden Sie den gebundenen Wechat-Scan-Code oder geben Sie das Passwort zum Entsperren ein @@ -373,10 +390,10 @@ 使用绑定的微信扫码或输入密码登录 - - - - + + + + Account locked, Konto gesperrt, @@ -388,17 +405,17 @@ PolkitListener - + Another client is already authenticating, please try again later. Ein anderer Client authentifiziert sich bereits, bitte versuchen Sie es später noch einmal. - + Authentication failure, please try again. Authentifizierungsfehler, bitte versuchen Sie es erneut. - + Password input error! Fehler bei der Passworteingabe! diff --git a/polkit-agent/i18n_ts/es.ts b/polkit-agent/i18n_ts/es.ts index 133ff59..5f76d62 100644 --- a/polkit-agent/i18n_ts/es.ts +++ b/polkit-agent/i18n_ts/es.ts @@ -51,6 +51,14 @@ 二维码 + + FullScreenBackground + + + Authentication + Autenticación + + LoginOptionsWidget @@ -65,7 +73,7 @@ MainWindow - + Authentication Autenticación @@ -92,8 +100,8 @@ - - + + Biometric Biométrico @@ -148,19 +156,18 @@ - + Cancel Cancelar - + Authenticate Autentificar - - + Use password Usar contraseña @@ -185,30 +192,30 @@ 认证中,请稍等... - - - + + + Please try again in %1 minutes. Inténtelo de nuevo en %1 minutos. - - - + + + Please try again in %1 seconds. Inténtelo de nuevo en %1 segundos. - - - - + + + + Account locked permanently. Cuenta bloqueada permanentemente. - - + + Password cannot be empty La contraseña no puede estar vacía @@ -221,8 +228,8 @@ 无法验证%1,请输入密码. - - + + Failed to verify %1, you still have %2 verification opportunities No se pudo verificar %1, todavía tiene %2 oportunidades de verificación @@ -231,42 +238,42 @@ 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作。 - + Password: Contraseña: - + Please enter your password or enroll your fingerprint Ingrese su contraseña o registre su huella dactilar - + Abnormal network Red anormal - + This operation requires the administrator's authorization. Please enter your password to allow this operation. Esta operación requiere la autorización del administrador. Introduzca su contraseña para permitir esta operación. - + _Password: _Contraseña: - + _Password: _Contraseña: - + Authentication failed, please try again. Error de autenticación, inténtelo de nuevo. - + days left Días restantes @@ -279,16 +286,16 @@ 生物/扫码验证失败,您还有%1次尝试机会 - - - + + + Failed to verify %1, please enter password to unlock No se pudo verificar %1, ingrese la contraseña para desbloquear - - - + + + Unable to verify %1, please enter password to unlock No se puede verificar %1, ingrese la contraseña para desbloquear @@ -297,74 +304,84 @@ 网络异常 - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. Un programa está intentando realizar una acción que requiere privilegios. Requiere autorización para realizar la acción. - - + + Input Password Contraseña de entrada - + Insert the ukey into the USB port - + Enter the ukey password - + + Close + + + + + Acquisition failure + + + + hours left horas restantes - + minutes left Quedan minutos - + seconds left segundos restantes - - + + Input your password to authentication - + Verify face recognition or enter password to unlock Verifique el reconocimiento facial o ingrese la contraseña para desbloquear - + Press fingerprint or enter password to unlock Presione la huella dactilar o ingrese la contraseña para desbloquear - + Verify voiceprint or enter password to unlock Verifica la huella de voz o ingresa la contraseña para desbloquear - + Verify finger vein or enter password to unlock Verifique la vena del dedo o ingrese la contraseña para desbloquear - + Verify iris or enter password to unlock Verifique el iris o ingrese la contraseña para desbloquear - + Use the bound wechat scanning code or enter the password to unlock Use el código de escaneo de wechat vinculado o ingrese la contraseña para desbloquear @@ -373,10 +390,10 @@ 使用绑定的微信扫码或输入密码登录 - - - - + + + + Account locked, Cuenta bloqueada, @@ -388,17 +405,17 @@ PolkitListener - + Another client is already authenticating, please try again later. Otro cliente ya se está autenticando, inténtelo de nuevo más tarde. - + Authentication failure, please try again. Error de autenticación, inténtelo de nuevo. - + Password input error! ¡Error de entrada de contraseña! diff --git a/polkit-agent/i18n_ts/fr.ts b/polkit-agent/i18n_ts/fr.ts index 357fb71..d7a4286 100644 --- a/polkit-agent/i18n_ts/fr.ts +++ b/polkit-agent/i18n_ts/fr.ts @@ -51,6 +51,14 @@ 二维码 + + FullScreenBackground + + + Authentication + Authentification + + LoginOptionsWidget @@ -65,7 +73,7 @@ MainWindow - + Authentication Authentification @@ -92,8 +100,8 @@ - - + + Biometric Biométrique @@ -148,19 +156,18 @@ - + Cancel Annuler - + Authenticate Authentifier - - + Use password Utiliser le mot de passe @@ -185,30 +192,30 @@ 认证中,请稍等... - - - + + + Please try again in %1 minutes. Veuillez réessayer dans %1 minutes. - - - + + + Please try again in %1 seconds. Veuillez réessayer dans %1 secondes. - - - - + + + + Account locked permanently. Compte verrouillé définitivement. - - + + Password cannot be empty Le mot de passe ne peut pas être vide @@ -221,8 +228,8 @@ 无法验证%1,请输入密码. - - + + Failed to verify %1, you still have %2 verification opportunities Échec de la vérification %1, vous avez encore %2 possibilités de vérification @@ -231,42 +238,42 @@ 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作。 - + Password: Mot de passe: - + Please enter your password or enroll your fingerprint Veuillez saisir votre mot de passe ou enregistrer votre empreinte digitale - + Abnormal network Réseau anormal - + This operation requires the administrator's authorization. Please enter your password to allow this operation. Cette opération nécessite l’autorisation de l’administrateur. Veuillez saisir votre mot de passe pour autoriser cette opération. - + _Password: _Mot de passe: - + _Password: _Mot de passe: - + Authentication failed, please try again. L’authentification a échoué, veuillez réessayer. - + days left jours restants @@ -279,16 +286,16 @@ 生物/扫码验证失败,您还有%1次尝试机会 - - - + + + Failed to verify %1, please enter password to unlock Impossible de vérifier %1, veuillez entrer le mot de passe pour déverrouiller - - - + + + Unable to verify %1, please enter password to unlock Impossible de vérifier %1, veuillez entrer le mot de passe pour déverrouiller @@ -297,74 +304,84 @@ 网络异常 - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. Un programme tente d’effectuer une action qui nécessite des privilèges. Il nécessite une autorisation pour effectuer l’action. - - + + Input Password Mot de passe d’entrée - + Insert the ukey into the USB port - + Enter the ukey password - + + Close + + + + + Acquisition failure + + + + hours left Heures restantes - + minutes left minutes restantes - + seconds left secondes restantes - - + + Input your password to authentication - + Verify face recognition or enter password to unlock Vérifier la reconnaissance faciale ou saisir le mot de passe pour déverrouiller - + Press fingerprint or enter password to unlock Appuyez sur l’empreinte digitale ou entrez le mot de passe pour déverrouiller - + Verify voiceprint or enter password to unlock Vérifier l’empreinte vocale ou saisir le mot de passe pour déverrouiller - + Verify finger vein or enter password to unlock Vérifiez la veine du doigt ou entrez le mot de passe pour déverrouiller - + Verify iris or enter password to unlock Vérifiez l’iris ou entrez le mot de passe pour déverrouiller - + Use the bound wechat scanning code or enter the password to unlock Utilisez le code d’analyse wechat lié ou entrez le mot de passe pour déverrouiller @@ -373,10 +390,10 @@ 使用绑定的微信扫码或输入密码登录 - - - - + + + + Account locked, Compte verrouillé, @@ -388,17 +405,17 @@ PolkitListener - + Another client is already authenticating, please try again later. Un autre client est déjà en train de s’authentifier, veuillez réessayer plus tard. - + Authentication failure, please try again. Échec de l’authentification, veuillez réessayer. - + Password input error! Erreur de saisie du mot de passe ! diff --git a/polkit-agent/i18n_ts/kk.ts b/polkit-agent/i18n_ts/kk.ts index d112f69..c1ccfd9 100644 --- a/polkit-agent/i18n_ts/kk.ts +++ b/polkit-agent/i18n_ts/kk.ts @@ -51,6 +51,14 @@ 二维码 + + FullScreenBackground + + + Authentication + شىندىقتى دالەلدەۋ + + LoginOptionsWidget @@ -65,7 +73,7 @@ MainWindow - + Authentication شىندىقتى دالەلدەۋ @@ -92,8 +100,8 @@ - - + + Biometric بىئولەگىيەلىك ەرەكشەلىكتى ٸستەتۋ @@ -148,19 +156,18 @@ - + Cancel كۇشىنەن قالدىرۋ - + Authenticate ۇقىق بەرۋ - - + Use password قۇپيا نومەر ٸستەتۋ ارقىلى دالەلدەۋ @@ -185,30 +192,30 @@ 认证中,请稍等... - - - + + + Please try again in %1 minutes. ٪1 مينۋت ٸشٸندە قاتە سىناپ كور. - - - + + + Please try again in %1 seconds. ٪1 سەكونت ٸشٸندە قاتە سىناپ كور. - - - - + + + + Account locked permanently. ەسەپات ماڭگىلىك قۇلىپتالادى. - - + + Password cannot be empty قۇپيا نۇمىردى بوس قويۋعا بولمايدى @@ -221,8 +228,8 @@ 无法验证%1,请输入密码. - - + + Failed to verify %1, you still have %2 verification opportunities ٪1 نى دالەلدەۋ جەڭىلىپ قالدى، سىزدە جانەدە ٪2 دالەلدەۋ ورايى بار @@ -231,42 +238,42 @@ 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作。 - + Password: قۇپيا نومەر - + Please enter your password or enroll your fingerprint قۇپيا نۇمىرىڭىزدى كىرگىزىڭىز ياكي بارماقشى ئىزىڭىزنى تونۇتۇڭ - + Abnormal network بينورمال تور - + This operation requires the administrator's authorization. Please enter your password to allow this operation. نۇ جوبالاۋ باسقارعٸشتٸڭ ۇقىق بىرىستى تالاپ ىستەيدى.قۇپيا نۇمىردى كىرەۈزۈپ بي رەتكى جوبالاۋنىڭ الىپ بېرىلىشىغا جول قويىڭىز. - + _Password: قۇپيا نومەر - + _Password: قۇپيا نومەر - + Authentication failed, please try again. دالەلدەۋ جەڭىلىپ قالدى، قاتە سىناڭ - + days left 1 كۇننەن كەيىن سناپ كور @@ -279,16 +286,16 @@ 生物/扫码验证失败,您还有%1次尝试机会 - - - + + + Failed to verify %1, please enter password to unlock ٪1 نى دالەلدەۋ جەڭىلىپ قالدى، قۇپيا نومەر كىرگىزىڭىز - - - + + + Unable to verify %1, please enter password to unlock ٪1 نى دالەلدەۋگە امالسٸز، قۇپيا نۇمىردى كىرەۈزۈپ قۇلىبىن ٴٸشڭٸز @@ -297,74 +304,84 @@ 网络异常 - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. بٸر پٸروگٸرامما ۇقىق تالاپ ىستەيتىن ارەكەتتى ىستەۋگە ئۇرۇنماقتا. نۇ ارەكەتتى اتقار ەتۋ ٷشٸن ۇقىق تالاپ ىستەيدى. - - + + Input Password قۇپيا نومەر كىرگىزۋ - + Insert the ukey into the USB port ukey نى USB اۋزىنا چېتىپ قويىڭىز - + Enter the ukey password ukey قۇپيا نۇمىردى كىرگىزىڭىز - + + Close + + + + + Acquisition failure + + + + hours left بٸر ساعاتتان كەيىن اشٸلدٸ - + minutes left بٸر مينوتتىن كەيىن اشٸلدٸ - + seconds left بٸر سەكونتىن كەيىن اشٸلدٸ - - + + Input your password to authentication قۇپيا نۇمىردى كىرەۈزۈپ ازاماتتىق كۋالىك دالەلدەۋ. - + Verify face recognition or enter password to unlock چىراي تانىسن دالەلدەۋ ياكي قۇپيا نومەر كىرگىزۋ ارقىلى قۇلىپ ٸشٸۋ - + Press fingerprint or enter password to unlock بارماقشى ٴٸزدٸ باسٸۋ ياكي قۇپيا نومەر كىرگىزۋ ارقىلى قۇلىپ ٸشٸۋ - + Verify voiceprint or enter password to unlock اۋا ٴٸزدٸ دالەلدەۋ ياكي قۇپيا نومەر كىرگىزۋ ارقىلى قۇلىپ ٸشٸۋ - + Verify finger vein or enter password to unlock بارماقشى ٴٸزٸ ارقىلى انىقتاۋ ياكي قۇپيا نومەر كىرگىزۋ ارقىلى قۇلىپ ٸشٸۋ - + Verify iris or enter password to unlock Iris نى انىقتاۋ ياكي قۇپيا نومەر كىرگىزۋ ارقىلى قۇلىپ ٸشٸۋ - + Use the bound wechat scanning code or enter the password to unlock بايلانعان ئۈندىدارنى كەسكىندەۋ بەلگىسى ياكي قۇپيا نۇمىردى كىرەۈزۈپ قۇلىپ ٸشٸۋ @@ -373,10 +390,10 @@ 使用绑定的微信扫码或输入密码登录 - - - - + + + + Account locked, ٸستەتۋ نومەرىڭىز قۇلىپتانىپ قالدى @@ -388,17 +405,17 @@ PolkitListener - + Another client is already authenticating, please try again later. جانە بٸر قاريدار دالەلدەپ جاتىر، سەل تۇرٸپ قاتە سىناڭ. - + Authentication failure, please try again. دالەلدەۋ جەڭىلىپ قالدى، قاتە سىناڭ. - + Password input error! كىرگىزگەن قۇپيا نومەر قاتە قالدى diff --git a/polkit-agent/i18n_ts/ky.ts b/polkit-agent/i18n_ts/ky.ts index 8ccad26..66987e0 100644 --- a/polkit-agent/i18n_ts/ky.ts +++ b/polkit-agent/i18n_ts/ky.ts @@ -51,6 +51,14 @@ 二维码 + + FullScreenBackground + + + Authentication + راستىنى دالىلدۅ + + LoginOptionsWidget @@ -65,7 +73,7 @@ MainWindow - + Authentication راستىنى دالىلدۅ @@ -92,8 +100,8 @@ - - + + Biometric بىئولەگىيەلىك ۅزگۅچۅلۉگۉ ىشتەتىش @@ -148,19 +156,18 @@ - + Cancel ارعادان قالتىرىش - + Authenticate ۇقۇق بەرۉۉ - - + Use password جاشىرۇۇن نومۇر ىشتەتىش ارقىلۇۇ دالىلدۅ @@ -185,30 +192,30 @@ 认证中,请稍等... - - - + + + Please try again in %1 minutes. ٪1 مىنۇت ىچىندە قايرا سىناپ باعىڭ. - - - + + + Please try again in %1 seconds. ٪1 سىكونت ىچىندە قايرا سىناپ باعىڭ. - - - - + + + + Account locked permanently. ەسابات تۉبۅلۉك قۇلۇپلىنىدۇ. - - + + Password cannot be empty جاشىرۇۇن نومۇردۇ بوش ،بەكەر قويۇشقا بولبويت @@ -221,8 +228,8 @@ 无法验证%1,请输入密码. - - + + Failed to verify %1, you still have %2 verification opportunities ٪1 نى دالىلدۅ جەڭىلۉۉ بولدۇ ، سىزدە داعى ەلە ٪2 دالىلدۅ مۅۅرتۉ بار @@ -231,42 +238,42 @@ 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作。 - + Password: جاشىرۇۇن نومۇر - + Please enter your password or enroll your fingerprint جاشىرۇۇن نومۇرۇڭۇزدۇ كىرگىزىڭ كۅرۉنۉشتۅرۉ بارماق ئىزىڭىزنى تونۇتۇڭ - + Abnormal network بۅتۅنچۅ تور - + This operation requires the administrator's authorization. Please enter your password to allow this operation. بۇل ماشقۇلدانۇۇ باشقارۇۇچۇنۇن ۇقۇق بەرۉۉنۉ تالاپ جاسايت .جاشىرۇۇن نومۇردۇ كىيىرىپ بي قاتىمقى ماشقۇلدانۇۇ نىڭ الىپ بېرىلىشىغا جول قويۇڭ. - + _Password: جاشىرۇۇن نومۇر - + _Password: جاشىرۇۇن نومۇر - + Authentication failed, please try again. دالىلدۅ جەڭىلۉۉ بولدۇ ، قايرا سىناڭ - + days left 1 كۉندۅن كىيىن سىناپ باعىڭ @@ -279,16 +286,16 @@ 生物/扫码验证失败,您还有%1次尝试机会 - - - + + + Failed to verify %1, please enter password to unlock ٪1 نى دالىلدۅ جەڭىلۉۉ بولدۇ ، سىرلۇۇ نومۇر كىرگىزىڭ - - - + + + Unable to verify %1, please enter password to unlock ٪1 نى دالىلدۅۅگۅ ايلاسىز، جاشىرۇۇن نومۇردۇ كىيىرىپ قۇلۇپنى اچىڭ @@ -297,74 +304,84 @@ 网络异常 - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. بىر پراگرامما ۇقۇق تالاپ جاسايتۇرعان قىيمىلدى جاسووعو ئۇرۇنماقتا. بۇل قىيمىلدى اتقارماق جاسوو ،اتقارۇۇ ۉچۉن ۇقۇق تالاپ جاسايت . - - + + Input Password جاشىرۇۇن نومۇر كىرگىزۉۉ - + Insert the ukey into the USB port ukey نى USB ووزۇنا چېتىپ قويۇڭ - + Enter the ukey password ukey جاشىرۇۇن نومۇرۇن كىرگىزىڭ - + + Close + + + + + Acquisition failure + + + + hours left بىر سائەتتىن كىيىن اچىلات - + minutes left بىر مىنۇتتان كىيىن اچىلات - + seconds left بىر سەكۇنتتان كىيىن اچىلات - - + + Input your password to authentication جاشىرۇۇن نومۇردۇ كىيىرىپ كۉبۅلۉك دالىلدۅ. - + Verify face recognition or enter password to unlock چىراي تاانىشتى دالىلدۅ كۅرۉنۉشتۅرۉ جاشىرۇۇن نومۇر كىرگىزۉۉ ارقىلۇۇ قۇلپ اچۇۇ - + Press fingerprint or enter password to unlock بارماق ىزىن باسۇۇدا كۅرۉنۉشتۅرۉ جاشىرۇۇن نومۇر كىرگىزۉۉ ارقىلۇۇ قۇلپ اچۇۇ - + Verify voiceprint or enter password to unlock دووش ىزىن دالىلدۅ كۅرۉنۉشتۅرۉ جاشىرۇۇن نومۇر كىرگىزۉۉ ارقىلۇۇ قۇلپ اچۇۇ - + Verify finger vein or enter password to unlock بارماق ئزى ارقىلۇۇ انىقتاش كۅرۉنۉشتۅرۉ جاشىرۇۇن نومۇر كىرگىزۉۉ ارقىلۇۇ قۇلپ اچۇۇ - + Verify iris or enter password to unlock Iris نى انىقتاش كۅرۉنۉشتۅرۉ جاشىرۇۇن نومۇر كىرگىزۉۉ ارقىلۇۇ قۇلپ اچۇۇ - + Use the bound wechat scanning code or enter the password to unlock بايلانعان ئۈندىدارنى ىسكاننىردوو قۇپۇيا نومۇرۇ كۅرۉنۉشتۅرۉ جاشىرۇۇن نومۇرۇن كىيىرىپ قۇلپ اچۇۇ @@ -373,10 +390,10 @@ 使用绑定的微信扫码或输入密码登录 - - - - + + + + Account locked, ىشتەتىش نومۇرۇڭۇز قۇلۇپتالىپ قالدى @@ -388,17 +405,17 @@ PolkitListener - + Another client is already authenticating, please try again later. داعى بىر سووداگەر ، جولووچۇ دالىلدەپ جاتات، سەل تۇرۇپ قايرا سىناڭ. - + Authentication failure, please try again. دالىلدۅ جەڭىلۉۉ بولدۇ ، قايرا سىناڭ. - + Password input error! كىيىرگەن جاشىرۇۇن نومۇر قاتاا بولدۇ diff --git a/polkit-agent/i18n_ts/mn.ts b/polkit-agent/i18n_ts/mn.ts index 4f8ed3c..af10ef8 100644 --- a/polkit-agent/i18n_ts/mn.ts +++ b/polkit-agent/i18n_ts/mn.ts @@ -51,6 +51,14 @@ 二维码 + + FullScreenBackground + + + Authentication + ᠡᠷᠬᠡ ᠤᠯᠭᠤᠬᠤ + + LoginOptionsWidget @@ -65,7 +73,7 @@ MainWindow - + Authentication ᠡᠷᠬᠡ ᠤᠯᠭᠤᠬᠤ @@ -92,8 +100,8 @@ - - + + Biometric ᠠᠮᠢᠳᠤ ᠪᠤᠳᠠᠰ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠵᠤ ᠢᠯᠭᠠᠨ ᠳᠠᠨᠢᠬᠤ @@ -148,19 +156,18 @@ - + Cancel ᠦᠬᠡᠢᠰᠭᠡᠬᠦ᠌ - + Authenticate ᠡᠷᠬᠡ ᠤᠯᠭᠤᠬᠤ - - + Use password ᠰᠢᠯᠭᠠᠨ ᠪᠠᠳᠤᠯᠠᠭᠰᠠᠨ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ @@ -185,30 +192,30 @@ 认证中,请稍等... - - - + + + Please try again in %1 minutes. %1 ᠮᠢᠨᠦ᠋ᠲ᠎ᠦᠨ ᠳᠠᠷᠠᠭ᠎ᠠ ᠳᠠᠬᠢᠵᠤ ᠳᠤᠷᠱᠢᠭᠠᠷᠠᠢ. - - - + + + Please try again in %1 seconds. %1 ᠮᠢᠨᠦ᠋ᠲ᠎ᠦᠨ ᠳᠠᠷᠠᠭ᠎ᠠ ᠳᠠᠬᠢᠵᠤ ᠳᠤᠷᠱᠢᠭᠠᠷᠠᠢ. - - - - + + + + Account locked permanently. ᠳᠠᠩᠰᠠ ᠨᠢᠭᠡᠨᠳᠡ ᠦᠨᠢᠳᠡ ᠤᠨᠢᠰᠤᠯᠠᠭᠳᠠᠪᠠ. - - + + Password cannot be empty ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠬᠤᠭᠤᠰᠤᠨ ᠪᠠᠢᠵᠤ ᠪᠤᠯᠬᠤ ᠦᠬᠡᠢ @@ -221,8 +228,8 @@ 无法验证%1,请输入密码. - - + + Failed to verify %1, you still have %2 verification opportunities %1᠎ᠶᠢᠨ/᠎ᠦᠨ ᠰᠢᠯᠭᠠᠨ ᠪᠠᠢᠴᠠᠭᠠᠯᠳᠠ ᠢᠯᠠᠭᠳᠠᠪᠠ ᠂ ᠲᠠ ᠪᠠᠰᠠ%2 ᠤᠳᠠᠭᠠᠨ᠎ᠤ ᠳᠤᠷᠱᠢᠬᠤ ᠵᠠᠪᠱᠢᠶᠠᠨ ᠲᠠᠢ @@ -231,42 +238,42 @@ 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作。 - + Password: ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋᠄ - + Please enter your password or enroll your fingerprint ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠪᠤᠶᠤ ᠬᠤᠷᠤᠭᠤᠨ ᠤ᠋ ᠤᠷᠤᠮ ᠵᠢᠨᠨ ᠤᠷᠤᠭᠤᠯᠤᠭᠠᠷᠠᠢ - + Abnormal network ᠲᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠬᠡᠪ ᠤ᠋ᠨ ᠪᠤᠰᠤ - + This operation requires the administrator's authorization. Please enter your password to allow this operation. ᠳᠤᠰ ᠤᠳᠠᠭᠠᠨ ᠤ᠋ ᠠᠵᠢᠯᠯᠠᠬᠤᠢ ᠵᠢᠨ ᠬᠠᠮᠢᠶᠠᠷᠤᠭᠴᠢ ᠵᠢᠨ ᠡᠷᠬᠡ ᠤᠯᠭᠤᠯᠳᠠ ᠪᠡᠷ ᠰᠠᠶᠢ ᠦᠷᠬᠦᠯᠵᠢᠯᠡᠨ ᠬᠡᠷᠡᠭᠵᠢᠬᠦᠯᠦᠨ᠎ᠡ᠂ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠵᠢᠨᠨ ᠤᠷᠤᠭᠤᠯᠵᠤ ᠳᠤᠰ ᠠᠵᠢᠯᠯᠠᠬᠤᠢ ᠵᠢ ᠵᠦᠪᠰᠢᠶᠡᠷᠡᠭᠡᠷᠡᠢ. - + _Password: ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋: - + _Password: ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋: - + Authentication failed, please try again. ᠰᠢᠯᠭᠠᠨ ᠪᠠᠳᠤᠯᠠᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠦᠬᠡᠢ᠂ ᠳᠠᠬᠢᠵᠤ ᠳᠤᠷᠰᠢᠭᠠᠷᠠᠢ. - + days left ᠡᠳᠦᠷ ᠤ᠋ᠨ ᠳᠠᠷᠠᠭ᠎ᠠ ᠤᠨᠢᠰᠤ ᠳᠠᠢᠯᠤᠨ᠎ᠠ @@ -279,16 +286,16 @@ 生物/扫码验证失败,您还有%1次尝试机会 - - - + + + Failed to verify %1, please enter password to unlock %1᠎ᠶᠢ/᠎ᠢ ᠪᠠᠳᠤᠯᠭᠠᠵᠢᠭᠤᠯᠬᠤ ᠠᠷᠭ᠎ᠠ ᠦᠬᠡᠢ ᠂ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤᠷᠤᠭᠤᠯᠵᠤ ᠤᠨᠢᠰᠤ᠎ᠶᠢ ᠳᠠᠢᠯᠤᠭᠠᠷᠠᠢ - - - + + + Unable to verify %1, please enter password to unlock %1᠎ᠶᠢ/᠎ᠢ ᠪᠠᠳᠤᠯᠭᠠᠵᠢᠭᠤᠯᠬᠤ ᠠᠷᠭ᠎ᠠ ᠦᠬᠡᠢ ᠂ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤᠷᠤᠭᠤᠯᠵᠤ ᠤᠨᠢᠰᠤ᠎ᠶᠢ ᠳᠠᠢᠯᠤᠭᠠᠷᠠᠢ @@ -297,74 +304,84 @@ 网络异常 - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. ᠨᠢᠭᠡ ᠫᠡᠷᠦᠭᠷᠡᠮ ᠶᠠᠭ ᠨᠢᠭᠡ ᠤᠨᠠᠴᠠ ᠡᠷᠬᠡ ᠬᠡᠷᠡᠭᠰᠡᠬᠦ ᠬᠦᠳᠡᠯᠬᠡᠬᠡᠨ ᠢ᠋ ᠬᠡᠷᠡᠭᠵᠢᠬᠦᠯᠬᠦ ᠪᠡᠷ ᠳᠤᠷᠰᠢᠵᠤ ᠪᠠᠢᠨ᠎ᠠ᠂ ᠳᠤᠰ ᠬᠦᠳᠡᠯᠬᠡᠬᠡᠨ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠬᠦ ᠡᠷᠬᠡ ᠤᠯᠭᠤᠬᠤ ᠵᠢ ᠱᠠᠭᠠᠷᠳᠠᠵᠤ ᠪᠠᠢᠨ᠎ᠠ. - - + + Input Password ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤᠷᠤᠭᠤᠯᠬᠤ - + Insert the ukey into the USB port ᠠᠮᠤᠷ ᠲᠦᠪᠰᠢᠨ ᠦ ᠨᠢᠭᠤᠴᠠ ᠶᠢ USB ᠦᠵᠦᠭᠦᠷ ᠲᠦ ᠬᠠᠳᠬᠤᠵᠤ ᠣᠷᠣᠭᠠᠷᠠᠢ ᠃ - + Enter the ukey password ᠠᠮᠤᠷ ᠲᠦᠪᠰᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠨᠣᠮᠧᠷ ᠢ ᠣᠷᠣᠭᠤᠯᠤᠨ᠎ᠠ ᠃ - + + Close + ᠬᠠᠭᠠᠬᠤ + + + + Acquisition failure + ᠢᠯᠠᠭᠳᠠᠯ ᠢ ᠣᠯᠪᠠ ᠃ + + + hours left ᠨᠢᠭᠡ ᠴᠠᠭ ᠤ᠋ᠨ ᠳᠠᠷᠠᠭ᠎ᠠ ᠤᠨᠢᠰᠤ ᠳᠠᠢᠯᠤᠨ᠎ᠠ - + minutes left ᠮᠢᠨᠦ᠋ᠲ ᠤ᠋ᠨ ᠳᠠᠷᠠᠭ᠎ᠠ ᠤᠨᠢᠰᠤ ᠳᠠᠢᠯᠤᠨ᠎ᠠ - + seconds left ᠰᠸᠺᠦᠨ᠋ᠲ ᠤ᠋ᠨ ᠳᠠᠷᠠᠭ᠎ᠠ ᠤᠨᠢᠰᠤ ᠳᠠᠢᠯᠤᠨ᠎ᠠ - - + + Input your password to authentication ᠨᠢᠭᠤᠴᠠ ᠨᠣᠮᠧᠷ ᠣᠷᠣᠭᠤᠯᠬᠤ ᠳᠤ ᠡᠷᠬᠡ ᠣᠯᠭᠣᠨ᠎ᠠ ᠃ - + Verify face recognition or enter password to unlock ᠨᠢᠭᠤᠷ ᠱᠢᠷᠪᠢᠵᠤ ᠪᠠᠳᠤᠯᠭᠠᠵᠢᠭᠤᠯᠬᠤ ᠪᠤᠶᠤ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤᠷᠤᠭᠤᠯᠵᠤ ᠤᠨᠢᠰᠤ᠎ᠶᠢ ᠳᠠᠢᠯᠤᠭᠠᠷᠠᠢ - + Press fingerprint or enter password to unlock ᠬᠤᠷᠤᠭᠤᠨ᠎ᠤ ᠤᠷᠤᠮ ᠳᠠᠷᠤᠬᠤ ᠪᠤᠶᠤ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤᠷᠤᠭᠤᠯᠵᠤ ᠤᠨᠢᠰᠤ᠎ᠶᠢ ᠳᠠᠢᠯᠤᠭᠠᠷᠠᠢ - + Verify voiceprint or enter password to unlock ᠳᠠᠭᠤ᠎ᠪᠠᠷ ᠰᠢᠯᠭᠠᠨ ᠪᠠᠳᠤᠯᠠᠬᠤ ᠪᠤᠶᠤ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤᠷᠤᠭᠤᠯᠵᠤ ᠤᠨᠢᠰᠤ᠎ᠶᠢ ᠳᠠᠢᠯᠤᠭᠠᠷᠠᠢ - + Verify finger vein or enter password to unlock ᠬᠤᠷᠤᠭᠤᠨ᠎ᠤ ᠨᠠᠮᠵᠢᠭᠤᠨ ᠰᠤᠳᠠᠯ᠎ᠢᠶᠠᠷ ᠰᠢᠯᠭᠠᠨ ᠪᠠᠳᠤᠯᠠᠬᠤ ᠪᠤᠶᠤ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤᠷᠤᠭᠤᠯᠵᠤ ᠤᠨᠢᠰᠤ᠎ᠶᠢ ᠳᠠᠢᠯᠤᠭᠠᠷᠠᠢ - + Verify iris or enter password to unlock ᠰᠤᠯᠤᠩᠭ᠎ᠠ ᠪᠦᠷᠬᠦᠪᠴᠢ᠎ᠶᠢ ᠰᠢᠯᠭᠠᠨ ᠪᠠᠳᠤᠯᠠᠬᠤ ᠪᠤᠶᠤ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤᠷᠤᠭᠤᠯᠵᠤ ᠤᠨᠢᠰᠤ᠎ᠶᠢ ᠳᠠᠢᠯᠤᠭᠠᠷᠠᠢ - + Use the bound wechat scanning code or enter the password to unlock ᠤᠶᠠᠭᠰᠠᠨ ᠸᠢᠴᠠᠲ᠎ᠢᠶᠠᠷ ᠺᠤᠳ᠋ ᠱᠢᠷᠪᠢᠬᠦ᠌ ᠪᠤᠶᠤ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤᠷᠤᠭᠤᠯᠵᠤ ᠤᠨᠢᠰᠤ᠎ᠶᠢ ᠳᠠᠢᠯᠤᠭᠠᠷᠠᠢ @@ -373,10 +390,10 @@ 使用绑定的微信扫码或输入密码登录 - - - - + + + + Account locked, ᠳᠠᠨᠭᠰᠠ ᠵᠢ ᠨᠢᠬᠡᠨᠳᠡ ᠤᠨᠢᠰᠤᠯᠠᠪᠠ @@ -388,17 +405,17 @@ PolkitListener - + Another client is already authenticating, please try again later. ᠦᠬᠡᠷ᠎ᠡ ᠨᠢᠭᠡ ᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠦᠵᠦᠬᠦᠷᠯᠢᠭ ᠢ᠋ ᠶᠠᠭ ᠨᠤᠳᠠᠯᠠᠵᠤ ᠪᠠᠢᠨ᠎ᠠ᠂ ᠤᠳᠠᠰᠬᠢᠭᠠᠳ ᠳᠠᠬᠢᠨ ᠳᠤᠷᠰᠢᠭᠠᠷᠠᠢ. - + Authentication failure, please try again. ᠰᠢᠯᠭᠠᠨ ᠪᠠᠳᠤᠯᠠᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠦᠬᠡᠢ᠂ ᠳᠠᠬᠢᠵᠤ ᠳᠤᠷᠰᠢᠭᠠᠷᠠᠢ. - + Password input error! ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠢ᠋ ᠪᠤᠷᠤᠭᠤ ᠤᠷᠤᠭᠤᠯᠪᠠ! diff --git a/polkit-agent/i18n_ts/pt.ts b/polkit-agent/i18n_ts/pt.ts index 155dec7..bac9d5e 100644 --- a/polkit-agent/i18n_ts/pt.ts +++ b/polkit-agent/i18n_ts/pt.ts @@ -15,6 +15,13 @@ Formato + + FullScreenBackground + + Authentication + Autenticação + + MainWindow @@ -197,6 +204,14 @@ Input your password to authentication + + Close + + + + Acquisition failure + + PolkitListener diff --git a/polkit-agent/i18n_ts/ru.ts b/polkit-agent/i18n_ts/ru.ts index c75c155..6b836b8 100644 --- a/polkit-agent/i18n_ts/ru.ts +++ b/polkit-agent/i18n_ts/ru.ts @@ -15,6 +15,13 @@ форма + + FullScreenBackground + + Authentication + Аутентификация + + MainWindow @@ -197,6 +204,14 @@ Input your password to authentication + + Close + + + + Acquisition failure + + PolkitListener diff --git a/polkit-agent/i18n_ts/tr.ts b/polkit-agent/i18n_ts/tr.ts index f59c7a3..a400a7b 100644 --- a/polkit-agent/i18n_ts/tr.ts +++ b/polkit-agent/i18n_ts/tr.ts @@ -31,159 +31,176 @@ Ses İzi + + FullScreenBackground + + + Authentication + Kimlik Doğrulama + + MainWindow - + Authentication Kimlik Doğrulama - - - + + + Failed to verify %1, please enter password to unlock - - - + + + Unable to verify %1, please enter password to unlock - - + + Failed to verify %1, you still have %2 verification opportunities - + Abnormal network - + This operation requires the administrator's authorization. Please enter your password to allow this operation. - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. - - + + Input Password - + Insert the ukey into the USB port - + Enter the ukey password - - - - - Account locked, + + Close - - days left - - - - - hours left - - - - - minutes left - - - - - seconds left + + Acquisition failure - + + + + Account locked, + + + + + days left + + + + + hours left + + + + + minutes left + + + + + seconds left + + + + + Password cannot be empty - - + + Input your password to authentication - - + Use password - - - + + + Please try again in %1 minutes. - - - + + + Please try again in %1 seconds. - - - - + + + + Account locked permanently. - + Verify face recognition or enter password to unlock - + Press fingerprint or enter password to unlock - + Verify voiceprint or enter password to unlock - + Verify finger vein or enter password to unlock - + Verify iris or enter password to unlock - + Use the bound wechat scanning code or enter the password to unlock @@ -206,8 +223,8 @@ - - + + Biometric Biyometrik @@ -257,13 +274,13 @@ - + Cancel İptal - + Authenticate Kimlik Doğrulaması @@ -277,7 +294,7 @@ Kimlik Doğrulaması - + Please enter your password or enroll your fingerprint @@ -290,22 +307,22 @@ Bir uygulama, ayrıcalıklar gerektiren bir eylem gerçekleştirmeye çalışıyor. Bu işlemi gerçekleştirmek için kimlik doğrulaması gerekiyor. - + Password: Parola: - + _Password: _Parola: - + _Password: _Parola: - + Authentication failed, please try again. Kimlik doğrulama başarısız, lütfen tekrar deneyin. @@ -317,17 +334,17 @@ PolkitListener - + Another client is already authenticating, please try again later. Başka bir hesap zaten kimlik doğrulaması yapıyor, lütfen daha sonra tekrar deneyin. - + Authentication failure, please try again. Kimlik doğrulama hatalı, lütfen tekrar deneyin. - + Password input error! diff --git a/polkit-agent/i18n_ts/ug.ts b/polkit-agent/i18n_ts/ug.ts index 58164c0..e2a10e7 100644 --- a/polkit-agent/i18n_ts/ug.ts +++ b/polkit-agent/i18n_ts/ug.ts @@ -51,6 +51,14 @@ 二维码 + + FullScreenBackground + + + Authentication + راستىنى دەلىللەش + + LoginOptionsWidget @@ -65,7 +73,7 @@ MainWindow - + Authentication راستىنى دەلىللەش @@ -92,8 +100,8 @@ - - + + Biometric بىئولەگىيەلىك ئالاھىدىلىكنى ئىشلىتىش @@ -148,19 +156,18 @@ - + Cancel ئەمەلدىن قالدۇرۇش - + Authenticate ھوقۇق بېرىش - - + Use password مەخپىي نومۇر ئىشلىتىش ئارقىلىق دەلىللەش @@ -185,30 +192,30 @@ 认证中,请稍等... - - - + + + Please try again in %1 minutes. ٪1 مىنۇت ئىچىدە قايتا سىناپ بېقىڭ. - - - + + + Please try again in %1 seconds. ٪1 سېكۇنت ئىچىدە قايتا سىناپ بېقىڭ. - - - - + + + + Account locked permanently. ھېسابات مەڭگۈلۈك قۇلۇپلىنىدۇ. - - + + Password cannot be empty مەخپىي نومۇرنى بوش قويۇشقا بولمايدۇ @@ -221,8 +228,8 @@ 无法验证%1,请输入密码. - - + + Failed to verify %1, you still have %2 verification opportunities ٪1 نى دەلىللەش مەغلۇپ بولدى، سىزدە يەنىلا ٪2 دەلىللەش پۇرسىتى بار @@ -231,42 +238,42 @@ 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作。 - + Password: مەخپىي نومۇر - + Please enter your password or enroll your fingerprint مەخپىي نومۇرىڭىزنى كىرگۈزۈڭ ياكى بارماق ئىزىڭىزنى تونۇتۇڭ - + Abnormal network بىنورمال تور - + This operation requires the administrator's authorization. Please enter your password to allow this operation. بۇ مەشغۇلات باشقۇرغۇچىنىڭ ھوقۇق بېرىشىنى تەلەپ قىلىدۇ.مەخپىي نومۇرنى كىرگۈزۈپ بي قېتىمقى مەشغۇلاتنىڭ ئېلىپ بېرىلىشىغا يول قويۇڭ. - + _Password: مەخپىي نومۇر - + _Password: مەخپىي نومۇر - + Authentication failed, please try again. دەلىللەش مەغلۇپ بولدى، قايتا سىناڭ - + days left 1 كۈندىن كېيىن سىناب بېقىڭ @@ -279,16 +286,16 @@ 生物/扫码验证失败,您还有%1次尝试机会 - - - + + + Failed to verify %1, please enter password to unlock ٪1 نى دەلىللەش مەغلۇپ بولدى، مەخپى نۇمۇر كىرگۈزۈڭ - - - + + + Unable to verify %1, please enter password to unlock ٪1 نى دەلىللەشكە ئامالسىز، مەخپىي نومۇرنى كىرگۈزۈپ قۇلۇپنى ئېچىڭ @@ -297,74 +304,84 @@ 网络异常 - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. بىر پروگرامما ئىمتىياز تەلەپ قىلىدىغان ھەرىكەتنى قىلىشقا ئۇرۇنماقتا. بۇ ھەرىكەتنى ئىجرا قىلىش ئۈچۈن ھوقۇق تەلەپ قىلىدۇ. - - + + Input Password ئىم كىرگۈزۈش - + Insert the ukey into the USB port ukey نى USB ئېغىزىغا چېتىپ قويۇڭ - + Enter the ukey password ukey مەخپىي نومۇرىنى كىرگۈزۈڭ - + + Close + + + + + Acquisition failure + + + + hours left بىر سائەتتىن كېيىن ئېچىلىدۇ - + minutes left بىر مىنۇتتىن كېيىن ئېچىلىدۇ - + seconds left بىر سېكۇنتتىن كېيىن ئېچىلىدۇ - - + + Input your password to authentication مەخپىي نومۇرنى كىرگۈزۈپ كىملىك دەلىللەش. - + Verify face recognition or enter password to unlock چىراي تونۇشنى دەلىللەش ياكى مەخپىي نومۇر كىرگۈزۈش ئارقىلىق قۇلۇپ ئېچىش - + Press fingerprint or enter password to unlock بارماق ئىزىنى بېسىش ياكى مەخپىي نومۇر كىرگۈزۈش ئارقىلىق قۇلۇپ ئېچىش - + Verify voiceprint or enter password to unlock ئاۋاز ئىزىنى دەلىللەش ياكى مەخپىي نومۇر كىرگۈزۈش ئارقىلىق قۇلۇپ ئېچىش - + Verify finger vein or enter password to unlock بارماق ئىزى ئارقىلىق ئېنىقلاش ياكى مەخپىي نومۇر كىرگۈزۈش ئارقىلىق قۇلۇپ ئېچىش - + Verify iris or enter password to unlock Iris نى ئېنىقلاش ياكى مەخپىي نومۇر كىرگۈزۈش ئارقىلىق قۇلۇپ ئېچىش - + Use the bound wechat scanning code or enter the password to unlock باغلانغان ئۈندىدارنى سىكاننېرلاش كودى ياكى مەخپىي نومۇرىنى كىرگۈزۈپ قۇلۇپ ئېچىش @@ -373,10 +390,10 @@ 使用绑定的微信扫码或输入密码登录 - - - - + + + + Account locked, ئىشلىتىش نومۇرىڭىز قۇلۇپلىنىپ قالدى @@ -388,17 +405,17 @@ PolkitListener - + Another client is already authenticating, please try again later. يەنە بىر خېرىدار دەلىللەۋاتىدۇ، سەل تۇرۇپ قايتا سىناڭ. - + Authentication failure, please try again. دەلىللەش مەغلۇپ بولدى، قايتا سىناڭ. - + Password input error! كىرگۈزگەن مەخپىي نومۇر خاتا بولدى diff --git a/polkit-agent/i18n_ts/zh_CN.ts b/polkit-agent/i18n_ts/zh_CN.ts index 070732c..30cb85a 100644 --- a/polkit-agent/i18n_ts/zh_CN.ts +++ b/polkit-agent/i18n_ts/zh_CN.ts @@ -51,6 +51,14 @@ 二维码 + + FullScreenBackground + + + Authentication + 授权 + + LoginOptionsWidget @@ -65,7 +73,7 @@ MainWindow - + Authentication 授权 @@ -92,8 +100,8 @@ - - + + Biometric 使用生物识别 @@ -148,19 +156,18 @@ - + Cancel 取消 - + Authenticate 授权 - - + Use password 使用密码验证 @@ -185,30 +192,30 @@ 认证中,请稍等... - - - + + + Please try again in %1 minutes. 请%1分钟后再试 - - - + + + Please try again in %1 seconds. 请%1秒后再试 - - - - + + + + Account locked permanently. 账号已被永久锁定 - - + + Password cannot be empty 密码不能为空 @@ -221,8 +228,8 @@ 无法验证%1,请输入密码. - - + + Failed to verify %1, you still have %2 verification opportunities 验证%1失败,您还有%2次尝试机会 @@ -231,42 +238,42 @@ 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作。 - + Password: 密码: - + Please enter your password or enroll your fingerprint 请输入密码或者录入指纹 - + Abnormal network 网络异常 - + This operation requires the administrator's authorization. Please enter your password to allow this operation. 本次操作需要通过管理员的授权才能继续执行,请输入密码以允许本次操作。 - + _Password: 密码: - + _Password: 密码: - + Authentication failed, please try again. 认证失败,请重试。 - + days left 天后解锁 @@ -279,16 +286,16 @@ 生物/扫码验证失败,您还有%1次尝试机会 - - - + + + Failed to verify %1, please enter password to unlock 验证%1失败,请输入密码解锁 - - - + + + Unable to verify %1, please enter password to unlock 无法验证%1,请输入密码解锁 @@ -297,74 +304,84 @@ 网络异常 - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. 一个程序正试图执行一个需要特权的动作,要求授权以执行该动作。 - - + + Input Password 输入密码 - + Insert the ukey into the USB port 请将安全密钥插入USB端口 - + Enter the ukey password 输入安全密钥密码 - + + Close + 关闭 + + + + Acquisition failure + 获取失败 + + + hours left 小时后解锁 - + minutes left 分钟后解锁 - + seconds left 秒后解锁 - - + + Input your password to authentication 输入密码以授权 - + Verify face recognition or enter password to unlock 验证人脸识别或输入密码解锁 - + Press fingerprint or enter password to unlock 按压指纹或输入密码解锁 - + Verify voiceprint or enter password to unlock 验证声纹或输入密码解锁 - + Verify finger vein or enter password to unlock 验证指静脉或输入密码解锁 - + Verify iris or enter password to unlock 验证虹膜或输入密码解锁 - + Use the bound wechat scanning code or enter the password to unlock 使用绑定的微信扫码或输入密码解锁 @@ -373,10 +390,10 @@ 使用绑定的微信扫码或输入密码登录 - - - - + + + + Account locked, 账户已锁定, @@ -388,17 +405,17 @@ PolkitListener - + Another client is already authenticating, please try again later. 有另外一个客户端正在认证,请稍后重试。 - + Authentication failure, please try again. 认证失败,请重试。 - + Password input error! 密码输入错误! diff --git a/polkit-agent/i18n_ts/zh_HK.ts b/polkit-agent/i18n_ts/zh_HK.ts index 95c8c43..b81f3a4 100644 --- a/polkit-agent/i18n_ts/zh_HK.ts +++ b/polkit-agent/i18n_ts/zh_HK.ts @@ -51,6 +51,14 @@ 二维码 + + FullScreenBackground + + + Authentication + 授權 + + LoginOptionsWidget @@ -65,7 +73,7 @@ MainWindow - + Authentication 授權 @@ -92,8 +100,8 @@ - - + + Biometric 使用生物識別 @@ -148,19 +156,18 @@ - + Cancel 取消 - + Authenticate 授權 - - + Use password 使用密碼驗證 @@ -185,30 +192,30 @@ 认证中,请稍等... - - - + + + Please try again in %1 minutes. 請%1分鐘后再試 - - - + + + Please try again in %1 seconds. 請%1秒後再試 - - - - + + + + Account locked permanently. 帳號已被永久鎖定 - - + + Password cannot be empty 密碼不能為空 @@ -221,8 +228,8 @@ 无法验证%1,请输入密码. - - + + Failed to verify %1, you still have %2 verification opportunities 驗證%1失敗,您還有%2次嘗試機會 @@ -231,42 +238,42 @@ 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作。 - + Password: 密碼: - + Please enter your password or enroll your fingerprint 請輸入密碼或者錄入指紋 - + Abnormal network 網路異常 - + This operation requires the administrator's authorization. Please enter your password to allow this operation. 本次操作需要通過管理員的授權才能繼續執行,請輸入密碼以允許本次操作。 - + _Password: 密碼: - + _Password: 密碼: - + Authentication failed, please try again. 認證失敗,請重試。 - + days left 天后解鎖 @@ -279,16 +286,16 @@ 生物/扫码验证失败,您还有%1次尝试机会 - - - + + + Failed to verify %1, please enter password to unlock 驗證%1失敗,請輸入密碼解鎖 - - - + + + Unable to verify %1, please enter password to unlock 無法驗證%1,請輸入密碼解鎖 @@ -297,74 +304,84 @@ 网络异常 - + A program is attempting to perform an action that requires privileges.It requires authorization to perform the action. 一個程式正試圖執行一個需要特權的動作,要求授權以執行該動作。 - - + + Input Password 輸入密碼 - + Insert the ukey into the USB port 請將安全金鑰插入USB埠 - + Enter the ukey password 輸入安全金鑰密碼 - + + Close + 關閉 + + + + Acquisition failure + 獲取失敗 + + + hours left 小時後解鎖 - + minutes left 分鐘後解鎖 - + seconds left 秒後解鎖 - - + + Input your password to authentication 輸入密碼以認證 - + Verify face recognition or enter password to unlock 驗證人臉識別或輸入密碼解鎖 - + Press fingerprint or enter password to unlock 按壓指紋或輸入密碼解鎖 - + Verify voiceprint or enter password to unlock 驗證聲紋或輸入密碼解鎖 - + Verify finger vein or enter password to unlock 驗證指靜脈或輸入密碼解鎖 - + Verify iris or enter password to unlock 驗證虹膜或輸入密碼解鎖 - + Use the bound wechat scanning code or enter the password to unlock 使用綁定的微信掃碼或輸入密碼解鎖 @@ -373,10 +390,10 @@ 使用绑定的微信扫码或输入密码登录 - - - - + + + + Account locked, 帳戶已鎖定, @@ -388,17 +405,17 @@ PolkitListener - + Another client is already authenticating, please try again later. 有另外一個用戶端正在認證,請稍後重試。 - + Authentication failure, please try again. 認證失敗,請重試。 - + Password input error! 密碼輸入錯誤! diff --git a/polkit-agent/src/PolkitListener.cpp b/polkit-agent/src/PolkitListener.cpp index 749e551..6a37a22 100644 --- a/polkit-agent/src/PolkitListener.cpp +++ b/polkit-agent/src/PolkitListener.cpp @@ -31,28 +31,21 @@ #include #include #include -#include #include "PolkitListener.h" #include "mainwindow.h" #include "generic.h" #include -#include "windowmanager/windowmanager.h" PolkitListener::PolkitListener(QObject *parent) - : Listener(parent), - inProgress(false), - currentIdentity(0), - mainWindow(nullptr) + : Listener(parent), inProgress(false), currentIdentity(0), m_managerFullScreen(nullptr) { m_isSupportTableMode = isSupportTableMode(); - m_isMavis = isMavis(); - qDebug()<<"isSupportTableMode:"<setError(tr("Another client is already authenticating, please try again later.")); result->setCompleted(); qDebug() << "Another client is already authenticating, please try again later."; @@ -107,13 +103,13 @@ void PolkitListener::initiateAuthentication( subjectPid = details.lookup("polkit.subject-pid"); callerPid = details.lookup("polkit.caller-pid"); + implicitActiveStr = details.lookup("implicit_authorization"); /* find action description for actionId */ - foreach(const PolkitQt1::ActionDescription &desc, - PolkitQt1::Authority::instance()->enumerateActionsSync()) { + foreach (const PolkitQt1::ActionDescription &desc, PolkitQt1::Authority::instance()->enumerateActionsSync()) { if (actionId == desc.actionId()) { actionDesc = desc; - qDebug() << "Action description has been found" ; + qDebug() << "Action description has been found"; break; } } @@ -135,117 +131,103 @@ void PolkitListener::initiateAuthentication( this->result = result; session.clear(); if (identities.length() == 1) { - this->currentIdentity = identities[0]; + this->currentIdentity = identities[0]; } else { currentIdentity = identities[0]; } /* Create the polkit window */ - mainWindow = new MainWindow; -// MotifWmHints hints; -// hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; -// hints.functions = MWM_FUNC_ALL; -// hints.decorations = MWM_DECOR_BORDER; -// XAtomHelper::getInstance()->setWindowMotifHint(mainWindow->winId(), hints); - mainWindow->setIcon(iconName); - mainWindow->setCurProject(m_isMavis); - mainWindow->setHeader(message); - mainWindow->setUsers(usersList); - mainWindow->setEditInputMethod(m_isSupportTableMode); - mainWindow->setFixedSize(420, 297); - /* - mainWindow->setDetails(subjectPid, callerPid, - actionDesc.actionId(), - actionDesc.description(), - actionDesc.vendorName(), - actionDesc.vendorUrl()); - */ - /* 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(); - } - } + m_managerFullScreen = new FullScreenBackground(); + m_managerFullScreen->initMainWindow( + iconName, message, usersList, subjectPid, callerPid, actionDesc, m_isMavis, m_isSupportTableMode); - if (desScreenGeometry.isEmpty()) { - desScreenGeometry = qApp->primaryScreen()->geometry(); - } -// mainWindow->move(desScreenGeometry.x() + (desScreenGeometry.width() - mainWindow->width())/2, -// desScreenGeometry.y() + (desScreenGeometry.height() - mainWindow->height())/2); -// qDebug()<<"MoveWindow to center1:"<geometry()<cancel(); - } - }); - - connect(mainWindow, &MainWindow::switchToBiometric, this, [&]{ - wasSwitchToBiometric = true; - startAuthentication(); - }); - - connect(mainWindow, &MainWindow::restartAuth, this, [&]{ - startAuthentication(); - }); - - connect(mainWindow, &MainWindow::userChanged, this, [&](const QString &userName){ - for(int i = 0; i < this->identities.size(); i++) { - auto identity = this->identities.at(i); - if(identity.toString().remove("unix-user:") == userName) { - this->currentIdentity = this->identities.at(i); - numTries = 0; - startAuthentication(); - break; + if (m_managerFullScreen && m_managerFullScreen->getMainWindow()) { + connect(m_managerFullScreen->getMainWindow(), &MainWindow::accept, this, &PolkitListener::onResponse); + connect(m_managerFullScreen->getMainWindow(), &MainWindow::canceled, this, [&] { + if (inProgress && !gainedAuthorization) { + wasCancelled = true; + unacknowledged_messages = false; + if (!session.isNull()) { + session.data()->cancel(); + } + finishObtainPrivilege(); } + }); + + connect(m_managerFullScreen->getMainWindow(), &MainWindow::switchToBiometric, this, [&] { + wasSwitchToBiometric = true; + startAuthentication(); + }); + + connect(m_managerFullScreen->getMainWindow(), &MainWindow::yesPrompted, this, [=] { + result->setCompleted(); + this->gainedAuthorization = true; + finishObtainPrivilege(); + }); + + connect(m_managerFullScreen->getMainWindow(), &MainWindow::restartAuth, this, [&] { startAuthentication(); }); + + connect(m_managerFullScreen->getMainWindow(), &MainWindow::userChanged, this, [&](const QString &userName) { + for (int i = 0; i < this->identities.size(); i++) { + auto identity = this->identities.at(i); + if (identity.toString().remove("unix-user:") == userName) { + this->currentIdentity = this->identities.at(i); + numTries = 0; + startAuthentication(); + break; + } + } + }); + + numTries = 0; + wasCancelled = false; + wasSwitchToBiometric = false; + + if (implicitActiveStr == "yes_prompt") { + m_managerFullScreen->getMainWindow()->onShowYesPrompt(); + m_managerFullScreen->getMainWindow()->setFixedSize(m_managerFullScreen->getMainWindow()->width(), 200); + m_managerFullScreen->getMainWindow()->show(); + m_managerFullScreen->getMainWindow()->activateWindow(); + return; } - }); - - numTries = 0; - wasCancelled = false; - wasSwitchToBiometric = false; - - mainWindow->userChanged(usersList.at(0)); + m_managerFullScreen->getMainWindow()->userChanged(usersList.at(0)); + } } -static -int get_pam_tally(int *deny, int *unlock_time) +static int get_pam_tally(int *deny, int *unlock_time) { char buf[128]; - FILE *auth_file; + FILE *auth_file = NULL; - if( (auth_file = fopen("/etc/pam.d/common-auth", "r")) == NULL) + if ((auth_file = fopen("/etc/pam.d/common-auth", "r")) == NULL) return -1; - while(fgets(buf, sizeof(buf), auth_file)) { - if(strlen(buf) == 0 || buf[0] == '#') + while (fgets(buf, sizeof(buf), auth_file)) { + if (strlen(buf) == 0 || buf[0] == '#') continue; - if(!strstr(buf, "deny")) + if (!strstr(buf, "deny")) continue; char *ptr = strtok(buf, " \t"); - while(ptr) { - if(strncmp(ptr, "deny=", 5)==0){ + while (ptr) { + if (strncmp(ptr, "deny=", 5) == 0) { sscanf(ptr, "deny=%d", deny); - //gs_debug("-------------------- deny=%d", *deny); + // gs_debug("-------------------- deny=%d", *deny); } - if(strncmp(ptr, "unlock_time=", 12)==0){ + if (strncmp(ptr, "unlock_time=", 12) == 0) { sscanf(ptr, "unlock_time=%d", unlock_time); - //gs_debug("-------------------- unlock_time=%d", *unlock_time); + // gs_debug("-------------------- unlock_time=%d", *unlock_time); } ptr = strtok(NULL, " \t"); } + fclose(auth_file); + auth_file = NULL; return 1; } + fclose(auth_file); + auth_file = NULL; return 0; } @@ -253,54 +235,59 @@ void PolkitListener::finishObtainPrivilege() { /* Number of tries increase only when some user is selected */ if (currentIdentity.isValid()) { - numTries++; + numTries++; } qDebug().noquote() << QString("Finishing obtaining " - "privileges (G:%1, C:%2, D:%3).") - .arg(gainedAuthorization) - .arg(wasCancelled) - .arg(mainWindow != NULL); + "privileges (G:%1, C:%2, D:%3).") + .arg(gainedAuthorization) + .arg(wasCancelled) + .arg(m_managerFullScreen && m_managerFullScreen->getMainWindow()); - if (!gainedAuthorization && !wasCancelled && (mainWindow != NULL)) { - int deny = 0, unlock_time = 0; - mainWindow->stopDoubleAuth(); - if(!get_pam_tally(&deny, &unlock_time)||(deny == 0 &&unlock_time == 0)) { - //if(!wasSwitchToBiometric){ - if (!unacknowledged_messages) - mainWindow->setAuthResult(gainedAuthorization, tr("Authentication failure, please try again.")); - //} - startAuthentication(); - return; - } - else { - if (!unacknowledged_messages) { - mainWindow->setAuthResult(gainedAuthorization, tr("Password input error!")); - } - startAuthentication(); - return; - } - - startAuthentication(); + if (!gainedAuthorization && !wasCancelled && (m_managerFullScreen && m_managerFullScreen->getMainWindow())) { + int deny = 0, unlock_time = 0; + m_managerFullScreen->getMainWindow()->stopDoubleAuth(); + if (!get_pam_tally(&deny, &unlock_time) || (deny == 0 && unlock_time == 0)) { + // if(!wasSwitchToBiometric){ + if (!unacknowledged_messages) + m_managerFullScreen->getMainWindow()->setAuthResult( + gainedAuthorization, tr("Authentication failure, please try again.")); + //} + startAuthentication(); return; + } else { + if (!unacknowledged_messages) { + m_managerFullScreen->getMainWindow()->setAuthResult(gainedAuthorization, tr("Password input error!")); + } + startAuthentication(); + return; + } + + startAuthentication(); + return; } - if (mainWindow) { - mainWindow->hide(); - mainWindow->stopDoubleAuth(); - mainWindow->close(); - mainWindow->deleteLater(); - mainWindow = NULL; + if (m_managerFullScreen) { + m_managerFullScreen->closeDialog(); + m_managerFullScreen->deleteLater(); + m_managerFullScreen = nullptr; + } + + if ((implicitActiveStr == "yes_prompt") && wasCancelled) { + result->setError("polkit-ukui-authentication-agent-1 cancel"); } if (!session.isNull()) { session.data()->result()->setCompleted(); + session.data()->deleteLater(); + session.clear(); } else { result->setCompleted(); } - session.data()->deleteLater(); this->inProgress = false; + implicitActiveStr = ""; qDebug() << "Finish obtain authorization:" << gainedAuthorization; + gainedAuthorization = false; } void establishToBioPAM() @@ -308,12 +295,12 @@ void establishToBioPAM() FILE *file; const char *data = "polkit-ukui-authentication-agent-1"; - if( (file = fopen(BIO_COM_FILE, "w")) == NULL){ + if ((file = fopen(BIO_COM_FILE, "w")) == NULL) { qWarning() << "open communication file failed: " << strerror(errno); return; } - if(fputs(data, file) == EOF) { + if (fputs(data, file) == EOF) { qWarning() << "write to communication file error: " << strerror(errno); } fclose(file); @@ -323,7 +310,7 @@ void PolkitListener::startAuthentication() { qDebug() << "start authenticate user " << currentIdentity.toString(); unacknowledged_messages = false; - if(!session.isNull()) { + if (!session.isNull()) { session.data()->deleteLater(); } @@ -332,92 +319,61 @@ void PolkitListener::startAuthentication() establishToBioPAM(); - session = new Session(currentIdentity, cookie, result); - connect(session.data(), SIGNAL(request(QString, bool)), this, - SLOT(onShowPrompt(QString,bool))); - connect(session.data(), SIGNAL(completed(bool)), this, - SLOT(onAuthCompleted(bool))); - connect(session.data(), SIGNAL(showError(QString)), this, - SLOT(onShowError(QString))); - connect(session.data(), SIGNAL(showInfo(QString)), this, - SLOT(onShowError(QString))); - session.data()->initiate(); + session = new Session(currentIdentity, cookie, result); + connect(session.data(), SIGNAL(request(QString, bool)), this, SLOT(onShowPrompt(QString, bool))); + connect(session.data(), SIGNAL(completed(bool)), this, SLOT(onAuthCompleted(bool))); + connect(session.data(), SIGNAL(showError(QString)), this, SLOT(onShowError(QString))); + connect(session.data(), SIGNAL(showInfo(QString)), this, SLOT(onShowError(QString))); + session.data()->initiate(); } - mainWindow->clearEdit(); + if (m_managerFullScreen && m_managerFullScreen->getMainWindow()) { + m_managerFullScreen->getMainWindow()->clearEdit(); + } } void PolkitListener::onShowPrompt(const QString &prompt, bool echo) { qDebug() << "Prompt: " << prompt << "echo: " << echo; - - if(prompt == BIOMETRIC_PAM || prompt == BIOMETRIC_PAM_QRCODE) { - mainWindow->setDoubleAuth(false); - mainWindow->switchAuthMode(MainWindow::BIOMETRIC); - }else if(prompt == BIOMETRIC_PAM_DOUBLE){ - mainWindow->setDoubleAuth(true); - mainWindow->switchAuthMode(MainWindow::BIOMETRIC); - //这时候不需要显示授权弹窗,下一次收到prompt请求的时候再显示 + if (!m_managerFullScreen || !m_managerFullScreen->getMainWindow()) { return; } - else { + if (prompt == BIOMETRIC_PAM || prompt == BIOMETRIC_PAM_QRCODE) { + m_managerFullScreen->getMainWindow()->setDoubleAuth(false); + m_managerFullScreen->getMainWindow()->switchAuthMode(MainWindow::BIOMETRIC); + } else if (prompt == BIOMETRIC_PAM_DOUBLE) { + m_managerFullScreen->getMainWindow()->setDoubleAuth(true); + m_managerFullScreen->getMainWindow()->switchAuthMode(MainWindow::BIOMETRIC); + //这时候不需要显示授权弹窗,下一次收到prompt请求的时候再显示 + return; + } else { unacknowledged_messages = false; - mainWindow->switchAuthMode(MainWindow::PASSWORD); - mainWindow->setPrompt(prompt, echo); + m_managerFullScreen->getMainWindow()->switchAuthMode(MainWindow::PASSWORD); + m_managerFullScreen->getMainWindow()->setPrompt(prompt, echo); + m_managerFullScreen->showDialog(); } - 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(); - // 重新开始认证不调整窗口位置 -// QPoint pos = QCursor::pos(); -// for(auto screen : QGuiApplication::screens()) -// { -// if(screen->geometry().contains(pos)) -// { -// mainWindow->move(screen->geometry().left() + (screen->geometry().width() - mainWindow->width()) / 2, -// screen->geometry().top() + (screen->geometry().height() - mainWindow->height()) / 2); -// } -// } - - mainWindow->activateWindow(); } //目前返回的pam错误就onShowError,onShowInfo两类 void PolkitListener::onShowError(const QString &text) { - qDebug() << "[Polkit]:" << "Error:" << text; + qDebug() << "[Polkit]:" + << "Error:" << text; unacknowledged_messages = true; - if(mainWindow){ - QString strText = mainWindow->check_is_pam_message(text); - mainWindow->setMessage(strText); + if (m_managerFullScreen && m_managerFullScreen->getMainWindow()) { + QString strText = m_managerFullScreen->getMainWindow()->check_is_pam_message(text); + m_managerFullScreen->getMainWindow()->setMessage(strText); } } void PolkitListener::onShowInfo(const QString &text) { - qDebug() << "[Polkit]:" << "Info:" << text; + qDebug() << "[Polkit]:" + << "Info:" << text; unacknowledged_messages = true; - if(mainWindow){ - QString strText = mainWindow->check_is_pam_message(text); - mainWindow->setMessage(strText); + if (m_managerFullScreen && m_managerFullScreen->getMainWindow()) { + QString strText = m_managerFullScreen->getMainWindow()->check_is_pam_message(text); + m_managerFullScreen->getMainWindow()->setMessage(strText); } } diff --git a/polkit-agent/src/PolkitListener.h b/polkit-agent/src/PolkitListener.h index 850077c..4137f79 100644 --- a/polkit-agent/src/PolkitListener.h +++ b/polkit-agent/src/PolkitListener.h @@ -22,45 +22,47 @@ #include #include "mainwindow.h" +#include "fullscreenbackground.h" using namespace PolkitQt1::Agent; class PolkitListener : public Listener { - Q_OBJECT + Q_OBJECT public: - PolkitListener(QObject *parent = 0); - virtual ~PolkitListener(); + PolkitListener(QObject *parent = 0); + virtual ~PolkitListener(); private: bool isSupportTableMode(); bool isMavis(); public slots: - void initiateAuthentication(const QString &actionId, - const QString &message, - const QString &iconName, - const PolkitQt1::Details &details, - const QString &cookie, - const PolkitQt1::Identity::List &identities, - PolkitQt1::Agent::AsyncResult *result); - bool initiateAuthenticationFinish(); - void cancelAuthentication(); - void finishObtainPrivilege(); - + void initiateAuthentication( + const QString &actionId, + const QString &message, + const QString &iconName, + const PolkitQt1::Details &details, + const QString &cookie, + const PolkitQt1::Identity::List &identities, + PolkitQt1::Agent::AsyncResult *result); + bool initiateAuthenticationFinish(); + void cancelAuthentication(); + void finishObtainPrivilege(); private: - bool gainedAuthorization; - bool wasCancelled; - bool wasSwitchToBiometric; + bool gainedAuthorization = false; + bool wasCancelled = false; + bool wasSwitchToBiometric = false; bool inProgress; - int numTries; + int numTries; + QString implicitActiveStr; QPointer session; - PolkitQt1::Identity::List identities; - PolkitQt1::Identity currentIdentity; - PolkitQt1::Agent::AsyncResult *result; - QString cookie; - MainWindow *mainWindow; + PolkitQt1::Identity::List identities; + PolkitQt1::Identity currentIdentity; + PolkitQt1::Agent::AsyncResult *result; + QString cookie; + FullScreenBackground *m_managerFullScreen; bool unacknowledged_messages = false; bool m_isSupportTableMode = false; bool m_isMavis = false; diff --git a/polkit-agent/src/fullscreenbackground.cpp b/polkit-agent/src/fullscreenbackground.cpp new file mode 100644 index 0000000..9bbaa3d --- /dev/null +++ b/polkit-agent/src/fullscreenbackground.cpp @@ -0,0 +1,513 @@ +/* + * Copyright (C) 2024 Tianjin KYLIN Information Technology Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + **/ +#include "fullscreenbackground.h" +#include "mainwindow.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace kdk; + +#define PERSONALSIE_SCHEMA "org.mate.background" +#define PERSONALSIE_TRAN_KEY "picture-filename" + +#define USD_MEDIA_KEYS_SCHEMA "org.ukui.SettingsDaemon.plugins.media-keys" +#define USD_MEDIA_KEYS_WINDOW_SWTICH_KEY "ukuiWindowSwitch" +#define USD_MEDIA_KEYS_WINDOW_SWTICH2_KEY "ukuiWindowSwitch2" + +FullScreenBackground::FullScreenBackground(QWidget *parent) : QWidget(parent) +{ + m_isWayland = QString(qgetenv("XDG_SESSION_TYPE")) == "wayland"; + initUI(); + initConnections(); +} + +FullScreenBackground::~FullScreenBackground() +{ + closeDialog(); +} + +void FullScreenBackground::initMainWindow( + const QString &strIconName, + const QString &strMsg, + const QStringList &listUsers, + const QString &subjectPid, + const QString &callerPid, + const PolkitQt1::ActionDescription &actionDesc, + const bool &isMavis, + const bool &isSupportTableMode) +{ + if (!m_wndMain) { + if (m_isWayland) { + m_wndMain = new MainWindow(); + m_wndMain->setWindowFlags(windowFlags() | Qt::Tool | Qt::WindowStaysOnTopHint); + KWindowSystem::setState(m_wndMain->winId(), NET::State::KeepAbove | NET::State::SkipTaskbar); + } else { + m_wndMain = new MainWindow(this); + m_wndMain->setModal(true); + } + setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint & ~Qt::WindowMinimizeButtonHint); + m_wndMain->setWindowTitle(tr("Authentication")); + WindowManager::setSkipTaskBar(m_wndMain->windowHandle(), true); + m_wndMain->setIcon(strIconName); + m_wndMain->setCurProject(isMavis); + m_wndMain->setHeader(strMsg); + m_wndMain->setUsers(listUsers); + m_wndMain->setEditInputMethod(isSupportTableMode); + m_wndMain->setFixedSize(420, 337); + /* + * + mainWindow->setDetails(subjectPid, callerPid, + actionDesc.actionId(), + actionDesc.description(), + actionDesc.vendorName(), + actionDesc.vendorUrl()); + */ + connect(m_wndMain, &MainWindow::finished, this, [=](int nResult) { + qDebug() << "auth dialog finished:" << nResult; + }); + } + if (m_isWayland) { + hide(); + } else { + show(); + } +} + +void FullScreenBackground::initUI() +{ + setWindowTitle(tr("Authentication")); + if (m_isWayland) { + setAttribute(Qt::WA_TranslucentBackground); + setGeometry(0, 0, 0, 0); + } else { + setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint); + setWindowOpacity(0.25); + KWindowSystem::setState(winId(), NET::State::KeepAbove | NET::State::SkipTaskbar); + WindowManager::setSkipTaskBar(this->windowHandle(), true); + installEventFilter(this); + + if (!isSupportCompositing()) { + m_pixmapBackground = getBackground(); + } + setGeometry(0, 0, 7680, 4320); + } + qDebug() << "Window geometry:" << geometry(); +} + +void FullScreenBackground::initConnections() +{ + QDesktopWidget *desktop = QApplication::desktop(); + if (desktop) { + connect(desktop, &QDesktopWidget::resized, this, &FullScreenBackground::onDesktopResized); + connect(desktop, &QDesktopWidget::workAreaResized, this, &FullScreenBackground::onWorkAreaResized); + connect(desktop, &QDesktopWidget::primaryScreenChanged, this, &FullScreenBackground::onPrimaryScreenChanged); + connect(desktop, &QDesktopWidget::screenCountChanged, this, &FullScreenBackground::onScreenCountChanged); + } +} + +void FullScreenBackground::onScreenCountChanged(int) +{ + qDebug() << "onScreenCountChanged----"; + if (m_isWayland) { + update(); + moveToCursorScreen(); + return; + } + QDesktopWidget *desktop = QApplication::desktop(); + if ((desktop->geometry().x() != 0 || desktop->geometry().y() != 0) && this->geometry().contains(desktop->geometry()) + && (QApplication::screens().count() == 1)) { + return; + } + if (desktop->geometry().height() > height() || desktop->geometry().width() > width()) { + setGeometry( + desktop->geometry().x(), + desktop->geometry().y(), + desktop->geometry().width() + 1, + desktop->geometry().height() + 1); + } + + update(); + moveToCursorScreen(); + qDebug() << desktop->geometry(); +} + +void FullScreenBackground::onWorkAreaResized() +{ + qDebug() << "onWorkAreaResized----"; + update(); +} + +void FullScreenBackground::onPrimaryScreenChanged() +{ + qDebug() << "onPrimaryScreenChanged----"; + moveToCursorScreen(); +} + +void FullScreenBackground::onDesktopResized() +{ + qDebug() << "onDesktopResized----"; + if (m_isWayland) { + update(); + moveToCursorScreen(); + return; + } + QDesktopWidget *desktop = QApplication::desktop(); + if ((desktop->geometry().x() != 0 || desktop->geometry().y() != 0) && this->geometry().contains(desktop->geometry()) + && (QGuiApplication::screens().count() == 1)) { + return; + } + if (desktop->geometry().height() > height() || desktop->geometry().width() > width()) { + setGeometry( + desktop->geometry().x(), + desktop->geometry().y(), + desktop->geometry().width() + 1, + desktop->geometry().height() + 1); + } + + update(); + moveToCursorScreen(); + qDebug() << desktop->geometry(); +} + +void FullScreenBackground::showDialog() +{ + if (m_isFirstShow) { + m_isFirstShow = false; + blockSomeShortCut(true); + if (!m_isWayland) { + show(); + } + if (m_wndMain) { + qDebug() << "DialogGeometry:" << m_wndMain->geometry(); + m_wndMain->show(); + m_wndMain->activateWindow(); + // move auth dialog to cursor screen + moveToCursorScreen(); + } + } +} + +void FullScreenBackground::closeDialog() +{ + blockSomeShortCut(false); + if (m_wndMain) { + m_wndMain->hide(); + m_wndMain->stopDoubleAuth(); + m_wndMain->close(); + m_wndMain->deleteLater(); + m_wndMain = nullptr; + } +} + +bool FullScreenBackground::isSupportCompositing() +{ + if (QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") { + return true; + } + QDBusInterface kwinCompositor( + "org.ukui.KWin", "/Compositor", "org.freedesktop.DBus.Properties", QDBusConnection::sessionBus()); + QDBusReply sessionReply = kwinCompositor.call("Get", "org.kde.kwin.Compositing", "compositingType"); + if (!sessionReply.isValid()) { + qWarning() << sessionReply.error(); + } else { + QString strType = sessionReply.value().variant().toString(); + if (strType.isEmpty() || strType == "none") + return false; + } + return true; +} + +QPixmap FullScreenBackground::getBackground() +{ + QPixmap pixmapBackground; + QString strPicName = ""; + + // 获取桌面壁纸路径 + QGSettings *personalGSettings = nullptr; + if (QGSettings::isSchemaInstalled(PERSONALSIE_SCHEMA)) { + personalGSettings = new QGSettings(PERSONALSIE_SCHEMA, QByteArray(), this); + QStringList keys = personalGSettings->keys(); + if (keys.contains(PERSONALSIE_TRAN_KEY)) { + strPicName = personalGSettings->get(PERSONALSIE_TRAN_KEY).toString(); + } + delete personalGSettings; + personalGSettings = nullptr; + } + + // 文件存在且可读则加载图片 + QFileInfo fileInfo(strPicName); + if (fileInfo.exists() && fileInfo.isReadable()) { + // do nothing + } else { + strPicName = getAccountBackground(); + } + + if (!strPicName.isEmpty()) { + QImageReader reader; + reader.setFileName(strPicName); + reader.setAutoTransform(true); + reader.setDecideFormatFromContent(true); + pixmapBackground = QPixmap::fromImageReader(&reader); + } + + return pixmapBackground; +} + +QString FullScreenBackground::getAccountBackground() +{ + QString strTmpPicName = "/usr/share/backgrounds/ubuntukylin-default-settings.jpg"; + + uid_t uid = getuid(); + QDBusInterface iface( + "org.freedesktop.Accounts", + "/org/freedesktop/Accounts", + "org.freedesktop.Accounts", + QDBusConnection::systemBus()); + + QDBusReply userPath = iface.call("FindUserById", (qint64)uid); + if (!userPath.isValid()) { + return strTmpPicName; + } else { + QDBusInterface userIface( + "org.freedesktop.Accounts", + userPath.value().path(), + "org.freedesktop.DBus.Properties", + QDBusConnection::systemBus()); + QDBusReply backgroundReply + = userIface.call("Get", "org.freedesktop.Accounts.User", "BackgroundFile"); + if (backgroundReply.isValid()) { + QString strPicName = backgroundReply.value().variant().toString(); + if (!strPicName.isEmpty()) { + QFileInfo fileInfo(strPicName); + if (fileInfo.exists() && fileInfo.isReadable()) { + return strPicName; + } + } + } + } + + return strTmpPicName; +} + +void FullScreenBackground::moveToScreen(QScreen *screen) +{ + // 将主全屏更新到新屏幕上,并重新将对话框居中 + if (!screen) { + return; + } + + if (m_wndMain) { + QRect rectParent = screen->geometry(); + QRect rectDes = QRect( + rectParent.x() + (rectParent.width() - m_wndMain->width()) / 2, + rectParent.y() + (rectParent.height() - m_wndMain->height()) / 2, + m_wndMain->width(), + m_wndMain->height()); + + WindowManager::setGeometry(m_wndMain->windowHandle(), rectDes); + qDebug() << "new rect:" << rectParent << "," << rectDes << "," << m_wndMain->geometry(); + } +} + +void FullScreenBackground::moveToCursorScreen() +{ + bool isFoundScreen = false; + if (m_isWayland) { + QString strCurScreen = WindowManager::currentOutputName(); + for (auto screen : QApplication::screens()) { + qDebug() << "Screen:" << screen->name() << "," << screen->geometry(); + if (screen && screen->name() == strCurScreen) { + isFoundScreen = true; + moveToScreen(screen); + break; + } + } + } else { + QPoint cursor = QCursor::pos(); + for (auto screen : QApplication::screens()) { + qDebug() << "Screen:" << screen->name() << "," << screen->geometry(); + if (screen && screen->geometry().contains(cursor)) { + isFoundScreen = true; + moveToScreen(screen); + break; + } + } + } + if (!isFoundScreen) { + if (QApplication::primaryScreen()) { + moveToScreen(QApplication::primaryScreen()); + } + isFoundScreen = true; + } +} + +void FullScreenBackground::paintEvent(QPaintEvent *event) +{ + if (!m_isWayland) { + for (auto screen : QApplication::screens()) { + QPainter painter(this); + if (!m_pixmapBackground.isNull()) { + painter.drawPixmap(screen->geometry(), m_pixmapBackground); + } + } + } + return QWidget::paintEvent(event); +} + +void FullScreenBackground::closeEvent(QCloseEvent *event) +{ + qDebug() << "FullScreenBackground::closeEvent"; + if (!m_isWayland) { + // 断开屏幕变化信号 + QDesktopWidget *desktop = QApplication::desktop(); + disconnect(desktop, &QDesktopWidget::resized, this, &FullScreenBackground::onDesktopResized); + disconnect(desktop, &QDesktopWidget::workAreaResized, this, &FullScreenBackground::onWorkAreaResized); + disconnect(desktop, &QDesktopWidget::primaryScreenChanged, this, &FullScreenBackground::onPrimaryScreenChanged); + disconnect(desktop, &QDesktopWidget::screenCountChanged, this, &FullScreenBackground::onScreenCountChanged); + } + + return QWidget::closeEvent(event); +} + +void FullScreenBackground::resizeEvent(QResizeEvent *event) +{ + Q_UNUSED(event); + qDebug() << "WndSize:" << this->size(); +} + +void FullScreenBackground::blockSomeShortCut(bool isBlock /* = false*/) +{ + static bool sIsBlocked = false; + if (sIsBlocked == isBlock) { + return; + } + QStringList listBlockShortCut = { + "Minimize All Window", // 最小化所有窗口 + "Minimize Or Unminimize All Window Besides Active Window", // 最小化或还原非焦点窗口 + "Multitask View show", // 显示工作区 + "Show/Hide Desktop", // 显示/隐藏桌面 + "ShowDesktopGrid", // Show Desktop Grid + "ShowMultitaskView", // Show Multitask View + "Switch One Desktop Down", // 切换到下面的桌面 + "Switch One Desktop Up", // 切换到上面的桌面 + "Switch One Desktop to the Left", // 切换到左边的工作区 + "Switch One Desktop to the Right", // 切换到右边的工作区 + "Switch to Desktop 1", // 切换到桌面 1 + "Switch to Desktop 2", // 切换到桌面 2 + "Switch to Desktop 3", // 切换到桌面 3 + "Switch to Desktop 4", // 切换到桌面 4 + "Switch to Next Screen", // 切换到下一屏幕 + "Switch to Previous Screen", // 切换到上一个屏幕 + "Toggle Window Raise/Lower", // 窗口置前或置后 + "Unminimize All Window", // 还原所有最小化窗口 + "Walk Through Desktop List", // 遍历桌面列表 + "Walk Through Desktop List (Reverse)", // 遍历桌面列表(反向) + "Walk Through Desktops", // 遍历桌面 + "Walk Through Desktops (Reverse)", // 遍历桌面(反向) + "Walk Through Windows", // 遍历窗口 + "Walk Through Windows (Reverse)", // 遍历窗口(反向) + "Walk Through Windows Alternative", // 遍历窗口候选 + "Walk Through Windows Alternative (Reverse)", // 遍历窗口候选(反向) + "Walk Through Windows of Current Application", // 遍历当前应用程序窗口 + "Walk Through Windows of Current Application (Reverse)", // 遍历当前应用程序窗口(反向) + "Walk Through Windows of Current Application Alternative", // 遍历当前应用程序窗口候选 + "Walk Through Windows of Current Application Alternative (Reverse)", // 遍历当前应用程序窗口候选(反向) + "Walk Through fullscreenWindows", // 遍历所有最大化或全屏窗口 + "Window Lower", // 降低窗口 + "Window Maximize", // 最大化窗口 + "Window Maximize Horizontal", // 水平最大化窗口 + "Window Maximize Vertical", // 垂直最大化窗口 + "Window Minimize", // 最小化窗口 + "Window On All Desktops", // 将窗口放到全部桌面 + "Window One Desktop Down", // 窗口下移一个桌面 + "Window One Desktop Up", // 窗口上移一个桌面 + "Window One Desktop to the Left", // 窗口左移一个桌面 + "Window One Desktop to the Right", // 窗口右移一个桌面 + "Window Operations Menu", // 窗口操作菜单 + "Window Quick Move And Maximize Left Screen", // 窗口快速移动并最大化到下一个屏幕 + "Window Quick Move And Maximize Right Screen", // 窗口快速移动并最大化到上一个屏幕 + "Window Quick Move Left Screen", // 窗口快速移动到下一个屏幕 + "Window Quick Move Right Screen", // 窗口快速移动到上一个屏幕 + "Window to Desktop 1", // 窗口到桌面 1 + "Window to Desktop 2", // 窗口到桌面 2 + "Window to Desktop 3", // 窗口到桌面 3 + "Window to Desktop 4", // 窗口到桌面 4 + "Window to Next Desktop", // 窗口到下一桌面 + "Window to Next Screen", // 窗口到下一屏幕 + "Window to Previous Desktop", // 窗口到前一桌面 + "Window to Previous Screen", // 窗口到前一屏幕 + "Window to Screen 0", // 窗口到屏幕 0 + "Window to Screen 1", // 窗口到屏幕 1 + "Window to Screen 2", // 窗口到屏幕 2 + "Window to Screen 3", // 窗口到屏幕 3 + "Window to Screen 4", // 窗口到屏幕 4 + }; + sIsBlocked = isBlock; + if (sIsBlocked) { + if (!m_isWayland) { + // kwin shortcut + QDBusInterface kwinInterface("org.ukui.KWin", "/KWin", "org.kde.KWin", QDBusConnection::sessionBus()); + for (QString strShortCut : listBlockShortCut) { + QDBusMessage blockMessage = kwinInterface.call("blockShortcut", strShortCut, true); + if (blockMessage.type() == QDBusMessage::ErrorMessage) { + qWarning() << "Kwin dbus error:" << blockMessage.errorMessage(); + break; + } + } + } + + // usd shortcut + if (!m_usdBlockShortCut) { + m_usdBlockShortCut = new USDBlockShortCut(this); + } + } else { + if (!m_isWayland) { + // kwin shortcut + QDBusInterface kwinInterface("org.ukui.KWin", "/KWin", "org.kde.KWin", QDBusConnection::sessionBus()); + for (QString strShortCut : listBlockShortCut) { + QDBusMessage blockMessage = kwinInterface.call("blockShortcut", strShortCut, false); + if (blockMessage.type() == QDBusMessage::ErrorMessage) { + qWarning() << "Kwin dbus error1:" << blockMessage.errorMessage(); + break; + } + } + } + + // usd shortcut + if (m_usdBlockShortCut) { + delete m_usdBlockShortCut; + m_usdBlockShortCut = nullptr; + } + } +} + +bool FullScreenBackground::eventFilter(QObject *obj, QEvent *event) +{ + return QWidget::eventFilter(obj, event); +} diff --git a/polkit-agent/src/fullscreenbackground.h b/polkit-agent/src/fullscreenbackground.h new file mode 100644 index 0000000..90c0665 --- /dev/null +++ b/polkit-agent/src/fullscreenbackground.h @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2024 Tianjin KYLIN Information Technology Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + **/ +#ifndef FULLSCREENMANAGER_H +#define FULLSCREENMANAGER_H + +#include +#include +#include +#include +#include +#include +#include +#include "usdblockshortcut.h" + +class MainWindow; +class FullScreenBackground : public QWidget +{ + Q_OBJECT +public: + explicit FullScreenBackground(QWidget *parent = nullptr); + virtual ~FullScreenBackground(); + + /** + * @brief getMainWindow 获取认证对话框 + * @return 认证对话框指针 + */ + inline MainWindow *getMainWindow() + { + return m_wndMain; + } + + /** + * @brief initMainWindow 初始化认证对话框 + * @param strIconName 认证图标名称 + * @param strMsg 认证消息 + * @param listUsers 认证用户列表 + * @param subjectPid 项目进程号 + * @param callerPid 调用者进程号 + * @param actionDesc 动作描述 + * @param isMavis 是否为mavis平台 + * @param isSupportTableMode 是否支持平板模式 + */ + void initMainWindow( + const QString &strIconName, + const QString &strMsg, + const QStringList &listUsers, + const QString &subjectPid, + const QString &callerPid, + const PolkitQt1::ActionDescription &actionDesc, + const bool &isMavis, + const bool &isSupportTableMode); + + /** + * @brief showDialog 显示认证对话框 + */ + void showDialog(); + + /** + * @brief closeDialog 关闭认证对话框 + */ + void closeDialog(); + +protected: + /** + * @brief paintEvent 绘制事件处理 + * @param event 事件指针 + */ + void paintEvent(QPaintEvent *event); + + /** + * @brief closeEvent 窗口关闭事件处理 + * @param event 事件指针 + */ + void closeEvent(QCloseEvent *event); + + /** + * @brief resizeEvent 窗口大小改变事件处理 + * @param event 事件指针 + */ + void resizeEvent(QResizeEvent *event); + + bool eventFilter(QObject *obj, QEvent *event); + +private Q_SLOTS: + /** + * @brief onScreenCountChanged 屏幕数变化处理 + */ + void onScreenCountChanged(int); + + /** + * @brief onDesktopResized 桌面大小变化处理 + */ + void onDesktopResized(); + + /** + * @brief onPrimaryScreenChanged 主屏变化处理 + */ + void onPrimaryScreenChanged(); + + /** + * @brief onWorkAreaResized 工作区大小变化处理 + */ + void onWorkAreaResized(); + +private: + /** + * @brief initUI 初始化UI + */ + void initUI(); + + /** + * @brief initConnections 初始化信号槽连接 + */ + void initConnections(); + /** + * @brief isSupportCompositing 是否支持窗口复合 + * @return true 支持,否则不支持 + */ + bool isSupportCompositing(); + + /** + * @brief getBackground 获取背景 + * @return 背景pixmap + */ + QPixmap getBackground(); + + /** + * @brief getAccountBackground 获取账户背景 + * @return 背景路径 + */ + QString getAccountBackground(); + + /** + * @brief moveToScreen 移动认证弹窗到指定屏幕 + * @param screen 屏幕信息指针 + */ + void moveToScreen(QScreen *screen); + + /** + * @brief moveToCursorScreen 移动认证窗口到光标屏幕 + */ + void moveToCursorScreen(); + + /** + * @brief blockSomeShortCut 禁启用快捷键 + * @param isBlock 是否为禁用 + */ + void blockSomeShortCut(bool isBlock = false); + +private: + MainWindow *m_wndMain = nullptr; // 认证对话框 + QPixmap m_pixmapBackground; // 背景图 + bool m_isFirstShow = true; // 第一次显示才主动移动对话框居中 + USDBlockShortCut *m_usdBlockShortCut = nullptr; // usd禁启用快捷键实例 + bool m_isWayland = false; +}; + +#endif // FULLSCREENMANAGER_H diff --git a/polkit-agent/src/kalabel.cpp b/polkit-agent/src/kalabel.cpp index a74f9da..9f14c79 100644 --- a/polkit-agent/src/kalabel.cpp +++ b/polkit-agent/src/kalabel.cpp @@ -17,15 +17,12 @@ **/ #include "kalabel.h" - -KALabel::KALabel(QWidget *parent) - : QLabel(parent) +KALabel::KALabel(QWidget *parent) : QLabel(parent) { m_strText = ""; } -KALabel::KALabel(QString strText, QWidget *parent) - : QLabel(strText, parent) +KALabel::KALabel(QString strText, QWidget *parent) : QLabel(strText, parent) { m_strText = strText; } @@ -38,7 +35,7 @@ void KALabel::setText(const QString &strText) void KALabel::paintEvent(QPaintEvent *event) { - QString strEText = getElidedText(font(), width() ,m_strText); + QString strEText = getElidedText(font(), width(), m_strText); if (strEText != m_strText) { QLabel::setText(strEText); setToolTip(m_strText); @@ -49,13 +46,12 @@ void KALabel::paintEvent(QPaintEvent *event) QLabel::paintEvent(event); } -QString KALabel::getElidedText(QFont font,int width,QString strInfo) +QString KALabel::getElidedText(QFont font, int width, QString strInfo) { QFontMetrics fontMetrics(font); //如果当前字体下,字符串长度大于指定宽度 - if(fontMetrics.width(strInfo) > width) - { - strInfo= QFontMetrics(font).elidedText(strInfo, Qt::ElideRight, width); + if (fontMetrics.width(strInfo) > width) { + strInfo = QFontMetrics(font).elidedText(strInfo, Qt::ElideRight, width); } return strInfo; } diff --git a/polkit-agent/src/kalabel.h b/polkit-agent/src/kalabel.h index 8fc9b53..7ee60cb 100644 --- a/polkit-agent/src/kalabel.h +++ b/polkit-agent/src/kalabel.h @@ -26,7 +26,8 @@ class KALabel : public QLabel public: KALabel(QWidget *parent = nullptr); KALabel(QString strText, QWidget *parent = nullptr); - QString getElidedText(QFont font,int width,QString strInfo); + QString getElidedText(QFont font, int width, QString strInfo); + public slots: void setText(const QString &); diff --git a/polkit-agent/src/mainwindow.cpp b/polkit-agent/src/mainwindow.cpp index 74a0730..d2c8edf 100644 --- a/polkit-agent/src/mainwindow.cpp +++ b/polkit-agent/src/mainwindow.cpp @@ -13,8 +13,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see . - * -**/ + * + **/ #include "mainwindow.h" #include "ui_mainwindow.h" #include @@ -44,49 +44,49 @@ #include "biotypes.h" #include "modeButton.h" #include +#include #define _(string) gettext(string) extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); -MainWindow::MainWindow(QWidget *parent) : - QWidget(parent), - ui(new Ui::MainWindow), - users(new Users(this)), - enableBioAuth(false), - receiveBioPAM(false), - authMode(UNDEFINED), - useDoubleAuth(false), - m_timer(nullptr), - w_timer(nullptr), - isLockingFlg(false), - m_nCurLockMin(0), - isbioSuccess(false) +MainWindow::MainWindow(QWidget *parent) + : kdk::KDialog(parent) + , ui(new Ui::MainWindow) + , users(new Users(this)) + , enableBioAuth(false) + , receiveBioPAM(false) + , authMode(UNDEFINED) + , useDoubleAuth(false) + , m_timer(nullptr) + , w_timer(nullptr) + , isLockingFlg(false) + , m_nCurLockMin(0) + , isbioSuccess(false) { - setWindowFlags(Qt::Tool | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint); ui->setupUi(this); - setWindowTitle(tr("Authentication")); + mainLayout()->addLayout(ui->verticalLayout_2); pam_tally_init(); // -// headerLayout = new QHBoxLayout(); -// headerLayout->setContentsMargins(8,0,8,0); -// headerLayout->setSpacing(8); -// logoLabel = new QLabel(); -// logoLabel->setPixmap(QIcon::fromTheme("ukui-polkit").pixmap(QSize(24,24))); -// headerLayout->addWidget(logoLabel); -// titleLabel = new QLabel(); -// titleLabel->setText(tr("Authenticate")); -// headerLayout->addWidget(titleLabel); -// ui->headerWidget->setLayout(headerLayout); -// headerLayout->addStretch(); -// closeBtn = new QPushButton(); -// closeBtn->setFixedSize(30, 30); -// closeBtn->setToolTip(tr("Close")); -// closeBtn->setProperty("isWindowButton", 0x02); -// closeBtn->setProperty("useIconHighlightEffect", 0x08); -// closeBtn->setFlat(true); -// closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); -// connect(closeBtn, &QPushButton::clicked, this, &MainWindow::close); -// headerLayout->addWidget(closeBtn); + // headerLayout = new QHBoxLayout(); + // headerLayout->setContentsMargins(8,0,8,0); + // headerLayout->setSpacing(8); + // logoLabel = new QLabel(); + // logoLabel->setPixmap(QIcon::fromTheme("ukui-polkit").pixmap(QSize(24,24))); + // headerLayout->addWidget(logoLabel); + // titleLabel = new QLabel(); + // titleLabel->setText(tr("Authenticate")); + // headerLayout->addWidget(titleLabel); + // ui->headerWidget->setLayout(headerLayout); + // headerLayout->addStretch(); + // closeBtn = new QPushButton(); + // closeBtn->setFixedSize(30, 30); + // closeBtn->setToolTip(tr("Close")); + // closeBtn->setProperty("isWindowButton", 0x02); + // closeBtn->setProperty("useIconHighlightEffect", 0x08); + // closeBtn->setFlat(true); + // closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); + // connect(closeBtn, &QPushButton::clicked, this, &MainWindow::close); + // headerLayout->addWidget(closeBtn); // 登录选项 m_labelTip = new KALabel(); @@ -95,7 +95,7 @@ MainWindow::MainWindow(QWidget *parent) : m_loginOptsWidget = new LoginOptionsWidget(); m_loginOptsWidget->hide(); ui->titleTipLayout->addWidget(m_labelTip); - ui->loginOptionsLayout->setAlignment(Qt::AlignTop|Qt::AlignCenter); + ui->loginOptionsLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); ui->loginOptionsLayout->addWidget(m_loginOptsWidget); ui->loadingUkeyWidget->adjustSize(); ui->loadingUkeyWidget->hide(); @@ -103,83 +103,88 @@ MainWindow::MainWindow(QWidget *parent) : ui->loadingUkeyBtn->setAttribute(Qt::WA_TransparentForMouseEvents, true); ui->ukeyPassword->setEchoMode(QLineEdit::Password); ui->loadingUkeyLbl->setText(tr("Insert the ukey into the USB port")); - ui->loadingUkeyLbl->setAlignment(Qt::AlignTop|Qt::AlignHCenter); + ui->loadingUkeyLbl->setAlignment(Qt::AlignTop | Qt::AlignHCenter); ui->ukeyTipLbl->setText(tr("Enter the ukey password")); ui->ukeyPassword->setPlaceholderText(tr("Input Password")); + ui->btnCancel->setAutoDefault(false); + ui->btnCancel->setDefault(false); maxFailedTimes = bioDevices.getFailedTimes(); isHiddenSwitchButton = bioDevices.GetHiddenSwitchButton(); + closeButton()->setToolTip(tr("Close")); - connect(m_loginOptsWidget, &LoginOptionsWidget::optionSelected, - this, [&](unsigned uCurLoginOptType, const DeviceInfoPtr &deviceInfo){ - isLoadingUkey = false; + connect( + m_loginOptsWidget, + &LoginOptionsWidget::optionSelected, + this, + [&](unsigned uCurLoginOptType, const DeviceInfoPtr &deviceInfo) { + isLoadingUkey = false; - if(uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY){ - stopLoadingUkey(); - } - - if(uCurLoginOptType == LOGINOPT_TYPE_PASSWORD){ - switchLoginOptType(uCurLoginOptType); - if(m_loginOptsWidget){ - m_loginOptsWidget->stopAuth(); + if (uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY) { + stopLoadingUkey(); } - m_deviceInfo = nullptr; - authMode = PASSWORD; - emit restartAuth(); - return; - } - if (uCurLoginOptType != LOGINOPT_TYPE_GENERAL_UKEY && !deviceInfo) - return; + if (uCurLoginOptType == LOGINOPT_TYPE_PASSWORD) { + switchLoginOptType(uCurLoginOptType); + if (m_loginOptsWidget) { + m_loginOptsWidget->stopAuth(); + } + m_deviceInfo = nullptr; + authMode = PASSWORD; + emit restartAuth(); + return; + } - if(deviceInfo) - qDebug() << "device changed: " << deviceInfo->biotype; + if (uCurLoginOptType != LOGINOPT_TYPE_GENERAL_UKEY && !deviceInfo) + return; - if(deviceInfo && m_failMap[getUid(userName)][deviceInfo->device_id] >= maxFailedTimes){ - qDebug() << "Failed MAX!!"; - return ; - } + if (deviceInfo) + qDebug() << "device changed: " << deviceInfo->biotype; - if (uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY && !deviceInfo){ - isLoadingUkey = true; - startLoadingUkey(); - m_loginOptsWidget->updateUkeyUIStatus(LOGINOPT_TYPE_GENERAL_UKEY); - }else if(uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY && deviceInfo){ - stopLoadingUkey(); - m_loginOptsWidget->updateUkeyUIStatus(LOGINOPT_TYPE_GENERAL_UKEY); - } + if (deviceInfo && m_failMap[getUid(userName)][deviceInfo->device_id] >= maxFailedTimes) { + qDebug() << "Failed MAX!!"; + return; + } - if (deviceInfo == m_deviceInfo) { - return; - } + if (uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY && !deviceInfo) { + isLoadingUkey = true; + startLoadingUkey(); + m_loginOptsWidget->updateUkeyUIStatus(LOGINOPT_TYPE_GENERAL_UKEY); + } else if (uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY && deviceInfo) { + stopLoadingUkey(); + m_loginOptsWidget->updateUkeyUIStatus(LOGINOPT_TYPE_GENERAL_UKEY); + } - if (uCurLoginOptType != LOGINOPT_TYPE_GENERAL_UKEY && deviceInfo == m_deviceInfo) { - return ; - } + if (deviceInfo == m_deviceInfo) { + return; + } - if(m_bioTimer) - m_bioTimer->stop(); + if (uCurLoginOptType != LOGINOPT_TYPE_GENERAL_UKEY && deviceInfo == m_deviceInfo) { + return; + } - m_deviceInfo = deviceInfo; - switchLoginOptType(uCurLoginOptType); - if(!isbioSuccess && m_deviceInfo) { - startBioAuth(); - } - }); + if (m_bioTimer) + m_bioTimer->stop(); - connect(m_loginOptsWidget, &LoginOptionsWidget::notifyOptionsChange, - this, [&](unsigned uOptionsCount){ + m_deviceInfo = deviceInfo; + switchLoginOptType(uCurLoginOptType); + if (!isbioSuccess && m_deviceInfo) { + startBioAuth(); + } + }); + + connect(m_loginOptsWidget, &LoginOptionsWidget::notifyOptionsChange, this, [&](unsigned uOptionsCount) { if (uOptionsCount > 0) { m_loginOptsWidget->show(); } else { - //m_loginOptsWidget->hide(); + // m_loginOptsWidget->hide(); } - - if (m_deviceInfo && m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY){ - stopLoadingUkey(); + + if (m_deviceInfo && m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) { + stopLoadingUkey(); } if (!m_deviceInfo || !m_loginOptsWidget->findDeviceById(m_deviceInfo->device_id) - || m_loginOptsWidget->isDeviceDisable(m_deviceInfo->device_id)) { + || m_loginOptsWidget->isDeviceDisable(m_deviceInfo->device_id)) { m_loginOptsWidget->stopAuth(); if (authMode != UNDEFINED) { authMode = UNDEFINED; @@ -188,76 +193,84 @@ MainWindow::MainWindow(QWidget *parent) : } }); - connect(m_loginOptsWidget, &LoginOptionsWidget::authComplete, - this, [&](uid_t uid, bool ret, int nStatus){ + connect(m_loginOptsWidget, &LoginOptionsWidget::authComplete, this, [&](uid_t uid, bool ret, int nStatus) { qDebug() << "biometric authentication complete: " << uid << ret << nStatus; - if(m_deviceInfo && m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY && ui->widgetUkeyAuth->isVisible()){ + if (m_deviceInfo && m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY && ui->widgetUkeyAuth->isVisible()) { ui->ukeyPassword->setText(""); } - if(uid == getUid(userName) && ret) { + if (uid == getUid(userName) && ret) { isbioSuccess = true; emit switchToBiometric(); authMode = UNDEFINED; } else { if (nStatus == 5 && m_deviceInfo) { - if(w_timer && w_timer->isActive()) + if (w_timer && w_timer->isActive()) w_timer->stop(); QImage imgFailed; m_loginOptsWidget->setFaceImg(imgFailed, 2); return; - } else if (nStatus >= 2 && nStatus != 5)if (nStatus >= 2) { - if (m_deviceInfo) { - uid_t curUid = getUid(userName); - if(m_failMap.contains(curUid) && m_failMap[curUid].contains(m_deviceInfo->device_id)){ - m_failMap[curUid][m_deviceInfo->device_id] = m_failMap[curUid][m_deviceInfo->device_id] + 1; - }else{ - m_failMap[curUid][m_deviceInfo->device_id] = 1; - } - qDebug()<<"Failed count:"<device_id]<<",Max:"<biotype == BIOTYPE_FACE) { - QImage imgFailed; - m_loginOptsWidget->setFaceImg(imgFailed, 1); - } - if(m_failMap[curUid][m_deviceInfo->device_id] >= maxFailedTimes){ - no_changes = true; - if (m_deviceInfo->biotype == REMOTE_QRCODE_TYPE) { - setLoginTypeTip(tr("Failed to verify %1, please enter password to unlock").arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); - QImage nullImage; - m_loginOptsWidget->setQRCode(nullImage); - } else if(m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY){ - ui->ukeyPassword->setReadOnly(true); - setUkeyTypeTip(tr("Unable to verify %1, please enter password to unlock").arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); - }else { - setLoginTypeTip(tr("Unable to verify %1, please enter password to unlock").arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); + } else if (nStatus >= 2 && nStatus != 5) + if (nStatus >= 2) { + if (m_deviceInfo) { + uid_t curUid = getUid(userName); + if (m_failMap.contains(curUid) && m_failMap[curUid].contains(m_deviceInfo->device_id)) { + m_failMap[curUid][m_deviceInfo->device_id] = m_failMap[curUid][m_deviceInfo->device_id] + 1; + } else { + m_failMap[curUid][m_deviceInfo->device_id] = 1; } + qDebug() << "Failed count:" << m_failMap[curUid][m_deviceInfo->device_id] + << ",Max:" << maxFailedTimes; + if (m_deviceInfo->biotype == BIOTYPE_FACE) { + QImage imgFailed; + m_loginOptsWidget->setFaceImg(imgFailed, 1); + } + if (m_failMap[curUid][m_deviceInfo->device_id] >= maxFailedTimes) { + no_changes = true; + if (m_deviceInfo->biotype == REMOTE_QRCODE_TYPE) { + setLoginTypeTip(tr("Failed to verify %1, please enter password to unlock") + .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); + QImage nullImage; + m_loginOptsWidget->setQRCode(nullImage); + } else if (m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) { + ui->ukeyPassword->setReadOnly(true); + setUkeyTypeTip(tr("Unable to verify %1, please enter password to unlock") + .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); + } else { + setLoginTypeTip(tr("Unable to verify %1, please enter password to unlock") + .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); + } - m_loginOptsWidget->setDeviceDisable(m_deviceInfo->device_id, true); - useDoubleAuth = false; - return ; - } - no_changes = false; - if(m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY){ - setUkeyTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities") - .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)) - .arg(maxFailedTimes-m_failMap[curUid][m_deviceInfo->device_id])); - }else{ - setLoginTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities") - .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)) - .arg(maxFailedTimes-m_failMap[curUid][m_deviceInfo->device_id])); + m_loginOptsWidget->setDeviceDisable(m_deviceInfo->device_id, true); + useDoubleAuth = false; + return; + } + no_changes = false; + if (m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) { + setUkeyTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities") + .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)) + .arg(maxFailedTimes - m_failMap[curUid][m_deviceInfo->device_id])); + } else { + setLoginTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities") + .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)) + .arg(maxFailedTimes - m_failMap[curUid][m_deviceInfo->device_id])); + } } } - } - if(!isbioSuccess) { + if (!isbioSuccess) { // dbus error if (nStatus == -1) { - qDebug()<<"Biometric dbus error:"<setQRCodeMsg(tr("Abnormal network")); startBioAuth(10000); + } else if (m_uCurLoginOptType == LOGINOPT_TYPE_QRCODE && nStatus == -4) { + m_isNetworkErr = true; + m_loginOptsWidget->setQRCodeMsg(tr("Acquisition failure")); + startBioAuth(10000); } else { startBioAuth(); } @@ -279,36 +292,32 @@ MainWindow::MainWindow(QWidget *parent) : setStyleSheet(qssFile.readAll()); qssFile.close(); - //ui->cmbUsers->hide(); - //ui->widgetDetails->hide(); - //ui->btnDetails->setIcon(QIcon(":/image/assets/arrow_right.svg")); - //ui->btnDetails->hide(); + // ui->cmbUsers->hide(); + // ui->widgetDetails->hide(); + // ui->btnDetails->setIcon(QIcon(":/image/assets/arrow_right.svg")); + // ui->btnDetails->hide(); ui->lePassword->installEventFilter(this); switchWidget(UNDEFINED); editIcon(); ui->lblContent->adjustSize(); - ui->lblContent->height(); - ui->lblMessage->adjustSize(); + ui->lblContent->hide(); + ui->lblMessage->setFixedSize(372, 30); ui->widgetPasswdAuth->adjustSize(); ui->widgetUkeyAuth->adjustSize(); - ui->lblMessage->height(); ui->cmbUsers->view()->setTextElideMode(Qt::ElideRight); + ui->cmbUsers->setFixedHeight(36); + ui->lePassword->setFixedHeight(36); + ui->btnBioAuth->hide(); + ui->returnButton->hide(); - settings = new QGSettings("org.ukui.style","",this); - fontSize = settings->get("system-font-size").toInt(); - connect(settings, &QGSettings::changed, - this, &MainWindow::onConfigurationChanged); - - QDBusInterface *interfaceScreensaver = new QDBusInterface( - "org.ukui.ScreenSaver", - "/", - "org.ukui.ScreenSaver", - QDBusConnection::sessionBus()); - connect(interfaceScreensaver, SIGNAL(lock()), - this, SLOT(onLockStatus())); - connect(interfaceScreensaver, SIGNAL(unlock()), - this, SLOT(onUnlockStatus())); + settings = new QGSettings("org.ukui.style", "", this); + fontSize = settings->get("system-font-size").toInt(); + connect(settings, &QGSettings::changed, this, &MainWindow::onConfigurationChanged); + QDBusInterface *interfaceScreensaver + = new QDBusInterface("org.ukui.ScreenSaver", "/", "org.ukui.ScreenSaver", QDBusConnection::sessionBus()); + connect(interfaceScreensaver, SIGNAL(lock()), this, SLOT(onLockStatus())); + connect(interfaceScreensaver, SIGNAL(unlock()), this, SLOT(onUnlockStatus())); } MainWindow::~MainWindow() @@ -318,19 +327,31 @@ MainWindow::~MainWindow() void MainWindow::onConfigurationChanged(QString key) { - if(key == "systemFontSize"){ + if (key == "systemFontSize") { m_loginOptsWidget->updateUIStatus(false); - fontSize = settings->get("system-font-size").toInt(); + fontSize = settings->get("system-font-size").toInt(); } - if(key == "iconThemeName") { + if (key == "iconThemeName") { setIcon(app_IconName); } + if (key == "styleName") { + QPalette pe; + if (no_changes) { + pe.setColor(QPalette::WindowText, Qt::red); + m_labelTip->setPalette(pe); + } else { + QColor color = palette().color(QPalette::WindowText); + QPalette pal(this->palette()); + pal.setColor(QPalette::WindowText, QColor(color)); + m_labelTip->setPalette(pal); + } + } } void MainWindow::restart_bio_identify() { DeviceInfoPtr device = bioDevices.getDefaultDevice(getUid(userName)); - if(device){ + if (device) { m_loginOptsWidget->startAuth(device, getUid(userName)); setMessage(tr("Please enter your password or enroll your fingerprint ")); } @@ -338,21 +359,22 @@ void MainWindow::restart_bio_identify() void MainWindow::closeEvent(QCloseEvent *event) { - m_loginOptsWidget->stopAuth(); + if (m_loginOptsWidget) { + m_loginOptsWidget->stopAuth(); + } m_failMap.clear(); emit canceled(); - - return QWidget::closeEvent(event); + return kdk::KDialog::closeEvent(event); } void MainWindow::setUkeyTypeTip(QString text) { QString textTip = text; if (!textTip.isEmpty()) { -// QFontMetrics font(m_ukeyMessageLabel->font()); -// QString textTip = font.elidedText(textTip, Qt::ElideRight, m_messageLabel->width()-8); + // QFontMetrics font(m_ukeyMessageLabel->font()); + // QString textTip = font.elidedText(textTip, Qt::ElideRight, m_messageLabel->width()-8); QPalette pe; - pe.setColor(QPalette::WindowText,Qt::red); + pe.setColor(QPalette::WindowText, Qt::red); ui->ukeyMessage->setPalette(pe); ui->ukeyMessage->setText(textTip); ui->ukeyMessage->setToolTip(text); @@ -364,7 +386,7 @@ void MainWindow::setUkeyTypeTip(QString text) void MainWindow::startLoadingUkey() { - m_loadingPixmap = QIcon::fromTheme("ukui-loading-0-symbolic").pixmap(27,27); + m_loadingPixmap = QIcon::fromTheme("ukui-loading-0-symbolic").pixmap(27, 27); ui->loadingUkeyBtn->setIcon(m_loadingPixmap); ui->loadingUkeyBtn->setIconSize(QSize(27, 27)); @@ -378,8 +400,7 @@ void MainWindow::startLoadingUkey() isLoadingUkey = true; ui->loadingUkeyWidget->show(); - if(!m_loadingTimer) - { + if (!m_loadingTimer) { m_loadingTimer = new QTimer(this); m_loadingTimer->setInterval(150); connect(m_loadingTimer, &QTimer::timeout, this, &MainWindow::updateLoadingPixmap); @@ -390,13 +411,13 @@ void MainWindow::startLoadingUkey() void MainWindow::stopLoadingUkey() { isLoadingUkey = false; - if(m_loadingTimer){ + if (m_loadingTimer) { m_loadingTimer->stop(); } ui->loadingUkeyWidget->hide(); - //ui->cmbUsers->show(); - //ui->widgetUkeyAuth->show(); + // ui->cmbUsers->show(); + // ui->widgetUkeyAuth->show(); } void MainWindow::updateLoadingPixmap() @@ -415,14 +436,14 @@ void MainWindow::paintEvent(QPaintEvent *event) QPainter p(this); p.setRenderHint(QPainter::Antialiasing); QPainterPath rectPath; - rectPath.addRoundedRect(this->rect().adjusted(0,0,0,0),0,0); + rectPath.addRoundedRect(this->rect().adjusted(0, 0, 0, 0), 0, 0); // 画一个黑底 QPixmap pixmap(this->rect().size()); pixmap.fill(Qt::transparent); QPainter pixmapPainter(&pixmap); pixmapPainter.setRenderHint(QPainter::Antialiasing); pixmapPainter.setPen(Qt::transparent); - pixmapPainter.setBrush(QColor(0,0,0,100)); + pixmapPainter.setBrush(QColor(0, 0, 0, 100)); pixmapPainter.drawPath(rectPath); pixmapPainter.end(); @@ -444,34 +465,52 @@ void MainWindow::paintEvent(QPaintEvent *event) // 绘制一个背景 p.save(); - p.fillPath(rectPath,option->palette.color(QPalette::Base)); + p.fillPath(rectPath, option->palette.color(QPalette::Base)); p.restore(); - //绘制一个矩形 + // 绘制一个矩形 p.setPen(Qt::red); - QRectF rect(0,290,20,20); - } bool MainWindow::eventFilter(QObject *obj, QEvent *event) { - if(obj == ui->lePassword){ - if(event->type() == QEvent::KeyPress){ //禁止复制粘贴功能。 + if (obj == ui->lePassword) { + if (event->type() == QEvent::KeyPress) { // 禁止复制粘贴功能。 QKeyEvent *keyEvent = static_cast(event); - if(keyEvent->matches(QKeySequence::Copy) || keyEvent->matches(QKeySequence::Cut) || keyEvent->matches(QKeySequence::Paste)){ + if (keyEvent->matches(QKeySequence::Copy) || keyEvent->matches(QKeySequence::Cut) + || keyEvent->matches(QKeySequence::Paste)) { event->ignore(); return true; } } - if(event->type() == QEvent::MouseButtonRelease) { //禁用鼠标中键 - QMouseEvent *mouseevent = static_cast(event); - if(mouseevent->button() == Qt::MidButton){ + if (event->type() == QEvent::MouseButtonRelease) { // 禁用鼠标中键 + QMouseEvent *mouseevent = static_cast(event); + if (mouseevent->button() == Qt::MidButton) { event->ignore(); return true; } } + } else if (obj == this) { + if (event->type() == QEvent::Show || event->type() == QEvent::UpdateRequest) { + if (QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") { + WindowManager::setWindowLayer(this->windowHandle(), (kdk::WindowLayer)15); + } + } + } + return kdk::KDialog::eventFilter(obj, event); +} + +void MainWindow::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) { + case Qt::Key_Escape: { + break; + } + default: { + kdk::KDialog::keyPressEvent(event); + break; + } } - return false; } /*** main ***/ @@ -479,14 +518,14 @@ void MainWindow::on_cmbUsers_currentTextChanged(const QString &userName) { qDebug() << "user changed to " << userName; m_loginOptsWidget->stopAuth(); - if(m_bioTimer && m_bioTimer->isActive()) + if (m_bioTimer && m_bioTimer->isActive()) m_bioTimer->stop(); - authMode=UNDEFINED; + authMode = UNDEFINED; QList accountUsers = users->getUsers(); this->userName = userName; - for(UserItem user:accountUsers){ - if(user.realName == userName){ + for (UserItem user : accountUsers) { + if (user.realName == userName) { this->userName = user.name; } } @@ -506,36 +545,35 @@ int MainWindow::enable_biometric_authentication() char line[1024], is_enable[16]; int i; - - if((file = fopen(conf_file, "r")) == NULL){ + if ((file = fopen(conf_file, "r")) == NULL) { return 0; } - while(fgets(line, sizeof(line), file)) { - i = sscanf(line, "EnableAuth=%s\n", is_enable); - if(i > 0) { + while (fgets(line, sizeof(line), file)) { + i = sscanf(line, "EnableAuth=%s\n", is_enable); + if (i > 0) { break; } } fclose(file); - if(!strcmp(is_enable, "true")) + if (!strcmp(is_enable, "true")) return 1; return 0; } void MainWindow::on_btnDetails_clicked() -{/* - if(ui->widgetDetails->isHidden()) { - ui->widgetDetails->show(); - ui->btnDetails->setIcon(QIcon(":/image/assets/arrow_down.svg")); -// resize(width(), height() + ui->widgetDetails->height()); - } - else { - ui->widgetDetails->hide(); - ui->btnDetails->setIcon(QIcon(":/image/assets/arrow_right.svg")); -// resize(width(), height() - ui->widgetDetails->height()); - } - adjustSize();*/ +{ /* + if(ui->widgetDetails->isHidden()) { + ui->widgetDetails->show(); + ui->btnDetails->setIcon(QIcon(":/image/assets/arrow_down.svg")); + // resize(width(), height() + ui->widgetDetails->height()); + } + else { + ui->widgetDetails->hide(); + ui->btnDetails->setIcon(QIcon(":/image/assets/arrow_right.svg")); + // resize(width(), height() - ui->widgetDetails->height()); + } + adjustSize();*/ } void MainWindow::on_btnCancel_clicked() @@ -545,22 +583,37 @@ void MainWindow::on_btnCancel_clicked() void MainWindow::on_btnAuth_clicked() { - if(ui->widgetUkeyAuth->isVisible()){ + if (doNotNeedAuth) { + emit yesPrompted(); + return; + } + + if (ui->widgetUkeyAuth->isVisible()) { on_ukeyPassword_returnPressed(); - }else{ + } else { on_lePassword_returnPressed(); } } +void MainWindow::onShowYesPrompt() +{ + doNotNeedAuth = true; + ui->widgetPasswdAuth->hide(); + ui->cmbUsers->hide(); + ui->btnBioAuth->hide(); + ui->returnButton->hide(); + ui->btnAuth->show(); +} + void MainWindow::onLockStatus() { - //m_loginOptsWidget->stopAuth(); + // m_loginOptsWidget->stopAuth(); m_loginOptsWidget->lockStatusChanged(true); } void MainWindow::onUnlockStatus() { - //m_loginOptsWidget->readDevicesInfo(); + // m_loginOptsWidget->readDevicesInfo(); m_loginOptsWidget->lockStatusChanged(false); startBioAuth(); } @@ -570,7 +623,7 @@ void MainWindow::editIcon() { m_modeButton = new ModeButton(ui->lePassword); m_modeButton->setFocusPolicy(Qt::NoFocus); - connect(m_modeButton, &QPushButton::clicked, this, [=](){ + connect(m_modeButton, &QPushButton::clicked, this, [=]() { if (ui->lePassword->echoMode() == QLineEdit::Password) { ui->lePassword->setEchoMode(QLineEdit::Normal); } else { @@ -580,15 +633,15 @@ void MainWindow::editIcon() QHBoxLayout *layout = new QHBoxLayout(ui->lePassword); layout->addStretch(); layout->addWidget(m_modeButton); - layout->setContentsMargins(0,0,8,0); + layout->setContentsMargins(0, 0, 8, 0); - ui->lePassword->setTextMargins(1, 1, 4+ m_modeButton->width(), 1); + ui->lePassword->setTextMargins(1, 1, 4 + m_modeButton->width(), 1); } void MainWindow::on_ukeyPassword_returnPressed() { - if(m_loginOptsWidget && m_deviceInfo){ - m_loginOptsWidget->SetExtraInfo(ui->ukeyPassword->text(),"pincode"); + if (m_loginOptsWidget && m_deviceInfo) { + m_loginOptsWidget->SetExtraInfo(ui->ukeyPassword->text(), "pincode"); m_loginOptsWidget->startAuth(m_deviceInfo, getUid(userName)); } } @@ -598,8 +651,7 @@ void MainWindow::on_lePassword_returnPressed() emit accept(ui->lePassword->text()); ui->btnAuth->hide(); ui->btnLoading->show(); - if(!w_timer) - { + if (!w_timer) { w_timer = new QTimer(this); w_timer->setInterval(150); connect(w_timer, &QTimer::timeout, this, &MainWindow::updatePixmap); @@ -625,20 +677,19 @@ void MainWindow::on_returnButton_clicked() } /*** end of control's slot ***/ - /*** public member ***/ void MainWindow::setIcon(const QString &iconName) { -// QIcon::setThemeName("ukui-icon-theme"); + // QIcon::setThemeName("ukui-icon-theme"); app_IconName = iconName; - if(!QIcon::hasThemeIcon("ukui-polkit")) { + if (!QIcon::hasThemeIcon("ukui-polkit")) { QDir iconsDir("/usr/share/icons"); auto themesList = iconsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); qDebug() << themesList; - for(auto theme : themesList) { + for (auto theme : themesList) { QIcon::setThemeName(theme); - if(QIcon::hasThemeIcon("ukui-polkit")) { + if (QIcon::hasThemeIcon("ukui-polkit")) { qDebug() << theme << "has ukui-polkit icon"; break; } @@ -649,25 +700,22 @@ void MainWindow::setIcon(const QString &iconName) QPainter painter; painter.begin(&icon); - QRect rect(32, - 32, - 32, 32); + QRect rect(32, 32, 32, 32); painter.drawPixmap(rect, actionIcon); painter.end(); setWindowIcon(icon); - //ui->lblIcon->setPixmap(icon); + // ui->lblIcon->setPixmap(icon); } void MainWindow::setHeader(const QString &text) { - if(is_Mavis) + if (is_Mavis) ui->lblHeader->setText(tr("This operation requires the administrator's authorization. " - "Please enter your password to allow this operation.")); + "Please enter your password to allow this operation.")); else ui->lblHeader->setText(text); ui->lblHeader->adjustSize(); - ui->lblHeader->height(); ui->lblContent->setText(tr("A program is attempting to perform an action that requires privileges." "It requires authorization to perform the action.")); ui->lblContent->adjustSize(); @@ -675,24 +723,24 @@ void MainWindow::setHeader(const QString &text) void MainWindow::setUsers(const QStringList &usersList) { - if(usersList.isEmpty()) + if (usersList.isEmpty()) return; - if(usersList.size() == 1) { + if (usersList.size() == 1) { UserItem user = users->getUserByName(usersList.at(0)); - if(user.realName != ""){ + if (user.realName != "") { userName = user.realName; - }else{ + } else { userName = usersList.at(0); } } QList accountUsers = users->getUsers(); - for(QString identifyUser:usersList){ + for (QString identifyUser : usersList) { bool isFoundAccount = false; - for(UserItem user:accountUsers){ - if(identifyUser == user.name){ - if(user.realName != "") + for (UserItem user : accountUsers) { + if (identifyUser == user.name) { + if (user.realName != "") ui->cmbUsers->addItem(user.realName); else ui->cmbUsers->addItem(user.name); @@ -706,7 +754,7 @@ void MainWindow::setUsers(const QStringList &usersList) } ui->cmbUsers->show(); - //ui->cmbUsers->adjustSize(); + // ui->cmbUsers->adjustSize(); } /* void MainWindow::setDetails(const QString &subPid, const QString &callerPid, const QString &actionId, @@ -725,7 +773,7 @@ void MainWindow::setPrompt(const QString &text, bool echo) { QString prompt = text; - if(text == "Input Password"){ + if (text == "Input Password") { prompt = tr("Input Password"); } else if (text == "Password: " || text == "Password:") { prompt = tr("Password: "); @@ -734,18 +782,18 @@ void MainWindow::setPrompt(const QString &text, bool echo) } else if (text == "_Password:") { prompt = tr("_Password:"); } - if(!m_timer){ + if (!m_timer) { m_timer = new QTimer(this); m_timer->setInterval(200); connect(m_timer, &QTimer::timeout, this, &MainWindow::unlock_countdown); } - //qDebug() << "6666"; + // qDebug() << "6666"; m_timer->start(); unlock_countdown(); ui->lePassword->clear(); ui->lePassword->setPlaceholderText(prompt); - // switchWidget(PASSWORD); + // switchWidget(PASSWORD); } /* @@ -756,89 +804,92 @@ void MainWindow::setPrompt(const QString &text, bool echo) */ QString MainWindow::check_is_pam_message(QString text) { - setlocale(LC_ALL,""); - bindtextdomain("Linux-PAM","/usr/share/locale"); - bind_textdomain_codeset("Linux-PAM","UTF-8"); + if (text.isEmpty()) { + return text; + } + setlocale(LC_ALL, ""); + bindtextdomain("Linux-PAM", "/usr/share/locale"); + bind_textdomain_codeset("Linux-PAM", "UTF-8"); textdomain("Linux-PAM"); - char* str; + char *str; QString strTrans = ""; QByteArray ba = text.toLocal8Bit(); // must - str=ba.data(); + str = ba.data(); char l_str[1024]; - int a,b; - //兼容旧版本翻译,以及适配新版本翻译 - //因为不知道什么原因,pam发过来的始终为英文,因此这里主动加载pam的翻译文件,使用gettext获取翻译 - if(text.contains("attemps",Qt::CaseSensitive) && sscanf(str,"Authenticated failed, %d login attemps left",&a)) - snprintf(l_str,1024,_("Authenticated failed, %d login attemps left"),a); - else if(text.contains("attempts",Qt::CaseSensitive) && sscanf(str,"Authenticated failed, %d login attempts left",&a)) - snprintf(l_str,1024,_("Authenticated failed, %d login attempts left"),a); - else if(text.contains("attempt",Qt::CaseSensitive) && sscanf(str,"Authenticated failed, %d login attempt left",&a)) - snprintf(l_str,1024,_("Authenticated failed, %d login attempt left"),a); - else if(text.contains("days",Qt::CaseSensitive) && sscanf(str,"Account locked, %d days left",&a)){ - //这里的消息是多个字符串拼接起来的,无法在翻译文件中找到对应的句子,只能自己翻译 + int a, b; + // 兼容旧版本翻译,以及适配新版本翻译 + // 因为不知道什么原因,pam发过来的始终为英文,因此这里主动加载pam的翻译文件,使用gettext获取翻译 + if (text.contains("attemps", Qt::CaseSensitive) && sscanf(str, "Authenticated failed, %d login attemps left", &a)) + snprintf(l_str, 1024, _("Authenticated failed, %d login attemps left"), a); + else if ( + text.contains("attempts", Qt::CaseSensitive) && sscanf(str, "Authenticated failed, %d login attempts left", &a)) + snprintf(l_str, 1024, _("Authenticated failed, %d login attempts left"), a); + else if ( + text.contains("attempt", Qt::CaseSensitive) && sscanf(str, "Authenticated failed, %d login attempt left", &a)) + snprintf(l_str, 1024, _("Authenticated failed, %d login attempt left"), a); + else if (text.contains("days", Qt::CaseSensitive) && sscanf(str, "Account locked, %d days left", &a)) { + // 这里的消息是多个字符串拼接起来的,无法在翻译文件中找到对应的句子,只能自己翻译 strTrans = tr("Account locked,") + QString("%1 ").arg(a) + tr("days left"); return strTrans; - } - else if(text.contains("hours",Qt::CaseSensitive) && sscanf(str,"Account locked, %d hours left",&a)){ + } else if (text.contains("hours", Qt::CaseSensitive) && sscanf(str, "Account locked, %d hours left", &a)) { strTrans = tr("Account locked,") + QString("%1 ").arg(a) + tr("hours left"); return strTrans; - } - else if(text.contains("minutes",Qt::CaseSensitive) && sscanf(str,"Account locked, %d minutes left",&a)){ + } else if (text.contains("minutes", Qt::CaseSensitive) && sscanf(str, "Account locked, %d minutes left", &a)) { strTrans = tr("Account locked,") + QString("%1 ").arg(a) + tr("minutes left"); return strTrans; - } - else if(text.contains("seconds",Qt::CaseSensitive) && sscanf(str,"Account locked, %d seconds left",&a)){ + } else if (text.contains("seconds", Qt::CaseSensitive) && sscanf(str, "Account locked, %d seconds left", &a)) { strTrans = tr("Account locked,") + QString("%1 ").arg(a) + tr("seconds left"); return strTrans; - }else if(text.contains("Warning: ",Qt::CaseSensitive) && sscanf(str,"Warning: your password will expire in %d day",&a)){ - snprintf(l_str,1024,_("Warning: your password will expire in %d day"),a); - }else if(text.contains("Warning: ",Qt::CaseSensitive) && sscanf(str,"Warning: your password will expire in %d days",&a)){ - snprintf(l_str,1024,_("Warning: your password will expire in %d days"),a); - } - else{ + } else if ( + text.contains("Warning: ", Qt::CaseSensitive) + && sscanf(str, "Warning: your password will expire in %d day", &a)) { + snprintf(l_str, 1024, _("Warning: your password will expire in %d day"), a); + } else if ( + text.contains("Warning: ", Qt::CaseSensitive) + && sscanf(str, "Warning: your password will expire in %d days", &a)) { + snprintf(l_str, 1024, _("Warning: your password will expire in %d days"), a); + } else { return _(str); } - - qDebug()<<"l_str = "<palette()); - pal.setColor(QPalette::WindowText,QColor(color)); - ui->lblMessage->setPalette(pal); + // ui->lePassword->setStyleSheet("QLineEdit{background-color: palette(Button);" + // "border-radius: 6px;border: 1px solid #F3222D;}"); + } else if (situat == TRUE) { + QColor color = palette().color(QPalette::WindowText); + QPalette pal(this->palette()); + pal.setColor(QPalette::WindowText, QColor(color)); + ui->lblMessage->setPalette(pal); } // qDebug()<<"receive:text = "<setInterval(800); connect(m_timer, &QTimer::timeout, this, &MainWindow::unlock_countdown); } m_timer->start(); - }else if (text.indexOf("No password received, please input password") != -1) - { + } else if (text.indexOf("No password received, please input password") != -1) { ui->lblMessage->setText(tr("Password cannot be empty")); ui->lblMessage->setToolTip(tr("Password cannot be empty")); - }else{ + } else { ui->lblMessage->setText(text); ui->lblMessage->setToolTip(text); } - ui->lblMessage->adjustSize(); - //ui->widgetPasswdAuth->adjustSize(); + // ui->lblMessage->adjustSize(); + // ui->widgetPasswdAuth->adjustSize(); // ui->lblMessage->setText(text); } @@ -846,36 +897,36 @@ void MainWindow::setAuthResult(bool result, const QString &text) { QString message = text; - if(!result && text.isEmpty()){ + if (!result && text.isEmpty()) { message = tr("Authentication failed, please try again."); } - if(authMode == PASSWORD) { + if (authMode == PASSWORD) { switchWidget(PASSWORD); - setMessage(message,ERROR); - } - else if(authMode == BIOMETRIC) - setMessage(message,ERROR); - - + setMessage(message, ERROR); + } else if (authMode == BIOMETRIC) + setMessage(message, ERROR); } void MainWindow::clearEdit() { ui->lePassword->setText(""); + ui->lePassword->setDisabled(true); + ui->lePassword->setReadOnly(true); ui->ukeyPassword->setText(""); + ui->btnAuth->setDisabled(true); } void MainWindow::switchAuthMode(Mode mode) { - if(isbioSuccess){ + if (isbioSuccess) { accept(BIOMETRIC_SUCCESS); - return ; + return; } int uid = getUid(userName); m_loginOptsWidget->setUser(uid); int count = m_loginOptsWidget->getLoginOptCount(); - enableBioAuth = count > 0; + enableBioAuth = count > 0; if (count < 1) { setLoginTypeTip(tr("Input your password to authentication")); m_loginOptsWidget->hide(); @@ -884,185 +935,177 @@ void MainWindow::switchAuthMode(Mode mode) m_loginOptsWidget->setEnabled(true); } - if(m_loginOptsWidget->getHasUkeyOptions()){ + if (m_loginOptsWidget->getHasUkeyOptions()) { setLoginTypeTip(tr("Input your password to authentication")); m_loginOptsWidget->show(); } - - switch(mode){ - case PASSWORD: - { - qDebug() << "switch to password"; - authMode = mode; + switch (mode) { + case PASSWORD: { + qDebug() << "switch to password"; - if(!enableBioAuth || !receiveBioPAM || useDoubleAuth) { - ui->btnBioAuth->hide(); - }else{ - ui->btnBioAuth->show(); - } - - if(isHiddenSwitchButton) - ui->btnBioAuth->hide(); + authMode = mode; - - // if(enableBioAuth && useDoubleAuth){ - // DeviceInfoPtr device = bioDevices.getDefaultDevice(getUid(userName)); - // if(device){ - // widgetBioAuth->startAuth(getUid(userName), device); - // } - // } - } - break; - case BIOMETRIC: - { - if(authMode == PASSWORD){ - emit accept(BIOMETRIC_IGNORE); - isFirstAuth = false; - return; - } - authMode = mode; - qDebug() << "switch to biometric"; - if (m_deviceInfo) { - if (!m_loginOptsWidget->findDeviceById(m_deviceInfo->device_id) - || m_loginOptsWidget->isDeviceDisable(m_deviceInfo->device_id)) { - m_deviceInfo = DeviceInfoPtr(); + if (!enableBioAuth || !receiveBioPAM || useDoubleAuth) { + ui->btnBioAuth->hide(); + } else { + ui->btnBioAuth->show(); } - } - if(!enableBioAuth){ - qDebug() << "It doesn't meet the condition for enabling biometric authentication, switch to password."; - emit accept(BIOMETRIC_IGNORE); - isFirstAuth = false; - return; - } else if(authMode == BIOMETRIC) { - QString strDeviceName; - if(isLoadingUkey){ - strDeviceName = m_loginOptsWidget->GetDefaultDevice(uid, UniT_General_Ukey); - }else{ - strDeviceName = m_loginOptsWidget->GetDefaultDevice(uid); - } - //如果默认设备为空的话,第一次不启动生物识别认证 - if(strDeviceName.isEmpty() && !m_deviceInfo) - { - qDebug() << "No default device"; + if (isHiddenSwitchButton) + ui->btnBioAuth->hide(); + + // if(enableBioAuth && useDoubleAuth){ + // DeviceInfoPtr device = bioDevices.getDefaultDevice(getUid(userName)); + // if(device){ + // widgetBioAuth->startAuth(getUid(userName), device); + // } + // } + } break; + case BIOMETRIC: { + if (authMode == PASSWORD) { emit accept(BIOMETRIC_IGNORE); isFirstAuth = false; return; } - - //第一次,获取默认设备的设备信息,之后使用的则是从设备选择窗口传出的设备信息 - if(!m_deviceInfo) - { - m_deviceInfo = m_loginOptsWidget->findDeviceByName(strDeviceName); - } - if(!m_deviceInfo){ - emit accept(BIOMETRIC_IGNORE); - isFirstAuth = false; - return; - } - - if(m_failMap.contains(uid) && m_failMap[uid].contains(m_deviceInfo->device_id) - && m_failMap[uid][m_deviceInfo->device_id] >= maxFailedTimes){ - emit accept(BIOMETRIC_IGNORE); - isFirstAuth = false; - return; - } - - if(m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY){ - if(isFirstAuth){ - isFirstAuth = false; - m_deviceInfo = nullptr; - emit accept(BIOMETRIC_IGNORE); - return ; + authMode = mode; + qDebug() << "switch to biometric"; + if (m_deviceInfo) { + if (!m_loginOptsWidget->findDeviceById(m_deviceInfo->device_id) + || m_loginOptsWidget->isDeviceDisable(m_deviceInfo->device_id)) { + m_deviceInfo = DeviceInfoPtr(); } - switchLoginOptType(LOGINOPT_TYPE_GENERAL_UKEY); - stopLoadingUkey(); - startBioAuth(); - m_loginOptsWidget->setCurrentDevice(m_deviceInfo); - m_loginOptsWidget->updateUIStatus(false); - - return ; } - isFirstAuth = false; - startBioAuth(); - emit accept(BIOMETRIC_IGNORE); - return; - } /*else if(authMode == UNDEFINED){ - authMode = BIOMETRIC; - - if(enableBioAuth) { - qDebug() << "enable biometric authenticaion"; - QString strDeviceName = m_loginOptsWidget->GetDefaultDevice(uid); - //如果默认设备为空的话,第一次不启动生物识别认证 - if(strDeviceName.isEmpty() && !m_deviceInfo) - { + if (!enableBioAuth) { + qDebug() << "It doesn't meet the condition for enabling biometric authentication, switch to password."; + emit accept(BIOMETRIC_IGNORE); + isFirstAuth = false; + return; + } else if (authMode == BIOMETRIC) { + QString strDeviceName; + if (isLoadingUkey) { + strDeviceName = m_loginOptsWidget->GetDefaultDevice(uid, UniT_General_Ukey); + } else { + strDeviceName = m_loginOptsWidget->GetDefaultDevice(uid); + } + // 如果默认设备为空的话,第一次不启动生物识别认证 + if (strDeviceName.isEmpty() && !m_deviceInfo) { qDebug() << "No default device"; - if(useFirstDevice == true){ - m_deviceInfo = m_loginOptsWidget->getFirstDevInfo(); - }else{ + emit accept(BIOMETRIC_IGNORE); + isFirstAuth = false; + return; + } + + // 第一次,获取默认设备的设备信息,之后使用的则是从设备选择窗口传出的设备信息 + if (!m_deviceInfo) { + m_deviceInfo = m_loginOptsWidget->findDeviceByName(strDeviceName); + } + if (!m_deviceInfo) { + emit accept(BIOMETRIC_IGNORE); + isFirstAuth = false; + return; + } + + if (m_failMap.contains(uid) && m_failMap[uid].contains(m_deviceInfo->device_id) + && m_failMap[uid][m_deviceInfo->device_id] >= maxFailedTimes) { + emit accept(BIOMETRIC_IGNORE); + isFirstAuth = false; + return; + } + + if (m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) { + if (isFirstAuth) { + isFirstAuth = false; + m_deviceInfo = nullptr; emit accept(BIOMETRIC_IGNORE); return; } - } - //第一次,获取默认设备的设备信息,之后使用的则是从设备选择窗口传出的设备信息 - if(!m_deviceInfo) - { - m_deviceInfo = m_loginOptsWidget->findDeviceByName(strDeviceName); - if (!m_deviceInfo) - m_deviceInfo = m_loginOptsWidget->getFirstDevInfo(); - } - if(!m_deviceInfo){ - emit accept(BIOMETRIC_IGNORE); - return; - } - if(m_failMap.contains(uid) && m_failMap[uid].contains(m_deviceInfo->device_id) - && m_failMap[uid][m_deviceInfo->device_id] >= maxFailedTimes){ - emit accept(BIOMETRIC_IGNORE); + switchLoginOptType(LOGINOPT_TYPE_GENERAL_UKEY); + stopLoadingUkey(); + startBioAuth(); + m_loginOptsWidget->setCurrentDevice(m_deviceInfo); + m_loginOptsWidget->updateUIStatus(false); + return; } + + isFirstAuth = false; startBioAuth(); emit accept(BIOMETRIC_IGNORE); return; - } else {*/ - /* pass biometric's pam module if there are not available devices */ -// qDebug() << "It doesn't meet the condition for enabling biometric authentication, switch to password."; -// emit accept(BIOMETRIC_IGNORE); -// return; -// } -// } - } - break; - default: - break; + } /*else if(authMode == UNDEFINED){ + authMode = BIOMETRIC; + + if(enableBioAuth) { + qDebug() << "enable biometric authenticaion"; + QString strDeviceName = m_loginOptsWidget->GetDefaultDevice(uid); + //如果默认设备为空的话,第一次不启动生物识别认证 + if(strDeviceName.isEmpty() && !m_deviceInfo) + { + qDebug() << "No default device"; + if(useFirstDevice == true){ + m_deviceInfo = m_loginOptsWidget->getFirstDevInfo(); + }else{ + emit accept(BIOMETRIC_IGNORE); + return; + } + } + //第一次,获取默认设备的设备信息,之后使用的则是从设备选择窗口传出的设备信息 + if(!m_deviceInfo) + { + m_deviceInfo = m_loginOptsWidget->findDeviceByName(strDeviceName); + if (!m_deviceInfo) + m_deviceInfo = m_loginOptsWidget->getFirstDevInfo(); + } + if(!m_deviceInfo){ + emit accept(BIOMETRIC_IGNORE); + return; + } + if(m_failMap.contains(uid) && m_failMap[uid].contains(m_deviceInfo->device_id) + && m_failMap[uid][m_deviceInfo->device_id] >= maxFailedTimes){ + emit accept(BIOMETRIC_IGNORE); + return; + } + startBioAuth(); + emit accept(BIOMETRIC_IGNORE); + return; + } else {*/ + /* pass biometric's pam module if there are not available devices */ + // qDebug() << "It doesn't meet the condition for enabling biometric authentication, switch + // to password."; emit accept(BIOMETRIC_IGNORE); return; + // } + // } + } break; + default: + break; } switchWidget(mode); } /*** end of public memeber ***/ - /*** private member ***/ uid_t MainWindow::getUid(const QString &userName) { struct passwd *pwd = getpwnam(userName.toStdString().c_str()); - if(pwd == NULL) { + if (pwd == NULL) { qWarning() << "getpwnam error: " << strerror(errno); return -1; } return pwd->pw_uid; } -void MainWindow::setDoubleAuth(bool val){ - useDoubleAuth = val; +void MainWindow::setDoubleAuth(bool val) +{ + useDoubleAuth = val; } void MainWindow::stopDoubleAuth() { -// if(useDoubleAuth && widgetBioAuth) -// widgetBioAuth->stopAuth(); + // if(useDoubleAuth && widgetBioAuth) + // widgetBioAuth->stopAuth(); } void MainWindow::switchWidget(Mode mode) @@ -1080,118 +1123,117 @@ void MainWindow::switchWidget(Mode mode) ui->btnLoading->setDisabled(true); ui->returnButton->adjustSize(); m_labelTip->adjustSize(); - if(is_Mavis){ + if (is_Mavis) { ui->cmbUsers->setFixedHeight(48); ui->lePassword->setFixedHeight(48); ui->ukeyPassword->setFixedHeight(48); ui->btnAuth->setFixedHeight(48); ui->btnCancel->setFixedHeight(48); } - switch(mode){ - case PASSWORD: - { - setFixedWidth(420); + switch (mode) { + case PASSWORD: { + setFixedWidth(420); - if (m_deviceInfo && m_loginOptsWidget->findDeviceById(m_deviceInfo->device_id)) { - switchLoginOptType(m_loginOptsWidget->convertDeviceType(m_deviceInfo->biotype)); - } else { - switchLoginOptType(LOGINOPT_TYPE_PASSWORD); - } - if (!m_loginOptsWidget->isHidden()) { - m_loginOptsWidget->adjustSize(); - } - int height; - if(fontSize = 10){ - height = 130 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } else if(fontSize = 11 ){ - height = 150 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } else if (fontSize = 12){ - height = 160 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } else if (fontSize = 13){ - height = 170 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } else if (fontSize = 14){ - height = 190 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } else if (fontSize = 15){ - height = 230 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } -// if (m_loginOptsWidget->isHidden()) { -// height = height - m_labelTip->height() - 10; -// } + if (m_deviceInfo && m_loginOptsWidget->findDeviceById(m_deviceInfo->device_id)) { + switchLoginOptType(m_loginOptsWidget->convertDeviceType(m_deviceInfo->biotype)); + } else { + switchLoginOptType(LOGINOPT_TYPE_PASSWORD); + } + if (!m_loginOptsWidget->isHidden()) { + m_loginOptsWidget->adjustSize(); + } + int height; + if (fontSize = 10) { + height = 130 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + + ui->btnAuth->height(); + } else if (fontSize = 11) { + height = 150 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + + ui->btnAuth->height(); + } else if (fontSize = 12) { + height = 160 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + + ui->btnAuth->height(); + } else if (fontSize = 13) { + height = 170 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + + ui->btnAuth->height(); + } else if (fontSize = 14) { + height = 190 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + + ui->btnAuth->height(); + } else if (fontSize = 15) { + height = 230 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + + ui->btnAuth->height(); + } - unsigned uOptsWidgetHeight = m_loginOptsWidget->height(); - if (m_loginOptsWidget->isHidden()) { - uOptsWidgetHeight = 0; - height = height + m_labelTip->height() - 10; - } - setFixedHeight(height + uOptsWidgetHeight + 10); + unsigned uOptsWidgetHeight = m_loginOptsWidget->height(); + if (m_loginOptsWidget->isHidden()) { + uOptsWidgetHeight = 0; + height = height + m_labelTip->height() - 10; + } + if (m_uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY) { + setFixedSize(width(), height + uOptsWidgetHeight + 10 + 40); + } else { + setFixedSize(width(), height + uOptsWidgetHeight + 40); + } - //m_loginOptsWidget->updateUIStatus(); - ui->btnBioAuth->setStyleSheet("QPushButton{font-size:14px;}QPushButton:hover{border:none;color:#3E6CE5;}QPushButton:pressed{border:none;}"); - ui->btnBioAuth->setFlat(true); - ui->btnBioAuth->setText(tr("Biometric")); - ui->btnBioAuth->setAttribute(Qt::WA_UnderMouse,false); - ui->btnBioAuth->adjustSize(); - ui->widgetPasswdAuth->show(); - ui->lePassword->setFocus(); - //ui->lePassword->setAttribute(Qt::WA_InputMethodEnabled, false); - if (m_modeButton && m_modeButton->isShowPwd()) { - ui->lePassword->setEchoMode(QLineEdit::Normal); - } else { - ui->lePassword->setEchoMode(QLineEdit::Password); - } - ui->btnAuth->show(); - ui->btnLoading->hide(); - //ui->lePassword->setDisabled(false); - if(w_timer && w_timer->isActive()) - { - w_timer->stop(); - } - ui->btnCancel->show(); - //ui->lblContent->show(); - ui->returnButton->hide(); - ui->lblContent->hide(); - } - break; + // m_loginOptsWidget->updateUIStatus(); + ui->btnBioAuth->setStyleSheet("QPushButton{font-size:14px;}QPushButton:hover{border:none;color:#3E6CE5;}" + "QPushButton:pressed{border:none;}"); + ui->btnBioAuth->setFlat(true); + ui->btnBioAuth->setText(tr("Biometric")); + ui->btnBioAuth->setAttribute(Qt::WA_UnderMouse, false); + ui->btnBioAuth->adjustSize(); + ui->widgetPasswdAuth->show(); + ui->lePassword->setFocus(); + // ui->lePassword->setAttribute(Qt::WA_InputMethodEnabled, false); + if (m_modeButton && m_modeButton->isShowPwd()) { + ui->lePassword->setEchoMode(QLineEdit::Normal); + } else { + ui->lePassword->setEchoMode(QLineEdit::Password); + } + ui->btnAuth->show(); + ui->btnLoading->hide(); + if (w_timer && w_timer->isActive()) { + w_timer->stop(); + } + ui->btnCancel->show(); + // ui->lblContent->show(); + ui->returnButton->hide(); + ui->lblContent->hide(); + } break; - case BIOMETRIC: - setFixedWidth(420); - if(m_loginOptsWidget->getLoginOptCount() <= 1){ - setFixedHeight(392+ui->cmbUsers->height()+ui->lblHeader->height()); - } else { - setFixedHeight(482+ui->cmbUsers->height()+ui->lblHeader->height()); - } + case BIOMETRIC: + setFixedWidth(420); + if (m_loginOptsWidget->getLoginOptCount() <= 1) { + setFixedHeight(392 + ui->cmbUsers->height() + ui->lblHeader->height() + 40); + } else { + setFixedHeight(482 + ui->cmbUsers->height() + ui->lblHeader->height() + 40); + } - ui->btnCancel->hide(); - ui->lblContent->hide(); - ui->btnBioAuth->hide(); - ui->returnButton->show(); - ui->returnButton->setAttribute(Qt::WA_UnderMouse,false); - ui->returnButton->setFlat(true); - ui->returnButton->setStyleSheet("QPushButton{font-size:14px;}QPushButton:hover{border:none;color:#3E6CE5;}QPushButton:pressed{border:none;}"); - ui->returnButton->setText(tr("Use password")); - ui->returnButton->adjustSize(); - break; -// case DEVICES: -// widgetBioAuth->show(); + ui->btnCancel->hide(); + ui->lblContent->hide(); + ui->btnBioAuth->hide(); + // ui->returnButton->show(); + // ui->returnButton->setAttribute(Qt::WA_UnderMouse, false); + // ui->returnButton->setFlat(true); + // ui->returnButton->setStyleSheet("QPushButton{font-size:14px;}QPushButton:hover{border:none;color:#3E6CE5;}" + // "QPushButton:pressed{border:none;}"); + // ui->returnButton->setText(tr("Use password")); + // ui->returnButton->adjustSize(); + break; + // case DEVICES: + // widgetBioAuth->show(); -// break; - default: - break; + // break; + default: + break; } -// adjustSize(); + // adjustSize(); } void MainWindow::unlock_countdown() @@ -1199,70 +1241,75 @@ void MainWindow::unlock_countdown() int failed_count = 0; int time_left = 0; int deny = 0; - int fail_time =0; + int fail_time = 0; int unlock_time = 0; - pam_tally_unlock_time_left(getUid(userName),&failed_count, &time_left, &deny,&fail_time,&unlock_time); + pam_tally_unlock_time_left(getUid(userName), &failed_count, &time_left, &deny, &fail_time, &unlock_time); - // qDebug() << "failed_count:" << failed_count << "time_left:" <= 60)//请多少分钟后重试 + // qDebug() << "failed_count:" << failed_count << "time_left:" <= 60) // 请多少分钟后重试 { - int nMinuteleft = time_left/60; - if (isLockingFlg == false){ - m_nCurLockMin = unlock_time/60;//获取当前需要锁定的分钟数 + int nMinuteleft = time_left / 60; + if (isLockingFlg == false) { + m_nCurLockMin = unlock_time / 60; // 获取当前需要锁定的分钟数 } - //如果当前设置的不是1min钟锁定,那么1min显示成2min,由2min直接跳到59s || 剩余分钟数小于当前设置的锁定时间,并且大于1min,自增+1 - if ((nMinuteleft == 1 && m_nCurLockMin != 1) || (nMinuteleft > 1 && nMinuteleft < m_nCurLockMin)) - { + // 如果当前设置的不是1min钟锁定,那么1min显示成2min,由2min直接跳到59s || + // 剩余分钟数小于当前设置的锁定时间,并且大于1min,自增+1 + if ((nMinuteleft == 1 && m_nCurLockMin != 1) || (nMinuteleft > 1 && nMinuteleft < m_nCurLockMin)) { nMinuteleft = nMinuteleft + 1; } - setMessage(tr("Please try again in %1 minutes.").arg(nMinuteleft),TRUE); - //ui->lblMessage->setToolTip(tr("Please try again in %1 minutes.").arg(nMinute)); + setMessage(tr("Please try again in %1 minutes.").arg(nMinuteleft), ERROR); + // ui->lblMessage->setToolTip(tr("Please try again in %1 minutes.").arg(nMinute)); ui->lePassword->setText(""); ui->lePassword->setDisabled(true); + ui->lePassword->setReadOnly(true); ui->btnAuth->setDisabled(true); isLockingFlg = true; - return ; - } - else if(time_left > 0 && time_left < 60)//请多少秒后重试 + setBiometricAuthDisabledStatus(isLockingFlg); + return; + } else if (time_left > 0 && time_left < 60) // 请多少秒后重试 { - char ch[100]={0}; - setMessage(tr("Please try again in %1 seconds.").arg(time_left%60),TRUE); - //ui->lblMessage->setToolTip(tr("Please try again in %1 seconds.").arg(time_left%60)); + char ch[100] = { 0 }; + setMessage(tr("Please try again in %1 seconds.").arg(time_left % 60), ERROR); + // ui->lblMessage->setToolTip(tr("Please try again in %1 seconds.").arg(time_left%60)); ui->lePassword->setText(""); ui->lePassword->setDisabled(true); + ui->lePassword->setReadOnly(true); ui->btnAuth->setDisabled(true); isLockingFlg = true; - return ; - } - else if (failed_count == 0xFFFF)//账号被永久锁定 + setBiometricAuthDisabledStatus(isLockingFlg); + return; + } else if (failed_count == 0xFFFF) // 账号被永久锁定 { ui->lblMessage->setText(tr("Account locked permanently.")); ui->lblMessage->setToolTip(tr("Account locked permanently.")); ui->lePassword->setText(""); ui->lePassword->setDisabled(true); + ui->lePassword->setReadOnly(true); ui->btnAuth->setDisabled(true); isLockingFlg = true; - return ; - } - else - { - if(ui->lePassword){ + setBiometricAuthDisabledStatus(isLockingFlg); + return; + } else { + if (ui->lePassword) { ui->lePassword->setDisabled(false); + ui->lePassword->setReadOnly(false); ui->lePassword->setFocus(); } - if(ui->btnAuth){ + if (ui->btnAuth) { ui->btnAuth->setDisabled(false); } if (isLockingFlg) { - //setMessage(tr("Authentication failed, please try again."),ERROR); + // setMessage(tr("Authentication failed, please try again."),ERROR); setMessage(""); isLockingFlg = false; + setBiometricAuthDisabledStatus(isLockingFlg); } m_timer->stop(); } - return ; + return; } void MainWindow::root_unlock_countdown() @@ -1270,22 +1317,23 @@ void MainWindow::root_unlock_countdown() int failed_count = 0; int time_left = 0; int deny = 0; - int fail_time =0; + int fail_time = 0; int unlock_time = 0; - pam_tally_root_unlock_time_left(&failed_count, &time_left, &deny,&fail_time,&unlock_time); + pam_tally_root_unlock_time_left(&failed_count, &time_left, &deny, &fail_time, &unlock_time); - // qDebug() << "failed_count:" << failed_count << "time_left:" <= 60)//请多少分钟后重试 + // qDebug() << "failed_count:" << failed_count << "time_left:" <= 60) // 请多少分钟后重试 { - int nMinuteleft = time_left/60; - if (isLockingFlg == false){ - m_nCurLockMin = unlock_time/60;//获取当前需要锁定的分钟数 + int nMinuteleft = time_left / 60; + if (isLockingFlg == false) { + m_nCurLockMin = unlock_time / 60; // 获取当前需要锁定的分钟数 } - //如果当前设置的不是1min钟锁定,那么1min显示成2min,由2min直接跳到59s || 剩余分钟数小于当前设置的锁定时间,并且大于1min,自增+1 - if ((nMinuteleft == 1 && m_nCurLockMin != 1) || (nMinuteleft > 1 && nMinuteleft < m_nCurLockMin)) - { + // 如果当前设置的不是1min钟锁定,那么1min显示成2min,由2min直接跳到59s || + // 剩余分钟数小于当前设置的锁定时间,并且大于1min,自增+1 + if ((nMinuteleft == 1 && m_nCurLockMin != 1) || (nMinuteleft > 1 && nMinuteleft < m_nCurLockMin)) { nMinuteleft = nMinuteleft + 1; } @@ -1293,179 +1341,193 @@ void MainWindow::root_unlock_countdown() ui->lblMessage->setToolTip(tr("Please try again in %1 minutes.").arg(nMinuteleft)); ui->lePassword->setText(""); ui->lePassword->setDisabled(true); + ui->lePassword->setReadOnly(true); + ui->btnAuth->setDisabled(true); isLockingFlg = true; - return ; - } - else if(time_left > 0 && time_left < 60)//请多少秒后重试 + setBiometricAuthDisabledStatus(isLockingFlg); + return; + } else if (time_left > 0 && time_left < 60) // 请多少秒后重试 { - char ch[100]={0}; - ui->lblMessage->setText(tr("Please try again in %1 seconds.").arg(time_left%60)); - ui->lblMessage->setToolTip(tr("Please try again in %1 seconds.").arg(time_left%60)); + char ch[100] = { 0 }; + ui->lblMessage->setText(tr("Please try again in %1 seconds.").arg(time_left % 60)); + ui->lblMessage->setToolTip(tr("Please try again in %1 seconds.").arg(time_left % 60)); ui->lePassword->setText(""); ui->lePassword->setDisabled(true); + ui->lePassword->setReadOnly(true); + ui->btnAuth->setDisabled(true); isLockingFlg = true; - return ; - } - else if (failed_count == 0xFFFF)//账号被永久锁定 + setBiometricAuthDisabledStatus(isLockingFlg); + return; + } else if (failed_count == 0xFFFF) // 账号被永久锁定 { ui->lblMessage->setText(tr("Account locked permanently.")); ui->lblMessage->setToolTip(tr("Account locked permanently.")); ui->lePassword->setText(""); ui->lePassword->setDisabled(true); + ui->lePassword->setReadOnly(false); + ui->btnAuth->setDisabled(true); isLockingFlg = true; - return ; - } - else - { - if(ui->lePassword){ + setBiometricAuthDisabledStatus(isLockingFlg); + return; + } else { + if (ui->lePassword) { ui->lePassword->setDisabled(false); + ui->lePassword->setReadOnly(false); ui->lePassword->setFocus(); } + if (ui->btnAuth) { + ui->btnAuth->setDisabled(false); + } - if (isLockingFlg) - { - //setMessage(tr("Authentication failed, please try again."),ERROR); + if (isLockingFlg) { + // setMessage(tr("Authentication failed, please try again."),ERROR); setMessage(""); isLockingFlg = false; + setBiometricAuthDisabledStatus(isLockingFlg); } - + m_timer->stop(); } - return ; + return; +} + +void MainWindow::setBiometricAuthDisabledStatus(bool locked) +{ + if (locked) { + if (m_loginOptsWidget) { + m_loginOptsWidget->stopAuth(); + m_loginOptsWidget->setAllDeviceDisable(true); + if (m_bioTimer && m_bioTimer->isActive()) + m_bioTimer->stop(); + } + if (m_deviceInfo && m_deviceInfo->biotype == BIOTYPE_FACE) { + QImage imgFailed; + m_loginOptsWidget->setFaceImg(imgFailed, 1); + } else if (m_deviceInfo && m_deviceInfo->biotype == REMOTE_QRCODE_TYPE) { + QImage nullImage; + m_loginOptsWidget->setQRCode(nullImage); + } + } else { + if (m_deviceInfo && m_loginOptsWidget) { + m_loginOptsWidget->startAuth(m_deviceInfo, getUid(userName)); + m_loginOptsWidget->setAllDeviceDisable(false); + } + } } void MainWindow::onRespondUkey(const QString &text) { - if (m_loginOptsWidget){ - m_loginOptsWidget->SetExtraInfo(text,"pincode"); - } + if (m_loginOptsWidget) { + m_loginOptsWidget->SetExtraInfo(text, "pincode"); + } } void MainWindow::switchLoginOptType(unsigned uLoginOptType) { - switch(uLoginOptType) { - case LOGINOPT_TYPE_PASSWORD: - { - //m_loginOptsWidget->hide(); - ui->lePassword->show(); - ui->cmbUsers->show(); - ui->widgetPasswdAuth->show(); - ui->widgetUkeyAuth->hide(); - ui->ukeyPassword->clearFocus(); - ui->loadingUkeyWidget->hide(); - setFocusProxy(ui->lePassword); - ui->cmbUsers->show(); - } - break; - case LOGINOPT_TYPE_FACE: - case LOGINOPT_TYPE_FINGERPRINT: - case LOGINOPT_TYPE_IRIS: - case LOGINOPT_TYPE_VOICEPRINT: - case LOGINOPT_TYPE_FINGERVEIN: - case LOGINOPT_TYPE_QRCODE: - { - //m_loginOptsWidget->show(); - // 延迟检查错误状态 - m_isNetworkErr = false; - QTimer::singleShot(500, this, [&,this](){ - if (!this->m_isNetworkErr) { - m_loginOptsWidget->setQRCodeMsg(""); - } - }); + switch (uLoginOptType) { + case LOGINOPT_TYPE_PASSWORD: { + // m_loginOptsWidget->hide(); + ui->lePassword->show(); + ui->cmbUsers->show(); + ui->widgetPasswdAuth->show(); + ui->widgetUkeyAuth->hide(); + ui->ukeyPassword->clearFocus(); + ui->loadingUkeyWidget->hide(); + setFocusProxy(ui->lePassword); + ui->cmbUsers->show(); + } break; + case LOGINOPT_TYPE_FACE: + case LOGINOPT_TYPE_FINGERPRINT: + case LOGINOPT_TYPE_IRIS: + case LOGINOPT_TYPE_VOICEPRINT: + case LOGINOPT_TYPE_FINGERVEIN: + case LOGINOPT_TYPE_QRCODE: { + // m_loginOptsWidget->show(); + // 延迟检查错误状态 + m_isNetworkErr = false; + QTimer::singleShot(500, this, [&, this]() { + if (!this->m_isNetworkErr) { + m_loginOptsWidget->setQRCodeMsg(""); + } + }); - //m_loginOptsWidget->hide(); - ui->lePassword->show(); - ui->widgetUkeyAuth->hide(); - ui->loadingUkeyWidget->hide(); - ui->ukeyPassword->clearFocus(); - setFocusProxy(ui->lePassword); - ui->cmbUsers->show(); - ui->widgetPasswdAuth->show(); + // m_loginOptsWidget->hide(); + ui->lePassword->show(); + ui->widgetUkeyAuth->hide(); + ui->loadingUkeyWidget->hide(); + ui->ukeyPassword->clearFocus(); + setFocusProxy(ui->lePassword); + ui->cmbUsers->show(); + ui->widgetPasswdAuth->show(); + } break; + case LOGINOPT_TYPE_GENERAL_UKEY: { + ui->lePassword->hide(); + ui->cmbUsers->hide(); + if (m_deviceInfo) { + stopLoadingUkey(); + ui->widgetUkeyAuth->show(); + } else { + startLoadingUkey(); + } + setFocusProxy(ui->ukeyPassword); + ui->ukeyPassword->setFocusPolicy(Qt::StrongFocus); + ui->ukeyPassword->setFocus(); + ui->widgetPasswdAuth->hide(); + } break; + default: + return; } - break; - case LOGINOPT_TYPE_GENERAL_UKEY: - { - ui->lePassword->hide(); - ui->cmbUsers->hide(); - if(m_deviceInfo){ - stopLoadingUkey(); - ui->widgetUkeyAuth->show(); - }else{ - startLoadingUkey(); - } - setFocusProxy(ui->ukeyPassword); - ui->ukeyPassword->setFocusPolicy(Qt::StrongFocus); - ui->ukeyPassword->setFocus(); - ui->widgetPasswdAuth->hide(); - } - break; - default: - return; - } - qDebug()<<"CurOptType:"<device_id) - && m_failMap[getUid(userName)][m_deviceInfo->device_id] >= maxFailedTimes){ + && m_failMap[getUid(userName)][m_deviceInfo->device_id] >= maxFailedTimes) { if (m_deviceInfo->biotype == BIOTYPE_FACE) { QImage imgFailed; m_loginOptsWidget->setFaceImg(imgFailed, 1); } no_changes = true; if (m_deviceInfo->biotype == REMOTE_QRCODE_TYPE) { - setLoginTypeTip(tr("Failed to verify %1, please enter password to unlock").arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); - }else if(m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY){ - setUkeyTypeTip(tr("Failed to verify %1, please enter password to unlock").arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); - }else { - setLoginTypeTip(tr("Unable to verify %1, please enter password to unlock").arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); + setLoginTypeTip(tr("Failed to verify %1, please enter password to unlock") + .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); + } else if (m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) { + setUkeyTypeTip(tr("Failed to verify %1, please enter password to unlock") + .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); + } else { + setLoginTypeTip(tr("Unable to verify %1, please enter password to unlock") + .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); } m_loginOptsWidget->setDeviceDisable(m_deviceInfo->device_id, true); } else { no_changes = false; if (uLoginOptType != m_uCurLoginOptType || (m_deviceInfo && m_deviceInfo->device_id != m_nLastDeviceId)) { - switch(uLoginOptType) { - case LOGINOPT_TYPE_PASSWORD: - { - setLoginTypeTip(""); - //setMessage("",TRUE); - } - break; - case LOGINOPT_TYPE_FACE: - { - setLoginTypeTip(tr("Verify face recognition or enter password to unlock")); - } - break; - case LOGINOPT_TYPE_FINGERPRINT: - { - setLoginTypeTip(tr("Press fingerprint or enter password to unlock")); - } - break; - case LOGINOPT_TYPE_VOICEPRINT: - { - setLoginTypeTip(tr("Verify voiceprint or enter password to unlock")); - } - break; - case LOGINOPT_TYPE_FINGERVEIN: - { - setLoginTypeTip(tr("Verify finger vein or enter password to unlock")); - } - break; - case LOGINOPT_TYPE_IRIS: - { - setLoginTypeTip(tr("Verify iris or enter password to unlock")); - } - break; - case LOGINOPT_TYPE_QRCODE: - { - setLoginTypeTip(tr("Use the bound wechat scanning code or enter the password to unlock")); - } - break; - case LOGINOPT_TYPE_GENERAL_UKEY: - { - setLoginTypeTip(""); - } - break; - default: - return; + switch (uLoginOptType) { + case LOGINOPT_TYPE_PASSWORD: { + setLoginTypeTip(""); + // setMessage("",TRUE); + } break; + case LOGINOPT_TYPE_FACE: { + setLoginTypeTip(tr("Verify face recognition or enter password to unlock")); + } break; + case LOGINOPT_TYPE_FINGERPRINT: { + setLoginTypeTip(tr("Press fingerprint or enter password to unlock")); + } break; + case LOGINOPT_TYPE_VOICEPRINT: { + setLoginTypeTip(tr("Verify voiceprint or enter password to unlock")); + } break; + case LOGINOPT_TYPE_FINGERVEIN: { + setLoginTypeTip(tr("Verify finger vein or enter password to unlock")); + } break; + case LOGINOPT_TYPE_IRIS: { + setLoginTypeTip(tr("Verify iris or enter password to unlock")); + } break; + case LOGINOPT_TYPE_QRCODE: { + setLoginTypeTip(tr("Use the bound wechat scanning code or enter the password to unlock")); + } break; + case LOGINOPT_TYPE_GENERAL_UKEY: { + setLoginTypeTip(""); + } break; + default: + return; } } } @@ -1484,13 +1546,13 @@ void MainWindow::setLoginTypeTip(QString strLoginTypeTip) m_labelTip->hide(); } else { QPalette pe; - if(no_changes) { - pe.setColor(QPalette::WindowText,Qt::red); + if (no_changes) { + pe.setColor(QPalette::WindowText, Qt::red); m_labelTip->setPalette(pe); } else { QColor color = palette().color(QPalette::WindowText); QPalette pal(this->palette()); - pal.setColor(QPalette::WindowText,QColor(color)); + pal.setColor(QPalette::WindowText, QColor(color)); m_labelTip->setPalette(pal); } m_labelTip->setText(m_strLoginTypeTip); @@ -1501,9 +1563,9 @@ void MainWindow::setLoginTypeTip(QString strLoginTypeTip) void MainWindow::startBioAuthDelay() { if (m_deviceInfo) { - if(m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY){ + if (m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) { - }else{ + } else { m_loginOptsWidget->startAuth(m_deviceInfo, getUid(userName)); } switchLoginOptType(m_loginOptsWidget->convertDeviceType(m_deviceInfo->biotype)); @@ -1517,11 +1579,11 @@ void MainWindow::startBioAuth(unsigned uTimeout) { m_loginOptsWidget->stopAuth(); - if(m_deviceInfo && m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY){ + if (m_deviceInfo && m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) { switchLoginOptType(m_loginOptsWidget->convertDeviceType(m_deviceInfo->biotype)); } - if(!m_bioTimer){ + if (!m_bioTimer) { m_bioTimer = new QTimer(this); connect(m_bioTimer, SIGNAL(timeout()), this, SLOT(startBioAuthDelay())); } @@ -1538,8 +1600,10 @@ void MainWindow::onUpdateBioAuthMsg(QString strMsg) void MainWindow::updatePixmap() { ui->btnAuth->hide(); + ui->btnAuth->setDisabled(true); ui->btnLoading->show(); ui->lePassword->setDisabled(true); + ui->lePassword->setReadOnly(true); QMatrix matrix; matrix.rotate(90.0); m_waitingPixmap = m_waitingPixmap.transformed(matrix, Qt::FastTransformation); @@ -1553,60 +1617,53 @@ void MainWindow::onUpdateWndSize(unsigned uLoginOptType, unsigned uLoginOptSize) m_loginOptsWidget->adjustSize(); } unsigned uOptsWidgetHeight = m_loginOptsWidget->height(); - if (m_loginOptsWidget->isHidden() || - (uLoginOptSize == 1 && uLoginOptType != LOGINOPT_TYPE_QRCODE && uLoginOptType != LOGINOPT_TYPE_FACE)) { + if (m_loginOptsWidget->isHidden() + || (uLoginOptSize == 1 && uLoginOptType != LOGINOPT_TYPE_QRCODE && uLoginOptType != LOGINOPT_TYPE_FACE)) { uOptsWidgetHeight = 0; } ui->lblHeader->adjustSize(); - if(uLoginOptType == LOGINOPT_TYPE_QRCODE && uLoginOptType == LOGINOPT_TYPE_FACE){ - uOptsWidgetHeight = m_loginOptsWidget->height() + 20; + if (uLoginOptType == LOGINOPT_TYPE_QRCODE || uLoginOptType == LOGINOPT_TYPE_FACE) { + uOptsWidgetHeight = m_loginOptsWidget->height() + 20; + } else if (uLoginOptType == LOGINOPT_TYPE_FINGERPRINT || uLoginOptType == LOGINOPT_TYPE_IRIS) { + uOptsWidgetHeight = m_loginOptsWidget->height() + 10; } - else if(uLoginOptType == LOGINOPT_TYPE_FINGERPRINT){ - uOptsWidgetHeight = m_loginOptsWidget->height() + 10 ; - } -// ui->lblContent->adjustSize(); -// ui->lblHeader->adjustSize(); + // ui->lblContent->adjustSize(); + // ui->lblHeader->adjustSize(); int height; - if(fontSize = 10){ + if (fontSize = 10) { height = 130 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } else if(fontSize = 11 ){ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + ui->btnAuth->height(); + } else if (fontSize = 11) { height = 150 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } else if (fontSize = 12){ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + ui->btnAuth->height(); + } else if (fontSize = 12) { height = 160 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } else if (fontSize = 13){ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + ui->btnAuth->height(); + } else if (fontSize = 13) { height = 170 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } else if (fontSize = 14){ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + ui->btnAuth->height(); + } else if (fontSize = 14) { height = 190 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); - } else if (fontSize = 15){ + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + ui->btnAuth->height(); + } else if (fontSize = 15) { height = 230 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ - + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() - + ui->btnAuth->height(); + + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + ui->btnAuth->height(); } if (m_loginOptsWidget->isHidden()) { height = height + m_labelTip->height() - 10; } - if(uLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY){ + if (uLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY) { setLoginTypeTip(""); - setFixedSize(width(), height + uOptsWidgetHeight + 10); - }else{ - setFixedSize(width(), height + uOptsWidgetHeight); + setFixedSize(width(), height + uOptsWidgetHeight + 10 + 40); + } else { + setFixedSize(width(), height + uOptsWidgetHeight + 40); } } void MainWindow::setEditInputMethod(bool bEnable) { - qDebug()<<"setEditInputMethod:"<lePassword->setAttribute(Qt::WA_InputMethodEnabled, true); } else { diff --git a/polkit-agent/src/mainwindow.h b/polkit-agent/src/mainwindow.h index 898f2d0..2a484b1 100644 --- a/polkit-agent/src/mainwindow.h +++ b/polkit-agent/src/mainwindow.h @@ -31,11 +31,14 @@ #include "loginoptionswidget.h" #include "modeButton.h" #include "kalabel.h" +#include +using namespace kdk; + namespace Ui { class MainWindow; } -class MainWindow : public QWidget +class MainWindow : public kdk::KDialog { Q_OBJECT @@ -45,17 +48,32 @@ public: void closeEvent(QCloseEvent *event); bool eventFilter(QObject *obj, QEvent *event); void paintEvent(QPaintEvent *event); - enum Mode{UNDEFINED, PASSWORD, BIOMETRIC, DEVICES}; - enum situation{TRUE, ERROR}; + void keyPressEvent(QKeyEvent *event); //屏蔽esc按钮 + enum Mode + { + UNDEFINED, + PASSWORD, + BIOMETRIC, + DEVICES + }; + enum situation + { + TRUE, + ERROR + }; void setIcon(const QString &iconName); void setHeader(const QString &text); void setUsers(const QStringList &usersList); - void setDetails(const QString &subPid, const QString &callerPid, - const QString &actionId, const QString &actionDesc, - const QString vendorName, const QString vendorUrl); + void setDetails( + const QString &subPid, + const QString &callerPid, + const QString &actionId, + const QString &actionDesc, + const QString vendorName, + const QString vendorUrl); void setPrompt(const QString &text, bool echo); - void setMessage(const QString &text,situation situat = ERROR); - void setAuthResult(bool result, const QString &text=""); + void setMessage(const QString &text, situation situat = ERROR); + void setAuthResult(bool result, const QString &text = ""); void clearEdit(); void switchAuthMode(Mode mode); void setDoubleAuth(bool val); @@ -69,7 +87,7 @@ public: void stopLoadingUkey(); void updateLoadingPixmap(); -private: +private: uid_t getUid(const QString &userName); void setMovie(); void setPixmap(); @@ -77,7 +95,6 @@ private: void switchWidget(Mode mode); int enable_biometric_authentication(); - void root_unlock_countdown(); void unlock_countdown(); void editIcon(); @@ -85,10 +102,12 @@ private: void setMavisSheel(); void updatePixmap(); + void setBiometricAuthDisabledStatus(bool locked); + public slots: void onUpdateBioAuthMsg(QString strMsg); void onUpdateWndSize(unsigned uLoginOptType, unsigned uLoginOptSize); - + void onShowYesPrompt(); private slots: void on_btnDetails_clicked(); void on_lePassword_returnPressed(); @@ -112,10 +131,11 @@ signals: void switchToBiometric(); void userChanged(const QString &userName); void restartAuth(); + void yesPrompted(); private: Ui::MainWindow *ui; - Users *users; + Users *users; QString userName; bool enableBioAuth; bool receiveBioPAM; @@ -124,25 +144,25 @@ private: bool isFirst; bool useDoubleAuth; bool isbioSuccess; - QMap> m_failMap; - int maxFailedTimes; + QMap> m_failMap; + int maxFailedTimes; bool isHiddenSwitchButton; ModeButton *m_modeButton; QIcon modeIcon; bool pwdShow = false; bool isHover = false; - //ukey优先级比密码低,该变量用于判断是否第一次认证,并选中密码 + // ukey优先级比密码低,该变量用于判断是否第一次认证,并选中密码 bool isFirstAuth = true; QTimer *m_timer; - //const DeviceInfo *device = NULL; - bool isLockingFlg; //判断当前是否正在锁定倒计时 - int m_nCurLockMin; //当前锁定的分钟数 + // const DeviceInfo *device = NULL; + bool isLockingFlg; //判断当前是否正在锁定倒计时 + int m_nCurLockMin; //当前锁定的分钟数 // 登录选项 KALabel *m_labelTip = nullptr; LoginOptionsWidget *m_loginOptsWidget = nullptr; - unsigned m_uCurLoginOptType = LOGINOPT_TYPE_PASSWORD; // 当前登录验证方式 + unsigned m_uCurLoginOptType = LOGINOPT_TYPE_PASSWORD; // 当前登录验证方式 QString m_strLoginTypeTip = ""; QTimer *m_bioTimer = nullptr; DeviceInfoPtr m_deviceInfo = nullptr; @@ -153,7 +173,7 @@ private: QLabel *titleLabel; QPushButton *closeBtn; - QGSettings *settings; + QGSettings *settings; int fontSize; QString app_IconName; @@ -165,9 +185,11 @@ private: QTimer *w_timer; QPixmap m_waitingPixmap; - QTimer *m_loadingTimer = nullptr; - QPixmap m_loadingPixmap; - bool isLoadingUkey = false; + QTimer *m_loadingTimer = nullptr; + QPixmap m_loadingPixmap; + bool isLoadingUkey = false; + + bool doNotNeedAuth = false; }; #endif // MAINWINDOW_H diff --git a/polkit-agent/src/modeButton.h b/polkit-agent/src/modeButton.h index 51ab67f..63bc0fd 100644 --- a/polkit-agent/src/modeButton.h +++ b/polkit-agent/src/modeButton.h @@ -37,7 +37,7 @@ public: bool isShowPwd(); protected: - bool eventFilter(QObject *obj, QEvent *event) override; //事件过滤 + bool eventFilter(QObject *obj, QEvent *event) override; //事件过滤 private: void initStyleTheme(); diff --git a/polkit-agent/src/pam-tally.c b/polkit-agent/src/pam-tally.c index da2651b..180c7d2 100644 --- a/polkit-agent/src/pam-tally.c +++ b/polkit-agent/src/pam-tally.c @@ -111,7 +111,7 @@ int get_is_open_other_authentication() int get_pam_tally(int *deny, int *unlock_time , int *root_unlock_time) { char buf[128]; - FILE *auth_file; + FILE *auth_file = NULL; if( (auth_file = fopen("/etc/pam.d/common-auth", "r")) == NULL) return -1; @@ -138,8 +138,12 @@ int get_pam_tally(int *deny, int *unlock_time , int *root_unlock_time) } ptr = strtok(NULL, " \t"); } + fclose(auth_file); + auth_file = NULL; return 1; } + fclose(auth_file); + auth_file = NULL; return 0; } @@ -389,15 +393,15 @@ void get_tally(uid_t uid, int *tfile, struct tallylog *tally) int pam_tally_unlock_time_left(int uid, int *fail_cnt,int *left_time, int *deny, int *fail_time, int *unlock_time1) { - pam_tally *tally_ptr; + pam_tally *tally_ptr; - if((tally_ptr = pam_tally_memory()) == NULL) - return 0; + if((tally_ptr = pam_tally_memory()) == NULL) + return 0; - int unlock_time = tally_ptr->unlock_time; + int unlock_time = tally_ptr->unlock_time; *deny = tally_ptr->deny; if(unlock_time == 0) - return 0; + return 0; int tfile = -1; struct tallylog tally; diff --git a/polkit-agent/src/pam-tally.h b/polkit-agent/src/pam-tally.h index 2585f56..5741e83 100644 --- a/polkit-agent/src/pam-tally.h +++ b/polkit-agent/src/pam-tally.h @@ -21,30 +21,32 @@ #include #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif #define SHM_TALLY "/shm_tally" -struct _pam_tally { - int deny; //失败次数上限 - int unlock_time; //普通用户失败次数达到上限后,多少秒之后才能解锁 - int root_unlock_time; //root用户失败次数达到上限后,多少秒之后才能解锁 - int failed; //当前失败的次数 - time_t lock_start_time; //失败次数达到上限后,开始计时 -}; -typedef struct _pam_tally pam_tally; + struct _pam_tally + { + int deny; //失败次数上限 + int unlock_time; //普通用户失败次数达到上限后,多少秒之后才能解锁 + int root_unlock_time; // root用户失败次数达到上限后,多少秒之后才能解锁 + int failed; //当前失败的次数 + time_t lock_start_time; //失败次数达到上限后,开始计时 + }; + typedef struct _pam_tally pam_tally; -int pam_tally_init(); -int pam_tally_add_failed(); -int pam_tally_clear_failed(); -int pam_tally_falure_is_out(); -int pam_tally_deny(); -int pam_tally_failed_count(); -int pam_tally_unlock_time(); -int pam_tally_is_enbled(); -int pam_tally_is_canUnlock(); -int pam_tally_unlock_time_left(int uid, int *fail_cnt, int *left_time, int *deny, int *fail_time, int *unlock_time); -int pam_tally_root_unlock_time_left(int *fail_cnt, int *left_time, int *deny, int *fail_time, int *unlock_time1); + int pam_tally_init(); + int pam_tally_add_failed(); + int pam_tally_clear_failed(); + int pam_tally_falure_is_out(); + int pam_tally_deny(); + int pam_tally_failed_count(); + int pam_tally_unlock_time(); + int pam_tally_is_enbled(); + int pam_tally_is_canUnlock(); + int pam_tally_unlock_time_left(int uid, int *fail_cnt, int *left_time, int *deny, int *fail_time, int *unlock_time); + int pam_tally_root_unlock_time_left(int *fail_cnt, int *left_time, int *deny, int *fail_time, int *unlock_time1); #ifdef __cplusplus } diff --git a/polkit-agent/src/sessionmanager.cpp b/polkit-agent/src/sessionmanager.cpp index 61d4ace..d9ee886 100644 --- a/polkit-agent/src/sessionmanager.cpp +++ b/polkit-agent/src/sessionmanager.cpp @@ -27,40 +27,35 @@ #define SM_DBUS_INTERFACE "org.gnome.SessionManager" #define SM_DBUS_CLIENT_INTERFACE "org.gnome.SessionManager.ClientPrivate" - SessionManager::SessionManager(QObject *parent) : QObject(parent) { - smInterface = new QDBusInterface(SM_DBUS_SERVICE, - SM_DBUS_PATH, - SM_DBUS_INTERFACE, - QDBusConnection::sessionBus()); + smInterface = new QDBusInterface(SM_DBUS_SERVICE, SM_DBUS_PATH, SM_DBUS_INTERFACE, QDBusConnection::sessionBus()); QString appId("polkit-ukui-authentication-agent-1.desktop"); QString clientStartupId(qgetenv("DESKTOP_AUTOSTART_ID")); - QDBusReply reply = smInterface->call("RegisterClient", - appId, clientStartupId); + QDBusReply reply = smInterface->call("RegisterClient", appId, clientStartupId); - if(!reply.isValid()) { + if (!reply.isValid()) { qWarning() << "Register Client to gnome session failed"; } clientId = reply.value().path(); qDebug() << "Register Client to gnome session: " << reply.value().path(); - clientInterface = new QDBusInterface(SM_DBUS_SERVICE, - clientId, - SM_DBUS_CLIENT_INTERFACE, - QDBusConnection::sessionBus()); + clientInterface + = new QDBusInterface(SM_DBUS_SERVICE, clientId, SM_DBUS_CLIENT_INTERFACE, QDBusConnection::sessionBus()); qDebug() << clientInterface->isValid(); QDBusConnection conn = clientInterface->connection(); - conn.connect(SM_DBUS_SERVICE, clientId, SM_DBUS_CLIENT_INTERFACE, - "Stop", this, SLOT(onStop())); - conn.connect(SM_DBUS_SERVICE, clientId, SM_DBUS_CLIENT_INTERFACE, - "EndSession", this, SLOT(onEndSession(unsigned int))); - conn.connect(SM_DBUS_SERVICE, clientId, SM_DBUS_CLIENT_INTERFACE, - "QueryEndSession", this, SLOT(onQueryEndSession(unsigned int))); - + conn.connect(SM_DBUS_SERVICE, clientId, SM_DBUS_CLIENT_INTERFACE, "Stop", this, SLOT(onStop())); + conn.connect( + SM_DBUS_SERVICE, clientId, SM_DBUS_CLIENT_INTERFACE, "EndSession", this, SLOT(onEndSession(unsigned int))); + conn.connect(SM_DBUS_SERVICE, + clientId, + SM_DBUS_CLIENT_INTERFACE, + "QueryEndSession", + this, + SLOT(onQueryEndSession(unsigned int))); } void SessionManager::onStop() @@ -82,6 +77,6 @@ void SessionManager::onQueryEndSession(unsigned int flag) void SessionManager::endSessionResponse() { QDBusMessage msg = clientInterface->call("EndSessionResponse", true, ""); - if(msg.type() == QDBusMessage::ErrorMessage) + if (msg.type() == QDBusMessage::ErrorMessage) qDebug() << "Failed to call EndSessionResponse " << msg.errorMessage(); } diff --git a/polkit-agent/src/types.h b/polkit-agent/src/types.h index ded7185..3881c37 100644 --- a/polkit-agent/src/types.h +++ b/polkit-agent/src/types.h @@ -34,34 +34,34 @@ enum ScreenStatus SCREEN_LOCK = 0x02 }; -#define SM_DBUS_SERVICE "org.gnome.SessionManager" -#define SM_DBUS_PATH "/org/gnome/SessionManager/Presence" -#define SM_DBUS_INTERFACE "org.gnome.SessionManager.Presence" +#define SM_DBUS_SERVICE "org.gnome.SessionManager" +#define SM_DBUS_PATH "/org/gnome/SessionManager/Presence" +#define SM_DBUS_INTERFACE "org.gnome.SessionManager.Presence" -#define DM_DBUS_SERVICE "org.freedesktop.DisplayManager" -#define DM_DBUS_PATH "/org/freedesktop/DisplayManager" -#define DM_DBUS_INTERFACE "org.freedesktop.DisplayManager" -#define DM_SEAT_INTERFACE "org.freedesktop.DisplayManager.Seat" +#define DM_DBUS_SERVICE "org.freedesktop.DisplayManager" +#define DM_DBUS_PATH "/org/freedesktop/DisplayManager" +#define DM_DBUS_INTERFACE "org.freedesktop.DisplayManager" +#define DM_SEAT_INTERFACE "org.freedesktop.DisplayManager.Seat" -#define ACT_DBUS_SERVICE "org.freedesktop.Accounts" -#define ACT_DBUS_PATH "/org/freedesktop/Accounts" -#define ACT_DBUS_INTERFACE "org.freedesktop.Accounts" -#define ACT_USER_INTERFACE "org.freedesktop.Accounts.User" +#define ACT_DBUS_SERVICE "org.freedesktop.Accounts" +#define ACT_DBUS_PATH "/org/freedesktop/Accounts" +#define ACT_DBUS_INTERFACE "org.freedesktop.Accounts" +#define ACT_USER_INTERFACE "org.freedesktop.Accounts.User" #define DBUS_PROP_INTERFACE "org.freedesktop.DBus.Properties" -#define SS_DBUS_SERVICE "org.ukui.ScreenSaver" -#define SS_DBUS_PATH "/" -#define SS_DBUS_INTERFACE "org.ukui.ScreenSaver" +#define SS_DBUS_SERVICE "org.ukui.ScreenSaver" +#define SS_DBUS_PATH "/" +#define SS_DBUS_INTERFACE "org.ukui.ScreenSaver" #define BIO_ERROR -1 #define BIO_FAILED 0 #define BIO_SUCCESS 1 #define BIO_IGNORE 2 -#define BIOMETRIC_PAM "BIOMETRIC_PAM" -#define BIOMETRIC_IGNORE "BIOMETRIC_IGNORE" -#define BIOMETRIC_SUCCESS "BIOMETRIC_SUCCESS" -#define BIOMETRIC_FAILED "BIOMETRIC_FAILED" +#define BIOMETRIC_PAM "BIOMETRIC_PAM" +#define BIOMETRIC_IGNORE "BIOMETRIC_IGNORE" +#define BIOMETRIC_SUCCESS "BIOMETRIC_SUCCESS" +#define BIOMETRIC_FAILED "BIOMETRIC_FAILED" #endif // TYPES_H diff --git a/polkit-agent/src/usdblockshortcut.cpp b/polkit-agent/src/usdblockshortcut.cpp new file mode 100644 index 0000000..2d0b57c --- /dev/null +++ b/polkit-agent/src/usdblockshortcut.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2024 Tianjin KYLIN Information Technology Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + **/ +#include "usdblockshortcut.h" +#include +#include +#include +#include + +USDBlockShortCut::USDBlockShortCut(QObject *parent) : QObject(parent) +{ + QString displayNum = QString(qgetenv("DISPLAY")).replace(":", "").replace(".", "_"); + m_strDbusPath = QString("%1%2").arg(QString("org.ukui.settingsDaemon.shortcut.ukui-polkit")).arg(displayNum); + m_isRegistService = QDBusConnection::sessionBus().registerService(m_strDbusPath); + if (!m_isRegistService) { + qInfo() << "registerService " << m_strDbusPath << " failed!!"; + } else { + m_isRegistObject = QDBusConnection::sessionBus().registerObject( + "/org/ukui/settingsDaemon/shortcut", + "org.ukui.settingsDaemon.shortcut", + this, + QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllProperties); + if (!m_isRegistObject) { + qInfo() << "registerObject /org/ukui/settingsDaemon/shortcut failed!!"; + } + } +} + +USDBlockShortCut::~USDBlockShortCut() +{ + if (m_isRegistObject) { + QDBusConnection::sessionBus().unregisterObject("/org/ukui/settingsDaemon/shortcut"); + m_isRegistObject = false; + } + if (m_isRegistService) { + QDBusConnection::sessionBus().unregisterService(m_strDbusPath); + m_isRegistService = false; + } +} + +QStringList USDBlockShortCut::blockShortcuts() +{ + QStringList listShortCut = { + "WINDOWSWITCH_KEY", "WLCOM_SWITCH_WORKSPACE", "WLCOM_WINDOW_ACTION", "WLCOM_MAXIMIZED_VIEWS", "WLCOM_CTRL_VIEWS" + }; + return listShortCut; +} diff --git a/polkit-agent/src/usdblockshortcut.h b/polkit-agent/src/usdblockshortcut.h new file mode 100644 index 0000000..645cba9 --- /dev/null +++ b/polkit-agent/src/usdblockshortcut.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 Tianjin KYLIN Information Technology Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + **/ +#ifndef USDBLOCKSHORTCUT_H +#define USDBLOCKSHORTCUT_H + +#include +#include +#include +#include + +class USDBlockShortCut : public QObject, public QDBusContext +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.ukui.settingsDaemon.shortcut") + Q_PROPERTY(QStringList blockShortcuts READ blockShortcuts) + +public: + USDBlockShortCut(QObject *parent = nullptr); + virtual ~USDBlockShortCut(); + +public slots: + /** + * @brief blockShortcuts 禁用按键列表 + * @return 禁用按键字符串列表 + */ + QStringList blockShortcuts(); + +private: + bool m_isRegistService = false; /**是否已注册服务*/ + bool m_isRegistObject = false; /**是否已注册对象*/ + QString m_strDbusPath; /**dbus服务路径*/ +}; + +#endif // USDBLOCKSHORTCUT_H diff --git a/polkit-agent/src/users.cpp b/polkit-agent/src/users.cpp index 64395c5..d9908f5 100644 --- a/polkit-agent/src/users.cpp +++ b/polkit-agent/src/users.cpp @@ -29,8 +29,7 @@ QDebug operator<<(QDebug stream, const UserItem &user) { - stream << user.name << user.realName << user.uid - << user.icon << user.path; + stream << user.name << user.realName << user.uid << user.icon << user.path; return stream; } @@ -47,26 +46,20 @@ QList Users::getUsers() UserItem Users::getUserByName(const QString &name) { - for(int i = 0 ; i < users.size() ; i++) { - if(users.at(i).name == name) - { + for (int i = 0; i < users.size(); i++) { + if (users.at(i).name == name) { return users.at(i); } } UserItem user; - if(name == "root") - { + if (name == "root") { user.icon = "/root/.face"; - if(!QFile(user.icon).exists()) - { + if (!QFile(user.icon).exists()) { user.icon = defaultIcon; } - } - else - { - user.icon = qgetenv("HOME")+"/.face"; - if(!QFile(user.icon).exists()) - { + } else { + user.icon = qgetenv("HOME") + "/.face"; + if (!QFile(user.icon).exists()) { user.icon = defaultIcon; } } @@ -81,29 +74,23 @@ QString Users::getDefaultIcon() return defaultIcon; } - -//https://stackoverflow.com/questions/20206376/ -//how-do-i-extract-the-returned-data-from-qdbusmessage-in-a-qt-dbus-call +// https://stackoverflow.com/questions/20206376/ +// how-do-i-extract-the-returned-data-from-qdbusmessage-in-a-qt-dbus-call void Users::loadUsers() { qDebug() << "loadUsers"; - actService = new QDBusInterface(ACT_DBUS_SERVICE, - ACT_DBUS_PATH, - ACT_DBUS_INTERFACE, - QDBusConnection::systemBus()); + actService = new QDBusInterface(ACT_DBUS_SERVICE, ACT_DBUS_PATH, ACT_DBUS_INTERFACE, QDBusConnection::systemBus()); - connect(actService, SIGNAL(UserAdded(const QDBusObjectPath&)), - this, SLOT(onUserAdded(const QDBusObjectPath&))); - connect(actService, SIGNAL(UserDeleted(const QDBusObjectPath&)), - this, SLOT(onUserDeleted(const QDBusObjectPath&))); + connect(actService, SIGNAL(UserAdded(const QDBusObjectPath &)), this, SLOT(onUserAdded(const QDBusObjectPath &))); + connect( + actService, SIGNAL(UserDeleted(const QDBusObjectPath &)), this, SLOT(onUserDeleted(const QDBusObjectPath &))); QDBusMessage ret = actService->call("ListCachedUsers"); - QList outArgs = ret.arguments(); //(QVariant(QDBusArgument,)) - QVariant first = outArgs.at(0); //QVariant(QDBusArgument,) + QList outArgs = ret.arguments(); //(QVariant(QDBusArgument,)) + QVariant first = outArgs.at(0); // QVariant(QDBusArgument,) const QDBusArgument &dbusArgs = first.value(); QDBusObjectPath path; dbusArgs.beginArray(); - while (!dbusArgs.atEnd()) - { + while (!dbusArgs.atEnd()) { dbusArgs >> path; getUser(path.path()); } @@ -112,10 +99,7 @@ void Users::loadUsers() UserItem Users::getUser(const QString &path) { - QDBusInterface iface(ACT_DBUS_SERVICE, - path, - DBUS_PROP_INTERFACE, - QDBusConnection::systemBus()); + QDBusInterface iface(ACT_DBUS_SERVICE, path, DBUS_PROP_INTERFACE, QDBusConnection::systemBus()); QDBusMessage ret = iface.call("GetAll", ACT_USER_INTERFACE); QList outArgs = ret.arguments(); QVariant first = outArgs.at(0); @@ -123,57 +107,45 @@ UserItem Users::getUser(const QString &path) UserItem user; user.path = path; dbusArgs.beginMap(); - while(!dbusArgs.atEnd()) - { + while (!dbusArgs.atEnd()) { QString key; QVariant value; dbusArgs.beginMapEntry(); dbusArgs >> key >> value; - if(key == "UserName") - { - user.name = value.toString(); - } - else if(key == "RealName") - { + if (key == "UserName") { + user.name = value.toString(); + } else if (key == "RealName") { user.realName = value.toString(); - } - else if(key == "IconFile") - { + } else if (key == "IconFile") { user.icon = value.toString(); - if(!QFile(user.icon).exists()) - { + if (!QFile(user.icon).exists()) { user.icon = defaultIcon; } - } - else if(key == "Uid") - { + } else if (key == "Uid") { user.uid = value.toUInt(); } dbusArgs.endMapEntry(); } dbusArgs.endMap(); - if(user.realName.isEmpty()) - { + if (user.realName.isEmpty()) { user.realName = user.name; } users.push_back(user); return user; } -void Users::onUserAdded(const QDBusObjectPath& path) +void Users::onUserAdded(const QDBusObjectPath &path) { int index = findUserByPath(path.path()); - if(index >=0 &&index= 0 && index < users.count()) { UserItem user = getUser(path.path()); Q_EMIT userAdded(user); } } -void Users::onUserDeleted(const QDBusObjectPath& path) +void Users::onUserDeleted(const QDBusObjectPath &path) { int index = findUserByPath(path.path()); - if(index >= 0 && index= 0 && index < users.count()) { UserItem user = users.at(index); users.removeAt(index); Q_EMIT userDeleted(user); @@ -182,13 +154,9 @@ void Users::onUserDeleted(const QDBusObjectPath& path) int Users::findUserByPath(const QString &path) { - auto iter = std::find_if(users.begin(), users.end(), - [&](const UserItem &user){ - return user.path == path; - }); + auto iter = std::find_if(users.begin(), users.end(), [&](const UserItem &user) { return user.path == path; }); int index = iter - users.begin(); return index; } - diff --git a/polkit-agent/src/users.h b/polkit-agent/src/users.h index 509cb3f..747bcc3 100644 --- a/polkit-agent/src/users.h +++ b/polkit-agent/src/users.h @@ -20,14 +20,13 @@ #include - struct UserItem { QString name; QString realName; QString icon; quint64 uid; - QString path; //accounts service path + QString path; // accounts service path friend QDebug operator<<(QDebug stream, const UserItem &user); }; @@ -48,17 +47,17 @@ private: int findUserByPath(const QString &path); private Q_SLOTS: - void onUserAdded(const QDBusObjectPath& path); - void onUserDeleted(const QDBusObjectPath& path); + void onUserAdded(const QDBusObjectPath &path); + void onUserDeleted(const QDBusObjectPath &path); Q_SIGNALS: void userAdded(const UserItem &user); void userDeleted(const UserItem &user); private: - QDBusInterface *actService; - QList users; - QString defaultIcon; + QDBusInterface *actService; + QList users; + QString defaultIcon; }; #endif // USERS_H