3 Star 0 Fork 6

src-openEuler/kiran-session-guard

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0014-fix-virutalkeyboard-Add-detection-for-whether-to-ins.patch 4.10 KB
一键复制 编辑 原始数据 按行查看 历史
liubuguiii 提交于 2024-04-09 17:11 . sync 2.5.1-11
From a76ad7de22f16efcad20236ec95dfa666ab3a8fa Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
Date: Tue, 6 Feb 2024 10:14:07 +0800
Subject: [PATCH 14/16] fix(virutalkeyboard): Add detection for whether to
install a virtual keyboard
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增对于是否安装虚拟键盘的检测
---
lib/utils/virtual-keyboard.cpp | 14 ++++++++++++++
lib/utils/virtual-keyboard.h | 5 +++--
src/lightdm-greeter/frame.cpp | 11 +++++++++--
src/screensaver-dialog/frame.cpp | 9 ++++++++-
4 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/lib/utils/virtual-keyboard.cpp b/lib/utils/virtual-keyboard.cpp
index 292740a..3e1e7dd 100644
--- a/lib/utils/virtual-keyboard.cpp
+++ b/lib/utils/virtual-keyboard.cpp
@@ -22,6 +22,7 @@
#include <QMutex>
#include <QScopedPointer>
#include <QScreen>
+#include <QFileInfo>
#define ONBOARD_LAYOUT "Compact"
#define ONBOARD_THEME "Blackboard"
@@ -61,10 +62,18 @@ VirtualKeyboard::~VirtualKeyboard()
bool VirtualKeyboard::init(QWidget *parent)
{
+ if( !QFileInfo::exists("/usr/bin/onboard") )
+ {
+ m_isSupported = false;
+ return false;
+ }
+
if (m_keyboardWidget != nullptr)
{
return false;
}
+
+ m_isSupported = true;
m_process = new QProcess(this);
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &VirtualKeyboard::slot_finished);
@@ -98,6 +107,11 @@ bool VirtualKeyboard::init(QWidget *parent)
return true;
}
+bool VirtualKeyboard::isSupported()
+{
+ return m_isSupported;
+}
+
bool VirtualKeyboard::isVisible()
{
if (m_keyboardWidget == nullptr)
diff --git a/lib/utils/virtual-keyboard.h b/lib/utils/virtual-keyboard.h
index 4670105..99bf405 100644
--- a/lib/utils/virtual-keyboard.h
+++ b/lib/utils/virtual-keyboard.h
@@ -29,8 +29,9 @@ public:
~VirtualKeyboard();
static VirtualKeyboard *instance();
-
bool init(QWidget *parent = nullptr);
+ bool isSupported();
+
void hide();
bool isVisible();
void showAdjustSize(QWidget *parent = nullptr);
@@ -39,11 +40,11 @@ public:
public slots:
void slot_finished(int exitCode, QProcess::ExitStatus exitStatus);
-
private slots:
void slotReadyReadStandardOutput();
private:
+ bool m_isSupported = false;
QWidget *m_keyboardWidget = nullptr;
QProcess *m_process = nullptr;
QWidget *m_keyboardEmbed = nullptr;
diff --git a/src/lightdm-greeter/frame.cpp b/src/lightdm-greeter/frame.cpp
index e4afcb9..085139a 100644
--- a/src/lightdm-greeter/frame.cpp
+++ b/src/lightdm-greeter/frame.cpp
@@ -306,7 +306,14 @@ void Frame::initUI()
rbBtnLayout->addItem(rbBtnLayoutItem);
rbBtnLayout->addWidget(m_btnSession, 1);
- rbBtnLayout->addWidget(m_btnKeyboard, 1);
+ if( VirtualKeyboard::instance()->isSupported() )
+ {
+ rbBtnLayout->addWidget(m_btnKeyboard, 1);
+ }
+ else
+ {
+ m_btnKeyboard->setVisible(false);
+ }
rbBtnLayout->addWidget(m_btnPower, 1);
setRightBottomWidget(rbBtnWidget);
@@ -316,7 +323,7 @@ void Frame::initAuth()
{
AuthLightdm* auth = new AuthLightdm(m_greeter);
LoginFrame::initAuth(auth);
- connect(m_greeter.data(),&QLightDM::Greeter::autologinTimerExpired,this,&Frame::onAutoLoginTimeout);
+ connect(m_greeter.data(), &QLightDM::Greeter::autologinTimerExpired, this, &Frame::onAutoLoginTimeout);
}
void Frame::initConnection()
diff --git a/src/screensaver-dialog/frame.cpp b/src/screensaver-dialog/frame.cpp
index 73f50dc..04f0f30 100644
--- a/src/screensaver-dialog/frame.cpp
+++ b/src/screensaver-dialog/frame.cpp
@@ -175,7 +175,14 @@ void Frame::initUI()
rbBtnLayout->addItem(rbBtnLayoutItem);
rbBtnLayout->addWidget(m_btnSwitchToGreeter, 1);
- rbBtnLayout->addWidget(m_btnKeyboard, 1);
+ if( VirtualKeyboard::instance()->isSupported() )
+ {
+ rbBtnLayout->addWidget(m_btnKeyboard, 1);
+ }
+ else
+ {
+ m_btnKeyboard->setVisible(false);
+ }
rbBtnLayout->addWidget(m_btnPower, 1);
setRightBottomWidget(rbBtnWidget);
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/kiran-session-guard.git
git@gitee.com:src-openeuler/kiran-session-guard.git
src-openeuler
kiran-session-guard
kiran-session-guard
master

搜索帮助