kio Library API Documentation

kservicegroup.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2000 Waldo Bastian <bastian@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
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 #include <ksortablevaluelist.h>
00030 
00031 #include "ksycocaentry.h"
00032 #include "ksycocatype.h"
00033 #include "kservice.h"
00034 
00035 class KBuildServiceGroupFactory;
00036 
00068 class KIO_EXPORT KServiceGroup : public KSycocaEntry
00069 {
00070   friend class KBuildServiceGroupFactory;
00071   K_SYCOCATYPE( KST_KServiceGroup, KSycocaEntry )
00072 
00073 public:
00074   typedef KSharedPtr<KServiceGroup> Ptr;
00075   typedef KSharedPtr<KSycocaEntry> SPtr;
00076   typedef QValueList<SPtr> List;
00077 public:
00083   KServiceGroup( const QString & name );
00084 
00090   KServiceGroup( const QString & _fullpath, const QString & _relpath );
00091 
00096   KServiceGroup( QDataStream& _str, int offset, bool deep );
00097 
00098   virtual ~KServiceGroup();
00099 
00104   bool isValid() const { return true; }
00105 
00110   virtual QString name() const { return entryPath(); }
00111 
00116   virtual QString relPath() const { return entryPath(); }
00117 
00122   QString caption() const { return m_strCaption; }
00123 
00129   QString icon() const { return m_strIcon; }
00130 
00136   QString comment() const { return m_strComment; }
00137 
00143   int childCount();
00144 
00151   bool noDisplay() const;
00152 
00160   QStringList suppressGenericNames() const;
00161 
00166   void setLayoutInfo(const QStringList &layout);
00167 
00171   bool SuSEshortMenu() const;
00172   bool SuSEgeneralDescription() const;
00173 
00178   QStringList layoutInfo() const;
00179 
00184   virtual void load( QDataStream& );
00189   virtual void save( QDataStream& );
00190 
00201   List entries(bool sorted, bool excludeNoDisplay, bool allowSeparators, bool sortByGenericName=false);  
00202   virtual List entries(bool sorted, bool excludeNoDisplay);
00203 
00210   virtual List entries(bool sorted = false);
00211 
00212   /*
00213    * UNOFFICIAL SuSE special
00214    */
00215   virtual List SuSEentries(bool sort, bool excludeNoDisplay, bool allowSeparators, bool sortByGenericName, bool excludeSuSEunimportant = true);
00216   virtual List SuSEsortEntries( KSortableValueList<SPtr,QCString> slist, KSortableValueList<SPtr,QCString> glist, bool excludeNoDisplay, bool allowSeparators );
00217 
00228   QString baseGroupName() const { return m_strBaseGroupName; }
00229 
00235   QString directoryEntryPath() const;
00236 
00242   static Ptr baseGroup( const QString &baseGroupName );
00243 
00248   static Ptr root();
00249 
00255   static Ptr group(const QString &relPath);
00256 
00264   static Ptr childGroup(const QString &parent);
00265 
00266 protected:
00271   void addEntry( KSycocaEntry *entry);
00272 
00273   QString m_strCaption;
00274   QString m_strIcon;
00275   QString m_strComment;
00276 
00277   List m_serviceList;
00278   bool m_bDeep;
00279   QString m_strBaseGroupName;
00280   int m_childCount;
00281 protected:
00282   virtual void virtual_hook( int id, void* data );
00283 private:
00284   class Private;
00285   Private* d;
00286 };
00287 
00288 class KIO_EXPORT KServiceSeparator : public KSycocaEntry
00289 {
00290   K_SYCOCATYPE( KST_KServiceSeparator, KSycocaEntry )
00291 
00292 public:
00293   typedef KSharedPtr<KServiceSeparator> Ptr;
00294 public:
00299   KServiceSeparator();
00300 
00301   bool isValid() const { return true; }
00302   
00303   // Dummy
00304   virtual QString name() const { return "separator"; }
00305   // Dummy
00306   virtual void load( QDataStream& ) { };
00307   // Dummy
00308   virtual void save( QDataStream& ) { };
00309 };
00310 
00311 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Mar 22 19:50:53 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003