From 137c3446f89fe808518981f974714161f794b364 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 10 Apr 2013 16:55:58 -0500 Subject: Overhaul taskbar configuration system This resolves Bug 1399 --- kcontrol/taskbar/kcmtaskbar.cpp | 58 +++++++++++++++++++++++----- kcontrol/taskbar/kcmtaskbar.h | 3 ++ kcontrol/taskbar/kcmtaskbarui.ui | 82 +++++++++++++++++++++++++--------------- 3 files changed, 104 insertions(+), 39 deletions(-) (limited to 'kcontrol/taskbar') diff --git a/kcontrol/taskbar/kcmtaskbar.cpp b/kcontrol/taskbar/kcmtaskbar.cpp index be897883f..f05e78822 100644 --- a/kcontrol/taskbar/kcmtaskbar.cpp +++ b/kcontrol/taskbar/kcmtaskbar.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -162,15 +163,15 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL if (args.count() > 0) { m_configFileName = args[0]; - m_widget->globalConfigWarning->hide(); - m_widget->globalConfigReload->show(); + m_isGlobalConfig = false; } else { - m_widget->globalConfigReload->hide(); - m_widget->globalConfigWarning->show(); + m_isGlobalConfig = true; } connect(m_widget->globalConfigReload, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotReloadConfigurationFromGlobals())); + connect(m_widget->globalConfigEdit, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotEditGlobalConfiguration())); + connect(m_widget->kcfg_UseGlobalSettings, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts())); TQFile configFile(locateLocal("config", m_configFileName)); if (!configFile.exists()) @@ -248,6 +249,8 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL setAboutData(about); load(); + processLockouts(); + TQTimer::singleShot(0, this, TQT_SLOT(notChanged())); } @@ -259,6 +262,42 @@ TaskbarConfig::~TaskbarConfig() } } +void TaskbarConfig::slotEditGlobalConfiguration() { + TQByteArray data; + kapp->dcopClient()->send("kicker", "kicker", "reshowTaskBarConfig()", data); +} + +void TaskbarConfig::processLockouts() +{ + m_configFileName = GLOBAL_TASKBAR_CONFIG_FILE_NAME; + if (m_isGlobalConfig) + { + m_widget->globalConfigWarning->show(); + m_widget->globalConfigReload->hide(); + m_widget->globalConfigEdit->hide(); + m_widget->kcfg_UseGlobalSettings->hide(); + } + else { + m_widget->globalConfigWarning->hide(); + m_widget->kcfg_UseGlobalSettings->show(); + if (m_widget->kcfg_UseGlobalSettings->isChecked()) { + m_widget->taskbarGroup->hide(); + m_widget->actionsGroup->hide(); + m_widget->globalConfigReload->hide(); + m_widget->globalConfigEdit->hide(); + } + else { + m_widget->taskbarGroup->show(); + m_widget->actionsGroup->show(); + // FIXME + // Disable this feature until a method can be found to force the TDECModule to reload its settings from disk after the global settings have been copied! + //m_widget->globalConfigReload->show(); + m_widget->globalConfigReload->hide(); + m_widget->globalConfigEdit->show(); + } + } +} + void TaskbarConfig::slotReloadConfigurationFromGlobals() { TDEConfig globalConfig(GLOBAL_TASKBAR_CONFIG_FILE_NAME, TRUE, TRUE); @@ -267,16 +306,17 @@ void TaskbarConfig::slotReloadConfigurationFromGlobals() localConfig.sync(); m_settingsObject->readConfig(); load(); + m_widget->kcfg_UseGlobalSettings->setChecked(false); } void TaskbarConfig::slotUpdateCustomColors() { m_widget->kcfg_ActiveTaskTextColor->setEnabled(m_widget->kcfg_UseCustomColors->isChecked()); m_widget->activeTaskTextColorLabel->setEnabled(m_widget->kcfg_UseCustomColors->isChecked()); - + m_widget->kcfg_InactiveTaskTextColor->setEnabled(m_widget->kcfg_UseCustomColors->isChecked()); m_widget->inactiveTaskTextColorLabel->setEnabled(m_widget->kcfg_UseCustomColors->isChecked()); - + m_widget->kcfg_TaskBackgroundColor->setEnabled(m_widget->kcfg_UseCustomColors->isChecked()); m_widget->taskBackgroundColorLabel->setEnabled(m_widget->kcfg_UseCustomColors->isChecked()); } @@ -320,7 +360,7 @@ void TaskbarConfig::updateAppearanceCombo() return; } - if (m_widget->appearance->count() == m_appearances.count()) + if (m_widget->appearance->count() == (int)m_appearances.count()) { m_widget->appearance->insertItem(i18n("Custom")); } @@ -330,7 +370,7 @@ void TaskbarConfig::updateAppearanceCombo() void TaskbarConfig::appearanceChanged(int selected) { - if (selected < m_appearances.count()) + if (selected < (int)m_appearances.count()) { unmanagedWidgetChangeState(!m_appearances[selected].matchesSettings()); } @@ -348,7 +388,7 @@ void TaskbarConfig::save() { m_settingsObject->setShowCurrentScreenOnly(!m_widget->showAllScreens->isChecked()); int selectedAppearance = m_widget->appearance->currentItem(); - if (selectedAppearance < m_appearances.count()) + if (selectedAppearance < (int)m_appearances.count()) { m_appearances[selectedAppearance].alterSettings(); m_settingsObject->writeConfig(); diff --git a/kcontrol/taskbar/kcmtaskbar.h b/kcontrol/taskbar/kcmtaskbar.h index 1f9a1e813..b0fe0c7ea 100644 --- a/kcontrol/taskbar/kcmtaskbar.h +++ b/kcontrol/taskbar/kcmtaskbar.h @@ -72,6 +72,8 @@ protected slots: private slots: void slotReloadConfigurationFromGlobals(); + void slotEditGlobalConfiguration(); + void processLockouts(); private: TaskbarAppearance::List m_appearances; @@ -85,6 +87,7 @@ private: TaskbarConfigUI *m_widget; TQString m_configFileName; TaskBarSettings* m_settingsObject; + bool m_isGlobalConfig; }; #endif diff --git a/kcontrol/taskbar/kcmtaskbarui.ui b/kcontrol/taskbar/kcmtaskbarui.ui index a522ef683..871badd75 100644 --- a/kcontrol/taskbar/kcmtaskbarui.ui +++ b/kcontrol/taskbar/kcmtaskbarui.ui @@ -24,6 +24,57 @@ 0 + + + GroupBox2 + + + Settings + + + + unnamed + + + + globalConfigWarning + + + <b>NOTE: This module is currently editing the global floating taskbar configuration.</b><br>To change the configuration of a specific Kicker taskbar applet, please use the corresponding Configure Taskbar menu option. + + + + + kcfg_UseGlobalSettings + + + Use global floating taskbar configuration + + + true + + + Selecting this option causes the taskbar to use the global taskbar configuration. + + + + + globalConfigReload + + + Overwrite current configuration with the current global floating taskbar configuration + + + + + globalConfigEdit + + + Edt global floating taskbar configuration + + + + taskbarGroup @@ -379,7 +430,7 @@ By default, this option is selected and all windows are shown. - GroupBox1 + actionsGroup Actions @@ -462,35 +513,6 @@ By default, this option is selected and all windows are shown. - - - GroupBox2 - - - Settings - - - - unnamed - - - - globalConfigWarning - - - NOTE: This module is currently editing the global floating taskbar configuration.<br>To change the configuration of a specific Kicker taskbar applet, please use the Configure Taskbar menu option. - - - - - globalConfigReload - - - Use current global floating taskbar configuration - - - - Spacer1 -- cgit v1.2.1