Accepting request 509427 from KDE:Frameworks5
- 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/request/show/509427 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kcm_sddm?expand=0&rev=41
This commit is contained in:
commit
9e8b0cdb88
@ -0,0 +1,79 @@
|
|||||||
|
From 65dc9de7c45d5ea4affaa6bf9e6601a000c3e321 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
31
0002-Support-default.session-symlink.patch
Normal file
31
0002-Support-default.session-symlink.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From dd3be6bbca6069ba04ae6f7557c0f959fc10d49c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||||||
|
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
|
||||||
|
|
@ -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
|
Tue Jun 27 17:49:52 CEST 2017 - fabian@ritter-vogt.de
|
||||||
|
|
||||||
|
@ -26,7 +26,11 @@ Release: 0
|
|||||||
Url: https://projects.kde.org/projects/kdereview/sddm-kcm/repository
|
Url: https://projects.kde.org/projects/kdereview/sddm-kcm/repository
|
||||||
Source: http://download.kde.org/stable/plasma/%{version}/sddm-kcm-%{version}.tar.xz
|
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-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: extra-cmake-modules >= 1.0.0
|
||||||
BuildRequires: kf5-filesystem
|
BuildRequires: kf5-filesystem
|
||||||
BuildRequires: cmake(KF5Archive)
|
BuildRequires: cmake(KF5Archive)
|
||||||
@ -63,7 +67,9 @@ sddm.
|
|||||||
%lang_package
|
%lang_package
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n sddm-kcm-%{version}
|
%setup -q -n sddm-kcm-%{version}
|
||||||
%patch -p1
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%cmake_kf5 -d build
|
%cmake_kf5 -d build
|
||||||
|
Loading…
Reference in New Issue
Block a user