SVN commit 1211421 by djarvie: Make the object names of the registered default pages discoverable by providing a method to return the object name for a specified page. M +12 -0 collectionpropertiesdialog.cpp M +24 -1 collectionpropertiesdialog.h --- trunk/KDE/kdepimlibs/akonadi/collectionpropertiesdialog.cpp #1211420:1211421 @@ -174,4 +174,16 @@ s_defaultPage = defaultPage; } +QString CollectionPropertiesDialog::defaultPageObjectName(DefaultPage page) +{ + switch (page) + { + case GeneralPage: + return QLatin1String( "Akonadi::CollectionGeneralPropertiesPage" ); + case CachePage: + return QLatin1String( "Akonadi::CachePolicyPage" ); + } + return QString(); +} + #include "collectionpropertiesdialog.moc" --- trunk/KDE/kdepimlibs/akonadi/collectionpropertiesdialog.h #1211420:1211421 @@ -56,6 +56,16 @@ Q_OBJECT public: /** + * Enumerates the registered default pages which can be displayed. + * + * @since 4.6 + */ + enum DefaultPage { + GeneralPage, //!< General properties page + CachePage //!< Cache properties page + }; + + /** * Creates a new collection properties dialog. * * @param collection The collection which properties should be shown. @@ -69,7 +79,8 @@ * This constructor allows to specify the subset of registered pages that will * be shown as well as their order. The pages have to set an objectName in their * constructor to make it work. If an empty list is passed, all registered pages - * will be loaded. + * will be loaded. Use defaultPageObjectName() to fetch the object name for a + * registered default page. * * @param collection The collection which properties should be shown. * @param pages The object names of the pages that shall be loaded. @@ -103,6 +114,18 @@ */ static void useDefaultPage( bool use ); + /** + * Returns the object name of one of the dialog's registered default pages. + * The object name may be used in the QStringList constructor parameter to + * specify which default pages should be shown. + * + * @param page the desired page + * @return the page's object name + * + * @since 4.6 + */ + static QString defaultPageObjectName(DefaultPage page); + private: //@cond PRIVATE class Private;