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

#include <QtGui>

struct CRD_UT10XX_info_t;

class LoginWidget: public QStackedWidget
{
	Q_OBJECT;
	
public:
	LoginWidget(QWidget *parent = 0);
	~LoginWidget();
	void focus2PIN();
	
public slots:
	void setInfo(const CRD_UT10XX_info_t *info);
	void logoutSlot();
	
private slots:
	void chooseSoLoginSlot(int state);
	void soLoginSlot();
	void userLoginSlot();
	
signals:
	void soLoginSig(const char *pin, bool &success);
	void userLoginSig(const char *pin, bool &success);
	void logoutSig();
	
private:
	void clearInputs();
	void clearFields();
	
private:
	QByteArray mSoPinBuf;
	QByteArray mUserPinBuf;
	
	QWidget *mLoginWidget;
	QCheckBox *mChooseSoLogin;
	QGroupBox *mSoLoginBox;
	QGroupBox *mUserLoginBox;
	QLabel *mSoInfo;
	QLabel *mUserInfo;
	QLineEdit *mSoPin;
	QLineEdit *mUserPin;
	QPushButton *mSoLogin;
	QPushButton *mUserLogin;
	
	QWidget *mLogoutWidget;
	QLabel *mLoginInfo;
	QPushButton *mLogout;
};

#endif
