You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
225 lines
7.9 KiB
225 lines
7.9 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 2003 Matthias Kretz <kretz@kde.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License version 2 as published by the Free Software Foundation.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
|
||
|
*/
|
||
|
|
||
|
#ifndef KSETTINGS_DIALOG_H
|
||
|
#define KSETTINGS_DIALOG_H
|
||
|
|
||
15 years ago
|
#include <tqobject.h>
|
||
15 years ago
|
#include <kservice.h>
|
||
|
|
||
15 years ago
|
template<class T> class TQValueList;
|
||
15 years ago
|
class KPluginInfo;
|
||
|
class KCMultiDialog;
|
||
12 years ago
|
class TDECModuleInfo;
|
||
15 years ago
|
|
||
|
namespace KSettings
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* @ingroup main
|
||
|
* @ingroup settings
|
||
|
* @short Generic configuration dialog that even works over component boundaries
|
||
|
*
|
||
|
* For more information see \ref KSettings.
|
||
|
*
|
||
|
* This class aims to standardize the use of configuration dialogs in KDE
|
||
|
* applications. Especially when using KParts and/or Plugins you face problems
|
||
|
* creating a consistent config dialog.
|
||
|
*
|
||
|
* To show a configuration dialog you only have to call the show method and be
|
||
|
* done with it. A code example:
|
||
|
*
|
||
|
* You initialize \p m_cfgdlg with
|
||
|
* \code
|
||
|
* m_cfgdlg = new Dialog( Dialog::Static, this );
|
||
|
* \endcode
|
||
|
* If you use a KPart that was not especially designed for your app you can use
|
||
|
* the second constructor:
|
||
|
* \code
|
||
12 years ago
|
* TQStringList tdepartslist;
|
||
|
* for( all my tdeparts )
|
||
|
* tdepartslist += m_mypart->instance().instanceName();
|
||
|
* m_cfgdlg = new Dialog( tdepartslist, this );
|
||
15 years ago
|
* \endcode
|
||
|
* and the action for the config dialog is connected to the show slot:
|
||
|
* \code
|
||
15 years ago
|
* KStdAction::preferences( m_cfgdlg, TQT_SLOT( show() ), actionCollection() );
|
||
15 years ago
|
* \endcode
|
||
|
*
|
||
|
* If you need to be informed when the config was changed and applied in the
|
||
|
* dialog you might want to take a look at Dispatcher.
|
||
|
*
|
||
|
* For more information see \ref KSettings.
|
||
|
*
|
||
|
* @author Matthias Kretz <kretz@kde.org>
|
||
|
* @since 3.2
|
||
|
*/
|
||
14 years ago
|
class KUTILS_EXPORT Dialog : public TQObject
|
||
15 years ago
|
{
|
||
|
friend class PageNode;
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
/**
|
||
|
* Tells the dialog whether the entries in the listview are all static
|
||
|
* or whether it should add a Configure... button to select which parts
|
||
|
* of the optional functionality should be active or not.
|
||
|
*/
|
||
|
enum ContentInListView
|
||
|
{
|
||
|
/**
|
||
|
* Static listview, while running no entries are added or deleted
|
||
|
*/
|
||
|
Static,
|
||
|
/**
|
||
|
* Configurable listview. The user can select what functionality he
|
||
|
* wants.
|
||
|
*/
|
||
|
Configurable
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Construct a new Preferences Dialog for the application. It uses all
|
||
12 years ago
|
* KCMs with X-TDE-ParentApp set to TDEGlobal::instance()->instanceName().
|
||
15 years ago
|
*
|
||
|
* @param parent The parent is only used as the parent for the
|
||
|
* dialog - centering the dialog over the parent
|
||
|
* widget.
|
||
|
* @param name name
|
||
|
*/
|
||
15 years ago
|
Dialog( TQWidget * parent = 0, const char * name = 0 );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Construct a new Preferences Dialog for the application. It uses all
|
||
12 years ago
|
* KCMs with X-TDE-ParentApp set to TDEGlobal::instance()->instanceName().
|
||
15 years ago
|
*
|
||
|
* @param content Select whether you want a static or configurable
|
||
|
* config dialog.
|
||
|
* @param parent The parent is only used as the parent for the
|
||
|
* dialog - centering the dialog over the parent
|
||
|
* widget.
|
||
|
* @param name name
|
||
|
*/
|
||
15 years ago
|
Dialog( ContentInListView content = Static, TQWidget * parent = 0,
|
||
15 years ago
|
const char * name = 0 );
|
||
|
|
||
|
/**
|
||
|
* Construct a new Preferences Dialog with the pages for the selected
|
||
|
* instance names. For example if you want to have the configuration
|
||
|
* pages for the kviewviewer KPart you would pass a
|
||
15 years ago
|
* TQStringList consisting of only the name of the part "kviewviewer".
|
||
15 years ago
|
*
|
||
|
* @param components A list of the names of the components that your
|
||
|
* config dialog should merge the config pages in.
|
||
|
* @param parent The parent is only used as the parent for the
|
||
|
* dialog - centering the dialog over the parent
|
||
|
* widget.
|
||
|
* @param name name
|
||
|
*/
|
||
15 years ago
|
Dialog( const TQStringList & components, TQWidget * parent = 0,
|
||
15 years ago
|
const char * name = 0 );
|
||
|
|
||
|
/**
|
||
|
* Construct a new Preferences Dialog with the pages for the selected
|
||
|
* instance names. For example if you want to have the configuration
|
||
|
* pages for the kviewviewer KPart you would pass a
|
||
15 years ago
|
* TQStringList consisting of only the name of the part "kviewviewer".
|
||
15 years ago
|
*
|
||
|
* @param components A list of the names of the components that your
|
||
|
* config dialog should merge the config pages in.
|
||
|
* @param content Select whether you want a static or configurable
|
||
|
* config dialog.
|
||
|
* @param parent The parent is only used as the parent for the
|
||
|
* dialog - centering the dialog over the parent
|
||
|
* widget.
|
||
|
* @param name name
|
||
|
*/
|
||
15 years ago
|
Dialog( const TQStringList & components, ContentInListView
|
||
|
content, TQWidget * parent = 0, const char * name = 0 );
|
||
15 years ago
|
|
||
|
~Dialog();
|
||
|
|
||
|
/**
|
||
|
* If you use a Configurable dialog you need to pass KPluginInfo
|
||
|
* objects that the dialog should configure.
|
||
|
*/
|
||
15 years ago
|
void addPluginInfos( const TQValueList<KPluginInfo*> & plugininfos );
|
||
15 years ago
|
|
||
|
KCMultiDialog * dialog();
|
||
|
|
||
|
public slots:
|
||
|
/**
|
||
|
* Show the config dialog. The slot immediatly returns since the dialog
|
||
|
* is non-modal.
|
||
|
*/
|
||
|
void show();
|
||
|
|
||
|
signals:
|
||
|
/**
|
||
|
* If you use the dialog in Configurable mode and want to be notified
|
||
|
* when the user changes the plugin selections use this signal. It's
|
||
|
* emitted if the selection has changed and the user pressed Apply or
|
||
|
* Ok. In the slot you would then load and unload the plugins as
|
||
|
* requested.
|
||
|
*/
|
||
|
void pluginSelectionChanged();
|
||
|
|
||
|
protected slots:
|
||
|
void configureTree();
|
||
|
void updateTreeList();
|
||
|
|
||
|
private:
|
||
|
/**
|
||
|
* @internal
|
||
|
* Check whether the plugin associated with this KCM is enabled.
|
||
|
*/
|
||
12 years ago
|
bool isPluginForKCMEnabled( TDECModuleInfo * ) const;
|
||
15 years ago
|
|
||
15 years ago
|
TQValueList<KService::Ptr> instanceServices() const;
|
||
|
TQValueList<KService::Ptr> parentComponentsServices(
|
||
|
const TQStringList & ) const;
|
||
15 years ago
|
/**
|
||
|
* @internal
|
||
|
* Read the .setdlg file and add it to the groupmap
|
||
|
*/
|
||
15 years ago
|
void parseGroupFile( const TQString & );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* @internal
|
||
|
* If this module is put into a TreeList hierarchy this will return a
|
||
|
* list of the names of the parent modules.
|
||
|
*/
|
||
12 years ago
|
TQStringList parentModuleNames( TDECModuleInfo * );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* @internal
|
||
|
* This method is called only once. The KCMultiDialog is not created
|
||
|
* until it's really needed. So if some method needs to access d->dlg it
|
||
|
* checks for 0 and if it's not created this method will do it.
|
||
|
*/
|
||
|
void createDialogFromServices();
|
||
|
|
||
|
class DialogPrivate;
|
||
|
DialogPrivate * d;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
// vim: sw=4 sts=4 et
|
||
|
#endif // KSETTINGS_DIALOG_H
|