/***************************************************************************
 *   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 QUERYFIELD_H
#define QUERYFIELD_H

#include <kdialog.h>
#include <klocale.h>
#include <qvariant.h>
#include <qpushbutton.h>
#include <kpushbutton.h>
#include <kcombobox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <libkdepim/kdateedit.h>
#include <libkdepim/ktimeedit.h>

#include "queryfieldiface.h"
#include "queryfieldbase.h"
#include "queryfieldmanager.h"
#include "queryfieldcontent.h"
#include "queryfieldtime.h"
#include "queryfieldmetadata.h"
#include "queryfieldmedia.h"
#include "queryfieldurl.h"
#include "queryfieldanything.h"
#include <qdatetime.h>
#include <qlabel.h>




class QueryField : public QWidget
{
	Q_OBJECT
	public:
		QueryField(QWidget* parent = 0, int itemNum = 0 ,  int convenienceWidth = 0,const char* name = 0, 
			   WFlags fl = 0 );
  
		~QueryField();
  
		//set queryfield Id
		void setItemNum(int );
		//get queryfield Id
		int itemNum( );
		int m_convenienceWidth;

   		
		//a "plugin" is a specialized search-widget 
// 		QueryPlugin * m_plugin;
		QueryFieldIface * pQF;
		QWidget * pWdg;
		QueryFieldBase * m_queryFieldBase ;
		QueryFieldManager * m_queryFieldManager;
		
		//return state of the boolean + - buttons
		bool getMinus();
 	 	bool getPlus();
		int m_newWidth;
		int m_newHeight;
		int m_minimumWidth;
 
	public slots:
		void slotRemoveQueryField();
		
		//create a new "plugin"
		void slotCreatePlugin(const QString & name);
		
		void slotQueryPlus(bool);
    		void slotQueryMinus(bool sig);

	signals:
		void removeQueryFieldClicked(int );
		void sizeChanged(int);
		void minimumSizeChanged();


	private:
		QString m_query;
		int  	m_itemNum;
		bool 	m_plus;
		bool 	m_minus;
		QueryFieldMetaData * pMD;
		QueryFieldContent  * pC;
		QueryFieldTime     *pDT;
		QueryFieldMedia    *pMedia;
		QueryFieldURL    *pURL;
		QueryFieldAnyThing    *pAny;
		
		QHBoxLayout * pl ;
		
};

#endif

