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 <tqdatetime.h> 00029 #include <tqstring.h> 00030 #include <tqstringlist.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 TQString generateLinkURL( const TQString &id ) { return id; } 00041 virtual TQString makeLink( const TQString &id, const TQString &text ); 00042 virtual Calendar *calendar() const { return 0; } 00043 }; 00044 00052 class LIBKCAL_EXPORT IncidenceFormatter 00053 { 00054 public: 00055 static TQString KDE_DEPRECATED toolTipString( IncidenceBase *incidence, bool richText = true ); 00056 static TQString toolTipStr( Calendar *calendar, 00057 IncidenceBase *incidence, 00058 const TQDate &date=TQDate(), 00059 bool richText = true ); 00060 static TQString mailBodyString( IncidenceBase *incidencebase ); 00061 static TQString KDE_DEPRECATED extensiveDisplayString( IncidenceBase *incidence ); 00062 static TQString extensiveDisplayStr( Calendar *calendar, 00063 IncidenceBase *incidence, 00064 const TQDate &date=TQDate() ); 00065 00066 static TQString formatICalInvitation( TQString invitation, Calendar *mCalendar, 00067 InvitationFormatterHelper *helper ); 00068 static TQString KDE_DEPRECATED formatICalInvitationNoHtml( TQString invitation, 00069 Calendar *mCalendar, 00070 InvitationFormatterHelper *helper ); 00071 static TQString formatICalInvitationNoHtml( TQString invitation, 00072 Calendar *mCalendar, 00073 InvitationFormatterHelper *helper, 00074 const TQString &sender ); 00075 00076 // Format a TNEF attachment to an HTML mail 00077 static TQString formatTNEFInvitation( const TQByteArray& tnef, 00078 Calendar *mCalendar, 00079 InvitationFormatterHelper *helper ); 00080 // Transform a TNEF attachment to an iCal or vCard 00081 static TQString msTNEFToVPart( const TQByteArray& tnef ); 00082 00083 static TQString recurrenceString( Incidence *incidence ); 00084 00085 /* 00086 Returns a reminder string computed for the specified Incidence. 00087 Each item of the returning TQStringList 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 TQStringList reminderStringList( Incidence *incidence, bool shortfmt = true ); 00094 00095 static TQString timeToString( const TQDateTime &date, bool shortfmt = true ); 00096 00097 static TQString dateToString( const TQDateTime &date, bool shortfmt = true ); 00098 00099 static TQString dateTimeToString( const TQDateTime &date, 00100 bool dateOnly = false, 00101 bool shortfmt = true ); 00107 static TQString resourceString( Calendar *calendar, Incidence *incidence ); 00108 00114 static TQString durationString( Incidence *incidence ); 00115 00116 private: 00117 static TQString formatICalInvitationHelper( TQString invitation, 00118 Calendar *mCalendar, 00119 InvitationFormatterHelper *helper, 00120 bool noHtmlMode, 00121 const TQString &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