KUtils
kcmoduleinfo.h
Go to the documentation of this file.00001 /* 00002 Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> 00003 Copyright (c) 2000 Matthias Elter <elter@kde.org> 00004 Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org> 00005 Copyright (c) 2003 Matthias Kretz <kretz@kde.org> 00006 00007 This file is part of the KDE project 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Library General Public 00011 License version 2, as published by the Free Software Foundation. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00023 00024 #ifndef KCMODULEINFO_H 00025 #define KCMODULEINFO_H 00026 00027 #include <kservice.h> 00028 00029 class QPixmap; 00030 class QString; 00031 class QStringList; 00032 00049 class KUTILS_EXPORT KCModuleInfo 00050 { 00051 00052 public: 00053 00061 KCModuleInfo(const QString& desktopFile); 00062 00070 KCModuleInfo( KService::Ptr moduleInfo ); 00071 00072 00078 KCModuleInfo( const KCModuleInfo &rhs ); 00079 00085 KCModuleInfo(); 00086 00090 KCModuleInfo &operator=( const KCModuleInfo &rhs ); 00091 00098 bool operator==( const KCModuleInfo &rhs ) const; 00099 00103 bool operator!=( const KCModuleInfo &rhs ) const; 00104 00108 ~KCModuleInfo(); 00109 00113 QString fileName() const { return _fileName; } 00114 00118 const QStringList &keywords() const { return _keywords; } 00119 00126 QString factoryName() const; 00127 00131 QString moduleName() const { return _name; } 00132 // changed from name() to avoid ambiguity with QObject::name() on multiple inheritance 00133 00137 KService::Ptr service() const { return _service; } 00138 00142 QString comment() const { return _comment; } 00143 00147 QString icon() const { return _icon; } 00148 00152 QString docPath() const; 00153 00157 QString library() const { return _lib; } 00158 00162 QString handle() const; 00163 00168 int weight() const; 00169 00173 bool needsRootPrivileges() const; 00174 00179 bool isHiddenByDefault() const KDE_DEPRECATED; 00180 00181 00187 bool needsTest() const; 00188 00189 00190 protected: 00191 00196 void setKeywords(const QStringList &keyword) { _keywords = keyword; } 00197 00202 void setName(const QString &name) { _name = name; } 00203 00208 void setComment(const QString &comment) { _comment = comment; } 00209 00214 void setIcon(const QString &icon) { _icon = icon; } 00215 00220 void setLibrary(const QString &lib) { _lib = lib; } 00221 00226 void setHandle(const QString &handle) { _handle = handle; } 00227 00234 void setWeight(int weight) { _weight = weight; } 00235 00236 00242 void setNeedsTest( bool val ); 00243 00249 void setNeedsRootPrivileges(bool needsRootPrivileges) 00250 { _needsRootPrivileges = needsRootPrivileges; } 00251 00255 void setIsHiddenByDefault(bool isHiddenByDefault) 00256 { _isHiddenByDefault = isHiddenByDefault; } 00257 00262 void setDocPath(const QString &p) { _doc = p; } 00263 00268 void loadAll(); 00269 00270 private: 00271 00275 void init(KService::Ptr s); 00276 00277 private: 00278 00279 // KDE4 These needs to be moved to KCModuleInfoPrivate 00280 QStringList _keywords; 00281 QString _name, _icon, _lib, _handle, _fileName, _doc, _comment; 00282 bool _needsRootPrivileges : 1; 00283 bool _isHiddenByDefault : 1; 00284 bool _allLoaded : 1; 00285 int _weight; 00286 00287 KService::Ptr _service; 00288 00289 class KCModuleInfoPrivate; 00290 KCModuleInfoPrivate *d; 00291 00292 }; 00293 00294 #endif // KCMODULEINFO_H 00295 00296 // vim: ts=2 sw=2 et