From 8c282b60f7cda135f4e8c981747536fda7da23af Mon Sep 17 00:00:00 2001 From: Nicky <71775776+nickylivardo@users.noreply.github.com> Date: Mon, 19 Aug 2024 03:18:54 +0700 Subject: [PATCH] readability enhanced --- src/optimusmanager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/optimusmanager.cpp b/src/optimusmanager.cpp index a412cf3..0398c17 100644 --- a/src/optimusmanager.cpp +++ b/src/optimusmanager.cpp @@ -476,9 +476,12 @@ int OptimusManager::sessionsCountWithoutGdm(const QVector &sessions) void OptimusManager::logout() { - QDBusInterface kde5(QStringLiteral("org.kde.ksmserver"), QStringLiteral("/KSMServer"), QStringLiteral("org.kde.KSMServerInterface")); QDBusInterface kde6(QStringLiteral("org.kde.Shutdown"), QStringLiteral("/Shutdown")); - if (kde6.call(QStringLiteral("logout")).type() == QDBusMessage::ReplyMessage || kde5.call(QStringLiteral("logout"), 0, 3, 3).type() == QDBusMessage::ReplyMessage) + if (kde6.call(QStringLiteral("logout")).type() == QDBusMessage::ReplyMessage) + return; + + QDBusInterface kde5(QStringLiteral("org.kde.ksmserver"), QStringLiteral("/KSMServer"), QStringLiteral("org.kde.KSMServerInterface")); + if (kde5.call(QStringLiteral("logout"), 0, 3, 3).type() == QDBusMessage::ReplyMessage) return; QDBusInterface gnome(QStringLiteral("org.gnome.SessionManager"), QStringLiteral("/org/gnome/SessionManager"), QStringLiteral("org.gnome.SessionManager"));