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
3 changes: 0 additions & 3 deletions dbus/adaptor/org.deepin.dde.SessionManager1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
<method name="CanSuspend">
<arg type="b" direction="out" name="result"></arg>
</method>
<method name="ForceLogout"></method>
<method name="ForceReboot"></method>
<method name="ForceShutdown"></method>
<method name="GetInhibitors">
<arg name="Inhibitors" type="ao" direction="out"></arg>
</method>
Expand Down
39 changes: 14 additions & 25 deletions src/dde-session/impl/sessionmanager.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2021 - 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2021 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -289,24 +289,6 @@ bool SessionManager::CanSuspend()
return canSuspend == "yes";
}

void SessionManager::ForceLogout()
{
qDebug() << "force logout";

prepareLogout(true);
clearCurrentTty();
doLogout();
}

void SessionManager::ForceReboot()
{
reboot(true);
}

void SessionManager::ForceShutdown()
{
shutdown(true);
}
/**
* @brief SessionManager::GetInhibitors 遍历得到 Inhibitor 的路径列表,Inhibitor 是操作拦截器的意思,可以阻止一些由 flags 指定的操作。
* @return ArrayofObjectPath: 返回一个包含 Inhibitors 路径名的数组
Expand Down Expand Up @@ -451,12 +433,12 @@ void SessionManager::RequestLogout()

void SessionManager::RequestReboot()
{
reboot(false);
reboot(true);
}

void SessionManager::RequestShutdown()
{
shutdown(false);
shutdown(true);
}

void SessionManager::RequestSuspend()
Expand Down Expand Up @@ -517,11 +499,18 @@ void SessionManager::prepareShutdown(bool force)
{
stopSogouIme();
stopBAMFDaemon();

if (!force)
preparePlayShutdownSound();

preparePlayShutdownSound();
stopPulseAudioService();

if (force) {
// 直接停止session,默认不会等待应用程序准备完成,强制关机
EXEC_COMMAND("/usr/bin/dde-am"
, QStringList()
<< "-c"
<< "/usr/libexec/dde-session-ctl"
<< "--"
<< "--shutdown");
}
}

void SessionManager::clearCurrentTty()
Expand Down
5 changes: 1 addition & 4 deletions src/dde-session/impl/sessionmanager.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2021 - 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2021 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -49,9 +49,6 @@ public Q_SLOTS:
bool CanReboot();
bool CanShutdown();
bool CanSuspend();
void ForceLogout();
void ForceReboot();
void ForceShutdown();
QList<QDBusObjectPath> GetInhibitors();
uint Inhibit(const QString &appId, uint topLevelXid, const QString &reason, uint flags);
bool IsInhibited (uint flags);
Expand Down