24 #include <tqvariant.h>
26 #include <kdesktopfile.h>
28 #include <tdeglobal.h>
29 #include <kstandarddirs.h>
32 #include "tdecmoduleinfo.h"
34 class TDECModuleInfo::TDECModuleInfoPrivate
37 TDECModuleInfoPrivate() :
40 ~TDECModuleInfoPrivate()
51 d =
new TDECModuleInfoPrivate;
56 KService::Ptr
service = KService::serviceByStorageId(desktopFile);
68 d =
new TDECModuleInfoPrivate;
77 _keywords = rhs._keywords;
81 _handle = rhs._handle;
82 _fileName = rhs._fileName;
84 _comment = rhs._comment;
85 _needsRootPrivileges = rhs._needsRootPrivileges;
86 _isHiddenByDefault = rhs._isHiddenByDefault;
87 _allLoaded = rhs._allLoaded;
88 _service = rhs._service;
97 if( d->factoryName.isEmpty() )
99 d->factoryName = _service->property(
"X-TDE-FactoryName", TQVariant::String).toString();
100 if ( d->factoryName.isEmpty() )
104 return d->factoryName;
109 return ( ( _name == rhs._name ) && ( _lib == rhs._lib ) && ( _fileName == rhs._fileName ) );
122 void TDECModuleInfo::init(KService::Ptr s)
125 d =
new TDECModuleInfoPrivate;
131 kdDebug(712) <<
"Could not find the service." <<
endl;
140 _fileName = ( _service->desktopEntryPath() );
158 setHandle(_service->property(
"X-TDE-FactoryName", TQVariant::String).toString());
163 tmp = _service->property(
"X-TDE-Weight", TQVariant::Int );
164 setWeight( tmp.isValid() ? tmp.toInt() : 100 );
167 tmp = _service->property(
"X-TDE-RootOnly", TQVariant::Bool );
172 tmp = _service->property(
"X-TDE-IsHiddenByDefault", TQVariant::Bool );
176 setDocPath( _service->property(
"X-DocPath", TQVariant::String ).toString() );
178 tmp = _service->property(
"X-TDE-Test-Module", TQVariant::Bool );
197 if (_handle.isEmpty())
218 return _needsRootPrivileges;
227 return _isHiddenByDefault;
235 return d->testModule;
A class that provides information about a TDECModule.
void setComment(const TQString &comment)
Sets the object's name.
void setIsHiddenByDefault(bool isHiddenByDefault)
void setIcon(const TQString &icon)
Sets the object's icon.
void setLibrary(const TQString &lib)
Set the object's library.
bool operator==(const TDECModuleInfo &rhs) const
Equal operator.
void setKeywords(const TQStringList &keyword)
Sets the object's keywords.
void setWeight(int weight)
Sets the object's weight property which determines in what order modules will be displayed.
bool operator!=(const TDECModuleInfo &rhs) const
void setNeedsTest(bool val)
Sets if the module should be tested for loading.
TDECModuleInfo()
Same as above but creates an empty TDECModuleInfo.
void setHandle(const TQString &handle)
Sets the factory name.
bool needsRootPrivileges() const
TDECModuleInfo & operator=(const TDECModuleInfo &rhs)
Assignment operator.
~TDECModuleInfo()
Default destructor.
void setName(const TQString &name)
Sets the object's name.
KService::Ptr service() const
TQString factoryName() const
Returns the module's factory name, if it's set.
void loadAll()
Reads the service entries specific for TDECModule from the desktop file.
void setDocPath(const TQString &p)
Sets the object's documentation path.
bool isHiddenByDefault() const TDE_DEPRECATED
void setNeedsRootPrivileges(bool needsRootPrivileges)
Toggles whether the represented module needs root privileges.
kndbgstream & endl(kndbgstream &s)
kdbgstream kdDebug(int area=0)