• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

KCal Library

calendarresources.h

Go to the documentation of this file.
00001 /*
00002   This file is part of the kcal library.
00003 
00004   Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
00005   Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007   This library is free software; you can redistribute it and/or
00008   modify it under the terms of the GNU Library General Public
00009   License as published by the Free Software Foundation; either
00010   version 2 of the License, or (at your option) any later version.
00011 
00012   This library is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015   Library General Public License for more details.
00016 
00017   You should have received a copy of the GNU Library General Public License
00018   along with this library; see the file COPYING.LIB.  If not, write to
00019   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020   Boston, MA 02110-1301, USA.
00021 */
00031 #ifndef KCAL_CALENDARRESOURCES_H
00032 #define KCAL_CALENDARRESOURCES_H
00033 
00034 #include <QtCore/QMap>
00035 
00036 #include "calendar.h"
00037 #include "exceptions.h"
00038 #include "resourcecalendar.h"
00039 
00040 #include "kcal_export.h"
00041 
00042 class QWidget;
00043 
00044 namespace KCal {
00045 
00057 class KCAL_EXPORT CalendarResources
00058   : public Calendar, public KRES::ManagerObserver<ResourceCalendar>
00059 {
00060   Q_OBJECT
00061   public:
00065     class DestinationPolicy
00066     {
00067       public:
00073         explicit DestinationPolicy( CalendarResourceManager *manager, QWidget *parent = 0 );
00074 
00078         virtual ~DestinationPolicy();
00079 
00083         virtual QWidget *parent();
00084 
00089         virtual void setParent( QWidget *parent );
00090 
00095         virtual ResourceCalendar *destination( Incidence *incidence ) = 0;
00096 
00097       protected:
00101         CalendarResourceManager *resourceManager();
00102 
00103       private:
00104         //@cond PRIVATE
00105         Q_DISABLE_COPY( DestinationPolicy )
00106         class Private;
00107         Private *d;
00108         //@endcond
00109     };
00110 
00114     class StandardDestinationPolicy : public DestinationPolicy
00115     {
00116       public:
00122         explicit StandardDestinationPolicy( CalendarResourceManager *manager, QWidget *parent = 0 );
00123 
00127         virtual ~StandardDestinationPolicy();
00128 
00133         ResourceCalendar *destination( Incidence *incidence );
00134 
00135       private:
00136         //@cond PRIVATE
00137         Q_DISABLE_COPY( StandardDestinationPolicy )
00138         class Private;
00139         Private *d;
00140         //@endcond
00141     };
00142 
00146     class AskDestinationPolicy : public DestinationPolicy
00147     {
00148       public:
00154         explicit AskDestinationPolicy( CalendarResourceManager *manager, QWidget *parent = 0 );
00155 
00159         virtual ~AskDestinationPolicy();
00160 
00165         ResourceCalendar *destination( Incidence *incidence );
00166 
00167       private:
00168         //@cond PRIVATE
00169         Q_DISABLE_COPY( AskDestinationPolicy )
00170         class Private;
00171         Private *d;
00172         //@endcond
00173     };
00174 
00178     class Ticket
00179     {
00180       friend class CalendarResources;
00181 
00182       public:
00186         ResourceCalendar *resource() const;
00187 
00191         ~Ticket();
00192 
00193       private:
00198         Ticket( ResourceCalendar *resource );
00199 
00200         //@cond PRIVATE
00201         Q_DISABLE_COPY( Ticket )
00202         class Private;
00203         Private *d;
00204         //@endcond
00205     };
00206 
00217     CalendarResources(
00218       const KDateTime::Spec &timeSpec,
00219       const QString &family = QLatin1String( "calendar" ) );
00220 
00230     CalendarResources(
00231       const QString &timeZoneId,
00232       const QString &family = QLatin1String( "calendar" ) );
00233 
00237     ~CalendarResources();
00238 
00243     void clearException();
00244 
00250     ErrorFormat *exception();
00251 
00257     void load();
00258 
00263     bool reload();
00264 
00269     void close();
00270 
00284     virtual bool save( Ticket *ticket, Incidence *incidence = 0 );
00285 
00290     bool save();
00291 
00296     bool isSaving();
00297 
00301     CalendarResourceManager *resourceManager() const;
00302 
00309     ResourceCalendar *resource( Incidence *incidence );
00310 
00319     void readConfig( KConfig *config = 0 );
00320 
00325     void setStandardDestinationPolicy();
00326 
00331     void setAskDestinationPolicy();
00332 
00345     QWidget *dialogParentWidget();
00346 
00356     void setDialogParentWidget( QWidget *parent );
00357 
00369     Ticket *requestSaveTicket( ResourceCalendar *resource );
00370 
00377     virtual void releaseSaveTicket( Ticket *ticket );
00378 
00390     void resourceAdded( ResourceCalendar *resource );
00391 
00392   // Incidence Specific Methods //
00393 
00402     bool addIncidence( Incidence *incidence );
00403 
00412     bool addIncidence( Incidence *incidence, ResourceCalendar *resource );
00413 
00418     bool beginChange( Incidence *incidence );
00419 
00424     bool endChange( Incidence *incidence );
00425 
00426   // Event Specific Methods //
00427 
00432     bool addEvent( Event *event );
00433 
00445     bool addEvent( Event *event, ResourceCalendar *resource );
00446 
00451     bool deleteEvent( Event *event );
00452 
00457     void deleteAllEvents();
00458 
00463     Event::List rawEvents(
00464       EventSortField sortField = EventSortUnsorted,
00465       SortDirection sortDirection = SortDirectionAscending );
00466 
00471     Event::List rawEventsForDate( const KDateTime &dt );
00472 
00477     Event::List rawEvents( const QDate &start, const QDate &end,
00478                            const KDateTime::Spec &timespec = KDateTime::Spec(),
00479                            bool inclusive = false );
00480 
00485     Event::List rawEventsForDate(
00486       const QDate &date,
00487       const KDateTime::Spec &timespec = KDateTime::Spec(),
00488       EventSortField sortField = EventSortUnsorted,
00489       SortDirection sortDirection = SortDirectionAscending );
00490 
00495     Event *event( const QString &uid );
00496 
00497   // Todo Specific Methods //
00498 
00503     bool addTodo( Todo *todo );
00504 
00516     bool addTodo( Todo *todo, ResourceCalendar *resource );
00517 
00522     bool deleteTodo( Todo *todo );
00523 
00528     void deleteAllTodos();
00529 
00534     Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted,
00535                          SortDirection sortDirection = SortDirectionAscending );
00536 
00541     Todo::List rawTodosForDate( const QDate &date );
00542 
00547     Todo *todo( const QString &uid );
00548 
00549   // Journal Specific Methods //
00550 
00555     bool addJournal( Journal *journal );
00556 
00568     bool addJournal( Journal *journal, ResourceCalendar *resource );
00569 
00574     bool deleteJournal( Journal *journal );
00575 
00580     void deleteAllJournals();
00581 
00586     Journal::List rawJournals(
00587       JournalSortField sortField = JournalSortUnsorted,
00588       SortDirection sortDirection = SortDirectionAscending );
00589 
00594     Journal::List rawJournalsForDate( const QDate &date );
00595 
00600     Journal *journal( const QString &uid );
00601 
00602   // Alarm Specific Methods //
00603 
00608     Alarm::List alarms( const KDateTime &from, const KDateTime &to );
00609 
00617     Alarm::List alarmsTo( const KDateTime &to );
00618 
00619     using QObject::event;   // prevent warning about hidden virtual method
00620 
00621   Q_SIGNALS:
00628     void signalResourceModified( ResourceCalendar *resource );
00629 
00636     void signalResourceAdded( ResourceCalendar *resource );
00637 
00644     void signalResourceDeleted( ResourceCalendar *resource );
00645 
00650     void signalErrorMessage( const QString &err );
00651 
00652   protected:
00657     void connectResource( ResourceCalendar *resource );
00658 
00665     void resourceModified( ResourceCalendar *resource );
00666 
00672     void resourceDeleted( ResourceCalendar *resource );
00673 
00678     virtual void doSetTimeSpec( const KDateTime::Spec &timeSpec );
00679 
00687     int incrementChangeCount( ResourceCalendar *resource );
00688 
00696     int decrementChangeCount( ResourceCalendar *resource );
00697 
00698   protected Q_SLOTS:
00707     void slotLoadError( ResourceCalendar *resource, const QString &err );
00708 
00717     void slotSaveError( ResourceCalendar *resource, const QString &err );
00718 
00719   private:
00720     //@cond PRIVATE
00721     Q_DISABLE_COPY( CalendarResources )
00722     class Private;
00723     Private *d;
00724     //@endcond
00725 };
00726 
00727 }
00728 
00729 #endif

KCal Library

Skip menu "KCal Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.7.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal