summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-10 16:55:58 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-10 16:55:58 -0500
commit137c3446f89fe808518981f974714161f794b364 (patch)
treec2510cece63d90384375b1daf0b708fb7b23169e
parent4dc80faf840ee48bd4c0b8d5338a5274de013c39 (diff)
downloadtdebase-137c3446f89fe808518981f974714161f794b364.tar.gz
tdebase-137c3446f89fe808518981f974714161f794b364.zip
Overhaul taskbar configuration system
This resolves Bug 1399
-rw-r--r--kcontrol/taskbar/kcmtaskbar.cpp58
-rw-r--r--kcontrol/taskbar/kcmtaskbar.h3
-rw-r--r--kcontrol/taskbar/kcmtaskbarui.ui82
-rw-r--r--kicker/kicker/core/kicker.cpp23
-rw-r--r--kicker/kicker/core/kicker.h11
-rw-r--r--kicker/taskbar/taskbar.cpp58
-rw-r--r--kicker/taskbar/taskbar.h5
-rw-r--r--kicker/taskbar/taskbar.kcfg5
-rw-r--r--kicker/taskbar/taskbarcontainer.cpp15
-rw-r--r--kicker/taskbar/taskbarcontainer.h1
-rw-r--r--kicker/taskbar/taskcontainer.cpp89
-rw-r--r--kicker/taskbar/taskcontainer.h6
12 files changed, 235 insertions, 121 deletions
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 <tqvaluelist.h>
#include <tqfile.h>
#include <tqlabel.h>
+#include <tqbuttongroup.h>
#include <dcopclient.h>
@@ -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 @@
<property name="margin">
<number>0</number>
</property>
+ <widget class="TQGroupBox">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Settings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>globalConfigWarning</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;NOTE: This module is currently editing the global floating taskbar configuration.&lt;/b&gt;&lt;br&gt;To change the configuration of a specific Kicker taskbar applet, please use the corresponding Configure Taskbar menu option.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_UseGlobalSettings</cstring>
+ </property>
+ <property name="text">
+ <string>Use global floating taskbar configuration</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Selecting this option causes the taskbar to use the global taskbar configuration.</string>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>globalConfigReload</cstring>
+ </property>
+ <property name="text">
+ <string>Overwrite current configuration with the current global floating taskbar configuration</string>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>globalConfigEdit</cstring>
+ </property>
+ <property name="text">
+ <string>Edt global floating taskbar configuration</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
<widget class="TQButtonGroup">
<property name="name">
<cstring>taskbarGroup</cstring>
@@ -379,7 +430,7 @@ By default, this option is selected and all windows are shown.</string>
</widget>
<widget class="TQGroupBox">
<property name="name">
- <cstring>GroupBox1</cstring>
+ <cstring>actionsGroup</cstring>
</property>
<property name="title">
<string>Actions</string>
@@ -462,35 +513,6 @@ By default, this option is selected and all windows are shown.</string>
</widget>
</grid>
</widget>
- <widget class="TQGroupBox">
- <property name="name">
- <cstring>GroupBox2</cstring>
- </property>
- <property name="title">
- <string>Settings</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel" rowspan="1" colspan="2">
- <property name="name">
- <cstring>globalConfigWarning</cstring>
- </property>
- <property name="text">
- <string>NOTE: This module is currently editing the global floating taskbar configuration.&lt;br&gt;To change the configuration of a specific Kicker taskbar applet, please use the Configure Taskbar menu option.</string>
- </property>
- </widget>
- <widget class="TQPushButton" rowspan="1" colspan="2">
- <property name="name">
- <cstring>globalConfigReload</cstring>
- </property>
- <property name="text">
- <string>Use current global floating taskbar configuration</string>
- </property>
- </widget>
- </grid>
- </widget>
<spacer>
<property name="name">
<cstring>Spacer1</cstring>
diff --git a/kicker/kicker/core/kicker.cpp b/kicker/kicker/core/kicker.cpp
index 904fcbb20..70ec00a39 100644
--- a/kicker/kicker/core/kicker.cpp
+++ b/kicker/kicker/core/kicker.cpp
@@ -66,7 +66,8 @@ Kicker::Kicker()
keys(0),
m_twinModule(0),
m_configDialog(0),
- m_canAddContainers(true)
+ m_canAddContainers(true),
+ m_reloadingConfigDialog(false)
{
// initialize the configuration object
KickerSettings::instance(instanceName() + "rc");
@@ -367,7 +368,7 @@ void Kicker::showConfig(const TQString& configPath, const TQString& configFile,
m_configDialog->raise();
if (page > -1)
{
- if (configFile == "")
+ if ((configFile == "") && (page != 4))
{
m_configDialog->showPage(0);
}
@@ -382,6 +383,19 @@ void Kicker::showTaskBarConfig()
showConfig(TQString(), TQString(), 4);
}
+void Kicker::hideTaskBarConfig()
+{
+ if (m_configDialog) {
+ m_configDialog->close();
+ }
+}
+
+void Kicker::reshowTaskBarConfig()
+{
+ m_reloadingConfigDialog = true;
+ hideTaskBarConfig();
+}
+
void Kicker::showTaskBarConfig(const TQString& configFile)
{
showConfig(TQString(), configFile, 4);
@@ -396,6 +410,11 @@ void Kicker::configDialogFinished()
{
m_configDialog->delayedDestruct();
m_configDialog = 0;
+ if (m_reloadingConfigDialog) {
+ TQByteArray data;
+ m_reloadingConfigDialog = false;
+ kapp->dcopClient()->send("kicker", "kicker", "showTaskBarConfig()", data);
+ }
}
void Kicker::slotDesktopResized()
diff --git a/kicker/kicker/core/kicker.h b/kicker/kicker/core/kicker.h
index 81fa8123f..6a3e02d36 100644
--- a/kicker/kicker/core/kicker.h
+++ b/kicker/kicker/core/kicker.h
@@ -59,6 +59,8 @@ k_dcop:
void showConfig(const TQString& config, const TQString& configFile = TQString::null, int page = -1);
void showTaskBarConfig();
void showTaskBarConfig(const TQString& configFile);
+ void hideTaskBarConfig();
+ void reshowTaskBarConfig();
void configureMenubar();
// return the region on the desktop, which is not covered by panels
// and therefore allowed to be used by icons placed on the desktop
@@ -123,10 +125,11 @@ private:
static void crashHandler(int signal);
TDEGlobalAccel* keys;
- KWinModule* m_twinModule;
- KCMultiDialog* m_configDialog;
- bool m_canAddContainers;
- TQPoint m_insertionPoint;
+ KWinModule* m_twinModule;
+ KCMultiDialog* m_configDialog;
+ bool m_canAddContainers;
+ TQPoint m_insertionPoint;
+ bool m_reloadingConfigDialog;
};
#endif
diff --git a/kicker/taskbar/taskbar.cpp b/kicker/taskbar/taskbar.cpp
index 5f92b9fa4..0838082d1 100644
--- a/kicker/taskbar/taskbar.cpp
+++ b/kicker/taskbar/taskbar.cpp
@@ -49,8 +49,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "taskbar.h"
#include "taskbar.moc"
+#define READ_MERGED_TASBKAR_SETTING(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->x():m_settingsObject->x())
-TaskBar::TaskBar( TaskBarSettings* settingsObject, TQWidget *parent, const char *name )
+TaskBar::TaskBar( TaskBarSettings* settingsObject, TaskBarSettings* globalSettingsObject, TQWidget *parent, const char *name )
: Panner( parent, name ),
m_showAllWindows(false),
m_cycleWheel(false),
@@ -72,6 +73,11 @@ TaskBar::TaskBar( TaskBarSettings* settingsObject, TQWidget *parent, const char
{
m_settingsObject->readConfig();
}
+ m_globalSettingsObject = globalSettingsObject;
+ if (m_globalSettingsObject)
+ {
+ m_globalSettingsObject->readConfig();
+ }
// init
setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) );
@@ -173,8 +179,8 @@ TQSize TaskBar::sizeHint() const
// get our minimum height based on the minimum button height or the
// height of the font in use, which is largest
TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > m_settingsObject->minimumButtonHeight() ?
- fm.height() : m_settingsObject->minimumButtonHeight();
+ int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
+ fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
return TQSize(BUTTON_MIN_WIDTH, minButtonHeight);
}
@@ -184,8 +190,8 @@ TQSize TaskBar::sizeHint( KPanelExtension::Position p, TQSize maxSize) const
// get our minimum height based on the minimum button height or the
// height of the font in use, which is largest
TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > m_settingsObject->minimumButtonHeight() ?
- fm.height() : m_settingsObject->minimumButtonHeight();
+ int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
+ fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
if ( p == KPanelExtension::Left || p == KPanelExtension::Right )
{
@@ -212,7 +218,7 @@ TQSize TaskBar::sizeHint( KPanelExtension::Position p, TQSize maxSize) const
rows = 1;
}
- int maxWidth = m_settingsObject->maximumButtonWidth();
+ int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth);
if (maxWidth == 0)
{
maxWidth = BUTTON_MAX_WIDTH;
@@ -246,15 +252,15 @@ void TaskBar::configure()
bool wasShowOnlyIconified = m_showOnlyIconified;
int wasShowTaskStates = m_showTaskStates;
- m_showAllWindows = m_settingsObject->showAllWindows();
- m_sortByDesktop = m_showAllWindows && m_settingsObject->sortByDesktop();
- m_showIcon = m_settingsObject->showIcon();
- m_showOnlyIconified = m_settingsObject->showOnlyIconified();
- m_cycleWheel = m_settingsObject->cycleWheel();
- m_showTaskStates = m_settingsObject->showTaskStates();
+ m_showAllWindows = READ_MERGED_TASBKAR_SETTING(showAllWindows);
+ m_sortByDesktop = m_showAllWindows && READ_MERGED_TASBKAR_SETTING(sortByDesktop);
+ m_showIcon = READ_MERGED_TASBKAR_SETTING(showIcon);
+ m_showOnlyIconified = READ_MERGED_TASBKAR_SETTING(showOnlyIconified);
+ m_cycleWheel = READ_MERGED_TASBKAR_SETTING(cycleWheel);
+ m_showTaskStates = READ_MERGED_TASBKAR_SETTING(showTaskStates);
m_currentScreen = -1; // Show all screens or re-get our screen
- m_showOnlyCurrentScreen = (m_settingsObject->showCurrentScreenOnly() &&
+ m_showOnlyCurrentScreen = (READ_MERGED_TASBKAR_SETTING(showCurrentScreenOnly) &&
TQApplication::desktop()->isVirtualDesktop() &&
TQApplication::desktop()->numScreens() > 1);
@@ -287,7 +293,7 @@ void TaskBar::configure()
}
}
- TaskManager::the()->setXCompositeEnabled(m_settingsObject->showThumbnails());
+ TaskManager::the()->setXCompositeEnabled(READ_MERGED_TASBKAR_SETTING(showThumbnails));
reLayoutEventually();
}
@@ -350,7 +356,7 @@ void TaskBar::add(Task::Ptr task)
}
// create new container
- TaskContainer *container = new TaskContainer(task, this, m_settingsObject, viewport());
+ TaskContainer *container = new TaskContainer(task, this, m_settingsObject, m_globalSettingsObject, viewport());
m_hiddenContainers.append(container);
// even though there is a signal to listen to, we have to add this
@@ -379,7 +385,7 @@ void TaskBar::add(Startup::Ptr startup)
}
// create new container
- TaskContainer *container = new TaskContainer(startup, frames, this, m_settingsObject, viewport());
+ TaskContainer *container = new TaskContainer(startup, frames, this, m_settingsObject, m_globalSettingsObject, viewport());
m_hiddenContainers.append(container);
connect(container, TQT_SIGNAL(showMe(TaskContainer*)), this, TQT_SLOT(showTaskContainer(TaskContainer*)));
}
@@ -398,7 +404,7 @@ void TaskBar::showTaskContainer(TaskContainer* container)
}
// try to place the container after one of the same app
- if (m_settingsObject->sortByApp())
+ if (READ_MERGED_TASBKAR_SETTING(sortByApp))
{
TaskContainer::Iterator it = containers.begin();
for (; it != containers.end(); ++it)
@@ -711,8 +717,8 @@ void TaskBar::reLayout()
// minimum button height or the height of the font in use, whichever is
// largest
TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > m_settingsObject->minimumButtonHeight() ?
- fm.height() : m_settingsObject->minimumButtonHeight();
+ int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
+ fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
// horizontal layout
if (orientation() == Qt::Horizontal)
@@ -750,7 +756,7 @@ void TaskBar::reLayout()
if (mbpr > bpr)
{
bwidth = contentsRect().width() / bpr;
- int maxWidth = m_settingsObject->maximumButtonWidth();
+ int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth);
if (maxWidth > 0 && bwidth > maxWidth)
{
bwidth = maxWidth;
@@ -971,8 +977,8 @@ int TaskBar::taskCount() const
int TaskBar::maximumButtonsWithoutShrinking() const
{
TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > m_settingsObject->minimumButtonHeight() ?
- fm.height() : m_settingsObject->minimumButtonHeight();
+ int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
+ fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
int rows = contentsRect().height() / minButtonHeight;
if (rows < 1)
@@ -982,7 +988,7 @@ int TaskBar::maximumButtonsWithoutShrinking() const
if ( orientation() == Qt::Horizontal ) {
// maxWidth of 0 means no max width, drop back to default
- int maxWidth = m_settingsObject->maximumButtonWidth();
+ int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth);
if (maxWidth == 0)
{
maxWidth = BUTTON_MAX_WIDTH;
@@ -1000,8 +1006,8 @@ int TaskBar::maximumButtonsWithoutShrinking() const
bool TaskBar::shouldGroup() const
{
- return m_settingsObject->groupTasks() == m_settingsObject->GroupAlways ||
- (m_settingsObject->groupTasks() == m_settingsObject->GroupWhenFull &&
+ return READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupAlways ||
+ (READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupWhenFull &&
taskCount() > maximumButtonsWithoutShrinking());
}
@@ -1149,7 +1155,7 @@ void TaskBar::activateNextTask(bool forward)
void TaskBar::wheelEvent(TQWheelEvent* e)
{
- if(m_settingsObject->cycleWheel()) {
+ if(READ_MERGED_TASBKAR_SETTING(cycleWheel)) {
if (e->delta() > 0)
{
diff --git a/kicker/taskbar/taskbar.h b/kicker/taskbar/taskbar.h
index 7c9540efe..b94928d0f 100644
--- a/kicker/taskbar/taskbar.h
+++ b/kicker/taskbar/taskbar.h
@@ -44,7 +44,7 @@ class TaskBar : public Panner
Q_OBJECT
public:
- TaskBar( TaskBarSettings* settingsObject, TQWidget *parent = 0, const char *name = 0 );
+ TaskBar( TaskBarSettings* settingsObject, TaskBarSettings* globalSettingsObject, TQWidget *parent = 0, const char *name = 0 );
~TaskBar();
TQSize sizeHint() const;
@@ -62,7 +62,7 @@ public:
bool showAllWindows() const { return m_showAllWindows; }
TQImage* blendGradient(const TQSize& size);
-
+
KTextShadowEngine *textShadowEngine();
public slots:
@@ -133,6 +133,7 @@ private:
TQTimer m_relayoutTimer;
TQImage m_blendGradient;
TaskBarSettings* m_settingsObject;
+ TaskBarSettings* m_globalSettingsObject;
};
#endif
diff --git a/kicker/taskbar/taskbar.kcfg b/kicker/taskbar/taskbar.kcfg
index 7d8d1f5d9..246ee36b7 100644
--- a/kicker/taskbar/taskbar.kcfg
+++ b/kicker/taskbar/taskbar.kcfg
@@ -6,6 +6,11 @@
<kcfgfile arg="true"/>
<group name="General">
+ <entry key="UseGlobalSettings" type="Bool" >
+ <default>true</default>
+ <label>Use the global (floating) taskbar configuration</label>
+ <whatsthis>Turning this option off will cause the taskbar to ignore the global (floating) taskbar configuration, instead using a specific configuration for that particular taskbar.</whatsthis>
+ </entry>
<entry key="ShowAllWindows" type="Bool" >
<default>true</default>
<label>Show windows from all desktops</label>
diff --git a/kicker/taskbar/taskbarcontainer.cpp b/kicker/taskbar/taskbarcontainer.cpp
index aacd22519..5a75f7c15 100644
--- a/kicker/taskbar/taskbarcontainer.cpp
+++ b/kicker/taskbar/taskbarcontainer.cpp
@@ -46,6 +46,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define GLOBAL_TASKBAR_CONFIG_FILE_NAME "ktaskbarrc"
+#define READ_MERGED_TASBKAR_SETTING(x) ((settingsObject->useGlobalSettings())?globalSettingsObject->x():settingsObject->x())
+
TaskBarContainer::TaskBarContainer( bool enableFrame, TQString configFileOverride, TQWidget *parent, const char *name )
: TQFrame(parent, name),
configFile(configFileOverride),
@@ -53,7 +55,8 @@ TaskBarContainer::TaskBarContainer( bool enableFrame, TQString configFileOverrid
showWindowListButton( true ),
windowListButton(0),
windowListMenu(0),
- settingsObject(NULL)
+ settingsObject(NULL),
+ globalSettingsObject(NULL)
{
if (configFile == "")
{
@@ -65,9 +68,11 @@ TaskBarContainer::TaskBarContainer( bool enableFrame, TQString configFileOverrid
TDEConfig globalConfig(GLOBAL_TASKBAR_CONFIG_FILE_NAME, TRUE, TRUE);
TDEConfig localConfig(configFile);
globalConfig.copyTo(configFile, &localConfig);
+ localConfig.writeEntry("UseGlobalSettings", TRUE);
localConfig.sync();
}
settingsObject = new TaskBarSettings(TDESharedConfig::openConfig(configFile));
+ globalSettingsObject = new TaskBarSettings(TDESharedConfig::openConfig(GLOBAL_TASKBAR_CONFIG_FILE_NAME));
setBackgroundOrigin( AncestorOrigin );
@@ -89,7 +94,7 @@ TaskBarContainer::TaskBarContainer( bool enableFrame, TQString configFileOverrid
layout->setMargin( margin );
// scrollable taskbar
- taskBar = new TaskBar(settingsObject, this);
+ taskBar = new TaskBar(settingsObject, globalSettingsObject, this);
layout->addWidget( taskBar );
connect( taskBar, TQT_SIGNAL( containerCountChanged() ), TQT_SIGNAL( containerCountChanged() ) );
@@ -107,12 +112,13 @@ TaskBarContainer::~TaskBarContainer()
{
if (windowListMenu) delete windowListMenu;
if (settingsObject) delete settingsObject;
+ if (globalSettingsObject) delete globalSettingsObject;
}
void TaskBarContainer::configure()
{
- setFont(settingsObject->taskbarFont());
- showWindowListButton = settingsObject->showWindowListBtn();
+ setFont(READ_MERGED_TASBKAR_SETTING(taskbarFont));
+ showWindowListButton = READ_MERGED_TASBKAR_SETTING(showWindowListBtn);
if (!showWindowListButton)
{
@@ -170,6 +176,7 @@ void TaskBarContainer::configChanged()
// to change/fix it if/when it changes) without calling
// configure() twice on taskbar on start up
settingsObject->readConfig();
+ globalSettingsObject->readConfig();
configure();
taskBar->configure();
diff --git a/kicker/taskbar/taskbarcontainer.h b/kicker/taskbar/taskbarcontainer.h
index cac8f1f2d..fb5f26dd1 100644
--- a/kicker/taskbar/taskbarcontainer.h
+++ b/kicker/taskbar/taskbarcontainer.h
@@ -73,6 +73,7 @@ private:
SimpleButton * windowListButton;
KWindowListMenu * windowListMenu;
TaskBarSettings * settingsObject;
+ TaskBarSettings * globalSettingsObject;
};
#endif
diff --git a/kicker/taskbar/taskcontainer.cpp b/kicker/taskbar/taskcontainer.cpp
index 166175f66..d63166bb8 100644
--- a/kicker/taskbar/taskcontainer.cpp
+++ b/kicker/taskbar/taskcontainer.cpp
@@ -61,6 +61,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "taskcontainer.h"
#include "taskcontainer.moc"
+#define READ_MERGED_TASBKAR_SETTING(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->x():m_settingsObject->x())
+#define READ_MERGED_TASBKAR_ACTION(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->action(x):m_settingsObject->action(x))
+
static Bool netwm_atoms_created = False;
static Atom net_wm_pid = 0;
@@ -112,8 +115,7 @@ bool is_process_resumable(pid_t pid) {
}
}
-TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar, TaskBarSettings* settingsObject,
- TQWidget *parent, const char *name)
+TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar, TaskBarSettings* settingsObject, TaskBarSettings* globalSettingsObject, TQWidget *parent, const char *name)
: TQToolButton(parent, name),
animationTimer(0, "TaskContainer::animationTimer"),
dragSwitchTimer(0, "TaskContainer::dragSwitchTimer"),
@@ -130,7 +132,8 @@ TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar, TaskBarSettings* sett
aboutToActivate(false),
m_mouseOver(false),
m_paintEventCompression(false),
- m_settingsObject(settingsObject)
+ m_settingsObject(settingsObject),
+ m_globalSettingsObject(globalSettingsObject)
{
init();
setAcceptDrops(true); // Always enabled to activate task during drag&drop.
@@ -144,8 +147,7 @@ TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar, TaskBarSettings* sett
dragSwitchTimer.start(0, true);
}
-TaskContainer::TaskContainer(Startup::Ptr startup, PixmapList& startupFrames,
- TaskBar* bar, TaskBarSettings* settingsObject, TQWidget *parent, const char *name)
+TaskContainer::TaskContainer(Startup::Ptr startup, PixmapList& startupFrames, TaskBar* bar, TaskBarSettings* settingsObject, TaskBarSettings* globalSettingsObject, TQWidget *parent, const char *name)
: TQToolButton(parent, name),
animationTimer(0, "TaskContainer::animationTimer"),
dragSwitchTimer(0, "TaskContainer::dragSwitchTimer"),
@@ -163,7 +165,8 @@ TaskContainer::TaskContainer(Startup::Ptr startup, PixmapList& startupFrames,
aboutToActivate(false),
m_mouseOver(false),
m_paintEventCompression(false),
- m_settingsObject(settingsObject)
+ m_settingsObject(settingsObject),
+ m_globalSettingsObject(globalSettingsObject)
{
init();
setEnabled(false);
@@ -181,6 +184,10 @@ void TaskContainer::init()
{
m_settingsObject->readConfig();
}
+ if (m_globalSettingsObject)
+ {
+ m_globalSettingsObject->readConfig();
+ }
if (!netwm_atoms_created) create_atoms(TQPaintDevice::x11AppDisplay());
@@ -356,11 +363,11 @@ void TaskContainer::checkAttention(const Task::Ptr t)
void TaskContainer::attentionTimerFired()
{
assert( attentionState != -1 );
- if (attentionState < m_settingsObject->attentionBlinkIterations()*2)
+ if (attentionState < READ_MERGED_TASBKAR_SETTING(attentionBlinkIterations)*2)
{
++attentionState;
}
- else if (m_settingsObject->attentionBlinkIterations() < 1000)
+ else if (READ_MERGED_TASBKAR_SETTING(attentionBlinkIterations) < 1000)
{
attentionTimer.stop();
}
@@ -571,12 +578,12 @@ void TaskContainer::drawButton(TQPainter *p)
TQPixmap *pm((TQPixmap*)p->device());
TQPixmap pixmap; // icon
Task::Ptr task = 0;
- bool iconified = !m_settingsObject->showOnlyIconified();
- bool halo = m_settingsObject->haloText();
- bool alwaysDrawButtons = m_settingsObject->drawButtons();
+ bool iconified = !READ_MERGED_TASBKAR_SETTING(showOnlyIconified);
+ bool halo = READ_MERGED_TASBKAR_SETTING(haloText);
+ bool alwaysDrawButtons = READ_MERGED_TASBKAR_SETTING(drawButtons);
bool drawButton = alwaysDrawButtons ||
(m_mouseOver && !halo && isEnabled() &&
- m_settingsObject->showButtonOnHover());
+ READ_MERGED_TASBKAR_SETTING(showButtonOnHover));
TQFont font(TDEGlobalSettings::taskbarFont());
// draw sunken if we contain the active task
@@ -598,7 +605,7 @@ void TaskContainer::drawButton(TQPainter *p)
if (task->demandsAttention())
{
- demandsAttention = attentionState == m_settingsObject->attentionBlinkIterations() ||
+ demandsAttention = attentionState == READ_MERGED_TASBKAR_SETTING(attentionBlinkIterations) ||
attentionState % 2 == 0;
}
}
@@ -607,12 +614,12 @@ void TaskContainer::drawButton(TQPainter *p)
TQColorGroup colors = palette().active();
- if (m_settingsObject->useCustomColors())
+ if (READ_MERGED_TASBKAR_SETTING(useCustomColors))
{
- colors.setColor( TQColorGroup::Button, m_settingsObject->taskBackgroundColor());
- colors.setColor( TQColorGroup::Background, m_settingsObject->taskBackgroundColor() );
- colors.setColor( TQColorGroup::ButtonText, m_settingsObject->inactiveTaskTextColor() );
- colors.setColor( TQColorGroup::Text, m_settingsObject->inactiveTaskTextColor() );
+ colors.setColor( TQColorGroup::Button, READ_MERGED_TASBKAR_SETTING(taskBackgroundColor));
+ colors.setColor( TQColorGroup::Background, READ_MERGED_TASBKAR_SETTING(taskBackgroundColor) );
+ colors.setColor( TQColorGroup::ButtonText, READ_MERGED_TASBKAR_SETTING(inactiveTaskTextColor) );
+ colors.setColor( TQColorGroup::Text, READ_MERGED_TASBKAR_SETTING(inactiveTaskTextColor) );
}
if (demandsAttention)
@@ -661,7 +668,7 @@ void TaskContainer::drawButton(TQPainter *p)
// draw button background
if (drawButton)
{
- if (m_settingsObject->drawButtons() && KickerSettings::showDeepButtons()) {
+ if (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons()) {
style().tqdrawPrimitive(TQStyle::PE_ButtonBevel, p,
TQRect(1, 1, width()-3, height()-2),
colors, sunken ? TQStyle::Style_On : TQStyle::Style_Raised);
@@ -760,9 +767,9 @@ void TaskContainer::drawButton(TQPainter *p)
}
else // hack for the dotNET style and others
{
- if (m_settingsObject->useCustomColors())
+ if (READ_MERGED_TASBKAR_SETTING(useCustomColors))
{
- textPen = TQPen(m_settingsObject->activeTaskTextColor());
+ textPen = TQPen(READ_MERGED_TASBKAR_SETTING(activeTaskTextColor));
}
else
{
@@ -770,7 +777,7 @@ void TaskContainer::drawButton(TQPainter *p)
}
}
- int availableWidth = width() - (br.x() * 2) - textPos - 2 - (m_settingsObject->drawButtons() && KickerSettings::showDeepButtons())?2:0;
+ int availableWidth = width() - (br.x() * 2) - textPos - 2 - (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())?2:0;
if (m_filteredTasks.count() > 1)
{
availableWidth -= 8;
@@ -846,7 +853,7 @@ void TaskContainer::drawButton(TQPainter *p)
}
// draw popup arrow
- if ((m_filteredTasks.count() > 1) && (!(m_settingsObject->drawButtons() && KickerSettings::showDeepButtons())))
+ if ((m_filteredTasks.count() > 1) && (!(READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())))
{
TQStyle::PrimitiveElement e = TQStyle::PE_ArrowLeft;
@@ -989,14 +996,14 @@ void TaskContainer::mousePressEvent( TQMouseEvent* e )
switch (e->button())
{
case Qt::LeftButton:
- buttonAction = m_settingsObject->action(m_settingsObject->LeftButton);
+ buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->LeftButton);
break;
case Qt::MidButton:
- buttonAction = m_settingsObject->action(m_settingsObject->MiddleButton);
+ buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->MiddleButton);
break;
case Qt::RightButton:
default:
- buttonAction = m_settingsObject->action(m_settingsObject->RightButton);
+ buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->RightButton);
break;
}
@@ -1012,7 +1019,7 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e)
{
m_dragStartPos = TQPoint();
- if (!m_settingsObject->drawButtons())
+ if (!READ_MERGED_TASBKAR_SETTING(drawButtons))
{
setDown(false);
}
@@ -1030,14 +1037,14 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e)
switch (e->button())
{
case Qt::LeftButton:
- buttonAction = m_settingsObject->action(m_settingsObject->LeftButton);
+ buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->LeftButton);
break;
case Qt::MidButton:
- buttonAction = m_settingsObject->action(m_settingsObject->MiddleButton);
+ buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->MiddleButton);
break;
case Qt::RightButton:
default:
- buttonAction = m_settingsObject->action(m_settingsObject->RightButton);
+ buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->RightButton);
break;
}
@@ -1547,7 +1554,7 @@ void TaskContainer::updateFilteredTaskList()
{
Task::Ptr t = *it;
if ((taskBar->showAllWindows() || t->isOnCurrentDesktop()) &&
- (!m_settingsObject->showOnlyIconified() || t->isIconified()))
+ (!READ_MERGED_TASBKAR_SETTING(showOnlyIconified) || t->isIconified()))
{
pid_t pid = 0;
#ifdef Q_WS_X11
@@ -1568,15 +1575,15 @@ void TaskContainer::updateFilteredTaskList()
if (pid < 0) {
m_filteredTasks.append(t);
}
- else if (m_settingsObject->showTaskStates() != m_settingsObject->ShowAll) {
+ else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) != m_settingsObject->ShowAll) {
if (is_process_resumable(pid)) {
- if (m_settingsObject->showTaskStates() == m_settingsObject->ShowAll) {
+ if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowAll) {
m_filteredTasks.append(t);
}
- else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowStopped) {
+ else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowStopped) {
m_filteredTasks.append(t);
}
- else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowRunning) {
+ else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowRunning) {
t->publishIconGeometry( TQRect());
}
else {
@@ -1584,13 +1591,13 @@ void TaskContainer::updateFilteredTaskList()
}
}
else {
- if (m_settingsObject->showTaskStates() == m_settingsObject->ShowAll) {
+ if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowAll) {
m_filteredTasks.append(t);
}
- else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowStopped) {
+ else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowStopped) {
t->publishIconGeometry( TQRect());
}
- else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowRunning) {
+ else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowRunning) {
m_filteredTasks.append(t);
}
else {
@@ -1677,12 +1684,12 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data)
if (m_filteredTasks.count() > 0)
{
- if (m_settingsObject->showThumbnails() &&
+ if (READ_MERGED_TASBKAR_SETTING(showThumbnails) &&
m_filteredTasks.count() == 1)
{
Task::Ptr t = m_filteredTasks.first();
- pixmap = t->thumbnail(m_settingsObject->thumbnailMaxDimension());
+ pixmap = t->thumbnail(READ_MERGED_TASBKAR_SETTING(thumbnailMaxDimension));
}
if (pixmap.isNull() && tasks.count())
@@ -1725,7 +1732,7 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data)
}
}
- if (m_settingsObject->showAllWindows() && KWin::numberOfDesktops() > 1)
+ if (READ_MERGED_TASBKAR_SETTING(showAllWindows) && KWin::numberOfDesktops() > 1)
{
if (desktopMap.isEmpty())
{
diff --git a/kicker/taskbar/taskcontainer.h b/kicker/taskbar/taskcontainer.h
index a176a0787..b7016477e 100644
--- a/kicker/taskbar/taskcontainer.h
+++ b/kicker/taskbar/taskcontainer.h
@@ -45,9 +45,8 @@ public:
typedef TQValueList<TaskContainer*> List;
typedef TQValueList<TaskContainer*>::iterator Iterator;
- TaskContainer(Task::Ptr, TaskBar*, TaskBarSettings* settingsObject, TQWidget *parent = 0, const char *name = 0);
- TaskContainer(Startup::Ptr, PixmapList&, TaskBar*, TaskBarSettings* settingsObject,
- TQWidget *parent = 0, const char *name = 0);
+ TaskContainer(Task::Ptr, TaskBar*, TaskBarSettings* settingsObject, TaskBarSettings* globalSettingsObject, TQWidget *parent = 0, const char *name = 0);
+ TaskContainer(Startup::Ptr, PixmapList&, TaskBar*, TaskBarSettings* settingsObject, TaskBarSettings* globalSettingsObject, TQWidget *parent = 0, const char *name = 0);
virtual ~TaskContainer();
void setArrowType( TQt::ArrowType at );
@@ -151,6 +150,7 @@ private:
enum { ATTENTION_BLINK_TIMEOUT = 4 };
TQPoint m_dragStartPos;
TaskBarSettings* m_settingsObject;
+ TaskBarSettings* m_globalSettingsObject;
};
#endif