From kde-commits Wed Mar 02 22:13:22 2005 From: Stefan Nikolaus Date: Wed, 02 Mar 2005 22:13:22 +0000 To: kde-commits Subject: kdebase/kicker Message-Id: <20050302221322.43B8016EF1 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=110980160904489 CVS commit by nikolaus: sort taskbar buttons alphabetically M +0 -5 TODO 1.48 M +17 -1 taskbar/taskbar.cpp 1.77 M +6 -2 taskbar/taskbar.h 1.40 M +5 -0 taskbar/taskbar.kcfg 1.4 M +4 -0 taskmanager/taskmanager.cpp 1.91 M +5 -0 taskmanager/taskmanager.h 1.59 --- kdebase/kicker/taskbar/taskbar.cpp #1.76:1.77 @@ -45,4 +45,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE #include "taskbar.moc" + +int TaskContainerList::compareItems(QPtrCollection::Item item1, + QPtrCollection::Item item2) +{ + TaskContainer* con1 = static_cast(item1); + TaskContainer* con2 = static_cast(item2); + return QString::localeAwareCompare(con1->name(), con2->name()); +} + + TaskBar::TaskBar( QWidget *parent, const char *name ) : Panner( parent, name ), @@ -82,4 +92,5 @@ TaskBar::TaskBar( QWidget *parent, const connect(TaskManager::the(), SIGNAL(desktopChanged(int)), SLOT(desktopChanged(int))); connect(TaskManager::the(), SIGNAL(windowChanged(WId)), SLOT(windowChanged(WId))); + connect(TaskManager::the(), SIGNAL(taskNameChanged()), SLOT(reLayout())); isGrouping = shouldGroup(); @@ -493,4 +504,9 @@ void TaskBar::reLayout() } + if (TaskBarSettings::sortByName()) + { + list.sort(); + } + // sort container list by desktop if ( m_sortByDesktop ) --- kdebase/kicker/taskbar/taskbar.h #1.39:1.40 @@ -45,6 +45,10 @@ typedef QPtrList TaskList; typedef QPtrList StartupList; typedef QPtrList PixmapList; -typedef QPtrList TaskContainerList; typedef QPtrListIterator TaskContainerIterator; +class TaskContainerList : public QPtrList +{ +public: + int compareItems(QPtrCollection::Item, QPtrCollection::Item); +}; class TaskBar : public Panner @@ -92,4 +96,5 @@ protected slots: void slotActivatePreviousTask(); void slotSettingsChanged(int); + void reLayout(); protected: @@ -101,5 +106,4 @@ protected: void propagateMouseEvent( QMouseEvent* ); void resizeEvent( QResizeEvent* ); - void reLayout(); bool idMatch( const QString& id1, const QString& id2 ); TaskContainerList filteredContainers(); --- kdebase/kicker/taskbar/taskbar.kcfg #1.3:1.4 @@ -38,4 +38,9 @@ Selecting this option causes the taskbar to show windows in order of the desktop they appear on.\n\nBy default this option is selected. + + true + + Selecting this option causes the taskbar to show windows alphabetically ordered.\n\nBy default this option is selected. + true --- kdebase/kicker/taskmanager/taskmanager.cpp #1.90:1.91 @@ -258,4 +258,8 @@ void TaskManager::windowChanged(WId w, u t->refreshIcon(); } + else if (dirty == NET::WMName) + { + emit taskNameChanged(); + } } --- kdebase/kicker/taskmanager/taskmanager.h #1.58:1.59 @@ -562,4 +562,9 @@ signals: void windowChangedGeometry(WId); + /** + * Emitted when a task changes name. + */ + void taskNameChanged(); + protected slots: //* @internal --- kdebase/kicker/TODO #1.47:1.48 @@ -117,9 +117,4 @@ do some semi-intelligent packing of the icons. -+++ Make the taskbar buttons sorted alphabeticall by default -** Taskbar buttons should be ordered alphabetically (in addition to by - desktop if that option is selected). It should also be decently - performant in doing so. - ++ Dialog for adding elements to the panel *** Context menus are primarily used by advanced users, and yet this is