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