libtaskmanager
desktopsortingstrategy.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "desktopsortingstrategy.h"
00025
00026 #include <QMap>
00027 #include <QString>
00028 #include <QtAlgorithms>
00029 #include <QList>
00030
00031 #include <KDebug>
00032
00033 #include "abstractgroupableitem.h"
00034
00035
00036 namespace TaskManager
00037 {
00038
00039 DesktopSortingStrategy::DesktopSortingStrategy(QObject *parent)
00040 :AbstractSortingStrategy(parent)
00041 {
00042 setType(GroupManager::DesktopSorting);
00043 }
00044
00045 void DesktopSortingStrategy::sortItems(ItemList &items)
00046 {
00047 kDebug();
00048 QMap<QString, AbstractGroupableItem*> map;
00049 foreach (AbstractGroupableItem *item, items) {
00050 if (!item) {
00051 kDebug() << "Null Pointer";
00052 continue;
00053 }
00054 kDebug() << item->name() << item->desktop();
00055 map.insertMulti(QString::number(item->desktop())+item->name(), item);
00056 }
00057
00058 items.clear();
00059 items = map.values();
00060 kDebug();
00061 foreach (AbstractGroupableItem *item, items) {
00062 kDebug() << item->name() << item->desktop();
00063 }
00064 }
00065
00066 void DesktopSortingStrategy::handleItem(AbstractItemPtr item)
00067 {
00068 kDebug();
00069 disconnect(item, 0, this, 0);
00070 connect(item, SIGNAL(changed(::TaskManager::TaskChanges)), this, SLOT(check()));
00071 AbstractSortingStrategy::handleItem(item);
00072 }
00073
00074 }
00075
00076 #include "desktopsortingstrategy.moc"
00077