Warning, file /pim/mailcommon/src/folder/foldersettings.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2009-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "mailcommon_export.h" 0010 #include <MessageViewer/Viewer> 0011 0012 #include <MessageCore/MailingList> 0013 using MessageCore::MailingList; 0014 0015 #include <Akonadi/Collection> 0016 #include <Akonadi/CollectionStatistics> 0017 0018 #include <KSharedConfig> 0019 #include <QKeySequence> 0020 0021 namespace MailCommon 0022 { 0023 /** 0024 * @brief The FolderSettings class 0025 * @author Laurent Montel <montel@kde.org> 0026 */ 0027 class MAILCOMMON_EXPORT FolderSettings : public QObject 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 static QSharedPointer<FolderSettings> forCollection(const Akonadi::Collection &coll, bool writeConfig = true); 0033 0034 ~FolderSettings() override; 0035 0036 void setCollection(const Akonadi::Collection &collection); 0037 0038 static QString configGroupName(const Akonadi::Collection &col); 0039 static void clearCache(); 0040 static void resetHtmlFormat(); 0041 0042 [[nodiscard]] bool isWriteConfig() const; 0043 void setWriteConfig(bool writeConfig); 0044 0045 void writeConfig() const; 0046 void readConfig(); 0047 0048 [[nodiscard]] QString name() const; 0049 0050 [[nodiscard]] bool isReadOnly() const; 0051 0052 [[nodiscard]] bool isStructural() const; 0053 0054 [[nodiscard]] bool isSystemFolder() const; 0055 0056 [[nodiscard]] qint64 count() const; 0057 0058 [[nodiscard]] bool canDeleteMessages() const; 0059 0060 [[nodiscard]] bool canCreateMessages() const; 0061 0062 [[nodiscard]] bool isValid() const; 0063 0064 [[nodiscard]] Akonadi::Collection::Rights rights() const; 0065 0066 [[nodiscard]] Akonadi::CollectionStatistics statistics() const; 0067 0068 void setShortcut(const QKeySequence &); 0069 const QKeySequence &shortcut() const; 0070 0071 /** 0072 * Get / set whether the default identity should be used instead of the 0073 * identity specified by setIdentity(). 0074 */ 0075 void setUseDefaultIdentity(bool useDefaultIdentity); 0076 [[nodiscard]] bool useDefaultIdentity() const; 0077 0078 void setIdentity(uint identity); 0079 [[nodiscard]] uint identity() const; 0080 0081 /** 0082 * Returns true if this folder is associated with a mailing-list. 0083 */ 0084 void setMailingListEnabled(bool enabled); 0085 [[nodiscard]] bool isMailingListEnabled() const; 0086 0087 void setMailingList(const MailingList &mlist); 0088 0089 [[nodiscard]] MailingList mailingList() const; 0090 0091 /** 0092 * Returns true if the replies to mails from this folder should be 0093 * put in the same folder. 0094 */ 0095 [[nodiscard]] bool putRepliesInSameFolder() const; 0096 void setPutRepliesInSameFolder(bool b); 0097 0098 /** 0099 * Returns true if this folder should be hidden from all folder selection dialogs 0100 */ 0101 [[nodiscard]] bool hideInSelectionDialog() const; 0102 void setHideInSelectionDialog(bool hide); 0103 0104 [[nodiscard]] QString mailingListPostAddress() const; 0105 0106 [[nodiscard]] uint fallBackIdentity() const; 0107 [[nodiscard]] MessageViewer::Viewer::DisplayFormatMessage formatMessage() const; 0108 void setFormatMessage(MessageViewer::Viewer::DisplayFormatMessage formatMessage); 0109 0110 [[nodiscard]] bool folderHtmlLoadExtPreference() const; 0111 void setFolderHtmlLoadExtPreference(bool folderHtmlLoadExtPreference); 0112 0113 protected Q_SLOTS: 0114 void slotIdentitiesChanged(); 0115 0116 private: 0117 explicit MAILCOMMON_NO_EXPORT FolderSettings(const Akonadi::Collection &col, bool writeconfig); 0118 MAILCOMMON_NO_EXPORT QString resource() const; 0119 0120 Akonadi::Collection mCollection; 0121 0122 /** Mailing list attributes */ 0123 bool mMailingListEnabled = false; 0124 MailingList mMailingList; 0125 0126 bool mUseDefaultIdentity = true; 0127 uint mIdentity; 0128 0129 MessageViewer::Viewer::DisplayFormatMessage mFormatMessage = MessageViewer::Viewer::Unknown; 0130 /** Should replies to messages in this folder be put in here? */ 0131 bool mPutRepliesInSameFolder = false; 0132 0133 /** Should this folder be hidden in the folder selection dialog? */ 0134 bool mHideInSelectionDialog = false; 0135 0136 bool mFolderHtmlLoadExtPreference = false; 0137 0138 /** shortcut associated with this folder or null, if none is configured. */ 0139 QKeySequence mShortcut; 0140 bool mWriteConfig = true; 0141 }; 0142 }