# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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;
    00034 class QWidget;
    00035
    00048 class KIO_EXPORT KService : public KSycocaEntry
    00049 {
    00050   K_SYCOCATYPE( KST_KService, KSycocaEntry )
    00051
    00052   friend class KBuildSycoca;
    00053
    00054 public:
    00055   typedef KSharedPtr<KService> Ptr;
    00056   typedef QValueList<Ptr> List;
    00057 public:
    00064   KService( const QString & _name, const QString &_exec, const QString &_icon);
    00065
    00071   explicit KService( const QString & _fullpath );
    00072
    00077   KService( KDesktopFile *config ); // KDE-4.0: make explicit
    00078
    00084   KService( QDataStream& _str, int offset );
    00085
    00086   virtual ~KService();
    00087
    00092   virtual QString type() const { return m_strType; }
    00098   virtual QString name() const { return m_strName; }
    00104   QString exec() const { return m_strExec; }
    00111   QString library() const { return m_strLibrary; }
    00118   QString init() const { return m_strInit; }
    00119
    00125   QString icon() const { return m_strIcon; }
    00132   QPixmap pixmap( KIcon::Group _group, int _force_size = 0, int _state = 0,
    00133                   QString * _path = 0L ) const;
    00138   bool terminal() const { return m_bTerminal; }
    00147   QString terminalOptions() const { return m_strTerminalOptions; }
    00153   bool substituteUid() const;
    00161   QString username() const;
    00162
    00174   QString desktopEntryPath() const { return entryPath(); }
    00175
    00182   QString desktopEntryName() const { return m_strDesktopEntryName; }
    00183
    00190   QString menuId() const;
    00191
    00199   QString storageId() const;
    00200
    00213   enum DCOPServiceType_t { DCOP_None = 0, DCOP_Unique, DCOP_Multi, DCOP_Wait };
    00214
    00219   DCOPServiceType_t DCOPServiceType() const { return m_DCOPServiceType; }
    00220
    00226   QString path() const { return m_strPath; }
    00227
    00233   QString comment() const { return m_strComment; }
    00234
    00241   QString genericName() const { return m_strGenName; }
    00242
    00251   QString untranslatedGenericName() const;
    00252
    00257   QStringList keywords() const { return m_lstKeywords; }
    00258
    00264   QStringList categories() const;
    00265
    00270   QStringList serviceTypes() const { return m_lstServiceTypes; }
    00271
    00280   bool hasServiceType( const QString& _service ) const;
    00288   bool allowAsDefault() const { return m_bAllowAsDefault; }
    00289
    00296   bool allowMultipleFiles() const;
    00297
    00304   int initialPreference() const { return m_initialPreference; }
    00305
    00314   int initialPreferenceForMimeType( const QString& mimeType ) const;
    00315
    00319   void setInitialPreference( int i ) { m_initialPreference = i; }
    00320
    00325   bool noDisplay() const;
    00326
    00333   QString parentApp() const;
    00334
    00347   virtual QVariant property( const QString& _name ) const;
    00348
    00358   QVariant property( const QString& _name, QVariant::Type t ) const;
    00359
    00365   virtual QStringList propertyNames() const;
    00366
    00371   bool isValid() const { return m_bValid; }
    00372
    00379   QString locateLocal();
    00380
    00385   virtual void load( QDataStream& );
    00390   virtual void save( QDataStream& );
    00395   void setMenuId(const QString &menuId);
    00400   void setTerminal(bool b) { m_bTerminal = b; }
    00405   void setTerminalOptions(const QString &options) { m_strTerminalOptions = options; }
    00406
    00416   static Ptr serviceByName( const QString& _name );
    00417
    00427   static Ptr serviceByDesktopPath( const QString& _path );
    00428
    00443   static Ptr serviceByDesktopName( const QString& _name );
    00444
    00454   static Ptr serviceByMenuId( const QString& _menuId );
    00455
    00466   static Ptr serviceByStorageId( const QString& _storageId );
    00467
    00477   static List allServices();
    00478
    00485   static List allInitServices();
    00486
    00502   static QString newServicePath(bool showInMenu, const QString &suggestedName,
    00503                                 QString *menuId = 0,
    00504                                 const QStringList *reservedMenuIds = 0);
    00505
    00506
    00512   static void rebuildKSycoca(QWidget *parent);
    00513
    00514 protected:
    00515
    00516   void init(KDesktopFile *config);
    00517
    00518   QStringList &accessServiceTypes() { return m_lstServiceTypes; }
    00519
    00520
    00521 private:
    00522   KService( const KService& ); // forbidden
    00523   KService& operator=(const KService&);
    00524
    00525   QString m_strType;
    00526   QString m_strName;
    00527   QString m_strExec;
    00528   QString m_strIcon;
    00529   QString m_strTerminalOptions;
    00530   QString m_strPath;
    00531   QString m_strComment;
    00532   QString m_strLibrary;
    00533   QStringList m_lstServiceTypes;
    00534   bool m_bAllowAsDefault;
    00535   int m_initialPreference;
    00536   bool m_bTerminal;
    00537   //bool m_bSuid;
    00538   //QString m_strUsername;
    00539   QString m_strDesktopEntryName;
    00540   //QString m_docPath;
    00541   //bool m_bHideFromPanel;
    00542   DCOPServiceType_t m_DCOPServiceType;
    00543   QMap<QString,QVariant> m_mapProps;
    00544   bool m_bValid;
    00545   QStringList m_lstKeywords;
    00546   QString m_strInit;
    00547   QString m_strGenName;
    00548 protected:
    00549   virtual void virtual_hook( int id, void* data );
    00550 private:
    00551   class KServicePrivate;
    00552   KServicePrivate* d;
    00553 };
    00554 #endif

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:03 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003