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
19 changes: 12 additions & 7 deletions applets/dde-shutdown/shutdownapplet.cpp
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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();
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Resolved
} 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")) {
Expand Down
34 changes: 34 additions & 0 deletions applets/dde-shutdown/treelandlockscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions applets/dde-shutdown/treelandlockscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ class TreeLandLockScreen : public QWaylandClientExtensionTemplate<TreeLandLockSc
void lock();
void shutdown();
void switchUser();
void powerOff();
void reboot();
void suspend();
void hibernate();
void logout();
};
}
DS_END_NAMESPACE
Loading