1/*
2 Copyright (c) 2010 Till Adam <adam@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef AKONADI_CACHEPOLICYPAGE_H
21#define AKONADI_CACHEPOLICYPAGE_H
22
23#include "akonadi_export.h"
24
25#include <akonadi/collectionpropertiespage.h>
26
27namespace Akonadi {
28
29/**
30 * @short A page in a collection properties dialog to configure the cache policy.
31 *
32 * This page allows the user to fine tune the cache policy of a collection
33 * in the Akonadi storage. It provides two modes, a UserMode and an AdvancedMode.
34 * While the former should be used in end-user applications, the latter can be
35 * used in debugging tools.
36 *
37 * @see Akonadi::CollectionPropertiesDialog, Akonadi::CollectionPropertiesPageFactory
38 *
39 * @author Till Adam <adam@kde.org>
40 * @since 4.6
41 */
42class AKONADI_EXPORT CachePolicyPage : public CollectionPropertiesPage
43{
44 Q_OBJECT
45
46public:
47 /**
48 * Describes the mode of the cache policy page.
49 */
50 enum GuiMode {
51 UserMode, ///< A simplified UI for end-users will be provided.
52 AdvancedMode ///< An advanced UI for debugging will be provided.
53 };
54
55 /**
56 * Creates a new cache policy page.
57 *
58 * @param parent The parent widget.
59 * @param mode The UI mode that will be used for the page.
60 */
61 explicit CachePolicyPage(QWidget *parent, GuiMode mode = UserMode);
62
63 /**
64 * Destroys the cache policy page.
65 */
66 ~CachePolicyPage();
67
68 /**
69 * Checks if the cache policy page can actually handle the given @p collection.
70 */
71 bool canHandle(const Collection &collection) const;
72
73 /**
74 * Loads the page content from the given @p collection.
75 */
76 void load(const Collection &collection);
77
78 /**
79 * Saves page content to the given @p collection.
80 */
81 void save(Collection &collection);
82
83private:
84 //@cond PRIVATE
85 class Private;
86 Private *const d;
87
88 Q_PRIVATE_SLOT(d, void slotIntervalValueChanged(int))
89 Q_PRIVATE_SLOT(d, void slotCacheValueChanged(int))
90 Q_PRIVATE_SLOT(d, void slotRetrievalOptionsGroupBoxDisabled(bool))
91
92 //@endcond
93};
94
95AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY(CachePolicyPageFactory, CachePolicyPage)
96
97}
98
99#endif
100