• Skip to content
  • Skip to link menu
KDE 4.1 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 "resourcecalendar.h"
00038 
00039 #include "kcal_export.h"
00040 
00041 class QWidget;
00042 
00043 namespace KCal {
00044 
00056 class KCAL_EXPORT CalendarResources
00057   : public Calendar, public KRES::ManagerObserver<ResourceCalendar>
00058 {
00059   Q_OBJECT
00060   public:
00064     class DestinationPolicy
00065     {
00066       public:
00072         explicit DestinationPolicy( CalendarResourceManager *manager, QWidget *parent = 0 );
00073 
00077         virtual ~DestinationPolicy();
00078 
00082         virtual QWidget *parent();
00083 
00088         virtual void setParent( QWidget *parent );
00089 
00094         virtual ResourceCalendar *destination( Incidence *incidence ) = 0;
00095 
00096       protected:
00100         CalendarResourceManager *resourceManager();
00101 
00102       private:
00103         //@cond PRIVATE
00104         Q_DISABLE_COPY( DestinationPolicy )
00105         class Private;
00106         Private *d;
00107         //@endcond
00108     };
00109 
00113     class StandardDestinationPolicy : public DestinationPolicy
00114     {
00115       public:
00121         explicit StandardDestinationPolicy( CalendarResourceManager *manager, QWidget *parent = 0 );
00122 
00126         virtual ~StandardDestinationPolicy();
00127 
00132         ResourceCalendar *destination( Incidence *incidence );
00133 
00134       private:
00135         //@cond PRIVATE
00136         Q_DISABLE_COPY( StandardDestinationPolicy )
00137         class Private;
00138         Private *d;
00139         //@endcond
00140     };
00141 
00145     class AskDestinationPolicy : public DestinationPolicy
00146     {
00147       public:
00153         explicit AskDestinationPolicy( CalendarResourceManager *manager, QWidget *parent = 0 );
00154 
00158         virtual ~AskDestinationPolicy();
00159 
00164         ResourceCalendar *destination( Incidence *incidence );
00165 
00166       private:
00167         //@cond PRIVATE
00168         Q_DISABLE_COPY( AskDestinationPolicy )
00169         class Private;
00170         Private *d;
00171         //@endcond
00172     };
00173 
00177     class Ticket
00178     {
00179       friend class CalendarResources;
00180 
00181       public:
00185         ResourceCalendar *resource() const;
00186 
00190         ~Ticket();
00191 
00192       private:
00197         Ticket( ResourceCalendar *resource );
00198 
00199         //@cond PRIVATE
00200         Q_DISABLE_COPY( Ticket )
00201         class Private;
00202         Private *d;
00203         //@endcond
00204     };
00205 
00216     CalendarResources(
00217       const KDateTime::Spec &timeSpec,
00218       const QString &family = QLatin1String( "calendar" ) );
00219 
00229     CalendarResources(
00230       const QString &timeZoneId,
00231       const QString &family = QLatin1String( "calendar" ) );
00232 
00236     ~CalendarResources();
00237 
00243     void load();
00244 
00249     bool reload();
00250 
00255     void close();
00256 
00270     virtual bool save( Ticket *ticket, Incidence *incidence = 0 );
00271 
00276     bool save();
00277 
00282     bool isSaving();
00283 
00287     CalendarResourceManager *resourceManager() const;
00288 
00295     ResourceCalendar *resource( Incidence *incidence );
00296 
00305     void readConfig( KConfig *config = 0 );
00306 
00311     void setStandardDestinationPolicy();
00312 
00317     void setAskDestinationPolicy();
00318 
00331     QWidget *dialogParentWidget();
00332 
00342     void setDialogParentWidget( QWidget *parent );
00343 
00355     Ticket *requestSaveTicket( ResourceCalendar *resource );
00356 
00363     virtual void releaseSaveTicket( Ticket *ticket );
00364 
00376     void resourceAdded( ResourceCalendar *resource );
00377 
00378   // Incidence Specific Methods //
00379 
00384     bool addIncidence( Incidence *incidence );
00385 
00394     bool addIncidence( Incidence *incidence, ResourceCalendar *resource );
00395 
00400     bool beginChange( Incidence *incidence );
00401 
00406     bool endChange( Incidence *incidence );
00407 
00408   // Event Specific Methods //
00409 
00414     bool addEvent( Event *event );
00415 
00427     bool addEvent( Event *event, ResourceCalendar *resource );
00428 
00433     bool deleteEvent( Event *event );
00434 
00439     void deleteAllEvents();
00440 
00445     Event::List rawEvents(
00446       EventSortField sortField = EventSortUnsorted,
00447       SortDirection sortDirection = SortDirectionAscending );
00448 
00453     Event::List rawEventsForDate( const KDateTime &dt );
00454 
00459     Event::List rawEvents( const QDate &start, const QDate &end,
00460                            const KDateTime::Spec &timespec = KDateTime::Spec(),
00461                            bool inclusive = false );
00462 
00467     Event::List rawEventsForDate(
00468       const QDate &date,
00469       const KDateTime::Spec &timespec = KDateTime::Spec(),
00470       EventSortField sortField = EventSortUnsorted,
00471       SortDirection sortDirection = SortDirectionAscending );
00472 
00477     Event *event( const QString &uid );
00478 
00479   // Todo Specific Methods //
00480 
00485     bool addTodo( Todo *todo );
00486 
00498     bool addTodo( Todo *todo, ResourceCalendar *resource );
00499 
00504     bool deleteTodo( Todo *todo );
00505 
00510     void deleteAllTodos();
00511 
00516     Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted,
00517                          SortDirection sortDirection = SortDirectionAscending );
00518 
00523     Todo::List rawTodosForDate( const QDate &date );
00524 
00529     Todo *todo( const QString &uid );
00530 
00531   // Journal Specific Methods //
00532 
00537     bool addJournal( Journal *journal );
00538 
00550     bool addJournal( Journal *journal, ResourceCalendar *resource );
00551 
00556     bool deleteJournal( Journal *journal );
00557 
00562     void deleteAllJournals();
00563 
00568     Journal::List rawJournals(
00569       JournalSortField sortField = JournalSortUnsorted,
00570       SortDirection sortDirection = SortDirectionAscending );
00571 
00576     Journal::List rawJournalsForDate( const QDate &date );
00577 
00582     Journal *journal( const QString &uid );
00583 
00584   // Alarm Specific Methods //
00585 
00590     Alarm::List alarms( const KDateTime &from, const KDateTime &to );
00591 
00599     Alarm::List alarmsTo( const KDateTime &to );
00600 
00601     using QObject::event;   // prevent warning about hidden virtual method
00602 
00603   Q_SIGNALS:
00610     void signalResourceModified( ResourceCalendar *resource );
00611 
00618     void signalResourceAdded( ResourceCalendar *resource );
00619 
00626     void signalResourceDeleted( ResourceCalendar *resource );
00627 
00632     void signalErrorMessage( const QString &err );
00633 
00634   protected:
00639     void connectResource( ResourceCalendar *resource );
00640 
00647     void resourceModified( ResourceCalendar *resource );
00648 
00654     void resourceDeleted( ResourceCalendar *resource );
00655 
00660     virtual void doSetTimeSpec( const KDateTime::Spec &timeSpec );
00661 
00669     int incrementChangeCount( ResourceCalendar *resource );
00670 
00678     int decrementChangeCount( ResourceCalendar *resource );
00679 
00680   protected Q_SLOTS:
00689     void slotLoadError( ResourceCalendar *resource, const QString &err );
00690 
00699     void slotSaveError( ResourceCalendar *resource, const QString &err );
00700 
00701   private:
00702     //@cond PRIVATE
00703     Q_DISABLE_COPY( CalendarResources )
00704     class Private;
00705     Private *d;
00706     //@endcond
00707 };
00708 
00709 }
00710 
00711 #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
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.4
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