diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-05 06:00:29 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-05 06:00:29 +0000 |
commit | fecb0e67b23e8b83ba7fc881bb57bc48c0852d62 (patch) | |
tree | 6b8614802f0d01b353bc9ba78aff2090846c198e /kmymoney2/dialogs/ksplittransactiondlg.cpp | |
parent | dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (diff) | |
download | kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.tar.gz kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.zip |
TQt4 port kmymoney
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239855 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/dialogs/ksplittransactiondlg.cpp')
-rw-r--r-- | kmymoney2/dialogs/ksplittransactiondlg.cpp | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/kmymoney2/dialogs/ksplittransactiondlg.cpp b/kmymoney2/dialogs/ksplittransactiondlg.cpp index a197b4c..9236bea 100644 --- a/kmymoney2/dialogs/ksplittransactiondlg.cpp +++ b/kmymoney2/dialogs/ksplittransactiondlg.cpp @@ -23,14 +23,14 @@ // ---------------------------------------------------------------------------- // QT Includes -#include <qpushbutton.h> -#include <qlabel.h> -#include <qtable.h> -#include <qtimer.h> -#include <qptrlist.h> -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qcursor.h> +#include <tqpushbutton.h> +#include <tqlabel.h> +#include <tqtable.h> +#include <tqtimer.h> +#include <tqptrlist.h> +#include <tqbuttongroup.h> +#include <tqradiobutton.h> +#include <tqcursor.h> // ---------------------------------------------------------------------------- // KDE Includes @@ -61,9 +61,9 @@ KSplitTransactionDlg::KSplitTransactionDlg(const MyMoneyTransaction& t, const bool amountValid, const bool deposit, const MyMoneyMoney& calculatedValue, - const QMap<QString, MyMoneyMoney>& priceInfo, - QWidget* parent, const char* name) : - KSplitTransactionDlgDecl(parent, name, true), + const TQMap<TQString, MyMoneyMoney>& priceInfo, + TQWidget* tqparent, const char* name) : + KSplitTransactionDlgDecl(tqparent, name, true), m_account(acc), m_split(s), m_precision(2), @@ -75,14 +75,14 @@ KSplitTransactionDlg::KSplitTransactionDlg(const MyMoneyTransaction& t, KIconLoader *il = KGlobal::iconLoader(); KGuiItem clearButtenItem( i18n( "Clear &All" ), - QIconSet(il->loadIcon("edittrash", KIcon::Small, KIcon::SizeSmall)), + TQIconSet(il->loadIcon("edittrash", KIcon::Small, KIcon::SizeSmall)), i18n("Clear all splits"), i18n("Use this to clear all splits of this transaction")); clearAllBtn->setGuiItem(clearButtenItem); KGuiItem mergeButtenItem( i18n( "&Merge" ), - QIconSet(il->loadIcon("math_sum", KIcon::Small, KIcon::SizeSmall)), + TQIconSet(il->loadIcon("math_sum", KIcon::Small, KIcon::SizeSmall)), "", ""); mergeBtn->setGuiItem(mergeButtenItem); @@ -90,24 +90,24 @@ KSplitTransactionDlg::KSplitTransactionDlg(const MyMoneyTransaction& t, finishBtn->setDefault(true); // setup the focus - cancelBtn->setFocusPolicy(QWidget::NoFocus); - finishBtn->setFocusPolicy(QWidget::NoFocus); - clearAllBtn->setFocusPolicy(QWidget::NoFocus); + cancelBtn->setFocusPolicy(TQ_NoFocus); + finishBtn->setFocusPolicy(TQ_NoFocus); + clearAllBtn->setFocusPolicy(TQ_NoFocus); // connect signals with slots - connect(transactionsTable, SIGNAL(transactionChanged(const MyMoneyTransaction&)), - this, SLOT(slotSetTransaction(const MyMoneyTransaction&))); - connect(transactionsTable, SIGNAL(createCategory(const QString&, QString&)), this, SLOT(slotCreateCategory(const QString&, QString&))); - connect(transactionsTable, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool))); + connect(transactionsTable, TQT_SIGNAL(transactionChanged(const MyMoneyTransaction&)), + this, TQT_SLOT(slotSetTransaction(const MyMoneyTransaction&))); + connect(transactionsTable, TQT_SIGNAL(createCategory(const TQString&, TQString&)), this, TQT_SLOT(slotCreateCategory(const TQString&, TQString&))); + connect(transactionsTable, TQT_SIGNAL(objectCreation(bool)), this, TQT_SIGNAL(objectCreation(bool))); - connect(transactionsTable, SIGNAL(returnPressed()), this, SLOT(accept())); - connect(transactionsTable, SIGNAL(escapePressed()), this, SLOT(reject())); + connect(transactionsTable, TQT_SIGNAL(returnPressed()), this, TQT_SLOT(accept())); + connect(transactionsTable, TQT_SIGNAL(escapePressed()), this, TQT_SLOT(reject())); - connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject())); - connect(finishBtn, SIGNAL(clicked()), this, SLOT(accept())); - connect(clearAllBtn, SIGNAL(clicked()), this, SLOT(slotClearAllSplits())); - connect(mergeBtn, SIGNAL(clicked()), this, SLOT(slotMergeSplits())); - connect(clearZeroBtn, SIGNAL(clicked()), this, SLOT(slotClearUnusedSplits())); + connect(cancelBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(reject())); + connect(finishBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(accept())); + connect(clearAllBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotClearAllSplits())); + connect(mergeBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotMergeSplits())); + connect(clearZeroBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotClearUnusedSplits())); // setup the precision try { @@ -122,11 +122,11 @@ KSplitTransactionDlg::KSplitTransactionDlg(const MyMoneyTransaction& t, // pass on those vars transactionsTable->setup(priceInfo); - QSize size(width(), height()); + TQSize size(width(), height()); kapp->config()->setGroup("SplitTransactionEditor"); size = kapp->config()->readSizeEntry("Geometry", &size); size.setHeight(size.height()-1); - QDialog::resize( size.expandedTo(minimumSizeHint()) ); + TQDialog::resize( size.expandedTo(tqminimumSizeHint()) ); // Trick: it seems, that the initial sizing of the dialog does // not work correctly. At least, the columns do not get displayed @@ -134,7 +134,7 @@ KSplitTransactionDlg::KSplitTransactionDlg(const MyMoneyTransaction& t, // is incorrect. If the widget is visible, resizing works correctly. // So, we let the dialog show up and resize it then. It's not really // clean, but the only way I got the damned thing working. - QTimer::singleShot( 10, this, SLOT(initSize()) ); + TQTimer::singleShot( 10, this, TQT_SLOT(initSize()) ); } KSplitTransactionDlg::~KSplitTransactionDlg() @@ -166,7 +166,7 @@ int KSplitTransactionDlg::exec(void) rc = KSplitTransactionDlgDecl::exec(); - if(rc == QDialog::Accepted) { + if(rc == TQDialog::Accepted) { if(!diffAmount().isZero()) { KSplitCorrectionDlgDecl* corrDlg = new KSplitCorrectionDlgDecl(this, 0, true); @@ -175,23 +175,23 @@ int KSplitTransactionDlg::exec(void) corrDlg->cancelBtn->setGuiItem(KStdGuiItem::cancel()); MyMoneySplit split = m_transaction.splits()[0]; - QString total = (-split.value()).formatMoney("", m_precision); - QString sums = splitsValue().formatMoney("", m_precision); - QString diff = diffAmount().formatMoney("", m_precision); + TQString total = (-split.value()).formatMoney("", m_precision); + TQString sums = splitsValue().formatMoney("", m_precision); + TQString diff = diffAmount().formatMoney("", m_precision); // now modify the text items of the dialog to contain the correct values - QString q = i18n("The total amount of this transaction is %1 while " + TQString q = i18n("The total amount of this transaction is %1 while " "the sum of the splits is %2. The remaining %3 are " "unassigned.") - .arg(total) - .arg(sums) - .arg(diff); + .tqarg(total) + .tqarg(sums) + .tqarg(diff); corrDlg->explanation->setText(q); - q = i18n("Change &total amount of transaction to %1.").arg(sums); + q = i18n("Change &total amount of transaction to %1.").tqarg(sums); corrDlg->changeBtn->setText(q); - q = i18n("&Distribute difference of %1 among all splits.").arg(diff); + q = i18n("&Distribute difference of %1 among all splits.").tqarg(diff); corrDlg->distributeBtn->setText(q); // FIXME remove the following line once distribution among // all splits is implemented @@ -200,18 +200,18 @@ int KSplitTransactionDlg::exec(void) // if we have only two splits left, we don't allow leaving sth. unassigned. if(m_transaction.splitCount() < 3) { - q = i18n("&Leave total amount of transaction at %1.").arg(total); + q = i18n("&Leave total amount of transaction at %1.").tqarg(total); } else { - q = i18n("&Leave %1 unassigned.").arg(diff); + q = i18n("&Leave %1 unassigned.").tqarg(diff); } corrDlg->leaveBtn->setText(q); - if((rc = corrDlg->exec()) == QDialog::Accepted) { - QButton* button = corrDlg->buttonGroup->selected(); + if((rc = corrDlg->exec()) == TQDialog::Accepted) { + TQButton* button = corrDlg->buttonGroup->selected(); if(button != 0) { switch(corrDlg->buttonGroup->id(button)) { case 0: // continue to edit - rc = QDialog::Rejected; + rc = TQDialog::Rejected; break; case 1: // modify total @@ -234,7 +234,7 @@ int KSplitTransactionDlg::exec(void) } else break; - } while(rc != QDialog::Accepted); + } while(rc != TQDialog::Accepted); // for deposits, we inverted the sign of all splits. // now we revert it back, so that things are left correct @@ -252,7 +252,7 @@ int KSplitTransactionDlg::exec(void) void KSplitTransactionDlg::initSize(void) { - QDialog::resize(width(), height()+1); + TQDialog::resize(width(), height()+1); } void KSplitTransactionDlg::accept() @@ -281,8 +281,8 @@ void KSplitTransactionDlg::slotClearAllSplits(void) if(answer == KMessageBox::Continue) { transactionsTable->slotCancelEdit(); - QValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction); - QValueList<MyMoneySplit>::ConstIterator it; + TQValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction); + TQValueList<MyMoneySplit>::ConstIterator it; // clear all but the one referencing the account for(it = list.begin(); it != list.end(); ++it) { @@ -298,8 +298,8 @@ void KSplitTransactionDlg::slotClearUnusedSplits(void) { transactionsTable->slotEndEdit(); - QValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction); - QValueList<MyMoneySplit>::ConstIterator it; + TQValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction); + TQValueList<MyMoneySplit>::ConstIterator it; try { // remove all splits that don't have a value assigned @@ -320,14 +320,14 @@ void KSplitTransactionDlg::slotMergeSplits(void) { transactionsTable->slotEndEdit(); - QValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction); - QValueList<MyMoneySplit>::ConstIterator it; + TQValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction); + TQValueList<MyMoneySplit>::ConstIterator it; try { // collect all splits, merge them if needed and remove from transaction - QValueList<MyMoneySplit> splits; + TQValueList<MyMoneySplit> splits; for(it = list.begin(); it != list.end(); ++it) { - QValueList<MyMoneySplit>::iterator it_s; + TQValueList<MyMoneySplit>::iterator it_s; for(it_s = splits.begin(); it_s != splits.end(); ++it_s) { if((*it_s).accountId() == (*it).accountId() && (*it_s).memo().isEmpty() && (*it).memo().isEmpty()) @@ -343,7 +343,7 @@ void KSplitTransactionDlg::slotMergeSplits(void) } // now add them back to the transaction - QValueList<MyMoneySplit>::iterator it_s; + TQValueList<MyMoneySplit>::iterator it_s; for(it_s = splits.begin(); it_s != splits.end(); ++it_s) { (*it_s).clearId(); m_transaction.addSplit(*it_s); @@ -361,18 +361,18 @@ void KSplitTransactionDlg::slotSetTransaction(const MyMoneyTransaction& t) transactionsTable->slotCancelEdit(); m_transaction = t; - QValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction); - QValueList<MyMoneySplit>::ConstIterator it; + TQValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction); + TQValueList<MyMoneySplit>::ConstIterator it; // check if we can merge splits or not, have zero splits or not - QMap<QString, int> splits; + TQMap<TQString, int> splits; bool haveZeroSplit = false; for(it = list.begin(); it != list.end(); ++it) { splits[(*it).accountId()]++; if(((*it).id() != m_split.id()) && ((*it).shares().isZero())) haveZeroSplit = true; } - QMap<QString, int>::const_iterator it_s; + TQMap<TQString, int>::const_iterator it_s; for(it_s = splits.begin(); it_s != splits.end(); ++it_s) { if((*it_s) > 1) break; @@ -400,8 +400,8 @@ void KSplitTransactionDlg::updateSums(void) MyMoneyMoney KSplitTransactionDlg::splitsValue(void) { MyMoneyMoney splitsValue(m_calculatedValue); - QValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction); - QValueList<MyMoneySplit>::ConstIterator it; + TQValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction); + TQValueList<MyMoneySplit>::ConstIterator it; // calculate the current sum of all split parts for(it = list.begin(); it != list.end(); ++it) { @@ -426,21 +426,21 @@ MyMoneyMoney KSplitTransactionDlg::diffAmount(void) return diff; } -void KSplitTransactionDlg::slotCreateCategory(const QString& name, QString& id) +void KSplitTransactionDlg::slotCreateCategory(const TQString& name, TQString& id) { - MyMoneyAccount acc, parent; + MyMoneyAccount acc, tqparent; acc.setName(name); if(m_isDeposit) - parent = MyMoneyFile::instance()->income(); + tqparent = MyMoneyFile::instance()->income(); else - parent = MyMoneyFile::instance()->expense(); + tqparent = MyMoneyFile::instance()->expense(); // TODO extract possible first part of a hierarchy and check if it is one - // of our top categories. If so, remove it and select the parent + // of our top categories. If so, remove it and select the tqparent // according to this information. - emit createCategory(acc, parent); + emit createCategory(acc, tqparent); // return id id = acc.id(); |