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/mymoney/mymoneystatement.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/mymoney/mymoneystatement.cpp')
-rw-r--r-- | kmymoney2/mymoney/mymoneystatement.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/kmymoney2/mymoney/mymoneystatement.cpp b/kmymoney2/mymoney/mymoneystatement.cpp index 0373863..3756520 100644 --- a/kmymoney2/mymoney/mymoneystatement.cpp +++ b/kmymoney2/mymoney/mymoneystatement.cpp @@ -24,10 +24,10 @@ // ---------------------------------------------------------------------------- // QT Includes -#include <qdom.h> -#include <qstringlist.h> -#include <qfile.h> -#include <qtextstream.h> +#include <tqdom.h> +#include <tqstringlist.h> +#include <tqfile.h> +#include <tqtextstream.h> // ---------------------------------------------------------------------------- // Project Includes @@ -35,12 +35,12 @@ #include "../../kdecompat.h" #include "mymoneystatement.h" -const QStringList kAccountTypeTxt = QStringList::split(",","none,checkings,savings,investment,creditcard,invalid"); -const QStringList kActionText = QStringList::split(",","none,buy,sell,reinvestdividend,cashdividend,add,remove,stocksplit,fees,interest,invalid"); +const TQStringList kAccountTypeTxt = TQStringList::split(",","none,checkings,savings,investment,creditcard,invalid"); +const TQStringList kActionText = TQStringList::split(",","none,buy,sell,reinvestdividend,cashdividend,add,remove,stocksplit,fees,interest,invalid"); -void MyMoneyStatement::write(QDomElement& _root,QDomDocument* _doc) const +void MyMoneyStatement::write(TQDomElement& _root,TQDomDocument* _doc) const { - QDomElement e = _doc->createElement("STATEMENT"); + TQDomElement e = _doc->createElement("STATEMENT"); _root.appendChild(e); e.setAttribute("version","1.1"); @@ -56,10 +56,10 @@ void MyMoneyStatement::write(QDomElement& _root,QDomDocument* _doc) const e.setAttribute("skipCategoryMatching", m_skipCategoryMatching); // iterate over transactions, and add each one - QValueList<Transaction>::const_iterator it_t = m_listTransactions.begin(); + TQValueList<Transaction>::const_iterator it_t = m_listTransactions.begin(); while ( it_t != m_listTransactions.end() ) { - QDomElement p = _doc->createElement("TRANSACTION"); + TQDomElement p = _doc->createElement("TRANSACTION"); p.setAttribute("dateposted", (*it_t).m_datePosted.toString(Qt::ISODate)); p.setAttribute("payee", (*it_t).m_strPayee); p.setAttribute("memo", (*it_t).m_strMemo); @@ -77,9 +77,9 @@ void MyMoneyStatement::write(QDomElement& _root,QDomDocument* _doc) const } // add all the splits we know of (might be empty) - QValueList<Split>::const_iterator it_s; + TQValueList<Split>::const_iterator it_s; for(it_s = (*it_t).m_listSplits.begin(); it_s != (*it_t).m_listSplits.end(); ++it_s) { - QDomElement split = _doc->createElement("SPLIT"); + TQDomElement split = _doc->createElement("SPLIT"); split.setAttribute("accountid", (*it_s).m_accountId); split.setAttribute("amount", (*it_s).m_amount.toString()); split.setAttribute("reconcile", (*it_s).m_reconcile); @@ -95,10 +95,10 @@ void MyMoneyStatement::write(QDomElement& _root,QDomDocument* _doc) const } // iterate over prices, and add each one - QValueList<Price>::const_iterator it_p = m_listPrices.begin(); + TQValueList<Price>::const_iterator it_p = m_listPrices.begin(); while ( it_p != m_listPrices.end() ) { - QDomElement p = _doc->createElement("PRICE"); + TQDomElement p = _doc->createElement("PRICE"); p.setAttribute("dateposted", (*it_p).m_date.toString(Qt::ISODate)); p.setAttribute("security", (*it_p).m_strSecurity); p.setAttribute("amount", (*it_p).m_amount.toString()); @@ -109,10 +109,10 @@ void MyMoneyStatement::write(QDomElement& _root,QDomDocument* _doc) const } // iterate over securities, and add each one - QValueList<Security>::const_iterator it_s = m_listSecurities.begin(); + TQValueList<Security>::const_iterator it_s = m_listSecurities.begin(); while ( it_s != m_listSecurities.end() ) { - QDomElement p = _doc->createElement("SECURITY"); + TQDomElement p = _doc->createElement("SECURITY"); p.setAttribute("name", (*it_s).m_strName); p.setAttribute("symbol", (*it_s).m_strSymbol); p.setAttribute("id", (*it_s).m_strId); @@ -124,7 +124,7 @@ void MyMoneyStatement::write(QDomElement& _root,QDomDocument* _doc) const } -bool MyMoneyStatement::read(const QDomElement& _e) +bool MyMoneyStatement::read(const TQDomElement& _e) { bool result = false; @@ -136,33 +136,33 @@ bool MyMoneyStatement::read(const QDomElement& _e) m_strAccountNumber = _e.attribute("accountnumber"); m_strRoutingNumber = _e.attribute("routingnumber"); m_strCurrency = _e.attribute("currency"); - m_dateBegin = QDate::fromString(_e.attribute("begindate"),Qt::ISODate); - m_dateEnd = QDate::fromString(_e.attribute("enddate"),Qt::ISODate); + m_dateBegin = TQDate::fromString(_e.attribute("begindate"),Qt::ISODate); + m_dateEnd = TQDate::fromString(_e.attribute("enddate"),Qt::ISODate); m_closingBalance = MyMoneyMoney(_e.attribute("closingbalance")); m_accountId = _e.attribute("accountid"); m_skipCategoryMatching = _e.attribute("skipCategoryMatching"); - int i = kAccountTypeTxt.findIndex(_e.attribute("type",kAccountTypeTxt[1])); + int i = kAccountTypeTxt.tqfindIndex(_e.attribute("type",kAccountTypeTxt[1])); if ( i != -1 ) m_eType = static_cast<EType>(i); - QDomNode child = _e.firstChild(); + TQDomNode child = _e.firstChild(); while(!child.isNull() && child.isElement()) { - QDomElement c = child.toElement(); + TQDomElement c = child.toElement(); if ( c.tagName() == "TRANSACTION" ) { MyMoneyStatement::Transaction t; - t.m_datePosted = QDate::fromString(c.attribute("dateposted"),Qt::ISODate); + t.m_datePosted = TQDate::fromString(c.attribute("dateposted"),Qt::ISODate); t.m_amount = MyMoneyMoney(c.attribute("amount")); t.m_strMemo = c.attribute("memo"); t.m_strNumber = c.attribute("number"); t.m_strPayee = c.attribute("payee"); t.m_strBankID = c.attribute("bankid"); t.m_reconcile = static_cast<MyMoneySplit::reconcileFlagE>(c.attribute("reconcile").toInt()); - int i = kActionText.findIndex(c.attribute("action",kActionText[1])); + int i = kActionText.tqfindIndex(c.attribute("action",kActionText[1])); if ( i != -1 ) t.m_eAction = static_cast<Transaction::EAction>(i); @@ -174,9 +174,9 @@ bool MyMoneyStatement::read(const QDomElement& _e) } // process splits (if any) - QDomNode child = c.firstChild(); + TQDomNode child = c.firstChild(); while(!child.isNull() && child.isElement()) { - QDomElement c = child.toElement(); + TQDomElement c = child.toElement(); if(c.tagName() == "SPLIT") { MyMoneyStatement::Split s; s.m_accountId = c.attribute("accountid"); @@ -194,7 +194,7 @@ bool MyMoneyStatement::read(const QDomElement& _e) { MyMoneyStatement::Price p; - p.m_date = QDate::fromString(c.attribute("dateposted"), Qt::ISODate); + p.m_date = TQDate::fromString(c.attribute("dateposted"), Qt::ISODate); p.m_strSecurity = c.attribute("security"); p.m_amount = MyMoneyMoney(c.attribute("amount")); @@ -217,20 +217,20 @@ bool MyMoneyStatement::read(const QDomElement& _e) return result; } -bool MyMoneyStatement::isStatementFile(const QString& _filename) +bool MyMoneyStatement::isStatementFile(const TQString& _filename) { - // filename is considered a statement file if it contains + // filename is considered a statement file if it tqcontains // the tag "<KMYMONEY2-STATEMENT>" in the first 20 lines. bool result = false; - QFile f( _filename ); + TQFile f( _filename ); if ( f.open( IO_ReadOnly ) ) { - QTextStream ts( &f ); + TQTextStream ts( &f ); int lineCount = 20; while ( !ts.atEnd() && !result && lineCount != 0) { - if ( ts.readLine().contains("<KMYMONEY-STATEMENT>",false) ) + if ( ts.readLine().tqcontains("<KMYMONEY-STATEMENT>",false) ) result = true; --lineCount; } @@ -240,29 +240,29 @@ bool MyMoneyStatement::isStatementFile(const QString& _filename) return result; } -void MyMoneyStatement::writeXMLFile( const MyMoneyStatement& _s, const QString& _filename ) +void MyMoneyStatement::writeXMLFile( const MyMoneyStatement& _s, const TQString& _filename ) { static unsigned filenum = 1; - QString filename = _filename; + TQString filename = _filename; if ( filename.isEmpty() ) { - filename = QString("statement-%1%2.xml").arg((filenum<10)?"0":"").arg(filenum); + filename = TQString("statement-%1%2.xml").tqarg((filenum<10)?"0":"").tqarg(filenum); filenum++; } - QDomDocument* doc = new QDomDocument("KMYMONEY-STATEMENT"); + TQDomDocument* doc = new TQDomDocument("KMYMONEY-STATEMENT"); Q_CHECK_PTR(doc); //writeStatementtoXMLDoc(_s,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 eroot = doc->createElement("KMYMONEY-STATEMENT"); + TQDomElement eroot = doc->createElement("KMYMONEY-STATEMENT"); doc->appendChild(eroot); _s.write(eroot,doc); - QFile g( filename ); + TQFile g( filename ); if(g.open( IO_WriteOnly )) { - QTextStream stream(&g); - stream.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream stream(&g); + stream.setEncoding(TQTextStream::UnicodeUTF8); stream << doc->toString(); g.close(); } @@ -270,22 +270,22 @@ void MyMoneyStatement::writeXMLFile( const MyMoneyStatement& _s, const QString& delete doc; } -bool MyMoneyStatement::readXMLFile( MyMoneyStatement& _s, const QString& _filename ) +bool MyMoneyStatement::readXMLFile( MyMoneyStatement& _s, const TQString& _filename ) { bool 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)) { - QDomElement rootElement = doc->documentElement(); + TQDomElement rootElement = doc->documentElement(); if(!rootElement.isNull()) { - QDomNode child = rootElement.firstChild(); + TQDomNode child = rootElement.firstChild(); while(!child.isNull() && child.isElement()) { result = true; - QDomElement childElement = child.toElement(); + TQDomElement childElement = child.toElement(); _s.read(childElement); child = child.nextSibling(); |