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.
187 lines
6.4 KiB
187 lines
6.4 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 KPLUGINSELECTOR_P_H
|
||
|
#define KPLUGINSELECTOR_P_H
|
||
|
|
||
15 years ago
|
#include <tqwidget.h>
|
||
15 years ago
|
|
||
13 years ago
|
#include <tdelibs_export.h>
|
||
15 years ago
|
|
||
12 years ago
|
class TDEConfigGroup;
|
||
15 years ago
|
class TQListViewItem;
|
||
15 years ago
|
class KPluginInfo;
|
||
12 years ago
|
class TDECModuleInfo;
|
||
15 years ago
|
|
||
|
/**
|
||
|
* This is a widget to configure what Plugins should be loaded. This widget is
|
||
|
* used by KPluginSelector and has no direct use.
|
||
|
*
|
||
|
* @internal
|
||
|
* @see KPluginSelector
|
||
|
*
|
||
|
* @author Matthias Kretz <kretz@kde.org>
|
||
|
* @since 3.2
|
||
|
*/
|
||
14 years ago
|
class KPluginSelectionWidget : public TQWidget
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
/**
|
||
|
* Create a new Plugin Selector widget.
|
||
|
*
|
||
|
* @param plugininfos A list of KPluginInfo objects containing the
|
||
|
* necessary information for the plugins you want to
|
||
|
* add the selector's list.
|
||
|
* @param kps A KPluginSelector object.
|
||
|
* @param parent The parent widget.
|
||
|
* @param catname The translated name of the category.
|
||
|
* @param category The unstranslated category key name.
|
||
12 years ago
|
* @param config Set the TDEConfigGroup object that holds the
|
||
15 years ago
|
* state of the plugins being enabled or not.
|
||
15 years ago
|
* @param name The name of the widget (passed to TQWidget)
|
||
15 years ago
|
*
|
||
|
* @internal
|
||
|
*/
|
||
15 years ago
|
KPluginSelectionWidget( const TQValueList<KPluginInfo*> & plugininfos,
|
||
|
KPluginSelector * kps, TQWidget * parent, const TQString & catname,
|
||
12 years ago
|
const TQString & category, TDEConfigGroup * config = 0,
|
||
15 years ago
|
const char * name = 0 );
|
||
|
|
||
|
virtual ~KPluginSelectionWidget();
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Returns the translated category name
|
||
|
*
|
||
|
* @internal
|
||
|
*/
|
||
15 years ago
|
TQString catName() const;
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Tell the KPluginInfo objects to load their state (enabled/disabled).
|
||
|
*/
|
||
|
virtual void load();
|
||
|
|
||
|
/**
|
||
|
* It tells the KPluginInfo objects to save their current state
|
||
|
* (enabled/disabled).
|
||
|
*/
|
||
|
virtual void save();
|
||
|
|
||
|
/**
|
||
|
* @return whether the plugin is enabled in the ListView or not.
|
||
|
*/
|
||
15 years ago
|
bool pluginChecked( const TQString & pluginName ) const;
|
||
15 years ago
|
|
||
|
signals:
|
||
|
/**
|
||
|
* Emits true when at least one embedded KCM is changed, or the plugin
|
||
|
* selection was changed.
|
||
|
* Emits false when the configuration is back to what it was.
|
||
|
*/
|
||
|
void changed( bool );
|
||
|
|
||
|
/**
|
||
|
* Emitted after the config of an embedded KCM has been saved. The
|
||
|
* argument is the name of the parent component that needs to reload
|
||
|
* its config
|
||
|
*/
|
||
15 years ago
|
void configCommitted( const TQCString & instanceName );
|
||
15 years ago
|
|
||
|
protected:
|
||
|
/**
|
||
|
* Reimplement in your subclass if you have special needs: The standard
|
||
14 years ago
|
* implementation looks at the KPluginInfo objects to find the
|
||
15 years ago
|
* needed information. But if, for some reason, your program doesn't
|
||
|
* work with that here's your chance to get it working.
|
||
|
*
|
||
|
* @return Whether the plugin is loaded.
|
||
|
*/
|
||
15 years ago
|
virtual bool pluginIsLoaded( const TQString & pluginName ) const;
|
||
15 years ago
|
|
||
|
private slots:
|
||
|
/**
|
||
15 years ago
|
* Called when a TQCheckListItem is checked or unchecked. It calls
|
||
15 years ago
|
* checkDependencies on the Plugin and then updateConfigPage.
|
||
|
*
|
||
|
* @internal
|
||
|
*/
|
||
15 years ago
|
void executed( TQListViewItem * );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Called whenever the visible config page should change (plugin
|
||
|
* selection changed, plugin checked changed)
|
||
|
*
|
||
|
* First it checks for a widget for the plugin - if there is one, great:
|
||
|
* show it.
|
||
|
* If there is none, check whether there should be one and try to load
|
||
|
* the KCM. If there are more than one KCM create a TabWidget and put
|
||
|
* all of them inside, else just use the "bare" KCM. If there is no KCM
|
||
|
* us the infoPage( NoKCM ). If there should be one but it can't be
|
||
|
* loaded us the infoPage( LoadError ).
|
||
|
* Depending on whether the currently selected Plugin is checked or not
|
||
|
* disable or enable the "page" (which is the TabWidget or the KCM).
|
||
|
*
|
||
|
* @internal
|
||
|
*/
|
||
|
void updateConfigPage( KPluginInfo * plugininfo, bool checked );
|
||
|
void updateConfigPage();
|
||
|
|
||
|
/**
|
||
|
* Whenever an embedded KCM emits the changed signal we count the number
|
||
|
* of changed KCMs. If it becomes one we emit changed( true ), if it
|
||
|
* becomes zero we emit changed( false ).
|
||
|
*
|
||
|
* @internal
|
||
|
*/
|
||
|
void clientChanged( bool );
|
||
|
|
||
|
/**
|
||
|
* Called whenever the tabWidget changes. It checks whether this
|
||
|
* KPluginSelectionWidget is shown and sets the currentplugininfo
|
||
|
* accordingly.
|
||
|
*/
|
||
15 years ago
|
void tabWidgetChanged( TQWidget * );
|
||
15 years ago
|
|
||
|
private:
|
||
|
/**
|
||
12 years ago
|
* Load a KCM from a TDECModuleInfo. If successfull connect changed
|
||
15 years ago
|
* signal and return the module. If not, create a label showing "Error",
|
||
|
* show the loaderError and return the label.
|
||
|
*
|
||
|
* @internal
|
||
|
*/
|
||
12 years ago
|
TQWidget * insertKCM( TQWidget * parent, const TDECModuleInfo & );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Embed the KCMs for the plugin into the widgetstack
|
||
|
*
|
||
|
* @internal
|
||
|
*/
|
||
|
void embeddPluginKCMs( KPluginInfo *, bool );
|
||
|
|
||
15 years ago
|
void init( const TQValueList<KPluginInfo*> & plugininfos, const TQString & );
|
||
15 years ago
|
void checkDependencies( const KPluginInfo * );
|
||
|
|
||
|
struct KPluginSelectionWidgetPrivate;
|
||
|
KPluginSelectionWidgetPrivate * d;
|
||
|
};
|
||
|
#endif // KPLUGINSELECTOR_P_H
|