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   friend class KBuildSycoca;
00048 
00049 public:
00050   typedef KSharedPtr<KService> Ptr;
00051   typedef QValueList<Ptr> List;
00052 public:
00056   KService( const QString & _name, const QString &_exec, const QString &_icon);
00057 
00063   KService( const QString & _fullpath );
00064 
00068   KService( KDesktopFile *config );
00069 
00075   KService( QDataStream& _str, int offset );
00076 
00077   virtual ~KService();
00078 
00082   virtual QString type() const { return m_strType; }
00086   virtual QString name() const { return m_strName; }
00090   QString exec() const { return m_strExec; }
00095   QString library() const { return m_strLibrary; }
00100   QString init() const { return m_strInit; }
00101 
00105   QString icon() const { return m_strIcon; }
00109   QPixmap pixmap( KIcon::Group _group, int _force_size = 0, int _state = 0,
00110                   QString * _path = 0L ) const;
00114   bool terminal() const { return m_bTerminal; }
00121   QString terminalOptions() const { return m_strTerminalOptions; }
00125   bool substituteUid() const;
00129   QString username() const;
00130 
00140   QString desktopEntryPath() const { return entryPath(); }
00141 
00146   QString desktopEntryName() const { return m_strDesktopEntryName; }
00147 
00159   enum DCOPServiceType_t { DCOP_None = 0, DCOP_Unique, DCOP_Multi, DCOP_Wait };
00160 
00164   DCOPServiceType_t DCOPServiceType() const { return m_DCOPServiceType; }
00165 
00169   QString path() const { return m_strPath; }
00170 
00174   QString comment() const { return m_strComment; }
00175 
00180   QString genericName() const { return m_strGenName; }
00181 
00185   QStringList keywords() const { return m_lstKeywords; }
00186 
00191   QStringList categories() const;
00192 
00196   QStringList serviceTypes() const { return m_lstServiceTypes; }
00197 
00205   bool hasServiceType( const QString& _service ) const;
00212   bool allowAsDefault() const { return m_bAllowAsDefault; }
00213 
00218   bool allowMultipleFiles() const;
00219 
00225   int initialPreference() const { return m_initialPreference; }
00226 
00230   void setInitialPreference( int i ) { m_initialPreference = i; }
00231 
00235   bool noDisplay() const;
00236 
00242   QString parentApp() const;
00243 
00254   virtual QVariant property( const QString& _name ) const;
00259   virtual QStringList propertyNames() const;
00260 
00264   bool isValid() const { return m_bValid; }
00265 
00270   virtual void load( QDataStream& );
00275   virtual void save( QDataStream& );
00276 
00285   static Ptr serviceByName( const QString& _name );
00286 
00297   static Ptr serviceByDesktopPath( const QString& _name );
00298 
00312   static Ptr serviceByDesktopName( const QString& _name );
00313 
00322   static List allServices();
00323 
00329   static List allInitServices();
00330 
00331 protected:
00332 
00333   void init(KDesktopFile *config);
00334 
00335   QStringList &accessServiceTypes() { return m_lstServiceTypes; }
00336 
00337 private:
00338   QString m_strType;
00339   QString m_strName;
00340   QString m_strExec;
00341   QString m_strIcon;
00342   QString m_strTerminalOptions;
00343   QString m_strPath;
00344   QString m_strComment;
00345   QString m_strLibrary;
00346   QStringList m_lstServiceTypes;
00347   bool m_bAllowAsDefault;
00348   int m_initialPreference;
00349   bool m_bTerminal;
00350   //bool m_bSuid;
00351   //QString m_strUsername;
00352   QString m_strDesktopEntryName;
00353   //QString m_docPath;
00354   //bool m_bHideFromPanel;
00355   DCOPServiceType_t m_DCOPServiceType;
00356   QMap<QString,QVariant> m_mapProps;
00357   bool m_bValid;
00358   QStringList m_lstKeywords;
00359   QString m_strInit;
00360   QString m_strGenName;
00361 protected:
00362   virtual void virtual_hook( int id, void* data );
00363 private:
00364   class KServicePrivate;
00365   KServicePrivate* d;
00366 };
00367 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:31 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001