@@ -113,14 +113,6 @@ void LockContent::init(SessionBaseModel *model)
113113 }
114114
115115 DConfigHelper::instance ()->bind (this , SHOW_MEDIA_WIDGET, &LockContent::OnDConfigPropertyChanged);
116-
117- QString kbLayout = getCurrentKBLayout ();
118- if (!kbLayout.isEmpty () && !kbLayout.toLower ().startsWith (" us" )) {
119- m_originalKBLayout = kbLayout;
120- qCInfo (DDE_SHELL) << " Original keyboard layout:" << m_originalKBLayout;
121- // 如果键盘布局有特殊设置,则切换到英文键盘布局,认证成功后恢复
122- setKBLayout (" us" );
123- }
124116}
125117
126118void LockContent::initUI ()
@@ -196,13 +188,8 @@ void LockContent::initConnections()
196188 connect (m_model, &SessionBaseModel::userListChanged, this , &LockContent::onUserListChanged);
197189 connect (m_model, &SessionBaseModel::userListLoginedChanged, this , &LockContent::onUserListChanged);
198190 connect (m_model, &SessionBaseModel::authFinished, this , [this ](bool successful) {
199- if (successful) {
191+ if (successful)
200192 setVisible (false );
201- if (!m_originalKBLayout.isEmpty ()) {
202- // 切换回原来的键盘布局
203- setKBLayout (m_originalKBLayout);
204- }
205- }
206193 restoreMode ();
207194 });
208195 connect (m_model, &SessionBaseModel::MFAFlagChanged, this , [this ](const bool isMFA) {
@@ -1027,26 +1014,3 @@ void LockContent::showShutdown()
10271014 m_model->setCurrentModeState (SessionBaseModel::ModeStatus::ShutDownMode);
10281015 m_model->setVisible (true );
10291016}
1030-
1031- QString LockContent::getCurrentKBLayout () const
1032- {
1033- QProcess p;
1034- p.start (" /usr/bin/setxkbmap" , {" -query" });
1035- p.waitForFinished ();
1036-
1037- const QString output = QString::fromUtf8 (p.readAllStandardOutput ());
1038- for (const QString &line : output.split (' \n ' )) {
1039- if (line.startsWith (" layout:" )) {
1040- QString layout = line.section (' :' , 1 ).trimmed ();
1041- return layout;
1042- }
1043- }
1044-
1045- return {};
1046- }
1047-
1048- void LockContent::setKBLayout (const QString &layout)
1049- {
1050- qCDebug (DDE_SHELL) << " Set keyboard layout: " << layout;
1051- QProcess::execute (" /usr/bin/setxkbmap" , { layout});
1052- }
0 commit comments