// @(#)root/qt:$Id$
// Author: Valeri Fine   21/01/2003

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * Copyright (C) 2002 by Valeri Fine.                                    *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TQMimeTypes
#define ROOT_TQMimeTypes


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TQMimeTypes and TQMime                                               //
//                                                                      //
// This class handles mime types, used by browsers to map file types    //
// to applications and icons. TQMime is internally used by TQMimeTypes. //
//                                                                      //
// This classes are based on TGMimeTypes and TGMime class from          //
// ROOT "gui"  package                                                  //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TObject.h"
#include "TString.h"
#ifndef __CINT__
#  include "qglobal.h"
#endif

class QFileIconProvider;
class TOrdCollection;
class TRegexp;
class QFileInfo;
class QPixmap;

#if (QT_VERSION > 0x39999)
   class QIcon;
#else /* QT_VERSION */
   class QIconSet;
#endif /* QT_VERSION */
class TSystemFile;

class TQMime : public TObject {

friend class TQMimeTypes;

private:
   TString   fType;      // mime type
   TString   fPattern;   // filename pattern
   TString   fAction;    // associated action
#if (QT_VERSION > 0x39999)
   QIcon  *fIcon;     // associated icon set
#else /* QT_VERSION */
   QIconSet  *fIcon;     // associated icon set
#endif /* QT_VERSION */
   TRegexp   *fReg;      // pattern regular expression

public:
  ~TQMime();
};


class TQMimeTypes : public TObject {
private:
   void operator=(const TQMimeTypes&);
   TQMimeTypes(const TQMimeTypes&);

protected:
   TString          fIconPath;   // the path to the icon directory
   TString          fFilename;   // file name of mime type file
   Bool_t           fChanged;    // true if file has changed
   TOrdCollection  *fList;       // list of mime types

   static QFileIconProvider  *fgDefaultProvider; // Default provider of the system icons;

   TQMime    *Find(const char *filename) const;
#if (QT_VERSION > 0x39999)
   const QIcon *AddType(const TSystemFile *filename);
   static QIcon  IconProvider(const QFileInfo &);
#else /* QT_VERSION */
   const QIconSet *AddType(const TSystemFile *filename);
   static const QPixmap  &IconProvider(const QFileInfo &);
#endif /* QT_VERSION */
public:
   TQMimeTypes(const char *iconPath, const char *file);
   virtual ~TQMimeTypes();
   void   SaveMimes();
   Bool_t HasChanged() const { return fChanged; }
   void   AddType(const char *type, const char *pat, const char *icon, const char *sicon, const char *action);
   void   Print(Option_t *option="") const;
   Bool_t GetAction(const char *filename, char *action) const;
   Bool_t GetType(const char *filename, char *type) const;
#if (QT_VERSION > 0x39999)
   const  QIcon *GetIcon(const char *filename) const;
   const  QIcon *GetIcon(const TSystemFile *filename);
#else /* QT_VERSION */
   const  QIconSet *GetIcon(const char *filename) const;
   const  QIconSet *GetIcon(const TSystemFile *filename);
#endif /* QT_VERSION */


#ifndef Q_MOC_RUN
//MOC_SKIP_BEGIN
   ClassDef(TQMimeTypes,0)  // Pool of mime type objects
//MOC_SKIP_END
#endif
};

#endif
 TQMimeTypes.h:1
 TQMimeTypes.h:2
 TQMimeTypes.h:3
 TQMimeTypes.h:4
 TQMimeTypes.h:5
 TQMimeTypes.h:6
 TQMimeTypes.h:7
 TQMimeTypes.h:8
 TQMimeTypes.h:9
 TQMimeTypes.h:10
 TQMimeTypes.h:11
 TQMimeTypes.h:12
 TQMimeTypes.h:13
 TQMimeTypes.h:14
 TQMimeTypes.h:15
 TQMimeTypes.h:16
 TQMimeTypes.h:17
 TQMimeTypes.h:18
 TQMimeTypes.h:19
 TQMimeTypes.h:20
 TQMimeTypes.h:21
 TQMimeTypes.h:22
 TQMimeTypes.h:23
 TQMimeTypes.h:24
 TQMimeTypes.h:25
 TQMimeTypes.h:26
 TQMimeTypes.h:27
 TQMimeTypes.h:28
 TQMimeTypes.h:29
 TQMimeTypes.h:30
 TQMimeTypes.h:31
 TQMimeTypes.h:32
 TQMimeTypes.h:33
 TQMimeTypes.h:34
 TQMimeTypes.h:35
 TQMimeTypes.h:36
 TQMimeTypes.h:37
 TQMimeTypes.h:38
 TQMimeTypes.h:39
 TQMimeTypes.h:40
 TQMimeTypes.h:41
 TQMimeTypes.h:42
 TQMimeTypes.h:43
 TQMimeTypes.h:44
 TQMimeTypes.h:45
 TQMimeTypes.h:46
 TQMimeTypes.h:47
 TQMimeTypes.h:48
 TQMimeTypes.h:49
 TQMimeTypes.h:50
 TQMimeTypes.h:51
 TQMimeTypes.h:52
 TQMimeTypes.h:53
 TQMimeTypes.h:54
 TQMimeTypes.h:55
 TQMimeTypes.h:56
 TQMimeTypes.h:57
 TQMimeTypes.h:58
 TQMimeTypes.h:59
 TQMimeTypes.h:60
 TQMimeTypes.h:61
 TQMimeTypes.h:62
 TQMimeTypes.h:63
 TQMimeTypes.h:64
 TQMimeTypes.h:65
 TQMimeTypes.h:66
 TQMimeTypes.h:67
 TQMimeTypes.h:68
 TQMimeTypes.h:69
 TQMimeTypes.h:70
 TQMimeTypes.h:71
 TQMimeTypes.h:72
 TQMimeTypes.h:73
 TQMimeTypes.h:74
 TQMimeTypes.h:75
 TQMimeTypes.h:76
 TQMimeTypes.h:77
 TQMimeTypes.h:78
 TQMimeTypes.h:79
 TQMimeTypes.h:80
 TQMimeTypes.h:81
 TQMimeTypes.h:82
 TQMimeTypes.h:83
 TQMimeTypes.h:84
 TQMimeTypes.h:85
 TQMimeTypes.h:86
 TQMimeTypes.h:87
 TQMimeTypes.h:88
 TQMimeTypes.h:89
 TQMimeTypes.h:90
 TQMimeTypes.h:91
 TQMimeTypes.h:92
 TQMimeTypes.h:93
 TQMimeTypes.h:94
 TQMimeTypes.h:95
 TQMimeTypes.h:96
 TQMimeTypes.h:97
 TQMimeTypes.h:98
 TQMimeTypes.h:99
 TQMimeTypes.h:100
 TQMimeTypes.h:101
 TQMimeTypes.h:102
 TQMimeTypes.h:103
 TQMimeTypes.h:104
 TQMimeTypes.h:105
 TQMimeTypes.h:106
 TQMimeTypes.h:107
 TQMimeTypes.h:108
 TQMimeTypes.h:109
 TQMimeTypes.h:110
 TQMimeTypes.h:111
 TQMimeTypes.h:112
 TQMimeTypes.h:113
 TQMimeTypes.h:114