/*
 *  Copyright (C) 2007-2008 CMM Sigma Andrzej Chmielowiec 
<cmmsigma@cmmsigma.eu>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2
 *  as published by the Free Software Foundation.
 *
 *  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.
 */

#ifndef STOKEN_DIALOG_H
#define STOKEN_DIALOG_H

#include <QDialog>
#include <QString>

class QPushButton;
class QTreeWidget;
class QTreeWidgetItem;

class STokenDialog: public QDialog
{
	Q_OBJECT;
	
public:
	static const int TokenDialogType = 0;
	static const int KeyDialogType = 1;
	static const int FileDialogType = 2;
	
	STokenDialog(int dialogType = TokenDialogType, QWidget *parent = 0);
	~STokenDialog();
	
	const QString& text() const;
	const QByteArray& data() const;
	
	static QString getKeyName(QString title = QString(), QWidget *parent = 0);
	static QString getFileName(QString title = QString(), QWidget *parent = 0);
	static QString getFileNameAndData(QByteArray &data, QString title = QString(), 
		QWidget *parent = 0);
	
signals:
	void acceptSig();
	
private slots:
	void acceptSlot();
	void listItemDoubleClickedSlot(QTreeWidgetItem *item, int column);
	
private:
	void libInit();
	void createLayout();
	void fillSTokenList();
	
	int mDialogType;
	int mSTokenNum;
	QTreeWidget *mSTokenList;
	
	QString mText;
	QByteArray mData;
	
	QPushButton *mCancel;
	QPushButton *mAccept;
};

#endif
