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
SDDM KCM
Commits
b616f247
Commit
b616f247
authored
Dec 11, 2020
by
David Redondo
🏎
Browse files
Load all themes
We need to check every possible directory. In my case my active theme was not listed!
parent
48dae08e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/themesmodel.cpp
View file @
b616f247
...
...
@@ -87,23 +87,29 @@ void ThemesModel::populate()
endResetModel
();
}
QString
themesBaseDir
=
KSharedConfig
::
openConfig
(
QStringLiteral
(
SDDM_CONFIG_FILE
),
KConfig
::
SimpleConfig
)
->
group
(
"Theme"
).
readEntry
(
"ThemeDir"
);
if
(
themesBaseDir
.
isEmpty
())
{
themesBaseDir
=
QStandardPaths
::
locate
(
QStandardPaths
::
GenericDataLocation
,
QStringLiteral
(
"sddm/themes"
),
QStandardPaths
::
LocateDirectory
);
}
QDir
dir
(
themesBaseDir
);
if
(
!
dir
.
exists
())
{
return
;
const
QString
themesBaseDir
=
KSharedConfig
::
openConfig
(
QStringLiteral
(
SDDM_CONFIG_FILE
),
KConfig
::
SimpleConfig
)
->
group
(
"Theme"
).
readEntry
(
"ThemeDir"
);
QStringList
themesBaseDirs
;
if
(
!
themesBaseDir
.
isEmpty
())
{
themesBaseDirs
.
append
(
themesBaseDir
);
}
else
{
themesBaseDirs
=
QStandardPaths
::
locateAll
(
QStandardPaths
::
GenericDataLocation
,
QStringLiteral
(
"sddm/themes"
),
QStandardPaths
::
LocateDirectory
);
}
foreach
(
const
QString
&
theme
,
dir
.
entryList
(
QDir
::
AllDirs
|
QDir
::
Readable
))
{
QString
path
=
themesBaseDir
+
QLatin1Char
(
'/'
)
+
theme
;
if
(
QFile
::
exists
(
path
+
QStringLiteral
(
"/metadata.desktop"
)
))
{
add
(
theme
,
path
);
auto
alreadyHave
=
[
this
]
(
const
QString
&
theme
)
{
return
std
::
any_of
(
mThemeList
.
cbegin
(),
mThemeList
.
cend
(),
[
&
theme
]
(
const
ThemeMetadata
&
data
)
{
return
data
.
themeid
()
==
theme
;
});
};
for
(
const
auto
&
folder
:
themesBaseDirs
)
{
QDir
dir
(
folder
);
if
(
!
dir
.
exists
())
{
return
;
}
for
(
const
QString
&
theme
:
dir
.
entryList
(
QDir
::
AllDirs
|
QDir
::
Readable
|
QDir
::
NoDotAndDotDot
))
{
QString
path
=
folder
+
QLatin1Char
(
'/'
)
+
theme
;
if
(
!
alreadyHave
(
theme
)
&&
QFile
::
exists
(
path
+
QStringLiteral
(
"/metadata.desktop"
)))
{
add
(
theme
,
path
);
}
}
}
}
...
...
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