Skip to content

Commit ea4df8c

Browse files
deepin-ci-robotyixinshark
authored andcommitted
sync: from linuxdeepin/dde-session-shell
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#46
1 parent f68a03d commit ea4df8c

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

src/session-widgets/lockcontent.cpp

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -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

126118
void 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-
}

src/session-widgets/lockcontent.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ public slots:
102102
void initFMAWidget();
103103
void initUserListWidget();
104104
void enableSystemShortcut(const QStringList &shortcuts, bool enabled, bool isPersistent);
105-
QString getCurrentKBLayout() const;
106-
void setKBLayout(const QString &layout);
107105

108106
protected:
109107
SessionBaseModel *m_model = nullptr;
@@ -136,8 +134,6 @@ public slots:
136134
bool m_MPRISEnable = false;
137135
bool m_showMediaWidget = false;
138136
bool m_hasResetPasswordDialog = false;
139-
140-
QString m_originalKBLayout;
141137
};
142138

143139
#endif // LOCKCONTENT_H

0 commit comments

Comments
 (0)