Merge branch 'Plasma/5.19'

This commit is contained in:
Ismael Asensio 2020-06-24 21:22:43 +02:00
commit eb6e439335

View file

@ -653,7 +653,6 @@ void RulesModel::populateRuleList()
const QHash<QString, QString> RulesModel::x11PropertyHash() const QHash<QString, QString> RulesModel::x11PropertyHash()
{ {
static const auto propertyToRule = QHash<QString, QString> { static const auto propertyToRule = QHash<QString, QString> {
{ "resourceName", "wmclass" },
{ "caption", "title" }, { "caption", "title" },
{ "role", "windowrole" }, { "role", "windowrole" },
{ "clientMachine", "clientmachine" }, { "clientMachine", "clientmachine" },
@ -692,12 +691,18 @@ void RulesModel::setWindowProperties(const QVariantMap &info, bool forceValue)
} }
m_rules["types"]->setSuggestedValue(1 << window_type, forceValue); m_rules["types"]->setSuggestedValue(1 << window_type, forceValue);
// Store "complete window class" as "resourceName" + " " + "resourceClass" const QString wmsimpleclass = info.value("resourceClass").toString();
// Do not force the value, we want it only as a suggested value for the user to select const QString wmcompleteclass = QStringLiteral("%1 %2").arg(info.value("resourceName").toString(),
const QString wmcompleteclass = QStringLiteral("%1 %2").arg(info.value("resourceName").toString()) info.value("resourceClass").toString());
.arg(info.value("resourceClass").toString()); const bool isComplete = m_rules.value("wmclasscomplete")->value().toBool();
m_rules["wmclass"]->setSuggestedValue(wmsimpleclass);
m_rules["wmclasshelper"]->setSuggestedValue(wmcompleteclass); m_rules["wmclasshelper"]->setSuggestedValue(wmcompleteclass);
if (forceValue) {
m_rules["wmclass"]->setValue(isComplete ? wmcompleteclass : wmsimpleclass);
}
const auto ruleForProperty = x11PropertyHash(); const auto ruleForProperty = x11PropertyHash();
for (QString &property : info.keys()) { for (QString &property : info.keys()) {
if (!ruleForProperty.contains(property)) { if (!ruleForProperty.contains(property)) {