Commit 3284e196 authored by Cyril Rossi's avatar Cyril Rossi

KCM KWinTabbox disable widget if property is immutable.

Summary:
Some widget cannot be managed by KCModule, so we have to disable the widget if the property is immutable.
Remove unused parameter in `createConnections()`

Test Plan: Add [$i] right after the key or group in kwinrc, the widget should be disabled.

Reviewers: #kwin, ervin, bport, meven, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28484
parent 59642a4b
......@@ -281,12 +281,66 @@ void KWinTabBoxConfigForm::resetShortcuts()
m_actionCollection->writeSettings();
}
void KWinTabBoxConfigForm::setHighlightWindowsEnabled(bool enabled)
{
m_isHighlightWindowsEnabled = enabled;
ui->kcfg_HighlightWindows->setEnabled(m_isHighlightWindowsEnabled);
}
void KWinTabBoxConfigForm::setFilterScreenEnabled(bool enabled)
{
ui->filterScreens->setEnabled(enabled);
ui->currentScreen->setEnabled(enabled);
ui->otherScreens->setEnabled(enabled);
}
void KWinTabBoxConfigForm::setFilterDesktopEnabled(bool enabled)
{
ui->filterDesktops->setEnabled(enabled);
ui->currentDesktop->setEnabled(enabled);
ui->otherDesktops->setEnabled(enabled);
}
void KWinTabBoxConfigForm::setFilterActivitiesEnabled(bool enabled)
{
ui->filterActivities->setEnabled(enabled);
ui->currentActivity->setEnabled(enabled);
ui->otherActivities->setEnabled(enabled);
}
void KWinTabBoxConfigForm::setFilterMinimizationEnabled(bool enabled)
{
ui->filterMinimization->setEnabled(enabled);
ui->visibleWindows->setEnabled(enabled);
ui->hiddenWindows->setEnabled(enabled);
}
void KWinTabBoxConfigForm::setApplicationModeEnabled(bool enabled)
{
ui->oneAppWindow->setEnabled(enabled);
}
void KWinTabBoxConfigForm::setShowDesktopModeEnabled(bool enabled)
{
ui->showDesktop->setEnabled(enabled);
}
void KWinTabBoxConfigForm::setSwitchingModeEnabled(bool enabled)
{
ui->switchingModeCombo->setEnabled(enabled);
}
void KWinTabBoxConfigForm::setLayoutNameEnabled(bool enabled)
{
ui->effectCombo->setEnabled(enabled);
}
void KWinTabBoxConfigForm::tabBoxToggled(bool on)
{
// Highlight Windows options is availabled if no TabBox effect is selected
// or if Tabbox is not builtin effet.
on = !on || ui->effectCombo->currentData(AddonEffect).toBool();
ui->kcfg_HighlightWindows->setEnabled(on);
ui->kcfg_HighlightWindows->setEnabled(on && m_isHighlightWindowsEnabled);
}
void KWinTabBoxConfigForm::onFilterScreen()
......@@ -331,7 +385,7 @@ void KWinTabBoxConfigForm::onEffectCombo()
if (!ui->kcfg_ShowTabBox->isChecked()) {
return;
}
ui->kcfg_HighlightWindows->setEnabled(isAddonEffect);
ui->kcfg_HighlightWindows->setEnabled(isAddonEffect && m_isHighlightWindowsEnabled);
emit layoutNameChanged(layoutName());
}
......
......@@ -86,6 +86,16 @@ public:
void loadShortcuts();
void resetShortcuts();
void setHighlightWindowsEnabled(bool enabled);
void setFilterScreenEnabled(bool enabled);
void setFilterDesktopEnabled(bool enabled);
void setFilterActivitiesEnabled(bool enabled);
void setFilterMinimizationEnabled(bool enabled);
void setApplicationModeEnabled(bool enabled);
void setShowDesktopModeEnabled(bool enabled);
void setSwitchingModeEnabled(bool enabled);
void setLayoutNameEnabled(bool enabled);
Q_SIGNALS:
void filterScreenChanged(int value);
void filterDesktopChanged(int value);
......@@ -113,6 +123,7 @@ private:
KActionCollection *m_actionCollection = nullptr;
KShortcutsEditor *m_editor = nullptr;
bool m_isHighlightWindowsEnabled = true;
TabboxType m_type;
Ui::KWinTabBoxConfigForm *ui;
};
......
......@@ -98,8 +98,8 @@ KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args)
addConfig(m_tabBoxConfig, m_primaryTabBoxUi);
addConfig(m_tabBoxAlternativeConfig, m_alternativeTabBoxUi);
createConnections(m_primaryTabBoxUi, m_tabBoxConfig);
createConnections(m_alternativeTabBoxUi, m_tabBoxAlternativeConfig);
createConnections(m_primaryTabBoxUi);
createConnections(m_alternativeTabBoxUi);
initLayoutLists();
......@@ -112,6 +112,9 @@ KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args)
} else {
infoLabel->hide();
}
setEnabledUi(m_primaryTabBoxUi, m_tabBoxConfig);
setEnabledUi(m_alternativeTabBoxUi, m_tabBoxAlternativeConfig);
}
KWinTabBoxConfig::~KWinTabBoxConfig()
......@@ -213,7 +216,20 @@ void KWinTabBoxConfig::initLayoutLists()
}
}
void KWinTabBoxConfig::createConnections(KWinTabBoxConfigForm *form, TabBoxSettings *config)
void KWinTabBoxConfig::setEnabledUi(KWinTabBoxConfigForm *form, const TabBoxSettings *config)
{
form->setHighlightWindowsEnabled(!config->isHighlightWindowsImmutable());
form->setFilterScreenEnabled(!config->isMultiScreenModeImmutable());
form->setFilterDesktopEnabled(!config->isDesktopModeImmutable());
form->setFilterActivitiesEnabled(!config->isActivitiesModeImmutable());
form->setFilterMinimizationEnabled(!config->isMinimizedModeImmutable());
form->setApplicationModeEnabled(!config->isApplicationsModeImmutable());
form->setShowDesktopModeEnabled(!config->isShowDesktopModeImmutable());
form->setSwitchingModeEnabled(!config->isSwitchingModeImmutable());
form->setLayoutNameEnabled(!config->isLayoutNameImmutable());
}
void KWinTabBoxConfig::createConnections(KWinTabBoxConfigForm *form)
{
connect(form, SIGNAL(effectConfigButtonClicked()), this, SLOT(configureEffectClicked()));
......
......@@ -61,7 +61,8 @@ private:
void updateConfigFromUi(const KWinTabBoxConfigForm *form, TabBox::TabBoxSettings *config);
void updateUiFromDefaultConfig(KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config);
void initLayoutLists();
void createConnections(KWinTabBoxConfigForm *form, TabBox::TabBoxSettings *config);
void setEnabledUi(KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config);
void createConnections(KWinTabBoxConfigForm *form);
bool updateUnmanagedIsNeedSave(const KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config);
bool updateUnmanagedIsDefault(const KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config);
......
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