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

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

#include "kgeneralloaninfopagedecl.h"

#include <ntqvariant.h>
#include <kmymoney/kmymoneydateinput.h>
#include <kmymoney/kmymoneyedit.h>
#include <kmymoney/kmymoneycategory.h>
#include <kmymoney/kmymoneycombo.h>
#include <ntqpushbutton.h>
#include <kactivelabel.h>
#include <ntqlabel.h>
#include <kcombobox.h>
#include <knuminput.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

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

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

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

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

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

    layout13->addWidget( textLabel1, 0, 0 );

    m_loanDirection = new KComboBox( false, this, "m_loanDirection" );

    layout13->addWidget( m_loanDirection, 0, 1 );

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

    layout13->addWidget( textLabel2, 1, 0 );

    m_payee = new KMyMoneyPayeeCombo( this, "m_payee" );

    layout13->addWidget( m_payee, 1, 1 );

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

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

    m_anyPayments = new KComboBox( false, this, "m_anyPayments" );

    layout13->addWidget( m_anyPayments, 2, 1 );

    textLabel3 = new TQLabel( this, "textLabel3" );

    layout13->addWidget( textLabel3, 3, 0 );

    m_recordings = new KComboBox( false, this, "m_recordings" );

    layout13->addWidget( m_recordings, 3, 1 );

    textLabel1_3 = new TQLabel( this, "textLabel1_3" );

    layout13->addWidget( textLabel1_3, 4, 0 );

    m_openingBalance = new kMyMoneyEdit( this, "m_openingBalance" );

    layout13->addWidget( m_openingBalance, 4, 1 );

    textLabel5 = new TQLabel( this, "textLabel5" );

    layout13->addWidget( textLabel5, 5, 0 );

    m_paymentFrequency = new KMyMoneyFrequencyCombo( this, "m_paymentFrequency" );
    m_paymentFrequency->setFocusPolicy( KMyMoneyFrequencyCombo::TabFocus );

    layout13->addWidget( m_paymentFrequency, 5, 1 );

    textLabel1_4 = new TQLabel( this, "textLabel1_4" );

    layout13->addWidget( textLabel1_4, 6, 0 );

    m_compoundFrequency = new KMyMoneyFrequencyCombo( this, "m_compoundFrequency" );

    layout13->addWidget( m_compoundFrequency, 6, 1 );

    textLabel2_2 = new TQLabel( this, "textLabel2_2" );

    layout13->addWidget( textLabel2_2, 7, 0 );

    m_firstPaymentDate = new kMyMoneyDateInput( this, "m_firstPaymentDate" );
    m_firstPaymentDate->setFocusPolicy( kMyMoneyDateInput::StrongFocus );

    layout13->addWidget( m_firstPaymentDate, 7, 1 );

    textLabel4 = new TQLabel( this, "textLabel4" );

    layout13->addWidget( textLabel4, 8, 0 );

    m_interestType = new KComboBox( false, this, "m_interestType" );

    layout13->addWidget( m_interestType, 8, 1 );

    textLabel3_2 = new TQLabel( this, "textLabel3_2" );

    layout13->addWidget( textLabel3_2, 9, 0 );

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

    m_interestFrequencyAmountEdit = new KIntSpinBox( this, "m_interestFrequencyAmountEdit" );
    m_interestFrequencyAmountEdit->setMinValue( 1 );
    layout48->addWidget( m_interestFrequencyAmountEdit );

    m_interestFrequencyUnitEdit = new KComboBox( false, this, "m_interestFrequencyUnitEdit" );
    layout48->addWidget( m_interestFrequencyUnitEdit );

    layout13->addLayout( layout48, 9, 1 );

    textLabel4_2 = new TQLabel( this, "textLabel4_2" );

    layout13->addWidget( textLabel4_2, 10, 0 );

    m_interestChangeDateEdit = new kMyMoneyDateInput( this, "m_interestChangeDateEdit" );
    m_interestChangeDateEdit->setFocusPolicy( kMyMoneyDateInput::StrongFocus );

    layout13->addWidget( m_interestChangeDateEdit, 10, 1 );
    layout14->addLayout( layout13 );
    spacer1 = new TQSpacerItem( 29, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout14->addItem( spacer1 );
    KGeneralLoanInfoPageDeclLayout->addLayout( layout14 );
    spacer2 = new TQSpacerItem( 20, 16, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    KGeneralLoanInfoPageDeclLayout->addItem( spacer2 );
    languageChange();
    resize( TQSize(675, 494).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void KGeneralLoanInfoPageDecl::languageChange()
{
    kActiveLabel1->setText( tr2i18n( "Please select the required options. Please use the <b>What's this?</b> feature to see more information about the items." ) );
    textLabel1->setText( tr2i18n( "What is the type of the loan?" ) );
    m_loanDirection->clear();
    m_loanDirection->insertItem( tr2i18n( "I am borrowing money" ) );
    m_loanDirection->insertItem( tr2i18n( "I am lending money" ) );
    textLabel2->setText( tr2i18n( "Who is the payee/payer of the loan?" ) );
    TQWhatsThis::add( m_payee, tr2i18n( "Enter the name of the person or bank you owe money or who owes you money.\n"
"\n"
"If the name does not exist within KMyMoney's database, you are asked if you want to create it." ) );
    textLabel1_2->setText( tr2i18n( "Did you make/receive any payments yet?" ) );
    m_anyPayments->clear();
    m_anyPayments->insertItem( tr2i18n( "No" ) );
    m_anyPayments->insertItem( tr2i18n( "Yes" ) );
    TQWhatsThis::add( m_anyPayments, tr2i18n( "Were there any payments for this loan whether they are entered into KMyMoney or not?\n"
"\n"
"Note: Payments made to obtain the loan (e.g. Disagio) are not considered as payments in this context." ) );
    textLabel3->setText( tr2i18n( "Which payments do you want to record?" ) );
    m_recordings->clear();
    m_recordings->insertItem( tr2i18n( "All payments" ) );
    m_recordings->insertItem( tr2i18n( "Start with this year's payments" ) );
    TQWhatsThis::add( m_recordings, tr2i18n( "<qt>Select which transactions should be recorded.\n"
"\n"
"<b>All payments</b> allows you to enter all payments made for this loan.\n"
"\n"
"The option to <b>start from the beginning of the current year</b> is meant for loans that are active for a longer period of time already and you don't want to enter all transactions of the past.\n"
"</qt>" ) );
    textLabel1_3->setText( tr2i18n( "Balance before start of recording" ) );
    TQWhatsThis::add( textLabel1_3, tr2i18n( "Enter the ending balance found on the statement that is the last one before you want to start recording this loan in KMyMoney." ) );
    TQWhatsThis::add( m_openingBalance, tr2i18n( "You have selected to record only payments from the beginning of this year. Since prior transactions will not be recorded, you need to supply the balance of the loan on January 1st of this year." ) );
    textLabel5->setText( tr2i18n( "Payment frequency" ) );
    textLabel1_4->setText( tr2i18n( "Interest Compounding frequency" ) );
    TQWhatsThis::add( m_compoundFrequency, tr2i18n( "Select the frequency with which the interest is compounded. If uncertain, select the same as the payment frequency. Consult your loan contract for details." ) );
    textLabel2_2->setText( tr2i18n( "Due date of first payment to be recorded" ) );
    TQWhatsThis::add( m_firstPaymentDate, tr2i18n( "Depending on the answer to <b>What do you want to record?</b> this field means the following:<p>\n"
"\n"
"<b>All payments</b><br>\n"
"Enter the due date of the very first payment<p>\n"
"\n"
"<b>Start with this year's payments</b><br>\n"
"Enter the due date of the first payment in the current year" ) );
    textLabel4->setText( tr2i18n( "Type of interest rate" ) );
    m_interestType->clear();
    m_interestType->insertItem( tr2i18n( "Fixed" ) );
    m_interestType->insertItem( tr2i18n( "Variable" ) );
    textLabel3_2->setText( tr2i18n( "Time between interest changes" ) );
    m_interestFrequencyUnitEdit->clear();
    m_interestFrequencyUnitEdit->insertItem( tr2i18n( "Days" ) );
    m_interestFrequencyUnitEdit->insertItem( tr2i18n( "Weeks" ) );
    m_interestFrequencyUnitEdit->insertItem( tr2i18n( "Months" ) );
    m_interestFrequencyUnitEdit->insertItem( tr2i18n( "Years" ) );
    m_interestFrequencyUnitEdit->setCurrentItem( 3 );
    textLabel4_2->setText( tr2i18n( "Next interest change is due" ) );
}

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

TQMetaObject *KGeneralLoanInfoPageDecl::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_KGeneralLoanInfoPageDecl( "KGeneralLoanInfoPageDecl", &KGeneralLoanInfoPageDecl::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* KGeneralLoanInfoPageDecl::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(
	"KGeneralLoanInfoPageDecl", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_KGeneralLoanInfoPageDecl.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

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

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

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

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