summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-11 22:13:39 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-11 22:13:39 -0500
commitfe303335daa50ee2c5a5745eb2acd2858e6c2616 (patch)
tree7e4d0693b059cbea9dd3a7929a4770d1a7c20706
parent300974c2a5ee6ea3d7b4536a703c6e850abb3d29 (diff)
downloadtdebase-fe303335daa50ee2c5a5745eb2acd2858e6c2616.tar.gz
tdebase-fe303335daa50ee2c5a5745eb2acd2858e6c2616.zip
Alphabetize applications on taskbar when requested in taskbar configuration module
Resort applications on taskbar sorting configuration option change
-rw-r--r--kicker/taskbar/taskbar.cpp34
-rw-r--r--kicker/taskbar/taskbar.h2
2 files changed, 36 insertions, 0 deletions
diff --git a/kicker/taskbar/taskbar.cpp b/kicker/taskbar/taskbar.cpp
index 0838082d1..1e27050f3 100644
--- a/kicker/taskbar/taskbar.cpp
+++ b/kicker/taskbar/taskbar.cpp
@@ -81,6 +81,7 @@ TaskBar::TaskBar( TaskBarSettings* settingsObject, TaskBarSettings* globalSettin
// init
setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) );
+ m_sortByAppPrev = READ_MERGED_TASBKAR_SETTING(sortByApp);
// setup animation frames
for (int i = 1; i < 11; i++)
@@ -293,6 +294,11 @@ void TaskBar::configure()
}
}
+ if (m_sortByAppPrev != READ_MERGED_TASBKAR_SETTING(sortByApp)) {
+ m_sortByAppPrev = READ_MERGED_TASBKAR_SETTING(sortByApp);
+ reSort();
+ }
+
TaskManager::the()->setXCompositeEnabled(READ_MERGED_TASBKAR_SETTING(showThumbnails));
reLayoutEventually();
@@ -390,6 +396,24 @@ void TaskBar::add(Startup::Ptr startup)
connect(container, TQT_SIGNAL(showMe(TaskContainer*)), this, TQT_SLOT(showTaskContainer(TaskContainer*)));
}
+void TaskBar::reSort()
+{
+ TaskContainer::List originalContainers = containers;
+ TaskContainer::Iterator it = originalContainers.begin();
+ for (; it != originalContainers.end(); ++it)
+ {
+ removeChild(*it);
+ }
+ containers.clear();
+ it = originalContainers.begin();
+ for (; it != originalContainers.end(); ++it)
+ {
+ showTaskContainer(*it);
+ }
+ reLayoutEventually();
+ emit containerCountChanged();
+}
+
void TaskBar::showTaskContainer(TaskContainer* container)
{
TaskContainer::List::iterator it = m_hiddenContainers.find(container);
@@ -427,6 +451,16 @@ void TaskBar::showTaskContainer(TaskContainer* container)
}
}
+ // alphabetize containers
+ it = containers.begin();
+ for (; it != containers.end(); ++it)
+ {
+ TaskContainer* c = *it;
+ if (TQString::localeAwareCompare(container->id().lower(), c->id().lower()) < 0) {
+ break;
+ }
+ }
+
if (it != containers.end())
{
containers.insert(it, container);
diff --git a/kicker/taskbar/taskbar.h b/kicker/taskbar/taskbar.h
index b94928d0f..afb59c365 100644
--- a/kicker/taskbar/taskbar.h
+++ b/kicker/taskbar/taskbar.h
@@ -90,6 +90,7 @@ protected slots:
void slotActivatePreviousTask();
void slotSettingsChanged(int);
void reLayout();
+ void reSort();
protected:
void reLayoutEventually();
@@ -130,6 +131,7 @@ private:
TDEGlobalAccel* keys;
KTextShadowEngine* m_textShadowEngine;
bool m_ignoreUpdates;
+ bool m_sortByAppPrev;
TQTimer m_relayoutTimer;
TQImage m_blendGradient;
TaskBarSettings* m_settingsObject;