~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to systemsettings/core/BaseData.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2009 Ben Cooksley <bcooksley@kde.org>                   *
 
3
 *                                                                         *
 
4
 *   This program is free software; you can redistribute it and/or modify  *
 
5
 *   it under the terms of the GNU General Public License as published by  *
 
6
 *   the Free Software Foundation; either version 2 of the License, or     *
 
7
 *   (at your option) any later version.                                   *
 
8
 *                                                                         *
 
9
 *   This program is distributed in the hope that it will be useful,       *
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
12
 *   GNU General Public License for more details.                          *
 
13
 *                                                                         *
 
14
 *   You should have received a copy of the GNU General Public License     *
 
15
 *   along with this program; if not, write to the                         *
 
16
 *   Free Software Foundation, Inc.,                                       *
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA          *
 
18
 ***************************************************************************/
 
19
 
 
20
#ifndef BASEDATA_H
 
21
#define BASEDATA_H
 
22
 
 
23
#include <QtCore/QObject>
 
24
#include "systemsettingsview_export.h"
 
25
 
 
26
class QString;
 
27
class MenuItem;
 
28
class KConfigGroup;
 
29
 
 
30
/**
 
31
 * @brief Provides a interface sharing common data between modules in System Settings
 
32
 *
 
33
 * BaseData is a standard interface in System Settings to retrieve information that is shared between all modules.
 
34
 * It is a singleton, and will be automatically cleaned up. 
 
35
 *
 
36
 * @author Ben Cooksley <bcooksley@kde.org>
 
37
*/
 
38
class SYSTEMSETTINGSVIEW_EXPORT BaseData : public QObject 
 
39
{
 
40
    Q_OBJECT
 
41
    Q_DISABLE_COPY(BaseData)
 
42
 
 
43
private:
 
44
    explicit BaseData();
 
45
 
 
46
public:
 
47
    /**
 
48
     * Provides a pointer to access the shared BaseData instance in order to retrieve data.
 
49
     *
 
50
     * @returns Access to the shared instance of BaseData.
 
51
     */
 
52
    static BaseData* instance();
 
53
 
 
54
    /**
 
55
    * Normal destructor that handles cleanup. Any objects created through BaseData must be assumed
 
56
    * to be invalid afterwards.
 
57
    */
 
58
    ~BaseData();
 
59
 
 
60
    /**
 
61
    * Provides the shared MenuItem which lists all categories and modules, for use with MenuModel.
 
62
    *
 
63
    * @returns the shared MenuItem.
 
64
    */
 
65
    MenuItem * menuItem();
 
66
 
 
67
    /**
 
68
    * Sets the MenuItem which the Singleton will return.
 
69
    * For internal use only.
 
70
    *
 
71
    * @param item A pointer to the MenuItem object
 
72
    */
 
73
    void setMenuItem( MenuItem * item );
 
74
 
 
75
    /**
 
76
    * Returns the configuration group by the name provided in the current applications configuration file.
 
77
    *
 
78
    * @param pluginName the name of the group that is required.
 
79
    * @returns The configuration group that is required.
 
80
    */
 
81
    KConfigGroup configGroup( const QString& pluginName );
 
82
 
 
83
private:
 
84
    MenuItem * rootMenu;
 
85
};
 
86
 
 
87
#endif
 
88