00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
#ifndef __kservicegroup_h__
00020
#define __kservicegroup_h__
00021
00022
#include <qptrlist.h>
00023
#include <qstring.h>
00024
#include <qshared.h>
00025
#include <qdatastream.h>
00026
#include <qvariant.h>
00027
00028
#include <kdesktopfile.h>
00029
00030
#include "ksycocaentry.h"
00031
#include "ksycocatype.h"
00032
#include "kservice.h"
00033
00034
class KBuildServiceGroupFactory;
00035
00067 class KServiceGroup :
public KSycocaEntry
00068 {
00069
friend class KBuildServiceGroupFactory;
00070 K_SYCOCATYPE( KST_KServiceGroup,
KSycocaEntry )
00071
00072
public:
00073
typedef KSharedPtr<KServiceGroup> Ptr;
00074
typedef KSharedPtr<KSycocaEntry> SPtr;
00075
typedef QValueList<SPtr> List;
00076
public:
00082
KServiceGroup(
const QString &
name );
00083
00089
KServiceGroup(
const QString & _fullpath,
const QString & _relpath );
00090
00095
KServiceGroup(
QDataStream& _str,
int offset,
bool deep );
00096
00097
virtual ~
KServiceGroup();
00098
00103 bool isValid()
const {
return true; }
00104
00109 virtual QString name()
const {
return entryPath(); }
00110
00115 virtual QString relPath()
const {
return entryPath(); }
00116
00121 QString caption()
const {
return m_strCaption; }
00122
00128 QString icon()
const {
return m_strIcon; }
00129
00135 QString comment()
const {
return m_strComment; }
00136
00142
int childCount();
00143
00150
bool noDisplay() const;
00151
00159
QStringList suppressGenericNames() const;
00160
00165
void setLayoutInfo(const
QStringList &layout);
00166
00171
QStringList layoutInfo() const;
00172
00177 virtual
void load(
QDataStream& );
00182 virtual
void save( QDataStream& );
00183
00194 List entries(
bool sorted,
bool excludeNoDisplay,
bool allowSeparators,
bool sortByGenericName=false);
00195 virtual List entries(
bool sorted,
bool excludeNoDisplay);
00196
00203 virtual List entries(
bool sorted = false);
00204
00215 QString baseGroupName()
const {
return m_strBaseGroupName; }
00216
00222
QString directoryEntryPath() const;
00223
00229 static Ptr baseGroup( const
QString &baseGroupName );
00230
00235 static Ptr root();
00236
00242 static Ptr group(const
QString &relPath);
00243
00251 static Ptr childGroup(const
QString &parent);
00252
00253 protected:
00258
void addEntry(
KSycocaEntry *entry);
00259
00260
QString m_strCaption;
00261
QString m_strIcon;
00262
QString m_strComment;
00263
00264 List m_serviceList;
00265
bool m_bDeep;
00266
QString m_strBaseGroupName;
00267
int m_childCount;
00268 protected:
00269 virtual
void virtual_hook(
int id,
void* data );
00270 private:
00271 class Private;
00272 Private* d;
00273 };
00274
00275 class KServiceSeparator : public
KSycocaEntry
00276 {
00277 K_SYCOCATYPE( KST_KServiceSeparator, KSycocaEntry )
00278
00279 public:
00280 typedef
KSharedPtr<KServiceSeparator> Ptr;
00281 public:
00286 KServiceSeparator();
00287
00288
bool isValid()
const {
return true; }
00289
00290
00291
virtual QString name()
const {
return "separator"; }
00292
00293
virtual void load(
QDataStream& ) { };
00294
00295
virtual void save(
QDataStream& ) { };
00296 };
00297
00298
#endif