File indexing completed on 2024-04-28 05:11:31
0001 /* 0002 SPDX-FileCopyrightText: 2009 Sebastian Sauer <sebsauer@kdab.net> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0005 */ 0006 0007 #pragma once 0008 0009 #include "incidenceeditor_export.h" 0010 0011 #include <KCalendarCore/IncidenceBase> 0012 0013 #include <QUrl> 0014 0015 #include <QDateTime> 0016 #include <QList> 0017 #include <QStringList> 0018 0019 #include <memory> 0020 0021 class KConfigSkeleton; 0022 0023 namespace IncidenceEditorNG 0024 { 0025 class EditorConfigPrivate; 0026 0027 /** 0028 * Configuration details. An application can inherit from this class 0029 * to provide application specific configurations to the editor. 0030 * 0031 */ 0032 class INCIDENCEEDITOR_EXPORT EditorConfig 0033 { 0034 public: 0035 struct Organizer { 0036 QString name; 0037 QString email; 0038 bool sign = false; 0039 bool encrypt = false; 0040 }; 0041 0042 EditorConfig(); 0043 virtual ~EditorConfig(); 0044 0045 static EditorConfig *instance(); 0046 static void setEditorConfig(EditorConfig *); 0047 0048 virtual KConfigSkeleton *config() const = 0; 0049 0050 /// Return the own full name. 0051 [[nodiscard]] virtual QString fullName() const; 0052 0053 /// Return the own mail address. 0054 [[nodiscard]] virtual QString email() const; 0055 0056 /// Return true if the given email belongs to the user. 0057 virtual bool thatIsMe(const QString &email) const; 0058 0059 /// Returns all email addresses for the user. 0060 [[nodiscard]] virtual QStringList allEmails() const; 0061 0062 /// Returns all email addresses together with the full username for the user. 0063 [[nodiscard]] virtual QList<Organizer> allOrganizers() const; 0064 0065 /// Show timezone selectors in the event and todo editor dialog. 0066 [[nodiscard]] virtual bool showTimeZoneSelectorInIncidenceEditor() const; 0067 0068 [[nodiscard]] virtual QDateTime defaultDuration() const 0069 { 0070 return QDateTime(QDate(1752, 1, 1), QTime(2, 0)); 0071 } 0072 0073 [[nodiscard]] virtual QDateTime startTime() const 0074 { 0075 return QDateTime(QDate(1752, 1, 1), QTime(10, 0)); 0076 } 0077 0078 [[nodiscard]] virtual bool defaultAudioFileReminders() const 0079 { 0080 return false; 0081 } 0082 0083 [[nodiscard]] virtual QUrl audioFilePath() const 0084 { 0085 return {}; 0086 } 0087 0088 [[nodiscard]] virtual int reminderTime() const 0089 { 0090 return 15; 0091 } 0092 0093 [[nodiscard]] virtual int reminderTimeUnits() const 0094 { 0095 return 0; 0096 } 0097 0098 [[nodiscard]] virtual bool defaultTodoReminders() const 0099 { 0100 return false; 0101 } 0102 0103 [[nodiscard]] virtual bool defaultEventReminders() const 0104 { 0105 return false; 0106 } 0107 0108 [[nodiscard]] virtual QStringList activeDesignerFields() const 0109 { 0110 return {}; 0111 } 0112 0113 [[nodiscard]] virtual QStringList &templates(KCalendarCore::IncidenceBase::IncidenceType type); 0114 0115 private: 0116 std::unique_ptr<EditorConfigPrivate> const d; 0117 }; 0118 }