Incidenceeditor

incidencedefaults.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 "incidenceeditor_export.h"
11
12#include <KCalendarCore/Incidence>
13
14#include <memory>
15
16namespace IncidenceEditorNG
17{
18class IncidenceDefaultsPrivate;
19/**
20 * @brief The IncidenceDefaults class
21 */
22class INCIDENCEEDITOR_EXPORT IncidenceDefaults
23{
24public:
25 explicit IncidenceDefaults(bool cleanupAttachmentTEmporaryFiles = false);
28
29 IncidenceDefaults &operator=(const IncidenceDefaults &other);
30
31 /**
32 Sets the attachments that are added by default to incidences.
33 */
34 void setAttachments(const QStringList &attachments,
35 const QStringList &attachmentMimetypes = QStringList(),
36 const QStringList &attachmentLabels = QStringList(),
37 bool inlineAttachment = false);
38
39 /**
40 Sets the attendees that are added by default to incidences.
41 @param attendees Expected to be of the form "name name <email>"
42 */
43 void setAttendees(const QStringList &attendees);
44
45 /**
46 Sets the list of identities to be used for the user. The items in the list
47 are expected to be of the form: "name [name] <email>".
48
49 If the list is empty, it is assumed that no valid identities are configured.
50
51 @param fullEmails The list of name email pairs that the user has configured as identities.
52 */
53 void setFullEmails(const QStringList &fullEmails);
54
55 /**
56 This is used to do a smarter guess about which identity to use for the organizer.
57 If the groupware server is not set, the first available identity will be used.
58 @param domain The gropuware server domain name without any protocol prefixes
59 (e.g. demo.kolab.org).
60 */
61 void setGroupWareDomain(const QString &domain);
62
63 /**
64 Sets the incidence related to the incidence for which to set the defaults. For
65 example the parent todo of a new sub todo.
66 */
67 void setRelatedIncidence(const KCalendarCore::Incidence::Ptr &incidence);
68
69 /**
70 Set the start date/time to use for passed incidences. This defaults to the
71 current start date/time. The main purpose of this method is supporting
72 defaults for new incidences that where created with a given time slot.
73 @param startDT The start date time to set on the incidence.
74 */
75 void setStartDateTime(const QDateTime &startDT);
76
77 /**
78 Set the end date/time to use for passed incidences. This defaults to the
79 current start date/time. The main purpose of this method is supporting
80 defaults for new incidences that where created with a given time slot.
81 @param endDT The start date time to set on the incidence.
82 */
83 void setEndDateTime(const QDateTime &endDT);
84
85 /**
86 Sets the default values for @param incidence. This method is merely meant for
87 <em>new</em> incidences. However, it will clear out all fields and set them
88 to default values.
89 @param incidence The incidence that will get default values for all of its field.
90 */
91 void setDefaults(const KCalendarCore::Incidence::Ptr &incidence) const;
92
93 /**
94 * Returns minimal incidence defaults: e-mails and groupware domain.
95 *
96 * TODO: See if this is always called when using IncidenceDefaults.
97 * If yes, this should be done inside ctor.
98 */
99 [[nodiscard]] static IncidenceDefaults minimalIncidenceDefaults(bool cleanupAttachmentTempFiles = false);
100
101 // Returns the e-mail address used for the organizer when we can't find anything useful
102 // This is something like "invalid@invalid"
103 [[nodiscard]] static QString invalidEmailAddress();
104
105private:
106 std::unique_ptr<IncidenceDefaultsPrivate> const d_ptr;
107 Q_DECLARE_PRIVATE(IncidenceDefaults)
108};
109}
The IncidenceDefaults class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:37 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.