1 | /* |
2 | This file is part of the kcal library. |
3 | |
4 | Copyright (c) 1998 Preston Brown <pbrown@kde.org> |
5 | Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> |
6 | Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> |
7 | Copyright (c) 2008 Thomas Thrainer <tom_t@gmx.at> |
8 | |
9 | This library is free software; you can redistribute it and/or |
10 | modify it under the terms of the GNU Library General Public |
11 | License as published by the Free Software Foundation; either |
12 | version 2 of the License, or (at your option) any later version. |
13 | |
14 | This library is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | Library General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Library General Public License |
20 | along with this library; see the file COPYING.LIB. If not, write to |
21 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 | Boston, MA 02110-1301, USA. |
23 | */ |
24 | /** |
25 | @file |
26 | This file is part of the API for handling calendar data and |
27 | defines the DndFactory class. |
28 | |
29 | @author Preston Brown \<pbrown@kde.org\> |
30 | @author Cornelius Schumacher \<schumacher@kde.org\> |
31 | @author Reinhold Kainhofer \<reinhold@kainhofer.com\> |
32 | */ |
33 | |
34 | #ifndef KCAL_DNDFACTORY_H |
35 | #define KCAL_DNDFACTORY_H |
36 | |
37 | #include "kcal_export.h" |
38 | #include "incidence.h" |
39 | |
40 | #include <KDE/KDateTime> |
41 | |
42 | class QDate; |
43 | class QTime; |
44 | class QDrag; |
45 | class QWidget; |
46 | class QDropEvent; |
47 | class QMimeData; |
48 | |
49 | namespace KCal { |
50 | |
51 | class Event; |
52 | class Todo; |
53 | class Incidence; |
54 | class Calendar; |
55 | |
56 | /** |
57 | @brief |
58 | vCalendar/iCalendar Drag-and-Drop object factory. |
59 | |
60 | This class implements functions to create Drag and Drop objects used for |
61 | Drag-and-Drop and Copy-and-Paste. |
62 | */ |
63 | class KCAL_DEPRECATED_EXPORT DndFactory |
64 | { |
65 | public: |
66 | explicit DndFactory( Calendar * ); |
67 | |
68 | ~DndFactory(); |
69 | |
70 | /** |
71 | Create the calendar that is contained in the drop event's data. |
72 | */ |
73 | Calendar *createDropCalendar( QDropEvent *de ); |
74 | |
75 | /** |
76 | Create the calendar that is contained in the mime data. |
77 | */ |
78 | Calendar *createDropCalendar( const QMimeData *md ); |
79 | |
80 | /** |
81 | Create the calendar that is contained in the mime data. |
82 | */ |
83 | static Calendar *createDropCalendar( const QMimeData *md, const KDateTime::Spec &timeSpec ); |
84 | |
85 | /** |
86 | Create the mime data for the whole calendar. |
87 | */ |
88 | QMimeData *createMimeData(); |
89 | |
90 | /** |
91 | Create a drag object for the whole calendar. |
92 | */ |
93 | QDrag *createDrag( QWidget *owner ); |
94 | |
95 | /** |
96 | Create the mime data for a single incidence. |
97 | */ |
98 | QMimeData *createMimeData( Incidence *incidence ); |
99 | |
100 | /** |
101 | Create a drag object for a single incidence. |
102 | */ |
103 | QDrag *createDrag( Incidence *incidence, QWidget *owner ); |
104 | |
105 | /** |
106 | Create Todo object from mime data. |
107 | */ |
108 | Todo *createDropTodo( const QMimeData *md ); |
109 | |
110 | /** |
111 | Create Todo object from drop event. |
112 | */ |
113 | Todo *createDropTodo( QDropEvent *de ); |
114 | |
115 | /** |
116 | Create Event object from mime data. |
117 | */ |
118 | Event *createDropEvent( const QMimeData *md ); |
119 | |
120 | /** |
121 | Create Event object from drop event. |
122 | */ |
123 | Event *createDropEvent( QDropEvent *de ); |
124 | |
125 | /** |
126 | Cut the incidence to the clipboard. |
127 | */ |
128 | void cutIncidence( Incidence * ); |
129 | |
130 | /** |
131 | Copy the incidence to clipboard/ |
132 | */ |
133 | bool copyIncidence( Incidence * ); |
134 | |
135 | /** |
136 | * Cuts a list of @p incidences to the clipboard. |
137 | * |
138 | * @since 4.5 |
139 | */ |
140 | bool cutIncidences( const Incidence::List &incidences ); |
141 | |
142 | /** |
143 | * Copies a list of @p incidences to the clipboard. |
144 | * |
145 | * @since 4.5 |
146 | */ |
147 | bool copyIncidences( const Incidence::List &incidences ); |
148 | |
149 | /** |
150 | * Pastes and returns the incidences from the clipboard |
151 | * If no date and time are given, the incidences will be pasted at |
152 | * their original date/time |
153 | * |
154 | * @param newDate The new date where the incidences shall be pasted. |
155 | * @param newTime The new time where the incidences shall be pasted. |
156 | * |
157 | * @since 4.5 |
158 | */ |
159 | Incidence::List pasteIncidences( const QDate &newDate = QDate(), |
160 | const QTime *newTime = 0 ); |
161 | |
162 | /** |
163 | * Pastes the event or todo and return a pointer to the new incidence pasted. |
164 | */ |
165 | Incidence *pasteIncidence( const QDate &, const QTime *newTime = 0 ); |
166 | |
167 | private: |
168 | //@cond PRIVATE |
169 | Q_DISABLE_COPY( DndFactory ) |
170 | class Private; |
171 | Private *const d; |
172 | //@endcond |
173 | }; |
174 | |
175 | } |
176 | |
177 | #endif |
178 | |