• Skip to content
  • Skip to link menu
KDE 4.2 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     Copyright (c) 2008      by Roman Jarosz          <kedgedev@centrum.cz>
00009 
00010     Kopete    (c) 2002-2008 by the Kopete developers <kopete-devel@kde.org>
00011 
00012     *************************************************************************
00013     *                                                                       *
00014     * This library is free software; you can redistribute it and/or         *
00015     * modify it under the terms of the GNU Lesser General Public            *
00016     * License as published by the Free Software Foundation; either          *
00017     * version 2 of the License, or (at your option) any later version.      *
00018     *                                                                       *
00019     *************************************************************************
00020 */
00021 
00022 #ifndef __KOPETE_MESSAGE_H__
00023 #define __KOPETE_MESSAGE_H__
00024 
00025 #include <QtCore/QSharedData>
00026 #include <QtCore/QList>
00027 #include <QtCore/Qt>
00028 
00029 #include "kopete_export.h"
00030 
00031 class QByteArray;
00032 class QColor;
00033 class QDateTime;
00034 class QFont;
00035 class QTextCodec;
00036 class QTextDocument;
00037 class QStringList;
00038 class QPixmap;
00039 
00040 namespace Kopete {
00041 
00042 
00043 class ChatSession;
00044 class Contact;
00045 
00046 
00082 class KOPETE_EXPORT Message
00083 {
00084 public:
00088     enum MessageDirection
00089     {
00090         Inbound = 0, 
00091         Outbound = 1, 
00092         Internal= 2 
00093     };
00094 
00098     enum MessageType
00099     {
00100         TypeNormal, 
00101         TypeAction, 
00102         TypeFileTransferRequest 
00103     };
00104 
00108     enum MessageImportance
00109     {
00110         Low = 0, 
00111         Normal = 1, 
00112         Highlight = 2 
00113     };
00114 
00115     enum MessageState
00116     {
00117         StateUnknown = 0, 
00118         StateSending = 1, 
00119         StateSent = 2, 
00120         StateError = 3 
00121     };
00122 
00126     explicit Message();
00127 
00131     ~Message();
00132 
00141     explicit Message( const Contact *fromKC, const Contact *toKC );
00147     explicit Message( const Contact *fromKC, const QList<Contact*> &contacts);
00148 
00153     Message( const Message &other );
00154 
00159     Message & operator=( const Message &other );
00160 
00165     uint id() const;
00166 
00171     static uint nextId();
00172 
00177     QDateTime timestamp() const;
00178 
00183     void setTimestamp(const QDateTime &timestamp);
00184 
00189     const Contact * from() const;
00190 
00195     QList<Contact*> to() const;
00196 
00202     MessageType type() const;
00203 
00209     void setType(MessageType type);
00210 
00216     QString requestedPlugin() const;
00217 
00226     void setRequestedPlugin(const QString &requestedPlugin);
00227 
00232     QColor foregroundColor() const;
00233 
00238     QColor backgroundColor() const;
00239 
00244     bool isRightToLeft() const;
00245 
00250     QFont font() const;
00251 
00256     QString subject() const;
00257 
00262     void setSubject(const QString &subject);
00263 
00269     const QTextDocument *body() const;
00270 
00275     Qt::TextFormat format() const;
00276 
00281     MessageDirection direction() const;
00282 
00288     void setDirection(MessageDirection direction);
00289 
00295     MessageImportance importance() const;
00296 
00302     void setImportance(MessageImportance importance);
00303 
00308     MessageState state() const;
00309 
00315     void setState(MessageState state);
00316 
00322     void setForegroundColor( const QColor &color );
00323 
00329     void setBackgroundColor( const QColor &color );
00330 
00336     void setFont( const QFont &font );
00337 
00343     void setPlainBody( const QString &body);
00344 
00350     void setHtmlBody( const QString &body);
00351 
00357     void setBody( const QTextDocument *body);
00358 
00363     QString plainBody() const;
00364 
00373     QString escapedBody() const;
00374 
00380     QString parsedBody() const;
00381 
00389      ChatSession *manager() const ;
00390 
00396      void setManager(ChatSession * manager);
00397 
00402     void setBackgroundOverride( bool enable );
00403 
00408     void setForegroundOverride( bool enable );
00409 
00414     void setRichTextOverride( bool enable );
00415 
00420     QString getHtmlStyleAttribute() const;
00421 
00426     void setFileTransferDisabled( bool disabled );
00427 
00432     bool fileTransferDisabled() const;
00433 
00438     void setFileName( const QString &fileName );
00439 
00444     QString fileName() const;
00445 
00450     void setFileSize( unsigned long size );
00451 
00456     unsigned long fileSize() const;
00457 
00462     void setFilePreview( const QPixmap &preview );
00463 
00468     QPixmap filePreview() const;
00469 
00474     QStringList classes() const;
00475     
00481     void addClass(const QString& classe);
00482     
00488     void setClasses(const QStringList &classes);
00489 
00490 public:  /* static helpers */
00491 
00499     static QString unescape( const QString &xml );
00500 
00505     static QString escape( const QString & );
00506 
00507 #if 0 
00508     //candidate for removal!
00521     static QString decodeString( const QByteArray &message,
00522         const QTextCodec *providedCodec = 0L, bool *success = 0L );
00523 #endif
00524 
00525 private:
00526     class Private;
00527     QSharedDataPointer<Private> d;
00528 
00534     void doSetBody( const QString &body, Qt::TextFormat format = Qt::PlainText );
00535 
00541     void doSetBody (const QTextDocument *body, Qt::TextFormat format = Qt::PlainText);
00542 
00547     static QString parseLinks( const QString &message, Qt::TextFormat format );
00548 };
00549 
00550 }
00551 
00552 #endif
00553 
00554 // vim: set noet ts=4 sts=4 sw=4:
00555 

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