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:171
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 170 of file noteutils.h.

Member Enumeration Documentation

◆ Classification

enum Akonadi::NoteUtils::NoteMessageWrapper::Classification

Definition at line 188 of file noteutils.h.

Constructor & Destructor Documentation

◆ NoteMessageWrapper() [1/2]

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

Definition at line 356 of file noteutils.cpp.

◆ NoteMessageWrapper() [2/2]

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

Definition at line 361 of file noteutils.cpp.

Member Function Documentation

◆ attachments()

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

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

Definition at line 549 of file noteutils.cpp.

◆ classification()

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

Returns the classification of the note.

Definition at line 462 of file noteutils.cpp.

◆ creationDate()

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

Returns the creation date of the note.

Definition at line 486 of file noteutils.cpp.

◆ custom()

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

Returns a reference to the custom-value map.

Returns
key-value map containing all custom values

Definition at line 555 of file noteutils.cpp.

◆ from()

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

Returns the origin (creator) of the note.

Definition at line 498 of file noteutils.cpp.

◆ lastModifiedDate()

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

Returns the lastModified-date of the note.

Definition at line 474 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 368 of file noteutils.cpp.

◆ setClassification()

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

Set the classification of the note.

Definition at line 456 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 480 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 492 of file noteutils.cpp.

◆ setLastModifiedDate()

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

Set the lastModified-date of the note.

Definition at line 468 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 516 of file noteutils.cpp.

◆ setTitle()

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

Set the title of the note.

Definition at line 504 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 444 of file noteutils.cpp.

◆ text()

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

Returns the text of the note.

Definition at line 523 of file noteutils.cpp.

◆ textFormat()

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

Definition at line 529 of file noteutils.cpp.

◆ title()

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

Returns the title of the note.

Definition at line 510 of file noteutils.cpp.

◆ toPlainText()

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

Definition at line 535 of file noteutils.cpp.

◆ uid()

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

Returns the uid of the note.

Definition at line 450 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 Mon Nov 4 2024 16:38:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.