/***************************************************************************
                          CdCopyDialog.h  -  description
                             -------------------
    begin                : Sat May 5 2001
    copyright            : (C) 2001 by Alexy Podolsky
    email                :  alexpod@users.sourceforge.net
 ***************************************************************************/

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

#ifndef CDCOPYDIALOG_H
#define CDCOPYDIALOG_H

#include <qwidget.h>
#include <qevent.h>
#include <qdatetime.h>


#include "CdCopyDialogBase.h"
#include "CdboDialogBase.h"
#include "CdboDialogActionFactory.h"

#include "dialogParts/DriveInfoPnl.h"
#include "dialogParts/SpeedPnl.h"
#include "dialogParts/DialogCntPnl.h"

class KConfig;
class KProcess;

/**
  *@author
  */

class CdCopyDialog : public CdCopyDialogBase, public CdboDialogBase  {
   Q_OBJECT
public:
	CdCopyDialog(QWidget *parent=0, const char *name=0);
	~CdCopyDialog();
	
	//implementing pure virtuals
	virtual void blockBtns(bool) const;
	virtual QString getActionType() const;
	
	inline virtual void output(int type, QString message) const { dialogCntPnl->output(type, message); }
	virtual void status(QString message) const { dialogCntPnl->status(message); }
	inline virtual void setProcessType(int type) const { dialogCntPnl->setProcessType(type); }
	inline virtual void setTotalProcesses(int type) const { dialogCntPnl->setTotalProcesses(type); }
	
	inline virtual QString getScsiDevice() const { return targetDevicePnl->getScsiDevice(); }
	inline virtual QString getSpeed() const { return speedPnl->getSpeed(); }

public slots:
	void readOptions();

protected slots:
	void taskFailedToStart();
	void taskDone(bool success);
	void tmpChecked(bool);
	
 	void cancelSlot();
	void quitSlot();
	void settingsSlot();
	void startBtnSlot();
	void eraseSlot();
	void previewSlot();
	
	
    virtual void customBtnSlot();
    virtual void detectDestSlot();
    virtual void readOptionsBtnSlot();
    virtual void dataSlot();
    virtual void musicSlot();

    virtual void closeEvent(QCloseEvent *e);
    virtual void keyPressEvent(QKeyEvent *e);
	void kcmshellDone(KProcess *proc);
	void readOnlyChkSlot();
	void fixateChkSlot();

private:
	bool checkTmpSize;
	bool remindedAlready;
	
	bool stillCopying;
	bool stillReading;
	bool stillChecking;
	
	bool readOnly;
	int minTmpSize;
	
	int copiesWanted;
	int copiesDone;
	
	QString imageAddr;
	QString tempDir;
	KConfig *config;
	QStringList tmpList;



	CdboDialogActionFactory *factory;
	
	//methods
	void saveOptions();
	void initBtns();
	bool confermExit();
	
	inline int getCopyType(){ return actionCmb->currentItem(); }

	void startCopyProcess();	
	void doCopy();
	void cleanUp();
};
#endif
