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

#include "indexerwidget_base.h"
#include "settings.h"
#include <qmap.h>
#include <kconfigdialog.h>
#include "indexerwidget_dcopiface.h"
#include <dcopobject.h>

class IndexerWidget : public IndexerWidgetBase ,  public IndexerWidgetDCOPIface
{
  Q_OBJECT
	public:
		IndexerWidget( KDialogBase * , Settings *, QMap< QString,
			       QString > *,QMap< QString ,QString > *,
                               QWidget* parent = 0,
			       const char* name = 0, WFlags fl = 0 );
		
		~IndexerWidget();
	
		//widget internal stuff
		QStringList m_itemIncludeList;
		QStringList m_itemExcludeList;
		
		bool wakeDCOP();
		QString name2path(QString fileName);

		//dcop stuff
		void indexerFinished();


  
	public slots:
		void slotStartIndexing();

		
		//widget internal stuff
		virtual void removeItemExclude();
		virtual void removeItemInclude();
		virtual void addItemExclude();
		virtual void addItemInclude();
		void slotRemoveIndex(const QString & removedIndex);

		void slotNewTextConverter(const QString&);
		void slotRemoveTextConverter(const QString&);
    
		//widget internal stuff
		void slotNewIndexConfigViewUpdate(const QString & indexStr);
		
		
		//creator stuff
		bool killDCOPIndexer();//barbaric HACK
		void saveSettingsIndexCreator();
		void someIndexSelected(const QString & itemStr);
		void updateEntriesInWidget(const QString&);
		bool validateStoredIndexEntries(const QString&);
		void storeEntries( QString & indexGroup );
    virtual void slotTextIndexNameChanged(const QString & str);
    


	signals:
		//widget internal stuff
		void newIndex(const QString &);
		
		//creator stuff
	
	private:
		QString m_lastNewIndexName;
		
		//pointer to cluceneindexsettingsrc config kconfigskeleton
		Settings *m_settings;
		KDialogBase *  m_dialog;
		//map of stored index names and corresponding path to the index database
		QMap<QString , QString > * m_indexMap;
		QMap<QString , QString > * m_textConvertersNameMap;
};

#endif
