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
Hello community, here is the log from the commit of package kcm_sddm for openSUSE:Factory checked in at 2017-07-17 09:01:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kcm_sddm (Old) and /work/SRC/openSUSE:Factory/.kcm_sddm.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "kcm_sddm" Mon Jul 17 09:01:30 2017 rev:41 rq:509427 version:5.10.3 Changes: -------- --- /work/SRC/openSUSE:Factory/kcm_sddm/kcm_sddm.changes 2017-07-02 13:33:43.928678843 +0200 +++ /work/SRC/openSUSE:Factory/.kcm_sddm.new/kcm_sddm.changes 2017-07-17 09:01:52.534375412 +0200 @@ -1,0 +2,11 @@ +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 + +------------------------------------------------------------------- New: ---- 0001-Session-file-parser-Support-sections-and-respect-the.patch 0002-Support-default.session-symlink.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kcm_sddm.spec ++++++ --- /var/tmp/diff_new_pack.3wQpm4/_old 2017-07-17 09:01:53.130291499 +0200 +++ /var/tmp/diff_new_pack.3wQpm4/_new 2017-07-17 09:01:53.134290936 +0200 @@ -26,7 +26,11 @@ 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 @@ %lang_package %prep %setup -q -n sddm-kcm-%{version} -%patch -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build %cmake_kf5 -d build ++++++ 0001-Session-file-parser-Support-sections-and-respect-the.patch ++++++ 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(); } ++++++ 0002-Support-default.session-symlink.patch ++++++
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