• 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
kopetemessage.h
Go to the documentation of this file.
1 /*
2  kopetemessage.h - Base class for Kopete messages
3 
4  Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org>
5  Copyright (c) 2002-2004 by Olivier Goffart <ogoffart@kde.org>
6  Copyright (c) 2006-2007 by Charles Connell <charles@connells.org>
7  Copyright (c) 2007 by MichaĆ«l Larouche <larouche@kde.org>
8  Copyright (c) 2008 by Roman Jarosz <kedgedev@centrum.cz>
9 
10  Kopete (c) 2002-2008 by the Kopete developers <kopete-devel@kde.org>
11 
12  *************************************************************************
13  * *
14  * This library is free software; you can redistribute it and/or *
15  * modify it under the terms of the GNU Lesser General Public *
16  * License as published by the Free Software Foundation; either *
17  * version 2 of the License, or (at your option) any later version. *
18  * *
19  *************************************************************************
20 */
21 
22 #ifndef KOPETEMESSAGE_H
23 #define KOPETEMESSAGE_H
24 
25 #include <QtCore/QSharedData>
26 #include <QtCore/QList>
27 #include <QtCore/Qt>
28 
29 #include "kopete_export.h"
30 
31 class QByteArray;
32 class QColor;
33 class QDateTime;
34 class QFont;
35 class QTextCodec;
36 class QTextDocument;
37 class QStringList;
38 class QPixmap;
39 
40 namespace Kopete {
41 
42 
43 class ChatSession;
44 class Contact;
45 
46 
82 class KOPETE_EXPORT Message
83 {
84 public:
88  enum MessageDirection
89  {
90  Inbound = 0,
91  Outbound = 1,
92  Internal= 2
93  };
94 
98  enum MessageType
99  {
100  TypeNormal,
101  TypeAction,
102  TypeFileTransferRequest,
103  TypeVoiceClipRequest
104  };
105 
109  enum MessageImportance
110  {
111  Low = 0,
112  Normal = 1,
113  Highlight = 2
114  };
115 
116  enum MessageState
117  {
118  StateUnknown = 0,
119  StateSending = 1,
120  StateSent = 2,
121  StateError = 3
122  };
123 
127  explicit Message();
128 
132  ~Message();
133 
142  explicit Message( const Contact *fromKC, const Contact *toKC );
148  explicit Message( const Contact *fromKC, const QList<Contact*> &contacts);
149 
154  Message( const Message &other );
155 
160  Message & operator=( const Message &other );
161 
166  uint id() const;
167 
172  static uint nextId();
173 
178  QDateTime timestamp() const;
179 
184  void setTimestamp(const QDateTime &timestamp);
185 
192  bool delayed() const;
193 
198  void setDelayed(bool delay);
199 
204  const Contact * from() const;
205 
210  QList<Contact*> to() const;
211 
217  MessageType type() const;
218 
224  void setType(MessageType type);
225 
231  QString requestedPlugin() const;
232 
241  void setRequestedPlugin(const QString &requestedPlugin);
242 
247  QColor foregroundColor() const;
248 
253  QColor backgroundColor() const;
254 
259  bool isRightToLeft() const;
260 
265  const QStringList regexpPatterns();
266 
271  QFont font() const;
272 
277  QString subject() const;
278 
283  void setSubject(const QString &subject);
284 
290  const QTextDocument *body() const;
291 
296  Qt::TextFormat format() const;
297 
302  MessageDirection direction() const;
303 
309  void setDirection(MessageDirection direction);
310 
316  MessageImportance importance() const;
317 
323  void setImportance(MessageImportance importance);
324 
329  MessageState state() const;
330 
336  void setState(MessageState state);
337 
343  void setForegroundColor( const QColor &color );
344 
350  void setBackgroundColor( const QColor &color );
351 
357  void setFont( const QFont &font );
358 
364  void setPlainBody( const QString &body);
365 
371  void setHtmlBody( const QString &body);
372 
378  void setForcedHtmlBody( const QString &body);
379 
385  void setBody( const QTextDocument *body);
386 
391  QString plainBody() const;
392 
401  QString escapedBody() const;
402 
408  QString parsedBody() const;
409 
417  ChatSession *manager() const ;
418 
424  void setManager(ChatSession * manager);
425 
429  void KDE_DEPRECATED setBackgroundOverride( bool enable );
430 
434  void KDE_DEPRECATED setForegroundOverride( bool enable );
435 
439  void KDE_DEPRECATED setRichTextOverride( bool enable );
440 
444  void setFormattingOverride( bool enable );
445 
450  QString getHtmlStyleAttribute() const;
451 
456  void setFileTransferDisabled( bool disabled );
457 
462  bool fileTransferDisabled() const;
463 
468  void setFileName( const QString &fileName );
469 
474  QString fileName() const;
475 
480  void setFileSize( unsigned long size );
481 
486  unsigned long fileSize() const;
487 
492  void setFilePreview( const QPixmap &preview );
493 
498  QPixmap filePreview() const;
499 
504  QStringList classes() const;
505 
511  void addClass(const QString& classe);
512 
518  void setClasses(const QStringList &classes);
519 
520 public: /* static helpers */
521 
529  static QString unescape( const QString &xml );
530 
535  static QString escape( const QString & );
536 
537 #if 0
538  //candidate for removal!
551  static QString decodeString( const QByteArray &message,
552  const QTextCodec *providedCodec = 0L, bool *success = 0L );
553 #endif
554 
555 private:
556  class Private;
557  QSharedDataPointer<Private> d;
558 
564  void doSetBody( QString body, Qt::TextFormat format = Qt::PlainText );
565 
571  void doSetBody (const QTextDocument *body, Qt::TextFormat format = Qt::PlainText);
572 
577  static QString parseLinks( const QString &message, Qt::TextFormat format );
578 };
579 
580 }
581 
582 #endif
583 
584 // vim: set noet ts=4 sts=4 sw=4:
585 
KOPETE_EXPORT
#define KOPETE_EXPORT
Definition: kopete_export.h:27
QByteArray
Kopete::Message::TypeFileTransferRequest
A incoming file transfer request message.
Definition: kopetemessage.h:102
QFont
Kopete::Message::TypeNormal
A typical message.
Definition: kopetemessage.h:100
Kopete::Message::MessageState
MessageState
Definition: kopetemessage.h:116
Kopete::ChatSession
Definition: kopetechatsession.h:74
Kopete::Message::MessageDirection
MessageDirection
Direction of a message.
Definition: kopetemessage.h:88
kopete_export.h
QString
QList< Contact * >
QColor
QTextCodec
Kopete::Contact
Definition: kopetecontact.h:58
QStringList
Kopete::Message::MessageImportance
MessageImportance
Specifies the type of notification that will be sent with this message.
Definition: kopetemessage.h:109
QPixmap
Kopete::Message::MessageType
MessageType
Specifies the type of the message.
Definition: kopetemessage.h:98
QTextDocument
Kopete::Message::TypeAction
An IRC-style action.
Definition: kopetemessage.h:101
Kopete::Message
Representation of a message in Kopete.
Definition: kopetemessage.h:82
QSharedDataPointer< Private >
QDateTime
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