Incidenceeditor

incidencedialog.h
1/*
2 SPDX-FileCopyrightText: 2010 Bertjan Broeksema <broeksema@kde.org>
3 SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#pragma once
9
10#include "editoritemmanager.h"
11#include "incidenceeditor_export.h"
12
13#include <QDate>
14#include <QDialog>
15
16#include <memory>
17
18class QAbstractButton;
19
20namespace Akonadi
21{
22class IncidenceChanger;
23}
24
25namespace IncidenceEditorNG
26{
27class IncidenceDialogPrivate;
28/**
29 * @brief The IncidenceDialog class
30 */
31class INCIDENCEEDITOR_EXPORT IncidenceDialog : public QDialog
32{
33 Q_OBJECT
34public:
35 explicit IncidenceDialog(Akonadi::IncidenceChanger *changer = nullptr, QWidget *parent = nullptr, Qt::WindowFlags flags = {});
36 ~IncidenceDialog() override;
37
38 /**
39 * Loads the @param item into the dialog.
40 *
41 * To create a new Incidence pass an invalid item with either an
42 * KCalendarCore::Event:Ptr or a KCalendarCore::Todo:Ptr set as payload. Note: When the
43 * item is invalid, i.e. it has an invalid id, a valid payload <em>must</em>
44 * be set.
45 *
46 * When the item has is valid this method will fetch the payload when this is
47 * not already set.
48 */
49 virtual void load(const Akonadi::Item &item, const QDate &activeDate = QDate());
50
51 /**
52 * Sets the Collection combobox to @param collection.
53 */
54 virtual void selectCollection(const Akonadi::Collection &collection);
55
56 virtual void setIsCounterProposal(bool isCounterProposal);
57
58 /**
59 Returns the object that will receive all key events.
60 */
61 QObject *typeAheadReceiver() const;
62
63 /**
64 By default, if you load an incidence into the editor ( load(item) ), then press [OK]
65 without changing anything, the dialog is dismissed, and the incidence isn't saved
66 to akonadi.
67
68 Call this method with @p initiallyDirty = true if you want the incidence to be saved,
69 It's useful if you're creating a dialog with an already crafted content, like in kmail's
70 "Create Todo/Reminder Feature".
71 */
72 void setInitiallyDirty(bool initiallyDirty);
73
74 [[nodiscard]] Akonadi::Item item() const;
75
76Q_SIGNALS:
77 /**
78 * This signal is emitted when an incidence is created.
79 * @param collection The collection where it was created.
80 */
82 void invalidCollection() const;
83
84protected:
85 void closeEvent(QCloseEvent *event) override;
86
87protected Q_SLOTS:
88 void slotButtonClicked(QAbstractButton *button);
89 void handleSelectedCollectionChange(const Akonadi::Collection &collection);
90 void reject() override;
91
92private:
93 std::unique_ptr<IncidenceDialogPrivate> const d_ptr;
94 Q_DECLARE_PRIVATE(IncidenceDialog)
95 Q_DISABLE_COPY(IncidenceDialog)
96
97 INCIDENCEEDITOR_NO_EXPORT void writeConfig();
98 INCIDENCEEDITOR_NO_EXPORT void readConfig();
99};
100}
The IncidenceDialog class.
void incidenceCreated(const Akonadi::Item &)
This signal is emitted when an incidence is created.
typedef WindowFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:23 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.