KAlarm Library
#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 '#!'.
Definition at line 56 of file alarmtext.h.
Constructor & Destructor Documentation
|
explicit |
Constructor which sets the alarm text.
If text
starts with '#!', it is flagged as a script, else plain text.
- Parameters
-
text alarm text to set.
Definition at line 97 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 247 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 232 of file alarmtext.cpp.
|
static |
Return whether a text is an email, with at least To and From headers.
- Parameters
-
text text to check.
Definition at line 379 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 267 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 174 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 262 of file alarmtext.cpp.
|
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
-
text text to check subjectOnly true 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 390 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 227 of file alarmtext.cpp.
|
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
-
text text to translate email updated to indicate whether it is an email text.
Definition at line 413 of file alarmtext.cpp.
bool KAlarmCal::AlarmText::isEmail | ( | ) | const |
Return whether the instance contains the text of an email.
Definition at line 284 of file alarmtext.cpp.
bool KAlarmCal::AlarmText::isEmpty | ( | ) | const |
Return whether there is any text.
Definition at line 275 of file alarmtext.cpp.
bool KAlarmCal::AlarmText::isScript | ( | ) | const |
Return whether the instance contains the text of a script.
Definition at line 289 of file alarmtext.cpp.
bool KAlarmCal::AlarmText::isTodo | ( | ) | const |
Return whether the instance contains the text of a todo.
Definition at line 294 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 299 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 257 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 body email body text
Definition at line 135 of file alarmtext.cpp.
void KAlarmCal::AlarmText::setScript | ( | const QString & | text | ) |
Set the instance contents to be a script.
- Parameters
-
text text 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.
Definition at line 121 of file alarmtext.cpp.
void KAlarmCal::AlarmText::setTodo | ( | const KCalCore::Todo::Ptr & | todo | ) |
Set the instance contents to be a todo.
- Parameters
-
todo Todo instance to set as the text
Definition at line 150 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 242 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 252 of file alarmtext.cpp.
|
static |
Return the alarm summary text for either single line or tooltip display.
- Parameters
-
event event whose summary text is to be returned maxLines the maximum number of lines returned truncated if 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 310 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 237 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 222 of file alarmtext.cpp.
|
static |
Return the text for an alarm message text, in alarm calendar format.
(The prefix strings are untranslated in the calendar.)
- Parameters
-
text alarm message text.
Definition at line 453 of file alarmtext.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:30:15 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.