libkcal

incidenceformatter.h

00001 /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006     Copyright (c) 2009 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
00007 
00008     This library is free software; you can redistribute it and/or
00009     modify it under the terms of the GNU Library General Public
00010     License as published by the Free Software Foundation; either
00011     version 2 of the License, or (at your option) any later version.
00012 
00013     This library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016     Library General Public License for more details.
00017 
00018     You should have received a copy of the GNU Library General Public License
00019     along with this library; see the file COPYING.LIB.  If not, write to
00020     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021     Boston, MA 02110-1301, USA.
00022 */
00023 #ifndef KCAL_INCIDENCEFORMATTER_H
00024 #define KCAL_INCIDENCEFORMATTER_H
00025 
00026 #include "libkcal_export.h"
00027 
00028 #include <qdatetime.h>
00029 #include <qstring.h>
00030 #include <qstringlist.h>
00031 
00032 namespace KCal {
00033 class Calendar;
00034 class Incidence;
00035 class IncidenceBase;
00036 
00037 class LIBKCAL_EXPORT InvitationFormatterHelper
00038 {
00039   public:
00040     virtual QString generateLinkURL( const QString &id ) { return id; }
00041     virtual QString makeLink( const QString &id, const QString &text );
00042     virtual Calendar *calendar() const { return 0; }
00043 };
00044 
00052 class LIBKCAL_EXPORT IncidenceFormatter
00053 {
00054   public:
00055     static QString KDE_DEPRECATED toolTipString( IncidenceBase *incidence, bool richText = true );
00056     static QString toolTipStr( Calendar *calendar,
00057                                IncidenceBase *incidence,
00058                                const QDate &date=QDate(),
00059                                bool richText = true );
00060     static QString mailBodyString( IncidenceBase *incidencebase );
00061     static QString KDE_DEPRECATED extensiveDisplayString( IncidenceBase *incidence );
00062     static QString extensiveDisplayStr( Calendar *calendar,
00063                                         IncidenceBase *incidence,
00064                                         const QDate &date=QDate() );
00065 
00066     static QString formatICalInvitation( QString invitation, Calendar *mCalendar,
00067                                          InvitationFormatterHelper *helper );
00068     static QString KDE_DEPRECATED formatICalInvitationNoHtml( QString invitation,
00069                                                               Calendar *mCalendar,
00070                                                               InvitationFormatterHelper *helper );
00071     static QString formatICalInvitationNoHtml( QString invitation,
00072                                                Calendar *mCalendar,
00073                                                InvitationFormatterHelper *helper,
00074                                                const QString &sender );
00075 
00076     // Format a TNEF attachment to an HTML mail
00077     static QString formatTNEFInvitation( const QByteArray& tnef,
00078                                          Calendar *mCalendar,
00079                                          InvitationFormatterHelper *helper );
00080     // Transform a TNEF attachment to an iCal or vCard
00081     static QString msTNEFToVPart( const QByteArray& tnef );
00082 
00083     static QString recurrenceString( Incidence *incidence );
00084 
00085     /*
00086       Returns a reminder string computed for the specified Incidence.
00087       Each item of the returning QStringList corresponds to a string
00088       representation of an reminder belonging to this incidence.
00089       @param incidence is a pointer to the Incidence.
00090       @param shortfmt if false, a short version of each reminder is printed;
00091       else a longer version of each reminder is printed.
00092     */
00093     static QStringList reminderStringList( Incidence *incidence, bool shortfmt = true );
00094 
00095     static QString timeToString( const QDateTime &date, bool shortfmt = true );
00096 
00097     static QString dateToString( const QDateTime &date, bool shortfmt = true );
00098 
00099     static QString dateTimeToString( const QDateTime &date,
00100                                      bool dateOnly = false,
00101                                      bool shortfmt = true );
00107     static QString resourceString( Calendar *calendar, Incidence *incidence );
00108 
00114     static QString durationString( Incidence *incidence );
00115 
00116   private:
00117     static QString formatICalInvitationHelper( QString invitation,
00118                                                Calendar *mCalendar,
00119                                                InvitationFormatterHelper *helper,
00120                                                bool noHtmlMode,
00121                                                const QString &sender );
00122     class EventViewerVisitor;
00123     class ScheduleMessageVisitor;
00124     class InvitationHeaderVisitor;
00125     class InvitationBodyVisitor;
00126     class IncidenceCompareVisitor;
00127     class ToolTipVisitor;
00128     class MailBodyVisitor;
00129 };
00130 
00131 }
00132 
00133 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys