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