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

KAlarm Library

  • KAlarmCal
  • AlarmText
Public Member Functions | Static Public Member Functions | List of all members
KAlarmCal::AlarmText Class Reference

#include <alarmtext.h>

Public Member Functions

 AlarmText (const QString &text=QString())
 
 AlarmText (const AlarmText &other)
 
QString body () const
 
QString cc () const
 
QString description () const
 
QString displayText () const
 
QString due () const
 
QString from () const
 
bool isEmail () const
 
bool isEmpty () const
 
bool isScript () const
 
bool isTodo () const
 
unsigned long kmailSerialNumber () const
 
QString location () const
 
AlarmText & operator= (const AlarmText &other)
 
void setEmail (const QString &to, const QString &from, const QString &cc, const QString &time, const QString &subject, const QString &body, unsigned long kmailSerialNumber=0)
 
void setScript (const QString &text)
 
void setText (const QString &text)
 
void setTodo (const KCalCore::Todo::Ptr &todo)
 
QString subject () const
 
QString summary () const
 
QString time () const
 
QString to () const
 

Static Public Member Functions

static bool checkIfEmail (const QString &text)
 
static QString emailHeaders (const QString &text, bool subjectOnly)
 
static QString fromCalendarText (const QString &text, bool &email)
 
static QString summary (const KAEvent &event, int maxLines=1, bool *truncated=0)
 
static QString toCalendarText (const QString &text)
 

Detailed Description

Parses email, todo and script alarm texts.

This class parses email, todo and script texts, enabling drag and drop of these items to be recognised and interpreted. It also holds plain alarm texts.

  • Email texts must contain headers (To, From, etc.) in normal RFC format.
  • Todos should be in iCalendar format.
  • Scripts are assumed if the alarm text starts with '#!'.
Author
David Jarvie djarv.nosp@m.ie@k.nosp@m.de.or.nosp@m.g

Definition at line 55 of file alarmtext.h.

Constructor & Destructor Documentation

KAlarmCal::AlarmText::AlarmText ( const QString &  text = QString())
explicit

Constructor which sets the alarm text.

If text starts with '#!', it is flagged as a script, else plain text.

Parameters
textalarm text to set

Definition at line 106 of file alarmtext.cpp.

Member Function Documentation

QString KAlarmCal::AlarmText::body ( ) const

Return the email message body.

Returns
message body, or empty if not an email text.

Definition at line 256 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::cc ( ) const

Return the 'Cc' header parameter for an email alarm.

Returns
'cc' value, or empty if not an email text.

Definition at line 241 of file alarmtext.cpp.

bool KAlarmCal::AlarmText::checkIfEmail ( const QString &  text)
static

Return whether a text is an email, with at least To and From headers.

Parameters
texttext to check

Definition at line 388 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::description ( ) const

Return the description text for a todo.

Returns
description text, or empty if not a todo.

Definition at line 276 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::displayText ( ) const

Return the text for a text message alarm, in display format.

  • An email is returned as a sequence of headers followed by the message body.
  • A todo is returned as a subject, location and due date followed by any text.
  • A script or plain text is returned without interpretation.

Definition at line 183 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::due ( ) const

Return the due date text for a todo.

Returns
due date text, or empty if not a todo.

Definition at line 271 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::emailHeaders ( const QString &  text,
bool  subjectOnly 
)
static

Check whether a text is an email (with at least To and From headers), and if so return its headers or optionally only its subject line.

Parameters
texttext to check
subjectOnlytrue to only return the subject line, false to return all headers
Returns
headers/subject line, or QString() if not the text of an email.

Definition at line 399 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::from ( ) const

Return the 'From' header parameter for an email alarm.

Returns
'from' value, or empty if not an email text.

Definition at line 236 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::fromCalendarText ( const QString &  text,
bool &  email 
)
static

Translate an alarm calendar text to a display text.

Translation is needed for email texts, since the alarm calendar stores untranslated email prefixes.

Parameters
texttext to translate
emailupdated to indicate whether it is an email text

Definition at line 422 of file alarmtext.cpp.

bool KAlarmCal::AlarmText::isEmail ( ) const

Return whether the instance contains the text of an email.

Definition at line 293 of file alarmtext.cpp.

bool KAlarmCal::AlarmText::isEmpty ( ) const

Return whether there is any text.

Definition at line 284 of file alarmtext.cpp.

bool KAlarmCal::AlarmText::isScript ( ) const

Return whether the instance contains the text of a script.

Definition at line 298 of file alarmtext.cpp.

bool KAlarmCal::AlarmText::isTodo ( ) const

Return whether the instance contains the text of a todo.

Definition at line 303 of file alarmtext.cpp.

unsigned long KAlarmCal::AlarmText::kmailSerialNumber ( ) const

Return the kmail serial number of an email.

Returns
serial number, or 0 if none.

Definition at line 308 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::location ( ) const

Return the location text for a todo.

Returns
location text, or empty if not a todo.

Definition at line 266 of file alarmtext.cpp.

void KAlarmCal::AlarmText::setEmail ( const QString &  to,
const QString &  from,
const QString &  cc,
const QString &  time,
const QString &  subject,
const QString &  body,
unsigned long  kmailSerialNumber = 0 
)

Set the instance contents to be an email.

Parameters
to'To' header parameter
from'From' header parameter
cc'Cc' header parameter
time'Date' header parameter
subject'Subject' header parameter
bodyemail body text

Definition at line 144 of file alarmtext.cpp.

void KAlarmCal::AlarmText::setScript ( const QString &  text)

Set the instance contents to be a script.

Parameters
texttext of script to set

Definition at line 138 of file alarmtext.cpp.

void KAlarmCal::AlarmText::setText ( const QString &  text)

Set the alarm text.

If text starts with '#!', it is flagged as a script, else plain text.

Parameters
textalarm text to set

Definition at line 130 of file alarmtext.cpp.

void KAlarmCal::AlarmText::setTodo ( const KCalCore::Todo::Ptr &  todo)

Set the instance contents to be a todo.

Parameters
todoTodo instance to set as the text

Definition at line 159 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::subject ( ) const

Return the 'Subject' header parameter for an email alarm.

Returns
'subject' value, or empty if not an email text.

Definition at line 251 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::summary ( ) const

Return the summary text for a todo.

Returns
summary text, or empty if not a todo.

Definition at line 261 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::summary ( const KAEvent &  event,
int  maxLines = 1,
bool *  truncated = 0 
)
static

Return the alarm summary text for either single line or tooltip display.

Parameters
eventevent whose summary text is to be returned
maxLinesthe maximum number of lines returned
truncatedif non-null, points to a variable which will be set true if the text returned has been truncated, other than to strip a trailing newline, or false otherwise

Definition at line 319 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::time ( ) const

Return the 'Date' header parameter for an email alarm.

Returns
'date' value, or empty if not an email text.

Definition at line 246 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::to ( ) const

Return the 'To' header parameter for an email alarm.

Returns
'from' value, or empty if not an email text.

Definition at line 231 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::toCalendarText ( const QString &  text)
static

Return the text for an alarm message text, in alarm calendar format.

(The prefix strings are untranslated in the calendar.)

Parameters
textalarm message text

Definition at line 462 of file alarmtext.cpp.


The documentation for this class was generated from the following files:
  • alarmtext.h
  • alarmtext.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KAlarm Library

Skip menu "KAlarm Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

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