• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/libkopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • libkopete
  • contactlist
kopetecontactliststorage.cpp
Go to the documentation of this file.
1 /*
2  Kopete Contact List Storage Base Class
3 
4  Copyright 2006 by Matt Rogers <mattr@kde.org>
5  Kopete 2002-2006 by the Kopete developers <kopete-devel@kde.org>
6 
7  *************************************************************************
8  * *
9  * This library is free software; you can redistribute it and/or *
10  * modify it under the terms of the GNU Lesser General Public *
11  * License as published by the Free Software Foundation; either *
12  * version 2 of the License, or (at your option) any later version. *
13  * *
14  *************************************************************************
15 */
16 #include "kopetecontactliststorage.h"
17 
18 // Qt includes
19 
20 // KDE includes
21 
22 // Kopete includes
23 namespace Kopete
24 {
25 
26 class ContactListStorage::Private
27 {
28 public:
29  Private()
30  {}
31 
32  Group::List groupList;
33  MetaContact::List metaContactList;
34 };
35 
36 ContactListStorage::ContactListStorage()
37  : d(new Private)
38 {
39 }
40 
41 
42 ContactListStorage::~ContactListStorage()
43 {
44  delete d;
45 }
46 
47 Group::List ContactListStorage::groups() const
48 {
49  return d->groupList;
50 }
51 
52 MetaContact::List ContactListStorage::contacts() const
53 {
54  return d->metaContactList;
55 }
56 
57 void ContactListStorage::addMetaContact(Kopete::MetaContact *contact)
58 {
59  d->metaContactList.append( contact );
60 }
61 
62 void ContactListStorage::addGroup(Kopete::Group *group)
63 {
64  d->groupList.append( group );
65 }
66 
67 Kopete::Group * ContactListStorage::group( unsigned int groupId ) const
68 {
69  foreach( Kopete::Group * group, d->groupList )
70  {
71  if( group->groupId() == groupId )
72  return group;
73  }
74  return 0L;
75 }
76 
77 Kopete::Group * ContactListStorage::findGroup( const QString& displayName, int type )
78 {
79  if( type == Kopete::Group::Temporary )
80  return Kopete::Group::temporary();
81  if( type == Kopete::Group::TopLevel )
82  return Kopete::Group::topLevel();
83  if( type == Kopete::Group::Offline )
84  return Kopete::Group::offline();
85 
86  foreach( Kopete::Group * group, d->groupList )
87  {
88  if( group->type() == type && group->displayName() == displayName )
89  return group;
90  }
91 
92  Kopete::Group *newGroup = new Kopete::Group( displayName );
93  addGroup( newGroup );
94  return newGroup;
95 }
96 
97 }
98 
99 //kate: indent-mode cstyle; indent-spaces on; indent-width 4; auto-insert-doxygen on; replace-tabs on
Kopete::ContactListStorage::findGroup
Kopete::Group * findGroup(const QString &displayName, int type=Kopete::Group::Normal)
Find a group with his displayName.
Definition: kopetecontactliststorage.cpp:77
Kopete::Group::offline
static Group * offline()
Definition: kopetegroup.cpp:51
Kopete::ContactListStorage::group
Kopete::Group * group(unsigned int groupId) const
Get the Group with the given id for this storage.
Definition: kopetecontactliststorage.cpp:67
Kopete::ContactListStorage::groups
Group::List groups() const
Get the Group list for this storage.
Definition: kopetecontactliststorage.cpp:47
kopetecontactliststorage.h
Kopete::Group::groupId
uint groupId
Definition: kopetegroup.h:47
Kopete::ContactListStorage::~ContactListStorage
virtual ~ContactListStorage()
Definition: kopetecontactliststorage.cpp:42
Kopete::ContactListStorage::ContactListStorage
ContactListStorage()
Definition: kopetecontactliststorage.cpp:36
Kopete::Group::Offline
Definition: kopetegroup.h:56
QString
QList
Kopete::Group::List
QList< Group * > List
Definition: kopetegroup.h:53
Kopete::ContactListStorage::contacts
MetaContact::List contacts() const
Get the MetaContact list for this storage.
Definition: kopetecontactliststorage.cpp:52
Kopete::Group::topLevel
static Group * topLevel()
Definition: kopetegroup.cpp:35
Kopete::Group::TopLevel
Definition: kopetegroup.h:56
Kopete::Group
Class which represents the Group.
Definition: kopetegroup.h:44
Kopete::MetaContact
Definition: kopetemetacontact.h:54
Kopete::Group::Temporary
Definition: kopetegroup.h:56
Kopete::Group::type
GroupType type() const
Definition: kopetegroup.cpp:127
Kopete::ContactListStorage::addGroup
void addGroup(Kopete::Group *group)
Add a Group to internal list.
Definition: kopetecontactliststorage.cpp:62
Kopete::MetaContact::List
QList< MetaContact * > List
Definition: kopetemetacontact.h:70
Kopete::ContactListStorage::addMetaContact
void addMetaContact(Kopete::MetaContact *metaContact)
Add a MetaContact to internal list.
Definition: kopetecontactliststorage.cpp:57
Kopete::Group::temporary
static Group * temporary()
Definition: kopetegroup.cpp:43
Kopete::Group::displayName
QString displayName
Definition: kopetegroup.h:46
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal