summaryrefslogtreecommitdiffstats
path: root/kmymoney2/mymoney/mymoneytransaction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmymoney2/mymoney/mymoneytransaction.cpp')
-rw-r--r--kmymoney2/mymoney/mymoneytransaction.cpp150
1 files changed, 75 insertions, 75 deletions
diff --git a/kmymoney2/mymoney/mymoneytransaction.cpp b/kmymoney2/mymoney/mymoneytransaction.cpp
index 10b4c08..662a9c8 100644
--- a/kmymoney2/mymoney/mymoneytransaction.cpp
+++ b/kmymoney2/mymoney/mymoneytransaction.cpp
@@ -29,25 +29,25 @@ MyMoneyTransaction::MyMoneyTransaction() :
MyMoneyObject()
{
m_nextSplitID = 1;
- m_entryDate = QDate();
- m_postDate = QDate();
+ m_entryDate = TQDate();
+ m_postDate = TQDate();
}
-MyMoneyTransaction::MyMoneyTransaction(const QString id, const MyMoneyTransaction& transaction) :
+MyMoneyTransaction::MyMoneyTransaction(const TQString id, const MyMoneyTransaction& transaction) :
MyMoneyObject(id)
{
*this = transaction;
m_id = id;
- if(m_entryDate == QDate())
- m_entryDate = QDate::currentDate();
+ if(m_entryDate == TQDate())
+ m_entryDate = TQDate::tqcurrentDate();
- QValueList<MyMoneySplit>::Iterator it;
+ TQValueList<MyMoneySplit>::Iterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
(*it).setTransactionId(id);
}
}
-MyMoneyTransaction::MyMoneyTransaction(const QDomElement& node, const bool forceId) :
+MyMoneyTransaction::MyMoneyTransaction(const TQDomElement& node, const bool forceId) :
MyMoneyObject(node, forceId)
{
if("TRANSACTION" != node.tagName())
@@ -57,17 +57,17 @@ MyMoneyTransaction::MyMoneyTransaction(const QDomElement& node, const bool force
m_postDate = stringToDate(node.attribute("postdate"));
m_entryDate = stringToDate(node.attribute("entrydate"));
- m_bankID = QStringEmpty(node.attribute("bankid"));
- m_memo = QStringEmpty(node.attribute("memo"));
- m_commodity = QStringEmpty(node.attribute("commodity"));
+ m_bankID = TQStringEmpty(node.attribute("bankid"));
+ m_memo = TQStringEmpty(node.attribute("memo"));
+ m_commodity = TQStringEmpty(node.attribute("commodity"));
- QDomNode child = node.firstChild();
+ TQDomNode child = node.firstChild();
while ( !child.isNull() && child.isElement() )
{
- QDomElement c = child.toElement();
+ TQDomElement c = child.toElement();
if(c.tagName() == "SPLITS") {
// Process any split information found inside the transaction entry.
- QDomNodeList nodeList = c.elementsByTagName("SPLIT");
+ TQDomNodeList nodeList = c.elementsByTagName("SPLIT");
for(unsigned int i = 0; i < nodeList.count(); ++i) {
MyMoneySplit s(nodeList.item(i).toElement());
if(!m_bankID.isEmpty())
@@ -84,7 +84,7 @@ MyMoneyTransaction::MyMoneyTransaction(const QDomElement& node, const bool force
}
child = child.nextSibling();
}
- m_bankID = QString();
+ m_bankID = TQString();
}
MyMoneyTransaction::~MyMoneyTransaction()
@@ -102,9 +102,9 @@ bool MyMoneyTransaction::operator == (const MyMoneyTransaction& right) const
(m_postDate == right.m_postDate) );
}
-bool MyMoneyTransaction::accountReferenced(const QString& id) const
+bool MyMoneyTransaction::accountReferenced(const TQString& id) const
{
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
if((*it).accountId() == id)
@@ -119,7 +119,7 @@ void MyMoneyTransaction::addSplit(MyMoneySplit& split)
throw new MYMONEYEXCEPTION("Cannot add split with assigned id (" + split.id() + ")");
/*
- QValueList<MyMoneySplit>::Iterator it;
+ TQValueList<MyMoneySplit>::Iterator it;
// if the account referenced in this split is already
// referenced in another split, we add the amount of
@@ -151,9 +151,9 @@ void MyMoneyTransaction::modifySplit(MyMoneySplit& split)
// by another split, the values will be added and the
// duplicate removed.
/*
- QValueList<MyMoneySplit>::Iterator it;
- QValueList<MyMoneySplit>::Iterator self = m_splits.end();
- QValueList<MyMoneySplit>::Iterator dup = self;
+ TQValueList<MyMoneySplit>::Iterator it;
+ TQValueList<MyMoneySplit>::Iterator self = m_splits.end();
+ TQValueList<MyMoneySplit>::Iterator dup = self;
bool duplicateAccount = false;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
@@ -181,19 +181,19 @@ void MyMoneyTransaction::modifySplit(MyMoneySplit& split)
if(split.accountId().isEmpty())
throw new MYMONEYEXCEPTION("Cannot modify split that does not contain an account reference");
- QValueList<MyMoneySplit>::Iterator it;
+ TQValueList<MyMoneySplit>::Iterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
if(split.id() == (*it).id()) {
*it = split;
return;
}
}
- throw new MYMONEYEXCEPTION(QString("Invalid split id '%1'").arg(split.id()));
+ throw new MYMONEYEXCEPTION(TQString("Invalid split id '%1'").tqarg(split.id()));
}
void MyMoneyTransaction::removeSplit(const MyMoneySplit& split)
{
- QValueList<MyMoneySplit>::Iterator it;
+ TQValueList<MyMoneySplit>::Iterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
if(split.id() == (*it).id()) {
@@ -202,7 +202,7 @@ void MyMoneyTransaction::removeSplit(const MyMoneySplit& split)
}
}
if(it == m_splits.end())
- throw new MYMONEYEXCEPTION(QString("Invalid split id '%1'").arg(split.id()));
+ throw new MYMONEYEXCEPTION(TQString("Invalid split id '%1'").tqarg(split.id()));
}
void MyMoneyTransaction::removeSplits(void)
@@ -211,20 +211,20 @@ void MyMoneyTransaction::removeSplits(void)
m_nextSplitID = 1;
}
-const MyMoneySplit& MyMoneyTransaction::splitByPayee(const QString& payeeId) const
+const MyMoneySplit& MyMoneyTransaction::splitByPayee(const TQString& payeeId) const
{
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
if((*it).payeeId() == payeeId)
return *it;
}
- throw new MYMONEYEXCEPTION(QString("Split not found for payee '%1'").arg(QString(payeeId)));
+ throw new MYMONEYEXCEPTION(TQString("Split not found for payee '%1'").tqarg(TQString(payeeId)));
}
-const MyMoneySplit& MyMoneyTransaction::splitByAccount(const QString& accountId, const bool match) const
+const MyMoneySplit& MyMoneyTransaction::splitByAccount(const TQString& accountId, const bool match) const
{
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
if(match == true && (*it).accountId() == accountId)
@@ -232,51 +232,51 @@ const MyMoneySplit& MyMoneyTransaction::splitByAccount(const QString& accountId,
if(match == false && (*it).accountId() != accountId)
return *it;
}
- throw new MYMONEYEXCEPTION(QString("Split not found for account %1%2").arg(match?"":"!").arg(QString(accountId)));
+ throw new MYMONEYEXCEPTION(TQString("Split not found for account %1%2").tqarg(match?"":"!").tqarg(TQString(accountId)));
}
-const MyMoneySplit& MyMoneyTransaction::splitByAccount(const QStringList& accountIds, const bool match) const
+const MyMoneySplit& MyMoneyTransaction::splitByAccount(const TQStringList& accountIds, const bool match) const
{
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
- if(match == true && accountIds.contains((*it).accountId()) )
+ if(match == true && accountIds.tqcontains((*it).accountId()) )
return *it;
- if(match == false && !accountIds.contains((*it).accountId()))
+ if(match == false && !accountIds.tqcontains((*it).accountId()))
return *it;
}
- throw new MYMONEYEXCEPTION(QString("Split not found for account %1%1...%2").arg(match?"":"!").arg(accountIds.front(),accountIds.back()));
+ throw new MYMONEYEXCEPTION(TQString("Split not found for account %1%1...%2").tqarg(match?"":"!").tqarg(accountIds.front(),accountIds.back()));
}
-const MyMoneySplit& MyMoneyTransaction::splitById(const QString& splitId) const
+const MyMoneySplit& MyMoneyTransaction::splitById(const TQString& splitId) const
{
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
if((*it).id() == splitId)
return *it;
}
- throw new MYMONEYEXCEPTION(QString("Split not found for id '%1'").arg(QString(splitId)));
+ throw new MYMONEYEXCEPTION(TQString("Split not found for id '%1'").tqarg(TQString(splitId)));
}
-const QString MyMoneyTransaction::nextSplitID()
+const TQString MyMoneyTransaction::nextSplitID()
{
- QString id;
- id = "S" + id.setNum(m_nextSplitID++).rightJustify(SPLIT_ID_SIZE, '0');
+ TQString id;
+ id = "S" + TQString(id.setNum(m_nextSplitID++)).rightJustify(SPLIT_ID_SIZE, '0');
return id;
}
-const QString MyMoneyTransaction::firstSplitID()
+const TQString MyMoneyTransaction::firstSplitID()
{
- QString id;
- id = "S" + id.setNum(1).rightJustify(SPLIT_ID_SIZE, '0');
+ TQString id;
+ id = "S" + TQString(id.setNum(1)).rightJustify(SPLIT_ID_SIZE, '0');
return id;
}
const MyMoneyMoney MyMoneyTransaction::splitSum(void) const
{
MyMoneyMoney result(0);
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
result += (*it).value();
@@ -284,14 +284,14 @@ const MyMoneyMoney MyMoneyTransaction::splitSum(void) const
return result;
}
-void MyMoneyTransaction::setPostDate(const QDate& date) { m_postDate = date; }
-void MyMoneyTransaction::setEntryDate(const QDate& date) { m_entryDate = date; }
-void MyMoneyTransaction::setMemo(const QString& memo) { m_memo = memo; }
+void MyMoneyTransaction::setPostDate(const TQDate& date) { m_postDate = date; }
+void MyMoneyTransaction::setEntryDate(const TQDate& date) { m_entryDate = date; }
+void MyMoneyTransaction::setMemo(const TQString& memo) { m_memo = memo; }
bool MyMoneyTransaction::isLoanPayment(void) const
{
try {
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
if((*it).isAmortizationSplit())
@@ -307,7 +307,7 @@ const MyMoneySplit& MyMoneyTransaction::amortizationSplit(void) const
{
static MyMoneySplit nullSplit;
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
if((*it).isAmortizationSplit() && (*it).isAutoCalc())
@@ -320,7 +320,7 @@ const MyMoneySplit& MyMoneyTransaction::interestSplit(void) const
{
static MyMoneySplit nullSplit;
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
if((*it).isInterestSplit() && (*it).isAutoCalc())
@@ -329,12 +329,12 @@ const MyMoneySplit& MyMoneyTransaction::interestSplit(void) const
return nullSplit;
}
-unsigned long MyMoneyTransaction::hash(const QString& txt, unsigned long h)
+unsigned long MyMoneyTransaction::hash(const TQString& txt, unsigned long h)
{
unsigned long g;
for(unsigned i=0; i < txt.length(); ++i) {
- unsigned short uc = txt[i].unicode();
+ unsigned short uc = txt[i].tqunicode();
for(unsigned j = 0; j < 2; ++j) {
unsigned char c = uc & 0xff;
// if either the cell or the row of the Unicode char is 0, stop processing
@@ -358,7 +358,7 @@ bool MyMoneyTransaction::isStockSplit(void) const
bool MyMoneyTransaction::isImported(void) const
{
- return value("Imported").lower() == QString("true");
+ return value("Imported").lower() == TQString("true");
}
void MyMoneyTransaction::setImported(bool state)
@@ -384,7 +384,7 @@ bool MyMoneyTransaction::isDuplicate(const MyMoneyTransaction& r) const
for(int i = 0; i < 2; ++i)
accHash[i] = valHash[i] = numHash[i] = 0;
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = splits().begin(); it != splits().end(); ++it) {
accHash[0] += hash((*it).accountId());
valHash[0] += hash((*it).value().formatMoney("", 4));
@@ -408,9 +408,9 @@ bool MyMoneyTransaction::isDuplicate(const MyMoneyTransaction& r) const
return rc;
}
-void MyMoneyTransaction::writeXML(QDomDocument& document, QDomElement& parent) const
+void MyMoneyTransaction::writeXML(TQDomDocument& document, TQDomElement& tqparent) const
{
- QDomElement el = document.createElement("TRANSACTION");
+ TQDomElement el = document.createElement("TRANSACTION");
writeBaseXML(document, el);
@@ -419,8 +419,8 @@ void MyMoneyTransaction::writeXML(QDomDocument& document, QDomElement& parent) c
el.setAttribute("entrydate", dateToString(m_entryDate));
el.setAttribute("commodity", m_commodity);
- QDomElement splits = document.createElement("SPLITS");
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQDomElement splits = document.createElement("SPLITS");
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
(*it).writeXML(document, splits);
}
@@ -428,12 +428,12 @@ void MyMoneyTransaction::writeXML(QDomDocument& document, QDomElement& parent) c
MyMoneyKeyValueContainer::writeXML(document, el);
- parent.appendChild(el);
+ tqparent.appendChild(el);
}
-bool MyMoneyTransaction::hasReferenceTo(const QString& id) const
+bool MyMoneyTransaction::hasReferenceTo(const TQString& id) const
{
- QValueList<MyMoneySplit>::const_iterator it;
+ TQValueList<MyMoneySplit>::const_iterator it;
bool rc = (id == m_commodity);
for(it = m_splits.begin(); rc == false && it != m_splits.end(); ++it) {
rc = (*it).hasReferenceTo(id);
@@ -443,7 +443,7 @@ bool MyMoneyTransaction::hasReferenceTo(const QString& id) const
bool MyMoneyTransaction::hasAutoCalcSplit(void) const
{
- QValueList<MyMoneySplit>::ConstIterator it;
+ TQValueList<MyMoneySplit>::ConstIterator it;
for(it = m_splits.begin(); it != m_splits.end(); ++it) {
if((*it).isAutoCalc())
@@ -452,33 +452,33 @@ bool MyMoneyTransaction::hasAutoCalcSplit(void) const
return false;
}
-QString MyMoneyTransaction::accountSignature(bool includeSplitCount) const
+TQString MyMoneyTransaction::accountSignature(bool includeSplitCount) const
{
- QMap<QString, int> accountList;
- QValueList<MyMoneySplit>::const_iterator it_s;
+ TQMap<TQString, int> accountList;
+ TQValueList<MyMoneySplit>::const_iterator it_s;
for(it_s = m_splits.begin(); it_s != m_splits.end(); ++it_s) {
accountList[(*it_s).accountId()] += 1;
}
- QMap<QString, int>::const_iterator it_a;
- QString rc;
+ TQMap<TQString, int>::const_iterator it_a;
+ TQString rc;
for(it_a = accountList.begin(); it_a != accountList.end(); ++it_a) {
if(it_a != accountList.begin())
rc += "-";
rc += it_a.key();
if(includeSplitCount)
- rc += QString("*%1").arg(*it_a);
+ rc += TQString("*%1").tqarg(*it_a);
}
return rc;
}
-QString MyMoneyTransaction::uniqueSortKey(void) const
+TQString MyMoneyTransaction::uniqueSortKey(void) const
{
- QString year, month, day, key;
- const QDate& postdate = postDate();
- year = year.setNum(postdate.year()).rightJustify(YEAR_SIZE, '0');
- month = month.setNum(postdate.month()).rightJustify(MONTH_SIZE, '0');
- day = day.setNum(postdate.day()).rightJustify(DAY_SIZE, '0');
+ TQString year, month, day, key;
+ const TQDate& postdate = postDate();
+ year = TQString(year.setNum(postdate.year())).rightJustify(YEAR_SIZE, '0');
+ month = TQString(month.setNum(postdate.month())).rightJustify(MONTH_SIZE, '0');
+ day = TQString(day.setNum(postdate.day())).rightJustify(DAY_SIZE, '0');
key = year + "-" + month + "-" + day + "-" + m_id;
return key;
}