1 /*
2   This file is part of KOrganizer
3 
4   SPDX-FileCopyrightText: 2004 Bo Thorsen <bo@sonofthor.dk>
5   SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
6 
7   SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #pragma once
11 
12 #include "korganizerprivate_export.h"
13 
14 #include <QObject>
15 
16 class ActionManager;
17 
18 class KORGANIZERPRIVATE_EXPORT KOrganizerIfaceImpl : public QObject
19 {
20     Q_OBJECT
21 public:
22     explicit KOrganizerIfaceImpl(ActionManager *mActionManager, QObject *parent = nullptr, const QString &name = QString());
23     ~KOrganizerIfaceImpl() override;
24 
25 public Q_SLOTS:
26     Q_REQUIRED_RESULT bool openURL(const QString &url);
27     Q_REQUIRED_RESULT bool mergeURL(const QString &url);
28     Q_REQUIRED_RESULT bool saveURL();
29     Q_REQUIRED_RESULT bool saveAsURL(const QString &url);
30     Q_REQUIRED_RESULT QString getCurrentURLasString() const;
31 
32     Q_REQUIRED_RESULT bool editIncidence(const QString &akonadiUrl);
33     /** @reimp from KOrganizerIface::deleteIncidence()
34         @param akonadiUrl the akonadi Item URL of the item to delete. if no such item exists,
35         nothing happens
36         @return true if the item could be deleted, false otherwise
37     */
deleteIncidence(const QString & akonadiUrl)38     Q_REQUIRED_RESULT bool deleteIncidence(const QString &akonadiUrl)
39     {
40         return deleteIncidence(akonadiUrl, false);
41     }
42 
43     /**
44       Delete the incidence with the given akonadi item URL from the active calendar.
45       @param akonadiUrl The Akonadi Item URL.
46       @param force If true, all recurrences and sub-todos (if applicable) will
47       be deleted without prompting for confirmation.
48     */
49     Q_REQUIRED_RESULT bool deleteIncidence(const QString &akonadiUrl, bool force);
50 
51     /**
52       Add an incidence to the active calendar.
53       @param iCal A calendar in iCalendar format containing the incidence. The
54                   calendar must consist of a VCALENDAR component which contains
55                   the incidence (VEVENT, VTODO, VJOURNAL or VFREEBUSY) and
56                   optionally a VTIMEZONE component. If there is more than one
57                   incidence, only the first is added to KOrganizer's calendar.
58     */
59     Q_REQUIRED_RESULT bool addIncidence(const QString &iCal);
60 
61     /**
62       Show a HTML representation of the incidence (the "View.." dialog).
63       If no incidence with the given Akonadi Item URL exists, nothing happens.
64       @param akonadiUrl The Akonadi Item URL of the incidence to be shown.
65     */
66     Q_REQUIRED_RESULT bool showIncidence(const QString &akonadiUrl);
67 
68     /**
69       Show an incidence in context. This means showing the todo, agenda or
70       journal view (as appropriate) and scrolling it to show the incidence.
71       @param akonadiUrl the Akonadi Item URL of the incidence to show.
72     */
73     Q_REQUIRED_RESULT bool showIncidenceContext(const QString &akonadiUrl);
74 
75     /**
76      * Called by KOrganizerUniqueAppHandler in the kontact plugin
77      * Returns true if the command line was successfully handled
78      * false otherwise.
79      */
80     Q_REQUIRED_RESULT bool handleCommandLine(const QStringList &args);
81 
82 private:
83     ActionManager *const mActionManager;
84 };
85 
86