Mailcommon

foldersettings.h
1 /*
2  SPDX-FileCopyrightText: 2009-2022 Laurent Montel <[email protected]>
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 
21 namespace MailCommon
22 {
23 /**
24  * @brief The FolderSettings class
25  * @author Laurent Montel <[email protected]>
26  */
27 class MAILCOMMON_EXPORT FolderSettings : public QObject
28 {
29  Q_OBJECT
30 
31 public:
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  Q_REQUIRED_RESULT bool isWriteConfig() const;
43  void setWriteConfig(bool writeConfig);
44 
45  void writeConfig() const;
46  void readConfig();
47 
48  Q_REQUIRED_RESULT QString name() const;
49 
50  Q_REQUIRED_RESULT bool isReadOnly() const;
51 
52  Q_REQUIRED_RESULT bool isStructural() const;
53 
54  Q_REQUIRED_RESULT bool isSystemFolder() const;
55 
56  Q_REQUIRED_RESULT qint64 count() const;
57 
58  Q_REQUIRED_RESULT bool canDeleteMessages() const;
59 
60  Q_REQUIRED_RESULT bool canCreateMessages() const;
61 
62  Q_REQUIRED_RESULT bool isValid() const;
63 
64  Q_REQUIRED_RESULT Akonadi::Collection::Rights rights() const;
65 
66  Q_REQUIRED_RESULT 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  Q_REQUIRED_RESULT bool useDefaultIdentity() const;
77 
78  void setIdentity(uint identity);
79  Q_REQUIRED_RESULT uint identity() const;
80 
81  /**
82  * Returns true if this folder is associated with a mailing-list.
83  */
84  void setMailingListEnabled(bool enabled);
85  Q_REQUIRED_RESULT bool isMailingListEnabled() const;
86 
87  void setMailingList(const MailingList &mlist);
88 
89  Q_REQUIRED_RESULT 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  Q_REQUIRED_RESULT 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  Q_REQUIRED_RESULT bool hideInSelectionDialog() const;
102  void setHideInSelectionDialog(bool hide);
103 
104  Q_REQUIRED_RESULT QString mailingListPostAddress() const;
105 
106  Q_REQUIRED_RESULT uint fallBackIdentity() const;
107  Q_REQUIRED_RESULT MessageViewer::Viewer::DisplayFormatMessage formatMessage() const;
108  void setFormatMessage(MessageViewer::Viewer::DisplayFormatMessage formatMessage);
109 
110  Q_REQUIRED_RESULT bool folderHtmlLoadExtPreference() const;
111  void setFolderHtmlLoadExtPreference(bool folderHtmlLoadExtPreference);
112 
113 protected Q_SLOTS:
114  void slotIdentitiesChanged();
115 
116 private:
117  explicit FolderSettings(const Akonadi::Collection &col, bool writeconfig);
118  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-2022 The KDE developers.
Generated on Sat Oct 1 2022 04:00:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.