kopete/libkopete
#include <kopetemessage.h>
Public Types | |
enum | MessageDirection { Inbound = 0, Outbound = 1, Internal = 2 } |
enum | MessageImportance { Low = 0, Normal = 1, Highlight = 2 } |
enum | MessageState { StateUnknown = 0, StateSending = 1, StateSent = 2, StateError = 3 } |
enum | MessageType { TypeNormal, TypeAction, TypeFileTransferRequest, TypeVoiceClipRequest } |
Static Public Member Functions | |
static QString | escape (const QString &) |
static uint | nextId () |
static QString | unescape (const QString &xml) |
Detailed Description
Representation of a message in Kopete.
Message represents any kind of messages shown on a chat view. The message may contain a simple plain text string, or a rich text HTML message. Also, Message can use a QTextDocument to structure the message.
Message in plain text can however have a color or a specific font. You can set color with setForegroundColor() and setBackgroundColor() and change the font with setFont()
Message have a direction from where the message come from. By default, the direction is Internal but it is strongly advised to set the direction explicitly.
Creating a plain text message
Creating a complete rich text message
Definition at line 82 of file kopetemessage.h.
Member Enumeration Documentation
Direction of a message.
Enumerator | |
---|---|
Inbound |
Message is from the chat partner. |
Outbound |
Message sent by the user. |
Internal |
(Default) Message which are not sent via the network. This is just a notification a plugin can show in a chat view |
Definition at line 88 of file kopetemessage.h.
Specifies the type of notification that will be sent with this message.
Definition at line 109 of file kopetemessage.h.
Definition at line 116 of file kopetemessage.h.
Specifies the type of the message.
Enumerator | |
---|---|
TypeNormal |
A typical message. |
TypeAction |
An IRC-style action. |
TypeFileTransferRequest |
A incoming file transfer request message. |
TypeVoiceClipRequest |
A incoming voice clip message. |
Definition at line 98 of file kopetemessage.h.
Constructor & Destructor Documentation
|
explicit |
Constructs a new empty message.
Definition at line 150 of file kopetemessage.cpp.
Kopete::Message::~Message | ( | ) |
Deref and clean private object if refcount == 0.
Definition at line 183 of file kopetemessage.cpp.
Constructs a new message with a from and to contact.
This constructor is a convience of the constructor who take a list of contacts for destination
Definition at line 155 of file kopetemessage.cpp.
Constructs a new message with many contacts as the destination.
Definition at line 165 of file kopetemessage.cpp.
Kopete::Message::Message | ( | const Message & | other | ) |
Copy constructor.
Just adds a reference, doesn't actually copy.
Definition at line 172 of file kopetemessage.cpp.
Member Function Documentation
void Kopete::Message::addClass | ( | const QString & | classe | ) |
Add a class.
- See also
- classes
- Parameters
-
class class to add
Definition at line 802 of file kopetemessage.cpp.
QColor Kopete::Message::backgroundColor | ( | ) | const |
Accessor method for the background color of the message.
- Returns
- The message's background color
Definition at line 545 of file kopetemessage.cpp.
const QTextDocument * Kopete::Message::body | ( | ) | const |
Accessor method for the body of the message This is used internaly, to modify it make a copy of it with QTextDocument::clone()
- Returns
- The message body
Definition at line 570 of file kopetemessage.cpp.
QStringList Kopete::Message::classes | ( | ) | const |
- Returns
- The list of classes Class are used to give different notification on a message. They are also used in the chatwindow as an HTML class
Definition at line 797 of file kopetemessage.cpp.
bool Kopete::Message::delayed | ( | ) | const |
Accessor method for the "delayed" attribute of the message.
- Returns
- true if the message was delayed (for example because it has been stored on a server while the intended recipient was offline or because the message is contained in the history of a group chat room).
Definition at line 814 of file kopetemessage.cpp.
Message::MessageDirection Kopete::Message::direction | ( | ) | const |
Accessor method for the direction of the message.
- Returns
- The message direction
Definition at line 580 of file kopetemessage.cpp.
Transform a plaintext message into HTML.
it escape main entity like > < add some <br /> or
Definition at line 351 of file kopetemessage.cpp.
QString Kopete::Message::escapedBody | ( | ) | const |
Get the message body as escaped (X)HTML format.
That means every HTML special char (>, <, &, ...) is escaped to the HTML entity (<, >, ...) and newlines (\n) are converted to <br /> Just because you set an HTML body doesn't mean you'll get the same string back here, but it will be equivalent in meaning
- Returns
- The message body as escaped text
Definition at line 374 of file kopetemessage.cpp.
QString Kopete::Message::fileName | ( | ) | const |
Accessor method for the file name of incoming file transfer.
- Returns
- file name of incoming file transfer
Definition at line 679 of file kopetemessage.cpp.
QPixmap Kopete::Message::filePreview | ( | ) | const |
Accessor method for the file preview icon.
- Returns
- file preview icon
Definition at line 705 of file kopetemessage.cpp.
unsigned long Kopete::Message::fileSize | ( | ) | const |
Accessor method for the file transfer size.
- Returns
- file transfer size
Definition at line 692 of file kopetemessage.cpp.
bool Kopete::Message::fileTransferDisabled | ( | ) | const |
Accessor method for the file transfer state.
- Returns
- if file transfer request should be enable or disable
Definition at line 666 of file kopetemessage.cpp.
QFont Kopete::Message::font | ( | ) | const |
Accessor method for the font of the message.
- Returns
- The message's font
Definition at line 555 of file kopetemessage.cpp.
QColor Kopete::Message::foregroundColor | ( | ) | const |
Accessor method for the foreground color.
- Returns
- The message's foreground color
Definition at line 540 of file kopetemessage.cpp.
Qt::TextFormat Kopete::Message::format | ( | ) | const |
Accessor method for the format of the message.
- Returns
- The message format
Definition at line 575 of file kopetemessage.cpp.
const Contact * Kopete::Message::from | ( | ) | const |
Accessor method for the Contact that sent this message.
- Returns
- The Contact who sent this message
Definition at line 510 of file kopetemessage.cpp.
QString Kopete::Message::getHtmlStyleAttribute | ( | ) | const |
Return HTML style attribute for this message.
- Returns
- A string formatted like this: "style=attr"
Definition at line 615 of file kopetemessage.cpp.
uint Kopete::Message::id | ( | ) | const |
Message::MessageImportance Kopete::Message::importance | ( | ) | const |
Accessor method for the importance.
- See also
- setImportance
- Returns
- The message importance (low/normal/highlight)
Definition at line 590 of file kopetemessage.cpp.
bool Kopete::Message::isRightToLeft | ( | ) | const |
Accesssor method for the direction of the text based on what language it is in.
- Returns
- The message text's direction
Definition at line 550 of file kopetemessage.cpp.
ChatSession * Kopete::Message::manager | ( | ) | const |
Get the related message manager.
If it is not set, returns 0L.
The ChatSession is only set if the message is already passed by the manager. We should trust this only in aboutToSend/aboutToReceive signals
Definition at line 605 of file kopetemessage.cpp.
|
static |
Assignment operator Just like the copy constructor it just refs and doesn't copy.
Definition at line 177 of file kopetemessage.cpp.
QString Kopete::Message::parsedBody | ( | ) | const |
Get the message body as parsed HTML with Emoticons, and URL parsed This should be ready to be shown in the chatwindow.
- Returns
- The HTML and Emoticon parsed message body
Definition at line 400 of file kopetemessage.cpp.
QString Kopete::Message::plainBody | ( | ) | const |
Get the message body back as plain text.
- Returns
- The message body as plain text
Definition at line 366 of file kopetemessage.cpp.
const QStringList Kopete::Message::regexpPatterns | ( | ) |
returns QStringList with regexp patterns will be used to look for links in the message
Definition at line 420 of file kopetemessage.cpp.
QString Kopete::Message::requestedPlugin | ( | ) | const |
Accessor method for the preferred plugin If null, Kopete will use the user's preferred plugin.
- Returns
- The preferred plugin
Definition at line 530 of file kopetemessage.cpp.
void Kopete::Message::setBackgroundColor | ( | const QColor & | color | ) |
Sets the background color for the message.
- See also
- backgroundColor
- Parameters
-
color The color
Definition at line 224 of file kopetemessage.cpp.
void Kopete::Message::setBackgroundOverride | ( | bool | enable | ) |
Does nothing.
Definition at line 197 of file kopetemessage.cpp.
void Kopete::Message::setBody | ( | const QTextDocument * | body | ) |
Sets the body of the message The format is changed to RichText automatically.
- Parameters
-
body The body
Definition at line 266 of file kopetemessage.cpp.
void Kopete::Message::setClasses | ( | const QStringList & | classes | ) |
Set the classes.
- See also
- classes
- Parameters
-
classes The new classes
Definition at line 807 of file kopetemessage.cpp.
void Kopete::Message::setDelayed | ( | bool | delay | ) |
Set the "delayed" attribute of the message.
- Parameters
-
delay whether the message was delayed, see delayed()
Definition at line 819 of file kopetemessage.cpp.
void Kopete::Message::setDirection | ( | MessageDirection | direction | ) |
Set the message direction.
- Parameters
-
direction The message direction
- See also
- MessageDirection
Definition at line 585 of file kopetemessage.cpp.
void Kopete::Message::setFileName | ( | const QString & | fileName | ) |
Set file name of incoming file transfer.
- Parameters
-
fileName file name
Definition at line 671 of file kopetemessage.cpp.
void Kopete::Message::setFilePreview | ( | const QPixmap & | preview | ) |
Set file preview icon for file transfer.
- Parameters
-
preview file preview icon
Definition at line 697 of file kopetemessage.cpp.
void Kopete::Message::setFileSize | ( | unsigned long | size | ) |
Set file transfer size.
- Parameters
-
size file transfer size
Definition at line 684 of file kopetemessage.cpp.
void Kopete::Message::setFileTransferDisabled | ( | bool | disabled | ) |
Set the state of incoming file transfer.
- Parameters
-
disabled flag to indicate if the file transfer request should be enabled or disabled.
Definition at line 658 of file kopetemessage.cpp.
void Kopete::Message::setFont | ( | const QFont & | font | ) |
Sets the font for the message.
- See also
- font
- Parameters
-
font The font
Definition at line 229 of file kopetemessage.cpp.
void Kopete::Message::setForcedHtmlBody | ( | const QString & | body | ) |
Sets the body of the message, which is used even if formatting is overridden.
- Parameters
-
body The body, interpreted as HTML
Definition at line 244 of file kopetemessage.cpp.
void Kopete::Message::setForegroundColor | ( | const QColor & | color | ) |
Sets the foreground color for the message.
- See also
- foregroundColor
- Parameters
-
color The color
Definition at line 219 of file kopetemessage.cpp.
void Kopete::Message::setForegroundOverride | ( | bool | enable | ) |
Does nothing.
Definition at line 202 of file kopetemessage.cpp.
void Kopete::Message::setFormattingOverride | ( | bool | enable | ) |
Ignores peer's formatting.
Definition at line 212 of file kopetemessage.cpp.
void Kopete::Message::setHtmlBody | ( | const QString & | body | ) |
Sets the body of the message.
- Parameters
-
body The body, interpreted as HTML
Definition at line 239 of file kopetemessage.cpp.
void Kopete::Message::setImportance | ( | Message::MessageImportance | i | ) |
Set the importance.
- See also
- importance and
- MessageImportance
- Parameters
-
importance The message importance to set
Definition at line 281 of file kopetemessage.cpp.
void Kopete::Message::setManager | ( | ChatSession * | manager | ) |
Set the messagemanager for this message.
Should be only used by the manager itself.
- See also
- manager
- Parameters
-
manager The chat session
Definition at line 610 of file kopetemessage.cpp.
void Kopete::Message::setPlainBody | ( | const QString & | body | ) |
Sets the body of the message.
- Parameters
-
body The body, intpreted as plain text
Definition at line 234 of file kopetemessage.cpp.
void Kopete::Message::setRequestedPlugin | ( | const QString & | requestedPlugin | ) |
Set a view plugin which will display the message.
This is used mostly by Jabber plugin to select between the email window or the chat window depending of the type of message.
- Parameters
-
requesedPlugin View plugin name
Definition at line 535 of file kopetemessage.cpp.
void Kopete::Message::setRichTextOverride | ( | bool | enable | ) |
Does nothing.
Definition at line 207 of file kopetemessage.cpp.
void Kopete::Message::setState | ( | MessageState | state | ) |
Set the state of message.
- See also
- MessageState
- Parameters
-
state The message state to set
Definition at line 600 of file kopetemessage.cpp.
void Kopete::Message::setSubject | ( | const QString & | subject | ) |
Set message subject.
- Parameters
-
subject Message's subject
Definition at line 565 of file kopetemessage.cpp.
void Kopete::Message::setTimestamp | ( | const QDateTime & | timestamp | ) |
Set the message timestamp.
- Parameters
-
timestamp timestamp as QDateTime. By default the current date and time.
Definition at line 505 of file kopetemessage.cpp.
void Kopete::Message::setType | ( | MessageType | type | ) |
Set message type.
- Parameters
-
type The type of the message
- See also
- MessageType
Definition at line 525 of file kopetemessage.cpp.
Message::MessageState Kopete::Message::state | ( | ) | const |
Accessor method for the state.
- Returns
- The message state (unknown/sending/sent/error)
Definition at line 595 of file kopetemessage.cpp.
QString Kopete::Message::subject | ( | ) | const |
Accessor method for the subject of the message.
- Returns
- The message subject
Definition at line 560 of file kopetemessage.cpp.
QDateTime Kopete::Message::timestamp | ( | ) | const |
Accessor method for the timestamp of the message.
- Returns
- The message's timestamp
Definition at line 500 of file kopetemessage.cpp.
Accessor method for the Contacts that this message was sent to.
- Returns
- Pointer list of the Contacts this message was sent to
Definition at line 515 of file kopetemessage.cpp.
Message::MessageType Kopete::Message::type | ( | ) | const |
Accessor method for the message type.
- Returns
- The type of the message
- See also
- MessageType
Definition at line 520 of file kopetemessage.cpp.
Unescapes a string, removing XML entity references and returns a plain text.
Note that this method is VERY expensive when called on rich text bodies, use with care!
Definition at line 286 of file kopetemessage.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.