/***************************************************************************
                          mycursordlg.cpp  -  description
                             -------------------
    begin                : Die July 04 2006
    copyright            : (C) 2006 by Harald Krippel
    email                : harald@the-develop.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.                                   *
 *                                                                         *
 ***************************************************************************/

#include "mycursordlg.h"

#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
 
MyCursorEditDlg::MyCursorEditDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
    : CursorEditDlg( parent, name, modal, fl )
{
    point = NULL;
}

/*
 *  Destroys the object and frees any allocated resources
 */
MyCursorEditDlg::~MyCursorEditDlg()
{
    // no need to delete child widgets, Qt does it all for us
}

void MyCursorEditDlg::slotGetData()
{
    if(point != NULL)
    {
      slotGetData(point);
    }
}

void MyCursorEditDlg::slotGetData(FolderListItem *i)
{
    point=i;

    text->setText(i->text(0));
    on->setChecked(i->GetValue("on",i).toInt());

    locx->setText(i->GetValue("x",i));
    locy->setText(i->GetValue("y",i));
    locz->setText(i->GetValue("z",i));

    mx->setText(i->GetValue("mx",i));
    my->setText(i->GetValue("my",i));

    qWarning( "MyCursorEditDlg::slotGetData(): Geht !" );
}

void MyCursorEditDlg::slotEditData()
{
    point->setText(0,text->text());

    point->SetValue("on", on->isChecked() ? "1" : "0");

    point->SetValue("x",locx->text());
    point->SetValue("y",locy->text());
    point->SetValue("z",locz->text());

    point->SetValue("mx",mx->text());
    point->SetValue("my",my->text());

    point->updategl();

    qWarning( "MyCursorEditDlg::slotEditData(): Geht !" );
}

