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 formatICalInvitationNoHtml( QString invitation, Calendar *mCalendar,
00069                                                InvitationFormatterHelper *helper );
00070     // Format a TNEF attachment to an HTML mail
00071     static QString formatTNEFInvitation( const QByteArray& tnef,
00072                                          Calendar *mCalendar,
00073                                          InvitationFormatterHelper *helper );
00074     // Transform a TNEF attachment to an iCal or vCard
00075     static QString msTNEFToVPart( const QByteArray& tnef );
00076 
00077     static QString recurrenceString( Incidence *incidence );
00078 
00079     /*
00080       Returns a reminder string computed for the specified Incidence.
00081       Each item of the returning QStringList corresponds to a string
00082       representation of an reminder belonging to this incidence.
00083       @param incidence is a pointer to the Incidence.
00084       @param shortfmt if false, a short version of each reminder is printed;
00085       else a longer version of each reminder is printed.
00086     */
00087     static QStringList reminderStringList( Incidence *incidence, bool shortfmt = true );
00088 
00089     static QString timeToString( const QDateTime &date, bool shortfmt = true );
00090 
00091     static QString dateToString( const QDateTime &date, bool shortfmt = true );
00092 
00093     static QString dateTimeToString( const QDateTime &date,
00094                                      bool dateOnly = false,
00095                                      bool shortfmt = true );
00101     static QString resourceString( Calendar *calendar, Incidence *incidence );
00102 
00108     static QString durationString( Incidence *incidence );
00109 
00110   private:
00111     static QString formatICalInvitationHelper( QString invitation,
00112                                                Calendar *mCalendar,
00113                                                InvitationFormatterHelper *helper,
00114                                                bool noHtmlMode );
00115     class EventViewerVisitor;
00116     class ScheduleMessageVisitor;
00117     class InvitationHeaderVisitor;
00118     class InvitationBodyVisitor;
00119     class IncidenceCompareVisitor;
00120     class ToolTipVisitor;
00121     class MailBodyVisitor;
00122 };
00123 
00124 }
00125 
00126 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys