/usr/include/kopete/kopetecontactlist.h is in libkopete-dev 4:15.12.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | /*
kopetecontactlist.h - Kopete's Contact List backend
Copyright (c) 2002 by Martijn Klingens <klingens@kde.org>
Copyright (c) 2002-2004 by Olivier Goffart <ogoffart@kde.org>
Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
*************************************************************************
*/
#ifndef KOPETECONTACTLIST_H__
#define KOPETECONTACTLIST_H__
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtGui/QStandardItemModel>
#include <KUrl>
#include "kopete_export.h"
namespace Kopete
{
class MetaContact;
class Group;
class Contact;
/**
* @brief manage contacts and metacontact
*
* The contactList is a singleton you can uses with @ref ContactList::self()
*
* it let you get a list of metacontact with metaContacts()
* Only metacontact which are on the contact list are returned.
*
* @author Martijn Klingens <klingens@kde.org>
* @author Olivier Goffart <ogoffart@tiscalinet.be>
*/
class KOPETE_EXPORT ContactList : public QObject
{
Q_OBJECT
public:
/**
* The contact list is a singleton object. Use this method to retrieve
* the instance.
*/
static ContactList *self();
~ContactList();
/**
* @brief return a list of all metacontact of the contact list
* Retrieve the list of all available meta contacts.
* The returned QPtrList is not the internally used variable, so changes
* to it won't propagate into the actual contact list. This can be
* useful if you need a subset of the contact list, because you can
* simply filter the result set as you wish without worrying about
* side effects.
* The contained MetaContacts are obviously _not_ duplicates, so
* changing those *will* have the expected result :-)
*/
QList<MetaContact *> metaContacts() const;
/**
* @return all groups
*/
QList<Group *> groups() const;
/**
* Return the metacontact referenced by the given id. is none is found, return 0L
* @sa MetaContact::metaContactId()
*/
MetaContact *metaContact( const QString &metaContactId ) const;
/**
* return the group with the given unique id. if none is found return 0L
*/
Group * group(unsigned int groupId) const;
/**
* @brief find a contact in the contact list.
* Browse in each metacontact of the list to find the contact with the given ID.
* @param protocolId the @ref Plugin::pluginId() of the protocol ("MSNProtocol")
* @param accountId the @ref Account::accountId()
* @param contactId the @ref Contact::contactId()
* @return the contact with the parameters, or 0L if not found.
*/
Contact *findContact( const QString &protocolId, const QString &accountId, const QString &contactId ) const;
/**
* Find a contact by display name. Returns the first match.
*/
MetaContact *findMetaContactByDisplayName( const QString &displayName ) const;
/**
* Find a meta contact by its contact id. Returns the first match.
*/
MetaContact *findMetaContactByContactId( const QString &contactId ) const;
/**
* @brief find a group with his displayName
* If a group already exists with the given name and the given type, the existing group will be returned.
* Otherwise, a new group will be created.
* @param displayName is the display name to search
* @param type is the Group::GroupType to search, the default value is group::Normal
* @return always a valid Group
*/
Group * findGroup( const QString &displayName, int type = 0/*Group::Normal*/ );
/**
* return the list of metacontact actually selected in the contact list UI
*/
QList<MetaContact *> selectedMetaContacts() const;
/**
* return the list of groups actualy selected in the contact list UI
*/
QList<Group *> selectedGroups() const ;
/**
* return the metacontact that represent the user itself.
* This metacontact should be the parent of every Kopete::Account::myself() contacts.
*
* This metacontact is not in the contact list.
*/
MetaContact* myself();
public slots:
/**
* Add metacontacts into the contact list
* When calling this method, contacts have to be already placed in the correct group.
* If contacts are not in a group, they will be added to the top-level group.
* It is also better if the MetaContacts could also be completely created, i.e: all contacts already in it
*/
void addMetaContacts( QList<MetaContact *> metaContacts );
/**
* Add the metacontact into the contact list
* When calling this method, the contact has to be already placed in the correct group.
* If the contact is not in a group, it will be added to the top-level group.
* It is also better if the MetaContact could also be completely created, i.e: all contacts already in it
*/
void addMetaContact( Kopete::MetaContact *c );
/**
* Remove a metacontact from the contact list.
* This method delete itself the metacontact.
*/
void removeMetaContact( Kopete::MetaContact *contact );
/**
* Merge one or more metacontacts into another one
*/
void mergeMetaContacts( QList<MetaContact *> src, Kopete::MetaContact *dst );
/**
* Add groups
* each group must be added on the list after his creation.
*/
void addGroups( QList<Group *> groups );
/**
* Add a group
* each group must be added on the list after his creation.
*/
void addGroup(Kopete::Group *);
/**
* Remove a group
* this method delete the group
*/
void removeGroup(Kopete::Group *);
/**
* Set which items are selected in the ContactList GUI.
* This method has to be called by the contact list UI side.
* it stores the selected items, and emits signals
*/
void setSelectedItems(QList<MetaContact *> metaContacts , QList<Group *> groups);
/**
* @internal
* Load the contact list
*/
void load();
bool loaded() const;
void save();
/**
* @internal
* Save and shutdown the contact list
*/
void shutdown();
signals:
/**
* A meta contact was added to the contact list. Interested classes
* ( like the listview widgets ) can connect to this signal to receive
* the newly added contacts.
*/
void metaContactAdded( Kopete::MetaContact *mc );
/**
* A metacontact has just been removed. and will be soon deleted
*/
void metaContactRemoved( Kopete::MetaContact *mc );
/**
* A group has just been added
*/
void groupAdded( Kopete::Group * );
/**
* A group has just been removed
*/
void groupRemoved( Kopete::Group * );
/**
* A group has just been renamed
*/
void groupRenamed(Kopete::Group *, const QString & oldname);
/**
* A contact has been added to a group
*/
void metaContactAddedToGroup( Kopete::MetaContact *mc, Kopete::Group *to );
/**
* A contact has been removed from a group
*/
void metaContactRemovedFromGroup( Kopete::MetaContact *mc, Kopete::Group *from );
/**
* A contact has been moved from one group to another
*/
void metaContactMovedToGroup( Kopete::MetaContact *mc, Kopete::Group *from, Kopete::Group *to );
/**
* This signal is emit when the selection has changed, it is emitted after the following slot
* Warning: Do not delete any contacts in slots connected to this signal. (it is the warning in the QListView::selectionChanged() doc)
*/
void selectionChanged();
/**
* This signal is emitted each time the selection has changed. the bool is set to true if only one meta contact has been selected,
* and set to false if none, or several contacts are selected
* you can connect this signal to KAction::setEnabled if you have an action which is applied to only one contact
*/
void metaContactSelected(bool);
void contactListLoaded();
private slots:
/**
* Called when the contact list changes. Flags the list dirty and schedules a save for a little while later.
*/
void slotSaveLater();
/**
* Called on contact list load or when KABC has changed, to check if we need to update our contact list from there.
*/
void slotKABCChanged();
private:
/**
* Private constructor: we are a singleton
*/
ContactList();
static ContactList *s_self;
class Private;
Private * const d;
};
} //END namespace Kopete
#endif
|