diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index 8d8b8f8f32..ca0ea3b2d0 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -298,6 +298,7 @@ int RulesWidget::comboToDesktop(int val) const return NET::OnAllDesktops; return val + 1; } + #ifdef KWIN_BUILD_ACTIVITIES int RulesWidget::activityToCombo(QString d) const { @@ -335,8 +336,19 @@ void RulesWidget::updateActivitiesList() activity->addItem(info.name(), activityId); } } + + auto rules = this->rules(); + if (rules->activityrule == Rules::UnusedSetRule) { + enable_activity->setChecked(false); + Ui::RulesWidgetBase::activity->setCurrentIndex(0); + } else { + enable_activity->setChecked(true); + Ui::RulesWidgetBase::activity->setCurrentIndex(activityToCombo(m_selectedActivityId)); + } + updateEnableactivity(); } #endif + static int placementToCombo(Placement::Policy placement) { static const int conv[] = { @@ -472,6 +484,7 @@ void RulesWidget::setRules(Rules* rules) COMBOBOX_SET_RULE(desktop, desktopToCombo); SPINBOX_SET_RULE(screen, inc); #ifdef KWIN_BUILD_ACTIVITIES + m_selectedActivityId = rules->activity; COMBOBOX_SET_RULE(activity, activityToCombo); #endif CHECKBOX_SET_RULE(maximizehoriz,); diff --git a/kcmkwin/kwinrules/ruleswidget.h b/kcmkwin/kwinrules/ruleswidget.h index a95428eb4f..7a4e3f27f7 100644 --- a/kcmkwin/kwinrules/ruleswidget.h +++ b/kcmkwin/kwinrules/ruleswidget.h @@ -111,6 +111,7 @@ private: QString comboToActivity(int val) const; void updateActivitiesList(); KActivities::Consumer *m_activities; + QString m_selectedActivityId; // we need this for async activity loading #endif int comboToTiling(int val) const; int inc(int i) const { return i+1; }