File indexing completed on 2024-05-12 05:13:15
0001 /* 0002 SPDX-FileCopyrightText: 2000, 2001 Cornelius Schumacher <schumacher@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0005 */ 0006 #pragma once 0007 0008 #include "calendarsupport_export.h" 0009 #include "kcalprefs_base.h" 0010 0011 #include <Akonadi/Collection> 0012 0013 #include <memory> 0014 0015 namespace CalendarSupport 0016 { 0017 class KCalPrefsPrivate; 0018 0019 class CALENDARSUPPORT_EXPORT KCalPrefs : public KCalPrefsBase 0020 { 0021 Q_OBJECT 0022 public: 0023 /** Constructor disabled for public. Use instance() to create a KCalPrefs 0024 object. */ 0025 KCalPrefs(); 0026 ~KCalPrefs() override; 0027 0028 /** Get instance of KCalPrefs. It is made sure that there is only one 0029 instance. */ 0030 static KCalPrefs *instance(); 0031 0032 /** Set preferences to default values */ 0033 void usrSetDefaults() override; 0034 0035 /** Read preferences from config file */ 0036 void usrRead() override; 0037 0038 /** Write preferences to config file */ 0039 bool usrSave() override; 0040 0041 /** Fill empty mail fields with default values. */ 0042 void fillMailDefaults(); 0043 0044 public: 0045 // preferences data 0046 QString fullName(); 0047 QString email(); 0048 /// Returns all email addresses for the user. 0049 QStringList allEmails(); 0050 /// Returns all email addresses together with the full username for the user. 0051 QStringList fullEmails(); 0052 /// Return true if the given email belongs to the user 0053 bool thatIsMe(const QString &email); 0054 0055 Akonadi::Collection::Id defaultCalendarId() const; 0056 void setDefaultCalendarId(Akonadi::Collection::Id); 0057 0058 void setDayBegins(const QDateTime &dateTime); 0059 QDateTime dayBegins() const; 0060 0061 private: 0062 std::unique_ptr<KCalPrefsPrivate> const d; 0063 }; 0064 }