Logo Search packages:      
Sourcecode: kmess version File versions

chatmessage.h

/***************************************************************************
                          chatmessage.h -  description
                             -------------------
    begin                : Sat Okt 29 2005
    copyright            : (C) 2005 by Diederik van der Boor
    email                : "vdboor" --at-- "codingdomain.com"
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef CHATMESSAGE_H
#define CHATMESSAGE_H

#include <qstring.h>
#include <qfont.h>
#include <qdatetime.h>

class ContactBase;


/**
 * A class describing a chat message.
 * @author Diederik van der Boor
 */
00032 class ChatMessage
{
  public:
    enum MessageType
    {
      TYPE_INCOMING,
      TYPE_OUTGOING,
      TYPE_APPLICATION,
      TYPE_NOTIFICATION,
      TYPE_SYSTEM,
      TYPE_OFFLINE_INCOMING
    };

    // The constructor
                        ChatMessage(const MessageType type, const QString &body, const QString &contactHandle = QString::null, const QDateTime &time = QDateTime::currentDateTime());
    // The constructor for messages sent by contacts
                        ChatMessage(const MessageType type, const QString &body,
                                    const QString &contactHandle,
                                    const QString &contactName,
                                    const QString &contactPicturePath,
                                    const QFont   &font,
                                    const QString &fontColor,
                                    const QDateTime &time = QDateTime::currentDateTime());
    // The destructor
                       ~ChatMessage();
    // A clone method for ChatView::showMessage()
    ChatMessage *       clone() const;

    // Return the message body
    const QString &     getBody() const;
    // Return the message date and time (for offline-im messages)
    const QDateTime &   getDateTime() const;
    // Return the handle of the sending contact
    const QString &     getContactHandle() const;
    // Return the name of the sending contact
    const QString &     getContactName() const;
    // Return the path of the sending contact's picture
    const QString &     getContactPicturePath() const;
    // Return the message font
    const QFont &       getFont() const;
    // Return the message font color
    const QString &     getFontColor() const;
    // Return the message time
    const QTime         getTime() const;
    // Return the message type
    MessageType         getType() const;
    // Return whether it's a normal chat message
    bool                isNormalMessage() const;


  private:
    // The message body
    QString             body_;
    // The handle of the sending contact
    QString             contactHandle_;
    // The name of the sending contact
    QString             contactName_;
    // The picture of the sending contact
    QString             contactPicturePath_;
    // The message font
    QFont               font_;
    // The message color
    QString             fontColor_;
    // The message time
    QDateTime           time_;
    // The message type
    MessageType         type_;
};

#endif

Generated by  Doxygen 1.6.0   Back to index