• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • Akonadi
  • NoteUtils
  • NoteMessageWrapper
Public Types | Public Member Functions | List of all members
Akonadi::NoteUtils::NoteMessageWrapper Class Reference

#include <noteutils.h>

Public Types

enum  Classification { Public, Private, Confidential }
 

Public Member Functions

 NoteMessageWrapper (const KMime::MessagePtr &)
 
QList< Attachment > & attachments ()
 
Classification classification () const
 
KDateTime creationDate () const
 
QMap< QString, QString > & custom ()
 
QString from () const
 
KDateTime lastModifiedDate () const
 
KMime::MessagePtr message () const
 
void setClassification (Classification)
 
void setCreationDate (const KDateTime &creationDate)
 
void setFrom (const QString &from)
 
void setLastModifiedDate (const KDateTime &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::Message::Ptr 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::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() );
Author
Christian Mollekopf chrig.nosp@m.i_1@.nosp@m.fastm.nosp@m.ail..nosp@m.fm
Since
4.8

Definition at line 145 of file noteutils.h.

Member Function Documentation

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

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

Definition at line 517 of file noteutils.cpp.

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

Returns the classification of the note.

Definition at line 429 of file noteutils.cpp.

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

Returns the creation date of the note.

Definition at line 453 of file noteutils.cpp.

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

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

Returns the origin (creator) of the note.

Definition at line 465 of file noteutils.cpp.

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

Returns the lastModified-date of the note.

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

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

Set the classification of the note.

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

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

Definition at line 459 of file noteutils.cpp.

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

Set the lastModified-date of the note.

Definition at line 435 of file noteutils.cpp.

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

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

Set the title of the note.

Definition at line 471 of file noteutils.cpp.

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

Set the uid of the note.

Parameters
uidshould be globally unique

Definition at line 411 of file noteutils.cpp.

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

Returns the text of the note.

Definition at line 490 of file noteutils.cpp.

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

Definition at line 496 of file noteutils.cpp.

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

Returns the title of the note.

Definition at line 477 of file noteutils.cpp.

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

Definition at line 502 of file noteutils.cpp.

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

Returns the uid of the note.

Definition at line 417 of file noteutils.cpp.


The documentation for this class was generated from the following files:
  • noteutils.h
  • noteutils.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:29 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal