#include <kdialog.h>
#include <tdelocale.h>

/****************************************************************************
** Form implementation generated from reading ui file 'keditscheduledlgdecl.ui'
**
** Created by: The TQt user interface compiler (TQt 3.5.0)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "keditscheduledlgdecl.h"

#include <ntqvariant.h>
#include <kmymoney/kmymoneydateinput.h>
#include <kmymoney/kmymoneycombo.h>
#include <kmymoney/register.h>
#include <kmymoney/transactionform.h>
#include <ntqpushbutton.h>
#include <ntqlabel.h>
#include <klineedit.h>
#include <knuminput.h>
#include <ntqgroupbox.h>
#include <ntqframe.h>
#include <kcombobox.h>
#include <ntqcheckbox.h>
#include <kpushbutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a KEditScheduleDlgDecl as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The qdialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal qdialog.
 */
KEditScheduleDlgDecl::KEditScheduleDlgDecl( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "KEditScheduleDlgDecl" );
    setSizeGripEnabled( true );
    KEditScheduleDlgDeclLayout = new TQVBoxLayout( this, 11, 6, "KEditScheduleDlgDeclLayout"); 

    layout8 = new TQHBoxLayout( 0, 0, 6, "layout8"); 

    layout9 = new TQHBoxLayout( 0, 0, 6, "layout9"); 

    textLabel1 = new TQLabel( this, "textLabel1" );
    layout9->addWidget( textLabel1 );

    m_nameEdit = new KLineEdit( this, "m_nameEdit" );
    layout9->addWidget( m_nameEdit );
    layout8->addLayout( layout9 );

    layout7 = new TQHBoxLayout( 0, 0, 6, "layout7"); 

    textLabel3 = new TQLabel( this, "textLabel3" );
    layout7->addWidget( textLabel3 );

    m_frequencyNoEdit = new KIntNumInput( this, "m_frequencyNoEdit" );
    m_frequencyNoEdit->setMaxValue( 999 );
    m_frequencyNoEdit->setMinValue( 1 );
    layout7->addWidget( m_frequencyNoEdit );

    m_frequencyEdit = new KMyMoneyOccurencePeriodCombo( this, "m_frequencyEdit" );
    layout7->addWidget( m_frequencyEdit );
    layout8->addLayout( layout7 );
    KEditScheduleDlgDeclLayout->addLayout( layout8 );

    m_paymentInformation = new TQGroupBox( this, "m_paymentInformation" );
    m_paymentInformation->setColumnLayout(0, TQt::Vertical );
    m_paymentInformation->layout()->setSpacing( 6 );
    m_paymentInformation->layout()->setMargin( 11 );
    m_paymentInformationLayout = new TQVBoxLayout( m_paymentInformation->layout() );
    m_paymentInformationLayout->setAlignment( TQt::AlignTop );

    layout7_2 = new TQHBoxLayout( 0, 0, 6, "layout7_2"); 

    textLabel1_3 = new TQLabel( m_paymentInformation, "textLabel1_3" );
    layout7_2->addWidget( textLabel1_3 );

    m_paymentMethodEdit = new KMyMoneyGeneralCombo( m_paymentInformation, "m_paymentMethodEdit" );
    m_paymentMethodEdit->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)3, (TQSizePolicy::SizeType)0, 0, 0, m_paymentMethodEdit->sizePolicy().hasHeightForWidth() ) );
    layout7_2->addWidget( m_paymentMethodEdit );
    spacer4 = new TQSpacerItem( 61, 21, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout7_2->addItem( spacer4 );
    m_paymentInformationLayout->addLayout( layout7_2 );

    line1 = new TQFrame( m_paymentInformation, "line1" );
    line1->setFrameShape( TQFrame::HLine );
    line1->setFrameShadow( TQFrame::Sunken );
    line1->setFrameShape( TQFrame::HLine );
    m_paymentInformationLayout->addWidget( line1 );

    m_register = new KMyMoneyRegister::Register( m_paymentInformation, "m_register" );
    m_register->setNumRows( 0 );
    m_register->setNumCols( 12 );
    m_paymentInformationLayout->addWidget( m_register );

    m_form = new KMyMoneyTransactionForm::TransactionForm( m_paymentInformation, "m_form" );
    m_form->setNumRows( 5 );
    m_form->setNumCols( 1 );
    m_paymentInformationLayout->addWidget( m_form );
    KEditScheduleDlgDeclLayout->addWidget( m_paymentInformation );

    groupBox2 = new TQGroupBox( this, "groupBox2" );
    groupBox2->setColumnLayout(0, TQt::Vertical );
    groupBox2->layout()->setSpacing( 6 );
    groupBox2->layout()->setMargin( 11 );
    groupBox2Layout = new TQVBoxLayout( groupBox2->layout() );
    groupBox2Layout->setAlignment( TQt::AlignTop );

    layout6 = new TQGridLayout( 0, 1, 1, 0, 6, "layout6"); 

    m_weekendOptionEdit = new KComboBox( false, groupBox2, "m_weekendOptionEdit" );

    layout6->addWidget( m_weekendOptionEdit, 1, 1 );

    textLabel1_2 = new TQLabel( groupBox2, "textLabel1_2" );

    layout6->addWidget( textLabel1_2, 1, 0 );
    groupBox2Layout->addLayout( layout6 );

    layout7_3 = new TQHBoxLayout( 0, 0, 6, "layout7_3"); 

    m_estimateEdit = new TQCheckBox( groupBox2, "m_estimateEdit" );
    layout7_3->addWidget( m_estimateEdit );

    m_variation = new KIntSpinBox( groupBox2, "m_variation" );
    m_variation->setEnabled( false );
    m_variation->setValue( 10 );
    layout7_3->addWidget( m_variation );
    spacer5 = new TQSpacerItem( 21, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout7_3->addItem( spacer5 );
    groupBox2Layout->addLayout( layout7_3 );

    m_autoEnterEdit = new TQCheckBox( groupBox2, "m_autoEnterEdit" );
    groupBox2Layout->addWidget( m_autoEnterEdit );

    m_endSeriesEdit = new TQCheckBox( groupBox2, "m_endSeriesEdit" );
    groupBox2Layout->addWidget( m_endSeriesEdit );

    m_endOptionsFrame = new TQFrame( groupBox2, "m_endOptionsFrame" );
    m_endOptionsFrame->setFrameShape( TQFrame::NoFrame );
    m_endOptionsFrame->setFrameShadow( TQFrame::Raised );
    m_endOptionsFrameLayout = new TQHBoxLayout( m_endOptionsFrame, 0, 6, "m_endOptionsFrameLayout"); 
    Spacer3_2_2 = new TQSpacerItem( 20, 20, TQSizePolicy::Fixed, TQSizePolicy::Minimum );
    m_endOptionsFrameLayout->addItem( Spacer3_2_2 );

    m_endLabel1 = new TQLabel( m_endOptionsFrame, "m_endLabel1" );
    m_endOptionsFrameLayout->addWidget( m_endLabel1 );

    m_RemainingEdit = new KIntNumInput( m_endOptionsFrame, "m_RemainingEdit" );
    m_RemainingEdit->setMinValue( 0 );
    m_RemainingEdit->setMaxValue( 9999 );
    m_endOptionsFrameLayout->addWidget( m_RemainingEdit );

    m_endLabel2 = new TQLabel( m_endOptionsFrame, "m_endLabel2" );
    m_endOptionsFrameLayout->addWidget( m_endLabel2 );

    m_FinalPaymentEdit = new kMyMoneyDateInput( m_endOptionsFrame, "m_FinalPaymentEdit" );
    m_FinalPaymentEdit->setFocusPolicy( kMyMoneyDateInput::StrongFocus );
    m_endOptionsFrameLayout->addWidget( m_FinalPaymentEdit );
    groupBox2Layout->addWidget( m_endOptionsFrame );
    KEditScheduleDlgDeclLayout->addWidget( groupBox2 );
    spacer12 = new TQSpacerItem( 20, 16, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    KEditScheduleDlgDeclLayout->addItem( spacer12 );

    layout10_3 = new TQHBoxLayout( 0, 0, 6, "layout10_3"); 

    buttonHelp = new KPushButton( this, "buttonHelp" );
    layout10_3->addWidget( buttonHelp );
    Spacer1_2 = new TQSpacerItem( 280, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout10_3->addItem( Spacer1_2 );

    buttonOk = new KPushButton( this, "buttonOk" );
    buttonOk->setAutoDefault( true );
    buttonOk->setDefault( true );
    layout10_3->addWidget( buttonOk );

    buttonCancel = new KPushButton( this, "buttonCancel" );
    layout10_3->addWidget( buttonCancel );
    KEditScheduleDlgDeclLayout->addLayout( layout10_3 );
    languageChange();
    resize( TQSize(798, 640).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( buttonOk, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
    connect( m_endSeriesEdit, TQ_SIGNAL( toggled(bool) ), m_endOptionsFrame, TQ_SLOT( setEnabled(bool) ) );
    connect( buttonCancel, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
    connect( m_estimateEdit, TQ_SIGNAL( toggled(bool) ), m_variation, TQ_SLOT( setEnabled(bool) ) );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void KEditScheduleDlgDecl::languageChange()
{
    setCaption( tr2i18n( "Edit Scheduled transaction" ) );
    textLabel1->setText( tr2i18n( "Schedule name:" ) );
    textLabel3->setText( tr2i18n( "Frequency:" ) );
    TQToolTip::add( m_frequencyNoEdit, tr2i18n( "Number of selected periods between entries" ) );
    m_paymentInformation->setTitle( tr2i18n( "Payment information" ) );
    textLabel1_3->setText( tr2i18n( "Payment method" ) );
    groupBox2->setTitle( tr2i18n( "Options" ) );
    m_weekendOptionEdit->clear();
    m_weekendOptionEdit->insertItem( tr2i18n( "Do nothing" ) );
    m_weekendOptionEdit->insertItem( tr2i18n( "Change the date to the previous Friday" ) );
    m_weekendOptionEdit->insertItem( tr2i18n( "Change the date to the next Monday" ) );
    textLabel1_2->setText( tr2i18n( "If this schedule occurs on the weekend:" ) );
    m_estimateEdit->setText( tr2i18n( "The amount is an estimate because it varies for each payment" ) );
    m_autoEnterEdit->setText( tr2i18n( "Enter this schedule into the register automatically when it is due" ) );
    m_endSeriesEdit->setText( tr2i18n( "This schedule will end at some time" ) );
    m_endLabel1->setText( tr2i18n( "Number of transactions remaining:" ) );
    m_endLabel2->setText( tr2i18n( "Date of final transaction:" ) );
    buttonHelp->setText( tr2i18n( "Help" ) );
    buttonOk->setText( tr2i18n( "OK" ) );
    buttonCancel->setText( tr2i18n( "Cancel" ) );
}

/****************************************************************************
** KEditScheduleDlgDecl meta object code from reading C++ file 'keditscheduledlgdecl.h'
**
** Created by: The TQt Meta Object Compiler version 26 (TQt 3.5.0)
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#undef TQT_NO_COMPAT
#include "keditscheduledlgdecl.h"
#include <ntqmetaobject.h>
#include <ntqapplication.h>

#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.5.0. It"
#error "cannot be used with the include files from this version of TQt."
#error "(The moc has changed too much.)"
#endif

const char *KEditScheduleDlgDecl::className() const
{
    return "KEditScheduleDlgDecl";
}

TQMetaObject *KEditScheduleDlgDecl::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_KEditScheduleDlgDecl( "KEditScheduleDlgDecl", &KEditScheduleDlgDecl::staticMetaObject );

#ifndef TQT_NO_TRANSLATION
TQString KEditScheduleDlgDecl::tr( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "KEditScheduleDlgDecl", s, c, TQApplication::DefaultCodec );
    else
	return TQString::fromLatin1( s );
}
#ifndef TQT_NO_TRANSLATION_UTF8
TQString KEditScheduleDlgDecl::trUtf8( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "KEditScheduleDlgDecl", s, c, TQApplication::UnicodeUTF8 );
    else
	return TQString::fromUtf8( s );
}
#endif // TQT_NO_TRANSLATION_UTF8

#endif // TQT_NO_TRANSLATION

TQMetaObject* KEditScheduleDlgDecl::staticMetaObject()
{
    if ( metaObj ) {
	return metaObj;
}
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();
    if ( metaObj ) {
	if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
	return metaObj;
    }
#endif // TQT_THREAD_SUPPORT
    TQMetaObject* parentObject = TQDialog::staticMetaObject();
    static const TQUMethod slot_0 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"KEditScheduleDlgDecl", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_KEditScheduleDlgDecl.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

void* KEditScheduleDlgDecl::tqt_cast( const char* clname )
{
    if ( !qstrcmp( clname, "KEditScheduleDlgDecl" ) )
	return this;
    return TQDialog::tqt_cast( clname );
}

bool KEditScheduleDlgDecl::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

bool KEditScheduleDlgDecl::tqt_emit( int _id, TQUObject* _o )
{
    return TQDialog::tqt_emit(_id,_o);
}
#ifndef TQT_NO_PROPERTIES

bool KEditScheduleDlgDecl::tqt_property( int id, int f, TQVariant* v)
{
    return TQDialog::tqt_property( id, f, v);
}

bool KEditScheduleDlgDecl::tqt_static_property( TQObject* , int , int , TQVariant* ){ return false; }
#endif // TQT_NO_PROPERTIES
