diff --git a/applets/dde-shutdown/shutdownapplet.cpp b/applets/dde-shutdown/shutdownapplet.cpp index 375d461d8..0f3c81703 100644 --- a/applets/dde-shutdown/shutdownapplet.cpp +++ b/applets/dde-shutdown/shutdownapplet.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -48,16 +48,21 @@ bool ShutdownApplet::requestShutdown(const QString &type) // TODO: left mouse clicked, show shutdown page m_lockscreen->shutdown(); } else if (type == QStringLiteral("Shutdown")) { - m_lockscreen->shutdown(); + m_lockscreen->powerOff(); } else if (type == QStringLiteral("Lock")) { m_lockscreen->lock(); } else if (type == QStringLiteral("SwitchUser")) { m_lockscreen->switchUser(); - } else if (type == QStringLiteral("UpdateAndShutdown") || type == QStringLiteral("UpdateAndReboot") || - type == QStringLiteral("Suspend") || type == QStringLiteral("Hibernate") || - type == QStringLiteral("Restart") || type == QStringLiteral("Logout")) { - // TODO: implement these types - m_lockscreen->shutdown(); + } else if (type == QStringLiteral("Restart") || type == QStringLiteral("UpdateAndReboot")) { + m_lockscreen->reboot(); + } else if (type == QStringLiteral("Suspend")) { + m_lockscreen->suspend(); + } else if (type == QStringLiteral("Hibernate")) { + m_lockscreen->hibernate(); + } else if (type == QStringLiteral("Logout")) { + m_lockscreen->logout(); + } else if (type == QStringLiteral("UpdateAndShutdown")) { + m_lockscreen->powerOff(); } } else { if (type == QStringLiteral("Lock")) { diff --git a/applets/dde-shutdown/treelandlockscreen.cpp b/applets/dde-shutdown/treelandlockscreen.cpp index 2ea5a8e75..c9392bc9d 100644 --- a/applets/dde-shutdown/treelandlockscreen.cpp +++ b/applets/dde-shutdown/treelandlockscreen.cpp @@ -40,5 +40,39 @@ void TreeLandLockScreen::switchUser() trigger(action_show_user_switch); } } +void TreeLandLockScreen::powerOff() +{ + if (isActive()) { + trigger(action_shutdown_menu_power_off); + } +} + +void TreeLandLockScreen::reboot() +{ + if (isActive()) { + trigger(action_shutdown_menu_reboot); + } +} + +void TreeLandLockScreen::suspend() +{ + if (isActive()) { + trigger(action_shutdown_menu_suspend); + } +} + +void TreeLandLockScreen::hibernate() +{ + if (isActive()) { + trigger(action_shutdown_menu_hibernate); + } +} + +void TreeLandLockScreen::logout() +{ + if (isActive()) { + trigger(action_shutdown_menu_log_out); + } +} } DS_END_NAMESPACE diff --git a/applets/dde-shutdown/treelandlockscreen.h b/applets/dde-shutdown/treelandlockscreen.h index 1cd74cf35..12b190dec 100644 --- a/applets/dde-shutdown/treelandlockscreen.h +++ b/applets/dde-shutdown/treelandlockscreen.h @@ -22,6 +22,11 @@ class TreeLandLockScreen : public QWaylandClientExtensionTemplate