Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Workspace
Commits
43ae993d
Commit
43ae993d
authored
May 16, 2022
by
Alexander Lohnau
💬
Browse files
kcms/desktoptheme: Fix reading of metadata in ThemesModel
We can not use KConfig to read the desktop file.
CCBUG: 453830
parent
10aa9bb8
Pipeline
#177196
passed with stage
in 11 minutes and 50 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
kcms/desktoptheme/themesmodel.cpp
View file @
43ae993d
...
...
@@ -16,6 +16,7 @@
#include
<KColorScheme>
#include
<KDesktopFile>
#include
<KPluginMetaData>
#include
<KConfigGroup>
#include
<KSharedConfig>
...
...
@@ -176,15 +177,25 @@ void ThemesModel::load()
int
themeNameSepIndex
=
themeRoot
.
lastIndexOf
(
QLatin1Char
(
'/'
),
-
1
);
const
QString
packageName
=
themeRoot
.
right
(
themeRoot
.
length
()
-
themeNameSepIndex
-
1
);
KDesktopFile
df
(
theme
);
QString
name
;
QString
comment
;
if
(
df
.
noDisplay
())
{
continue
;
}
if
(
theme
.
endsWith
(
QLatin1String
(
".json"
)))
{
KPluginMetaData
data
=
KPluginMetaData
::
fromJsonFile
(
theme
);
name
=
data
.
name
();
comment
=
data
.
description
();
}
else
{
KDesktopFile
df
(
theme
);
QString
name
=
df
.
readName
();
if
(
name
.
isEmpty
())
{
name
=
packageName
;
if
(
df
.
noDisplay
())
{
continue
;
}
name
=
df
.
readName
();
if
(
name
.
isEmpty
())
{
name
=
packageName
;
}
comment
=
df
.
readComment
();
}
const
bool
isLocal
=
QFileInfo
(
theme
).
isWritable
();
bool
hasPluginName
=
std
::
any_of
(
m_data
.
begin
(),
m_data
.
end
(),
[
&
](
const
ThemesModelData
&
item
)
{
...
...
@@ -205,7 +216,7 @@ void ThemesModel::load()
type
=
LightTheme
;
}
}
ThemesModelData
item
{
name
,
packageName
,
df
.
readC
omment
()
,
type
,
isLocal
,
false
};
ThemesModelData
item
{
name
,
packageName
,
c
omment
,
type
,
isLocal
,
false
};
m_data
.
append
(
item
);
}
}
...
...
Alexander Lohnau
💬
@alex
mentioned in commit
ae7adb36
·
May 16, 2022
mentioned in commit
ae7adb36
mentioned in commit ae7adb368f52c0b7bf510e3c9cf12e368940745a
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment