/*
 *  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.
 */

// FTPAccountWidget.h: interface for the FTPAccountWidget class.
//
//////////////////////////////////////////////////////////////////////

#ifndef FTPAACCOUNTWIDGET_H
#define FTPAACCOUNTWIDGET_H

#include <QtGui>
#include "CaOptions.h"

class QFTPTableWidgetItem : public QTableWidgetItem, public CaOptions::FTPConfig::FTPAccount
{
public:
	QFTPTableWidgetItem(const QString &text = "");
};

class FTPAccountWidget : public QWidget  
{
	Q_OBJECT
	
public:
	FTPAccountWidget(QWidget *parent = 0);
	virtual ~FTPAccountWidget();
	
	void setData(CaOptions::FTPConfig &data);
	void getData(CaOptions::FTPConfig &data);
	
	QLineEdit *mServer;
	QLineEdit *mUser;
	QLineEdit *mPass;
	QCheckBox *mUseAccount;
	
	QTableWidget *mServers;
	QTableWidget *mPaths;
	
	QPushButton *mAddAccount;
	QPushButton *mDelAccount;
	QPushButton *mAddPath;
	QPushButton *mDelPath;
	
protected:
	QFTPTableWidgetItem *mCurr;
	void saveData(QTableWidgetItem *previous);
	void updateFTPPanel();
	
	
private slots:
	void addAccount();
	void delAccount();
	void addPath();
	void delPath();
	void addressFinished();
	
	void serverItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous);
};

#endif
