~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to calendarsupport/nepomukcalendar.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (C) 2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
 
3
  Author: Sérgio Martins <sergio.martins@kdab.com>
 
4
 
 
5
  This program is free software; you can redistribute it and/or modify
 
6
  it under the terms of the GNU General Public License as published by
 
7
  the Free Software Foundation; either version 2 of the License, or
 
8
  (at your option) any later version.
 
9
 
 
10
  This program is distributed in the hope that it will be useful,
 
11
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
13
  GNU General Public License for more details.
 
14
 
 
15
  You should have received a copy of the GNU General Public License along
 
16
  with this program; if not, write to the Free Software Foundation, Inc.,
 
17
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
18
*/
 
19
 
 
20
#ifndef CALENDARSUPPORT_NEPOMUKCALENDAR_H
 
21
#define CALENDARSUPPORT_NEPOMUKCALENDAR_H
 
22
 
 
23
#include "calendarsupport_export.h"
 
24
#include "next/incidencechanger2.h"
 
25
 
 
26
#include <KCalCore/IncidenceBase>
 
27
 
 
28
#include <Akonadi/Item>
 
29
#include <Akonadi/Collection>
 
30
 
 
31
#include <KCalCore/MemoryCalendar>
 
32
#include <KCalCore/ScheduleMessage>
 
33
 
 
34
class KJob;
 
35
 
 
36
namespace CalendarSupport {
 
37
 
 
38
class CALENDARSUPPORT_EXPORT NepomukCalendar : public KCalCore::MemoryCalendar
 
39
{
 
40
  Q_OBJECT
 
41
  // prevent warning about hidden virtual method
 
42
  using QObject::event;
 
43
  using KCalCore::Calendar::addIncidence;
 
44
  using KCalCore::Calendar::deleteIncidence;
 
45
 
 
46
  public:
 
47
    typedef QSharedPointer<NepomukCalendar> Ptr;
 
48
 
 
49
 
 
50
    static NepomukCalendar::Ptr create( QWidget *parent = 0 );
 
51
    virtual ~NepomukCalendar();
 
52
 
 
53
    virtual bool save();
 
54
    virtual bool reload();
 
55
    virtual void close();
 
56
 
 
57
    KCalCore::Incidence::List incidencesFromSchedulingID( const QString &sid ) const;
 
58
    KCalCore::Incidence::Ptr incidenceFromSchedulingID( const QString &sid ) const;
 
59
 
 
60
    virtual void incidenceUpdate( const QString &uid, const KDateTime &recurrenceId );
 
61
    virtual void incidenceUpdated( const QString &uid, const KDateTime &recurrenceId );
 
62
 
 
63
    virtual bool addEvent( const KCalCore::Event::Ptr &event );
 
64
    virtual bool deleteEvent( const KCalCore::Event::Ptr &event );
 
65
    virtual void deleteAllEvents();  //unused
 
66
 
 
67
    virtual KCalCore::Event::List rawEvents(
 
68
      KCalCore::EventSortField sortField = KCalCore::EventSortUnsorted,
 
69
      KCalCore::SortDirection sortDirection = KCalCore::SortDirectionAscending ) const;
 
70
 
 
71
    virtual KCalCore::Event::List rawEventsForDate( const KDateTime &dt ) const;
 
72
 
 
73
    virtual KCalCore::Event::List rawEvents(
 
74
      const QDate &start, const QDate &end,
 
75
      const KDateTime::Spec &timeSpec = KDateTime::Spec(),
 
76
      bool inclusive = false ) const;
 
77
 
 
78
    virtual KCalCore::Event::List rawEventsForDate(
 
79
      const QDate &date,
 
80
      const KDateTime::Spec &timeSpec = KDateTime::Spec(),
 
81
      KCalCore::EventSortField sortField = KCalCore::EventSortUnsorted,
 
82
      KCalCore::SortDirection sortDirection = KCalCore::SortDirectionAscending ) const;
 
83
 
 
84
    virtual KCalCore::Event::Ptr event( const QString &uid,
 
85
                                        const KDateTime &recurrenceId = KDateTime() ) const;
 
86
 
 
87
    virtual bool addTodo( const KCalCore::Todo::Ptr &todo );
 
88
 
 
89
    virtual bool deleteTodo( const KCalCore::Todo::Ptr &todo );
 
90
 
 
91
    virtual void deleteAllTodos(); //unused
 
92
 
 
93
    virtual KCalCore::Todo::List rawTodos(
 
94
      KCalCore::TodoSortField sortField = KCalCore::TodoSortUnsorted,
 
95
      KCalCore::SortDirection sortDirection = KCalCore::SortDirectionAscending ) const;
 
96
 
 
97
    virtual KCalCore::Todo::List rawTodosForDate( const QDate &date ) const;
 
98
 
 
99
    virtual KCalCore::Todo::Ptr todo( const QString &uid,
 
100
                                      const KDateTime &recurrenceId = KDateTime() ) const;
 
101
 
 
102
    virtual bool addJournal( const KCalCore::Journal::Ptr &journal );
 
103
 
 
104
    virtual bool deleteJournal( const KCalCore::Journal::Ptr &journal );
 
105
 
 
106
    virtual void deleteAllJournals(); //unused
 
107
 
 
108
    // The following functions aren't used by korganizer, but must be implemented because
 
109
    // they are pure virtual in kcalcore, don't bother on cleaning this up, or doing a
 
110
    // proper implementation because NepomukCalendar has it's days numbered.
 
111
    bool deleteChildIncidences( const KCalCore::Incidence::Ptr & ) { return true; }
 
112
 
 
113
    bool deleteChildEvents( const KCalCore::Event::Ptr & ) { return true; }
 
114
 
 
115
    bool deleteChildTodos( const KCalCore::Todo::Ptr & ) { return true; }
 
116
 
 
117
    bool deleteChildJournals( const KCalCore::Journal::Ptr & ) { return true; }
 
118
 
 
119
    KCalCore::Event::Ptr deletedEvent( const QString &, const KDateTime & = KDateTime() ) const
 
120
    { return KCalCore::Event::Ptr(); }
 
121
 
 
122
    KCalCore::Todo::Ptr deletedTodo( const QString &, const KDateTime & = KDateTime() ) const
 
123
    { return KCalCore::Todo::Ptr(); }
 
124
 
 
125
    KCalCore::Journal::Ptr deletedJournal( const QString &, const KDateTime & = KDateTime() ) const
 
126
    { return KCalCore::Journal::Ptr(); }
 
127
 
 
128
    KCalCore::Event::List deletedEvents( KCalCore::EventSortField, KCalCore::SortDirection ) const
 
129
    { return KCalCore::Event::List(); }
 
130
 
 
131
    KCalCore::Todo::List deletedTodos( KCalCore::TodoSortField, KCalCore::SortDirection ) const
 
132
    { return KCalCore::Todo::List(); }
 
133
 
 
134
    KCalCore::Journal::List deletedJournals(
 
135
      KCalCore::JournalSortField, KCalCore::SortDirection ) const
 
136
    { return KCalCore::Journal::List();}
 
137
 
 
138
    KCalCore::Event::List childEvents(
 
139
      const KCalCore::Incidence::Ptr &,
 
140
      KCalCore::EventSortField,
 
141
      KCalCore::SortDirection ) const
 
142
    { return KCalCore::Event::List(); }
 
143
 
 
144
    KCalCore::Todo::List childTodos(
 
145
      const KCalCore::Incidence::Ptr &,
 
146
      KCalCore::TodoSortField,
 
147
      KCalCore::SortDirection ) const
 
148
    { return KCalCore::Todo::List(); }
 
149
 
 
150
    KCalCore::Journal::List childJournals(
 
151
      const KCalCore::Incidence::Ptr &,
 
152
      KCalCore::JournalSortField,
 
153
      KCalCore::SortDirection ) const
 
154
    { return KCalCore::Journal::List(); }
 
155
 
 
156
    KCalCore::Todo::List rawTodos(
 
157
      const QDate &, const QDate &, const KDateTime::Spec &, bool ) const
 
158
    { return KCalCore::Todo::List(); }
 
159
 
 
160
    virtual KCalCore::Journal::List rawJournals(
 
161
      KCalCore::JournalSortField sortField = KCalCore::JournalSortUnsorted,
 
162
      KCalCore::SortDirection sortDirection = KCalCore::SortDirectionAscending ) const;
 
163
 
 
164
    virtual KCalCore::Journal::List rawJournalsForDate( const QDate &dt ) const;
 
165
 
 
166
    virtual KCalCore::Journal::Ptr journal( const QString &uid,
 
167
                                            const KDateTime &recurrenceId = KDateTime() ) const;
 
168
 
 
169
    virtual KCalCore::Alarm::List alarms( const KDateTime &from, const KDateTime &to ) const;
 
170
 
 
171
    // From IncidenceChanger
 
172
    bool addIncidence( const KCalCore::Incidence::Ptr &incidence );
 
173
 
 
174
    bool deleteIncidence( const KCalCore::Incidence::Ptr & );
 
175
 
 
176
    void setWeakPointer( const QWeakPointer<NepomukCalendar> &pointer );
 
177
    QWeakPointer<NepomukCalendar> weakPointer() const;
 
178
 
 
179
    bool changeIncidence( const KCalCore::Incidence::Ptr &incidence );
 
180
 
 
181
    bool jobsInProgress() const;
 
182
 
 
183
    Akonadi::Item itemForIncidenceUid( const QString &uid ) const;
 
184
 
 
185
  Q_SIGNALS:
 
186
    void loadFinished( bool success, const QString &errorMessage );
 
187
    void addFinished( bool success, const QString &errorMessage );
 
188
    void deleteFinished( bool success, const QString &errorMessage );
 
189
    void changeFinished( bool success, const QString &errorMessage );
 
190
 
 
191
  private slots:
 
192
    void deleteIncidenceFinished( KJob *j );
 
193
 
 
194
    void createFinished( int changeId,
 
195
                         const Akonadi::Item &item,
 
196
                         CalendarSupport::IncidenceChanger2::ResultCode changerResultCode,
 
197
                         const QString &errorMessage );
 
198
 
 
199
    void modifyFinished( int changeId,
 
200
                         const Akonadi::Item &item,
 
201
                         CalendarSupport::IncidenceChanger2::ResultCode changerResultCode,
 
202
                         const QString &errorMessage );
 
203
 
 
204
 
 
205
    void searchResult( KJob * );
 
206
 
 
207
  private:
 
208
 
 
209
    /* The ctor is private because somebody might forget to call
 
210
       setWeakPointer().
 
211
 
 
212
       Use the static method create().
 
213
    */
 
214
    NepomukCalendar( QWidget *parent = 0 );
 
215
 
 
216
    class Private;
 
217
    Private *const d;
 
218
};
 
219
 
 
220
}
 
221
 
 
222
#endif