• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libtaskmanager

desktopsortingstrategy.cpp

Go to the documentation of this file.
00001 /*****************************************************************
00002 
00003 Copyright 2008 Christian Mollekopf <chrigi_1@hotmail.com>
00004 
00005 Permission is hereby granted, free of charge, to any person obtaining a copy
00006 of this software and associated documentation files (the "Software"), to deal
00007 in the Software without restriction, including without limitation the rights
00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00009 copies of the Software, and to permit persons to whom the Software is
00010 furnished to do so, subject to the following conditions:
00011 
00012 The above copyright notice and this permission notice shall be included in
00013 all copies or substantial portions of the Software.
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00018 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00019 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00020 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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); //To avoid duplicate connections
00070     connect(item, SIGNAL(changed(::TaskManager::TaskChanges)), this, SLOT(check()));
00071     AbstractSortingStrategy::handleItem(item);
00072 }
00073 
00074 } //namespace
00075 
00076 #include "desktopsortingstrategy.moc"
00077 

libtaskmanager

Skip menu "libtaskmanager"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal