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 Desktop
Commits
eef1a5e4
Commit
eef1a5e4
authored
May 22, 2022
by
Alexander Lohnau
💬
Browse files
kcms/ksplash: Fix 'None' entry not appearing last in the grid view
BUG: 451422
FIXED-IN: 5.25 (cherry picked from commit
c314fcf2
)
parent
ee30e074
Pipeline
#179738
passed with stage
in 3 minutes and 43 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
kcms/ksplash/kcm.cpp
View file @
eef1a5e4
...
...
@@ -27,6 +27,24 @@
K_PLUGIN_FACTORY_WITH_JSON
(
KCMSplashScreenFactory
,
"kcm_splashscreen.json"
,
registerPlugin
<
KCMSplashScreen
>
();
registerPlugin
<
SplashScreenData
>
();)
const
QLatin1String
s_nonePluginName
(
"None"
);
class
SplashScreenSortModel
:
public
QSortFilterProxyModel
{
using
QSortFilterProxyModel
::
QSortFilterProxyModel
;
virtual
bool
lessThan
(
const
QModelIndex
&
source_left
,
const
QModelIndex
&
source_right
)
const
{
// The "None" entry should be the last item of the model, BUG: 451422
if
(
source_left
.
data
(
KCMSplashScreen
::
PluginNameRole
).
toString
()
==
s_nonePluginName
)
{
return
false
;
}
if
(
source_right
.
data
(
KCMSplashScreen
::
PluginNameRole
).
toString
()
==
s_nonePluginName
)
{
return
true
;
}
return
QSortFilterProxyModel
::
lessThan
(
source_left
,
source_right
);
}
};
KCMSplashScreen
::
KCMSplashScreen
(
QObject
*
parent
,
const
QVariantList
&
args
)
:
KQuickAddons
::
ManagedConfigModule
(
parent
,
args
)
,
m_data
(
new
SplashScreenData
(
this
))
...
...
@@ -48,7 +66,7 @@ KCMSplashScreen::KCMSplashScreen(QObject *parent, const QVariantList &args)
roles
[
PendingDeletionRole
]
=
"pendingDeletion"
;
m_model
->
setItemRoleNames
(
roles
);
m_sortModel
=
new
QSortFilterProxy
Model
(
this
);
m_sortModel
=
new
SplashScreenSort
Model
(
this
);
m_sortModel
->
setSourceModel
(
m_model
);
m_sortModel
->
setSortLocaleAware
(
true
);
m_sortModel
->
setSortRole
(
Qt
::
DisplayRole
);
...
...
@@ -144,7 +162,7 @@ void KCMSplashScreen::load()
m_sortModel
->
sort
(
Qt
::
DisplayRole
);
QStandardItem
*
row
=
new
QStandardItem
(
i18n
(
"None"
));
row
->
setData
(
"None"
,
PluginNameRole
);
row
->
setData
(
s_nonePluginName
,
PluginNameRole
);
row
->
setData
(
i18n
(
"No splash screen will be shown"
),
DescriptionRole
);
row
->
setData
(
false
,
UninstallableRole
);
m_model
->
insertRow
(
0
,
row
);
...
...
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