Framework for looking up contacts directly in nepomuk in addition to going through...
[kdepim.git] / mailcommon / foldercollection.h
blob68dd6b7a4d3e7b64797888df7d7ecd140b299f1c
1 /*
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>
30 #include <KShortcut>
31 #include <KIO/Job>
33 namespace MailCommon {
35 class MAILCOMMON_EXPORT FolderCollection : public QObject
37 Q_OBJECT
39 public:
40 static QSharedPointer<FolderCollection> forCollection(
41 const Akonadi::Collection &coll, bool writeConfig = true );
43 ~FolderCollection();
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;
55 void readConfig();
57 QString name() const;
59 bool isReadOnly() const;
61 bool isStructural() const;
63 bool isSystemFolder() const;
65 qint64 count() const;
67 bool canDeleteMessages() const;
69 bool canCreateMessages() const;
71 bool isValid() const;
73 Akonadi::Collection::Rights rights() const;
75 Akonadi::CollectionStatistics statistics() const;
77 void setShortcut( const KShortcut & );
78 const KShortcut &shortcut() const
80 return mShortcut;
83 /**
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;
96 /**
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
109 return mMailingList;
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
139 * in this folder.
141 bool ignoreNewMail() const
143 return mIgnoreNewMail;
145 void setIgnoreNewMail( bool b )
147 mIgnoreNewMail = b;
150 QString mailingListPostAddress() const;
152 protected slots:
153 void slotIdentitiesChanged();
155 private:
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;
165 uint mIdentity;
167 /** Should new mail in this folder be ignored? */
168 bool mIgnoreNewMail;
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. */
177 KShortcut mShortcut;
178 bool mWriteConfig;
180 bool mOldIgnoreNewMail;
185 #endif