Skip to content

Commit 5d8f7e0

Browse files
committed
fix: fix notification settings opening via direct D-Bus call
Changed the method of opening notification settings from using the controlCenterInterface() helper to directly constructing a D-Bus message and making an async call. The previous approach used a QDBusReply which would wait for a synchronous response, potentially blocking the UI. The new implementation uses QDBusMessage::createMethodCall to create the message and QDBusConnection::sessionBus().asyncCall() to send it asynchronously, improving responsiveness. Log: Fixed issue where opening notification settings could cause UI lag Influence: 1. Test clicking notification settings button in notification center 2. Verify settings window opens without delay 3. Check that other notification center functions remain unaffected 4. Test with multiple rapid clicks to ensure no blocking occurs fix: 修复通过直接 D-Bus 调用打开通知设置的问题 将打开通知设置的方法从使用 controlCenterInterface() 辅助函数改为直接构造 D-Bus 消息并进行异步调用。之前的方法使用 QDBusReply 会等待同步响应,可能 导致 UI 阻塞。新实现使用 QDBusMessage::createMethodCall 创建消息,并使用 QDBusConnection::sessionBus().asyncCall() 异步发送,提高了响应速度。 Log: 修复了打开通知设置可能导致界面卡顿的问题 Influence: 1. 测试通知中心中点击通知设置按钮 2. 验证设置窗口打开无延迟 3. 检查通知中心其他功能是否不受影响 4. 测试多次快速点击确保不会发生阻塞 PMS: BUG-353895
1 parent 0b9cab0 commit 5d8f7e0

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

panels/notification/center/notifyaccessor.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -219,12 +219,20 @@ bool NotifyAccessor::applicationPin(const QString &appId) const
219219
void NotifyAccessor::openNotificationSetting()
220220
{
221221
qDebug(notifyLog) << "Open notification setting";
222-
QDBusReply<void> reply = controlCenterInterface().call("ShowPage",
223-
"notification");
224-
if (reply.error().isValid()) {
225-
qWarning(notifyLog) << "Failed to Open notifycation setting" << reply.error().message();
226-
return;
227-
}
222+
QDBusMessage msg = QDBusMessage::createMethodCall("org.deepin.dde.ControlCenter1",
223+
"/org/deepin/dde/ControlCenter1",
224+
"org.deepin.dde.ControlCenter1",
225+
"ShowPage");
226+
msg << "notification";
227+
QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(msg);
228+
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
229+
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *self) {
230+
QDBusReply<void> reply = *self;
231+
if (!reply.isValid()) {
232+
qWarning(notifyLog) << "Failed to open notification setting:" << reply.error().message();
233+
}
234+
self->deleteLater();
235+
});
228236
}
229237

230238
void NotifyAccessor::onNotificationStateChanged(qint64 id, int processedType)

0 commit comments

Comments
 (0)