Mailcommon

foldersettings.h
1/*
2 SPDX-FileCopyrightText: 2009-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "mailcommon_export.h"
10#include <MessageViewer/Viewer>
11
12#include <MessageCore/MailingList>
14
15#include <Akonadi/Collection>
16#include <Akonadi/CollectionStatistics>
17
18#include <KSharedConfig>
19#include <QKeySequence>
20
21namespace MailCommon
22{
23/**
24 * @brief The FolderSettings class
25 * @author Laurent Montel <montel@kde.org>
26 */
27class MAILCOMMON_EXPORT FolderSettings : public QObject
28{
29 Q_OBJECT
30
31public:
32 static QSharedPointer<FolderSettings> forCollection(const Akonadi::Collection &coll, bool writeConfig = true);
33
34 ~FolderSettings() override;
35
36 void setCollection(const Akonadi::Collection &collection);
37
38 static QString configGroupName(const Akonadi::Collection &col);
39 static void clearCache();
40 static void resetHtmlFormat();
41
42 [[nodiscard]] bool isWriteConfig() const;
43 void setWriteConfig(bool writeConfig);
44
45 void writeConfig() const;
46 void readConfig();
47
48 [[nodiscard]] QString name() const;
49
50 [[nodiscard]] bool isReadOnly() const;
51
52 [[nodiscard]] bool isStructural() const;
53
54 [[nodiscard]] bool isSystemFolder() const;
55
56 [[nodiscard]] qint64 count() const;
57
58 [[nodiscard]] bool canDeleteMessages() const;
59
60 [[nodiscard]] bool canCreateMessages() const;
61
62 [[nodiscard]] bool isValid() const;
63
64 [[nodiscard]] Akonadi::Collection::Rights rights() const;
65
66 [[nodiscard]] Akonadi::CollectionStatistics statistics() const;
67
68 void setShortcut(const QKeySequence &);
69 const QKeySequence &shortcut() const;
70
71 /**
72 * Get / set whether the default identity should be used instead of the
73 * identity specified by setIdentity().
74 */
75 void setUseDefaultIdentity(bool useDefaultIdentity);
76 [[nodiscard]] bool useDefaultIdentity() const;
77
78 void setIdentity(uint identity);
79 [[nodiscard]] uint identity() const;
80
81 /**
82 * Returns true if this folder is associated with a mailing-list.
83 */
84 void setMailingListEnabled(bool enabled);
85 [[nodiscard]] bool isMailingListEnabled() const;
86
87 void setMailingList(const MailingList &mlist);
88
89 [[nodiscard]] MailingList mailingList() const;
90
91 /**
92 * Returns true if the replies to mails from this folder should be
93 * put in the same folder.
94 */
95 [[nodiscard]] bool putRepliesInSameFolder() const;
96 void setPutRepliesInSameFolder(bool b);
97
98 /**
99 * Returns true if this folder should be hidden from all folder selection dialogs
100 */
101 [[nodiscard]] bool hideInSelectionDialog() const;
102 void setHideInSelectionDialog(bool hide);
103
104 [[nodiscard]] QString mailingListPostAddress() const;
105
106 [[nodiscard]] uint fallBackIdentity() const;
107 [[nodiscard]] MessageViewer::Viewer::DisplayFormatMessage formatMessage() const;
108 void setFormatMessage(MessageViewer::Viewer::DisplayFormatMessage formatMessage);
109
110 [[nodiscard]] bool folderHtmlLoadExtPreference() const;
111 void setFolderHtmlLoadExtPreference(bool folderHtmlLoadExtPreference);
112
113protected Q_SLOTS:
114 void slotIdentitiesChanged();
115
116private:
117 explicit MAILCOMMON_NO_EXPORT FolderSettings(const Akonadi::Collection &col, bool writeconfig);
118 MAILCOMMON_NO_EXPORT QString resource() const;
119
120 Akonadi::Collection mCollection;
121
122 /** Mailing list attributes */
123 bool mMailingListEnabled = false;
124 MailingList mMailingList;
125
126 bool mUseDefaultIdentity = true;
127 uint mIdentity;
128
129 MessageViewer::Viewer::DisplayFormatMessage mFormatMessage = MessageViewer::Viewer::Unknown;
130 /** Should replies to messages in this folder be put in here? */
131 bool mPutRepliesInSameFolder = false;
132
133 /** Should this folder be hidden in the folder selection dialog? */
134 bool mHideInSelectionDialog = false;
135
136 bool mFolderHtmlLoadExtPreference = false;
137
138 /** shortcut associated with this folder or null, if none is configured. */
139 QKeySequence mShortcut;
140 bool mWriteConfig = true;
141};
142}
The FolderSettings class.
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:01 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.