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

#include "cluceneguisearchhelper.h"
#include "queryfieldboolean.h"
#include "queryfield.h"
#include <qptrlist.h> 
#include <kdialogbase.h>
#include <qscrollview.h>
#include <klineedit.h>


// define ioslave protocol namespace
#define IOSLAVE_PROTOCOL_NAME  "rekwest"
#define IOSLAVE_PROTOCOL_NAME_FULL  IOSLAVE_PROTOCOL_NAME":/"


/*
  CLuceneGuiSearch 	: 
  CLuceneGuiSearchHelper : manages all the search-field except the boolean field
  */   
class CLuceneGuiSearch: public KDialogBase 
{

	Q_OBJECT

	public:
		CLuceneGuiSearch(QWidget *parent = 0, const char *name = 0);
		
		//used to decide if app is started as standalone or called from ioslave clucene
		void onrequest(bool b);    
		

	public slots:
		//kdialog management stuff		 
		virtual void slotApply();
		virtual void slotCancel();
		virtual void slotOk();
		void initDialogGeometry();

		//sends the parsed query string to the ioslave, remote or started with krun
		void sendQueryString();

	private :
				//the main page widget of the dialog
		QWidget * m_page;
		
		//a qscrollview widget containing all the queryfields widgets
		CLuceneGuiSearchHelper *m_scrollView;

		//TODO: not implemented
		void createGUIDesktopFile();
		
		QHBoxLayout * l2;
		
		QLabel * label;
		QVBoxLayout * l;

		//tell if app started standalone or from a remote app like ioslave clucene
		bool m_onRequest;
		
		//used by user to enter the name of the query (usefull for long complex queries)
		KLineEdit * queryName;
		
		//boolean field widget		
		QueryFieldBoolean * m_boolField;
};
#endif
