File indexing completed on 2024-05-26 05:22:56

0001 /*
0002   This file is part of KOrganizer
0003 
0004   SPDX-FileCopyrightText: 2004 Bo Thorsen <bo@sonofthor.dk>
0005   SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
0006 
0007   SPDX-License-Identifier: GPL-2.0-or-later
0008  */
0009 
0010 #pragma once
0011 
0012 #include "korganizerprivate_export.h"
0013 
0014 #include <QObject>
0015 
0016 class ActionManager;
0017 
0018 class KORGANIZERPRIVATE_EXPORT KOrganizerIfaceImpl : public QObject
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit KOrganizerIfaceImpl(ActionManager *mActionManager, QObject *parent = nullptr, const QString &name = QString());
0023     ~KOrganizerIfaceImpl() override;
0024 
0025 public Q_SLOTS:
0026     [[nodiscard]] bool openURL(const QString &url);
0027     [[nodiscard]] bool mergeURL(const QString &url);
0028     [[nodiscard]] bool saveURL();
0029     [[nodiscard]] bool saveAsURL(const QString &url);
0030     [[nodiscard]] QString getCurrentURLasString() const;
0031 
0032     [[nodiscard]] bool editIncidence(const QString &akonadiUrl);
0033     /** @reimp from KOrganizerIface::deleteIncidence()
0034         @param akonadiUrl the akonadi Item URL of the item to delete. if no such item exists,
0035         nothing happens
0036         @return true if the item could be deleted, false otherwise
0037     */
0038     [[nodiscard]] bool deleteIncidence(const QString &akonadiUrl)
0039     {
0040         return deleteIncidence(akonadiUrl, false);
0041     }
0042 
0043     /**
0044       Delete the incidence with the given akonadi item URL from the active calendar.
0045       @param akonadiUrl The Akonadi Item URL.
0046       @param force If true, all recurrences and sub-todos (if applicable) will
0047       be deleted without prompting for confirmation.
0048     */
0049     [[nodiscard]] bool deleteIncidence(const QString &akonadiUrl, bool force);
0050 
0051     /**
0052       Add an incidence to the active calendar.
0053       @param iCal A calendar in iCalendar format containing the incidence. The
0054                   calendar must consist of a VCALENDAR component which contains
0055                   the incidence (VEVENT, VTODO, VJOURNAL or VFREEBUSY) and
0056                   optionally a VTIMEZONE component. If there is more than one
0057                   incidence, only the first is added to KOrganizer's calendar.
0058     */
0059     [[nodiscard]] bool addIncidence(const QString &iCal);
0060 
0061     /**
0062       Show a HTML representation of the incidence (the "View.." dialog).
0063       If no incidence with the given Akonadi Item URL exists, nothing happens.
0064       @param akonadiUrl The Akonadi Item URL of the incidence to be shown.
0065     */
0066     [[nodiscard]] bool showIncidence(const QString &akonadiUrl);
0067 
0068     /**
0069       Show an incidence in context. This means showing the todo, agenda or
0070       journal view (as appropriate) and scrolling it to show the incidence.
0071       @param akonadiUrl the Akonadi Item URL of the incidence to show.
0072     */
0073     [[nodiscard]] bool showIncidenceContext(const QString &akonadiUrl);
0074 
0075     /**
0076      * Called by KOrganizerUniqueAppHandler in the kontact plugin
0077      * Returns true if the command line was successfully handled
0078      * false otherwise.
0079      */
0080     [[nodiscard]] bool handleCommandLine(const QStringList &args);
0081 
0082 private:
0083     ActionManager *const mActionManager;
0084 };