kio
kservicegroup.h
Go to the documentation of this file.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 KIO_EXPORT 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
00157 bool showEmptyMenu() const;
00158 void setShowEmptyMenu( bool b);
00159
00164 bool showInlineHeader() const;
00165 void setShowInlineHeader(bool _b);
00166
00171 bool inlineAlias() const;
00172 void setInlineAlias(bool _b);
00177 bool allowInline() const;
00178 void setAllowInline(bool _b);
00179
00184 int inlineValue() const;
00185 void setInlineValue(int _val);
00186
00187
00195 QStringList suppressGenericNames() const;
00196
00201 void setLayoutInfo(const QStringList &layout);
00202
00207 QStringList layoutInfo() const;
00208
00213 virtual void load( QDataStream& );
00218 virtual void save( QDataStream& );
00219
00230 List entries(bool sorted, bool excludeNoDisplay, bool allowSeparators, bool sortByGenericName=false);
00231 virtual List entries(bool sorted, bool excludeNoDisplay);
00232
00239 virtual List entries(bool sorted = false);
00240
00251 QString baseGroupName() const { return m_strBaseGroupName; }
00252
00258 QString directoryEntryPath() const;
00259
00265 static Ptr baseGroup( const QString &baseGroupName );
00266
00271 static Ptr root();
00272
00278 static Ptr group(const QString &relPath);
00279
00287 static Ptr childGroup(const QString &parent);
00288
00293 void parseAttribute( const QString &item , bool &showEmptyMenu, bool &showInline, bool &showInlineHeader, bool & showInlineAlias ,int &inlineValue );
00294
00295 protected:
00300 void addEntry( KSycocaEntry *entry);
00301
00302 QString m_strCaption;
00303 QString m_strIcon;
00304 QString m_strComment;
00305
00306 List m_serviceList;
00307 bool m_bDeep;
00308 QString m_strBaseGroupName;
00309 int m_childCount;
00310 protected:
00311 virtual void virtual_hook( int id, void* data );
00312 private:
00313 class Private;
00314 Private* d;
00315 };
00316
00317 class KIO_EXPORT KServiceSeparator : public KSycocaEntry
00318 {
00319 K_SYCOCATYPE( KST_KServiceSeparator, KSycocaEntry )
00320
00321 public:
00322 typedef KSharedPtr<KServiceSeparator> Ptr;
00323 public:
00328 KServiceSeparator();
00329
00330 bool isValid() const { return true; }
00331
00332
00333 virtual QString name() const { return "separator"; }
00334
00335 virtual void load( QDataStream& ) { };
00336
00337 virtual void save( QDataStream& ) { };
00338 };
00339
00340 #endif