Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit bd31daab authored by Wolfgang Bauer's avatar Wolfgang Bauer

Port shutdown actions

This allows again to shutdown/suspend/hibernate the system after the
downloads have finished, if kget is built with libkworkspace.

Use the more generic org.freedesktop.PowerManagement interface though,
org.kde.Solid.PowerManagement has changed (during KDE4 times already)
and Solid::PowerManagement is deprecated (part of kdelibs4support).
parent 27c8db02
......@@ -127,12 +127,11 @@ add_subdirectory(desktop)
add_subdirectory(tests)
add_subdirectory(doc)
#macro_optional_find_package(KDE4Workspace)
#macro_log_feature(KDE4WORKSPACE_FOUND "KDE4Workspace" "KDE4 workspace libraries, part of kdebase-workspace" "http://www.kde.org" FALSE "" "Allows 'shutdown after downloads completed' in kget")
#if(KDE4WORKSPACE_FOUND)
# add_definitions(-DHAVE_KWORKSPACE)
# include_directories(${KDE4WORKSPACE_INCLUDE_DIR})
#endif(KDE4WORKSPACE_FOUND)
find_package(LibKWorkspace CONFIG)
set_package_properties(LibKWorkspace PROPERTIES TYPE OPTIONAL PURPOSE "Allows 'shutdown after downloads completed' in kget")
if(LibKWorkspace_FOUND)
add_definitions(-DHAVE_KWORKSPACE)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
......@@ -208,9 +207,9 @@ generate_export_header(kgetcore BASE_NAME kget)
target_link_libraries(kgetcore Qt5::Core Qt5::Widgets Qt5::Sql Qt5::Network Qt5::DBus KF5::DBusAddons KF5::I18n KF5::CoreAddons KF5::IconThemes KF5::KDELibs4Support)
if (KDE4WORKSPACE_FOUND)
target_link_libraries(kgetcore ${KDE4WORKSPACE_KWORKSPACE_LIBS})
endif (KDE4WORKSPACE_FOUND)
if(LibKWorkspace_FOUND)
target_link_libraries(kgetcore PW::KWorkspace)
endif()
if (SQLITE_FOUND)
target_link_libraries(kgetcore ${QT_QTSQL_LIBRARY})
......
......@@ -58,10 +58,10 @@
#include <QTemporaryFile>
#ifdef HAVE_KWORKSPACE
#include <QDBusConnection>
#include <kworkspace/kworkspace.h>
#include <solid/powermanagement.h>
#include <QStandardPaths>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusPendingCall>
#include <kworkspace.h>
#endif
......@@ -1556,19 +1556,19 @@ void GenericObserver::slotAfterFinishAction()
break;
case KGet::Hibernate: {
QDBusMessage call;
call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement",
"/org/kde/Solid/PowerManagement",
"org.kde.Solid.PowerManagement",
"suspendToRam");
call = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.PowerManagement"),
QStringLiteral("/org/freedesktop/PowerManagement"),
QStringLiteral("org.freedesktop.PowerManagement"),
QStringLiteral("Suspend"));
QDBusConnection::sessionBus().asyncCall(call);
break;
}
case KGet::Suspend: {
QDBusMessage call;
call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement",
"/org/kde/Solid/PowerManagement",
"org.kde.Solid.PowerManagement",
"suspendToDisk");
call = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.PowerManagement"),
QStringLiteral("/org/freedesktop/PowerManagement"),
QStringLiteral("org.freedesktop.PowerManagement"),
QStringLiteral("Hibernate"));
QDBusConnection::sessionBus().asyncCall(call);
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment