
//  Copyright (C) 2009 by Arnaud Dupuis
//  a.dupuis@infinityperl.org
//  http://www.infinityperl.org
// 
//  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 3 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.,
//  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA

#ifndef ASSUMA_SUBSCRIBERIMPORTERDIALOG
#define ASSUMA_SUBSCRIBERIMPORTERDIALOG

#include <QDialog>
#include <QWidget>
#include <QList>
#include <QTreeWidgetItem>
#include "ui_assuma_subsciberimporterdialog.h"
/*! \class AssumaSubscriberImporterDialog
* \brief A dialog to import subscribers from another database.
*
* This dialog is used to import subscribers from any database to the current one.
*/
class AssumaSubscriberImporterDialog : public QDialog, public Ui::AssumaSubscriberImporterDialog
{
	Q_OBJECT
	
	public:
		/*!
		Constructs a dialog window.
		\param parent the parent widget
		*/
		AssumaSubscriberImporterDialog(QWidget *parent=0);
		/*!
		Return the column number for columnName.
		\param columnName the name of the column
		*/
		int elementColumn(const QString&);
	signals:
		/*!
		This signal is emitted each time one or more subscribers are to import.
		Technically speaking it is emitted when user click on the "Import subscribers" button.
		\param list a list of QTreeWidgetItems
		*/
		void importSubscribers( QList<QTreeWidgetItem*>* );
	public slots:
		/*!
		load the fileName database.
		\param fileName the complete path to the database (can be relative or absolute).
		*/
		void loadDatabase(const QString&);
		/*!
		Load a theme for the UI.
		\param themeName the name of the theme to load. This is the name of a directory in the theme/ directory.
		*/
		void loadTheme( const QString & themeName = "default" );
	private slots:
		void on_openDatabaseButton_clicked();
		void on_importButton_clicked();
	private:
		void setItemTooltip(QTreeWidgetItem *);
		QMap<QString, int> columnMap;
	
};

#endif
