SVN_SILENT made messages (.desktop file)
[kdepim.git] / incidenceeditor-ng / incidencedialog.h
bloba5aa32dd44cdcd4943c9eb1ac4ab3eda6c6c1e80
1 /*
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
18 02110-1301, USA.
21 #ifndef INCIDENCEEDITOR_INCIDENCEDIALOG_H
22 #define INCIDENCEEDITOR_INCIDENCEDIALOG_H
24 #include "incidenceeditors_ng_export.h"
25 #include "editoritemmanager.h"
27 #include <KDialog>
29 namespace Akonadi
31 class IncidenceChanger;
34 namespace IncidenceEditorNG
37 class IncidenceDialogPrivate;
39 class INCIDENCEEDITORS_NG_EXPORT IncidenceDialog : public KDialog
41 Q_OBJECT
42 public:
43 explicit IncidenceDialog(Akonadi::IncidenceChanger *changer = 0,
44 QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = 0);
45 ~IncidenceDialog();
47 /**
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>
53 * be set.
55 * When the item has is valid this method will fetch the payload when this is
56 * not already set.
58 virtual void load(const Akonadi::Item &item, const QDate &activeDate = QDate());
60 /**
61 * Sets the Collection combobox to @param collection.
63 virtual void selectCollection(const Akonadi::Collection &collection);
65 virtual void setIsCounterProposal(bool isCounterProposal);
67 /**
68 Returns the object that will receive all key events.
70 QObject *typeAheadReceiver() const;
72 /**
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
75 to akonadi.
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;
85 Q_SIGNALS:
86 /**
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;
92 protected:
93 void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
95 protected Q_SLOTS:
96 virtual void slotButtonClicked(int button);
97 void handleSelectedCollectionChange(const Akonadi::Collection &collection);
99 private:
100 IncidenceDialogPrivate *const d_ptr;
101 Q_DECLARE_PRIVATE(IncidenceDialog)
102 Q_DISABLE_COPY(IncidenceDialog)
104 void writeConfig();
105 void readConfig();
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 updateButtonStatus(bool))
117 Q_PRIVATE_SLOT(d_ptr, void showMessage(QString, KMessageWidget::MessageType))
118 Q_PRIVATE_SLOT(d_ptr, void slotInvalidCollection())
123 #endif