20 #ifndef __kservices_h__
21 #define __kservices_h__
23 #include <tqstringlist.h>
25 #include <tqvariant.h>
26 #include <kicontheme.h>
28 #include "tdesycocaentry.h"
48 class TDEIO_EXPORT
KService :
public KSycocaEntry
50 K_SYCOCATYPE( KST_KService, KSycocaEntry )
52 friend class KBuildSycoca;
55 typedef TDESharedPtr<KService> Ptr;
56 typedef TQValueList<Ptr> List;
64 KService(
const TQString & _name,
const TQString &_exec,
const TQString &_icon);
71 explicit KService(
const TQString & _fullpath );
84 KService( TQDataStream& _str,
int offset );
92 virtual TQString
type()
const {
return m_strType; }
98 virtual TQString
name()
const {
return m_strName; }
104 TQString
exec()
const {
return m_strExec; }
111 TQString
library()
const {
return m_strLibrary; }
118 TQString
init()
const {
return m_strInit; }
125 TQString
icon()
const {
return m_strIcon; }
132 TQPixmap pixmap( TDEIcon::Group _group,
int _force_size = 0,
int _state = 0,
133 TQString * _path = 0L )
const;
153 bool substituteUid()
const;
161 TQString username()
const;
190 TQString menuId()
const;
199 TQString storageId()
const;
226 TQString
path()
const {
return m_strPath; }
233 TQString
comment()
const {
return m_strComment; }
251 TQString untranslatedGenericName()
const;
257 TQStringList
keywords()
const {
return m_lstKeywords; }
264 TQStringList categories()
const;
280 bool hasServiceType(
const TQString& _service )
const;
300 bool allowMultipleFiles()
const;
318 int initialPreferenceForMimeType(
const TQString& mimeType )
const;
323 void setInitialPreference(
int i ) { m_initialPreference = i; }
329 bool noDisplay()
const;
333 bool SuSEunimportant()
const;
341 TQString parentApp()
const;
355 virtual TQVariant property(
const TQString& _name )
const;
366 TQVariant property(
const TQString& _name, TQVariant::Type t )
const;
373 virtual TQStringList propertyNames()
const;
387 TQString locateLocal();
393 virtual void load( TQDataStream& );
398 virtual void save( TQDataStream& );
403 void setMenuId(
const TQString &menuId);
408 void setTerminal(
bool b) { m_bTerminal = b; }
413 void setTerminalOptions(
const TQString &options) { m_strTerminalOptions = options; }
424 static Ptr serviceByName(
const TQString& _name );
435 static Ptr serviceByDesktopPath(
const TQString& _path );
451 static Ptr serviceByDesktopName(
const TQString& _name );
462 static Ptr serviceByMenuId(
const TQString& _menuId );
474 static Ptr serviceByStorageId(
const TQString& _storageId );
485 static List allServices();
493 static List allInitServices();
510 static TQString newServicePath(
bool showInMenu,
const TQString &suggestedName,
511 TQString *menuId = 0,
512 const TQStringList *reservedMenuIds = 0);
520 static void rebuildKSycoca(TQWidget *parent);
524 void init(KDesktopFile *config);
526 TQStringList &accessServiceTypes() {
return m_lstServiceTypes; }
537 TQString m_strTerminalOptions;
539 TQString m_strComment;
540 TQString m_strLibrary;
541 TQStringList m_lstServiceTypes;
542 bool m_bAllowAsDefault;
543 int m_initialPreference;
547 TQString m_strDesktopEntryName;
550 DCOPServiceType_t m_DCOPServiceType;
551 TQStringVariantMap m_mapProps;
553 TQStringList m_lstKeywords;
555 TQString m_strGenName;
557 virtual void virtual_hook(
int id,
void* data );
559 class KServicePrivate;
Represent a service, i.e.
TQString path() const
Returns the working directory to run the program in.
TQString comment() const
Returns the descriptive comment for the service, if there is one.
bool terminal() const
Checks whethe the service should be run in a terminal.
TQString library() const
Returns the name of the service's library.
TQString desktopEntryPath() const
Returns the path to the location where the service desktop entry is stored.
DCOPServiceType_t
Describes the DCOP type of the service.
TQStringList keywords() const
Returns a list of descriptive keywords the service, if there are any.
bool isValid() const
Checks whether the service is valid.
TQString init() const
Returns the name of the init function to call (KControl modules).
TQString genericName() const
Returns the generic name for the service, if there is one (e.g.
virtual TQString name() const
Returns the name of the service.
TQString icon() const
Returns the name of the icon.
TQString desktopEntryName() const
Returns the filename of the service desktop entry without any extension.
int initialPreference() const
What preference to associate with this service initially (before the user has had any chance to defin...
virtual TQString type() const
Returns the type of the service.
TQStringList serviceTypes() const
Returns the service types that this service supports.
bool allowAsDefault() const
Set to true if it is allowed to use this service as the default (main) action for the files it suppor...
DCOPServiceType_t DCOPServiceType() const
Returns the DCOPServiceType supported by this service.
TQString exec() const
Returns the executable.
TQString terminalOptions() const
Returns any options associated with the terminal the service runs in, if it requires a terminal.