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

KAlarm Library

  • sources
  • kde-4.14
  • kdepimlibs
  • kalarmcal
alarmtext.cpp
1 /*
2  * alarmtext.cpp - text/email alarm text conversion
3  * This file is part of kalarmcal library, which provides access to KAlarm
4  * calendar data.
5  * Copyright © 2004,2005,2007-2013 by David Jarvie <djarvie@kde.org>
6  *
7  * This library is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Library General Public License as published
9  * by the Free Software Foundation; either version 2 of the License, or (at
10  * your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to the
19  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301, USA.
21  */
22 
23 #include "alarmtext.h"
24 
25 #include "kaevent.h"
26 
27 #ifdef KALARMCAL_USE_KRESOURCES
28 #include <kcal/todo.h>
29 #endif
30 #include <klocale.h>
31 #include <klocalizedstring.h>
32 #include <kglobal.h>
33 #include <QStringList>
34 
35 namespace
36 {
37 const int MAIL_FROM_LINE = 0; // line number containing From in email text
38 const int MAIL_TO_LINE = 1; // line number containing To in email text
39 const int MAIL_CC_LINE = 2; // line number containing CC in email text
40 const int MAIL_MIN_LINES = 4; // allow for From, To, no CC, Date, Subject
41 }
42 
43 namespace KAlarmCal
44 {
45 
46 class AlarmText::Private
47 {
48  public:
49  enum Type { None, Email, Script, Todo };
50  QString displayText() const;
51  void clear();
52  static void initialise();
53  static void setUpTranslations();
54  static int emailHeaderCount(const QStringList&);
55  static QString todoTitle(const QString& text);
56 
57  static QString mFromPrefix; // translated header prefixes
58  static QString mToPrefix;
59  static QString mCcPrefix;
60  static QString mDatePrefix;
61  static QString mSubjectPrefix;
62  static QString mTitlePrefix;
63  static QString mLocnPrefix;
64  static QString mDuePrefix;
65  static QString mFromPrefixEn; // untranslated header prefixes
66  static QString mToPrefixEn;
67  static QString mCcPrefixEn;
68  static QString mDatePrefixEn;
69  static QString mSubjectPrefixEn;
70  static bool mInitialised;
71 
72  QString mBody, mFrom, mTo, mCc, mTime, mSubject;
73  unsigned long mKMailSerialNum; // if email, message's KMail serial number, else 0
74  Type mType;
75  bool mIsEmail;
76 };
77 
78 QString AlarmText::Private::mFromPrefix;
79 QString AlarmText::Private::mToPrefix;
80 QString AlarmText::Private::mCcPrefix;
81 QString AlarmText::Private::mDatePrefix;
82 QString AlarmText::Private::mSubjectPrefix;
83 QString AlarmText::Private::mTitlePrefix;
84 QString AlarmText::Private::mLocnPrefix;
85 QString AlarmText::Private::mDuePrefix;
86 QString AlarmText::Private::mFromPrefixEn;
87 QString AlarmText::Private::mToPrefixEn;
88 QString AlarmText::Private::mCcPrefixEn;
89 QString AlarmText::Private::mDatePrefixEn;
90 QString AlarmText::Private::mSubjectPrefixEn;
91 bool AlarmText::Private::mInitialised = false;
92 
93 void AlarmText::Private::initialise()
94 {
95  if (!mInitialised)
96  {
97  mInitialised = true;
98  mFromPrefixEn = QLatin1String("From:");
99  mToPrefixEn = QLatin1String("To:");
100  mCcPrefixEn = QLatin1String("Cc:");
101  mDatePrefixEn = QLatin1String("Date:");
102  mSubjectPrefixEn = QLatin1String("Subject:");
103  }
104 }
105 
106 AlarmText::AlarmText(const QString& text)
107  : d(new Private)
108 {
109  Private::initialise();
110  setText(text);
111 }
112 
113 AlarmText::AlarmText(const AlarmText& other)
114  : d(new Private(*other.d))
115 {
116 }
117 
118 AlarmText::~AlarmText()
119 {
120  delete d;
121 }
122 
123 AlarmText& AlarmText::operator=(const AlarmText& other)
124 {
125  if (&other != this)
126  *d = *other.d;
127  return *this;
128 }
129 
130 void AlarmText::setText(const QString& text)
131 {
132  d->clear();
133  d->mBody = text;
134  if (text.startsWith(QLatin1String("#!")))
135  d->mType = Private::Script;
136 }
137 
138 void AlarmText::setScript(const QString& text)
139 {
140  setText(text);
141  d->mType = Private::Script;
142 }
143 
144 void AlarmText::setEmail(const QString& to, const QString& from, const QString& cc, const QString& time,
145  const QString& subject, const QString& body, unsigned long kmailSerialNumber)
146 {
147  d->clear();
148  d->mType = Private::Email;
149  d->mTo = to;
150  d->mFrom = from;
151  d->mCc = cc;
152  d->mTime = time;
153  d->mSubject = subject;
154  d->mBody = body;
155  d->mKMailSerialNum = kmailSerialNumber;
156 }
157 
158 #ifndef KALARMCAL_USE_KRESOURCES
159 void AlarmText::setTodo(const KCalCore::Todo::Ptr& todo)
160 #else
161 void AlarmText::setTodo(const KCal::Todo* todo)
162 #endif
163 {
164  d->clear();
165  d->mType = Private::Todo;
166  d->mSubject = todo->summary();
167  d->mBody = todo->description();
168  d->mTo = todo->location();
169  if (todo->hasDueDate())
170  {
171  KDateTime due = todo->dtDue(false); // fetch the next due date
172  if (todo->hasStartDate() && todo->dtStart() != due)
173  {
174  d->mTime = todo->allDay() ? KGlobal::locale()->formatDate(due.date(), KLocale::ShortDate)
175  : KGlobal::locale()->formatDateTime(due.dateTime());
176  }
177  }
178 }
179 
180 /******************************************************************************
181 * Return the text for a text message alarm, in display format.
182 */
183 QString AlarmText::displayText() const
184 {
185  return d->displayText();
186 }
187 
188 QString AlarmText::Private::displayText() const
189 {
190  QString text;
191  switch (mType)
192  {
193  case Email:
194  // Format the email into a text alarm
195  setUpTranslations();
196  text = mFromPrefix + QLatin1Char('\t') + mFrom + QLatin1Char('\n');
197  text += mToPrefix + QLatin1Char('\t') + mTo + QLatin1Char('\n');
198  if (!mCc.isEmpty())
199  text += mCcPrefix + QLatin1Char('\t') + mCc + QLatin1Char('\n');
200  if (!mTime.isEmpty())
201  text += mDatePrefix + QLatin1Char('\t') + mTime + QLatin1Char('\n');
202  text += mSubjectPrefix + QLatin1Char('\t') + mSubject;
203  if (!mBody.isEmpty())
204  {
205  text += QLatin1String("\n\n");
206  text += mBody;
207  }
208  break;
209  case Todo:
210  // Format the todo into a text alarm
211  setUpTranslations();
212  if (!mSubject.isEmpty())
213  text = mTitlePrefix + QLatin1Char('\t') + mSubject + QLatin1Char('\n');
214  if (!mTo.isEmpty())
215  text += mLocnPrefix + QLatin1Char('\t') + mTo + QLatin1Char('\n');
216  if (!mTime.isEmpty())
217  text += mDuePrefix + QLatin1Char('\t') + mTime + QLatin1Char('\n');
218  if (!mBody.isEmpty())
219  {
220  if (!text.isEmpty())
221  text += QLatin1Char('\n');
222  text += mBody;
223  }
224  break;
225  default:
226  break;
227  }
228  return !text.isEmpty() ? text : mBody;
229 }
230 
231 QString AlarmText::to() const
232 {
233  return (d->mType == Private::Email) ? d->mTo : QString();
234 }
235 
236 QString AlarmText::from() const
237 {
238  return (d->mType == Private::Email) ? d->mFrom : QString();
239 }
240 
241 QString AlarmText::cc() const
242 {
243  return (d->mType == Private::Email) ? d->mCc : QString();
244 }
245 
246 QString AlarmText::time() const
247 {
248  return (d->mType == Private::Email) ? d->mTime : QString();
249 }
250 
251 QString AlarmText::subject() const
252 {
253  return (d->mType == Private::Email) ? d->mSubject : QString();
254 }
255 
256 QString AlarmText::body() const
257 {
258  return (d->mType == Private::Email) ? d->mBody : QString();
259 }
260 
261 QString AlarmText::summary() const
262 {
263  return (d->mType == Private::Todo) ? d->mSubject : QString();
264 }
265 
266 QString AlarmText::location() const
267 {
268  return (d->mType == Private::Todo) ? d->mTo : QString();
269 }
270 
271 QString AlarmText::due() const
272 {
273  return (d->mType == Private::Todo) ? d->mTime : QString();
274 }
275 
276 QString AlarmText::description() const
277 {
278  return (d->mType == Private::Todo) ? d->mBody : QString();
279 }
280 
281 /******************************************************************************
282 * Return whether there is any text.
283 */
284 bool AlarmText::isEmpty() const
285 {
286  if (!d->mBody.isEmpty())
287  return false;
288  if (d->mType != Private::Email)
289  return true;
290  return d->mFrom.isEmpty() && d->mTo.isEmpty() && d->mCc.isEmpty() && d->mTime.isEmpty() && d->mSubject.isEmpty();
291 }
292 
293 bool AlarmText::isEmail() const
294 {
295  return d->mType == Private::Email;
296 }
297 
298 bool AlarmText::isScript() const
299 {
300  return d->mType == Private::Script;
301 }
302 
303 bool AlarmText::isTodo() const
304 {
305  return d->mType == Private::Todo;
306 }
307 
308 unsigned long AlarmText::kmailSerialNumber() const
309 {
310  return d->mKMailSerialNum;
311 }
312 
313 /******************************************************************************
314 * Return the alarm summary text for either single line or tooltip display.
315 * The maximum number of line returned is determined by 'maxLines'.
316 * If 'truncated' is non-null, it will be set true if the text returned has been
317 * truncated, other than to strip a trailing newline.
318 */
319 QString AlarmText::summary(const KAEvent& event, int maxLines, bool* truncated)
320 {
321  static const QRegExp localfile(QLatin1String("^file:/+"));
322  QString text;
323  switch (event.actionSubType())
324  {
325  case KAEvent::AUDIO:
326  text = event.audioFile();
327  if (localfile.indexIn(text) >= 0)
328  text = text.mid(localfile.matchedLength() - 1);
329  break;
330  case KAEvent::EMAIL:
331  text = event.emailSubject();
332  break;
333  case KAEvent::COMMAND:
334  text = event.cleanText();
335  if (localfile.indexIn(text) >= 0)
336  text = text.mid(localfile.matchedLength() - 1);
337  break;
338  case KAEvent::FILE:
339  text = event.cleanText();
340  break;
341  case KAEvent::MESSAGE:
342  {
343  text = event.cleanText();
344  // If the message is the text of an email, return its headers or just subject line
345  QString subject = emailHeaders(text, (maxLines <= 1));
346  if (!subject.isNull())
347  {
348  if (truncated)
349  *truncated = true;
350  return subject;
351  }
352  if (maxLines == 1)
353  {
354  // If the message is the text of a todo, return either the
355  // title/description or the whole text.
356  subject = Private::todoTitle(text);
357  if (!subject.isEmpty())
358  {
359  if (truncated)
360  *truncated = true;
361  return subject;
362  }
363  }
364  break;
365  }
366  }
367  if (truncated)
368  *truncated = false;
369  if (text.count(QLatin1Char('\n')) < maxLines)
370  return text;
371  int newline = -1;
372  for (int i = 0; i < maxLines; ++i)
373  {
374  newline = text.indexOf(QLatin1Char('\n'), newline + 1);
375  if (newline < 0)
376  return text; // not truncated after all !?!
377  }
378  if (newline == static_cast<int>(text.length()) - 1)
379  return text.left(newline); // text ends in newline
380  if (truncated)
381  *truncated = true;
382  return text.left(newline + (maxLines <= 1 ? 0 : 1)) + QLatin1String("...");
383 }
384 
385 /******************************************************************************
386 * Check whether a text is an email.
387 */
388 bool AlarmText::checkIfEmail(const QString& text)
389 {
390  const QStringList lines = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
391  return Private::emailHeaderCount(lines);
392 }
393 
394 /******************************************************************************
395 * Check whether a text is an email, and if so return its headers or optionally
396 * only its subject line.
397 * Reply = headers/subject line, or QString() if not the text of an email.
398 */
399 QString AlarmText::emailHeaders(const QString& text, bool subjectOnly)
400 {
401  const QStringList lines = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
402  const int n = Private::emailHeaderCount(lines);
403  if (!n)
404  return QString();
405  if (subjectOnly)
406  return lines[n-1].mid(Private::mSubjectPrefix.length()).trimmed();
407  QString h = lines[0];
408  for (int i = 1; i < n; ++i)
409  {
410  h += QLatin1Char('\n');
411  h += lines[i];
412  }
413  return h;
414 }
415 
416 /******************************************************************************
417 * Translate an alarm calendar text to a display text.
418 * Translation is needed for email texts, since the alarm calendar stores
419 * untranslated email prefixes.
420 * 'email' is set to indicate whether it is an email text.
421 */
422 QString AlarmText::fromCalendarText(const QString& text, bool& email)
423 {
424  Private::initialise();
425  const QStringList lines = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
426  const int maxn = lines.count();
427  if (maxn >= MAIL_MIN_LINES
428  && lines[MAIL_FROM_LINE].startsWith(Private::mFromPrefixEn)
429  && lines[MAIL_TO_LINE].startsWith(Private::mToPrefixEn))
430  {
431  int n = MAIL_CC_LINE;
432  if (lines[MAIL_CC_LINE].startsWith(Private::mCcPrefixEn))
433  ++n;
434  if (maxn > n + 1
435  && lines[n].startsWith(Private::mDatePrefixEn)
436  && lines[n+1].startsWith(Private::mSubjectPrefixEn))
437  {
438  Private::setUpTranslations();
439  QString dispText;
440  dispText = Private::mFromPrefix + lines[MAIL_FROM_LINE].mid(Private::mFromPrefixEn.length()) + QLatin1Char('\n');
441  dispText += Private::mToPrefix + lines[MAIL_TO_LINE].mid(Private::mToPrefixEn.length()) + QLatin1Char('\n');
442  if (n > MAIL_CC_LINE)
443  dispText += Private::mCcPrefix + lines[MAIL_CC_LINE].mid(Private::mCcPrefixEn.length()) + QLatin1Char('\n');
444  dispText += Private::mDatePrefix + lines[n].mid(Private::mDatePrefixEn.length()) + QLatin1Char('\n');
445  dispText += Private::mSubjectPrefix + lines[n+1].mid(Private::mSubjectPrefixEn.length());
446  int i = text.indexOf(Private::mSubjectPrefixEn);
447  i = text.indexOf(QLatin1Char('\n'), i);
448  if (i > 0)
449  dispText += text.mid(i);
450  email = true;
451  return dispText;
452  }
453  }
454  email = false;
455  return text;
456 }
457 
458 /******************************************************************************
459 * Return the text for a text message alarm, in alarm calendar format.
460 * (The prefix strings are untranslated in the calendar.)
461 */
462 QString AlarmText::toCalendarText(const QString& text)
463 {
464  Private::setUpTranslations();
465  const QStringList lines = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
466  const int maxn = lines.count();
467  if (maxn >= MAIL_MIN_LINES
468  && lines[MAIL_FROM_LINE].startsWith(Private::mFromPrefix)
469  && lines[MAIL_TO_LINE].startsWith(Private::mToPrefix))
470  {
471  int n = MAIL_CC_LINE;
472  if (lines[MAIL_CC_LINE].startsWith(Private::mCcPrefix))
473  ++n;
474  if (maxn > n + 1
475  && lines[n].startsWith(Private::mDatePrefix)
476  && lines[n+1].startsWith(Private::mSubjectPrefix))
477  {
478  // Format the email into a text alarm
479  QString calText;
480  calText = Private::mFromPrefixEn + lines[MAIL_FROM_LINE].mid(Private::mFromPrefix.length()) + QLatin1Char('\n');
481  calText += Private::mToPrefixEn + lines[MAIL_TO_LINE].mid(Private::mToPrefix.length()) + QLatin1Char('\n');
482  if (n > MAIL_CC_LINE)
483  calText += Private::mCcPrefixEn + lines[MAIL_CC_LINE].mid(Private::mCcPrefix.length()) + QLatin1Char('\n');
484  calText += Private::mDatePrefixEn + lines[n].mid(Private::mDatePrefix.length()) + QLatin1Char('\n');
485  calText += Private::mSubjectPrefixEn + lines[n+1].mid(Private::mSubjectPrefix.length());
486  int i = text.indexOf(Private::mSubjectPrefix);
487  i = text.indexOf(QLatin1Char('\n'), i);
488  if (i > 0)
489  calText += text.mid(i);
490  return calText;
491  }
492  }
493  return text;
494 }
495 
496 void AlarmText::Private::clear()
497 {
498  mType = None;
499  mBody.clear();
500  mTo.clear();
501  mFrom.clear();
502  mCc.clear();
503  mTime.clear();
504  mSubject.clear();
505  mKMailSerialNum = 0;
506 }
507 
508 /******************************************************************************
509 * Set up messages used by executeDropEvent() and emailHeaders().
510 */
511 void AlarmText::Private::setUpTranslations()
512 {
513  initialise();
514  if (mFromPrefix.isNull())
515  {
516  mFromPrefix = i18nc("@info/plain 'From' email address", "From:");
517  mToPrefix = i18nc("@info/plain Email addressee", "To:");
518  mCcPrefix = i18nc("@info/plain Copy-to in email headers", "Cc:");
519  mDatePrefix = i18nc("@info/plain", "Date:");
520  mSubjectPrefix = i18nc("@info/plain Email subject", "Subject:");
521  // Todo prefixes
522  mTitlePrefix = i18nc("@info/plain Todo calendar item's title field", "To-do:");
523  mLocnPrefix = i18nc("@info/plain Todo calendar item's location field", "Location:");
524  mDuePrefix = i18nc("@info/plain Todo calendar item's due date/time", "Due:");
525  }
526 }
527 
528 /******************************************************************************
529 * Check whether a text is an email.
530 * Reply = number of email header lines, or 0 if not an email.
531 */
532 int AlarmText::Private::emailHeaderCount(const QStringList& lines)
533 {
534  setUpTranslations();
535  const int maxn = lines.count();
536  if (maxn >= MAIL_MIN_LINES
537  && lines[MAIL_FROM_LINE].startsWith(mFromPrefix)
538  && lines[MAIL_TO_LINE].startsWith(mToPrefix))
539  {
540  int n = MAIL_CC_LINE;
541  if (lines[MAIL_CC_LINE].startsWith(mCcPrefix))
542  ++n;
543  if (maxn > n + 1
544  && lines[n].startsWith(mDatePrefix)
545  && lines[n+1].startsWith(mSubjectPrefix))
546  return n+2;
547  }
548  return 0;
549 }
550 
551 /******************************************************************************
552 * Return the Todo title line, if the text is for a Todo.
553 */
554 QString AlarmText::Private::todoTitle(const QString& text)
555 {
556  setUpTranslations();
557  const QStringList lines = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
558  int n;
559  for (n = 0; n < lines.count() && lines[n].contains(QLatin1Char('\t')); ++n) ;
560  if (!n || n > 3)
561  return QString();
562  QString title;
563  int i = 0;
564  if (lines[i].startsWith(mTitlePrefix + QLatin1Char('\t')))
565  {
566  title = lines[i].mid(mTitlePrefix.length()).trimmed();
567  ++i;
568  }
569  if (i < n && lines[i].startsWith(mLocnPrefix + QLatin1Char('\t')))
570  ++i;
571  if (i < n && lines[i].startsWith(mDuePrefix + QLatin1Char('\t')))
572  ++i;
573  if (i == n)
574  {
575  // It's a Todo text
576  if (!title.isEmpty())
577  return title;
578  if (n < lines.count())
579  return lines[n];
580  }
581  return QString();
582 }
583 
584 } // namespace KAlarmCal
585 
586 // vim: et sw=4:
QString::indexOf
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
KAlarmCal::AlarmText::summary
QString summary() const
Return the summary text for a todo.
Definition: alarmtext.cpp:261
QString::split
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
QStringList::contains
bool contains(const QString &str, Qt::CaseSensitivity cs) const
KAlarmCal::AlarmText::cc
QString cc() const
Return the 'Cc' header parameter for an email alarm.
Definition: alarmtext.cpp:241
KAlarmCal::AlarmText::displayText
QString displayText() const
Return the text for a text message alarm, in display format.
Definition: alarmtext.cpp:183
KAlarmCal::AlarmText::fromCalendarText
static QString fromCalendarText(const QString &text, bool &email)
Translate an alarm calendar text to a display text.
Definition: alarmtext.cpp:422
KAlarmCal::AlarmText::isEmpty
bool isEmpty() const
Return whether there is any text.
Definition: alarmtext.cpp:284
KAlarmCal::AlarmText::subject
QString subject() const
Return the 'Subject' header parameter for an email alarm.
Definition: alarmtext.cpp:251
KAlarmCal::KAEvent::COMMAND
execute a command
Definition: kaevent.h:260
KAlarmCal::AlarmText::location
QString location() const
Return the location text for a todo.
Definition: alarmtext.cpp:266
KAlarmCal::AlarmText::time
QString time() const
Return the 'Date' header parameter for an email alarm.
Definition: alarmtext.cpp:246
QString::isNull
bool isNull() const
KAlarmCal::AlarmText::description
QString description() const
Return the description text for a todo.
Definition: alarmtext.cpp:276
QString::clear
void clear()
KAlarmCal::CalEvent::Type
Type
The category of an event, indicated by the middle part of its UID.
Definition: kacalendar.h:155
QRegExp::matchedLength
int matchedLength() const
QRegExp::indexIn
int indexIn(const QString &str, int offset, CaretMode caretMode) const
QRegExp
KAlarmCal::AlarmText::emailHeaders
static QString emailHeaders(const QString &text, bool subjectOnly)
Check whether a text is an email (with at least To and From headers), and if so return its headers or...
Definition: alarmtext.cpp:399
KAlarmCal::AlarmText::isTodo
bool isTodo() const
Return whether the instance contains the text of a todo.
Definition: alarmtext.cpp:303
QList::count
int count(const T &value) const
KAlarmCal::AlarmText::toCalendarText
static QString toCalendarText(const QString &text)
Return the text for an alarm message text, in alarm calendar format.
Definition: alarmtext.cpp:462
QSharedPointer
QString::isEmpty
bool isEmpty() const
KAlarmCal::AlarmText::kmailSerialNumber
unsigned long kmailSerialNumber() const
Return the kmail serial number of an email.
Definition: alarmtext.cpp:308
QString::startsWith
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
KAlarmCal::AlarmText::isScript
bool isScript() const
Return whether the instance contains the text of a script.
Definition: alarmtext.cpp:298
KAlarmCal::KAEvent::AUDIO
play an audio file
Definition: kaevent.h:262
QString
QStringList
KAlarmCal::AlarmText::due
QString due() const
Return the due date text for a todo.
Definition: alarmtext.cpp:271
QLatin1Char
KAlarmCal::AlarmText::setEmail
void 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.
Definition: alarmtext.cpp:144
KAlarmCal::AlarmText::from
QString from() const
Return the 'From' header parameter for an email alarm.
Definition: alarmtext.cpp:236
KAlarmCal::AlarmText
Parses email, todo and script alarm texts.
Definition: alarmtext.h:55
KAlarmCal::KAEvent::FILE
display the contents of a file
Definition: kaevent.h:259
KAlarmCal::KAEvent::EMAIL
send an email
Definition: kaevent.h:261
KAlarmCal::AlarmText::setScript
void setScript(const QString &text)
Set the instance contents to be a script.
Definition: alarmtext.cpp:138
QString::mid
QString mid(int position, int n) const
QLatin1String
QString::count
int count() const
KAlarmCal::KAEvent
KAEvent represents a KAlarm event.
Definition: kaevent.h:210
KAlarmCal::AlarmText::setTodo
void setTodo(const KCalCore::Todo::Ptr &todo)
Set the instance contents to be a todo.
Definition: alarmtext.cpp:159
KAlarmCal::KAEvent::actionSubType
SubAction actionSubType() const
Return the action sub-type of the event's main alarm.
Definition: kaevent.cpp:1987
QList::mid
QList< T > mid(int pos, int length) const
QString::length
int length() const
KAlarmCal::AlarmText::checkIfEmail
static bool checkIfEmail(const QString &text)
Return whether a text is an email, with at least To and From headers.
Definition: alarmtext.cpp:388
QString::left
QString left(int n) const
KAlarmCal::AlarmText::isEmail
bool isEmail() const
Return whether the instance contains the text of an email.
Definition: alarmtext.cpp:293
KAlarmCal::AlarmText::setText
void setText(const QString &text)
Set the alarm text.
Definition: alarmtext.cpp:130
KAlarmCal::AlarmText::AlarmText
AlarmText(const QString &text=QString())
Constructor which sets the alarm text.
Definition: alarmtext.cpp:106
KAlarmCal::AlarmText::body
QString body() const
Return the email message body.
Definition: alarmtext.cpp:256
KAlarmCal::AlarmText::to
QString to() const
Return the 'To' header parameter for an email alarm.
Definition: alarmtext.cpp:231
KAlarmCal::KAEvent::MESSAGE
display a message text
Definition: kaevent.h:258
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