Akonadi::NoteUtils::NoteMessageWrapper Class Reference

#include <noteutils.h>

Public Types

enum  Classification { Public, Private, Confidential }

Public Member Functions

 NoteMessageWrapper (const KMime::MessagePtr &msg)
QVector< Attachment > & attachments ()
Classification classification () const
QDateTime creationDate () const
QMap< QString, QString > & custom ()
QString from () const
QDateTime lastModifiedDate () const
KMime::MessagePtr message () const
void setClassification (Classification)
void setCreationDate (const QDateTime &creationDate)
void setFrom (const QString &from)
void setLastModifiedDate (const QDateTime &lastModifiedDate)
void setText (const QString &text, Qt::TextFormat format=Qt::PlainText)
void setTitle (const QString &title)
void setUid (const QString &uid)
QString text () const
Qt::TextFormat textFormat () const
QString title () const
QString toPlainText () const
QString uid () const

Detailed Description

A convenience wrapper around KMime::MessagePtr for notes.

This is the format used by the Akonotes Resource

A note has the following properties: uid: globally unique identifier (generated if empty) creationDate: timestamp when the note was created (generated if empty) lastModified: lastModified (generated if empty) classification: one of private, confidential, public. This is only meant as an indication to the user. title: title of the note text: textual content from: author (generated if empty) attachments: inline or url only custom: key value pair for custom values

Reading a note from an Akonotes akonadi item:

if ( item.hasPayload<KMime::MessagePtr>() ) {
NoteUtils::NoteMessageWrapper note(item.payload<KMime::MessagePtr>());
qCDebug(AKONADINOTES_LOG) << note.text();
textIsRich = messageWrapper.textFormat() == Qt::RichText;

Setting the note as payload of an akonadi Item

NoteUtils::NoteMessageWrapper note;
note.setTitle( "title" );
note.setText( "text" );
note.setFrom( QString::fromLatin1( "[email protected]" ) );
item.setPayload( note.message() );
Christian Mollekopf chrig[email protected][email protected][email protected]fastm[email protected]ail.[email protected]fm

Definition at line 164 of file noteutils.h.

Member Function Documentation

QVector< Attachment > & Akonadi::NoteUtils::NoteMessageWrapper::attachments ( )

Returns a reference to the list of attachments of the note.

Definition at line 567 of file noteutils.cpp.

NoteMessageWrapper::Classification Akonadi::NoteUtils::NoteMessageWrapper::classification ( ) const

Returns the classification of the note.

Definition at line 480 of file noteutils.cpp.

QDateTime Akonadi::NoteUtils::NoteMessageWrapper::creationDate ( ) const

Returns the creation date of the note.

Definition at line 504 of file noteutils.cpp.

QMap< QString, QString > & Akonadi::NoteUtils::NoteMessageWrapper::custom ( )

Returns a reference to the custom-value map.

key-value map containing all custom values

Definition at line 573 of file noteutils.cpp.

QString Akonadi::NoteUtils::NoteMessageWrapper::from ( ) const

Returns the origin (creator) of the note.

Definition at line 516 of file noteutils.cpp.

QDateTime Akonadi::NoteUtils::NoteMessageWrapper::lastModifiedDate ( ) const

Returns the lastModified-date of the note.

Definition at line 492 of file noteutils.cpp.

KMime::MessagePtr 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 386 of file noteutils.cpp.

void Akonadi::NoteUtils::NoteMessageWrapper::setClassification ( NoteMessageWrapper::Classification  classification)

Set the classification of the note.

Definition at line 474 of file noteutils.cpp.

void Akonadi::NoteUtils::NoteMessageWrapper::setCreationDate ( const QDateTime creationDate)

Set the creation date of the note (stored in the mime header)

Definition at line 498 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.

frommust be an address in the style of [email protected][email protected]de.o[email protected]rg.

Definition at line 510 of file noteutils.cpp.

void Akonadi::NoteUtils::NoteMessageWrapper::setLastModifiedDate ( const QDateTime lastModifiedDate)

Set the lastModified-date of the note.

Definition at line 486 of file noteutils.cpp.

void Akonadi::NoteUtils::NoteMessageWrapper::setText ( const QString text,
Qt::TextFormat  format = Qt::PlainText 

Set the text of the note.

formatonly Qt::PlainText and Qt::RichText is supported

Definition at line 534 of file noteutils.cpp.

void Akonadi::NoteUtils::NoteMessageWrapper::setTitle ( const QString title)

Set the title of the note.

Definition at line 522 of file noteutils.cpp.

void Akonadi::NoteUtils::NoteMessageWrapper::setUid ( const QString uid)

Set the uid of the note.

uidshould be globally unique

Definition at line 462 of file noteutils.cpp.

QString Akonadi::NoteUtils::NoteMessageWrapper::text ( ) const

Returns the text of the note.

Definition at line 541 of file noteutils.cpp.

Qt::TextFormat Akonadi::NoteUtils::NoteMessageWrapper::textFormat ( ) const
Qt::PlainText or Qt::RichText

Definition at line 547 of file noteutils.cpp.

QString Akonadi::NoteUtils::NoteMessageWrapper::title ( ) const

Returns the title of the note.

Definition at line 528 of file noteutils.cpp.

QString Akonadi::NoteUtils::NoteMessageWrapper::toPlainText ( ) const
plaintext version of the text (if richtext)

Definition at line 553 of file noteutils.cpp.

QString Akonadi::NoteUtils::NoteMessageWrapper::uid ( ) const

Returns the uid of the note.

Definition at line 468 of file noteutils.cpp.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 23:13:44 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.