File 0001-Use-platform-detection-in-SystemSettings.patch of Package systemsettings5

From 5405ba3d72482ccfd50c06cdb0bb9df62a9d88cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= <mgraesslin@kde.org>
Date: Sun, 18 Mar 2018 09:48:54 +0100
Subject: [PATCH] Use platform detection in SystemSettings

Summary:
SystemSettings needs to run on Wayland in a Wayland session and on X11
in an X11 session.

Test Plan:
unset QT_QPA_PLATFORM and XDG_SESSION_TYPE -> x11 window,
reset XDG_SESSION_TYPE to wayland -> wayland window

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D11445
---
 CMakeLists.txt     | 2 ++
 app/CMakeLists.txt | 1 +
 app/main.cpp       | 3 +++
 3 files changed, 6 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 147a4e5..c1d8ec4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,6 +48,8 @@ ecm_find_qmlmodule(org.kde.kcm 1.0)
 
 find_package(KF5Kirigami2 2.1 REQUIRED)
 
+find_package(LibKWorkspace ${PROJECT_VERSION} REQUIRED)
+
 add_subdirectory(core)
 add_subdirectory(app)
 add_subdirectory(categories)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index cb97e63..6db59a5 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -28,6 +28,7 @@ target_link_libraries( systemsettings5 systemsettingsview
     KF5::XmlGui
     KF5::DBusAddons
     KF5::ConfigGui
+    PW::KWorkspace
 )
 
 install( TARGETS systemsettings5 ${INSTALL_TARGETS_DEFAULT_ARGS} )
diff --git a/app/main.cpp b/app/main.cpp
index ae0d65d..3f1cd34 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -25,6 +25,8 @@
 #include <KAboutData>
 #include <KCrash>
 
+#include <kworkspace.h>
+
 #include "SystemSettingsApp.h"
 #include "SettingsBase.h"
 
@@ -33,6 +35,7 @@ int main( int argc, char *argv[] )
     //exec is systemsettings5, but we need the QPT to use the right config from the qApp constructor
     //which is before KAboutData::setApplicationData
     QCoreApplication::setApplicationName("systemsettings");
+    KWorkSpace::detectPlatform(argc, argv);
     SystemSettingsApp application(argc, argv);
     KCrash::initialize();
 
-- 
2.16.2

openSUSE Build Service is sponsored by