diff --git a/kcal/attachment.h b/kcal/attachment.h index 81bc028d3..ffd9c2b75 100644 --- a/kcal/attachment.h +++ b/kcal/attachment.h @@ -1,85 +1,86 @@ /* This file is part of libkcal. Copyright (c) 2002 Michael Brade This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KCAL_ATTACHMENT_H #define KCAL_ATTACHMENT_H #include "listbase.h" +#include "libkcal_export.h" #include namespace KCal { /** This class represents information related to an attachment. */ -class Attachment +class KDE_EXPORT Attachment { public: typedef ListBase List; /** Create a Reference to some URI by copying an existing Attachment. @param attachment the attachment to be duplicated */ Attachment( const Attachment &attachment ); /** Create a Reference to some URI. @param uri the uri this attachment refers to @param mime the mime type of the resource being linked to */ Attachment( const QString &uri, const QString &mime = QString::null ); /** Create a binary attachment. @param base64 the attachment in base64 format @param mime the mime type of the attachment */ Attachment( const char *base64, const QString &mime = QString::null ); /* The VALUE parameter in Cal */ bool isUri() const; QString uri() const; void setUri( const QString &uri ); bool isBinary() const; char *data() const; void setData( const char *base64 ); /* The optional FMTTYPE parameter in iCal */ QString mimeType() const; void setMimeType( const QString &mime ); private: QString mMimeType; QString mData; bool mBinary; class Private; Private *d; }; } #endif diff --git a/kcal/calendarresources.h b/kcal/calendarresources.h index 6fb3bb114..c7a1cd65c 100644 --- a/kcal/calendarresources.h +++ b/kcal/calendarresources.h @@ -1,315 +1,317 @@ /* This file is part of libkcal. Copyright (c) 2003 Cornelius Schumacher Copyright (C) 2003-2004 Reinhold Kainhofer This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KCAL_CALENDARRESOURCES_H #define KCAL_CALENDARRESOURCES_H #include #include #include "calendar.h" #include "resourcecalendar.h" +#include "libkcal_export.h" + #include class QWidget; namespace KCal { class CalFormat; /** This class provides a calendar composed of several calendar resources. */ class LIBKCAL_EXPORT CalendarResources : public Calendar, public KRES::ManagerObserver { Q_OBJECT public: class DestinationPolicy { public: DestinationPolicy( CalendarResourceManager *manager ) : mManager( manager ) {} virtual ResourceCalendar *destination( Incidence * ) = 0; protected: CalendarResourceManager *resourceManager() { return mManager; } private: CalendarResourceManager *mManager; }; class StandardDestinationPolicy : public DestinationPolicy { public: StandardDestinationPolicy( CalendarResourceManager *manager ) : DestinationPolicy( manager ) {} ResourceCalendar *destination( Incidence * ); private: class Private; Private *d; }; class AskDestinationPolicy : public DestinationPolicy { public: AskDestinationPolicy( CalendarResourceManager *manager, QWidget *parent = 0 ) : DestinationPolicy( manager ), mParent( parent ) {} ResourceCalendar *destination( Incidence * ); private: QWidget *mParent; class Private; Private *d; }; class Ticket { friend class CalendarResources; public: ResourceCalendar *resource() const { return mResource; } private: Ticket( ResourceCalendar *r ) : mResource( r ) {} ResourceCalendar *mResource; class Private; Private *d; }; /** constructs a new calendar, with variables initialized to sane values. */ CalendarResources( const QString &timeZoneId = QString::fromLatin1( "UTC" ), const QString &family = "calendar" ); ~CalendarResources(); /** Read the resources settings from a config file. You have to call this method before load(). @param config The KConfig object which points to the config file. If no object is given (null pointer) the standard config file is used. */ void readConfig( KConfig *config = 0 ); /** Loads all events from the resources. You have to add the resources first or call readConfig() to load the system resources. */ void load(); /** Return ResourceManager used by this calendar. */ CalendarResourceManager *resourceManager() const { return mManager; } /** Set the destinatinpolicy to add incidences always to the standard resource */ void setStandardDestinationPolicy(); /** Set the destinatinpolicy to ask to which resource incidences are added */ void setAskDestinationPolicy(); /** clears out the current calendar, freeing all used memory etc. etc. */ void close(); /** Request ticket for saving the calendar. If a ticket is returned the calendar is locked for write access until save() or releaseSaveTicket() is called. */ Ticket *requestSaveTicket( ResourceCalendar * ); /** Save calendar if incidence == 0, else save only this incidence. If save is successfull, the ticket is deleted. Otherwise the caller has to release the ticket with releaseSaveTicket() to abandon the save operation or to call save() to try to save again. */ virtual bool save( Ticket *, Incidence *incidence = 0 ); /** Release the save ticket. The calendar is unlocked without saving. */ virtual void releaseSaveTicket( Ticket *ticket ); void save(); bool isSaving(); bool addIncidence( Incidence * ); bool addIncidence( Incidence *incidence, ResourceCalendar *resource ); /** Add Event to calendar. */ bool addEvent(Event *anEvent) KDE_DEPRECATED; /** Add Event to a resource. */ bool addEvent(Event *anEvent, ResourceCalendar *resource) KDE_DEPRECATED; /** deletes an event from this calendar. */ void deleteEvent(Event *) KDE_DEPRECATED; /** Retrieves an event on the basis of the unique string ID. */ Event *event(const QString &UniqueStr); /** Return unfiltered list of all events in calendar. */ Event::List rawEvents( EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending ); /* Returns a QString with the text of the holiday (if any) that falls on the specified date. */ QString getHolidayForDate(const QDate &qd); /** Add a todo to the todolist. */ bool addTodo( Todo *todo ) KDE_DEPRECATED; /** Add Todo to a resource. */ bool addTodo(Todo *todo, ResourceCalendar *resource) KDE_DEPRECATED; /** Remove a todo from the todolist. */ void deleteTodo( Todo * ) KDE_DEPRECATED; /** Searches todolist for an event with this unique string identifier, returns a pointer or null. */ Todo *todo( const QString &uid ); /** Return list of all todos. */ Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending ); /** Returns list of todos due on the specified date. */ Todo::List rawTodosForDate( const QDate &date ); /** Add a Journal entry to calendar */ bool addJournal(Journal *) KDE_DEPRECATED; /** Remove journal entry. */ void deleteJournal( Journal * ) KDE_DEPRECATED; /** Add Journal to a resource. */ bool addJournal(Journal *journal, ResourceCalendar *resource) KDE_DEPRECATED; /** Return Journal with given UID */ Journal *journal(const QString &uid); /** Return list of all journals. */ Journal::List rawJournals( JournalSortField sortField = JournalSortUnsorted, SortDirection sortDirection = SortDirectionAscending ); /** Returns list of journals for the given date. */ Journal::List rawJournalsForDate( const QDate &date ); /** Return all alarms, which ocur in the given time interval. */ Alarm::List alarms( const QDateTime &from, const QDateTime &to ); /** Return all alarms, which ocur before given date. */ Alarm::List alarmsTo( const QDateTime &to ); /** Return Resource for given uid */ ResourceCalendar *resource(Incidence *); bool beginChange( Incidence * ); bool endChange( Incidence * ); signals: void signalResourceAdded( ResourceCalendar * ); void signalResourceModified( ResourceCalendar * ); void signalResourceDeleted( ResourceCalendar * ); void signalErrorMessage( const QString & ); public: /** Builds and then returns a list of all events that match for the date specified. useful for dayView, etc. etc. */ //TODO: Deprecate Event::List rawEventsForDate( const QDate &date, bool sorted = false ); //Event::List rawEventsForDate( const QDate &date, EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending ); /** Get unfiltered events for date \a qdt. */ Event::List rawEventsForDate( const QDateTime &qdt ); /** Get unfiltered events in a range of dates. If inclusive is set to true, only events are returned, which are completely included in the range. */ Event::List rawEvents( const QDate &start, const QDate &end, bool inclusive = false ); protected: void connectResource( ResourceCalendar * ); public: // resourceAdded needs to be public, because in-process added // resources don't emit the corresponding signal, so this method // has to be called manually! void resourceAdded( ResourceCalendar *resource ); protected: void resourceModified( ResourceCalendar *resource ); void resourceDeleted( ResourceCalendar *resource ); virtual void doSetTimeZoneId( const QString& tzid ); int incrementChangeCount( ResourceCalendar * ); int decrementChangeCount( ResourceCalendar * ); protected slots: void slotLoadError( ResourceCalendar *r, const QString &err ); void slotSaveError( ResourceCalendar *r, const QString &err ); private: void init( const QString &family ); bool mOpen; KRES::Manager* mManager; QMap mResourceMap; DestinationPolicy *mDestinationPolicy; StandardDestinationPolicy *mStandardPolicy; AskDestinationPolicy *mAskPolicy; QMap mTickets; QMap mChangeCounts; class Private; Private *d; }; } #endif diff --git a/kcal/confirmsavedialog.h b/kcal/confirmsavedialog.h index d91489f56..ebcf1ee29 100644 --- a/kcal/confirmsavedialog.h +++ b/kcal/confirmsavedialog.h @@ -1,46 +1,47 @@ /* This file is part of kdepim. Copyright (c) 2004 Cornelius Schumacher This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KCAL_CONFIRMSAVEDIALOG_H #define KCAL_CONFIRMSAVEDIALOG_H #include #include +#include class KListView; namespace KCal { -class ConfirmSaveDialog : public KDialogBase +class KDE_EXPORT ConfirmSaveDialog : public KDialogBase { public: ConfirmSaveDialog( const QString &destination, QWidget *parent, const char *name = 0 ); void addIncidences( const Incidence::List &incidences, const QString &operation ); private: KListView *mListView; }; } #endif diff --git a/kcal/freebusy.h b/kcal/freebusy.h index 47bda8cfc..b06ebeaa7 100644 --- a/kcal/freebusy.h +++ b/kcal/freebusy.h @@ -1,76 +1,76 @@ /* This file is part of libkcal. Copyright (c) 2001-2003 Cornelius Schumacher Copyright (C) 2004 Reinhold Kainhofer This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KCAL_FREEBUSY_H #define KCAL_FREEBUSY_H #include #include #include #include "period.h" #include "calendar.h" #include "incidencebase.h" namespace KCal { /** This class provides information about free/busy time of a calendar user. */ -class FreeBusy : public IncidenceBase +class LIBKCAL_EXPORT FreeBusy : public IncidenceBase { public: FreeBusy(); FreeBusy( const QDateTime &start, const QDateTime &end ); FreeBusy( Calendar *calendar, const QDateTime &start, const QDateTime &end ); FreeBusy( QValueList busyPeriods ); ~FreeBusy(); QCString type() const { return "FreeBusy"; } virtual QDateTime dtEnd() const; bool setDtEnd( const QDateTime &end ); QValueList busyPeriods() const; void addPeriod( const QDateTime &start, const QDateTime &end ); void addPeriod( const QDateTime &start, const Duration &dur ); void sortList(); private: bool accept( Visitor &v ) { return v.visit( this ); } //This is used for creating a freebusy object for the current user bool addLocalPeriod( const QDateTime &start, const QDateTime &end ); QDateTime mDtEnd; QValueList mBusyPeriods; Calendar *mCalendar; class Private; Private *d; }; } #endif diff --git a/kcal/freebusyurlstore.h b/kcal/freebusyurlstore.h index b492b586b..db8af1822 100644 --- a/kcal/freebusyurlstore.h +++ b/kcal/freebusyurlstore.h @@ -1,52 +1,54 @@ /* This file is part of libkcal. Copyright (c) 2004 Cornelius Schumacher This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KCAL_FREEBUSYURLSTORE_H #define KCAL_FREEBUSYURLSTORE_H #include +#include "libkcal_export.h" + class KConfig; namespace KCal { -class FreeBusyUrlStore +class LIBKCAL_EXPORT FreeBusyUrlStore { public: static FreeBusyUrlStore *self(); ~FreeBusyUrlStore(); void writeUrl( const QString &email, const QString &url ); QString readUrl( const QString &email ); void sync(); private: FreeBusyUrlStore(); static FreeBusyUrlStore *mSelf; KConfig *mConfig; }; } #endif diff --git a/kcal/htmlexport.h b/kcal/htmlexport.h index 5bcd887f7..8eec195e2 100644 --- a/kcal/htmlexport.h +++ b/kcal/htmlexport.h @@ -1,98 +1,100 @@ /* This file is part of libkcal. Copyright (c) 2000-2003 Cornelius Schumacher Copyright (C) 2004 Reinhold Kainhofer This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KCAL_HTMLEXPORT_H #define KCAL_HTMLEXPORT_H #include #include #include #include #include +#include "libkcal_export.h" + class QFile; class QTextStream; namespace KCal { /** This class provides the functions to export a calendar as a HTML page. */ -class HtmlExport +class KDE_EXPORT HtmlExport { public: /** Create new HTML exporter for calendar. */ HtmlExport( Calendar *calendar, HTMLExportSettings *settings ); virtual ~HtmlExport() {} /** Writes out the calendar in HTML format. */ bool save( const QString &fileName = QString::null ); /** Writes out calendar to text stream. */ bool save( QTextStream * ); void addHoliday( const QDate &date, const QString &name ); protected: void createWeekView( QTextStream *ts ); void createMonthView( QTextStream *ts ); void createEventList( QTextStream *ts ); void createTodoList( QTextStream *ts ); void createJournalView( QTextStream *ts ); void createFreeBusyView( QTextStream *ts ); void createTodo( QTextStream *ts, Todo *todo); void createEvent( QTextStream *ts, Event *event, QDate date, bool withDescription = true); void createFooter( QTextStream *ts ); bool checkSecrecy( Incidence * ); void formatCategories( QTextStream *ts, Incidence *event ); void formatAttendees( QTextStream *ts, Incidence *event ); QString breakString( const QString &text ); QDate fromDate() const; QDate toDate() const; QString styleSheet() const; private: QString cleanChars( const QString &txt ); Calendar *mCalendar; HTMLExportSettings *mSettings; QMap mHolidayMap; class Private; Private *d; }; } #endif diff --git a/kcal/htmlexportsettings.kcfgc b/kcal/htmlexportsettings.kcfgc index 895c2eefb..62c526154 100644 --- a/kcal/htmlexportsettings.kcfgc +++ b/kcal/htmlexportsettings.kcfgc @@ -1,9 +1,10 @@ # Code generation options for kconfig_compiler File=htmlexportsettings.kcfg ClassName=HTMLExportSettings Singleton=false Mutators=true MemberVariables=public GlobalEnums=true ItemAccessors=true SetUserTexts=true +Visibility=KDE_EXPORT diff --git a/kcal/incidenceformatter.h b/kcal/incidenceformatter.h index e6c2e2910..155373ea0 100644 --- a/kcal/incidenceformatter.h +++ b/kcal/incidenceformatter.h @@ -1,74 +1,74 @@ /* This file is part of libkcal. Copyright (c) 2001-2003 Cornelius Schumacher Copyright (c) 2004 Reinhold Kainhofer This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KCAL_INCIDENCEFORMATTER_H #define KCAL_INCIDENCEFORMATTER_H #include #include "libkcal_export.h" namespace KCal { class Calendar; class Incidence; class IncidenceBase; -class InvitationFormatterHelper +class LIBKCAL_EXPORT InvitationFormatterHelper { public: virtual QString generateLinkURL( const QString &id ) { return id; } virtual QString makeLink( const QString &id, const QString &text ); }; /** This class is a helper class that provides several static methods to format an Incidence into different formats, like an HTML representation for KMail, a representation for tool tips, ir a representation for the event viewer. @short methods to format incidences into various formats for displaying them */ class LIBKCAL_EXPORT IncidenceFormatter { public: static QString toolTipString( IncidenceBase *incidence, bool richText = true ); static QString mailBodyString( IncidenceBase *incidencebase ); static QString extensiveDisplayString( IncidenceBase *incidence ); static QString formatICalInvitation( QString invitation, Calendar *mCalendar, InvitationFormatterHelper *helper ); // Format a TNEF attachment to an HTML mail static QString formatTNEFInvitation( const QByteArray& tnef, Calendar *mCalendar, InvitationFormatterHelper *helper ); // Transform a TNEF attachment to an iCal or vCard static QString msTNEFToVPart( const QByteArray& tnef ); private: class EventViewerVisitor; class ScheduleMessageVisitor; class InvitationHeaderVisitor; class InvitationBodyVisitor; class ToolTipVisitor; class MailBodyVisitor; }; } #endif diff --git a/kcal/resourcecached.h b/kcal/resourcecached.h index 34cdc5517..e58779d09 100644 --- a/kcal/resourcecached.h +++ b/kcal/resourcecached.h @@ -1,347 +1,349 @@ /* This file is part of libkcal. Copyright (c) 2003,2004 Cornelius Schumacher This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KCAL_RESOURCECACHED_H #define KCAL_RESOURCECACHED_H #include "resourcecalendar.h" #include "libemailfunctions/idmapper.h" #include "incidence.h" #include "calendarlocal.h" #include #include #include #include #include +#include + namespace KCal { /** This class provides a calendar resource using a local CalendarLocal object to cache the calendar data. */ -class ResourceCached : public ResourceCalendar, +class KDE_EXPORT ResourceCached : public ResourceCalendar, public KCal::Calendar::Observer { Q_OBJECT public: /** Reload policy. @see setReloadPolicy(), reloadPolicy() */ enum { ReloadNever, ReloadOnStartup, ReloadInterval }; /** Save policy. @see setSavePolicy(), savePolicy() */ enum { SaveNever, SaveOnExit, SaveInterval, SaveDelayed, SaveAlways }; ResourceCached( const KConfig * ); virtual ~ResourceCached(); void readConfig( const KConfig *config ); void writeConfig( KConfig *config ); /** Set reload policy. This controls when the cache is refreshed. ReloadNever never reload ReloadOnStartup reload when resource is started ReloadInterval reload regularly after given interval */ void setReloadPolicy( int policy ); /** Return reload policy. @see setReloadPolicy() */ int reloadPolicy() const; /** Set reload interval in minutes which is used when reload policy is ReloadInterval. */ void setReloadInterval( int minutes ); /** Return reload interval in minutes. */ int reloadInterval() const; /** Set save policy. This controls when the cache is refreshed. SaveNever never save SaveOnExit save when resource is exited SaveInterval save regularly after given interval SaveDelayed save after small delay SaveAlways save on every change */ void setSavePolicy( int policy ); /** Return save policy. @see setsavePolicy() */ int savePolicy() const; /** Set save interval in minutes which is used when save policy is SaveInterval. */ void setSaveInterval( int minutes ); /** Return save interval in minutes. */ int saveInterval() const; /** Set time of last load. */ void setLastLoad( const QDateTime & ); /** Return time of last load. */ QDateTime lastLoad() const; /** Set time of last save. */ void setLastSave( const QDateTime & ); /** Return time of last save. */ QDateTime lastSave() const; /** Add event to calendar. */ bool addEvent(Event *anEvent); /** Deletes an event from this calendar. */ void deleteEvent(Event *); /** Retrieves an event on the basis of the unique string ID. */ Event *event(const QString &UniqueStr); /** Return filtered list of all events in calendar. */ Event::List events(); /** Return unfiltered list of all events in calendar. */ Event::List rawEvents( EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending ); /** Builds and then returns a list of all events that match for the date specified. useful for dayView, etc. etc. */ //TODO: Deprecate Event::List rawEventsForDate( const QDate &date, bool sorted = false ); //Event::List rawEventsForDate( const QDate &date, EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending ); /** Get unfiltered events for date \a qdt. */ Event::List rawEventsForDate( const QDateTime &qdt ); /** Get unfiltered events in a range of dates. If inclusive is set to true, only events are returned, which are completely included in the range. */ Event::List rawEvents( const QDate &start, const QDate &end, bool inclusive = false ); /** Add a todo to the todolist. */ bool addTodo( Todo *todo ); /** Remove a todo from the todolist. */ void deleteTodo( Todo * ); /** Searches todolist for an event with this unique string identifier, returns a pointer or null. */ Todo *todo( const QString &uid ); /** Return list of all todos. */ Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending ); /** Returns list of todos due on the specified date. */ Todo::List rawTodosForDate( const QDate &date ); /** Add a Journal entry to calendar */ virtual bool addJournal( Journal * ); /** Remove a Journal from the calendar */ virtual void deleteJournal( Journal * ); /** Return Journal with given unique id. */ virtual Journal *journal( const QString &uid ); /** Return list of all journals. */ Journal::List rawJournals( JournalSortField sortField = JournalSortUnsorted,SortDirection sortDirection = SortDirectionAscending ); /** Return list of journals for the given date. */ Journal::List rawJournalsForDate( const QDate &date ); /** Return all alarms, which ocur in the given time interval. */ Alarm::List alarms( const QDateTime &from, const QDateTime &to ); /** Return all alarms, which ocur before given date. */ Alarm::List alarmsTo( const QDateTime &to ); /** Set id of timezone, e.g. "Europe/Berlin" */ void setTimeZoneId( const QString& tzid ); QString timeZoneId() const; void enableChangeNotification(); void disableChangeNotification(); void clearChange( Incidence * ); void clearChanges(); bool hasChanges() const; Incidence::List allChanges() const; Incidence::List addedIncidences() const; Incidence::List changedIncidences() const; Incidence::List deletedIncidences() const; /** Loads the cache, this method should be called on load. */ void loadCache(); /** Saves the cache back. */ void saveCache(); /** Clear cache. */ void clearCache(); void cleanUpEventCache( const KCal::Event::List &eventList ); void cleanUpTodoCache( const KCal::Todo::List &todoList ); /** Returns a reference to the id mapper. */ KPIM::IdMapper& idMapper(); protected: // From Calendar::Observer void calendarIncidenceAdded( KCal::Incidence * ); void calendarIncidenceChanged( KCal::Incidence * ); void calendarIncidenceDeleted( KCal::Incidence * ); CalendarLocal mCalendar; /** Virtual method from KRES::Resource, called when the last instace of the resource is closed */ virtual void doClose(); /** Opens the resource. Dummy implementation, so child classes don't have to reimplement this method. By default, this does not do anything, but can be reimplemented in child classes */ virtual bool doOpen(); /** Check if reload required according to reload policy. */ bool checkForReload(); /** Check if save required according to save policy. */ bool checkForSave(); void checkForAutomaticSave(); void addInfoText( QString & ) const; void setupSaveTimer(); void setupReloadTimer(); /** This method is used by loadCache() and saveCache(), reimplement it to change the location of the cache. */ virtual QString cacheFile() const; protected slots: void slotReload(); void slotSave(); void setIdMapperIdentifier(); private: int mReloadPolicy; int mReloadInterval; QTimer mReloadTimer; bool mReloaded; int mSavePolicy; int mSaveInterval; QTimer mSaveTimer; QDateTime mLastLoad; QDateTime mLastSave; QMap mAddedIncidences; QMap mChangedIncidences; QMap mDeletedIncidences; KPIM::IdMapper mIdMapper; class Private; Private *d; }; } #endif diff --git a/kcal/resourcecachedconfig.h b/kcal/resourcecachedconfig.h index d773412c5..949516a18 100644 --- a/kcal/resourcecachedconfig.h +++ b/kcal/resourcecachedconfig.h @@ -1,87 +1,88 @@ /* This file is part of libkcal. Copyright (c) 2004 Cornelius Schumacher This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KCAL_RESOURCECACHEDCONFIG_H #define KCAL_RESOURCECACHEDCONFIG_H #include +#include class QButtonGroup; class QSpinBox; namespace KCal { class ResourceCached; /** Configuration widget for reload policy @see ResourceCached */ -class ResourceCachedReloadConfig : public QWidget +class KDE_EXPORT ResourceCachedReloadConfig : public QWidget { Q_OBJECT public: ResourceCachedReloadConfig( QWidget *parent = 0, const char *name = 0 ); public slots: void loadSettings( ResourceCached *resource ); void saveSettings( ResourceCached *resource ); protected slots: void slotIntervalStateChanged( int ); private: QButtonGroup *mGroup; QSpinBox *mIntervalSpin; class Private; Private *d; }; /** Configuration widget for save policy @see ResourceCached */ -class ResourceCachedSaveConfig : public QWidget +class KDE_EXPORT ResourceCachedSaveConfig : public QWidget { Q_OBJECT public: ResourceCachedSaveConfig( QWidget *parent = 0, const char *name = 0 ); public slots: void loadSettings( ResourceCached *resource ); void saveSettings( ResourceCached *resource ); protected slots: void slotIntervalStateChanged( int ); private: QButtonGroup *mGroup; QSpinBox *mIntervalSpin; class Private; Private *d; }; } #endif diff --git a/kholidays/kholidays.h b/kholidays/kholidays.h index 28864cb93..e74c8cfd6 100644 --- a/kholidays/kholidays.h +++ b/kholidays/kholidays.h @@ -1,57 +1,59 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher Copyright (c) 2004 Allen Winter This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KHOLIDAYS_HOLIDAYS_H #define KHOLIDAYS_HOLIDAYS_H #include #include #include -class KHolidays { +#include + +class KDE_EXPORT KHolidays { public: /** Return a list of all available locations which have a holiday definition. One of these can then be passed to the constructor for a new KHolidays object. */ static QStringList locations(); KHolidays( const QString& location ); ~KHolidays(); /// return the location with which this object was constructed QString location() const; QString shortText( const QDate& ); QString getHoliday( const QDate& ); enum { WORKDAY, HOLIDAY }; int category( const QDate& ); private: bool parseFile( const QDate& ); QString mLocation; // location string used to determine holidays file QString mHolidayFile; // name of file containing holiday data int mYearLast; // save off the last year we have seen }; #endif diff --git a/kmime/Makefile.am b/kmime/Makefile.am index e5fa6c21a..8469a1cb3 100644 --- a/kmime/Makefile.am +++ b/kmime/Makefile.am @@ -1,32 +1,32 @@ -INCLUDES= -I$(top_srcdir)/libkdepim $(all_includes) +INCLUDES= $(all_includes) lib_LTLIBRARIES = libkmime.la libkmime_la_SOURCES = \ kmime_charfreq.cpp \ kmime_util.cpp \ kmime_mdn.cpp \ kmime_codecs.cpp \ kmime_codec_base64.cpp \ kmime_codec_uuencode.cpp \ kmime_codec_qp.cpp \ kmime_codec_identity.cpp \ kmime_parsers.cpp \ kmime_header_parsing.cpp \ kmime_content.cpp \ kmime_headers.cpp \ kmime_message.cpp \ kmime_newsarticle.cpp \ boolflags.cpp \ kqcstringsplitter.cpp libkmime_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 4:0:2 libkmime_la_LIBADD = $(LIB_KDECORE) $(LIB_POLL) METASOURCES = AUTO messages: $(XGETTEXT) *.cpp *.h -o $(podir)/libkmime.pot include ../admin/Doxyfile.am diff --git a/kmime/kmime_charfreq.h b/kmime/kmime_charfreq.h index bebaaea1b..58c6cf0fe 100644 --- a/kmime/kmime_charfreq.h +++ b/kmime/kmime_charfreq.h @@ -1,67 +1,68 @@ /* -*- c++ -*- kmime_charfreq.h KMime, the KDE internet mail/usenet news message library. Copyright (c) 2001-2002 Marc Mutz This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US */ #ifndef __KMIME_CHARFREQ_H__ #define __KMIME_CHARFREQ_H__ #include +#include #undef None namespace KMime { -class CharFreq { +class KDE_EXPORT CharFreq { public: CharFreq( const QByteArray & buf ); CharFreq( const char * buf, size_t len ); enum Type { None = 0, EightBitData, Binary = EightBitData, SevenBitData, EightBitText, SevenBitText }; Type type() const; bool isEightBitData() const; bool isEightBitText() const; bool isSevenBitData() const; bool isSevenBitText() const; /** Returns true if buf has trailing whitespace, i.e. if any line ends with space (' ') or tab ('\t'). */ bool hasTrailingWhitespace() const; /** Returns true if buf contains a line that starts with "From ". */ bool hasLeadingFrom() const; /** Returns the percentage of printable characters: printable/total. If total == 0, the result is undefined. */ float printableRatio() const; /** Returns the percentage of control code (CTLs): CTL/total. If total == 0, the result is undefined. */ float controlCodesRatio() const; protected: uint NUL; // count of NUL chars uint CTL; // count of CTLs (incl. DEL, excl. CR, LF, HT) uint CR, LF; // count of CRs and LFs uint CRLF; // count of LFs, preceded by CRs uint printable; // count of printable US-ASCII chars (SPC..~) uint eightBit; // count of other latin1 chars (those with 8th bit set) uint total; uint lineMin; uint lineMax; bool mTrailingWS; // does the buffer contain trailing whitespace? bool mLeadingFrom; // does the buffer contain lines starting with "From "? private: void count( const char * buf, size_t len ); }; } // namespace KMime #endif /* __KMIME_CHARFREQ_H__ */ diff --git a/kmime/kmime_codecs.h b/kmime/kmime_codecs.h index 894fbac2a..147d6a59a 100644 --- a/kmime/kmime_codecs.h +++ b/kmime/kmime_codecs.h @@ -1,366 +1,367 @@ /* -*- c++ -*- kmime_codecs.h This file is part of KMime, the KDE internet mail/usenet news message library. Copyright (c) 2001-2002 Marc Mutz KMime is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. KMime is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA In addition, as a special exception, the copyright holders give permission to link the code of this library with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ #ifndef __KMIME_CODECS__ #define __KMIME_CODECS__ #include #if defined(QT_THREAD_SUPPORT) # include #endif #include // QByteArray #include // for kdFatal() +#include namespace KMime { // forward declarations: class Encoder; class Decoder; /** Abstract base class of codecs like base64 and quoted-printable. It's a singleton. @short Codecs for common mail transfer encodings. @author Marc Mutz */ -class Codec { +class KDE_EXPORT Codec { protected: static QAsciiDict* all; #if defined(QT_THREAD_SUPPORT) static QMutex* dictLock; #endif Codec() {} private: static void fillDictionary(); public: static Codec * codecForName( const char * name ); static Codec * codecForName( const QCString & name ); virtual int maxEncodedSizeFor( int insize, bool withCRLF=false ) const = 0; virtual int maxDecodedSizeFor( int insize, bool withCRLF=false ) const = 0; virtual Encoder * makeEncoder( bool withCRLF=false ) const = 0; virtual Decoder * makeDecoder( bool withCRLF=false ) const = 0; /** * Convenience wrapper that can be used for small chunks of data * when you can provide a large enough buffer. The default * implementation creates an @see Encoder and uses it. * * Encodes a chunk of bytes starting at @p scursor and extending to * @p send into the buffer described by @p dcursor and @p dend. * * This function doesn't support chaining of blocks. The returned * block cannot be added to, but you don't need to finalize it, too. * * Example usage (@p in contains the input data): *
    * KMime::Codec * codec = KMime::Codec::codecForName( "base64" );
    * kdFatal( !codec ) << "no base64 codec found!?" << endl;
    * QByteArray out( in.size()*1.4 ); // crude maximal size of b64 encoding
    * QByteArray::Iterator iit = in.begin();
    * QByteArray::Iterator oit = out.begin();
    * if ( !codec->encode( iit, in.end(), oit, out.end() ) ) {
    *   kdDebug() << "output buffer too small" << endl;
    *   return;
    * }
    * kdDebug() << "Size of encoded data: " << oit - out.begin() << endl;
    * 
* * @param scursor/send begin and end of input buffer * @param dcursor/dend begin and end of output buffer * @param withCRLF If true, make the lineends CRLF, else make them LF only. * * @return false if the encoded data didn't fit into the output * buffer. **/ virtual bool encode( const char* & scursor, const char * const send, char* & dcursor, const char * const dend, bool withCRLF=false ) const; /** * Convenience wrapper that can be used for small chunks of data * when you can provide a large enough buffer. The default * implementation creates a @see Decoder and uses it. * * Decodes a chunk of bytes starting at @p scursor and extending to * @p send into the buffer described by @p dcursor and @p dend. * * This function doesn't support chaining of blocks. The returned * block cannot be added to, but you don't need to finalize it, too. * * Example usage (@p in contains the input data): *
    * KMime::Codec * codec = KMime::Codec::codecForName( "base64" );
    * kdFatal( !codec ) << "no base64 codec found!?" << endl;
    * QByteArray out( in.size() ); // good guess for any encoding...
    * QByteArray::Iterator iit = in.begin();
    * QByteArray::Iterator oit = out.begin();
    * if ( !codec->decode( iit, in.end(), oit, out.end() ) ) {
    *   kdDebug() << "output buffer too small" << endl;
    *   return;
    * }
    * kdDebug() << "Size of decoded data: " << oit - out.begin() << endl;
    * 
* * @param scursor/send begin and end of input buffer * @param dcursor/dend begin and end of output buffer * @param withCRLF If true, make the lineends CRLF, else make them LF only. * * @return false if the decoded data didn't fit into the output * buffer. **/ virtual bool decode( const char* & scursor, const char * const send, char* & dcursor, const char * const dend, bool withCRLF=false ) const; /** * Even more convenient, but also a bit slower and more memory * intensive, since it allocates storage for the worst case and then * shrinks the result QByteArray to the actual size again. * * For use with small @p src. **/ virtual QByteArray encode( const QByteArray & src, bool withCRLF=false ) const; /** * Even more convenient, but also a bit slower and more memory * intensive, since it allocates storage for the worst case and then * shrinks the result QCString to the actual size again. * * For use with small @p src. * * This method only works for codecs whose output is in the 8bit * domain (ie. not in the binary domain). Codecs that do not fall * into this category will return a null QCString. **/ virtual QCString encodeToQCString( const QByteArray & src, bool withCRLF=false ) const; /** * Even more convenient, but also a bit slower and more memory * intensive, since it allocates storage for the worst case and then * shrinks the result QByteArray to the actual size again. * * For use with small @p src. **/ virtual QByteArray decode( const QByteArray & src, bool withCRLF=false ) const; /** * @return the name of the encoding. Guaranteed to be lowercase. */ virtual const char * name() const = 0; virtual ~Codec() {} }; /** * Stateful decoder class, modelled after @see QTextDecoder. * * @section Overview * * KMime decoders are designed to be able to process encoded data in * chunks of arbitrary size and to work with output buffers of also * arbitrary size. They maintain any state necessary to go on where * the previous call left off. * * The class consists of only two methods of interest: @see decode, * which decodes an input block and @see finalize, which flushes any * remaining data to the output stream. * * Typically, you will create a decoder instance, call @see decode as * often as necessary, then call @see finalize (most often a single * call suffices, but it might be that during that call the output * buffer is filled, so you should be prepared to call @see finalize * as often as necessary, ie. until it returns @p true). * * @section Return Values * * Both methods return @p true to indicate that they've finished their * job. For @see decode, a return value of @p true means that the * current input block has been finished (@p false most often means * that the output buffer is full, but that isn't required * behavior. The @see decode call is free to return at arbitrary * times during processing). * * For @see finalize, a return value of @p true means that all data * implicitly or explicitly stored in the decoder instance has been * flushed to the output buffer. A @p false return value should be * interpreted as "check if the output buffer is full and call me * again", just as with @see decode. * * @section Usage Pattern * * Since the decoder maintains state, you can only use it once. After * a sequence of input blocks has been processed, you @see finalize * the output and then delete the decoder instance. If you want to * process another input block sequence, you create a new instance. * * Typical usage (@p in contains the (base64-encoded) input data), * taking into account all the conventions detailed above: * *
  * KMime::Codec * codec = KMime::Codec::codecForName( "base64" );
  * kdFatal( !codec ) << "No codec found for base64!" << endl;
  * KMime::Decoder * dec = codec->makeDecoder();
  * assert( dec ); // should not happen
  * QByteArray out( 256 ); // small buffer is enough ;-)
  * QByteArray::Iterator iit = in.begin();
  * QByteArray::Iterator oit = out.begin();
  * // decode the chunk
  * while ( !dec->decode( iit, in.end(), oit, out.end() ) )
  *   if ( oit == out.end() ) { // output buffer full, process contents
  *     do_something_with( out );
  *     oit = out.begin();
  *   }
  * // repeat while loop for each input block
  * // ...
  * // finish (flush remaining data from decoder):
  * while ( !dec->finish( oit, out.end() ) )
  *   if ( oit == out.end() ) { // output buffer full, process contents
  *     do_something_with( out );
  *     oit = out.begin();
  *   }
  * // now process last chunk:
  * out.resize( oit - out.begin() );
  * do_something_with( out );
  * // _delete_ the decoder, but not the codec:
  * delete dec;
  * 
* * @short Stateful CTE decoder class * @author Marc Mutz **/ class Decoder { protected: friend class Codec; /** * Protected constructor. Use @see KMime::Codec::makeDecoder to * create an instance. The bool parameter determines whether lines * end with CRLF (true) or LF (false, default). **/ Decoder( bool withCRLF=false ) : mWithCRLF( withCRLF ) {} public: virtual ~Decoder() {} /** Decode a chunk of data, maintaining state information between * calls. See class decumentation for calling conventions. **/ virtual bool decode( const char* & scursor, const char * const send, char* & dcursor, const char * const dend ) = 0; /** Call this method to finalize the output stream. Writes all * remaining data and resets the decoder. See @see KMime::Codec for * calling conventions. **/ virtual bool finish( char* & dcursor, const char * const dend ) = 0; protected: const bool mWithCRLF; }; /** Stateful encoder class, modelled after @see QTextEncoder. @short Stateful encoder class @author Marc Mutz */ class Encoder { protected: friend class Codec; /** Protected constructor. Use KMime::Codec::makeEncoder if you want one. The bool parameter determines whether lines end with CRLF (true) or LF (false, default). */ Encoder( bool withCRLF=false ) : mOutputBufferCursor( 0 ), mWithCRLF( withCRLF ) {} public: virtual ~Encoder() {} /** Encode a chunk of data, maintaining state information between calls. See @see KMime::Codec for calling conventions. */ virtual bool encode( const char* & scursor, const char * const send, char* & dcursor, const char * const dend ) = 0; /** Call this method to finalize the output stream. Writes all remaining data and resets the encoder. See @see KMime::Codec for calling conventions. */ virtual bool finish( char* & dcursor, const char * const dend ) = 0; protected: /** Space in the output buffer */ enum { maxBufferedChars = 8 }; /** Writes @p ch to the output stream or the output buffer, depending on whether or not the output stream has space left. @return true if written to the output stream, false if buffered. */ bool write( char ch, char* & dcursor, const char * const dend ) { if ( dcursor != dend ) { // if there's space in the output stream, write there: *dcursor++ = ch; return true; } else { // else buffer the output: kdFatal( mOutputBufferCursor >= maxBufferedChars ) << "KMime::Encoder: internal buffer overflow!" << endl; mOutputBuffer[ mOutputBufferCursor++ ] = ch; return false; } } /** Writes characters from the output buffer to the output stream. Implementations of @see encode and @see finish should call this at the very beginning and for each iteration of the while loop. @return true if all chars could be written, false otherwise */ bool flushOutputBuffer( char* & dcursor, const char * const dend ); /** Convenience function. Outputs LF or CRLF, based on the state of mWithCRLF */ bool writeCRLF( char* & dcursor, const char * const dend ) { if ( mWithCRLF ) write( '\r', dcursor, dend ); return write( '\n', dcursor, dend ); } private: /** An output buffer to simplyfy some codecs. Use with @see write and flushOutputBuffer */ char mOutputBuffer[ maxBufferedChars ]; protected: uchar mOutputBufferCursor; const bool mWithCRLF; }; } // namespace KMime #endif // __KMIME_CODECS__ diff --git a/kmime/kmime_mdn.h b/kmime/kmime_mdn.h index daa8f3359..35e478d34 100644 --- a/kmime/kmime_mdn.h +++ b/kmime/kmime_mdn.h @@ -1,200 +1,202 @@ /* -*- c++ -*- kmime_mdn.h This file is part of KMime, the KDE internet mail/usenet news message library. Copyright (c) 2002 Marc Mutz KMime is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. KMime is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA In addition, as a special exception, the copyright holders give permission to link the code of this library with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ #ifndef __KMIME_MDN_H__ #define __KMIME_MDN_H__ #include #include +#include + class QCString; namespace KMime { namespace MDN { /** The following disposition-types are defined: @li Displayed The message has been displayed by the UA to someone reading the recipient's mailbox. There is no guarantee that the content has been read or understood. @li Dispatched The message has been sent somewhere in some manner (e.g., printed, faxed, forwarded) without necessarily having been previously displayed to the user. The user may or may not see the message later. @li Processed The message has been processed in some manner (i.e., by some sort of rules or server) without being displayed to the user. The user may or may not see the message later, or there may not even be a human user associated with the mailbox. @li Deleted The message has been deleted. The recipient may or may not have seen the message. The recipient might "undelete" the message at a later time and read the message. @li Denied The recipient does not wish the sender to be informed of the message's disposition. A UA may also siliently ignore message disposition requests in this situation. @li Failed A failure occurred that prevented the proper generation of an MDN. More information about the cause of the failure may be contained in a Failure field. The "failed" disposition type is not to be used for the situation in which there is is some problem in processing the message other than interpreting the request for an MDN. The "processed" or other disposition type with appropriate disposition modifiers is to be used in such situations. IOW: @p Displayed when - well -displayed @p Dispatched when forwarding unseen ( == new ) @p Processed (maybe) when piping unseen, but probably never used @p Deleted when deleting unseen @p Denied on user command @p Failed on Disposition-Notification-Options containing unknown required options. ( == @em any required options ) @p Failed needs a description in the @p special parameter. **/ enum DispositionType { Displayed, Read = Displayed, Deleted, Dispatched, Forwarded = Dispatched, Processed, Denied, Failed }; /** The following disposition modifiers are defined: @li Error An error of some sort occurred that prevented successful processing of the message. Further information is contained in an Error field. @li Warning The message was successfully processed but some sort of exceptional condition occurred. Further information is contained in a Warning field. @li Superseded The message has been automatically rendered obsolete by another message received. The recipient may still access and read the message later. @li Expired The message has reached its expiration date and has been automatically removed from the recipient's mailbox. @li MailboxTerminated The recipient's mailbox has been terminated and all message in it automatically removed. **/ enum DispositionModifier { Error, Warning, Superseded, Expired, MailboxTerminated }; \ /** The following disposition modes are defined: @li ManualAction The disposition described by the disposition type was a result of an explicit instruction by the user rather than some sort of automatically performed action. @li AutomaticAction The disposition described by the disposition type was a result of an automatic action, rather than an explicit instruction by the user for this message. IOW: @p ManualAction for user-driven actions, @p AutomanticAction for filtering. **/ enum ActionMode { ManualAction, AutomaticAction }; /** @li SentManually The user explicitly gave permission for this particular MDN to be sent. @li SentAutomatically The MDN was sent because the MUA had previously been configured to do so automatically. IOW: @p SentManually for when we have asked the user @p SentAutomatically when we use the default specified by the user **/ enum SendingMode { SentManually, SentAutomatically }; /** Main function. Generates the content of the message/disposition-notification body part. */ - extern QCString dispositionNotificationBodyContent( const QString & finalRecipient, + KDE_EXPORT extern QCString dispositionNotificationBodyContent( const QString & finalRecipient, const QCString & originalRecipient, const QCString & originalMsgID, DispositionType disposition, ActionMode actionMode, SendingMode sendingMode, const QValueList & dispositionModifers =QValueList(), const QString & special=QString::null ); - extern QString descriptionFor( DispositionType d, + KDE_EXPORT extern QString descriptionFor( DispositionType d, const QValueList & m =QValueList() ); enum ReturnContent { Nothing, All, HeadersOnly }; } // namespace MDN } // namespace KMime #endif // __KMIME_MDN_H__ diff --git a/kpimidentities/identity.h b/kpimidentities/identity.h index 33b52195e..43c246ae1 100644 --- a/kpimidentities/identity.h +++ b/kpimidentities/identity.h @@ -1,312 +1,312 @@ /* -*- mode: C++; c-file-style: "gnu" -*- * User identity information * * Author: Stefan Taferner * This code is under GPL */ #ifndef kpim_identity_h #define kpim_identity_h #include #include #include #include #include class KProcess; namespace KPIM { class Identity; class Signature; } class KConfigBase; class IdentityList; class QDataStream; namespace KPIM { /** * @short abstraction of a signature (aka "footer"). * @author Marc Mutz */ class KDE_EXPORT Signature { friend class Identity; friend QDataStream & KPIM::operator<<( QDataStream & stream, const Signature & sig ); friend QDataStream & KPIM::operator>>( QDataStream & stream, Signature & sig ); public: /** Type of signature (ie. way to obtain the signature text) */ enum Type { Disabled = 0, Inlined = 1, FromFile = 2, FromCommand = 3 }; /** Used for comparison */ bool operator==( const Signature & other ) const; /** Constructor for disabled signature */ Signature(); /** Constructor for inline text */ Signature( const QString & text ); /** Constructor for text from a file or from output of a command */ Signature( const QString & url, bool isExecutable ); /** @return the raw signature text as entered resp. read from file. */ QString rawText( bool * ok=0 ) const; /** @return the signature text with a "-- " separator added, if necessary. */ QString withSeparator( bool * ok=0 ) const; /** Set the signature text and mark this signature as being of "inline text" type. */ void setText( const QString & text ) { mText = text; mType = Inlined; } QString text() const { return mText; } /** Set the signature URL and mark this signature as being of "from file" resp. "from output of command" type. */ void setUrl( const QString & url, bool isExecutable=false ); QString url() const { return mUrl; } /// @return the type of signature (ie. way to obtain the signature text) Type type() const { return mType; } protected: void writeConfig( KConfigBase * config ) const; void readConfig( const KConfigBase * config ); private: QString textFromFile( bool * ok ) const; QString textFromCommand( bool * ok ) const; private: QString mUrl; QString mText; Type mType; }; /** User identity information */ class KDE_EXPORT Identity { // only the identity manager should be able to construct and // destruct us, but then we get into problems with using // QValueList and especially qHeapSort(). friend class IdentityManager; - friend QDataStream & KPIM::operator<<( QDataStream & stream, const Identity & ident ); - friend QDataStream & KPIM::operator>>( QDataStream & stream, Identity & ident ); + friend QDataStream & operator<<( QDataStream & stream, const KPIM::Identity & ident ); + friend QDataStream & operator>>( QDataStream & stream, KPIM::Identity & ident ); public: typedef QValueList List; /** used for comparison */ bool operator==( const Identity & other ) const; bool operator!=( const Identity & other ) const { return !operator==( other ); } /** used for sorting */ bool operator<( const Identity & other ) const { if ( isDefault() ) return true; if ( other.isDefault() ) return false; return identityName() < other.identityName(); } bool operator>( const Identity & other ) const { if ( isDefault() ) return false; if ( other.isDefault() ) return true; return identityName() > other.identityName(); } bool operator<=( const Identity & other ) const { return !operator>( other ); } bool operator>=( const Identity & other ) const { return !operator<( other ); } /** Constructor */ explicit Identity( const QString & id=QString::null, const QString & realName=QString::null, const QString & emailAddr=QString::null, const QString & organization=QString::null, const QString & replyToAddress=QString::null ); /** Destructor */ ~Identity(); protected: /** Read configuration from config. Group must be preset (or use @ref KConfigGroup). Called from @ref IdentityManager. */ void readConfig( const KConfigBase * ); /** Write configuration to config. Group must be preset (or use @ref KConfigGroup). Called from @ref IdentityManager. */ void writeConfig( KConfigBase * ) const; public: /** Tests if there are enough values set to allow mailing */ bool mailingAllowed() const; /** Identity/nickname for this collection */ QString identityName() const { return mIdentity; } void setIdentityName( const QString & name ); /** @return whether this identity is the default identity */ bool isDefault() const { return mIsDefault; } /// Unique Object Identifier for this identity uint uoid() const { return mUoid; } protected: /** Set whether this identity is the default identity. Since this affects all other identites, too (most notably, the old default identity), only the @ref IdentityManager can change this. You should use
       kmkernel->identityManager()->setAsDefault( name_of_default )
       
instead. **/ void setIsDefault( bool flag ); void setUoid( uint aUoid ) { mUoid = aUoid; } public: /** Full name of the user */ QString fullName() const { return mFullName; } void setFullName(const QString&); /** The user's organization (optional) */ QString organization() const { return mOrganization; } void setOrganization(const QString&); KDE_DEPRECATED QCString pgpIdentity() const { return pgpEncryptionKey(); } KDE_DEPRECATED void setPgpIdentity( const QCString & key ) { setPGPEncryptionKey( key ); setPGPSigningKey( key ); } /** The user's OpenPGP encryption key */ QCString pgpEncryptionKey() const { return mPGPEncryptionKey; } void setPGPEncryptionKey( const QCString & key ); /** The user's OpenPGP signing key */ QCString pgpSigningKey() const { return mPGPSigningKey; } void setPGPSigningKey( const QCString & key ); /** The user's S/MIME encryption key */ QCString smimeEncryptionKey() const { return mSMIMEEncryptionKey; } void setSMIMEEncryptionKey( const QCString & key ); /** The user's S/MIME signing key */ QCString smimeSigningKey() const { return mSMIMESigningKey; } void setSMIMESigningKey( const QCString & key ); Kleo::CryptoMessageFormat preferredCryptoMessageFormat() const { return mPreferredCryptoMessageFormat; } void setPreferredCryptoMessageFormat( Kleo::CryptoMessageFormat format ) { mPreferredCryptoMessageFormat = format; } /** email address (without the user name - only name@host) */ QString emailAddr() const { return mEmailAddr; } void setEmailAddr(const QString&); /** vCard to attach to outgoing emails */ QString vCardFile() const { return mVCardFile; } void setVCardFile(const QString&); /** email address in the format "username " suitable for the "From:" field of email messages. */ QString fullEmailAddr() const; /** email address for the ReplyTo: field */ QString replyToAddr() const { return mReplyToAddr; } void setReplyToAddr(const QString&); /** email addresses for the BCC: field */ QString bcc() const { return mBcc; } void setBcc(const QString& aBcc) { mBcc = aBcc; } void setSignature( const Signature & sig ) { mSignature = sig; } Signature & signature() /* _not_ const! */ { return mSignature; } protected: /** @return true if the signature is read from the output of a command */ bool signatureIsCommand() const { return mSignature.type() == Signature::FromCommand; } /** @return true if the signature is read from a text file */ bool signatureIsPlainFile() const { return mSignature.type() == Signature::FromFile; } /** @return true if the signature was specified directly */ bool signatureIsInline() const { return mSignature.type() == Signature::Inlined; } /** name of the signature file (with path) */ QString signatureFile() const { return mSignature.url(); } void setSignatureFile(const QString&); /** inline signature */ QString signatureInlineText() const { return mSignature.text();} void setSignatureInlineText(const QString&); /** Inline or signature from a file */ bool useSignatureFile() const { return signatureIsPlainFile() || signatureIsCommand(); } public: /** Returns the signature. This method also takes care of special signature files that are shell scripts and handles them correct. So use this method to rectreive the contents of the signature file. If @p prompt is false, no errors will be displayed (useful for retries). */ QString signatureText( bool * ok=0) const; /** The transport that is set for this identity. Used to link a transport with an identity. */ QString transport() const { return mTransport; } void setTransport(const QString&); /** The folder where sent messages from this identity will be stored by default. */ QString fcc() const { return mFcc; } void setFcc(const QString&); /** The folder where draft messages from this identity will be stored by default. */ QString drafts() const { return mDrafts; } void setDrafts(const QString&); /** dictionary which should be used for spell checking */ QString dictionary() const { return mDictionary; } void setDictionary( const QString& ); /** a X-Face header for this identity */ QString xface() const { return mXFace; } void setXFace( const QString& ); bool isXFaceEnabled() const { return mXFaceEnabled; } void setXFaceEnabled( const bool ); static const Identity null; bool isNull() const; protected: // if you add new members, make sure they have an operator= (or the // compiler can synthesize one) and amend Identity::operator==, // isNull(), readConfig() and writeConfig() as well as operator<< // and operator>> accordingly: uint mUoid; QString mIdentity, mFullName, mEmailAddr, mOrganization; QString mReplyToAddr; QString mBcc; QString mVCardFile; QCString mPGPEncryptionKey, mPGPSigningKey, mSMIMEEncryptionKey, mSMIMESigningKey; QString mFcc, mDrafts, mTransport; QString mDictionary; QString mXFace; bool mXFaceEnabled; Signature mSignature; bool mIsDefault; Kleo::CryptoMessageFormat mPreferredCryptoMessageFormat; }; -QDataStream & operator<<( QDataStream & stream, const KPIM::Signature & sig ); -QDataStream & operator>>( QDataStream & stream, KPIM::Signature & sig ); +KDE_EXPORT QDataStream & operator<<( QDataStream & stream, const KPIM::Signature & sig ); +KDE_EXPORT QDataStream & operator>>( QDataStream & stream, KPIM::Signature & sig ); -QDataStream & operator<<( QDataStream & stream, const KPIM::Identity & ident ); -QDataStream & operator>>( QDataStream & stream, KPIM::Identity & ident ); +KDE_EXPORT QDataStream & operator<<( QDataStream & stream, const KPIM::Identity & ident ); +KDE_EXPORT QDataStream & operator>>( QDataStream & stream, KPIM::Identity & ident ); } // namespace KPIM #endif /*kpim_identity_h*/