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

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

#include "kloanpayoutpagedecl.h"

#include <ntqvariant.h>
#include <kmymoney/kmymoneydateinput.h>
#include <kmymoney/kmymoneyedit.h>
#include <kmymoney/kmymoneycategory.h>
#include <kactivelabel.h>
#include <ntqcheckbox.h>
#include <ntqframe.h>
#include <ntqlabel.h>
#include <kpushbutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a KLoanPayoutPageDecl as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
KLoanPayoutPageDecl::KLoanPayoutPageDecl( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "KLoanPayoutPageDecl" );
    KLoanPayoutPageDeclLayout = new TQVBoxLayout( this, 11, 6, "KLoanPayoutPageDeclLayout"); 

    kActiveLabel1 = new KActiveLabel( this, "kActiveLabel1" );
    kActiveLabel1->setFocusPolicy( KActiveLabel::NoFocus );
    KLoanPayoutPageDeclLayout->addWidget( kActiveLabel1 );

    m_noPayoutTransaction = new TQCheckBox( this, "m_noPayoutTransaction" );
    KLoanPayoutPageDeclLayout->addWidget( m_noPayoutTransaction );

    m_payoutDetailFrame = new TQFrame( this, "m_payoutDetailFrame" );
    m_payoutDetailFrame->setFrameShape( TQFrame::NoFrame );
    m_payoutDetailFrame->setFrameShadow( TQFrame::Raised );
    m_payoutDetailFrameLayout = new TQGridLayout( m_payoutDetailFrame, 1, 1, 0, 6, "m_payoutDetailFrameLayout"); 

    m_refinanceLoan = new TQCheckBox( m_payoutDetailFrame, "m_refinanceLoan" );

    m_payoutDetailFrameLayout->addMultiCellWidget( m_refinanceLoan, 0, 0, 0, 3 );

    textLabel1 = new TQLabel( m_payoutDetailFrame, "textLabel1" );

    m_payoutDetailFrameLayout->addWidget( textLabel1, 1, 0 );

    m_assetAccount = new KMyMoneyCategory( m_payoutDetailFrame, "m_assetAccount" );
    m_assetAccount->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 1, 0, m_assetAccount->sizePolicy().hasHeightForWidth() ) );

    m_payoutDetailFrameLayout->addMultiCellWidget( m_assetAccount, 1, 1, 1, 2 );

    m_createAssetButton = new KPushButton( m_payoutDetailFrame, "m_createAssetButton" );

    m_payoutDetailFrameLayout->addWidget( m_createAssetButton, 1, 3 );

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

    m_payoutDetailFrameLayout->addWidget( textLabel1_2, 2, 0 );

    m_loanAccount = new KMyMoneyCategory( m_payoutDetailFrame, "m_loanAccount" );
    m_loanAccount->setEnabled( false );
    m_loanAccount->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 1, 0, m_loanAccount->sizePolicy().hasHeightForWidth() ) );

    m_payoutDetailFrameLayout->addMultiCellWidget( m_loanAccount, 2, 2, 1, 2 );

    textLabel2 = new TQLabel( m_payoutDetailFrame, "textLabel2" );

    m_payoutDetailFrameLayout->addWidget( textLabel2, 3, 0 );
    spacer88 = new TQSpacerItem( 40, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    m_payoutDetailFrameLayout->addItem( spacer88, 3, 1 );

    m_payoutDate = new kMyMoneyDateInput( m_payoutDetailFrame, "m_payoutDate" );

    m_payoutDetailFrameLayout->addWidget( m_payoutDate, 3, 2 );
    KLoanPayoutPageDeclLayout->addWidget( m_payoutDetailFrame );
    spacer89 = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    KLoanPayoutPageDeclLayout->addItem( spacer89 );
    languageChange();
    resize( TQSize(600, 384).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( m_noPayoutTransaction, TQ_SIGNAL( toggled(bool) ), m_payoutDetailFrame, TQ_SLOT( setDisabled(bool) ) );
    connect( m_refinanceLoan, TQ_SIGNAL( toggled(bool) ), m_assetAccount, TQ_SLOT( setDisabled(bool) ) );
    connect( m_refinanceLoan, TQ_SIGNAL( toggled(bool) ), m_loanAccount, TQ_SLOT( setEnabled(bool) ) );
    connect( m_refinanceLoan, TQ_SIGNAL( toggled(bool) ), m_createAssetButton, TQ_SLOT( setDisabled(bool) ) );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void KLoanPayoutPageDecl::languageChange()
{
    kActiveLabel1->setText( tr2i18n( "If this loan is for an asset, such as a car or a house, you can create the asset account now. An asset account represents the total value of an asset. The money from this loan will be transfered into the asset account you create or select.\n"
"If this loan is a 'consumer loan' (money to use however you want), you can use a checking account instead." ) );
    m_noPayoutTransaction->setText( tr2i18n( "Don't create payout transaction" ) );
    m_refinanceLoan->setText( tr2i18n( "Refinance existing loan" ) );
    TQWhatsThis::add( m_refinanceLoan, tr2i18n( "Check this if you are refinancing a loan that already exists in KMyMoney" ) );
    textLabel1->setText( tr2i18n( "Asset Account" ) );
    m_createAssetButton->setText( tr2i18n( "Create" ) );
    textLabel1_2->setText( tr2i18n( "Loan account" ) );
    textLabel2->setText( tr2i18n( "Date of payment" ) );
}

/****************************************************************************
** KLoanPayoutPageDecl meta object code from reading C++ file 'kloanpayoutpagedecl.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 "kloanpayoutpagedecl.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 *KLoanPayoutPageDecl::className() const
{
    return "KLoanPayoutPageDecl";
}

TQMetaObject *KLoanPayoutPageDecl::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_KLoanPayoutPageDecl( "KLoanPayoutPageDecl", &KLoanPayoutPageDecl::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* KLoanPayoutPageDecl::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 = TQWidget::staticMetaObject();
    static const TQUMethod slot_0 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"KLoanPayoutPageDecl", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_KLoanPayoutPageDecl.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

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

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

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

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