kalarm

alarmtext.h
1/*
2 * alarmtext.h - text/email alarm text conversion
3 * Program: kalarm
4 * Copyright (C) 2004, 2005 by David Jarvie <software@astrojar.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef ALARMTEXT_H
22#define ALARMTEXT_H
23
24#include <tqstring.h>
25class TQStringList;
26class KAEvent;
27
28
29class AlarmText
30{
31 public:
32 AlarmText(const TQString& text = TQString()) { setText(text); }
33 void setText(const TQString&);
34 void setScript(const TQString& text) { setText(text); mIsScript = true; }
35 void setEmail(const TQString& to, const TQString& from, const TQString& cc, const TQString& time,
36 const TQString& subject, const TQString& body, unsigned long kmailSerialNumber = 0);
37 TQString displayText() const;
38 TQString calendarText() const;
39 TQString to() const { return mTo; }
40 TQString from() const { return mFrom; }
41 TQString cc() const { return mCc; }
42 TQString time() const { return mTime; }
43 TQString subject() const { return mSubject; }
44 TQString body() const { return mIsEmail ? mBody : TQString(); }
45 bool isEmpty() const;
46 bool isEmail() const { return mIsEmail; }
47 bool isScript() const { return mIsScript; }
48 unsigned long kmailSerialNumber() const { return mKMailSerialNum; }
49 static TQString summary(const KAEvent&, int maxLines = 1, bool* truncated = 0);
50 static bool checkIfEmail(const TQString&);
51 static TQString emailHeaders(const TQString&, bool subjectOnly);
52 static TQString fromCalendarText(const TQString&, bool& email);
53 static TQString toCalendarText(const TQString&);
54
55 private:
56 static void setUpTranslations();
57 static int emailHeaderCount(const TQStringList&);
58
59 static TQString mFromPrefix; // translated header prefixes
60 static TQString mToPrefix;
61 static TQString mCcPrefix;
62 static TQString mDatePrefix;
63 static TQString mSubjectPrefix;
64 static TQString mFromPrefixEn; // untranslated header prefixes
65 static TQString mToPrefixEn;
66 static TQString mCcPrefixEn;
67 static TQString mDatePrefixEn;
68 static TQString mSubjectPrefixEn;
69 TQString mBody, mFrom, mTo, mCc, mTime, mSubject;
70 unsigned long mKMailSerialNum; // if email, message's KMail serial number, else 0
71 bool mIsEmail;
72 bool mIsScript;
73};
74
75#endif // ALARMTEXT_H
KAEvent corresponds to a KCal::Event instance.
Definition: alarmevent.h:232