20 #ifndef __kmimetype_h__
21 #define __kmimetype_h__
23 #include <sys/types.h>
26 #include <tqstringlist.h>
27 #include <tqvaluelist.h>
30 #include <kicontheme.h>
32 #include <tdesycocatype.h>
33 #include <kservicetype.h>
52 typedef TDESharedPtr<KMimeType> Ptr;
53 typedef TQValueList<Ptr> List;
68 KMimeType(
const TQString & _fullpath,
const TQString& _type,
const TQString& _icon,
69 const TQString& _comment,
const TQStringList& _patterns );
88 KMimeType( TQDataStream& _str,
int offset );
100 virtual TQString
icon(
const TQString& ,
bool )
const {
return m_strIcon; }
110 virtual TQString
icon(
const KURL& ,
bool )
const {
return m_strIcon; }
129 virtual TQPixmap pixmap( TDEIcon::Group group,
int force_size = 0,
int state = 0,
130 TQString * path = 0L )
const;
148 virtual TQPixmap pixmap(
const KURL& _url, TDEIcon::Group _group,
int _force_size = 0,
149 int _state = 0, TQString * _path = 0L )
const;
169 static TQPixmap pixmapForURL(
const KURL & _url, mode_t _mode = 0, TDEIcon::Group _group = TDEIcon::Desktop,
170 int _force_size = 0,
int _state = 0, TQString * _path = 0L );
185 static TQString iconForURL(
const KURL & _url, mode_t _mode = 0 );
196 static TQString favIconForURL(
const KURL& url );
202 TQString
comment()
const {
return m_strComment; }
211 virtual TQString
comment(
const TQString&,
bool )
const {
return m_strComment; }
220 virtual TQString
comment(
const KURL&,
bool )
const {
return m_strComment; }
227 const TQStringList&
patterns()
const {
return m_lstPatterns; }
233 virtual void load( TQDataStream &qs );
239 virtual void save( TQDataStream &qs );
247 virtual TQVariant
property(
const TQString& _name )
const;
271 static Ptr mimeType(
const TQString& _name );
301 static Ptr findByURL(
const KURL& _url, mode_t _mode = 0,
302 bool _is_local_file =
false,
bool _fast_mode =
false );
304 static Ptr findByURL(
const KURL& _url, mode_t _mode,
305 bool _is_local_file,
bool _fast_mode,
333 static Ptr findByPath(
const TQString& path, mode_t mode = 0,
bool fast_mode =
false );
345 static Ptr findByContent(
const TQByteArray &data,
int *accuracy=0 );
360 static Ptr findByFileContent(
const TQString &fileName,
int *accuracy=0 );
364 enum { NoCompression=0, GZipCompression } compression : 4;
373 static Format findFormatByFileContent(
const TQString &fileName );
384 static List allMimeTypes();
393 static const TQString & defaultMimeType();
402 static KMimeType::Ptr defaultMimeTypePtr();
420 TQString parentMimeType()
const;
428 bool is(
const TQString& mimeTypeName )
const;
435 static KMimeType::Ptr diagnoseFileName(
const TQString &file, TQString &pattern);
438 void loadInternal( TQDataStream& );
439 void init( KDesktopFile * );
445 static void errorMissingMimeType(
const TQString& _type );
450 static void buildDefaultType();
455 static void checkEssentialMimeTypes();
461 TQStringList m_lstPatterns;
463 static Ptr s_pDefaultType;
466 friend class KServiceTypeFactory;
467 int patternsAccuracy()
const;
470 virtual void virtual_hook(
int id,
void* data );
479 K_SYCOCATYPE( KST_KFolderType,
KMimeType )
493 virtual TQString
icon(
const TQString& _url,
bool _is_local )
const;
494 virtual TQString
icon(
const KURL& _url,
bool _is_local )
const;
495 virtual TQString
comment(
const TQString& _url,
bool _is_local )
const;
496 virtual TQString
comment(
const KURL& _url,
bool _is_local )
const;
498 virtual void virtual_hook(
int id,
void* data );
508 K_SYCOCATYPE( KST_KDEDesktopMimeType,
KMimeType )
511 enum ServiceType { ST_MOUNT, ST_UNMOUNT, ST_USER_DEFINED };
519 Service() { m_display =
true; }
520 bool isEmpty()
const {
return m_strName.isEmpty(); }
538 virtual TQString
icon(
const TQString& _url,
bool _is_local )
const;
539 virtual TQString
icon(
const KURL& _url,
bool _is_local )
const;
540 virtual TQPixmap
pixmap(
const KURL& _url, TDEIcon::Group _group,
int _force_size = 0,
541 int _state = 0, TQString * _path = 0L )
const;
542 virtual TQString
comment(
const TQString& _url,
bool _is_local )
const;
543 virtual TQString
comment(
const KURL& _url,
bool _is_local )
const;
550 static TQValueList<Service> builtinServices(
const KURL& _url );
561 static TQValueList<Service> userDefinedServices(
const TQString& path,
bool bLocalFiles );
568 static TQValueList<Service> userDefinedServices(
const TQString& path, TDEConfig& config,
bool bLocalFiles );
576 static TQValueList<Service> userDefinedServices(
const TQString& path, TDEConfig& config,
bool bLocalFiles,
const KURL::List & file_list);
603 static pid_t run(
const KURL& _url,
bool _is_local );
606 virtual TQPixmap
pixmap( TDEIcon::Group group,
int force_size = 0,
int state = 0,
607 TQString * path = 0L )
const
610 static pid_t runFSDevice(
const KURL& _url,
const KSimpleConfig &cfg );
611 static pid_t runApplication(
const KURL& _url,
const TQString & _serviceFile );
612 static pid_t runLink(
const KURL& _url,
const KSimpleConfig &cfg );
613 static pid_t runMimeType(
const KURL& _url,
const KSimpleConfig &cfg );
615 virtual void virtual_hook(
int id,
void* data );
624 K_SYCOCATYPE( KST_KExecMimeType,
KMimeType )
638 virtual void virtual_hook(
int id,
void* data );
static bool s_bChecked
true if check for vital mime types has been done.
virtual TQPixmap pixmap(TDEIcon::Group group, int force_size=0, int state=0, TQString *path=0L) const
Use this function only if you don't have a special URL for which you search a pixmap.
virtual TQPixmap pixmap(TDEIcon::Group group, int force_size=0, int state=0, TQString *path=0L) const
Use this function only if you don't have a special URL for which you search a pixmap.
Represent a mime type, like "text/plain", and the data that is associated with it.
KExecMimeType(KDesktopFile *config)
Construct a executable mimetype and take all information from a desktop file.
A service type is the generic notion for a mimetype, a type of service instead of a type of file...
TQString icon() const
Returns the icon associated with this service type.
KFolderType(KDesktopFile *config)
Construct a folder mimetype and take all information from a desktop file.
Mime type for desktop files.
TQString comment() const
Returns the descriptive comment associated with the MIME type.
virtual TQStringList propertyNames() const
Returns the list of all properties of this service type.
virtual TQString comment(const TQString &, bool) const
Returns the descriptive comment associated with the MIME type.
virtual TQString comment(const KURL &, bool) const
Returns the descriptive comment associated with the MIME type.
KDEDesktopMimeType(KDesktopFile *config)
Construct a desktop mimetype and take all information from a desktop file.
virtual TQString icon(const TQString &, bool) const
Return the filename of the icon associated with the mimetype.
The mime type for executable files.
Structure representing a service, in the list of services returned by builtinServices and userDefined...
virtual TQVariant property(const TQString &_name) const
Returns the requested property.
virtual TQString icon(const KURL &, bool) const
Return the filename of the icon associated with the mimetype.
const TQStringList & patterns() const
Retrieve the list of patterns associated with the MIME Type.