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 KDE_DEPRECATED formatICalInvitationNoHtml( QString invitation,
00072                                                               Calendar *mCalendar,
00073                                                               InvitationFormatterHelper *helper,
00074                                                               const QString &sender );
00075 
00076     static QString formatICalInvitationNoHtml( QString invitation,
00077                                                Calendar *mCalendar,
00078                                                InvitationFormatterHelper *helper,
00079                                                const QString &sender,
00080                                                bool outlookCompareStyle );
00081 
00082     // Format a TNEF attachment to an HTML mail
00083     static QString formatTNEFInvitation( const QByteArray& tnef,
00084                                          Calendar *mCalendar,
00085                                          InvitationFormatterHelper *helper );
00086     // Transform a TNEF attachment to an iCal or vCard
00087     static QString msTNEFToVPart( const QByteArray& tnef );
00088 
00089     static QString recurrenceString( Incidence *incidence );
00090 
00091     /*
00092       Returns a reminder string computed for the specified Incidence.
00093       Each item of the returning QStringList corresponds to a string
00094       representation of an reminder belonging to this incidence.
00095       @param incidence is a pointer to the Incidence.
00096       @param shortfmt if false, a short version of each reminder is printed;
00097       else a longer version of each reminder is printed.
00098     */
00099     static QStringList reminderStringList( Incidence *incidence, bool shortfmt = true );
00100 
00101     static QString timeToString( const QDateTime &date, bool shortfmt = true );
00102 
00103     static QString dateToString( const QDateTime &date, bool shortfmt = true );
00104 
00105     static QString dateTimeToString( const QDateTime &date,
00106                                      bool dateOnly = false,
00107                                      bool shortfmt = true );
00113     static QString resourceString( Calendar *calendar, Incidence *incidence );
00114 
00120     static QString durationString( Incidence *incidence );
00121 
00122   private:
00123     static QString formatICalInvitationHelper( QString invitation,
00124                                                Calendar *mCalendar,
00125                                                InvitationFormatterHelper *helper,
00126                                                bool noHtmlMode,
00127                                                const QString &sender,
00128                                                bool outlookCompareStyle );
00129     class EventViewerVisitor;
00130     class ScheduleMessageVisitor;
00131     class InvitationHeaderVisitor;
00132     class InvitationBodyVisitor;
00133     class IncidenceCompareVisitor;
00134     class ToolTipVisitor;
00135     class MailBodyVisitor;
00136 };
00137 
00138 }
00139 
00140 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys