KCModuleProxy Class Reference
Encapsulates a KCModule for embedding. More...
#include <kcmoduleproxy.h>
Inheritance diagram for KCModuleProxy:

Public Slots | |
void | runAsRoot () |
void | defaults () |
void | deleteClient () |
Signals | |
void | changed (bool state) |
void | changed (KCModuleProxy *mod) |
void | childClosed () |
void | quickHelpChanged () |
Public Member Functions | |
KCModuleProxy (const KCModuleInfo &info, bool withFallback=true, QWidget *parent=0, const char *name=0, const QStringList &args=QStringList()) | |
KCModuleProxy (const QString &serviceName, bool withFallback=true, QWidget *parent=0, const char *name=0, const QStringList &args=QStringList()) | |
KCModuleProxy (const KService::Ptr &service, bool withFallback=true, QWidget *parent=0, const char *name=0, const QStringList &args=QStringList()) | |
~KCModuleProxy () | |
void | load () |
void | save () |
QString | quickHelp () const |
const KAboutData * | aboutData () const |
int | buttons () const |
QString | rootOnlyMsg () const |
bool | useRootOnlyMsg () const |
KInstance * | instance () const |
bool | changed () const |
bool | rootMode () const |
KCModule * | realModule () const |
const KCModuleInfo & | moduleInfo () const |
QCString | dcopName () const |
Protected Member Functions | |
void | showEvent (QShowEvent *) |
void | init (const KCModuleInfo &info) |
void | emitQuickHelpChanged () |
Friends | |
class | KCModuleProxyRootCommunicatorImpl |
Detailed Description
Encapsulates a KCModule for embedding.
KCModuleProxy is a wrapper for KCModule intended for cases where modules are to be displayed. It ensures layout is consistent, handles root/administrator modules and in general takes care of the details needed for making a module available in an interface. A KCModuleProxy can be treated as a QWidget, without worrying about the details specific for modules such as library loading. KCModuleProxy is not a sub class of KCModule but its API closely resembles KCModule's.
Usually, an instance is created by passing one of the constructors a KService::Ptr, KCModuleInfo or simply the name of the module and then added to the layout as any other widget.
When the user have changed the module, changed( bool ) as well as changed ( KCModuleProxy * ) is emitted. KCModuleProxy does not take care of prompting for saving - if the object is deleted while changes is not saved the changes will be lost. changed() returns true if changes are unsaved.
KCModuleProxy does not take care of authorization of KCModules.
KCModuleProxy do lazy loading, meaning the library will not be loaded or any other initialization done before its show() function is called. This means modules will only be loaded when they are actually needed as well as it is possible to load many KCModuleProxy without any speed penalty.
KCModuleProxy should be used in all cases where modules are embedded in order to promote code efficiency and usability consistency.
- Author:
- Frans Englich <frans.englich@telia.com>
Matthias Kretz <kretz@kde.org>
Definition at line 67 of file kcmoduleproxy.h.
Constructor & Destructor Documentation
|
Constructs a KCModuleProxy from a KCModuleInfo class.
Definition at line 482 of file kcmoduleproxy.cpp. References init(). |
|
Constructs a KCModuleProxy from a module's service name, which is equivalent to the desktop file for the kcm without the ".desktop" part. Otherwise equal to the one above.
Definition at line 491 of file kcmoduleproxy.cpp. References init(). |
|
Constructs a KCModuleProxy from KService. Otherwise equal to the one above.
Definition at line 473 of file kcmoduleproxy.cpp. References init(). |
|
Default destructor.
Definition at line 428 of file kcmoduleproxy.cpp. References deleteClient(), moduleInfo(), and KCModuleLoader::unloadModule(). |
Member Function Documentation
|
Calling it will cause the contained module to run its load() routine.
Definition at line 515 of file kcmoduleproxy.cpp. References realModule(). Referenced by KCModuleProxyIfaceImpl::load(). |
|
Calling it will cause the contained module to run its save() routine. If the module was not modified, it will not be asked to save. Definition at line 527 of file kcmoduleproxy.cpp. References realModule(). Referenced by KCModuleProxyIfaceImpl::save(). |
|
Definition at line 559 of file kcmoduleproxy.cpp. References kdDebug(), KCModule::quickHelp(), and realModule(). Referenced by KCModuleProxyIfaceImpl::quickHelp(). |
|
Definition at line 588 of file kcmoduleproxy.cpp. References KCModule::aboutData(), and realModule(). |
|
Definition at line 600 of file kcmoduleproxy.cpp. References KCModule::buttons(), and realModule(). |
|
Definition at line 606 of file kcmoduleproxy.cpp. References realModule(), and KCModule::rootOnlyMsg(). |
|
Definition at line 611 of file kcmoduleproxy.cpp. References realModule(), and KCModule::useRootOnlyMsg(). |
|
Returns the embedded KCModule's KInstance.
Definition at line 616 of file kcmoduleproxy.cpp. References KCModule::instance(), and realModule(). |
|
Definition at line 621 of file kcmoduleproxy.cpp. Referenced by KCMultiDialog::addModule(), KCModuleProxyIfaceImpl::changed(), and realModule(). |
|
Returns whether the module is running in root mode. A module is in root mode when runAsRoot() has been called. A session under root user will never reach root mode.
Definition at line 631 of file kcmoduleproxy.cpp. |
|
Access to the actual module. However, if the module is running in root mode, see rootMode(), this function returns a NULL pointer, since the module is in another process. It may also return NULL if anything goes wrong.
Definition at line 140 of file kcmoduleproxy.cpp. References QWhatsThis::add(), changed(), endl(), KCModuleInfo::handle(), KCModuleLoader::Inline, QString::isEmpty(), kdDebug(), KCModuleLoader::loadModule(), moduleInfo(), QString::prepend(), KCModuleLoader::reportError(), QApplication::restoreOverrideCursor(), and QApplication::setOverrideCursor(). Referenced by aboutData(), KCModuleContainer::addModule(), buttons(), defaults(), instance(), load(), quickHelp(), rootOnlyMsg(), save(), showEvent(), and useRootOnlyMsg(). |
|
Definition at line 626 of file kcmoduleproxy.cpp. Referenced by KCModuleContainer::addModule(), realModule(), runAsRoot(), and ~KCModuleProxy(). |
|
Returns the DCOP the module's DCOPClient and DCOPObject has(they are identical).
Definition at line 636 of file kcmoduleproxy.cpp. |
|
Calling this will cause the module to be run in "administrator mode".
Definition at line 298 of file kcmoduleproxy.cpp. References QWidget::colorGroup(), deleteClient(), QString::find(), KStandardDirs::findExe(), QWidget::icon(), QString::isEmpty(), KCModuleProxyRootCommunicatorImpl, QString::left(), QString::length(), KGlobal::locale(), moduleInfo(), KProcess::NotifyOnExit, QString::remove(), QApplication::restoreOverrideCursor(), KCModuleInfo::service(), QLabel::setAlignment(), QPalette::setColor(), QApplication::setOverrideCursor(), and QLabel::setTextFormat(). |
|
Calling it will cause the contained module to load its default values.
Definition at line 551 of file kcmoduleproxy.cpp. References realModule(). Referenced by KPluginSelector::defaults(), and KCModuleProxyIfaceImpl::defaults(). |
|
Calling this, results in deleting the contained module, and unregistering from DCOP. A similar result is achieved by deleting the KCModuleProxy itself.
Definition at line 436 of file kcmoduleproxy.cpp. References kdDebug(). Referenced by runAsRoot(), and ~KCModuleProxy(). |
|
This is emitted in the same situations as in the one above. Practical when several KCModuleProxys are loaded.
|
|
When a module running with root privileges and exits, returns to normal mode, the childClosed() signal is emitted.
|
|
Reimplemented for internal purposes. Makes sure the encapsulated module is loaded before the show event is taken care of. Reimplemented from QWidget. Definition at line 284 of file kcmoduleproxy.cpp. References endl(), kdDebug(), realModule(), and QWidget::showEvent(). |
|
Internal intialization function, called by the constructors.
Definition at line 501 of file kcmoduleproxy.cpp. References kdDebug(). Referenced by KCModuleProxy(). |
|
Emits the quickHelpChanged signal.
Definition at line 641 of file kcmoduleproxy.cpp. Referenced by KCModuleProxyRootCommunicatorImpl::quickHelpChanged(). |
The documentation for this class was generated from the following files: