Akonadi::NoteUtils::NoteMessageWrapper

Search for usage in LXR

Akonadi::NoteUtils::NoteMessageWrapper Class Reference

#include <noteutils.h>

Public Types

enum  Classification { Public , Private , Confidential }
 

Public Member Functions

 NoteMessageWrapper (const KMime::MessagePtr &msg)
 
QList< 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>() ) {
qCDebug(AKONADINOTES_LOG) << note.text();
textIsRich = messageWrapper.textFormat() == Qt::RichText;
}
A convenience wrapper around KMime::MessagePtr for notes.
Definition noteutils.h:170
RichText

Setting the note as payload of an akonadi Item

item.setMimeType(NoteUtils::noteMimeType());
note.setTitle( "title" );
note.setText( "text" );
note.setFrom( QString::fromLatin1( "MyApplication@kde4" ) );
item.setPayload( note.message() );
void setText(const QString &text, Qt::TextFormat format=Qt::PlainText)
Set the text of the note.
void setFrom(const QString &from)
Set the origin (creator) of the note (stored in the mime header) This is usually the application crea...
void setTitle(const QString &title)
Set the title of the note.
KMime::MessagePtr message() const
Assemble a KMime message with the given values.
QString fromLatin1(QByteArrayView str)
Author
Christian Mollekopf chrig.nosp@m.i_1@.nosp@m.fastm.nosp@m.ail..nosp@m.fm
Since
4.8

Definition at line 169 of file noteutils.h.

Member Enumeration Documentation

◆ Classification

enum Akonadi::NoteUtils::NoteMessageWrapper::Classification

Definition at line 187 of file noteutils.h.

Constructor & Destructor Documentation

◆ NoteMessageWrapper() [1/2]

Akonadi::NoteUtils::NoteMessageWrapper::NoteMessageWrapper ( )

Definition at line 355 of file noteutils.cpp.

◆ NoteMessageWrapper() [2/2]

Akonadi::NoteUtils::NoteMessageWrapper::NoteMessageWrapper ( const KMime::MessagePtr & msg)
explicit

Definition at line 360 of file noteutils.cpp.

Member Function Documentation

◆ attachments()

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

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

Definition at line 548 of file noteutils.cpp.

◆ classification()

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

Returns the classification of the note.

Definition at line 461 of file noteutils.cpp.

◆ creationDate()

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

Returns the creation date of the note.

Definition at line 485 of file noteutils.cpp.

◆ custom()

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

Returns a reference to the custom-value map.

Returns
key-value map containing all custom values

Definition at line 554 of file noteutils.cpp.

◆ from()

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

Returns the origin (creator) of the note.

Definition at line 497 of file noteutils.cpp.

◆ lastModifiedDate()

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

Returns the lastModified-date of the note.

Definition at line 473 of file noteutils.cpp.

◆ message()

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 367 of file noteutils.cpp.

◆ setClassification()

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

Set the classification of the note.

Definition at line 455 of file noteutils.cpp.

◆ setCreationDate()

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

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

Definition at line 479 of file noteutils.cpp.

◆ setFrom()

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.

Parameters
frommust be an address in the style of foo@k.nosp@m.de.o.nosp@m.rg.

Definition at line 491 of file noteutils.cpp.

◆ setLastModifiedDate()

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

Set the lastModified-date of the note.

Definition at line 467 of file noteutils.cpp.

◆ setText()

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

Set the text of the note.

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

Definition at line 515 of file noteutils.cpp.

◆ setTitle()

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

Set the title of the note.

Definition at line 503 of file noteutils.cpp.

◆ setUid()

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

Set the uid of the note.

Parameters
uidshould be globally unique

Definition at line 443 of file noteutils.cpp.

◆ text()

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

Returns the text of the note.

Definition at line 522 of file noteutils.cpp.

◆ textFormat()

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

Definition at line 528 of file noteutils.cpp.

◆ title()

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

Returns the title of the note.

Definition at line 509 of file noteutils.cpp.

◆ toPlainText()

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

Definition at line 534 of file noteutils.cpp.

◆ uid()

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

Returns the uid of the note.

Definition at line 449 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-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:12:32 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.