not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / libs / taskmanager / abstractgroupableitem.cpp
blobc820784e3ffda046a3201d2a14db83783bfa9012
1 /*****************************************************************
3 Copyright 2008 Christian Mollekopf <chrigi_1@hotmail.com>
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 ******************************************************************/
24 // Ownm_preferredInsertIndex
25 #include "abstractgroupableitem.h"
26 #include "taskgroup.h"
27 #include "taskmanager.h"
30 // KDE
31 #include <KDebug>
35 namespace TaskManager
39 class AbstractGroupableItem::Private
41 public:
42 Private()
43 :m_parentGroup(0)
47 GroupPtr m_parentGroup;
51 AbstractGroupableItem::AbstractGroupableItem(QObject *parent)
52 : QObject(parent),
53 d(new Private)
59 AbstractGroupableItem::~AbstractGroupableItem()
61 //kDebug();
62 emit destroyed(this);
63 /*if (parentGroup()) {
64 kDebug() << "Error: item gets destroyed but still has a parent group";
65 }*/
66 delete d;
70 bool AbstractGroupableItem::isGrouped() const
72 return parentGroup() && parentGroup()->parentGroup();
75 QIcon AbstractGroupableItem::icon() const
77 return QIcon();
80 QString AbstractGroupableItem::name() const
82 return QString();
85 GroupPtr AbstractGroupableItem::parentGroup() const
87 //kDebug();
88 return d->m_parentGroup;
92 void AbstractGroupableItem::setParentGroup(const GroupPtr group)
94 d->m_parentGroup = group;
98 //Item is member of group
99 bool AbstractGroupableItem::isGroupMember(const GroupPtr group) const
101 //kDebug();
102 if (!group) {
103 //kDebug() << "Null Group Pointer";
104 return false;
107 if (!parentGroup()) {
108 return false;
111 return group->members().contains(const_cast<AbstractGroupableItem*>(this));
115 } // TaskManager namespace
117 #include "abstractgroupableitem.moc"