# include <QApplication>


# include <QListView>
# include <QDirModel>
# include <QPushButton>
# include <QMainWindow>
# include <QVBoxLayout>

# include <QDir>
# include <QSize>

# include "main.h"
bool C_Application::Init ( )
{
//	Bereits initialisiert
	if ( mp_model != NULL && mp_view != NULL )
		return true;

	if ( mp_model == NULL )
		mp_model = new QDirModel ( this );
	if ( mp_view == NULL )
	{
		mp_view = new QListView;
		mp_view->setModel ( mp_model );
		mp_view->setRootIndex ( mp_model->index ( QDir::currentPath ( ) ) );
		mp_view->setCurrentIndex ( mp_model->index ( QDir::currentPath ( ) ) );
		mp_view->setViewMode ( QListView::IconMode );
		mp_view->setMovement ( QListView::Snap );
		mp_view->setUniformItemSizes ( true );
		mp_view->setGridSize ( QSize ( 50, 50 ) );
		mp_view->show ( );
		mp_view->setAttribute ( Qt::WA_DeleteOnClose, true );
		mp_view->resize ( mp_view->sizeHint ( ) );
	}

	mp_button = new QPushButton;
	mp_button->show ( );
	mp_button->setAttribute ( Qt::WA_DeleteOnClose, true );
	mp_button->setText ( tr ( "Nachdem einige Objekte verschoben wurden klicken" ) );
	mp_button->resize ( mp_button->sizeHint ( ) );

	connect ( mp_button, SIGNAL ( clicked ( bool ) ), this, SLOT ( Reset ( ) ) );

	m_isStepOne = true;

	return true;
}

C_Application::~C_Application ( )
{
}

void C_Application::Reset ( )
{
	QDir newDir ( QDir::currentPath ( ) );
	newDir.cd ( ".." );
	mp_view->setRootIndex ( mp_model->index ( newDir.path ( ) ) );
	mp_view->setCurrentIndex ( mp_model->index ( newDir.path ( ) ) );

	mp_view->setRootIndex ( mp_model->index ( QDir::currentPath ( ) ) );
	mp_view->setCurrentIndex ( mp_model->index ( QDir::currentPath ( ) ) );
	mp_button->setDisabled ( true );
}

int main ( int f_arc, char **faa_argv )
{
	C_Application app ( f_arc, faa_argv );
	app.Init ( );
	app.setQuitOnLastWindowClosed ( true );

	app.exec ( );

	return 0;
}
