#include <tdecmoduleproxy.h>
Inherits TQWidget.
Public Slots | |
void | runAsRoot () |
void | defaults () |
void | deleteClient () |
Signals | |
void | changed (bool state) |
void | changed (TDECModuleProxy *mod) |
void | childClosed () |
void | quickHelpChanged () |
Public Member Functions | |
TDECModuleProxy (const TDECModuleInfo &info, bool withFallback=true, TQWidget *parent=0, const char *name=0, const TQStringList &args=TQStringList()) | |
TDECModuleProxy (const TQString &serviceName, bool withFallback=true, TQWidget *parent=0, const char *name=0, const TQStringList &args=TQStringList()) | |
TDECModuleProxy (const KService::Ptr &service, bool withFallback=true, TQWidget *parent=0, const char *name=0, const TQStringList &args=TQStringList()) | |
~TDECModuleProxy () | |
void | load () |
void | save () |
TQString | quickHelp () const |
const TDEAboutData * | aboutData () const |
TQString | handbookDocPath () const |
TQString | handbookSection () const |
int | buttons () const |
TQString | rootOnlyMsg () const |
bool | useRootOnlyMsg () const |
TDEInstance * | instance () const |
bool | changed () const |
bool | rootMode () const |
TDECModule * | realModule () const |
const TDECModuleInfo & | moduleInfo () const |
TQCString | dcopName () const |
Protected Member Functions | |
void | showEvent (TQShowEvent *) |
void | init (const TDECModuleInfo &info) |
void | emitQuickHelpChanged () |
Friends | |
class | TDECModuleProxyRootCommunicatorImpl |
Detailed Description
Encapsulates a TDECModule for embedding.
TDECModuleProxy is a wrapper for TDECModule 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 TDECModuleProxy can be treated as a TQWidget, without worrying about the details specific for modules such as library loading. TDECModuleProxy is not a sub class of TDECModule but its API closely resembles TDECModule's.
Usually, an instance is created by passing one of the constructors a KService::Ptr, TDECModuleInfo 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 ( TDECModuleProxy * ) is emitted. TDECModuleProxy 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.
TDECModuleProxy does not take care of authorization of TDECModules.
TDECModuleProxy 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 TDECModuleProxy without any speed penalty.
TDECModuleProxy should be used in all cases where modules are embedded in order to promote code efficiency and usability consistency.
Definition at line 68 of file tdecmoduleproxy.h.
Constructor & Destructor Documentation
◆ TDECModuleProxy() [1/3]
TDECModuleProxy::TDECModuleProxy | ( | const TDECModuleInfo & | info, |
bool | withFallback = true , |
||
TQWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const TQStringList & | args = TQStringList() |
||
) |
Constructs a TDECModuleProxy from a TDECModuleInfo class.
- Parameters
-
info The TDECModuleInfo to construct the module from. withFallback If set to true and loading of the module fails, a alternative will be tried, resulting in the module appearing in its own window, if at all. The embedded module will be load()ed. parent the parent TQWidget. name the module's name. args This is used in the implementation and is internal. Use the default.
Definition at line 483 of file tdecmoduleproxy.cpp.
◆ TDECModuleProxy() [2/3]
TDECModuleProxy::TDECModuleProxy | ( | const TQString & | serviceName, |
bool | withFallback = true , |
||
TQWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const TQStringList & | args = TQStringList() |
||
) |
Constructs a TDECModuleProxy 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.
- Parameters
-
serviceName The module's service name to construct from. withFallback If set to true and loading of the module fails, a alternative will be tried, resulting in the module appearing in its own window, if at all. The embedded module will be load()ed. parent the parent TQWidget. name the module's name. args This is used in the implementation and is internal. Use the default.
Definition at line 492 of file tdecmoduleproxy.cpp.
◆ TDECModuleProxy() [3/3]
TDECModuleProxy::TDECModuleProxy | ( | const KService::Ptr & | service, |
bool | withFallback = true , |
||
TQWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const TQStringList & | args = TQStringList() |
||
) |
Constructs a TDECModuleProxy from KService.
Otherwise equal to the one above.
- Parameters
-
service The KService to construct from. withFallback If set to true and loading of the module fails, a alternative will be tried, resulting in the module appearing in its own window, if at all. The embedded module will be load()ed. parent the parent TQWidget. name the module's name. args This is used in the implementation and is internal. Use the default.
Definition at line 474 of file tdecmoduleproxy.cpp.
◆ ~TDECModuleProxy()
TDECModuleProxy::~TDECModuleProxy | ( | ) |
Default destructor.
Definition at line 429 of file tdecmoduleproxy.cpp.
Member Function Documentation
◆ aboutData()
const TDEAboutData * TDECModuleProxy::aboutData | ( | ) | const |
- Returns
- the module's aboutData()
Definition at line 589 of file tdecmoduleproxy.cpp.
◆ buttons()
int TDECModuleProxy::buttons | ( | ) | const |
- Returns
- what buttons the module needs
Definition at line 625 of file tdecmoduleproxy.cpp.
◆ changed() [1/2]
bool TDECModuleProxy::changed | ( | ) | const |
- Returns
- true if the module is modified and needs to be saved.
Definition at line 646 of file tdecmoduleproxy.cpp.
◆ changed [2/2]
|
signal |
This is emitted in the same situations as in the one above.
Practical when several TDECModuleProxys are loaded.
- Since
- 3.4
◆ childClosed
|
signal |
When a module running with root privileges and exits, returns to normal mode, the childClosed() signal is emitted.
- Since
- 3.4
◆ dcopName()
TQCString TDECModuleProxy::dcopName | ( | ) | const |
Returns the DCOP the module's DCOPClient and DCOPObject has(they are identical).
- Since
- 3.4
Definition at line 661 of file tdecmoduleproxy.cpp.
◆ defaults
|
slot |
Calling it will cause the contained module to load its default values.
Definition at line 552 of file tdecmoduleproxy.cpp.
◆ deleteClient
|
slot |
Calling this, results in deleting the contained module, and unregistering from DCOP.
A similar result is achieved by deleting the TDECModuleProxy itself.
- Since
- 3.4
Definition at line 437 of file tdecmoduleproxy.cpp.
◆ emitQuickHelpChanged()
|
protected |
◆ handbookDocPath()
TQString TDECModuleProxy::handbookDocPath | ( | ) | const |
- Returns
- the module's handbookDocPath()
Definition at line 601 of file tdecmoduleproxy.cpp.
◆ handbookSection()
TQString TDECModuleProxy::handbookSection | ( | ) | const |
- Returns
- the module's handbookSection()
Definition at line 613 of file tdecmoduleproxy.cpp.
◆ init()
|
protected |
Internal intialization function, called by the constructors.
Definition at line 502 of file tdecmoduleproxy.cpp.
◆ instance()
TDEInstance * TDECModuleProxy::instance | ( | ) | const |
Returns the embedded TDECModule's TDEInstance.
- Returns
- The module's TDEInstance.
Definition at line 641 of file tdecmoduleproxy.cpp.
◆ load()
void TDECModuleProxy::load | ( | ) |
Calling it will cause the contained module to run its load() routine.
Definition at line 516 of file tdecmoduleproxy.cpp.
◆ moduleInfo()
const TDECModuleInfo & TDECModuleProxy::moduleInfo | ( | ) | const |
- Returns
- a TDECModuleInfo for the encapsulated module
Definition at line 651 of file tdecmoduleproxy.cpp.
◆ quickHelp()
TQString TDECModuleProxy::quickHelp | ( | ) | const |
- Returns
- the module's quickHelp();
Definition at line 560 of file tdecmoduleproxy.cpp.
◆ realModule()
TDECModule * TDECModuleProxy::realModule | ( | ) | const |
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.
- Returns
- the encapsulated module.
Definition at line 140 of file tdecmoduleproxy.cpp.
◆ rootMode()
bool TDECModuleProxy::rootMode | ( | ) | const |
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.
- Note
- realModule() will return null when the module is running in root mode.
- Returns
- true if the module is running with root privileges
- Since
- 3.4
Definition at line 656 of file tdecmoduleproxy.cpp.
◆ rootOnlyMsg()
TQString TDECModuleProxy::rootOnlyMsg | ( | ) | const |
- Returns
- The module's custom root message, if it has one
Definition at line 631 of file tdecmoduleproxy.cpp.
◆ runAsRoot
|
slot |
Calling this will cause the module to be run in "administrator mode".
- Since
- 3.4
Definition at line 299 of file tdecmoduleproxy.cpp.
◆ save()
void TDECModuleProxy::save | ( | ) |
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 528 of file tdecmoduleproxy.cpp.
◆ showEvent()
|
protected |
Reimplemented for internal purposes.
Makes sure the encapsulated module is loaded before the show event is taken care of.
Definition at line 285 of file tdecmoduleproxy.cpp.
◆ useRootOnlyMsg()
bool TDECModuleProxy::useRootOnlyMsg | ( | ) | const |
- Returns
- If the module is a root module.
Definition at line 636 of file tdecmoduleproxy.cpp.
The documentation for this class was generated from the following files: