akonadi
#include <noteutils.h>
Public Member Functions | |
NoteMessageWrapper (const KMime::MessagePtr &) | |
KDateTime | creationDate () const |
QString | from () const |
KMime::MessagePtr | message () const |
void | setCreationDate (const KDateTime &creationDate) |
void | setFrom (const QString &from) |
void | setText (const QString &text, Qt::TextFormat format=Qt::PlainText) |
void | setTitle (const QString &title) |
QString | text () const |
Qt::TextFormat | textFormat () const |
QString | title () const |
QString | toPlainText () const |
Detailed Description
A convenience wrapper around KMime::Message::Ptr for notes.
This is the format used by the Akonotes Resource
Reading a note from an Akonotes akonadi item:
if ( item.hasPayload<KMime::Message::Ptr>() ) {
NoteUtils::NoteMessageWrapper note(item.payload<KMime::Message::Ptr>());
kDebug() << note.text();
textIsRich = messageWrapper.textFormat() == Qt::RichText;
}
Setting the note as payload of an akonadi Item
item.setMimeType(NoteUtils::noteMimeType()); NoteUtils::NoteMessageWrapper note; note.setTitle( "title" ); note.setText( "text" ); note.setFrom( QString::fromLatin1( "MyApplication@kde4" ) ); item.setPayload( note.message() );
- Since:
- 4.8
Member Function Documentation
KDateTime Akonadi::NoteUtils::NoteMessageWrapper::creationDate | ( | ) | const |
Returns the creation date of the note.
Definition at line 117 of file noteutils.cpp.
QString Akonadi::NoteUtils::NoteMessageWrapper::from | ( | ) | const |
Returns the origin (creator) of the note.
Definition at line 129 of file noteutils.cpp.
KMime::Message::Ptr Akonadi::NoteUtils::NoteMessageWrapper::message | ( | ) | const |
Assemble a KMime message with the given values.
The message can then i.e. be stored inside an akonadi item
Definition at line 79 of file noteutils.cpp.
void Akonadi::NoteUtils::NoteMessageWrapper::setCreationDate | ( | const KDateTime & | creationDate | ) |
Set the creation date of the note (stored in the mime header)
Definition at line 111 of file noteutils.cpp.
void Akonadi::NoteUtils::NoteMessageWrapper::setFrom | ( | const QString & | from | ) |
Set the origin (creator) of the note (stored in the mime header) This is usually the application creating the note.
Definition at line 123 of file noteutils.cpp.
void Akonadi::NoteUtils::NoteMessageWrapper::setText | ( | const QString & | text, |
Qt::TextFormat | format = Qt::PlainText |
||
) |
Set the text of the note.
- Parameters:
-
format only Qt::PlainText and Qt::RichText is supported
Definition at line 147 of file noteutils.cpp.
void Akonadi::NoteUtils::NoteMessageWrapper::setTitle | ( | const QString & | title | ) |
Set the title of the note.
Definition at line 135 of file noteutils.cpp.
QString Akonadi::NoteUtils::NoteMessageWrapper::text | ( | ) | const |
Returns the text of the note.
Definition at line 154 of file noteutils.cpp.
Qt::TextFormat Akonadi::NoteUtils::NoteMessageWrapper::textFormat | ( | ) | const |
- Returns:
- Qt::PlainText or Qt::RichText
Definition at line 160 of file noteutils.cpp.
QString Akonadi::NoteUtils::NoteMessageWrapper::title | ( | ) | const |
Returns the title of the note.
Definition at line 141 of file noteutils.cpp.
QString Akonadi::NoteUtils::NoteMessageWrapper::toPlainText | ( | ) | const |
- Returns:
- plaintext version of the text (if richtext)
Definition at line 166 of file noteutils.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu Aug 2 2012 15:25:23 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.