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/reports/reportstestcommon.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/reports/reportstestcommon.cpp')
-rw-r--r-- | kmymoney2/reports/reportstestcommon.cpp | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/kmymoney2/reports/reportstestcommon.cpp b/kmymoney2/reports/reportstestcommon.cpp index 31e6c1d..7d42abc 100644 --- a/kmymoney2/reports/reportstestcommon.cpp +++ b/kmymoney2/reports/reportstestcommon.cpp @@ -15,10 +15,10 @@ * * ***************************************************************************/ -#include <qvaluelist.h> -#include <qvaluevector.h> -#include <qdom.h> -#include <qfile.h> +#include <tqvaluelist.h> +#include <tqvaluevector.h> +#include <tqdom.h> +#include <tqfile.h> #include <kdebug.h> #include <kdeversion.h> @@ -31,7 +31,7 @@ #define private public #include "pivottable.h" -#include "querytable.h" +#include "tquerytable.h" #undef private using namespace reports; @@ -58,35 +58,35 @@ const MyMoneyMoney moChild(14.00); const MyMoneyMoney moThomas(5.11); const MyMoneyMoney moNoPayee(8944.70); -QString acAsset; -QString acLiability; -QString acExpense; -QString acIncome; -QString acChecking; -QString acCredit; -QString acSolo; -QString acParent; -QString acChild; -QString acSecondChild; -QString acGrandChild1; -QString acGrandChild2; -QString acForeign; -QString acCanChecking; -QString acJpyChecking; -QString acCanCash; -QString acJpyCash; -QString inBank; -QString eqStock1; -QString eqStock2; -QString acInvestment; -QString acStock1; -QString acStock2; -QString acDividends; -QString acInterest; -QString acTax; -QString acCash; - -TransactionHelper::TransactionHelper( const QDate& _date, const QString& _action, MyMoneyMoney _value, const QString& _accountid, const QString& _categoryid, const QString& _currencyid, const QString& _payee ) +TQString acAsset; +TQString acLiability; +TQString acExpense; +TQString acIncome; +TQString acChecking; +TQString acCredit; +TQString acSolo; +TQString acParent; +TQString acChild; +TQString acSecondChild; +TQString acGrandChild1; +TQString acGrandChild2; +TQString acForeign; +TQString acCanChecking; +TQString acJpyChecking; +TQString acCanCash; +TQString acJpyCash; +TQString inBank; +TQString eqStock1; +TQString eqStock2; +TQString acInvestment; +TQString acStock1; +TQString acStock2; +TQString acDividends; +TQString acInterest; +TQString acTax; +TQString acCash; + +TransactionHelper::TransactionHelper( const TQDate& _date, const TQString& _action, MyMoneyMoney _value, const TQString& _accountid, const TQString& _categoryid, const TQString& _currencyid, const TQString& _payee ) { // _currencyid is the currency of the transaction, and of the _value // both the account and category can have their own currency (athough the category having @@ -100,7 +100,7 @@ TransactionHelper::TransactionHelper( const QDate& _date, const QString& _action MyMoneyFileTransaction ft; setPostDate(_date); - QString currencyid = _currencyid; + TQString currencyid = _currencyid; if ( currencyid.isEmpty() ) currencyid=MyMoneyFile::instance()->baseCurrency().id(); setCommodity(currencyid); @@ -144,12 +144,12 @@ void TransactionHelper::update(void) ft.commit(); } -InvTransactionHelper::InvTransactionHelper( const QDate& _date, const QString& _action, MyMoneyMoney _shares, MyMoneyMoney _price, const QString& _stockaccountid, const QString& _transferid, const QString& _categoryid ) +InvTransactionHelper::InvTransactionHelper( const TQDate& _date, const TQString& _action, MyMoneyMoney _shares, MyMoneyMoney _price, const TQString& _stockaccountid, const TQString& _transferid, const TQString& _categoryid ) { init(_date, _action, _shares, _price, _stockaccountid, _transferid, _categoryid); } -void InvTransactionHelper::init( const QDate& _date, const QString& _action, MyMoneyMoney _shares, MyMoneyMoney _price, const QString& _stockaccountid, const QString& _transferid, const QString& _categoryid ) +void InvTransactionHelper::init( const TQDate& _date, const TQString& _action, MyMoneyMoney _shares, MyMoneyMoney _price, const TQString& _stockaccountid, const TQString& _transferid, const TQString& _categoryid ) { MyMoneyFile* file = MyMoneyFile::instance(); MyMoneyAccount stockaccount = file->account(_stockaccountid); @@ -216,8 +216,8 @@ void InvTransactionHelper::init( const QDate& _date, const QString& _action, MyM //kdDebug(2) << "updating price..." << endl; // update the price, while we're here - QString stockid = stockaccount.currencyId(); - QString basecurrencyid = file->baseCurrency().id(); + TQString stockid = stockaccount.currencyId(); + TQString basecurrencyid = file->baseCurrency().id(); MyMoneyPrice price = file->price( stockid, basecurrencyid, _date, true ); if ( !price.isValid() ) { @@ -228,7 +228,7 @@ void InvTransactionHelper::init( const QDate& _date, const QString& _action, MyM //kdDebug(2) << "successfully added " << id() << endl; } -QString makeAccount( const QString& _name, MyMoneyAccount::accountTypeE _type, MyMoneyMoney _balance, const QDate& _open, const QString& _parent, QString _currency, bool _taxReport ) +TQString makeAccount( const TQString& _name, MyMoneyAccount::accountTypeE _type, MyMoneyMoney _balance, const TQDate& _open, const TQString& _parent, TQString _currency, bool _taxReport ) { MyMoneyAccount info; MyMoneyFileTransaction ft; @@ -244,8 +244,8 @@ QString makeAccount( const QString& _name, MyMoneyAccount::accountTypeE _type, M if(_taxReport) info.setValue("Tax", "Yes"); - MyMoneyAccount parent = MyMoneyFile::instance()->account(_parent); - MyMoneyFile::instance()->addAccount( info, parent ); + MyMoneyAccount tqparent = MyMoneyFile::instance()->account(_parent); + MyMoneyFile::instance()->addAccount( info, tqparent ); // create the opening balance transaction if any if(!_balance.isZero()) { MyMoneySecurity sec = MyMoneyFile::instance()->currency(info.currencyId()); @@ -257,7 +257,7 @@ QString makeAccount( const QString& _name, MyMoneyAccount::accountTypeE _type, M return info.id(); } -void makePrice(const QString& _currencyid, const QDate& _date, const MyMoneyMoney& _price ) +void makePrice(const TQString& _currencyid, const TQDate& _date, const MyMoneyMoney& _price ) { MyMoneyFileTransaction ft; MyMoneyFile* file = MyMoneyFile::instance(); @@ -267,7 +267,7 @@ void makePrice(const QString& _currencyid, const QDate& _date, const MyMoneyMone ft.commit(); } -QString makeEquity(const QString& _name, const QString& _symbol ) +TQString makeEquity(const TQString& _name, const TQString& _symbol ) { MyMoneySecurity equity; MyMoneyFileTransaction ft; @@ -282,11 +282,11 @@ QString makeEquity(const QString& _name, const QString& _symbol ) return equity.id(); } -void makeEquityPrice(const QString& _id, const QDate& _date, const MyMoneyMoney& _price ) +void makeEquityPrice(const TQString& _id, const TQDate& _date, const MyMoneyMoney& _price ) { MyMoneyFile* file = MyMoneyFile::instance(); MyMoneyFileTransaction ft; - QString basecurrencyid = file->baseCurrency().id(); + TQString basecurrencyid = file->baseCurrency().id(); MyMoneyPrice price = file->price( _id, basecurrencyid, _date, true ); if ( !price.isValid() ) { @@ -296,114 +296,114 @@ void makeEquityPrice(const QString& _id, const QDate& _date, const MyMoneyMoney& ft.commit(); } -void writeRCFtoXMLDoc( const MyMoneyReport& filter, QDomDocument* doc ) +void writeRCFtoXMLDoc( const MyMoneyReport& filter, TQDomDocument* doc ) { - QDomProcessingInstruction instruct = doc->createProcessingInstruction(QString("xml"), QString("version=\"1.0\" encoding=\"utf-8\"")); + TQDomProcessingInstruction instruct = doc->createProcessingInstruction(TQString("xml"), TQString("version=\"1.0\" encoding=\"utf-8\"")); doc->appendChild(instruct); - QDomElement root = doc->createElement("KMYMONEY-FILE"); + TQDomElement root = doc->createElement("KMYMONEY-FILE"); doc->appendChild(root); - QDomElement reports = doc->createElement("REPORTS"); + TQDomElement reports = doc->createElement("REPORTS"); root.appendChild(reports); - QDomElement report = doc->createElement("REPORT"); + TQDomElement report = doc->createElement("REPORT"); filter.write(report,doc); reports.appendChild(report); } -void writeTabletoHTML( const PivotTable& table, const QString& _filename ) +void writeTabletoHTML( const PivotTable& table, const TQString& _filename ) { static unsigned filenumber = 1; - QString filename = _filename; + TQString filename = _filename; if ( filename.isEmpty() ) { - filename = QString("report-%1%2.html").arg((filenumber<10)?"0":"").arg(filenumber); + filename = TQString("report-%1%2.html").tqarg((filenumber<10)?"0":"").tqarg(filenumber); ++filenumber; } - QFile g( filename ); + TQFile g( filename ); g.open( IO_WriteOnly ); - QTextStream(&g) << table.renderHTML(); + TQTextStream(&g) << table.renderHTML(); g.close(); } -void writeTabletoHTML( const QueryTable& table, const QString& _filename ) +void writeTabletoHTML( const QueryTable& table, const TQString& _filename ) { static unsigned filenumber = 1; - QString filename = _filename; + TQString filename = _filename; if ( filename.isEmpty() ) { - filename = QString("report-%1%2.html").arg((filenumber<10)?"0":"").arg(filenumber); + filename = TQString("report-%1%2.html").tqarg((filenumber<10)?"0":"").tqarg(filenumber); ++filenumber; } - QFile g( filename ); + TQFile g( filename ); g.open( IO_WriteOnly ); - QTextStream(&g) << table.renderHTML(); + TQTextStream(&g) << table.renderHTML(); g.close(); } -void writeTabletoCSV( const PivotTable& table, const QString& _filename ) +void writeTabletoCSV( const PivotTable& table, const TQString& _filename ) { static unsigned filenumber = 1; - QString filename = _filename; + TQString filename = _filename; if ( filename.isEmpty() ) { - filename = QString("report-%1%2.csv").arg((filenumber<10)?"0":"").arg(filenumber); + filename = TQString("report-%1%2.csv").tqarg((filenumber<10)?"0":"").tqarg(filenumber); ++filenumber; } - QFile g( filename ); + TQFile g( filename ); g.open( IO_WriteOnly ); - QTextStream(&g) << table.renderCSV(); + TQTextStream(&g) << table.renderCSV(); g.close(); } -void writeTabletoCSV( const QueryTable& table, const QString& _filename ) +void writeTabletoCSV( const QueryTable& table, const TQString& _filename ) { static unsigned filenumber = 1; - QString filename = _filename; + TQString filename = _filename; if ( filename.isEmpty() ) { - filename = QString("qreport-%1%2.csv").arg((filenumber<10)?"0":"").arg(filenumber); + filename = TQString("qreport-%1%2.csv").tqarg((filenumber<10)?"0":"").tqarg(filenumber); ++filenumber; } - QFile g( filename ); + TQFile g( filename ); g.open( IO_WriteOnly ); - QTextStream(&g) << table.renderCSV(); + TQTextStream(&g) << table.renderCSV(); g.close(); } -void writeRCFtoXML( const MyMoneyReport& filter, const QString& _filename ) +void writeRCFtoXML( const MyMoneyReport& filter, const TQString& _filename ) { static unsigned filenum = 1; - QString filename = _filename; + TQString filename = _filename; if ( filename.isEmpty() ) { - filename = QString("report-%1%2.xml").arg(QString::number(filenum).rightJustify(2, '0')); + filename = TQString("report-%1%2.xml").tqarg(TQString::number(filenum).rightJustify(2, '0')); ++filenum; } - QDomDocument* doc = new QDomDocument("KMYMONEY-FILE"); + TQDomDocument* doc = new TQDomDocument("KMYMONEY-FILE"); Q_CHECK_PTR(doc); writeRCFtoXMLDoc(filter,doc); - QFile g( filename ); + TQFile g( filename ); g.open( IO_WriteOnly ); - QTextStream stream(&g); + TQTextStream stream(&g); #if KDE_IS_VERSION(3,2,0) - stream.setEncoding(QTextStream::UnicodeUTF8); + stream.setEncoding(TQTextStream::UnicodeUTF8); stream << doc->toString(); #else - //stream.setEncoding(QTextStream::Locale); - QString temp = doc->toString(); + //stream.setEncoding(TQTextStream::Locale); + TQString temp = doc->toString(); stream << temp.data(); #endif g.close(); @@ -411,21 +411,21 @@ void writeRCFtoXML( const MyMoneyReport& filter, const QString& _filename ) delete doc; } -bool readRCFfromXMLDoc( QValueList<MyMoneyReport>& list, QDomDocument* doc ) +bool readRCFfromXMLDoc( TQValueList<MyMoneyReport>& list, TQDomDocument* doc ) { bool result = false; - QDomElement rootElement = doc->documentElement(); + TQDomElement rootElement = doc->documentElement(); if(!rootElement.isNull()) { - QDomNode child = rootElement.firstChild(); + TQDomNode child = rootElement.firstChild(); while(!child.isNull() && child.isElement()) { - QDomElement childElement = child.toElement(); + TQDomElement childElement = child.toElement(); if("REPORTS" == childElement.tagName()) { result = true; - QDomNode subchild = child.firstChild(); + TQDomNode subchild = child.firstChild(); while(!subchild.isNull() && subchild.isElement()) { MyMoneyReport filter; @@ -442,12 +442,12 @@ bool readRCFfromXMLDoc( QValueList<MyMoneyReport>& list, QDomDocument* doc ) return result; } -bool readRCFfromXML( QValueList<MyMoneyReport>& list, const QString& filename ) +bool readRCFfromXML( TQValueList<MyMoneyReport>& list, const TQString& filename ) { int result = false; - QFile f( filename ); + TQFile f( filename ); f.open( IO_ReadOnly ); - QDomDocument* doc = new QDomDocument; + TQDomDocument* doc = new TQDomDocument; if(doc->setContent(&f, FALSE)) { result = readRCFfromXMLDoc(list,doc); @@ -465,11 +465,11 @@ void XMLandback( MyMoneyReport& filter ) // in all cases, the result should be the same if the read // & write methods are working correctly. - QDomDocument* doc = new QDomDocument("KMYMONEY-FILE"); + TQDomDocument* doc = new TQDomDocument("KMYMONEY-FILE"); Q_CHECK_PTR(doc); writeRCFtoXMLDoc(filter,doc); - QValueList<MyMoneyReport> list; + TQValueList<MyMoneyReport> list; if ( readRCFfromXMLDoc(list,doc) && list.count() > 0 ) filter = list[0]; else @@ -479,11 +479,11 @@ void XMLandback( MyMoneyReport& filter ) } -MyMoneyMoney searchHTML(const QString& _html, const QString& _search) +MyMoneyMoney searchHTML(const TQString& _html, const TQString& _search) { - QRegExp re(QString("%1[<>/td]*([\\-.0-9,]*)").arg(_search)); + TQRegExp re(TQString("%1[<>/td]*([\\-.0-9,]*)").tqarg(_search)); re.search(_html); - QString found = re.cap(1); + TQString found = re.cap(1); found.remove(','); return MyMoneyMoney(found.toDouble()); |