libtaskmanager
manualgroupingstrategy.h
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 #ifndef MANUALGROUPINGSTRATEGY_H 00025 #define MANUALGROUPINGSTRATEGY_H 00026 00027 #include "abstractgroupingstrategy.h" 00028 #include "taskgroup.h" 00029 00030 namespace TaskManager 00031 { 00032 00033 class ManualGroupingStrategy; 00038 class TaskGroupTemplate : public AbstractGroupableItem 00039 { 00040 Q_OBJECT 00041 public: 00042 TaskGroupTemplate(ManualGroupingStrategy *parent, TaskGroup *group); 00043 ~TaskGroupTemplate(); 00044 00045 TaskGroup *group(); 00046 void setGroup(TaskGroup *); 00047 00048 ItemList &members() const; 00049 QIcon icon() const; 00050 QColor color() const; 00051 QString name() const; 00052 00053 bool isGroupItem() const { return true; } 00054 00056 bool hasDirectMember(AbstractItemPtr item) const; 00058 bool hasMember(AbstractItemPtr item) const; 00060 AbstractItemPtr directMember(AbstractItemPtr) const; 00061 00062 TaskGroupTemplate *findParentGroup(AbstractItemPtr item) const; 00063 00064 TaskGroupTemplate *parentGroup() const; 00065 void setParentGroup(TaskGroupTemplate *); 00066 00067 void addMimeData(QMimeData *mimeData) const; 00068 00069 Q_SIGNALS: 00072 void unprotectGroup(TaskGroup *); 00076 void protectGroup(TaskGroup *); 00077 00078 void destroyed(AbstractGroupableItem *); 00079 00080 private Q_SLOTS: 00081 void itemDestroyed(AbstractGroupableItem *); 00082 00083 00084 public Q_SLOTS: 00086 void toDesktop(int) {} 00087 bool isOnCurrentDesktop() const { return false; } 00088 bool isOnAllDesktops() const { return false; } 00089 int desktop() const {return 0; } 00090 00091 void setShaded(bool) {} 00092 void toggleShaded() {} 00093 bool isShaded() const {return false; } 00094 00095 void setMaximized(bool) {} 00096 void toggleMaximized() {} 00097 bool isMaximized() const {return false; } 00098 00099 void setMinimized(bool) {} 00100 void toggleMinimized() {} 00101 bool isMinimized() const { return false; } 00102 00103 void setFullScreen(bool) {} 00104 void toggleFullScreen() {} 00105 bool isFullScreen() const { return false; } 00106 00107 void setKeptBelowOthers(bool) {} 00108 void toggleKeptBelowOthers() {} 00109 bool isKeptBelowOthers() const { return false; } 00110 00111 void setAlwaysOnTop(bool) {} 00112 void toggleAlwaysOnTop() {} 00113 bool isAlwaysOnTop() const { return false; } 00114 00115 bool isActionSupported(NET::Action) const { return false; } 00116 00118 void close() {} 00119 00121 bool isActive() const { return false; } 00123 bool demandsAttention() const { return false; } 00124 00126 void add(AbstractItemPtr); 00127 00129 void remove(AbstractItemPtr); 00130 00132 void clear(); 00133 00135 void closeGroup(); 00136 00137 private: 00138 class Private; 00139 Private * const d; 00140 }; 00141 00142 00143 00144 00145 class GroupManager; 00151 class ManualGroupingStrategy: public AbstractGroupingStrategy 00152 { 00153 Q_OBJECT 00154 public: 00155 ManualGroupingStrategy(GroupManager *groupingStrategy); 00156 ~ManualGroupingStrategy(); 00157 00161 void handleItem(AbstractItemPtr); 00163 //bool addItemToGroup(AbstractGroupableItem*, TaskGroup*); 00165 bool groupItems(ItemList items); 00166 00170 QList<QAction*> strategyActions(QObject *parent, AbstractGroupableItem *item); 00171 00172 EditableGroupProperties editableGroupProperties(); 00173 00174 void desktopChanged(int newDesktop); 00175 00176 private slots: 00177 00180 void leaveGroup(); 00182 void removeGroup(); 00183 00184 00185 void groupChangedDesktop(int newDesk); 00190 void protectGroup(TaskGroup *group); 00193 void unprotectGroup(TaskGroup *group); 00195 void resetCurrentTemplate(); 00196 00197 protected: 00198 void closeGroup(TaskGroup*); 00199 00200 private: 00201 bool manualGrouping(TaskItem* taskItem, TaskGroup* groupItem); 00202 00204 TaskGroupTemplate *createDuplication(TaskGroup *group); 00205 00206 class Private; 00207 Private * const d; 00208 }; 00209 00210 00211 } 00212 00213 00214 00215 #endif