9#include <KLocalizedString>
17 {Qt::DisplayRole, QByteArrayLiteral(
"display")},
18 {Qt::DecorationRole, QByteArrayLiteral(
"decoration")},
19 {Qt::ToolTipRole, QByteArrayLiteral(
"tooltip")},
29 if (parent.isValid()) {
37 if (!checkIndex(index, CheckIndexOption::IndexIsValid | CheckIndexOption::ParentIsInvalid)) {
48 case Qt::DecorationRole:
51 return item.
icon.name();
69 for (
int index = 0; index <
m_data.count(); index++) {
80 if (index < 0 || index >=
m_data.count()) {
83 return m_data.at(index).text;
99 if (this->
value() == value) {
103 if (index >= 0 && index !=
m_index) {
128 return item.
value.toUInt();
140 for (
const Data &item : std::as_const(
m_data)) {
151 for (
int index = 0; index <
m_data.count(); index++) {
186 return QStringLiteral(
"%1match").arg(key);
189 return QStringLiteral(
"%1rule").arg(key);
197 static const auto stringMatchOptions = QList<RulePolicy::Data>{
203 static const auto setRuleOptions = QList<RulePolicy::Data>{
205 i18n(
"Apply Initially"),
206 i18n(
"The window property will be only set to the given value after the window is created."
207 "\nNo further changes will be affected.")},
210 i18n(
"The window property will be set to the given value immediately and will not be affected later"
211 "\n(this action will be deleted afterwards).")},
214 i18n(
"The value of the window property will be remembered and, every time the window"
215 " is created, the last remembered value will be applied.")},
217 i18n(
"Do Not Affect"),
218 i18n(
"The window property will not be affected and therefore the default handling for it will be used."
219 "\nSpecifying this will block more generic window settings from taking effect.")},
222 i18n(
"The window property will be always forced to the given value.")},
224 i18n(
"Force Temporarily"),
225 i18n(
"The window property will be forced to the given value until it is hidden"
226 "\n(this action will be deleted after the window is hidden).")}};
228 static auto forceRuleOptions = QList<RulePolicy::Data>{
229 setRuleOptions.at(4),
230 setRuleOptions.at(5),
231 setRuleOptions.at(3),
238 return stringMatchOptions;
240 return setRuleOptions;
242 return forceRuleOptions;
249#include "moc_optionsmodel.cpp"
void selectedIndexChanged(int index)
QHash< int, QByteArray > roleNames() const override
uint bitMask(int index) const
void setValue(QVariant value)
Q_INVOKABLE int indexOf(const QVariant &value) const
QVariant allValues() const
Q_INVOKABLE QString textOfValue(const QVariant &value) const
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void updateModelData(const QList< Data > &data)
QString policyKey(const QString &key) const