• 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
kopetestatusitems.h
Go to the documentation of this file.
1 /*
2  kopetestatusitems.h - Kopete Status Items
3 
4  Copyright (c) 2008 by Roman Jarosz <kedgedev@centrum.cz>
5  Kopete (c) 2008 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 #ifndef KOPETESTATUSITEMS_H
17 #define KOPETESTATUSITEMS_H
18 
19 #include <QtCore/QObject>
20 #include <QtCore/QList>
21 #include <QtCore/QString>
22 
23 #include "kopete_export.h"
24 #include "kopeteonlinestatusmanager.h"
25 
26 namespace Kopete {
27 
28 namespace Status {
29 
30 class StatusGroup;
31 
42 class KOPETE_EXPORT StatusItem : public QObject
43 {
44  Q_OBJECT
45 public:
49  StatusItem();
50  StatusItem( const QString& uid );
51 
55  void setCategory( OnlineStatusManager::Categories category );
56 
60  OnlineStatusManager::Categories category() const { return mCategory; }
61 
65  void setTitle( const QString& title );
66 
70  QString title() const { return mTitle; }
71 
75  QString uid() const { return mUid; }
76 
80  virtual bool isGroup() const = 0;
81 
85  virtual int childCount() const = 0;
86 
90  virtual StatusItem *child( int /*index*/ ) const = 0;
91 
95  int index() const;
96 
100  StatusGroup *parentGroup() const;
101 
108  virtual StatusItem* copy() const = 0;
109 
110 Q_SIGNALS:
114  void changed();
115 
116 private:
117  OnlineStatusManager::Categories mCategory;
118  QString mTitle;
119  QString mUid;
120 
121  StatusGroup *mParentItem;
122  Q_DISABLE_COPY(StatusItem)
123 };
124 
130 class KOPETE_EXPORT StatusGroup : public StatusItem
131 {
132  Q_OBJECT
133 public:
137  StatusGroup();
138  StatusGroup( const QString& uid );
139 
144  virtual bool isGroup() const { return true; }
145 
149  virtual int childCount() const { return mChildItems.count(); }
150 
154  virtual StatusItem *child( int index ) const { return mChildItems.value( index, 0 ); }
155 
159  QList<StatusItem*> childList() const { return mChildItems; }
160 
164  int indexOf( StatusItem *child ) const { return mChildItems.indexOf( child ); }
165 
169  void insertChild( int index, StatusItem *child );
170 
174  void appendChild( Kopete::Status::StatusItem *child );
175 
179  void removeChild( Kopete::Status::StatusItem *child );
180 
187  virtual StatusItem* copy() const;
188 Q_SIGNALS:
192  void childInserted( int index, Kopete::Status::StatusItem *child );
193 
197  void childRemoved( Kopete::Status::StatusItem *child );
198 
199 private Q_SLOTS:
200  void childDestroyed( QObject *object );
201 
202 private:
203  QList<StatusItem*> mChildItems;
204 };
205 
212 class KOPETE_EXPORT Status : public StatusItem
213 {
214  Q_OBJECT
215 public:
219  Status();
220  Status( const QString& uid );
221 
226  virtual bool isGroup() const { return false; }
227 
232  virtual int childCount() const { return 0; }
233 
238  virtual StatusItem *child( int ) const { return 0; }
239 
243  void setMessage( const QString& message );
244 
248  QString message() const { return mMessage; }
249 
256  virtual StatusItem* copy() const;
257 
258 private:
259  QString mMessage;
260 };
261 
262 }
263 
264 }
265 
266 #endif
KOPETE_EXPORT
#define KOPETE_EXPORT
Definition: kopete_export.h:27
Kopete::Status::StatusGroup::isGroup
virtual bool isGroup() const
Returns true if StatusItem is group.
Definition: kopetestatusitems.h:144
Kopete::Status::StatusGroup::childList
QList< StatusItem * > childList() const
Returns list of all childes.
Definition: kopetestatusitems.h:159
Kopete::Status::Status
Status represents a status which has title, message and category.
Definition: kopetestatusitems.h:212
Kopete::Status::StatusGroup
StatusGroup represents a group that can contain other StatusItems.
Definition: kopetestatusitems.h:130
Kopete::Status::StatusItem
StatusItem is a base class for all status items.
Definition: kopetestatusitems.h:42
Kopete::Status::StatusItem::category
OnlineStatusManager::Categories category() const
Returns category.
Definition: kopetestatusitems.h:60
QObject
Kopete::Status::StatusItem::title
QString title() const
Returns title.
Definition: kopetestatusitems.h:70
kopete_export.h
QString
QList
Kopete::Status::StatusGroup::childCount
virtual int childCount() const
Returns number of childes.
Definition: kopetestatusitems.h:149
Kopete::Status::Status::message
QString message() const
Returns message.
Definition: kopetestatusitems.h:248
Kopete::Status::StatusGroup::child
virtual StatusItem * child(int index) const
Returns a StatusItem at given index or 0 if there is no item at given index.
Definition: kopetestatusitems.h:154
Kopete::Status::StatusItem::uid
QString uid() const
Returns unique identifier.
Definition: kopetestatusitems.h:75
Kopete::Status::StatusGroup::indexOf
int indexOf(StatusItem *child) const
Returns index for given StatusItem.
Definition: kopetestatusitems.h:164
kopeteonlinestatusmanager.h
Kopete::Status::Status::isGroup
virtual bool isGroup() const
Returns true if the item is group.
Definition: kopetestatusitems.h:226
Kopete::Status::Status::childCount
virtual int childCount() const
Returns number of childes.
Definition: kopetestatusitems.h:232
Kopete::Status::Status::child
virtual StatusItem * child(int) const
Returns the item at given index or 0 if there is no item at given index.
Definition: kopetestatusitems.h:238
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