Commit 43001f79 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Colors KCM] Fix roles mixup

There were two role enums that became out of sync, breaking e.g. editing user themes ("override" mode).

Differential Revision: https://phabricator.kde.org/D27072
parent a72f0c65
......@@ -243,7 +243,7 @@ void KCMColors::installSchemeFile(const QString &path)
m_model->load();
const auto results = m_model->match(m_model->index(0, 0), SchemeNameRole, newName);
const auto results = m_model->match(m_model->index(0, 0), ColorsModel::SchemeNameRole, newName);
if (!results.isEmpty()) {
m_model->setSelectedScheme(newName);
}
......@@ -278,8 +278,8 @@ void KCMColors::editScheme(const QString &schemeName, QQuickItem *ctx)
});
QStringList args;
args << idx.data(KCMColors::SchemeNameRole).toString();
if (idx.data(KCMColors::RemovableRole).toBool()) {
args << idx.data(ColorsModel::SchemeNameRole).toString();
if (idx.data(ColorsModel::RemovableRole).toBool()) {
args << QStringLiteral("--overwrite");
}
......
......@@ -55,13 +55,6 @@ public:
KCMColors(QObject *parent, const QVariantList &args);
~KCMColors() override;
enum Roles {
SchemeNameRole = Qt::UserRole + 1,
PaletteRole,
RemovableRole,
PendingDeletionRole
};
enum SchemeFilter {
AllSchemes,
LightSchemes,
......
......@@ -109,13 +109,13 @@ bool FilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &sourc
if (!m_query.isEmpty()) {
if (!idx.data(Qt::DisplayRole).toString().contains(m_query, Qt::CaseInsensitive)
&& !idx.data(KCMColors::SchemeNameRole).toString().contains(m_query, Qt::CaseInsensitive)) {
&& !idx.data(ColorsModel::SchemeNameRole).toString().contains(m_query, Qt::CaseInsensitive)) {
return false;
}
}
if (m_filter != KCMColors::AllSchemes) {
const QPalette palette = idx.data(KCMColors::PaletteRole).value<QPalette>();
const QPalette palette = idx.data(ColorsModel::PaletteRole).value<QPalette>();
const int windowBackgroundGray = qGray(palette.window().color().rgb());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment