summaryrefslogtreecommitdiffstats
path: root/kresources/caldav/reader.h
blob: c34f2083b0cc8277e38036ca53eef3b36986754d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*=========================================================================
| KCalDAV
|--------------------------------------------------------------------------
| (c) 2010  Timothy Pearson
| (c) 2009  Kumaran Santhanam (initial KDE4 version)
|
| This project is released under the GNU General Public License.
| Please see the file COPYING for more details.
|--------------------------------------------------------------------------
| Remote calendar loading class.
 ========================================================================*/

/*=========================================================================
| INCLUDES
 ========================================================================*/

#ifndef KCALDAV_LOADER_H
#define KCALDAV_LOADER_H

#include "job.h"

#include <tqstring.h>
#include <tqdatetime.h>

namespace KCal {

/*=========================================================================
| CLASS
 ========================================================================*/

/**
 * Calendar Reader.
 */
class CalDavReader : public CalDavJob {

public:

    /**
     * @param url URL to load.
     */
    CalDavReader(const TQString& url = TQString()) :
        CalDavJob(url)
        , mGetAll(true)
    {
    }

    /**
     * Sets a time range. Only event between @p start and @p end will be loaded.
     * This method call disables the effect of setGetAll() call.
     * setGetAll() call disables the effect of this method.
     */
    void setRange(const TQDateTime& start, const TQDateTime& end) {
        mGetAll = false;
        mTimeStart = start;
        mTimeEnd = end;
    }

    /**
     * Sets the flag to load all events from the remote calendar.
     * This method call disables the effect of setRange() call.
     * setGetAll() call disables the effect of this method.
     */
    void setGetAll() {
        mGetAll = true;
    }

    /**
     * @return downloaded calendar data in iCal format.
     */
    TQString data() const {
        return mData;
    }

    /**
     * @return downloaded task data in iCal format.
     */
    TQString tasksData() const {
        return mTasksData;
    }

protected:

    virtual int runJob(runtime_info* caldavRuntime);

    virtual void cleanJob();

private:

    TQString mData;
    TQString mTasksData;
    bool mGetAll;
    TQDateTime mTimeStart;
    TQDateTime mTimeEnd;

};

} // namespace KCal

#endif // KCALDAV_LOADER_H