From 2cf23fa870d6e8b0f1e8af469992d393d9251dd6d1abfb94bd5c5af9b52a70a9 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Tue, 11 Jul 2017 11:45:51 +0000 Subject: [PATCH] - Add upstream patch to fix parsing of certain session desktop files (kde#381982): * 0001-Session-file-parser-Support-sections-and-respect-the.patch - Add patch to avoid showing default.desktop as duplication (kde#381982): * 0002-Support-default.session-symlink.patch - Keep set-default-session-to-plasma5-for-autologin.patch as-is to not break on 42.2 (no default.desktop), plasma5.desktop still makes sense OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kcm_sddm?expand=0&rev=117 --- ...ser-Support-sections-and-respect-the.patch | 79 +++++++++++++++++++ 0002-Support-default.session-symlink.patch | 31 ++++++++ kcm_sddm.changes | 11 +++ kcm_sddm.spec | 10 ++- 4 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 0001-Session-file-parser-Support-sections-and-respect-the.patch create mode 100644 0002-Support-default.session-symlink.patch diff --git a/0001-Session-file-parser-Support-sections-and-respect-the.patch b/0001-Session-file-parser-Support-sections-and-respect-the.patch new file mode 100644 index 0000000..724b112 --- /dev/null +++ b/0001-Session-file-parser-Support-sections-and-respect-the.patch @@ -0,0 +1,79 @@ +From 65dc9de7c45d5ea4affaa6bf9e6601a000c3e321 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Tue, 11 Jul 2017 13:05:37 +0200 +Subject: [PATCH] Session file parser: Support sections and respect the Hidden + property + +Summary: +Some desktop files have multiple sections, but for now we're only +interested in [Desktop Entry]. Without this patch, every entry was seen +as part of the [Desktop Entry] session, resulting in values getting +overwritten. + +Additionally, the Hidden=true property specifies that the desktop file +needs to be treated like it was non-existant. + +Same as https://github.com/sddm/sddm/pull/821 for sddm. + +BUG: 381982 + +Test Plan: +Installed the KCM, now there are no duplicate sessions and the right +Name is shown for icewm-session.desktop. + +Reviewers: #plasma + +Subscribers: plasma-devel + +Tags: #plasma + +Differential Revision: https://phabricator.kde.org/D6626 +--- + src/sessionmodel.cpp | 22 ++++++++++++++++++++-- + 1 file changed, 20 insertions(+), 2 deletions(-) + +diff --git a/src/sessionmodel.cpp b/src/sessionmodel.cpp +index d4aa025..9e52b12 100644 +--- a/src/sessionmodel.cpp ++++ b/src/sessionmodel.cpp +@@ -65,9 +65,22 @@ void SessionModel::loadDir(const QString &path, SessionType type) + if (!inputFile.open(QIODevice::ReadOnly)) + continue; + SessionPtr si { new Session { session, "", "", "" } }; ++ bool isHidden = false; ++ QString current_section; + QTextStream in(&inputFile); + while (!in.atEnd()) { + QString line = in.readLine(); ++ ++ if (line.startsWith(QLatin1String("["))) { ++ // The section name ends before the last ] before the start of a comment ++ int end = line.lastIndexOf(QLatin1Char(']'), line.indexOf(QLatin1Char('#'))); ++ if (end != -1) ++ current_section = line.mid(1, end - 1); ++ } ++ ++ if (current_section != QLatin1String("Desktop Entry")) ++ continue; // We are only interested in the "Desktop Entry" section ++ + if (line.startsWith("Name=")) { + si->name = line.mid(5); + if (type == SessionTypeWayland) { +@@ -79,9 +92,14 @@ void SessionModel::loadDir(const QString &path, SessionType type) + si->exec = line.mid(5); + if (line.startsWith("Comment=")) + si->comment = line.mid(8); ++ if (line.startsWith(QLatin1String("Hidden="))) ++ isHidden = line.mid(7).toLower() == QLatin1String("true"); ++ } ++ if (!isHidden) { ++ // add to sessions list ++ d->sessions.push_back(si); + } +- // add to sessions list +- d->sessions.push_back(si); ++ + // close file + inputFile.close(); + } + diff --git a/0002-Support-default.session-symlink.patch b/0002-Support-default.session-symlink.patch new file mode 100644 index 0000000..c030bb1 --- /dev/null +++ b/0002-Support-default.session-symlink.patch @@ -0,0 +1,31 @@ +From dd3be6bbca6069ba04ae6f7557c0f959fc10d49c Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Tue, 11 Jul 2017 13:13:13 +0200 +Subject: [PATCH 2/2] Support default.session symlink + +Display it under a different name, otherwise it is indistinguishable from +a normal session. +--- + src/sessionmodel.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/sessionmodel.cpp b/src/sessionmodel.cpp +index 036711f..55f394f 100644 +--- a/src/sessionmodel.cpp ++++ b/src/sessionmodel.cpp +@@ -78,6 +78,12 @@ SessionModel::SessionModel(QObject *parent) : QAbstractListModel(parent), d(new + if (line.startsWith(QLatin1String("Hidden="))) + isHidden = line.mid(7).toLower() == QLatin1String("true"); + } ++ ++ if (session == QLatin1String( "default.desktop" )) { ++ si->name = tr("(System Default)"); ++ isHidden = false; ++ } ++ + if (!isHidden) { + // add to sessions list + d->sessions.push_back(si); +-- +2.13.2 + diff --git a/kcm_sddm.changes b/kcm_sddm.changes index d3f677f..be99b82 100644 --- a/kcm_sddm.changes +++ b/kcm_sddm.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Tue Jul 11 11:34:41 UTC 2017 - fabian@ritter-vogt.de + +- Add upstream patch to fix parsing of certain session desktop files (kde#381982): + * 0001-Session-file-parser-Support-sections-and-respect-the.patch +- Add patch to avoid showing default.desktop as duplication (kde#381982): + * 0002-Support-default.session-symlink.patch +- Keep set-default-session-to-plasma5-for-autologin.patch as-is + to not break on 42.2 (no default.desktop), plasma5.desktop still + makes sense + ------------------------------------------------------------------- Tue Jun 27 17:49:52 CEST 2017 - fabian@ritter-vogt.de diff --git a/kcm_sddm.spec b/kcm_sddm.spec index ad6e9f7..50e3da3 100644 --- a/kcm_sddm.spec +++ b/kcm_sddm.spec @@ -26,7 +26,11 @@ Release: 0 Url: https://projects.kde.org/projects/kdereview/sddm-kcm/repository Source: http://download.kde.org/stable/plasma/%{version}/sddm-kcm-%{version}.tar.xz # PATCH-FIX-OPENSUSE set-default-session-to-plasma5-for-autologin.patch boo#951886 wbauer@tmo.at -- set the default autologin session to plasma5.desktop -Patch: set-default-session-to-plasma5-for-autologin.patch +Patch1: set-default-session-to-plasma5-for-autologin.patch +# PATCH-FIX-UPSTREAM +Patch2: 0001-Session-file-parser-Support-sections-and-respect-the.patch +# PATCH-FIX-OPENSUSE +Patch3: 0002-Support-default.session-symlink.patch BuildRequires: extra-cmake-modules >= 1.0.0 BuildRequires: kf5-filesystem BuildRequires: cmake(KF5Archive) @@ -63,7 +67,9 @@ sddm. %lang_package %prep %setup -q -n sddm-kcm-%{version} -%patch -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build %cmake_kf5 -d build