/**********************************************************************

	--- Dlgedit generated file ---

	File: MiscData.cpp
	Last generated: Tue Jun 24 22:20:11 1997

	DO NOT EDIT!!!  This file will be automatically
	regenerated by dlgedit.  All changes will be lost.

 *********************************************************************/

#include "MiscData.h"

#define Inherited QDialog

#include <qbttngrp.h>
#include <qframe.h>
#include <qlabel.h>
#include <kapp.h>
#include <qdialog.h>
#include <klocale.h>

extern KApplication *mykapp;

MiscData::MiscData
(
	QWidget* parent,
	const char* name
)
	:
	Inherited( parent, name )
{
	QFrame* tmpQFrame;
	tmpQFrame = new QFrame( this, "Frame_5" );
	tmpQFrame->setGeometry( 10, 10, 320, 235 );
	tmpQFrame->setFrameStyle( 49 );


	ReturnButtonGroup = new QButtonGroup( this, "ButtonGroup_6" );
	ReturnButtonGroup->setGeometry( 25, 40, 135, 100 );
	ReturnButtonGroup->setFrameStyle( 49 );
	ReturnButtonGroup->setTitle( i18n("End of Line Mode") );
	ReturnButtonGroup->setAlignment( 1 );


	UnixButton = new QRadioButton( ReturnButtonGroup, "RadioButton_7" );
	UnixButton->move(15,25);
	connect( UnixButton, SIGNAL(clicked()), SLOT(UnixButtonClicked()) );
	UnixButton->setText( "Unix ( LF )" );
	UnixButton->setAutoRepeat( FALSE );
	UnixButton->setAutoResize( TRUE );
	UnixButton->setChecked( TRUE );

	DosButton = new QRadioButton( ReturnButtonGroup, "RadioButton_8" );
	DosButton->move(15,55);
	connect( DosButton, SIGNAL(clicked()), SLOT(DosButtonClicked()) );
	DosButton->setText( "Dos (CR+LF)" );
	DosButton->setAutoRepeat( FALSE );
	DosButton->setAutoResize( TRUE );

	QLabel* tmpQLabel;
	tmpQLabel = new QLabel( this, "Label_13" );
	tmpQLabel->setGeometry( 180, 35, 100, 20 );
	tmpQLabel->setText( i18n("PageProtect") );
	tmpQLabel->setAlignment( 289 );
	tmpQLabel->setMargin( -1 );

	PageProtectCombo = new QComboBox( FALSE, this, "ComboBox_6" );
	PageProtectCombo->setGeometry( 180, 60, 100, 25 );
	connect( PageProtectCombo, SIGNAL(activated(const char*)), SLOT(PageProtectSelected(const char*)) );
	PageProtectCombo->setSizeLimit( 10 );
	PageProtectCombo->setAutoResize( FALSE );
	PageProtectCombo->insertItem( "on" );
	PageProtectCombo->insertItem( "off" );
	PageProtectCombo->insertItem( "auto" );

	tmpQLabel = new QLabel( this, "Label_14" );
	tmpQLabel->setGeometry( 180, 90, 100, 20 );
	tmpQLabel->setText( i18n("Powersave Time") );
	tmpQLabel->setAlignment( 292 );
	tmpQLabel->setMargin( -1 );

	PowerSaveCombo = new QComboBox( FALSE, this, "ComboBox_7" );
	PowerSaveCombo->setGeometry( 180, 115, 100, 25 );
	connect( PowerSaveCombo, SIGNAL(activated(const char*)), SLOT(PowerSaveComboSelected(const char*)) );
	PowerSaveCombo->setSizeLimit( 10 );
	PowerSaveCombo->setAutoResize( FALSE );
	PowerSaveCombo->insertItem( "0" );
	PowerSaveCombo->insertItem( "15" );
	PowerSaveCombo->insertItem( "30" );
	PowerSaveCombo->insertItem( "60" );
	PowerSaveCombo->insertItem( "120" );
	PowerSaveCombo->insertItem( "180" );

	EjectButton = new QPushButton( this, "PushButton_1" );
	EjectButton->setGeometry( 130, 165, 90, 25 );
	connect( EjectButton, SIGNAL(clicked()), SLOT(EjectButtonClicked()) );
	EjectButton->setText(i18n( "Eject") );
	EjectButton->setAutoRepeat( FALSE );
	EjectButton->setAutoResize( FALSE );

	ResetButton = new QPushButton( this, "PushButton_2" );
	ResetButton->setGeometry( 25, 165, 90, 25 );
	connect( ResetButton, SIGNAL(clicked()), SLOT(ResetButtonClicked()) );
	ResetButton->setText(i18n( "Reset") );
	ResetButton->setAutoRepeat( FALSE );
	ResetButton->setAutoResize( FALSE );

	Initialize = new QPushButton( this, "PushButton_3" );
	Initialize->setGeometry( 25, 205, 90, 25 );
	connect( Initialize, SIGNAL(clicked()), SLOT(InitializeClicked()) );
	Initialize->setText(i18n( "Initialize") );
	Initialize->setAutoRepeat( FALSE );
	Initialize->setAutoResize( FALSE );


	Help = new QPushButton( this, "PushButton_4" );
	Help->setGeometry( 130, 205, 90, 25 );
	connect( Help, SIGNAL(clicked()), SLOT(HelpClicked()) );
	Help->setText( i18n("Help") );
	Help->setAutoRepeat( FALSE );
	Help->setAutoResize( FALSE );


	About = new QPushButton( this, "PushButton_4" );
	About->setGeometry( 230, 205, 90, 25 );
	connect( About, SIGNAL(clicked()), SLOT(AboutClicked()) );
	About->setText( i18n("About") );
	About->setAutoRepeat( FALSE );
	About->setAutoResize( FALSE );


	resize( 330, 255 );

}


MiscData::~MiscData()
{
}
void MiscData::UnixButtonClicked()
{
  if(!data)
    return;
  if(UnixButton->isChecked()){

    data->Termination = "unix";

  }
  else{

    data->Termination = "dos";

  }

}
void MiscData::DosButtonClicked()
{
  if(!data)
    return;
  if(DosButton->isChecked()){

    data->Termination = "dos";

  }
  else{

    data->Termination = "Unix";

  }

}
void MiscData::PageProtectSelected(const char* pp)
{
  if(!data)
    return;

  data->Pageprotect = pp;
  
}
void MiscData::PowerSaveComboSelected(const char* ps)
{
  if(!data)
    return;

  data->Powersave = ps;

}

void MiscData::EjectButtonClicked()
{
  if(!data)
    return;
  data->eject();

}


void MiscData::ResetButtonClicked()
{
  if(!data)
    return;
  data->reset();
}


void MiscData::InitializeClicked()
{
  if(!data)
    return;
  data->initialize();

}


void MiscData::HelpClicked()
{

  mykapp->invokeHTMLHelp("kljettool/kljettool.html","");

}


void MiscData::AboutClicked()
{

  QDialog *dlg = new MyAbout(0);

  QPoint point = this->mapToGlobal (QPoint (0,0));

  QRect pos = this->geometry();
  dlg->setGeometry(point.x() + pos.width()/2  - dlg->width()/2,
		   point.y() + pos.height()/2 - dlg->height()/2, 
		   dlg->width(),dlg->height());

  dlg->exec();
  delete dlg;

}
