• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.8.3 API Reference
  • KDE Home
  • 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_DEPRECATED 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 
00101         bool hasCalendarResources();
00102       protected:
00106         CalendarResourceManager *resourceManager();
00107 
00108       private:
00109         //@cond PRIVATE
00110         Q_DISABLE_COPY( DestinationPolicy )
00111         class Private;
00112         Private *d;
00113         //@endcond
00114     };
00115 
00119     class StandardDestinationPolicy : public DestinationPolicy
00120     {
00121       public:
00127         explicit StandardDestinationPolicy( CalendarResourceManager *manager, QWidget *parent = 0 );
00128 
00132         virtual ~StandardDestinationPolicy();
00133 
00138         ResourceCalendar *destination( Incidence *incidence );
00139 
00140       private:
00141         //@cond PRIVATE
00142         Q_DISABLE_COPY( StandardDestinationPolicy )
00143         class Private;
00144         Private *d;
00145         //@endcond
00146     };
00147 
00151     class AskDestinationPolicy : public DestinationPolicy
00152     {
00153       public:
00159         explicit AskDestinationPolicy( CalendarResourceManager *manager, QWidget *parent = 0 );
00160 
00164         virtual ~AskDestinationPolicy();
00165 
00170         ResourceCalendar *destination( Incidence *incidence );
00171       private:
00172         //@cond PRIVATE
00173         Q_DISABLE_COPY( AskDestinationPolicy )
00174         class Private;
00175         Private *d;
00176         //@endcond
00177     };
00178 
00182     class Ticket
00183     {
00184       friend class CalendarResources;
00185 
00186       public:
00190         ResourceCalendar *resource() const;
00191 
00195         ~Ticket();
00196 
00197       private:
00202         Ticket( ResourceCalendar *resource );
00203 
00204         //@cond PRIVATE
00205         Q_DISABLE_COPY( Ticket )
00206         class Private;
00207         Private *d;
00208         //@endcond
00209     };
00210 
00221     CalendarResources(
00222       const KDateTime::Spec &timeSpec,
00223       const QString &family = QLatin1String( "calendar" ) );
00224 
00234     CalendarResources(
00235       const QString &timeZoneId,
00236       const QString &family = QLatin1String( "calendar" ) );
00237 
00241     ~CalendarResources();
00242 
00247     void clearException();
00248 
00254     ErrorFormat *exception();
00255 
00261     void load();
00262 
00267     bool reload();
00268 
00273     void close();
00274 
00288     virtual bool save( Ticket *ticket, Incidence *incidence = 0 );
00289 
00294     bool save();
00295 
00300     bool isSaving();
00301 
00305     CalendarResourceManager *resourceManager() const;
00306 
00313     ResourceCalendar *resource( Incidence *incidence );
00314 
00323     void readConfig( KConfig *config = 0 );
00324 
00329     void setStandardDestinationPolicy();
00330 
00335     void setAskDestinationPolicy();
00336 
00341     bool hasCalendarResources();
00342 
00355     QWidget *dialogParentWidget();
00356 
00366     void setDialogParentWidget( QWidget *parent );
00367 
00379     Ticket *requestSaveTicket( ResourceCalendar *resource );
00380 
00387     virtual void releaseSaveTicket( Ticket *ticket );
00388 
00400     void resourceAdded( ResourceCalendar *resource );
00401 
00402   // Incidence Specific Methods //
00403 
00412     bool addIncidence( Incidence *incidence );
00413 
00422     bool addIncidence( Incidence *incidence, ResourceCalendar *resource );
00423 
00428     bool beginChange( Incidence *incidence );
00429 
00434     bool endChange( Incidence *incidence );
00435 
00436   // Event Specific Methods //
00437 
00442     bool addEvent( Event *event );
00443 
00455     bool addEvent( Event *event, ResourceCalendar *resource );
00456 
00461     bool deleteEvent( Event *event );
00462 
00467     void deleteAllEvents();
00468 
00473     Event::List rawEvents(
00474       EventSortField sortField = EventSortUnsorted,
00475       SortDirection sortDirection = SortDirectionAscending );
00476 
00481     Event::List rawEventsForDate( const KDateTime &dt );
00482 
00487     Event::List rawEvents( const QDate &start, const QDate &end,
00488                            const KDateTime::Spec &timeSpec = KDateTime::Spec(),
00489                            bool inclusive = false );
00490 
00502     Event::List rawEventsForDate( const QDate &date,
00503                                   const KDateTime::Spec &timeSpec = KDateTime::Spec(),
00504                                   EventSortField sortField = EventSortUnsorted,
00505                                   SortDirection sortDirection = SortDirectionAscending );
00506 
00511     Event *event( const QString &uid );
00512 
00513   // Todo Specific Methods //
00514 
00519     bool addTodo( Todo *todo );
00520 
00532     bool addTodo( Todo *todo, ResourceCalendar *resource );
00533 
00538     bool deleteTodo( Todo *todo );
00539 
00544     void deleteAllTodos();
00545 
00550     Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted,
00551                          SortDirection sortDirection = SortDirectionAscending );
00552 
00557     Todo::List rawTodosForDate( const QDate &date );
00558 
00563     Todo *todo( const QString &uid );
00564 
00565   // Journal Specific Methods //
00566 
00571     bool addJournal( Journal *journal );
00572 
00584     bool addJournal( Journal *journal, ResourceCalendar *resource );
00585 
00590     bool deleteJournal( Journal *journal );
00591 
00596     void deleteAllJournals();
00597 
00602     Journal::List rawJournals(
00603       JournalSortField sortField = JournalSortUnsorted,
00604       SortDirection sortDirection = SortDirectionAscending );
00605 
00610     Journal::List rawJournalsForDate( const QDate &date );
00611 
00616     Journal *journal( const QString &uid );
00617 
00618   // Alarm Specific Methods //
00619 
00624     Alarm::List alarms( const KDateTime &from, const KDateTime &to );
00625 
00633     Alarm::List alarmsTo( const KDateTime &to );
00634 
00635     using QObject::event;   // prevent warning about hidden virtual method
00636 
00637   Q_SIGNALS:
00644     void signalResourceModified( ResourceCalendar *resource );
00645 
00652     void signalResourceAdded( ResourceCalendar *resource );
00653 
00660     void signalResourceDeleted( ResourceCalendar *resource );
00661 
00666     void signalErrorMessage( const QString &err );
00667 
00668   protected:
00673     void connectResource( ResourceCalendar *resource );
00674 
00681     void resourceModified( ResourceCalendar *resource );
00682 
00688     void resourceDeleted( ResourceCalendar *resource );
00689 
00694     virtual void doSetTimeSpec( const KDateTime::Spec &timeSpec );
00695 
00703     int incrementChangeCount( ResourceCalendar *resource );
00704 
00712     int decrementChangeCount( ResourceCalendar *resource );
00713 
00714   protected Q_SLOTS:
00723     void slotLoadError( ResourceCalendar *resource, const QString &err );
00724 
00733     void slotSaveError( ResourceCalendar *resource, const QString &err );
00734 
00741     void beginAddingIncidences();
00742 
00747     void endAddingIncidences();
00748 
00749   private:
00750     //@cond PRIVATE
00751     Q_DISABLE_COPY( CalendarResources )
00752     class Private;
00753     Private *d;
00754     //@endcond
00755 };
00756 
00757 }
00758 
00759 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:19:46 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

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

kdepimlibs-4.8.3 API Reference

Skip menu "kdepimlibs-4.8.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal