• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

  • tdeio
  • tdeio
kmimetype.h
1/* This file is part of the KDE libraries
2 * Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
3 * David Faure <faure@kde.org>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License version 2 as published by the Free Software Foundation;
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 **/
19
20#ifndef __kmimetype_h__
21#define __kmimetype_h__
22
23#include <sys/types.h>
24#include <sys/stat.h>
25
26#include <tqstringlist.h>
27#include <tqvaluelist.h>
28#include <tqpixmap.h>
29
30#include <kicontheme.h>
31#include <kurl.h>
32#include <tdesycocatype.h>
33#include <kservicetype.h>
34
35class KSimpleConfig;
47class TDEIO_EXPORT KMimeType : public KServiceType
48{
49 K_SYCOCATYPE( KST_KMimeType, KServiceType )
50
51public:
52 typedef TDESharedPtr<KMimeType> Ptr;
53 typedef TQValueList<Ptr> List;
54public:
68 KMimeType( const TQString & _fullpath, const TQString& _type, const TQString& _icon,
69 const TQString& _comment, const TQStringList& _patterns );
70
75 KMimeType( const TQString & _fullpath );
76
81 KMimeType( KDesktopFile *config );
82
88 KMimeType( TQDataStream& _str, int offset );
89
90 virtual ~KMimeType();
91
100 virtual TQString icon( const TQString& , bool ) const { return m_strIcon; }
101
110 virtual TQString icon( const KURL& , bool ) const { return m_strIcon; }
111
129 virtual TQPixmap pixmap( TDEIcon::Group group, int force_size = 0, int state = 0,
130 TQString * path = 0L ) const;
131
148 virtual TQPixmap pixmap( const KURL& _url, TDEIcon::Group _group, int _force_size = 0,
149 int _state = 0, TQString * _path = 0L ) const;
150
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 );
171
172
185 static TQString iconForURL( const KURL & _url, mode_t _mode = 0 );
186
196 static TQString favIconForURL( const KURL& url );
197
202 TQString comment() const { return m_strComment; }
203
211 virtual TQString comment( const TQString&, bool ) const { return m_strComment; }
212
220 virtual TQString comment( const KURL&, bool ) const { return m_strComment; }
221
227 const TQStringList& patterns() const { return m_lstPatterns; }
228
233 virtual void load( TQDataStream &qs );
234
239 virtual void save( TQDataStream &qs );
240
247 virtual TQVariant property( const TQString& _name ) const;
248
255 virtual TQStringList propertyNames() const;
256
271 static Ptr mimeType( const TQString& _name );
272
301 static Ptr findByURL( const KURL& _url, mode_t _mode = 0,
302 bool _is_local_file = false, bool _fast_mode = false );
303
304 static Ptr findByURL( const KURL& _url, mode_t _mode,
305 bool _is_local_file, bool _fast_mode,
306 bool *accurate);
333 static Ptr findByPath( const TQString& path, mode_t mode = 0, bool fast_mode = false );
334
345 static Ptr findByContent( const TQByteArray &data, int *accuracy=0 );
346
360 static Ptr findByFileContent( const TQString &fileName, int *accuracy=0 );
361
362 struct Format{
363 bool text : 1;
364 enum { NoCompression=0, GZipCompression } compression : 4;
365 unsigned dummy : 27;
366 };
367
373 static Format findFormatByFileContent( const TQString &fileName );
374
384 static List allMimeTypes();
385
393 static const TQString & defaultMimeType();
394
402 static KMimeType::Ptr defaultMimeTypePtr();
403
420 TQString parentMimeType() const;
421
428 bool is( const TQString& mimeTypeName ) const;
429
435 static KMimeType::Ptr diagnoseFileName(const TQString &file, TQString &pattern);
436
437protected:
438 void loadInternal( TQDataStream& );
439 void init( KDesktopFile * );
440
445 static void errorMissingMimeType( const TQString& _type );
446
450 static void buildDefaultType();
451
455 static void checkEssentialMimeTypes();
459 static bool s_bChecked;
460
461 TQStringList m_lstPatterns;
462
463 static Ptr s_pDefaultType;
464
465protected:
466 friend class KServiceTypeFactory;
467 int patternsAccuracy() const;
468
469protected:
470 virtual void virtual_hook( int id, void* data );
471};
472
477class TDEIO_EXPORT KFolderType : public KMimeType
478{
479 K_SYCOCATYPE( KST_KFolderType, KMimeType )
480
481public:
482// KFolderType( const TQString & _fullpath, const TQString& _type, const TQString& _icon, const TQString& _comment,
483// const TQStringList& _patterns );
484// KFolderType( const TQString & _fullpath ) : KMimeType( _fullpath ) { }
489 KFolderType( KDesktopFile *config) : KMimeType( config ) { }
491 KFolderType( TQDataStream& _str, int offset ) : KMimeType( _str, offset ) { }
492
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;
497protected:
498 virtual void virtual_hook( int id, void* data );
499};
500
506class TDEIO_EXPORT KDEDesktopMimeType : public KMimeType
507{
508 K_SYCOCATYPE( KST_KDEDesktopMimeType, KMimeType )
509
510public:
511 enum ServiceType { ST_MOUNT, ST_UNMOUNT, /* ST_PROPERTIES, */ ST_USER_DEFINED };
512
517 struct Service
518 {
519 Service() { m_display = true; }
520 bool isEmpty() const { return m_strName.isEmpty(); }
521 TQString m_strName;
522 TQString m_strIcon;
523 TQString m_strExec;
524 ServiceType m_type;
525 bool m_display;
526 };
527 // KDEDesktopMimeType( const TQString & _fullpath, const TQString& _type, const TQString& _icon,
528 // const TQString& _comment, const TQStringList& _patterns );
529 // KDEDesktopMimeType( const TQString & _fullpath ) : KMimeType( _fullpath ) { }
534 KDEDesktopMimeType( KDesktopFile *config) : KMimeType( config ) { }
536 KDEDesktopMimeType( TQDataStream& _str, int offset ) : KMimeType( _str, offset ) { }
537
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;
544
550 static TQValueList<Service> builtinServices( const KURL& _url );
561 static TQValueList<Service> userDefinedServices( const TQString& path, bool bLocalFiles );
562
568 static TQValueList<Service> userDefinedServices( const TQString& path, TDEConfig& config, bool bLocalFiles );
569
576 static TQValueList<Service> userDefinedServices( const TQString& path, TDEConfig& config, bool bLocalFiles, const KURL::List & file_list);
577
583 static void executeService( const TQString& path, KDEDesktopMimeType::Service& service ) KDE_DEPRECATED;
584
590 static void executeService( const KURL::List& urls, KDEDesktopMimeType::Service& service );
591
603 static pid_t run( const KURL& _url, bool _is_local );
604
605protected:
606 virtual TQPixmap pixmap( TDEIcon::Group group, int force_size = 0, int state = 0,
607 TQString * path = 0L ) const
608 { return KMimeType::pixmap( group, force_size, state, path ); }
609
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 );
614protected:
615 virtual void virtual_hook( int id, void* data );
616};
617
622class TDEIO_EXPORT KExecMimeType : public KMimeType
623{
624 K_SYCOCATYPE( KST_KExecMimeType, KMimeType )
625
626public:
627 // KExecMimeType( const TQString & _fullpath, const TQString& _type, const TQString& _icon,
628 // const TQString& _comment, const TQStringList& _patterns );
629 // KExecMimeType( const TQString & _fullpath ) : KMimeType( _fullpath ) { }
634 KExecMimeType( KDesktopFile *config) : KMimeType( config ) { }
636 KExecMimeType( TQDataStream& _str, int offset ) : KMimeType( _str, offset ) { }
637protected:
638 virtual void virtual_hook( int id, void* data );
639};
640
641#endif
KDEDesktopMimeType
Mime type for desktop files.
Definition kmimetype.h:507
KDEDesktopMimeType::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.
Definition kmimetype.h:606
KDEDesktopMimeType::KDEDesktopMimeType
KDEDesktopMimeType(KDesktopFile *config)
Construct a desktop mimetype and take all information from a desktop file.
Definition kmimetype.h:534
KExecMimeType
The mime type for executable files.
Definition kmimetype.h:623
KExecMimeType::KExecMimeType
KExecMimeType(KDesktopFile *config)
Construct a executable mimetype and take all information from a desktop file.
Definition kmimetype.h:634
KFolderType
Folder mime type.
Definition kmimetype.h:478
KFolderType::KFolderType
KFolderType(KDesktopFile *config)
Construct a folder mimetype and take all information from a desktop file.
Definition kmimetype.h:489
KMimeType
Represent a mime type, like "text/plain", and the data that is associated with it.
Definition kmimetype.h:48
KMimeType::s_bChecked
static bool s_bChecked
true if check for vital mime types has been done.
Definition kmimetype.h:459
KMimeType::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.
Definition kmimetype.cpp:457
KMimeType::icon
virtual TQString icon(const TQString &, bool) const
Return the filename of the icon associated with the mimetype.
Definition kmimetype.h:100
KMimeType::comment
virtual TQString comment(const KURL &, bool) const
Returns the descriptive comment associated with the MIME type.
Definition kmimetype.h:220
KMimeType::comment
virtual TQString comment(const TQString &, bool) const
Returns the descriptive comment associated with the MIME type.
Definition kmimetype.h:211
KMimeType::comment
TQString comment() const
Returns the descriptive comment associated with the MIME type.
Definition kmimetype.h:202
KMimeType::patterns
const TQStringList & patterns() const
Retrieve the list of patterns associated with the MIME Type.
Definition kmimetype.h:227
KMimeType::icon
virtual TQString icon(const KURL &, bool) const
Return the filename of the icon associated with the mimetype.
Definition kmimetype.h:110
KServiceType
A service type is the generic notion for a mimetype, a type of service instead of a type of file.
Definition kservicetype.h:46
KServiceType::propertyNames
virtual TQStringList propertyNames() const
Returns the list of all properties of this service type.
Definition kservicetype.cpp:191
KServiceType::property
virtual TQVariant property(const TQString &_name) const
Returns the requested property.
Definition kservicetype.cpp:171
KServiceType::comment
TQString comment() const
Returns the descriptive comment associated, if any.
Definition kservicetype.h:100
KServiceType::icon
TQString icon() const
Returns the icon associated with this service type.
Definition kservicetype.h:94
KDEDesktopMimeType::Service
Structure representing a service, in the list of services returned by builtinServices and userDefined...
Definition kmimetype.h:518

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.8
This website is maintained by Timothy Pearson.