kalarm

alarmtext.h

00001 /*
00002  *  alarmtext.h  -  text/email alarm text conversion
00003  *  Program:  kalarm
00004  *  Copyright (C) 2004, 2005 by David Jarvie <software@astrojar.org.uk>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef ALARMTEXT_H
00022 #define ALARMTEXT_H
00023 
00024 #include <qstring.h>
00025 class QStringList;
00026 class KAEvent;
00027 
00028 
00029 class AlarmText
00030 {
00031     public:
00032         AlarmText(const QString& text = QString::null)  { setText(text); }
00033         void           setText(const QString&);
00034         void           setScript(const QString& text)   { setText(text);  mIsScript = true; }
00035         void           setEmail(const QString& to, const QString& from, const QString& cc, const QString& time,
00036                                 const QString& subject, const QString& body, unsigned long kmailSerialNumber = 0);
00037         QString        displayText() const;
00038         QString        calendarText() const;
00039         QString        to() const                 { return mTo; }
00040         QString        from() const               { return mFrom; }
00041         QString        cc() const                 { return mCc; }
00042         QString        time() const               { return mTime; }
00043         QString        subject() const            { return mSubject; }
00044         QString        body() const               { return mIsEmail ? mBody : QString::null; }
00045         bool           isEmpty() const;
00046         bool           isEmail() const            { return mIsEmail; }
00047         bool           isScript() const           { return mIsScript; }
00048         unsigned long  kmailSerialNumber() const  { return mKMailSerialNum; }
00049         static QString summary(const KAEvent&, int maxLines = 1, bool* truncated = 0);
00050         static bool    checkIfEmail(const QString&);
00051         static QString emailHeaders(const QString&, bool subjectOnly);
00052         static QString fromCalendarText(const QString&, bool& email);
00053         static QString toCalendarText(const QString&);
00054 
00055     private:
00056         static void    setUpTranslations();
00057         static int     emailHeaderCount(const QStringList&);
00058 
00059         static QString mFromPrefix;       // translated header prefixes
00060         static QString mToPrefix;
00061         static QString mCcPrefix;
00062         static QString mDatePrefix;
00063         static QString mSubjectPrefix;
00064         static QString mFromPrefixEn;     // untranslated header prefixes
00065         static QString mToPrefixEn;
00066         static QString mCcPrefixEn;
00067         static QString mDatePrefixEn;
00068         static QString mSubjectPrefixEn;
00069         QString        mBody, mFrom, mTo, mCc, mTime, mSubject;
00070         unsigned long  mKMailSerialNum;   // if email, message's KMail serial number, else 0
00071         bool           mIsEmail;
00072         bool           mIsScript;
00073 };
00074 
00075 #endif // ALARMTEXT_H
KDE Home | KDE Accessibility Home | Description of Access Keys