1
/*****************************************************************************
2
* Copyright (C) 2009 Ben Cooksley <bcooksley@kde.org> *
3
* Copyright (C) 2009 by Mathias Soeken <msoeken@informatik.uni-bremen.de> *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
19
*****************************************************************************/
24
#include <QtGui/QWidget>
25
#include <QtCore/QModelIndex>
26
#include "systemsettingsview_export.h"
32
class KPageWidgetItem;
35
* @brief Provides a convienent way to display modules
37
* Provides a standardised interface for displaying multiple modules simultaneously
38
* and provides facilities to access the current module, and to load its help, restore
39
* default settings, save new settings and revert changes to settings
41
* It also provides checking for when a module has changed its configuration, and will prompt
42
* if the user tries to change module or view if BaseMode is reimplemented correctly
44
* It also provides signals for active module changes, configuration changes and for when it has
45
* been requested to close by button press
47
* @author Mathias Soeken <msoeken@informatik.uni-bremen.de>
48
* @author Ben Cooksley <bcooksley@kde.org>
50
class SYSTEMSETTINGSVIEW_EXPORT ModuleView : public QWidget
56
* Constructs a ModuleView, with the parent specified.
58
explicit ModuleView(QWidget * parent = 0);
61
* Destroys the module view, along with all modules loaded, and any changes present in them.
63
* @warning The user will not be prompted to save changes if any exist.\n
68
* Provides the module information, which is used to set the caption of the window when either the
69
* active module or configuration changes.
71
KCModuleInfo * activeModule() const;
74
* Provides the about data of the active module, used for the about dialog.
76
const KAboutData * aboutData() const;
79
* Resolves any changes in the currently active module by prompting the user if they exist.
81
* @returns true if the user saved or discarded changes, or there were no changes at all.
82
* @returns false if the user canceled the module change.
84
bool resolveChanges();
87
* Closes all active modules, after checking there are no active changes.
89
* @warning This forces all modules to be destroyed regardless of if changes exist or not
90
* If possible, always check with resolveChanges() first.
96
* Loads the module specified by menuItem.\n
97
* If the module has children, they will all be loaded instead of the module.
99
* @param menuItem the QModelIndex that you want to load. Must be sourced from either MenuModel or MenuProxyModel
101
void loadModule( QModelIndex menuItem );
104
* Will open KHelpCenter, and load the help for the active module.
109
* Causes the active module to reload its configuration, reverting all changes.
114
* Causes the active module to save its configuration, applying all changes.
119
* Causes the active module to revert all changes to the configuration, and return to defaults.
121
void moduleDefaults();
124
* Reimplemented for internal reasons.\n
126
void keyPressEvent( QKeyEvent * event );
129
bool resolveChanges( KCModuleProxy *currentProxy );
130
void addModule( KCModuleInfo *module );
131
bool moduleSave( KCModuleProxy *module );
132
void updatePageIconHeader( KPageWidgetItem * page, bool light = false );
135
void activeModuleChanged( KPageWidgetItem* current, KPageWidgetItem* previous);
136
void updateButtons();
141
* Emitted when the currently active module is changed. This occurs whenever the active module or
142
* its configuration changes. This causes the window caption to update.
144
void moduleChanged( bool state );
147
* Emitted when the ModuleView is asked to close.\n