Akonadi

collectionpropertiesdialog.h
1 /*
2  SPDX-FileCopyrightText: 2008 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "akonadiwidgets_export.h"
10 #include "collectionpropertiespage.h"
11 
12 #include <QDialog>
13 
14 #include <memory>
15 
16 namespace Akonadi
17 {
18 class Collection;
19 class CollectionPropertiesDialogPrivate;
20 
21 /**
22  * @short A generic and extensible dialog for collection properties.
23  *
24  * This dialog allows you to show or modify the properties of a collection.
25  *
26  * @code
27  *
28  * Akonadi::Collection collection = ...
29  *
30  * CollectionPropertiesDialog dlg( collection, this );
31  * dlg.exec();
32  *
33  * @endcode
34  *
35  * It can be extended by custom pages, which contains gui elements for custom
36  * properties.
37  *
38  * @see Akonadi::CollectionPropertiesPage
39  *
40  * @author Volker Krause <[email protected]>
41  */
42 class AKONADIWIDGETS_EXPORT CollectionPropertiesDialog : public QDialog
43 {
44  Q_OBJECT
45 public:
46  /**
47  * Enumerates the registered default pages which can be displayed.
48  *
49  * @since 4.7
50  */
51  enum DefaultPage {
52  GeneralPage, //!< General properties page
53  CachePage //!< Cache properties page
54  };
55 
56  /**
57  * Creates a new collection properties dialog.
58  *
59  * @param collection The collection which properties should be shown.
60  * @param parent The parent widget.
61  */
62  explicit CollectionPropertiesDialog(const Collection &collection, QWidget *parent = nullptr);
63 
64  /**
65  * Creates a new collection properties dialog.
66  *
67  * This constructor allows to specify the subset of registered pages that will
68  * be shown as well as their order. The pages have to set an objectName in their
69  * constructor to make it work. If an empty list is passed, all registered pages
70  * will be loaded. Use defaultPageObjectName() to fetch the object name for a
71  * registered default page.
72  *
73  * @param collection The collection which properties should be shown.
74  * @param pages The object names of the pages that shall be loaded.
75  * @param parent The parent widget.
76  *
77  * @since 4.6
78  */
79  CollectionPropertiesDialog(const Collection &collection, const QStringList &pages, QWidget *parent = nullptr);
80 
81  /**
82  * Destroys the collection properties dialog.
83  *
84  * @note Never call manually, the dialog is deleted automatically once all changes
85  * are written back to the Akonadi storage.
86  */
87  ~CollectionPropertiesDialog() override;
88 
89  /**
90  * Register custom pages for the collection properties dialog.
91  *
92  * @param factory The properties page factory that provides the custom page.
93  *
94  * @see Akonadi::CollectionPropertiesPageFactory
95  */
96  static void registerPage(CollectionPropertiesPageFactory *factory);
97 
98  /**
99  * Sets whether to @p use default page or not.
100  *
101  * @since 4.4
102  * @param use mode of default page's usage
103  */
104  static void useDefaultPage(bool use);
105 
106  /**
107  * Returns the object name of one of the dialog's registered default pages.
108  * The object name may be used in the QStringList constructor parameter to
109  * specify which default pages should be shown.
110  *
111  * @param page the desired page
112  * @return the page's object name
113  *
114  * @since 4.7
115  */
116  Q_REQUIRED_RESULT static QString defaultPageObjectName(DefaultPage page);
117 
118  /**
119  * Sets the page to be shown in the tab widget.
120  *
121  * @param name The object name of the page that is to be shown.
122  *
123  * @since 4.10
124  */
125  void setCurrentPage(const QString &name);
126 
127 Q_SIGNALS:
128  void settingsSaved();
129 
130 private:
131  /// @cond PRIVATE
132  std::unique_ptr<CollectionPropertiesDialogPrivate> const d;
133  /// @endcond
134 };
135 
136 }
A generic and extensible dialog for collection properties.
Represents a collection of PIM items.
Definition: collection.h:61
DefaultPage
Enumerates the registered default pages which can be displayed.
A factory class for collection properties dialog pages.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:52:15 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.