summaryrefslogtreecommitdiffstats
path: root/kcontrol/taskbar/kcmtaskbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kcontrol/taskbar/kcmtaskbar.cpp')
-rw-r--r--kcontrol/taskbar/kcmtaskbar.cpp165
1 files changed, 108 insertions, 57 deletions
diff --git a/kcontrol/taskbar/kcmtaskbar.cpp b/kcontrol/taskbar/kcmtaskbar.cpp
index 941c8b986..0d6de4f0c 100644
--- a/kcontrol/taskbar/kcmtaskbar.cpp
+++ b/kcontrol/taskbar/kcmtaskbar.cpp
@@ -24,6 +24,7 @@
#include <tqfile.h>
#include <tqlabel.h>
#include <tqbuttongroup.h>
+#include <tqtabwidget.h>
#include <dcopclient.h>
@@ -34,7 +35,8 @@
#include <kgenericfactory.h>
#include <twin.h>
#include <kcolorbutton.h>
-#include <kstandarddirs.h>
+#include <tdestandarddirs.h>
+#include <kiconloader.h>
#define protected public
#include "kcmtaskbarui.h"
@@ -190,15 +192,15 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
{
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()));
- connect(m_widget->kcfg_SortByApp, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts()));
+ connect(m_widget->globalConfigReload, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotReloadConfigurationFromGlobals()));
+ connect(m_widget->globalConfigEdit, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotEditGlobalConfiguration()));
+ connect(m_widget->kcfg_UseGlobalSettings, TQ_SIGNAL(clicked()), this, TQ_SLOT(processLockouts()));
+ connect(m_widget->kcfg_SortByApp, TQ_SIGNAL(clicked()), this, TQ_SLOT(processLockouts()));
TQFile configFile(locateLocal("config", m_configFileName));
if (!configFile.exists())
{
- TDEConfig globalConfig(GLOBAL_TASKBAR_CONFIG_FILE_NAME, TRUE, TRUE);
+ TDEConfig globalConfig(GLOBAL_TASKBAR_CONFIG_FILE_NAME, true, true);
TDEConfig localConfig(m_configFileName);
globalConfig.copyTo(m_configFileName, &localConfig);
localConfig.sync();
@@ -218,9 +220,12 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
{
m_widget->appearance->insertItem((*it).name());
}
+ m_widget->appearance->insertItem(i18n("Custom"));
- connect(m_widget->appearance, TQT_SIGNAL(activated(int)),
- this, TQT_SLOT(appearanceChanged(int)));
+ connect(m_widget->appearance, TQ_SIGNAL(activated(int)),
+ this, TQ_SLOT(appearanceChanged(int)));
+ connect(m_widget->kcfg_DisplayIconsNText, TQ_SIGNAL(activated(int)),
+ this, TQ_SLOT(displayIconsNTextChanged(int)));
addConfig(m_settingsObject, m_widget);
setQuickHelp(i18n("<h1>Taskbar</h1> You can configure the taskbar here."
@@ -236,9 +241,9 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
m_widget->kcfg_GroupTasks->insertStringList(i18nGroupModeList());
m_widget->kcfg_ShowTaskStates->insertStringList(i18nShowTaskStatesList());
- connect(m_widget->kcfg_GroupTasks, TQT_SIGNAL(activated(int)),
- this, TQT_SLOT(slotUpdateComboBox()));
- connect(m_widget->kcfg_UseCustomColors, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(slotUpdateCustomColors()));
+ connect(m_widget->kcfg_GroupTasks, TQ_SIGNAL(activated(int)),
+ this, TQ_SLOT(slotUpdateComboBox()));
+ connect(m_widget->kcfg_UseCustomColors, TQ_SIGNAL(stateChanged(int)), this, TQ_SLOT(slotUpdateCustomColors()));
slotUpdateCustomColors();
updateAppearanceCombo();
@@ -247,7 +252,6 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
{
m_widget->kcfg_ShowAllWindows->hide();
m_widget->kcfg_SortByDesktop->hide();
- m_widget->spacer2->changeSize(0, 0);
}
if (!TQApplication::desktop()->isVirtualDesktop() ||
@@ -259,7 +263,8 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
{
m_widget->showAllScreens->show();
}
- connect( m_widget->showAllScreens, TQT_SIGNAL( stateChanged( int )), TQT_SLOT( changed()));
+ connect( m_widget->showAllScreens, TQ_SIGNAL( stateChanged( int )), TQ_SLOT( changed()));
+ connect( m_widget->smallIcons, TQ_SIGNAL(toggled(bool)), TQ_SLOT(changed()) );
TDEAboutData *about = new TDEAboutData(I18N_NOOP("kcmtaskbar"),
I18N_NOOP("TDE Taskbar Control Module"),
@@ -274,7 +279,7 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
load();
processLockouts();
- TQTimer::singleShot(0, this, TQT_SLOT(notChanged()));
+ TQTimer::singleShot(0, this, TQ_SLOT(notChanged()));
}
TaskbarConfig::~TaskbarConfig()
@@ -286,48 +291,49 @@ TaskbarConfig::~TaskbarConfig()
}
void TaskbarConfig::slotEditGlobalConfiguration() {
- TQByteArray data;
- kapp->dcopClient()->send("kicker", "kicker", "reshowTaskBarConfig()", data);
+ TQByteArray data;
+ tdeApp->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->localConfigWarning->hide();
- m_widget->globalConfigReload->hide();
- m_widget->globalConfigEdit->hide();
- m_widget->kcfg_UseGlobalSettings->hide();
- }
- else {
- m_widget->globalConfigWarning->hide();
- m_widget->localConfigWarning->show();
- 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->show();
- }
- 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->hide();
- }
- }
-
- m_widget->kcfg_AllowDragAndDropReArrange->setEnabled(!m_widget->kcfg_SortByApp->isChecked());
+ m_configFileName = GLOBAL_TASKBAR_CONFIG_FILE_NAME;
+ if (m_isGlobalConfig)
+ {
+ m_widget->globalConfigWarning->show();
+ m_widget->localConfigWarning->hide();
+ m_widget->globalConfigReload->hide();
+ m_widget->globalConfigEdit->hide();
+ m_widget->kcfg_UseGlobalSettings->hide();
+ m_widget->localLikeGlobalSpacer->changeSize(0, 0, TQSizePolicy::Fixed, TQSizePolicy::Maximum);
+ }
+ else {
+ m_widget->globalConfigWarning->hide();
+ m_widget->localConfigWarning->show();
+ m_widget->kcfg_UseGlobalSettings->show();
+ if (m_widget->kcfg_UseGlobalSettings->isChecked()) {
+ m_widget->tabs->hide();
+ m_widget->globalConfigReload->hide();
+ m_widget->globalConfigEdit->show();
+ m_widget->localLikeGlobalSpacer->changeSize(0, 0, TQSizePolicy::Fixed, TQSizePolicy::MinimumExpanding);
+ }
+ else {
+ m_widget->tabs->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->hide();
+ m_widget->localLikeGlobalSpacer->changeSize(0, 0, TQSizePolicy::Fixed, TQSizePolicy::Maximum);
+ }
+ }
+
+ m_widget->kcfg_AllowDragAndDropReArrange->setEnabled(!m_widget->kcfg_SortByApp->isChecked());
}
void TaskbarConfig::slotReloadConfigurationFromGlobals()
{
- TDEConfig globalConfig(GLOBAL_TASKBAR_CONFIG_FILE_NAME, TRUE, TRUE);
+ TDEConfig globalConfig(GLOBAL_TASKBAR_CONFIG_FILE_NAME, true, true);
TDEConfig localConfig(m_configFileName);
globalConfig.copyTo(m_configFileName, &localConfig);
localConfig.sync();
@@ -384,23 +390,50 @@ void TaskbarConfig::updateAppearanceCombo()
if (i < m_appearances.count())
{
m_widget->appearance->setCurrentItem(i);
+ m_widget->customAppearance->setEnabled(false);
return;
}
- if (m_widget->appearance->count() == (int)m_appearances.count())
+ m_widget->appearance->setCurrentItem(m_appearances.count());
+ m_widget->customAppearance->setEnabled(true);
+}
+
+void TaskbarConfig::updateCustomAppearance()
+{
+ m_widget->kcfg_DrawButtons ->setChecked(m_settingsObject->drawButtons());
+ m_widget->kcfg_HaloText ->setChecked(m_settingsObject->haloText());
+ m_widget->kcfg_ShowButtonOnHover->setChecked(m_settingsObject->showButtonOnHover());
+}
+
+void TaskbarConfig::updateIconsTextCombo()
+{
+ if (m_widget->kcfg_DisplayIconsNText->currentText() == "Text only")
{
- m_widget->appearance->insertItem(i18n("Custom"));
+ m_widget->useIconsFrame->setEnabled(false);
+ }
+ else
+ {
+ m_widget->useIconsFrame->setEnabled(true);
}
-
- m_widget->appearance->setCurrentItem(m_appearances.count());
}
void TaskbarConfig::appearanceChanged(int selected)
{
- if (selected < (int)m_appearances.count())
+ if (selected < m_appearances.count())
+ {
+ m_widget->customAppearance->setEnabled(false);
+ }
+ else if(selected == m_appearances.count())
{
- unmanagedWidgetChangeState(!m_appearances[selected].matchesSettings());
+ m_widget->customAppearance->setEnabled(true);
+ updateCustomAppearance();
}
+ unmanagedWidgetChangeState(true);
+}
+
+void TaskbarConfig::displayIconsNTextChanged(int selected)
+{
+ m_widget->useIconsFrame->setEnabled(selected != 1); // 1 == Text only
}
void TaskbarConfig::load()
@@ -408,23 +441,40 @@ void TaskbarConfig::load()
TDECModule::load();
slotUpdateComboBox();
updateAppearanceCombo();
+ updateIconsTextCombo();
m_widget->showAllScreens->setChecked(!m_settingsObject->showCurrentScreenOnly());
+
+ int iconSize = m_settingsObject->iconSize();
+ if(tdeApp->iconLoader()->currentSize(TDEIcon::Small) != iconSize)
+ {
+ m_widget->smallIcons->setChecked(false);
+ }
}
void TaskbarConfig::save()
{
+ TDECModule::save();
+
+ if(m_widget->smallIcons->isChecked())
+ {
+ m_settingsObject->setIconSize(tdeApp->iconLoader()->currentSize(TDEIcon::Small));
+ }
+ else
+ {
+ m_settingsObject->setIconSize(tdeApp->iconLoader()->currentSize(TDEIcon::Panel));
+ }
+
m_settingsObject->setShowCurrentScreenOnly(!m_widget->showAllScreens->isChecked());
int selectedAppearance = m_widget->appearance->currentItem();
if (selectedAppearance < (int)m_appearances.count())
{
m_appearances[selectedAppearance].alterSettings();
- m_settingsObject->writeConfig();
}
- TDECModule::save();
+ m_settingsObject->writeConfig();
TQByteArray data;
- kapp->dcopClient()->emitDCOPSignal("kdeTaskBarConfigChanged()", data);
+ tdeApp->dcopClient()->emitDCOPSignal("kdeTaskBarConfigChanged()", data);
}
void TaskbarConfig::defaults()
@@ -432,6 +482,7 @@ void TaskbarConfig::defaults()
TDECModule::defaults();
slotUpdateComboBox();
updateAppearanceCombo();
+ updateIconsTextCombo();
}
void TaskbarConfig::notChanged()