2 kopetegroup.h - Kopete (Meta)Contact Group
4 Copyright (c) 2002-2005 by Olivier Goffart <ogoffart@kde.org>
5 Copyright (c) 2003 by Martijn Klingens <klingens@kde.org>
7 Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
9 *************************************************************************
11 * This library is free software; you can redistribute it and/or *
12 * modify it under the terms of the GNU Lesser General Public *
13 * License as published by the Free Software Foundation; either *
14 * version 2 of the License, or (at your option) any later version. *
16 *************************************************************************
22 #include <QtCore/QList>
24 #include "kopetecontactlistelement.h"
26 #include "kopete_export.h"
36 * Class which represents the Group.
38 * A Group is a ConstacListElement which means plugin can save data.
40 * some static group are availavle from this class: topLevel and temporary
42 * @author Olivier Goffart <ogoffart@kde.org>
44 class KOPETE_EXPORT Group
: public ContactListElement
46 Q_PROPERTY( QString displayName READ displayName WRITE setDisplayName
)
47 Q_PROPERTY( uint groupId READ groupId
)
48 Q_PROPERTY( bool expanded READ isExpanded WRITE setExpanded
)
53 typedef QList
<Group
*> List
;
55 /** Kinds of groups. */
56 enum GroupType
{ Normal
=0, Temporary
, TopLevel
};
59 * \brief Create an empty group
61 * Note that the constructor will not add the group automatically to the contact list.
62 * Use @ref ContactList::addGroup() to add it
67 * \brief Create a group of the specified type
69 * Overloaded constructor to create a group with a display name of the specified type.
71 explicit Group( const QString
&displayName
, GroupType type
= Normal
);
76 * \brief Return the group's display name
78 * \return the display name of the group
80 QString
displayName() const;
83 * \brief Rename the group
85 void setDisplayName( const QString
&newName
);
88 * \return the group type
90 GroupType
type() const;
93 * \brief Set the group type
95 void setType( GroupType newType
);
98 * \return the unique id for this group
100 uint
groupId() const;
103 * @brief child metacontact
104 * This function is not very efficient - it searches through all the metacontacts in the contact list
105 * \return the members of this group
107 QList
<MetaContact
*> members() const;
110 * \brief Set if the group is expanded.
112 void setExpanded( bool expanded
);
116 * \return true if the group is expanded.
117 * \return false otherwise
119 bool isExpanded() const;
122 * \return a Group pointer to the toplevel group
124 static Group
*topLevel();
127 * \return a Group pointer to the temporary group
129 static Group
*temporary();
134 void setGroupId( uint groupId
);
139 uint
uniqueGroupId() const;
143 void setUniqueGroupId( uint uniqueGroupId
);
147 * Send a message to all contacts in the group
154 * \brief Emitted when the group has been renamed
156 void displayNameChanged( Kopete::Group
*group
, const QString
&oldName
);
160 void sendMessage( Kopete::Message
& );
163 static Group
*s_topLevel
;
164 static Group
*s_temporary
;
170 * @internal used to get reachabe contact to send message to thom.
172 QList
<MetaContact
*> onlineMembers() const;
175 } //END namespace Kopete