1 | /* |
2 | This file is part of the kcal library. |
3 | |
4 | Copyright (c) 2002,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 | /** |
22 | @file |
23 | This file is part of the API for handling calendar data and |
24 | defines the FileStorage class. |
25 | |
26 | @author Cornelius Schumacher \<schumacher@kde.org\> |
27 | */ |
28 | |
29 | #ifndef KCAL_FILESTORAGE_H |
30 | #define KCAL_FILESTORAGE_H |
31 | |
32 | #include "calstorage.h" |
33 | #include <QtCore/QString> |
34 | |
35 | namespace KCal { |
36 | |
37 | class CalFormat; |
38 | |
39 | /** |
40 | @brief |
41 | This class provides a calendar storage as a local file. |
42 | */ |
43 | class KCAL_DEPRECATED_EXPORT FileStorage : public CalStorage |
44 | { |
45 | public: |
46 | /** |
47 | Constructs a new FileStorage object for Calendar @p calendar with format |
48 | @p format, and storage to file @p fileName. |
49 | |
50 | @param calendar is a pointer to a valid Calendar object. |
51 | @param fileName is the name of the disk file containing the Calendar data. |
52 | @param format is a pointer to a valid CalFormat object that specifies |
53 | the calendar format to be used. FileStorage takes ownership; i.e., the |
54 | memory for @p format is deleted by this destructor. If no format is |
55 | specified, then iCalendar format is assumed. |
56 | */ |
57 | explicit FileStorage( Calendar *calendar, |
58 | const QString &fileName = QString(), |
59 | CalFormat *format = 0 ); |
60 | |
61 | /** |
62 | Destructor. |
63 | */ |
64 | virtual ~FileStorage(); |
65 | |
66 | /** |
67 | Sets the name of the file that contains the calendar data. |
68 | |
69 | @param fileName is the name of the disk file containing the Calendar data. |
70 | @see fileName(). |
71 | */ |
72 | void setFileName( const QString &fileName ); |
73 | |
74 | /** |
75 | Returns a string containing the name of the calendar file. |
76 | @see setFileName(). |
77 | */ |
78 | QString fileName() const; |
79 | |
80 | /** |
81 | Sets the CalFormat object to use for this storage. |
82 | |
83 | @param format is a pointer to a valid CalFormat object that specifies |
84 | the calendar format to be used. FileStorage takes ownership. |
85 | @see saveFormat(). |
86 | */ |
87 | void setSaveFormat( CalFormat *format ); |
88 | |
89 | /** |
90 | Returns a pointer to the CalFormat object used by this storage. |
91 | @see setSaveFormat(). |
92 | */ |
93 | CalFormat *saveFormat() const; |
94 | |
95 | /** |
96 | @copydoc |
97 | CalStorage::open() |
98 | */ |
99 | bool open(); |
100 | |
101 | /** |
102 | @copydoc |
103 | CalStorage::load() |
104 | */ |
105 | bool load(); |
106 | |
107 | /** |
108 | @copydoc |
109 | CalStorage::save() |
110 | */ |
111 | bool save(); |
112 | |
113 | /** |
114 | @copydoc |
115 | CalStorage::close() |
116 | */ |
117 | bool close(); |
118 | |
119 | private: |
120 | //@cond PRIVATE |
121 | Q_DISABLE_COPY( FileStorage ) |
122 | class Private; |
123 | Private *const d; |
124 | //@endcond |
125 | }; |
126 | |
127 | } |
128 | |
129 | #endif |
130 | |