~ubuntu-branches/ubuntu/quantal/psi/quantal

« back to all changes in this revision

Viewing changes to src/tools/contactlist/contactlistitem.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-04-14 18:57:30 UTC
  • mfrom: (2.1.9 hardy)
  • Revision ID: james.westby@ubuntu.com-20080414185730-528re3zp0m2hdlhi
Tags: 0.11-8
* added CONFIG -= link_prl to .pro files and removed dependencies
  which are made unnecessary by this change
* Fix segfault when closing last chat tab with qt4.4
  (This is from upstream svn, rev. 1101) (Closes: Bug#476122)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "contactlist.h"
 
2
#include "contactlistitem.h"
 
3
#include "contactlistgroupitem.h"
 
4
 
 
5
ContactListItem::ContactListItem(ContactListGroupItem* parent) : parent_(NULL), defaultParent_(parent)
 
6
{
 
7
        setParent(parent);
 
8
}
 
9
 
 
10
ContactList* ContactListItem::contactList() const
 
11
{
 
12
        if (parent()) {
 
13
                return parent()->contactList();
 
14
        }
 
15
        else {
 
16
                qWarning("contaclistitem.cpp: Unable to determine contactlist");
 
17
                return NULL;
 
18
        }
 
19
}
 
20
 
 
21
ContactListGroupItem* ContactListItem::parent() const
 
22
{
 
23
        return parent_;
 
24
}
 
25
 
 
26
ContactListGroupItem* ContactListItem::defaultParent() const
 
27
{
 
28
        return defaultParent_;
 
29
}
 
30
 
 
31
void ContactListItem::setParent(ContactListGroupItem* parent)
 
32
{
 
33
        if (parent_ != parent) {
 
34
                if (parent_) {
 
35
                        parent_->removeItem(this);
 
36
                }
 
37
                
 
38
                if (parent) {
 
39
                        parent->addItem(this);
 
40
                }
 
41
                
 
42
                parent_ = parent;
 
43
                contactList()->emitDataChanged();
 
44
        }
 
45
}
 
46
 
 
47
int ContactListItem::index() 
 
48
{
 
49
        return (parent() ? parent()->indexOf(this) : 0);
 
50
}
 
51
 
 
52
 
 
53
bool ContactListItem::isVisible() const
 
54
{
 
55
        return true;
 
56
}
 
57
 
 
58
bool ContactListItem::equals(ContactListItem* other) const
 
59
{
 
60
        return (this == other);
 
61
}
 
62
 
 
63
QString ContactListItem::toolTip() const
 
64
{
 
65
        return QString();
 
66
}
 
67
 
 
68
void ContactListItem::updateParent()
 
69
{
 
70
}
 
71
 
 
72
void ContactListItem::updateParents()
 
73
{
 
74
        updateParent();
 
75
}
 
76
 
 
77
ContactListItem* ContactListItem::findFirstItem(ContactListItem* other)
 
78
{
 
79
        return (equals(other) ? this : NULL);
 
80
}
 
81
 
 
82
int ContactListItem::count() const
 
83
{
 
84
        return 1;
 
85
}
 
86
 
 
87
int ContactListItem::countOnline() const
 
88
{
 
89
        return 0;
 
90
}
 
91
 
 
92
/*QList<ContactListItem*> ContactListItem::visibleItems()
 
93
{
 
94
        QList<ContactListItem*> l;
 
95
        if (isVisible())
 
96
                l += this;
 
97
        return l;
 
98
}
 
99
 
 
100
QList<ContactListItem*> ContactListItem::invisibleItems()
 
101
{
 
102
        QList<ContactListItem*> l;
 
103
        if (!isVisible())
 
104
                l += this;
 
105
        return l;
 
106
}*/
 
107
 
 
108
void ContactListItem::showContextMenu(const QPoint&)
 
109
{
 
110
}