20 #ifndef __kservices_h__
21 #define __kservices_h__
23 #include <tqstringlist.h>
25 #include <tqvariant.h>
26 #include <kicontheme.h>
28 #include "ksycocaentry.h"
48 class KIO_EXPORT
KService :
public KSycocaEntry
50 K_SYCOCATYPE( KST_KService, KSycocaEntry )
52 friend class KBuildSycoca;
55 typedef KSharedPtr<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( KIcon::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 TQMap<TQString,TQVariant> m_mapProps;
553 TQStringList m_lstKeywords;
555 TQString m_strGenName;
557 virtual void virtual_hook(
int id,
void* data );
559 class KServicePrivate;