KAlarmCal::AlarmText

Search for usage in LXR

#include <alarmtext.h>

Public Member Functions

 AlarmText (const QString &text=QString())
 
 AlarmText (const AlarmText &other)
 
Akonadi::Item::Id akonadiItemId () const
 
QString body () const
 
QString cc () const
 
void clear ()
 
QString description () const
 
QString displayText () const
 
QString due () const
 
QString from () const
 
bool isEmail () const
 
bool isEmpty () const
 
bool isScript () const
 
bool isTodo () const
 
QString location () const
 
AlarmTextoperator= (const AlarmText &other)
 
void setEmail (const QString &to, const QString &from, const QString &cc, const QString &time, const QString &subject, const QString &body, Akonadi::Item::Id itemId=-1)
 
void setScript (const QString &text)
 
void setText (const QString &text)
 
void setTodo (const KCalendarCore::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=nullptr)
 
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[email protected][email protected][email protected]de.or[email protected]g

Definition at line 37 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 90 of file alarmtext.cpp.

Member Function Documentation

Akonadi::Item::Id KAlarmCal::AlarmText::akonadiItemId ( ) const

Return the Akonadi item ID of an email.

Returns
Item ID, or -1 if none.

Definition at line 298 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::body ( ) const

Return the email message body.

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

Definition at line 244 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 229 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 381 of file alarmtext.cpp.

void KAlarmCal::AlarmText::clear ( )

Initialise the instance to an empty state.

Definition at line 115 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 264 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 168 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 259 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 392 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 224 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 416 of file alarmtext.cpp.

bool KAlarmCal::AlarmText::isEmail ( ) const

Return whether the instance contains the text of an email.

Definition at line 283 of file alarmtext.cpp.

bool KAlarmCal::AlarmText::isEmpty ( ) const

Return whether the instance has any contents.

Definition at line 272 of file alarmtext.cpp.

bool KAlarmCal::AlarmText::isScript ( ) const

Return whether the instance contains the text of a script.

Definition at line 288 of file alarmtext.cpp.

bool KAlarmCal::AlarmText::isTodo ( ) const

Return whether the instance contains the text of a todo.

Definition at line 293 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 254 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,
Akonadi::Item::Id  itemId = -1 
)

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
itemIdAkonadi item ID of the email.

Definition at line 135 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 129 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 120 of file alarmtext.cpp.

void KAlarmCal::AlarmText::setTodo ( const KCalendarCore::Todo::Ptr todo)

Set the instance contents to be a todo.

Parameters
todoTodo instance to set as the text

Definition at line 149 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 239 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 249 of file alarmtext.cpp.

QString KAlarmCal::AlarmText::summary ( const KAEvent event,
int  maxLines = 1,
bool *  truncated = nullptr 
)
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 309 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 234 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 219 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 457 of file alarmtext.cpp.


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

KDE's Doxygen guidelines are available online.