home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / libkcal / resourcekabc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  4.9 KB  |  181 lines

  1. /*
  2.     This file is part of libkcal.
  3.  
  4.     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20. */
  21. #ifndef KCAL_RESOURCEKABC_H
  22. #define KCAL_RESOURCEKABC_H
  23.  
  24. #include <qptrlist.h>
  25. #include <qstring.h>
  26. #include <qdatetime.h>
  27.  
  28. #include <kconfig.h>
  29.  
  30. #include "libkcal/incidence.h"
  31. #include "libkcal/calendarlocal.h"
  32. #include <kabc/addressbook.h>
  33.  
  34. #include "libkcal/resourcecalendar.h"
  35.  
  36. #include "libkdepim/kdepimmacros.h"
  37.  
  38. namespace KIO {
  39. class FileCopyJob;
  40. class Job;
  41. }
  42.  
  43. namespace KCal {
  44.  
  45. /**
  46.   Resource providing birthdays and anniversaries as events.
  47. */
  48. class KDE_EXPORT ResourceKABC : public ResourceCalendar
  49. {
  50.     Q_OBJECT
  51.  
  52.     friend class ResourceKABCConfig;
  53.  
  54.   public:
  55.     ResourceKABC( const KConfig * );
  56.     ResourceKABC( );
  57.     virtual ~ResourceKABC();
  58.  
  59.     void readConfig( const KConfig *config );
  60.     void writeConfig( KConfig* config );
  61.  
  62.     void setAlarm( bool );
  63.     bool alarm();
  64.  
  65.     void setAlarmDays( int );
  66.     int alarmDays();
  67.  
  68.     void setCategories( const QStringList &categories );
  69.     QStringList categories() const;
  70.  
  71.     void setUseCategories( bool useCategories );
  72.     bool useCategories() const;
  73.  
  74.     bool isSaving();
  75.  
  76.     KABC::Lock *lock();
  77.  
  78.     /** Add Event to calendar. */
  79.     bool addEvent(Event *anEvent);
  80.     /** deletes an event from this calendar. */
  81.     bool deleteEvent(Event *);
  82.  
  83.     /**
  84.       Retrieves an event on the basis of the unique string ID.
  85.     */
  86.     Event *event(const QString &UniqueStr);
  87.     /**
  88.       Return unfiltered list of all events in calendar.
  89.     */
  90.     Event::List rawEvents( EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
  91.     /**
  92.       Builds and then returns a list of all events that match for the
  93.       date specified. useful for dayView, etc. etc.
  94.     */
  95.     Event::List rawEventsForDate( const QDate &date, EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
  96.     /**
  97.       Get unfiltered events for date \a qdt.
  98.     */
  99.     Event::List rawEventsForDate( const QDateTime &qdt );
  100.     /**
  101.       Get unfiltered events in a range of dates. If inclusive is set to true,
  102.       only events are returned, which are completely included in the range.
  103.     */
  104.     Event::List rawEvents( const QDate &start, const QDate &end,
  105.                            bool inclusive = false );
  106.  
  107.     /**
  108.       Add a todo to the todolist.
  109.     */
  110.     bool addTodo( Todo *todo );
  111.     /**
  112.       Remove a todo from the todolist.
  113.     */
  114.     bool deleteTodo( Todo * );
  115.     /**
  116.       Searches todolist for an event with this unique string identifier,
  117.       returns a pointer or null.
  118.     */
  119.     Todo *todo( const QString &uid );
  120.     /**
  121.       Return list of all todos.
  122.     */
  123.     Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
  124.     /**
  125.       Returns list of todos due on the specified date.
  126.     */
  127.     Todo::List rawTodosForDate( const QDate &date );
  128.     /** Add a Journal entry to calendar */
  129.     virtual bool addJournal(Journal *);
  130.     /** Remove journal from the calendar. */
  131.     bool deleteJournal( Journal * );
  132.     /** Return Journal with given UID */
  133.     virtual Journal *journal(const QString &uid);
  134.     /**
  135.       Return list of all journals.
  136.     */
  137.     Journal::List rawJournals( JournalSortField sortField = JournalSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
  138.     /**
  139.       Returns list of journals for the given date.
  140.     */
  141.     Journal::List rawJournalsForDate( const QDate &date );
  142.  
  143.     /** Return all alarms, which ocur in the given time interval. */
  144.     Alarm::List alarms( const QDateTime &from, const QDateTime &to );
  145.  
  146.     /** Return all alarms, which ocur before given date. */
  147.     Alarm::List alarmsTo( const QDateTime &to );
  148.  
  149.     void dump() const;
  150.  
  151.     void setTimeZoneId( const QString &timeZoneId );
  152.  
  153.   protected:
  154.     bool doOpen();
  155.     bool doLoad();
  156.     bool doSave();
  157.  
  158.   private slots:
  159.     void reload();
  160.  
  161.   private:
  162.     void init();
  163.  
  164.     CalendarLocal mCalendar;
  165.  
  166.     int mAlarmDays;
  167.     bool mAlarm;
  168.     QStringList mCategories;
  169.     bool mUseCategories;
  170.     KABC::AddressBook *mAddressbook;
  171.  
  172.     KABC::Lock *mLock;
  173.  
  174.     class Private;
  175.     Private *d;
  176. };
  177.  
  178. }
  179.  
  180. #endif
  181.