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;
232 return d->testModule;
bool isHiddenByDefault() const KDE_DEPRECATED
TDECModuleInfo()
Same as above but creates an empty TDECModuleInfo.
void setComment(const TQString &comment)
Sets the object's name.
bool needsRootPrivileges() const
kndbgstream & endl(kndbgstream &s)
void setName(const TQString &name)
Sets the object's name.
kdbgstream kdDebug(int area=0)
void setLibrary(const TQString &lib)
Set the object's library.
void setIcon(const TQString &icon)
Sets the object's icon.
KService::Ptr service() const
TDECModuleInfo & operator=(const TDECModuleInfo &rhs)
Assignment operator.
~TDECModuleInfo()
Default destructor.
TQString factoryName() const
Returns the module's factory name, if it's set.
void setNeedsTest(bool val)
Sets if the module should be tested for loading.
void setKeywords(const TQStringList &keyword)
Sets the object's keywords.
void setNeedsRootPrivileges(bool needsRootPrivileges)
Toggles whether the represented module needs root privileges.
bool operator==(const TDECModuleInfo &rhs) const
Equal operator.
void loadAll()
Reads the service entries specific for TDECModule from the desktop file.
void setIsHiddenByDefault(bool isHiddenByDefault)
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 setDocPath(const TQString &p)
Sets the object's documentation path.
void setHandle(const TQString &handle)
Sets the factory name.