/***************************************************************************
 *   Copyright (C) 2005 by xavier helluy   *
 *   xavier.helluy@web.de   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.             *
 ***************************************************************************/

#ifndef QUERYFIELDMETADATA_H
#define QUERYFIELDMETADATA_H

#include "queryfieldmetadata_base.h"
#include <qstringlist.h>
#include <qmap.h>
#include "queryfieldiface.h"


class QueryFieldMetaData : public QueryFieldMetaDataBase , virtual public QueryFieldIface
{
  
Q_OBJECT

public:
  QueryFieldMetaData(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
  ~QueryFieldMetaData();
  
  void setupSupportedMimeTypes();
  virtual QString getQuery();
  void readMetaDataFromFile();

  

  
  /*$PUBLIC_FUNCTIONS$*/

public slots:
	void slotSetupSupportedKeys(const QString & mimeType);
	void slotReloadMetaData();

  /*$PUBLIC_SLOTS$*/

protected:
  /*$PROTECTED_FUNCTIONS$*/

protected slots:
	void slotReturnPressed();
	void slotTextChanged(const QString &);
  /*$PROTECTED_SLOTS$*/
	private:
		QString parseQuery(const QString &);
		
		QStringList allMimeTypes;
		QStringList m_supportedKeys;
		QMap<QString, QMap<QString , QString> > m_commentToSupportedMimeType;
		QMap<QString, QString> m_mimeTypeToIcon;
		QMap<QString , QStringList > m_commentsToFields;
		QString m_query;
		QString m_fileName;

	signals:
		void returnPressed(const QString &);
		void textChanged(const QString &);	
};

#endif

