kservice.h
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kservices_h__
#define __kservices_h__
#include <qstringlist.h>
#include <qmap.h>
#include <qvariant.h>
#include <kicontheme.h>
#include "ksycocaentry.h"
class QDataStream;
class KDesktopFile;
class KService;
class KBuildSycoca;
class QWidget;
class KIO_EXPORT KService : public KSycocaEntry
{
K_SYCOCATYPE( KST_KService, KSycocaEntry )
friend class KBuildSycoca;
public:
typedef KSharedPtr<KService> Ptr;
typedef QValueList<Ptr> List;
public:
KService( const QString & _name, const QString &_exec, const QString &_icon);
explicit KService( const QString & _fullpath );
KService( KDesktopFile *config ); // KDE-4.0: make explicit
KService( QDataStream& _str, int offset );
virtual ~KService();
virtual QString type() const { return m_strType; }
virtual QString name() const { return m_strName; }
QString exec() const { return m_strExec; }
QString library() const { return m_strLibrary; }
QString init() const { return m_strInit; }
QString icon() const { return m_strIcon; }
QPixmap pixmap( KIcon::Group _group, int _force_size = 0, int _state = 0,
QString * _path = 0L ) const;
bool terminal() const { return m_bTerminal; }
QString terminalOptions() const { return m_strTerminalOptions; }
bool substituteUid() const;
QString username() const;
QString desktopEntryPath() const { return entryPath(); }
QString desktopEntryName() const { return m_strDesktopEntryName; }
QString menuId() const;
QString storageId() const;
enum DCOPServiceType_t { DCOP_None = 0, DCOP_Unique, DCOP_Multi, DCOP_Wait };
DCOPServiceType_t DCOPServiceType() const { return m_DCOPServiceType; }
QString path() const { return m_strPath; }
QString comment() const { return m_strComment; }
QString genericName() const { return m_strGenName; }
QString untranslatedGenericName() const;
QStringList keywords() const { return m_lstKeywords; }
QStringList categories() const;
QStringList serviceTypes() const { return m_lstServiceTypes; }
bool hasServiceType( const QString& _service ) const;
bool allowAsDefault() const { return m_bAllowAsDefault; }
bool allowMultipleFiles() const;
int initialPreference() const { return m_initialPreference; }
int initialPreferenceForMimeType( const QString& mimeType ) const;
void setInitialPreference( int i ) { m_initialPreference = i; }
bool noDisplay() const;
QString parentApp() const;
virtual QVariant property( const QString& _name ) const;
QVariant property( const QString& _name, QVariant::Type t ) const;
virtual QStringList propertyNames() const;
bool isValid() const { return m_bValid; }
QString locateLocal();
virtual void load( QDataStream& );
virtual void save( QDataStream& );
void setMenuId(const QString &menuId);
void setTerminal(bool b) { m_bTerminal = b; }
void setTerminalOptions(const QString &options) { m_strTerminalOptions = options; }
static Ptr serviceByName( const QString& _name );
static Ptr serviceByDesktopPath( const QString& _path );
static Ptr serviceByDesktopName( const QString& _name );
static Ptr serviceByMenuId( const QString& _menuId );
static Ptr serviceByStorageId( const QString& _storageId );
static List allServices();
static List allInitServices();
static QString newServicePath(bool showInMenu, const QString &suggestedName,
QString *menuId = 0,
const QStringList *reservedMenuIds = 0);
static void rebuildKSycoca(QWidget *parent);
protected:
void init(KDesktopFile *config);
QStringList &accessServiceTypes() { return m_lstServiceTypes; }
private:
KService( const KService& ); // forbidden
KService& operator=(const KService&);
QString m_strType;
QString m_strName;
QString m_strExec;
QString m_strIcon;
QString m_strTerminalOptions;
QString m_strPath;
QString m_strComment;
QString m_strLibrary;
QStringList m_lstServiceTypes;
bool m_bAllowAsDefault;
int m_initialPreference;
bool m_bTerminal;
//bool m_bSuid;
//QString m_strUsername;
QString m_strDesktopEntryName;
//QString m_docPath;
//bool m_bHideFromPanel;
DCOPServiceType_t m_DCOPServiceType;
QMap<QString,QVariant> m_mapProps;
bool m_bValid;
QStringList m_lstKeywords;
QString m_strInit;
QString m_strGenName;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KServicePrivate;
KServicePrivate* d;
};
#endif
KService::init
QString init() const
Returns the name of the init function to call (KControl modules).
Definition: kservice.h:118
KService
Represent a service, i.e.
Definition: kservice.h:48
KService::genericName
QString genericName() const
Returns the generic name for the service, if there is one (e.g.
Definition: kservice.h:241
KService::terminalOptions
QString terminalOptions() const
Returns any options associated with the terminal the service runs in, if it requires a terminal...
Definition: kservice.h:147
KService::comment
QString comment() const
Returns the descriptive comment for the service, if there is one.
Definition: kservice.h:233
KService::exec
QString exec() const
Returns the executable.
Definition: kservice.h:104
KService::path
QString path() const
Returns the working directory to run the program in.
Definition: kservice.h:226
KService::allowAsDefault
bool allowAsDefault() const
Set to true if it is allowed to use this service as the default (main) action for the files it suppor...
Definition: kservice.h:292
KService::isValid
bool isValid() const
Checks whether the service is valid.
Definition: kservice.h:375
KService::DCOPServiceType_t
DCOPServiceType_t
Describes the DCOP type of the service.
Definition: kservice.h:213
KService::initialPreference
int initialPreference() const
What preference to associate with this service initially (before the user has had any chance to defin...
Definition: kservice.h:308
KService::desktopEntryPath
QString desktopEntryPath() const
Returns the path to the location where the service desktop entry is stored.
Definition: kservice.h:174
KService::icon
QString icon() const
Returns the name of the icon.
Definition: kservice.h:125
KService::terminal
bool terminal() const
Checks whethe the service should be run in a terminal.
Definition: kservice.h:138
KService::library
QString library() const
Returns the name of the service's library.
Definition: kservice.h:111
KService::serviceTypes
QStringList serviceTypes() const
Returns the service types that this service supports.
Definition: kservice.h:270
KService::desktopEntryName
QString desktopEntryName() const
Returns the filename of the service desktop entry without any extension.
Definition: kservice.h:182
KService::DCOPServiceType
DCOPServiceType_t DCOPServiceType() const
Returns the DCOPServiceType supported by this service.
Definition: kservice.h:219
KService::name
virtual QString name() const
Returns the name of the service.
Definition: kservice.h:98
KService::keywords
QStringList keywords() const
Returns a list of descriptive keywords the service, if there are any.
Definition: kservice.h:257
KService::type
virtual QString type() const
Returns the type of the service.
Definition: kservice.h:92

KDE Home | KDE Accessibility Home | Description of Access Keys