• 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
kopetecontact.h
Go to the documentation of this file.
1 /*
2  kopetecontact.h - Kopete Contact
3 
4  Copyright (c) 2002-2004 by Duncan Mac-Vicar Prett <duncan@kde.org>
5  Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org>
6  Copyright (c) 2002-2004 by Olivier Goffart <ogoffart@kde.org>
7 
8  Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
9 
10  *************************************************************************
11  * *
12  * This library is free software; you can redistribute it and/or *
13  * modify it under the terms of the GNU Lesser General Public *
14  * License as published by the Free Software Foundation; either *
15  * version 2 of the License, or (at your option) any later version. *
16  * *
17  *************************************************************************
18 */
19 
20 #ifndef KOPETECONTACT_H
21 #define KOPETECONTACT_H
22 
23 #include "kopetecontactlistelement.h"
24 #include "kopetepropertycontainer.h"
25 
26 #include <kurl.h>
27 #include <kdemacros.h>
28 #include <ktoggleaction.h>
29 #include "kopeteglobal.h"
30 
31 #include "kopete_export.h"
32 
33 class KMenu;
34 class KAction;
35 
36 namespace Kopete
37 {
38 
39 class Group;
40 class MetaContact;
41 class ChatSession;
42 class OnlineStatus;
43 class Plugin;
44 class Protocol;
45 class Account;
46 class StatusMessage;
47 
48 typedef QList<Group *> GroupList;
49 
58 class KOPETE_EXPORT Contact
59  : public ContactListElement
60 {
61  Q_OBJECT
62 
63  Q_ENUMS( CanCreateFlags )
64  Q_PROPERTY( QString formattedName READ formattedName )
65  Q_PROPERTY( QString formattedIdleTime READ formattedIdleTime )
66  Q_PROPERTY( bool isOnline READ isOnline )
67  Q_PROPERTY( bool fileCapable READ isFileCapable WRITE setFileCapable )
68  Q_PROPERTY( bool canAcceptFiles READ canAcceptFiles )
69  //Q_PROPERTY( bool isReachable READ isReachable )
70  Q_PROPERTY( QString contactId READ contactId )
71  Q_PROPERTY( QString icon READ icon WRITE setIcon )
72  Q_PROPERTY( QString toolTip READ toolTip )
73  Q_PROPERTY( QString nickName READ nickName WRITE setNickName )
74  //Q_PROPERTY( unsigned long idleTime READ idleTime WRITE setIdleTime )
75 
76 public:
80  enum Changed{ MovedBetweenGroup = 0x01,
81  DisplayNameChanged = 0x02
82  };
83 
84  enum NameType {
85  NickName,
86  CustomName,
87  FormattedName,
88  ContactId,
89  };
90 
95  static NameType nameTypeFromString(const QString &nameType);
96  static const QString nameTypeToString(NameType nameType);
97 
115  Contact( Account *account, const QString &id, MetaContact *parent,
116  const QString &icon = QString() );
117 
118  ~Contact();
119 
124  MetaContact *metaContact() const;
125 
126 
139  QString contactId() const;
140 
148  Protocol* protocol() const;
149 
155  Account* account() const;
156 
165  void setMetaContact(MetaContact *m);
166 
171  bool isOnline() const;
172 
182  // FIXME: After KDE 3.2 we should split this into a public, NON-virtual
183  // isReachable() accessor that checks for account->isConnected()
184  // and then calls a new virtual method that does the
185  // protocol-specific work, like 'doIsUnreachable' or so - Martijn
186  //
187  //FIXME: Can this be made const please? - JK
188  virtual bool isReachable();
189 
210  virtual void serialize( QMap<QString, QString> &serializedData, QMap<QString, QString> &addressBookData );
211 
216  OnlineStatus onlineStatus() const;
217 
221  void setOnlineStatus(const OnlineStatus &status);
222 
227  Kopete::StatusMessage statusMessage() const;
232  void setStatusMessage(const Kopete::StatusMessage &statusMessage);
233 
246  virtual QList<KAction *> *customContextMenuActions();
247 
251  virtual KDE_DEPRECATED QList<KAction *> *customContextMenuActions( ChatSession *manager );
252 
259  KMenu *popupMenu();
260 
264  KDE_DEPRECATED KMenu *popupMenu( ChatSession *manager );
265 
276  bool isFileCapable() const;
277 
284  void setFileCapable( bool filecap );
285 
295  bool canAcceptFiles() const;
296 
297  enum CanCreateFlags { CannotCreate=false , CanCreate=true };
298 
310  virtual ChatSession * manager( CanCreateFlags canCreate = CannotCreate ) =0;
311 
317  QString& icon() const;
318 
327  void setIcon( const QString& icon );
328 
338  virtual unsigned long int idleTime() const;
339 
348  void setIdleTime(unsigned long int);
349 
354  void setNickName( const QString &name );
355 
361  QString nickName() const;
362 
367  void setCustomName( const QString &name );
368 
374  QString customName() const;
375 
379  void setPreferredNameType(NameType type);
380 
385  NameType preferredNameType() const;
386 
392  QString displayName() const;
393 
399  QString toolTip() const;
400 
404  QString formattedName() const;
405 
410  QString formattedIdleTime() const;
411 
416  void setPhoto(const QString &photoPath);
417 
418 public slots:
422  void startChat();
423 
427  void sendMessage();
428 
432  void execute();
433 
439  void toggleAlwaysVisible();
440 
446  void changeMetaContact();
454  virtual void slotUserInfo() {}
455 
467  virtual void sync(unsigned int changed = 0xFF);
468 
477  virtual KDE_DEPRECATED void deleteContact();
478 
492  virtual void sendFile( const KUrl &sourceURL = KUrl(),
493  const QString &fileName = QString(), uint fileSize = 0L );
494 private slots:
498  void slotAddContact();
499 
503  void slotDelete();
504 
508  void slotBlock();
509 
513  void slotUnblock();
514 
518  void slotAccountIsConnectedChanged();
519 
523  void slotMetaContactDestroyed( QObject* mc );
524 
528  void slotPropertyChanged(Kopete::PropertyContainer *, const QString &key, const QVariant &oldValue, const QVariant &newValue);
529 signals:
533  void onlineStatusChanged( Kopete::Contact *contact,
534  const Kopete::OnlineStatus &status, const Kopete::OnlineStatus &oldStatus );
535 
539  void statusMessageChanged( Kopete::Contact *contact );
540 
549  void contactDestroyed( Kopete::Contact *contact );
550 
556  void idleStateChanged( Kopete::Contact *contact );
557 
561  void canAcceptFilesChanged();
562 
566  void displayNameChanged(const QString &oldName, const QString &newName);
567 
568 private:
569  class Private;
570  Private * const d;
571 
572 
573 };
574 
575 
576 } //END namespace Kopete
577 
578 #endif
579 
Kopete::Contact::NameType
NameType
Definition: kopetecontact.h:84
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::StatusMessage
This class encapsulate a status message.
Definition: kopetestatusmessage.h:48
kopetecontactlistelement.h
Kopete::Protocol
base class of every protocol.
Definition: kopeteprotocol.h:62
QMap
Kopete::Contact::Changed
Changed
used in sync()
Definition: kopetecontact.h:80
Kopete::ChatSession
Definition: kopetechatsession.h:74
Kopete::Contact::FormattedName
Formatted name (first and/or last name)
Definition: kopetecontact.h:87
kopetepropertycontainer.h
Kopete::Contact::CustomName
Custom name set by user and stored on server contact list, can be changed.
Definition: kopetecontact.h:86
Kopete::Contact::ContactId
Contact id, will never change.
Definition: kopetecontact.h:88
Kopete::Contact::slotUserInfo
virtual void slotUserInfo()
Method to retrieve user information.
Definition: kopetecontact.h:454
Kopete::ContactListElement
Definition: kopetecontactlistelement.h:46
QObject
kopete_export.h
QString
QList< Group * >
Kopete::Contact
Definition: kopetecontact.h:58
Kopete::Contact::CanCreateFlags
CanCreateFlags
Definition: kopetecontact.h:297
Kopete::Contact::NickName
Nick name, comes from contact.
Definition: kopetecontact.h:85
KAction
Kopete::PropertyContainer
Definition: kopetepropertycontainer.h:39
Kopete::MetaContact
Definition: kopetemetacontact.h:54
Kopete::Account
The Kopete::Account class handles one account.
Definition: kopeteaccount.h:72
kopeteglobal.h
name
const char * name
Definition: kopeteonlinestatus.cpp:104
Kopete::GroupList
QList< Group * > GroupList
Definition: kopetecontact.h:46
QVariant
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