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

kopete/libkopete

kopetemessage.h

Go to the documentation of this file.
00001 /*
00002     kopetemessage.h  -  Base class for Kopete messages
00003 
00004     Copyright (c) 2002-2003 by Martijn Klingens      <klingens@kde.org>
00005     Copyright (c) 2002-2004 by Olivier Goffart       <ogoffart@kde.org>
00006     Copyright (c) 2006-2007 by Charles Connell       <charles@connells.org>
00007     Copyright (c) 2007      by Michaƫl Larouche      <larouche@kde.org>
00008 
00009     Kopete    (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
00010 
00011     *************************************************************************
00012     *                                                                       *
00013     * This library is free software; you can redistribute it and/or         *
00014     * modify it under the terms of the GNU Lesser General Public            *
00015     * License as published by the Free Software Foundation; either          *
00016     * version 2 of the License, or (at your option) any later version.      *
00017     *                                                                       *
00018     *************************************************************************
00019 */
00020 
00021 #ifndef __KOPETE_MESSAGE_H__
00022 #define __KOPETE_MESSAGE_H__
00023 
00024 #include <QtCore/QSharedData>
00025 #include <QtCore/QList>
00026 #include <QtCore/Qt>
00027 
00028 #include "kopete_export.h"
00029 
00030 class QByteArray;
00031 class QColor;
00032 class QDateTime;
00033 class QFont;
00034 class QTextCodec;
00035 class QTextDocument;
00036 class QStringList;
00037 
00038 namespace Kopete {
00039 
00040 
00041 class ChatSession;
00042 class Contact;
00043 
00044 
00080 class KOPETE_EXPORT Message
00081 {
00082 public:
00086     enum MessageDirection
00087     {
00088         Inbound = 0, 
00089         Outbound = 1, 
00090         Internal= 2 
00091     };
00092 
00096     enum MessageType
00097     {
00098         TypeNormal, 
00099         TypeAction 
00100     };
00101 
00105     enum MessageImportance
00106     {
00107         Low = 0, 
00108         Normal = 1, 
00109         Highlight = 2 
00110     };
00111 
00115     explicit Message();
00116 
00120     ~Message();
00121 
00130     explicit Message( const Contact *fromKC, const Contact *toKC );
00136     explicit Message( const Contact *fromKC, const QList<Contact*> &contacts);
00137 
00142     Message( const Message &other );
00143 
00148     Message & operator=( const Message &other );
00149 
00154     QDateTime timestamp() const;
00155 
00160     void setTimestamp(const QDateTime &timestamp);
00161 
00166     const Contact * from() const;
00167 
00172     QList<Contact*> to() const;
00173 
00179     MessageType type() const;
00180 
00186     void setType(MessageType type);
00187 
00193     QString requestedPlugin() const;
00194 
00203     void setRequestedPlugin(const QString &requestedPlugin);
00204 
00209     QColor foregroundColor() const;
00210 
00215     QColor backgroundColor() const;
00216 
00221     bool isRightToLeft() const;
00222 
00227     QFont font() const;
00228 
00233     QString subject() const;
00234 
00239     void setSubject(const QString &subject);
00240 
00246     const QTextDocument *body() const;
00247 
00252     Qt::TextFormat format() const;
00253 
00258     MessageDirection direction() const;
00259 
00265     void setDirection(MessageDirection direction);
00266 
00272     MessageImportance importance() const;
00273 
00279     void setImportance(MessageImportance importance);
00280 
00286     void setForegroundColor( const QColor &color );
00287 
00293     void setBackgroundColor( const QColor &color );
00294 
00300     void setFont( const QFont &font );
00301 
00307     void setPlainBody( const QString &body);
00308 
00314     void setHtmlBody( const QString &body);
00315 
00321     void setBody( const QTextDocument *body);
00322 
00327     QString plainBody() const;
00328 
00337     QString escapedBody() const;
00338 
00344     QString parsedBody() const;
00345 
00353      ChatSession *manager() const ;
00354 
00360      void setManager(ChatSession * manager);
00361 
00366     void setBackgroundOverride( bool enable );
00367 
00372     void setForegroundOverride( bool enable );
00373 
00378     void setRichTextOverride( bool enable );
00379 
00384     QString getHtmlStyleAttribute() const;
00385     
00390     QStringList classes() const;
00391     
00397     void addClass(const QString& classe);
00398     
00404     void setClasses(const QStringList &classes);
00405 
00406 public:  /* static helpers */
00407 
00415     static QString unescape( const QString &xml );
00416 
00421     static QString escape( const QString & );
00422 
00423 #if 0 
00424     //candidate for removal!
00437     static QString decodeString( const QByteArray &message,
00438         const QTextCodec *providedCodec = 0L, bool *success = 0L );
00439 #endif
00440 
00441 private:
00442     class Private;
00443     QSharedDataPointer<Private> d;
00444 
00450     void doSetBody( const QString &body, Qt::TextFormat format = Qt::PlainText );
00451 
00457     void doSetBody (const QTextDocument *body, Qt::TextFormat format = Qt::PlainText);
00458 
00463     static QString parseLinks( const QString &message, Qt::TextFormat format );
00464 };
00465 
00466 }
00467 
00468 #endif
00469 
00470 // vim: set noet ts=4 sts=4 sw=4:
00471 

kopete/libkopete

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

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal