kopete/libkopete
Kopete::Message Class Reference
#include <kopetemessage.h>
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
Kopete::Message newMessage(sourceContact, destionationContact); newMessage.setPlainBody( QString("A plain text message") ); newMessage.setDirection( Kopete::Message::Inbound );
Creating a complete rich text message
Kopete::Message richTextMessage(sourceContact, destinationContactList); richTextMessage.setTimestamp( QDateTime::currentDateTime() ); richTextMessage.setDirection( Kopete::Message::Outbound ); richTextMessage.setSubjet( QString("Kopete API documentation thread") ); richTextMessage.setHtmlBody( QString("<b>A bold text</b>") );
Definition at line 80 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 86 of file kopetemessage.h.
Specifies the type of notification that will be sent with this message.
- Enumerator:
Definition at line 105 of file kopetemessage.h.
Constructor & Destructor Documentation
| Kopete::Message::Message | ( | ) | [explicit] |
| Kopete::Message::~Message | ( | ) |
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 122 of file kopetemessage.cpp.
Constructs a new message with many contacts as the destination.
Definition at line 132 of file kopetemessage.cpp.
| Kopete::Message::Message | ( | const Message & | other | ) |
Copy constructor.
Just adds a reference, doesn't actually copy.
Definition at line 139 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 652 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 462 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 487 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 647 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 497 of file kopetemessage.cpp.
Transform a plaintext message into HTML.
it escape main entity like > < add some <br /> or
Definition at line 289 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 309 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 472 of file kopetemessage.cpp.
| QColor Kopete::Message::foregroundColor | ( | ) | const |
Accessor method for the foreground color.
- Returns:
- The message's foreground color
Definition at line 457 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 492 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 427 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 522 of file kopetemessage.cpp.
| Message::MessageImportance Kopete::Message::importance | ( | ) | const |
Accessor method for the importance.
- See also:
- setImportance
- Returns:
- The message importance (low/normal/highlight)
Definition at line 507 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 467 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 512 of file kopetemessage.cpp.
Assignment operator Just like the copy constructor it just refs and doesn't copy.
Definition at line 144 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 335 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 304 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 447 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 174 of file kopetemessage.cpp.
| void Kopete::Message::setBackgroundOverride | ( | bool | enable | ) |
Enables the use of a background for a message.
- Parameters:
-
enable A flag to indicate if the background should be enabled or disabled.
Definition at line 154 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 205 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 657 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 502 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 179 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 169 of file kopetemessage.cpp.
| void Kopete::Message::setForegroundOverride | ( | bool | enable | ) |
Enables the use of a foreground for a message.
- Parameters:
-
enable A flag to indicate if the foreground should be enabled or disabled.
Definition at line 159 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 189 of file kopetemessage.cpp.
| void Kopete::Message::setImportance | ( | Message::MessageImportance | i | ) |
Set the importance.
- See also:
- importance and
- Parameters:
-
importance The message importance to set
Definition at line 219 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 517 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 184 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 452 of file kopetemessage.cpp.
| void Kopete::Message::setRichTextOverride | ( | bool | enable | ) |
Enables the use of a RTF formatting for a message.
- Parameters:
-
enable A flag to indicate if the RTF formatting should be enabled or disabled.
Definition at line 164 of file kopetemessage.cpp.
| void Kopete::Message::setSubject | ( | const QString & | subject | ) |
Set message subject.
- Parameters:
-
subject Message's subject
Definition at line 482 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 422 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 442 of file kopetemessage.cpp.
| QString Kopete::Message::subject | ( | ) | const |
Accessor method for the subject of the message.
- Returns:
- The message subject
Definition at line 477 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 417 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 432 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 437 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 224 of file kopetemessage.cpp.
The documentation for this class was generated from the following files:
KDE 4.1 API Reference