kio Library API Documentation

kservice.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Torben Weis <weis@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 as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef __kservices_h__
00021 #define __kservices_h__
00022 
00023 #include <qstringlist.h>
00024 #include <qmap.h>
00025 #include <qvariant.h>
00026 #include <kicontheme.h>
00027 
00028 #include "ksycocaentry.h"
00029 
00030 class QDataStream;
00031 class KDesktopFile;
00032 class KService;
00033 class KBuildSycoca;
00043 class KService : public KSycocaEntry
00044 {
00045   K_SYCOCATYPE( KST_KService, KSycocaEntry )
00046 
00047   KService(const KService&);
00048   KService& operator=(const KService&);
00049 
00050   friend class KBuildSycoca;
00051 
00052 public:
00053   typedef KSharedPtr<KService> Ptr;
00054   typedef QValueList<Ptr> List;
00055 public:
00059   KService( const QString & _name, const QString &_exec, const QString &_icon);
00060 
00066   KService( const QString & _fullpath );
00067 
00071   KService( KDesktopFile *config );
00072 
00078   KService( QDataStream& _str, int offset );
00079 
00080   virtual ~KService();
00081 
00085   virtual QString type() const { return m_strType; }
00089   virtual QString name() const { return m_strName; }
00093   QString exec() const { return m_strExec; }
00098   QString library() const { return m_strLibrary; }
00103   QString init() const { return m_strInit; }
00104 
00108   QString icon() const { return m_strIcon; }
00112   QPixmap pixmap( KIcon::Group _group, int _force_size = 0, int _state = 0,
00113                   QString * _path = 0L ) const;
00117   bool terminal() const { return m_bTerminal; }
00124   QString terminalOptions() const { return m_strTerminalOptions; }
00128   bool substituteUid() const;
00132   QString username() const;
00133 
00143   QString desktopEntryPath() const { return entryPath(); }
00144 
00149   QString desktopEntryName() const { return m_strDesktopEntryName; }
00150 
00162   enum DCOPServiceType_t { DCOP_None = 0, DCOP_Unique, DCOP_Multi, DCOP_Wait };
00163 
00167   DCOPServiceType_t DCOPServiceType() const { return m_DCOPServiceType; }
00168 
00172   QString path() const { return m_strPath; }
00173 
00177   QString comment() const { return m_strComment; }
00178 
00183   QString genericName() const { return m_strGenName; }
00184 
00188   QStringList keywords() const { return m_lstKeywords; }
00189 
00194   QStringList categories() const;
00195 
00199   QStringList serviceTypes() const { return m_lstServiceTypes; }
00200 
00208   bool hasServiceType( const QString& _service ) const;
00215   bool allowAsDefault() const { return m_bAllowAsDefault; }
00216 
00221   bool allowMultipleFiles() const;
00222 
00228   int initialPreference() const { return m_initialPreference; }
00229 
00233   void setInitialPreference( int i ) { m_initialPreference = i; }
00234 
00238   bool noDisplay() const;
00239 
00245   QString parentApp() const;
00246 
00257   virtual QVariant property( const QString& _name ) const;
00262   virtual QStringList propertyNames() const;
00263 
00267   bool isValid() const { return m_bValid; }
00268 
00273   virtual void load( QDataStream& );
00278   virtual void save( QDataStream& );
00279 
00288   static Ptr serviceByName( const QString& _name );
00289 
00300   static Ptr serviceByDesktopPath( const QString& _name );
00301 
00315   static Ptr serviceByDesktopName( const QString& _name );
00316 
00325   static List allServices();
00326 
00332   static List allInitServices();
00333 
00334 protected:
00335 
00336   void init(KDesktopFile *config);
00337 
00338   QStringList &accessServiceTypes() { return m_lstServiceTypes; }
00339 
00340 private:
00341   QString m_strType;
00342   QString m_strName;
00343   QString m_strExec;
00344   QString m_strIcon;
00345   QString m_strTerminalOptions;
00346   QString m_strPath;
00347   QString m_strComment;
00348   QString m_strLibrary;
00349   QStringList m_lstServiceTypes;
00350   bool m_bAllowAsDefault;
00351   int m_initialPreference;
00352   bool m_bTerminal;
00353   //bool m_bSuid;
00354   //QString m_strUsername;
00355   QString m_strDesktopEntryName;
00356   //QString m_docPath;
00357   //bool m_bHideFromPanel;
00358   DCOPServiceType_t m_DCOPServiceType;
00359   QMap<QString,QVariant> m_mapProps;
00360   bool m_bValid;
00361   QStringList m_lstKeywords;
00362   QString m_strInit;
00363   QString m_strGenName;
00364 protected:
00365   virtual void virtual_hook( int id, void* data );
00366 private:
00367   class KServicePrivate;
00368   KServicePrivate* d;
00369 };
00370 #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