Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/common/commondefine.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2025 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -41,5 +41,10 @@ const static QString ShutdownFront1Service = QStringLiteral("org.deepin.dde.Shut
const static QString ShutdownFront1Path = QStringLiteral("/org/deepin/dde/ShutdownFront1");
const static QString ShutdownFront1Interface = QStringLiteral("org.deepin.dde.ShutdownFront1");

// SessionManager1
const static QString SessionManager1Service = QStringLiteral("org.deepin.dde.SessionManager1");
const static QString SessionManager1Path = QStringLiteral("/org/deepin/dde/SessionManager1");
const static QString SessionManager1Interface = QStringLiteral("org.deepin.dde.SessionManager1");

const static QString PropertiesInterface = QStringLiteral("org.freedesktop.DBus.Properties");
const static QString PropertiesChanged = QStringLiteral("PropertiesChanged");
23 changes: 19 additions & 4 deletions src/common/dbus/updatedbusproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
#include <QDBusInterface>
#include <QDBusMetaType>
#include <QDBusPendingReply>
#include <QDBusReply>

Check warning on line 10 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusReply> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusUnixFileDescriptor>

Check warning on line 11 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusUnixFileDescriptor> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QLoggingCategory>

Check warning on line 12 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QLoggingCategory> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DGuiApplicationHelper>

Check warning on line 13 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DGuiApplicationHelper> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include "common/commondefine.h"

Check warning on line 15 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "common/commondefine.h" not found.

Q_DECLARE_LOGGING_CATEGORY(logCommon)

Expand Down Expand Up @@ -39,6 +40,8 @@
LockService, LockPath, LockInterface, QDBusConnection::systemBus(), this))
, m_shutdownFrontInter(new DDBusInterface(
ShutdownFront1Service, ShutdownFront1Path, ShutdownFront1Interface, QDBusConnection::sessionBus(), this))
, m_sessionManagerInter(new DDBusInterface(
SessionManager1Service, SessionManager1Path, SessionManager1Interface, QDBusConnection::sessionBus(), this))
, m_interWatcher(new QDBusServiceWatcher(UpdaterService, QDBusConnection::systemBus()))

{
Expand Down Expand Up @@ -550,18 +553,30 @@
return QDBusPendingReply<QString>(m_lockServiceInter->asyncCall(QStringLiteral("CurrentUser")));
}

void UpdateDBusProxy::Restart()

Check warning on line 556 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'Restart' is never used.
{
qCInfo(logCommon) << "Calling system restart";
m_shutdownFrontInter->asyncCall(QStringLiteral("Restart"));
if (Dtk::Gui::DGuiApplicationHelper::testAttribute(Dtk::Gui::DGuiApplicationHelper::IsWaylandPlatform)) {
m_sessionManagerInter->asyncCall(QStringLiteral("RequestReboot"));
} else {
m_shutdownFrontInter->asyncCall(QStringLiteral("Restart"));
}
}
void UpdateDBusProxy::UpdateAndReboot()

Check warning on line 565 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'UpdateAndReboot' is never used.
{
qCInfo(logCommon) << "Calling update and reboot";
m_shutdownFrontInter->asyncCall(QStringLiteral("UpdateAndReboot"));
if (Dtk::Gui::DGuiApplicationHelper::testAttribute(Dtk::Gui::DGuiApplicationHelper::IsWaylandPlatform)) {
m_sessionManagerInter->asyncCall(QStringLiteral("RequestReboot"));
} else {
m_shutdownFrontInter->asyncCall(QStringLiteral("UpdateAndReboot"));
}
}
void UpdateDBusProxy::UpdateAndShutdown()

Check warning on line 574 in src/common/dbus/updatedbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'UpdateAndShutdown' is never used.
{
qCInfo(logCommon) << "Calling update and shutdown";
m_shutdownFrontInter->asyncCall(QStringLiteral("UpdateAndShutdown"));
}
if (Dtk::Gui::DGuiApplicationHelper::testAttribute(Dtk::Gui::DGuiApplicationHelper::IsWaylandPlatform)) {
m_sessionManagerInter->asyncCall(QStringLiteral("RequestShutdown"));
} else {
m_shutdownFrontInter->asyncCall(QStringLiteral("UpdateAndShutdown"));
}
}
1 change: 1 addition & 0 deletions src/common/dbus/updatedbusproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ class UpdateDBusProxy : public QObject
DDBusInterface *m_login1Inter;
DDBusInterface *m_lockServiceInter;
DDBusInterface *m_shutdownFrontInter;
DDBusInterface *m_sessionManagerInter;

QDBusServiceWatcher *m_interWatcher;
};
Expand Down
23 changes: 16 additions & 7 deletions src/dock-update-plugin/pluginupdateplugin.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2025-2026 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2025 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -189,12 +189,21 @@ void PluginUpdatePlugin::invokedMenuItem(const QString &itemKey, const QString &
.call();
} else if (menuId == MENU_RESTART) {
// 重启系统
DDBusSender()
.service("org.deepin.dde.ShutdownFront1")
.interface("org.deepin.dde.ShutdownFront1")
.path("/org/deepin/dde/ShutdownFront1")
.method("Restart")
.call();
if (Dtk::Gui::DGuiApplicationHelper::testAttribute(Dtk::Gui::DGuiApplicationHelper::IsWaylandPlatform)) {
DDBusSender()
.service("org.deepin.dde.SessionManager1")
.interface("org.deepin.dde.SessionManager1")
.path("/org/deepin/dde/SessionManager1")
.method("RequestReboot")
.call();
} else {
DDBusSender()
.service("org.deepin.dde.ShutdownFront1")
.interface("org.deepin.dde.ShutdownFront1")
.path("/org/deepin/dde/ShutdownFront1")
.method("Restart")
.call();
}
}
}

Expand Down
Loading