Akonadi Calendar

calendarclipboard.h
1 /*
2  SPDX-FileCopyrightText: 2012 Sérgio Martins <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "akonadi-calendar_export.h"
10 #include "calendarbase.h"
11 
12 #include <KCalendarCore/Incidence>
13 #include <QObject>
14 
15 namespace Akonadi
16 {
17 class IncidenceChanger;
18 
19 /**
20  * @short Class to copy or cut calendar incidences.
21  *
22  * @author Sérgio Martins <[email protected]>
23  * @since 4.11
24  */
25 class AKONADI_CALENDAR_EXPORT CalendarClipboard : public QObject
26 {
27  Q_OBJECT
28 public:
29  enum Mode {
30  SingleMode = 0, ///< Only the specified incidence is cut/copied.
31  RecursiveMode, ///< The specified incidence's children are also cut/copied
32  AskMode ///< The user is asked if he wants children to be cut/copied too
33  };
34 
35  /**
36  * Constructs a new CalendarClipboard.
37  * @param calendar calendar containing incidences
38  * @param changer incidence changer that will delete incidences while copying.
39  * If 0, an internal one will be created.
40  * @param parent QObject parent
41  */
42  explicit CalendarClipboard(const Akonadi::CalendarBase::Ptr &calendar, Akonadi::IncidenceChanger *changer = nullptr, QObject *parent = nullptr);
43  /**
44  * Destroys the CalendarClipboard instance.
45  */
47 
48  /**
49  * Copies the specified incidence into the clipboard and then deletes it from akonadi.
50  * The incidence must be present in the calendar.
51  * After it's deletion from akonadi, signal cutFinished() is emitted.
52  * @param incidence to cut
53  * @param mode how to treat child incidences. Defaults to #RecursiveMode
54  * @see cutFinished().
55  */
56  void cutIncidence(const KCalendarCore::Incidence::Ptr &incidence, CalendarClipboard::Mode mode = RecursiveMode);
57 
58  /**
59  * Copies the specified incidence into the clipboard.
60  * @param incidence the incidence to copy
61  * @param mode how to treat child incidences. Defaults to #RecursiveMode
62  * @return true on success
63  */
64  bool copyIncidence(const KCalendarCore::Incidence::Ptr &incidence, CalendarClipboard::Mode mode = RecursiveMode);
65 
66  /**
67  * Returns if there's any ical mime data available for pasting.
68  */
69  Q_REQUIRED_RESULT bool pasteAvailable() const;
70 
71 Q_SIGNALS:
72  /**
73  * Emitted after cutIncidences() finishes.
74  * @param success true if the cut was successful
75  * @param errorMessage if @p success if false, contains the error message, empty otherwise.
76  */
77  void cutFinished(bool success, const QString &errorMessage);
78 
79 private:
80  class Private;
81  Private *const d;
82 };
83 }
84 
The specified incidence&#39;s children are also cut/copied.
FreeBusyManager::Singleton.
Class to copy or cut calendar incidences.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jun 19 2021 23:12:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.