2 Copyright (c) 1998 Preston Brown <pbrown@kde.org>
3 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
4 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
5 Copyright (c) 2008 Thomas Thrainer <tom_t@gmx.at>
6 Copyright (c) 2010 Laurent Montel <montel@kde.org>
8 Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
9 Author: Sergio Martins <sergio@kdab.com>
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later version.
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Library General Public License for more details.
21 You should have received a copy of the GNU Library General Public License
22 along with this library; see the file COPYING.LIB. If not, write to
23 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 Boston, MA 02110-1301, USA.
26 #ifndef CALENDARSUPPORT_DNDFACTORY_H
27 #define CALENDARSUPPORT_DNDFACTORY_H
29 #include "calendarsupport_export.h"
30 #include "calendaradaptor.h"
32 #include <KCalUtils/DndFactory>
34 namespace CalendarSupport
{
36 class CalendarAdaptor
;
40 vCalendar/iCalendar Drag-and-Drop object factory.
42 This class implements functions to create Drag and Drop objects used for
43 Drag-and-Drop and Copy-and-Paste.
45 class CALENDARSUPPORT_EXPORT DndFactory
48 explicit DndFactory( const CalendarSupport::CalendarAdaptor::Ptr
&,
49 bool deleteCalendarHere
= false );
54 Create the calendar that is contained in the drop event's data.
56 KCalCore::MemoryCalendar::Ptr
createDropCalendar( QDropEvent
*de
);
59 Create the calendar that is contained in the mime data.
61 KCalCore::MemoryCalendar::Ptr
createDropCalendar( const QMimeData
*md
);
64 Create the calendar that is contained in the mime data.
66 static KCalCore::MemoryCalendar::Ptr
createDropCalendar( const QMimeData
*md
,
67 const KDateTime::Spec
&timeSpec
);
70 Create the mime data for the whole calendar.
72 QMimeData
*createMimeData();
75 Create a drag object for the whole calendar.
77 QDrag
*createDrag( QWidget
*owner
);
80 Create the mime data for a single incidence.
82 QMimeData
*createMimeData( const KCalCore::Incidence::Ptr
&incidence
);
85 Create a drag object for a single incidence.
87 QDrag
*createDrag( const KCalCore::Incidence::Ptr
&incidence
, QWidget
*owner
);
90 Create Todo object from mime data.
92 KCalCore::Todo::Ptr
createDropTodo( const QMimeData
*md
);
95 Create Todo object from drop event.
97 KCalCore::Todo::Ptr
createDropTodo( QDropEvent
*de
);
100 Create Event object from mime data.
102 KCalCore::Event::Ptr
createDropEvent( const QMimeData
*md
);
105 Create Event object from drop event.
107 KCalCore::Event::Ptr
createDropEvent( QDropEvent
*de
);
110 Cut the incidence to the clipboard.
112 void cutIncidence( const Akonadi::Item
& );
115 Copy the incidence to clipboard/
117 bool copyIncidence( const Akonadi::Item
& );
120 Paste the event or todo and return a pointer to the new incidence pasted.
122 KCalCore::Incidence::Ptr
pasteIncidence(
124 const KCalUtils::DndFactory::PasteFlags
& = KCalUtils::DndFactory::PasteFlags() );
127 Pastes and returns the incidences from the clipboard.
128 If no date and time are given, the incidences will be pasted at their original date/time.
130 KCalCore::Incidence::List
pasteIncidences(
132 const KCalUtils::DndFactory::PasteFlags
& = KCalUtils::DndFactory::PasteFlags() );
135 Cuts a list of incidences to the clipboard.
137 bool cutIncidences( const Akonadi::Item::List
&item
);
140 Copies a list of incidences to the clipboard.
142 bool copyIncidences( const Akonadi::Item::List
&item
);
146 Q_DISABLE_COPY( DndFactory
)