libkcal Library API Documentation

htmlexport.h

00001 /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library 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 GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, USA.
00020 */
00021 #ifndef KCAL_HTMLEXPORT_H
00022 #define KCAL_HTMLEXPORT_H
00023 
00024 #include <qstring.h>
00025 #include <qdatetime.h>
00026 #include <qmap.h>
00027 
00028 #include <libkcal/calendar.h>
00029 
00030 class QFile;
00031 class QTextStream;
00032 
00033 namespace KCal {
00034 
00038 class HtmlExport
00039 {
00040   public:
00044     HtmlExport( Calendar *calendar );
00045     virtual ~HtmlExport() {}
00046 
00050     bool save( const QString &fileName );
00051 
00055     bool save( QTextStream * );
00056 
00057     void setTitle( QString title ) { mTitle = title; }
00058     QString title() { return mTitle; }
00059 
00060     void setTitleTodo( QString title ) { mTitleTodo = title; }
00061     QString titleTodo() { return mTitleTodo; }
00062 
00063     void setFullName( QString name ) { mName = name; }
00064     QString fullName() { return mName; }
00065 
00066     void setEmail( QString email ) { mEmail = email; }
00067     QString email() { return mEmail; }
00068 
00069     void setCredit( QString name, QString url ) { mCreditName = name; mCreditURL = url; }
00070     QString creditName() { return mCreditName; }
00071     QString creditURL() { return mCreditURL; }
00072 
00073     void setMonthViewEnabled(bool enable=true) { mMonthViewEnabled = enable; }
00074     bool monthViewEnabled() { return mMonthViewEnabled; }
00075 
00076     void setEventsEnabled(bool enable=true) { mEventsEnabled = enable; }
00077     bool eventsEnabled() { return mEventsEnabled; }
00078 
00079     void setTodosEnabled(bool enable=true) { mTodosEnabled = enable; }
00080     bool todosEnabled() { return mTodosEnabled; }
00081 
00082     void setCategoriesTodoEnabled(bool enable=true) { mCategoriesTodoEnabled = enable; }
00083     bool categoriesTodoEnabled() { return mCategoriesTodoEnabled; }
00084 
00085     void setAttendeesTodoEnabled(bool enable=true) { mAttendeesTodoEnabled = enable; }
00086     bool attendeesTodoEnabled() { return mAttendeesTodoEnabled; }
00087 
00088     void setExcludePrivateTodoEnabled(bool enable=true) { mExcludePrivateTodoEnabled = enable; }
00089     bool excludePrivateTodoEnabled() { return mExcludePrivateTodoEnabled; }
00090 
00091     void setExcludeConfidentialTodoEnabled(bool enable=true) { mExcludeConfidentialTodoEnabled = enable; }
00092     bool excludeConfidentialTodoEnabled() { return mExcludeConfidentialTodoEnabled; }
00093 
00094     void setCategoriesEventEnabled(bool enable=true) { mCategoriesEventEnabled = enable; }
00095     bool categoriesEventEnabled() { return mCategoriesEventEnabled; }
00096 
00097     void setAttendeesEventEnabled(bool enable=true) { mAttendeesEventEnabled = enable; }
00098     bool attendeesEventEnabled() { return mAttendeesEventEnabled; }
00099 
00100     void setExcludePrivateEventEnabled(bool enable=true) { mExcludePrivateEventEnabled = enable; }
00101     bool excludePrivateEventEnabled() { return mExcludePrivateEventEnabled; }
00102 
00103     void setExcludeConfidentialEventEnabled(bool enable=true) { mExcludeConfidentialEventEnabled = enable; }
00104     bool excludeConfidentialEventEnabled() { return mExcludeConfidentialEventEnabled; }
00105 
00106     void setDueDateEnabled(bool enable=true) { mDueDateEnabled = enable; }
00107     bool dueDateEnabled() { return mDueDateEnabled; }
00108 
00109     void setDateRange(const QDate &from,const QDate &to) { mFromDate = from, mToDate = to; }
00110     QDate fromDate() { return mFromDate; }
00111     QDate toDate() { return mToDate; }
00112 
00113     void setStyleSheet( const QString & );
00114     QString styleSheet();
00115 
00116     void addHoliday( QDate date, QString name );
00117 
00118   protected:
00119     void createHtmlMonthView (QTextStream *ts);
00120     void createHtmlEventList (QTextStream *ts);
00121     void createHtmlTodoList (QTextStream *ts);
00122 
00123     void createHtmlTodo (QTextStream *ts,Todo *todo);
00124     void createHtmlEvent (QTextStream *ts,Event *event,QDate date, bool withDescription = true);
00125 
00126     bool checkSecrecy( Incidence * );
00127 
00128     void formatHtmlCategories (QTextStream *ts,Incidence *event);
00129     void formatHtmlAttendees (QTextStream *ts,Incidence *event);
00130 
00131     QString breakString(const QString &text);
00132 
00133   private:
00134     QString cleanChars(const QString &txt);
00135 
00136     Calendar *mCalendar;
00137 
00138     bool mMonthViewEnabled;
00139     bool mEventsEnabled;
00140     bool mTodosEnabled;
00141     bool mCategoriesTodoEnabled;
00142     bool mAttendeesTodoEnabled;
00143     bool mCategoriesEventEnabled;
00144     bool mAttendeesEventEnabled;
00145     bool mDueDateEnabled;
00146     bool mExcludePrivateTodoEnabled;
00147     bool mExcludeConfidentialTodoEnabled;
00148     bool mExcludePrivateEventEnabled;
00149     bool mExcludeConfidentialEventEnabled;
00150 
00151     QDate mFromDate;
00152     QDate mToDate;
00153 
00154     QString mStyleSheet;
00155     QString mTitle;
00156     QString mTitleTodo;
00157     QString mName;
00158     QString mEmail;
00159     QString mCreditName;
00160     QString mCreditURL;
00161     QMap<QDate,QString> mHolidayMap;
00162 
00163     class Private;
00164     Private *d;
00165 };
00166 
00167 }
00168 
00169 #endif
KDE Logo
This file is part of the documentation for libkcal Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jan 31 15:52:17 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003