summaryrefslogtreecommitdiffstats
path: root/kicker/taskbar/taskbar.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-04-11 22:13:39 -0500
committerTimothy Pearson <[email protected]>2013-04-11 22:13:39 -0500
commitfe303335daa50ee2c5a5745eb2acd2858e6c2616 (patch)
tree7e4d0693b059cbea9dd3a7929a4770d1a7c20706 /kicker/taskbar/taskbar.cpp
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
Diffstat (limited to 'kicker/taskbar/taskbar.cpp')
-rw-r--r--kicker/taskbar/taskbar.cpp34
1 files changed, 34 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);