Skip to content

Commit 9167618

Browse files
wyu71deepin-bot[bot]
authored andcommitted
fix: reset boot delay switch state when authentication is cancelled
- Added resetBootDelay signal and onSetTimeoutError slot in CommonInfoProxy - Used callWithCallback to handle SetTimeout DBus call errors - Connected resetBootDelay signal to emit bootDelayChanged in CommonInfoWork - Added Connections in BootPage.qml to sync switch state with model Log: reset boot delay switch state when authentication is cancelled pms: BUG-342081
1 parent 387dfd7 commit 9167618

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

src/plugin-commoninfo/operation/commoninfoproxy.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ uint CommonInfoProxy::Timeout()
227227

228228
void CommonInfoProxy::setTimeout(const uint timeout)
229229
{
230-
m_grubInter->asyncCallWithArgumentList("SetTimeout", { timeout });
230+
QList<QVariant> argumentList;
231+
argumentList << QVariant::fromValue(timeout);
232+
m_grubInter->callWithCallback(QStringLiteral("SetTimeout"), argumentList, this, nullptr, SLOT(onSetTimeoutError(QDBusError)));
231233
}
232234

233235
QStringList CommonInfoProxy::EnabledUsers()
@@ -361,3 +363,9 @@ void CommonInfoProxy::onLicenseStateChanged()
361363
const auto state = AuthorizationState();
362364
Q_EMIT AuthorizationStateChanged(state);
363365
}
366+
367+
void CommonInfoProxy::onSetTimeoutError(const QDBusError &error)
368+
{
369+
Q_UNUSED(error);
370+
Q_EMIT resetBootDelay();
371+
}

src/plugin-commoninfo/operation/commoninfoproxy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ class CommonInfoProxy : public QObject
9595
// reset signals
9696
void resetEnableTheme();
9797
void resetGrubEditAuthEnabled();
98+
void resetBootDelay();
9899

99100
private Q_SLOTS:
100101
void onDeepinIdError(const int code, const QString &msg);
101102
void onACLError(quint32 exitCode);
102103
void onLicenseStateChanged();
104+
void onSetTimeoutError(const QDBusError &error);
103105

104106
private:
105107
DDBusInterface *m_grubInter;

src/plugin-commoninfo/operation/commoninfowork.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ CommonInfoWork::CommonInfoWork(CommonInfoModel *model, QObject *parent)
219219

220220
connect(m_commonInfoProxy, &CommonInfoProxy::resetGrubEditAuthEnabled, this, &CommonInfoWork::resetEditAuthEnabled);
221221

222+
connect(m_commonInfoProxy, &CommonInfoProxy::resetBootDelay, this, [=](){
223+
Q_EMIT m_commomModel->bootDelayChanged(m_commomModel->bootDelay());
224+
});
225+
222226
connect(m_commonInfoProxy, &CommonInfoProxy::DeveloperModeChanged, m_commomModel, &CommonInfoModel::setIsDeveloperMode);
223227
}
224228

src/plugin-commoninfo/qml/BootPage.qml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,17 @@ DccObject {
248248
pageType: DccObject.Editor
249249
backgroundType: DccObject.Normal
250250
page: Switch {
251+
id: bootDelaySwitch
251252
Layout.alignment: Qt.AlignRight
252253
checked: dccData.mode().bootDelay
253254

255+
Connections {
256+
target: dccData.mode()
257+
function onBootDelayChanged() {
258+
bootDelaySwitch.checked = dccData.mode().bootDelay
259+
}
260+
}
261+
254262
onCheckedChanged: {
255263
if (dccData.mode().bootDelay != checked) {
256264
dccData.work().setBootDelay(checked)

0 commit comments

Comments
 (0)