• 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.12
  • kdenetwork
  • kopete
  • libkopete
kopeteaccount.h
Go to the documentation of this file.
1 /*
2  kopeteaccount.h - Kopete Account
3 
4  Copyright (c) 2007 by Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
5  Copyright (c) 2003-2005 by Olivier Goffart <ogoffart@kde.org>
6  Copyright (c) 2003-2004 by Martijn Klingens <klingens@kde.org>
7  Copyright (c) 2004 by Richard Smith <kde@metafoo.co.uk>
8 
9  Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
10 
11  *************************************************************************
12  * *
13  * This library is free software; you can redistribute it and/or *
14  * modify it under the terms of the GNU Lesser General Public *
15  * License as published by the Free Software Foundation; either *
16  * version 2 of the License, or (at your option) any later version. *
17  * *
18  *************************************************************************
19 */
20 
21 #ifndef KOPETEACCOUNT_H
22 #define KOPETEACCOUNT_H
23 
24 #include "kopeteonlinestatus.h"
25 #include "kopetestatusmessage.h"
26 #include "kopete_export.h"
27 
28 #include <QtCore/QObject>
29 #include <QtGui/QPixmap>
30 #include <QtCore/QHash>
31 
32 #include <kconfiggroup.h>
33 #include <kiconloader.h>
34 #include <solid/networking.h>
35 
36 class KActionMenu;
37 class KConfigGroup;
38 
39 namespace Kopete
40 {
41 class Contact;
42 class Protocol;
43 class MetaContact;
44 class Group;
45 class OnlineStatus;
46 class BlackLister;
47 class StatusMessage;
48 class Identity;
49 class PropertyContainer;
50 
72 class KOPETE_EXPORT Account : public QObject
73 {
74  Q_OBJECT
75 
76  Q_ENUMS( AddMode )
77  Q_PROPERTY( QString accountId READ accountId )
78  Q_PROPERTY( bool excludeConnect READ excludeConnect WRITE setExcludeConnect )
79  Q_PROPERTY( QColor color READ color WRITE setColor )
80  Q_PROPERTY( QPixmap accountIcon READ accountIcon )
81  Q_PROPERTY( bool isConnected READ isConnected )
82  Q_PROPERTY( bool isAway READ isAway )
83  Q_PROPERTY( bool suppressStatusNotification READ suppressStatusNotification )
84  Q_PROPERTY( uint priority READ priority WRITE setPriority )
85 
86 public:
95  enum DisconnectReason {
96  OtherClient = -4,
97  BadPassword = -3,
98  BadUserName = -2,
99  InvalidHost = -1,
100  Manual = 0,
101  ConnectionReset = 1,
102  Unknown = 99
103  };
104 
109  enum AddMode {
110  ChangeKABC = 0,
111  DontChangeKABC = 1,
112  Temporary = 2
113  };
114 
119  enum OnlineStatusOption {
120  None = 0x00,
121  KeepSpecialFlags = 0x01
122  };
123  Q_DECLARE_FLAGS(OnlineStatusOptions, OnlineStatusOption)
124 
125 
133  Account(Protocol *parent, const QString &accountID);
134 
138  ~Account();
139 
143  Protocol *protocol() const ;
144 
148  QString accountId() const;
149 
156  QString accountLabel() const;
157 
163  uint priority() const;
164 
170  void setPriority( uint priority );
171 
178  void setExcludeConnect(bool);
179 
185  bool excludeConnect() const;
186 
195  const QColor color() const;
196 
204  void setColor( const QColor &color);
205 
214  QPixmap accountIcon( const int size = 0 ) const;
215 
216  /*
217  * \brief Get the icon path for this account.
218  *
219  * This is the account icon path.
220  *
221  * @return the icon path for this account.
222  */
223  QString accountIconPath(const KIconLoader::Group size) const;
224 
232  void setCustomIcon( const QString& );
233 
239  QString customIcon() const;
240 
248  Identity * identity() const;
249 
261  virtual bool setIdentity( Kopete::Identity *ident );
262 
270  Contact * myself() const;
271 
286  virtual void fillActionMenu( KActionMenu *actionMenu );
287 
296  virtual bool hasCustomStatusMenu() const;
297 
305  const QHash<QString,Contact*>& contacts();
306 
316  bool suppressStatusNotification() const;
317 
336  MetaContact* addContact( const QString &contactId, const QString &displayName = QString(), Group *group = 0, AddMode mode = DontChangeKABC );
337 
351  bool addContact( const QString &contactId, MetaContact *parent, AddMode mode = DontChangeKABC );
352 
361  bool isConnected() const;
362 
371  bool isAway() const;
372 
383  bool isBusy() const;
384 
393  KConfigGroup *configGroup() const;
394 
408  virtual bool removeAccount();
409 
414  BlackLister* blackLister();
415 
420  virtual bool isBlocked( const QString &contactId );
421 
422 protected:
437  void setMyself( Contact *myself );
438 
454  virtual bool createContact( const QString &contactId, MetaContact *parentContact ) =0;
455 
456 
462  void setAccountLabel( const QString &label );
463 
464 protected slots:
476  virtual void disconnected( Kopete::Account::DisconnectReason reason );
477 
490  void setAllContactsStatus( const Kopete::OnlineStatus &status );
491 
497  void networkingStatusChanged( const Solid::Networking::Status status );
498 
499 signals:
506  void colorChanged( const QColor & );
507 
512  void accountDestroyed( const Kopete::Account *account );
513 
517  void isConnectedChanged();
518 
519 private:
524  void readConfig();
525 
526 public:
532  bool registerContact( Contact *c );
533 
534 public slots:
542  virtual void connect( const Kopete::OnlineStatus& initialStatus = OnlineStatus() ) = 0;
543 
552  virtual void disconnect( ) = 0 ;
553 
554 public slots:
562  virtual void setOnlineStatus( const Kopete::OnlineStatus& status,
563  const Kopete::StatusMessage &reason = Kopete::StatusMessage(),
564  const OnlineStatusOptions& options = None ) = 0;
570  virtual void setStatusMessage( const Kopete::StatusMessage &statusMessage ) = 0;
571 
576  bool suspend( const Kopete::StatusMessage &reason = Kopete::StatusMessage() );
577 
582  bool resume();
583 
587  void editAccount( QWidget* parent = 0L );
588 
596  virtual void block( const QString &contactId );
597 
605  virtual void unblock( const QString &contactId );
606 
607 private slots:
611  void reconnect();
612 
616  void contactDestroyed( Kopete::Contact * );
617 
621  void slotOnlineStatusChanged( Kopete::Contact *contact, const Kopete::OnlineStatus &newStatus, const Kopete::OnlineStatus &oldStatus );
622 
626  void slotContactPropertyChanged( Kopete::PropertyContainer *, const QString &, const QVariant &, const QVariant & );
627 
631  void slotStopSuppression();
632 
633 private:
634  class Private;
635  Private * const d;
636 };
637 Q_DECLARE_OPERATORS_FOR_FLAGS(Account::OnlineStatusOptions)
638 
639 } //END namespace Kopete
640 
641 #endif
642 
KOPETE_EXPORT
#define KOPETE_EXPORT
Definition: kopete_export.h:27
Kopete::OnlineStatus
Definition: kopeteonlinestatus.h:68
status
OnlineStatus::StatusType status
Definition: kopeteonlinestatus.cpp:103
Kopete::Account::OnlineStatusOption
OnlineStatusOption
Describes what should be done when we set new OnlineStatus.
Definition: kopeteaccount.h:119
Kopete::StatusMessage
This class encapsulate a status message.
Definition: kopetestatusmessage.h:48
Kopete::Protocol
base class of every protocol.
Definition: kopeteprotocol.h:62
QWidget
kopeteonlinestatus.h
QObject
kopetestatusmessage.h
kopete_export.h
Kopete::Account::AddMode
AddMode
Describes what should be done when the contact is added to a metacontact.
Definition: kopeteaccount.h:109
Kopete::Contact
Definition: kopetecontact.h:58
NetworkStatus::None
Definition: networkstatuscommon.h:11
Kopete::BlackLister
Manages the list of blacklisted contacts for an account.
Definition: kopeteblacklister.h:45
Kopete::Group
Class which represents the Group.
Definition: kopetegroup.h:44
Kopete::PropertyContainer
Definition: kopetepropertycontainer.h:39
Kopete::MetaContact
Definition: kopetemetacontact.h:54
Kopete::Account::DisconnectReason
DisconnectReason
Describes how the account was disconnected.
Definition: kopeteaccount.h:95
Kopete::Account
The Kopete::Account class handles one account.
Definition: kopeteaccount.h:72
Kopete::Identity
Definition: kopeteidentity.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:50 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