2 Copyright (c) 2010 Bertjan Broeksema <broeksema@kde.org>
3 Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #ifndef INCIDENCEEDITOR_INCIDENCEDIALOG_H
22 #define INCIDENCEEDITOR_INCIDENCEDIALOG_H
24 #include "incidenceeditors_ng_export.h"
25 #include "editoritemmanager.h"
31 class IncidenceChanger
;
34 namespace IncidenceEditorNG
37 class IncidenceDialogPrivate
;
39 class INCIDENCEEDITORS_NG_EXPORT IncidenceDialog
: public KDialog
43 explicit IncidenceDialog(Akonadi::IncidenceChanger
*changer
= Q_NULLPTR
,
44 QWidget
*parent
= Q_NULLPTR
, Qt::WindowFlags flags
= 0);
48 * Loads the @param item into the dialog.
50 * To create a new Incidence pass an invalid item with either an
51 * KCalCore::Event:Ptr or a KCalCore::Todo:Ptr set as payload. Note: When the
52 * item is invalid, i.e. it has an invalid id, a valid payload <em>must</em>
55 * When the item has is valid this method will fetch the payload when this is
58 virtual void load(const Akonadi::Item
&item
, const QDate
&activeDate
= QDate());
61 * Sets the Collection combobox to @param collection.
63 virtual void selectCollection(const Akonadi::Collection
&collection
);
65 virtual void setIsCounterProposal(bool isCounterProposal
);
68 Returns the object that will receive all key events.
70 QObject
*typeAheadReceiver() const;
73 By default, if you load an incidence into the editor ( load(item) ), then press [OK]
74 without changing anything, the dialog is dismissed, and the incidence isn't saved
77 Call this method with @p initiallyDirty = true if you want the incidence to be saved,
78 It's useful if you're creating a dialog with an already crafted content, like in kmail's
79 "Create Todo/Reminder Feature".
81 void setInitiallyDirty(bool initiallyDirty
);
83 Akonadi::Item
item() const;
87 * This signal is emitted when an incidence is created.
88 * @param collection The collection where it was created.
90 void incidenceCreated(const Akonadi::Item
&);
91 void invalidCollection() const;
93 void closeEvent(QCloseEvent
*event
) Q_DECL_OVERRIDE
;
96 void slotButtonClicked(int button
) Q_DECL_OVERRIDE
;
97 void handleSelectedCollectionChange(const Akonadi::Collection
&collection
);
100 IncidenceDialogPrivate
*const d_ptr
;
101 Q_DECLARE_PRIVATE(IncidenceDialog
)
102 Q_DISABLE_COPY(IncidenceDialog
)
107 Q_PRIVATE_SLOT(d_ptr
, void handleAlarmCountChange(int))
108 Q_PRIVATE_SLOT(d_ptr
, void handleItemSaveFinish(IncidenceEditorNG::EditorItemManager::SaveAction
))
109 Q_PRIVATE_SLOT(d_ptr
, void handleItemSaveFail(IncidenceEditorNG::EditorItemManager::SaveAction
, QString
))
110 Q_PRIVATE_SLOT(d_ptr
, void handleRecurrenceChange(IncidenceEditorNG::RecurrenceType
))
111 Q_PRIVATE_SLOT(d_ptr
, void loadTemplate(QString
))
112 Q_PRIVATE_SLOT(d_ptr
, void saveTemplate(QString
))
113 Q_PRIVATE_SLOT(d_ptr
, void storeTemplatesInConfig(QStringList
))
114 Q_PRIVATE_SLOT(d_ptr
, void updateAttachmentCount(int))
115 Q_PRIVATE_SLOT(d_ptr
, void updateAttendeeCount(int))
116 Q_PRIVATE_SLOT(d_ptr
, void updateResourceCount(int))
117 Q_PRIVATE_SLOT(d_ptr
, void updateButtonStatus(bool))
118 Q_PRIVATE_SLOT(d_ptr
, void showMessage(QString
, KMessageWidget::MessageType
))
119 Q_PRIVATE_SLOT(d_ptr
, void slotInvalidCollection())