2 Copyright (c) 2009 Montel Laurent <montel@kde.org>
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License, version 2, as
6 published by the Free Software Foundation.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License along
14 with this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef MAILCOMMON_FOLDERCOLLECTION_H
19 #define MAILCOMMON_FOLDERCOLLECTION_H
21 #include "mailcommon_export.h"
23 #include <messagecore/mailinglist.h>
24 using MessageCore::MailingList
;
26 #include <Akonadi/Collection>
27 #include <Akonadi/CollectionStatistics>
29 #include <KSharedConfig>
33 namespace MailCommon
{
35 class MAILCOMMON_EXPORT FolderCollection
: public QObject
40 static QSharedPointer
<FolderCollection
> forCollection(
41 const Akonadi::Collection
&coll
, bool writeConfig
= true );
45 Akonadi::Collection
collection() const;
46 void setCollection( const Akonadi::Collection
&collection
);
48 static QString
configGroupName( const Akonadi::Collection
&col
);
49 static void clearCache();
51 bool isWriteConfig() const;
52 void setWriteConfig( bool writeConfig
);
54 void writeConfig() const;
59 bool isReadOnly() const;
61 bool isStructural() const;
63 bool isSystemFolder() const;
67 bool canDeleteMessages() const;
69 bool canCreateMessages() const;
73 Akonadi::Collection::Rights
rights() const;
75 Akonadi::CollectionStatistics
statistics() const;
77 void setShortcut( const KShortcut
& );
78 const KShortcut
&shortcut() const
84 * Get / set whether the default identity should be used instead of the
85 * identity specified by setIdentity().
87 void setUseDefaultIdentity( bool useDefaultIdentity
);
88 bool useDefaultIdentity() const
90 return mUseDefaultIdentity
;
93 void setIdentity( uint identity
);
94 uint
identity() const;
97 * Returns true if this folder is associated with a mailing-list.
99 void setMailingListEnabled( bool enabled
);
100 bool isMailingListEnabled() const
102 return mMailingListEnabled
;
105 void setMailingList( const MailingList
&mlist
);
107 MailingList
mailingList() const
113 * Returns true if the replies to mails from this folder should be
114 * put in the same folder.
116 bool putRepliesInSameFolder() const
118 return mPutRepliesInSameFolder
;
120 void setPutRepliesInSameFolder( bool b
)
122 mPutRepliesInSameFolder
= b
;
126 * Returns true if this folder should be hidden from all folder selection dialogs
128 bool hideInSelectionDialog() const
130 return mHideInSelectionDialog
;
132 void setHideInSelectionDialog( bool hide
)
134 mHideInSelectionDialog
= hide
;
138 * Returns true if the user doesn't want to get notified about new mail
141 bool ignoreNewMail() const
143 return mIgnoreNewMail
;
145 void setIgnoreNewMail( bool b
)
150 QString
mailingListPostAddress() const;
153 void slotIdentitiesChanged();
156 explicit FolderCollection( const Akonadi::Collection
&col
, bool writeconfig
);
158 Akonadi::Collection mCollection
;
160 /** Mailing list attributes */
161 bool mMailingListEnabled
;
162 MailingList mMailingList
;
164 bool mUseDefaultIdentity
;
167 /** Should new mail in this folder be ignored? */
170 /** Should replies to messages in this folder be put in here? */
171 bool mPutRepliesInSameFolder
;
173 /** Should this folder be hidden in the folder selection dialog? */
174 bool mHideInSelectionDialog
;
176 /** shortcut associated with this folder or null, if none is configured. */
180 bool mOldIgnoreNewMail
;