kio Library API Documentation

kservicetype.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00003                        1999 Waldo Bastian <bastian@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef __kservicetype_h__
00022 #define __kservicetype_h__
00023 
00024 #include "ksycocaentry.h"
00025 #include "kservice.h"
00026 
00027 #include <qstring.h>
00028 #include <qstringlist.h>
00029 #include <qptrlist.h>
00030 #include <qmap.h>
00031 #include <qshared.h>
00032 #include <qdatastream.h>
00033 #include <qvariant.h>
00034 
00035 #include <ksimpleconfig.h>
00036 
00043 class KServiceType : public KSycocaEntry
00044 {
00045   K_SYCOCATYPE( KST_KServiceType, KSycocaEntry )
00046 
00047 public:
00048   typedef KSharedPtr<KServiceType> Ptr;
00049   typedef QValueList<Ptr> List;
00050 public:
00051 
00056   KServiceType( const QString & _fullpath, const QString& _name,
00057                 const QString& _icon, const QString& _comment);
00062   KServiceType( const QString & _fullpath );
00063 
00067   KServiceType( KDesktopFile *config);
00068 
00073   KServiceType( QDataStream& _str, int offset );
00074 
00075   virtual ~KServiceType();
00076 
00084   QString icon() const { return m_strIcon; }
00085 
00089   QString comment() const { return m_strComment; }
00090 
00094   QString name() const { return m_strName; }
00095 
00101   QString desktopEntryPath() const { return entryPath(); }
00102 
00106   bool isDerived() const { return m_bDerived; }
00107 
00112   QString parentServiceType() const;
00113 
00118   bool inherits( const QString& servTypeName ) const;
00119 
00120   virtual QVariant property( const QString& _name ) const;
00121   virtual QStringList propertyNames() const;
00122 
00123   bool isValid() const { return m_bValid; }
00124 
00125   virtual QVariant::Type propertyDef( const QString& _name ) const;
00126   virtual QStringList propertyDefNames() const;
00127   virtual const QMap<QString,QVariant::Type>& propertyDefs() const { return m_mapPropDefs; }
00128 
00132   virtual void save( QDataStream& );
00133 
00137   virtual void load( QDataStream& );
00138 
00144   static Ptr serviceType( const QString& _name );
00145 
00152   static KService::List offers( const QString& _servicetype );
00153 
00161   static List allServiceTypes();
00162 
00163 protected:
00164   void init( KDesktopFile *config );
00165 
00166 protected:
00167   QString m_strName;
00168   QString m_strIcon;
00169   QString m_strComment;
00170   QMap<QString,QVariant> m_mapProps;
00171   QMap<QString,QVariant::Type> m_mapPropDefs;
00172 
00173   bool m_bValid:1;
00174   bool m_bDerived:1;
00175 protected:
00176   virtual void virtual_hook( int id, void* data );
00177 private:
00178   class KServiceTypePrivate* d;
00179 };
00180 
00181 //QDataStream& operator>>( QDataStream& _str, KServiceType& s );
00182 //QDataStream& operator<<( QDataStream& _str, KServiceType& s );
00183 
00184 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:32 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001