1 /*************************************************************************** 2 zeitcalcdialog - 3 ------------------- 4 begin : 2004-23-09 5 copyright : (C) 2004 by Klaas Freitag 6 email : freitag@kde.org 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 18 // include files for Qt 19 #include <qcombobox.h> 20 #include <qcheckbox.h> 21 22 // include files for KDE 23 #include <QDebug> 24 25 #include "fixcalcdialog.h" 26 #include "fixcalcpart.h" 27 #include "stdsatzman.h" 28 #include "defaultprovider.h" 29 30 FixCalcDialog(QWidget * parent)31FixCalcDialog::FixCalcDialog(QWidget *parent) 32 :CalcDialogBase(parent), 33 _fixWidget(new Ui_calcdetailFix), 34 m_part(0) 35 { 36 setWindowTitle( i18n("Calculation Fix Item")); 37 _fixWidget->setupUi(_centralWidget); 38 _fixWidget->m_inpPreis->setSuffix( DefaultProvider::self()->currencySymbol() ); 39 } 40 setCalcPart(FixCalcPart * cp)41void FixCalcDialog::setCalcPart( FixCalcPart *cp ) 42 { 43 if( ! cp ) return; 44 m_part = cp; 45 _fixWidget->m_nameEdit->setText( cp->getName()); 46 _fixWidget->m_inpMenge->setValue( cp->getMenge()); 47 _fixWidget->m_inpPreis->setValue(cp->unitPreis().toDouble()); 48 } 49 accept()50void FixCalcDialog::accept() 51 { 52 if( m_part ) { 53 m_part->setMenge( _fixWidget->m_inpMenge->value() ); 54 m_part->setName( _fixWidget->m_nameEdit->text()); 55 m_part->setUnitPreis(Geld(_fixWidget->m_inpPreis->value())); 56 } 57 58 if( m_part && m_part->isDirty() ) { 59 emit fixCalcPartChanged(m_part); 60 } 61 62 CalcDialogBase::accept(); 63 } 64 getName()65QString FixCalcDialog::getName() 66 { 67 return _fixWidget->m_nameEdit->text(); 68 } 69 getMenge()70double FixCalcDialog::getMenge() 71 { 72 return _fixWidget->m_inpMenge->value(); 73 } 74 getPreis()75double FixCalcDialog::getPreis() 76 { 77 return _fixWidget->m_inpPreis->value(); 78 } 79 80 81 /* END */ 82 83