• Skip to content
  • Skip to link menu
KDE 4.1 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 
00117     bool save( QString &err, Incidence *incidence = 0 );
00118 
00123     virtual bool isSaving();
00124 
00132     void setInhibitSave( bool inhibit );
00133 
00137     bool saveInhibited() const;
00138 
00142     virtual KABC::Lock *lock() = 0;
00143 
00147     virtual bool addIncidence( Incidence * );
00148 
00152     virtual bool deleteIncidence( Incidence * );
00153 
00160     Incidence *incidence( const QString &uid );
00161 
00165     virtual bool addEvent( Event *event ) = 0;
00166 
00170     virtual bool deleteEvent( Event * ) = 0;
00171 
00175     virtual void deleteAllEvents() = 0;
00176 
00180     virtual Event *event( const QString &uid ) = 0;
00181 
00189     virtual Event::List rawEvents(
00190       EventSortField sortField = EventSortUnsorted,
00191       SortDirection sortDirection = SortDirectionAscending ) = 0;
00192 
00202     virtual Event::List rawEventsForDate(
00203       const QDate &date,
00204       const KDateTime::Spec &timespec = KDateTime::Spec(),
00205       EventSortField sortField = EventSortUnsorted,
00206       SortDirection sortDirection = SortDirectionAscending ) = 0;
00207 
00211     virtual Event::List rawEventsForDate( const KDateTime &dt ) = 0;
00212 
00223     virtual Event::List rawEvents(
00224       const QDate &start, const QDate &end,
00225       const KDateTime::Spec &timespec = KDateTime::Spec(),
00226       bool inclusive = false ) = 0;
00227 
00250     virtual bool setValue( const QString &key, const QString &value );
00251 
00252   Q_SIGNALS:
00259     void resourceChanged( ResourceCalendar * );
00260 
00265     void resourceLoaded( ResourceCalendar * );
00266 
00271     void resourceSaved( ResourceCalendar * );
00272 
00276     void resourceLoadError( ResourceCalendar *, const QString &error );
00277 
00281     void resourceSaveError( ResourceCalendar *, const QString &error );
00282 
00286     void signalSubresourceAdded( ResourceCalendar *, const QString &type,
00287                                  const QString &subresource, const QString &label );
00288 
00292     void signalSubresourceRemoved( ResourceCalendar *, const QString &,
00293                                    const QString & );
00294 
00295   public:
00299     virtual bool addTodo( Todo *todo ) = 0;
00300 
00304     virtual bool deleteTodo( Todo * ) = 0;
00305 
00309     virtual void deleteAllTodos() = 0;
00310 
00317     virtual Todo *todo( const QString &uid ) = 0;
00318 
00322     virtual Todo::List rawTodos(
00323       TodoSortField sortField = TodoSortUnsorted,
00324       SortDirection sortDirection = SortDirectionAscending ) = 0;
00325 
00329     virtual Todo::List rawTodosForDate( const QDate &date ) = 0;
00330 
00334     virtual bool addJournal( Journal * ) = 0;
00335 
00339     virtual bool deleteJournal( Journal * ) = 0;
00340 
00344     virtual void deleteAllJournals() = 0;
00345 
00349     virtual Journal *journal( const QString &uid ) = 0;
00350 
00354     virtual Journal::List rawJournals(
00355       JournalSortField sortField = JournalSortUnsorted,
00356       SortDirection sortDirection = SortDirectionAscending ) = 0;
00357 
00361     virtual Journal::List rawJournalsForDate( const QDate &date ) = 0;
00362 
00366     virtual Alarm::List alarms( const KDateTime &from,
00367                                 const KDateTime &to ) = 0;
00368 
00372     virtual Alarm::List alarmsTo( const KDateTime &to ) = 0;
00373 
00375     Incidence::List rawIncidences();
00376 
00383     virtual void setTimeSpec( const KDateTime::Spec &timeSpec ) = 0;
00384 
00390     virtual KDateTime::Spec timeSpec() const = 0;
00391 
00401     virtual void setTimeZoneId( const QString &timeZoneId ) = 0;
00402 
00410     virtual QString timeZoneId() const = 0;
00411 
00426     virtual void shiftTimes( const KDateTime::Spec &oldSpec,
00427                              const KDateTime::Spec &newSpec ) = 0;
00428 
00434     virtual QStringList subresources() const;
00435 
00439     virtual bool canHaveSubresources() const;
00440 
00444     virtual bool subresourceActive( const QString &resource ) const;
00445 
00449     virtual QString labelForSubresource( const QString &resource ) const;
00450 
00459     virtual QString subresourceIdentifier( Incidence *incidence );
00460 
00461   public Q_SLOTS:
00465     virtual void setSubresourceActive( const QString &resource, bool active );
00466 
00470     virtual bool removeSubresource( const QString &resource );
00471 
00476     virtual bool addSubresource( const QString &resource, const QString &parent );
00477 
00482     virtual QString subresourceType( const QString &resource );
00483 
00484   protected:
00488     virtual bool doLoad( bool syncCache ) = 0;
00489 
00493     virtual bool doSave( bool syncCache ) = 0;
00494 
00500     virtual bool doSave( bool syncCache, Incidence * );
00501 
00505     virtual void addInfoText( QString & ) const {}
00506 
00510     void loadError( const QString &errorMessage = QString() );
00511 
00515     void saveError( const QString &errorMessage = QString() );
00516 
00517     bool receivedLoadError() const;
00518     void setReceivedLoadError( bool b );
00519     bool receivedSaveError() const;
00520     void setReceivedSaveError( bool b );
00521 
00528     void setNoReadOnlyOnLoad( bool noReadOnly );
00529 
00534     bool noReadOnlyOnLoad() const;
00535 
00536     using QObject::event;   // prevent warning about hidden virtual method
00537 
00538   private:
00539     //@cond PRIVATE
00540     Q_DISABLE_COPY( ResourceCalendar )
00541     class Private;
00542     Private *const d;
00543     //@endcond
00544 };
00545 
00547 typedef KRES::Manager<ResourceCalendar> CalendarResourceManager;
00548 
00549 }
00550 
00551 #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