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

KCal Library

resourcecalendar.h

00001 /*
00002   This file is part of the kcal library.
00003 
00004   Copyright (c) 1998 Preston Brown <pbrown@kde.org>
00005   Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
00006   Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
00007   Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00008 
00009   This library is free software; you can redistribute it and/or
00010   modify it under the terms of the GNU Library General Public
00011   License as published by the Free Software Foundation; either
00012   version 2 of the License, or (at your option) any later version.
00013 
00014   This library is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017   Library General Public License for more details.
00018 
00019   You should have received a copy of the GNU Library General Public License
00020   along with this library; see the file COPYING.LIB.  If not, write to
00021   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00022   Boston, MA 02110-1301, USA.
00023 */
00024 
00025 #ifndef KCAL_RESOURCECALENDAR_H
00026 #define KCAL_RESOURCECALENDAR_H
00027 
00028 #include "alarm.h"
00029 #include "todo.h"
00030 #include "event.h"
00031 #include "journal.h"
00032 #include "calendar.h"
00033 
00034 #include "kresources/resource.h"
00035 #include "kresources/manager.h"
00036 #include "kabc/lock.h"
00037 
00038 #include <kdatetime.h>
00039 #include <kconfig.h>
00040 
00041 #include <QtCore/QString>
00042 
00043 namespace KCal {
00044 
00049 class KCAL_EXPORT ResourceCalendar : public KRES::Resource
00050 {
00051   Q_OBJECT
00052   public:
00053     ResourceCalendar();
00054     explicit ResourceCalendar( const KConfigGroup &group );
00055     virtual ~ResourceCalendar();
00056 
00057     bool isResolveConflictSet() const;
00058     void setResolveConflict( bool b );
00059 
00060     virtual void writeConfig( KConfigGroup &group );
00061 
00066     virtual QString infoText() const;
00067 
00087     virtual bool load();
00088 
00106     bool save( Incidence *incidence = 0 );
00107 
00112     virtual bool isSaving();
00113 
00121     void setInhibitSave( bool inhibit );
00122 
00126     bool saveInhibited() const;
00127 
00131     virtual KABC::Lock *lock() = 0;
00132 
00136     virtual bool addIncidence( Incidence * );
00137 
00141     virtual bool deleteIncidence( Incidence * );
00142 
00149     Incidence *incidence( const QString &uid );
00150 
00154     virtual bool addEvent( Event *event ) = 0;
00155 
00159     virtual bool deleteEvent( Event * ) = 0;
00160 
00164     virtual void deleteAllEvents() = 0;
00165 
00169     virtual Event *event( const QString &uid ) = 0;
00170 
00178     virtual Event::List rawEvents(
00179       EventSortField sortField = EventSortUnsorted,
00180       SortDirection sortDirection = SortDirectionAscending ) = 0;
00181 
00191     virtual Event::List rawEventsForDate(
00192       const QDate &date,
00193       const KDateTime::Spec &timespec = KDateTime::Spec(),
00194       EventSortField sortField = EventSortUnsorted,
00195       SortDirection sortDirection = SortDirectionAscending ) = 0;
00196 
00200     virtual Event::List rawEventsForDate( const KDateTime &dt ) = 0;
00201 
00212     virtual Event::List rawEvents(
00213       const QDate &start, const QDate &end,
00214       const KDateTime::Spec &timespec = KDateTime::Spec(),
00215       bool inclusive = false ) = 0;
00216 
00239     virtual bool setValue( const QString &key, const QString &value );
00240 
00241   Q_SIGNALS:
00248     void resourceChanged( ResourceCalendar * );
00249 
00254     void resourceLoaded( ResourceCalendar * );
00255 
00260     void resourceSaved( ResourceCalendar * );
00261 
00265     void resourceLoadError( ResourceCalendar *, const QString &error );
00266 
00270     void resourceSaveError( ResourceCalendar *, const QString &error );
00271 
00275     void signalSubresourceAdded( ResourceCalendar *, const QString &type,
00276                                  const QString &subresource, const QString &label );
00277 
00281     void signalSubresourceRemoved( ResourceCalendar *, const QString &,
00282                                    const QString & );
00283 
00284   public:
00288     virtual bool addTodo( Todo *todo ) = 0;
00289 
00293     virtual bool deleteTodo( Todo * ) = 0;
00294 
00298     virtual void deleteAllTodos() = 0;
00299 
00306     virtual Todo *todo( const QString &uid ) = 0;
00307 
00311     virtual Todo::List rawTodos(
00312       TodoSortField sortField = TodoSortUnsorted,
00313       SortDirection sortDirection = SortDirectionAscending ) = 0;
00314 
00318     virtual Todo::List rawTodosForDate( const QDate &date ) = 0;
00319 
00323     virtual bool addJournal( Journal * ) = 0;
00324 
00328     virtual bool deleteJournal( Journal * ) = 0;
00329 
00333     virtual void deleteAllJournals() = 0;
00334 
00338     virtual Journal *journal( const QString &uid ) = 0;
00339 
00343     virtual Journal::List rawJournals(
00344       JournalSortField sortField = JournalSortUnsorted,
00345       SortDirection sortDirection = SortDirectionAscending ) = 0;
00346 
00350     virtual Journal::List rawJournalsForDate( const QDate &date ) = 0;
00351 
00355     virtual Alarm::List alarms( const KDateTime &from,
00356                                 const KDateTime &to ) = 0;
00357 
00361     virtual Alarm::List alarmsTo( const KDateTime &to ) = 0;
00362 
00364     Incidence::List rawIncidences();
00365 
00372     virtual void setTimeSpec( const KDateTime::Spec &timeSpec ) = 0;
00373 
00379     virtual KDateTime::Spec timeSpec() const = 0;
00380 
00390     virtual void setTimeZoneId( const QString &timeZoneId ) = 0;
00391 
00399     virtual QString timeZoneId() const = 0;
00400 
00415     virtual void shiftTimes( const KDateTime::Spec &oldSpec,
00416                              const KDateTime::Spec &newSpec ) = 0;
00417 
00423     virtual QStringList subresources() const;
00424 
00428     virtual bool canHaveSubresources() const;
00429 
00433     virtual bool subresourceActive( const QString &resource ) const;
00434 
00438     virtual QString labelForSubresource( const QString &resource ) const;
00439 
00448     virtual QString subresourceIdentifier( Incidence *incidence );
00449 
00450   public Q_SLOTS:
00454     virtual void setSubresourceActive( const QString &resource, bool active );
00455 
00459     virtual bool removeSubresource( const QString &resource );
00460 
00465     virtual bool addSubresource( const QString &resource, const QString &parent );
00466 
00471     virtual QString subresourceType( const QString &resource );
00472 
00473   protected:
00477     virtual bool doLoad( bool syncCache ) = 0;
00478 
00482     virtual bool doSave( bool syncCache ) = 0;
00483 
00489     virtual bool doSave( bool syncCache, Incidence * );
00490 
00494     virtual void addInfoText( QString & ) const {}
00495 
00499     void loadError( const QString &errorMessage = QString() );
00500 
00504     void saveError( const QString &errorMessage = QString() );
00505 
00506     bool receivedLoadError() const;
00507     void setReceivedLoadError( bool b );
00508     bool receivedSaveError() const;
00509     void setReceivedSaveError( bool b );
00510 
00517     void setNoReadOnlyOnLoad( bool noReadOnly );
00518 
00523     bool noReadOnlyOnLoad() const;
00524 
00525     using QObject::event;   // prevent warning about hidden virtual method
00526 
00527   private:
00528     //@cond PRIVATE
00529     Q_DISABLE_COPY( ResourceCalendar )
00530     class Private;
00531     Private *const d;
00532     //@endcond
00533 };
00534 
00536 typedef KRES::Manager<ResourceCalendar> CalendarResourceManager;
00537 
00538 }
00539 
00540 #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"
  • 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.5
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