diff options
Diffstat (limited to 'kmymoney2/mymoney/mymoneybudget.cpp')
-rw-r--r-- | kmymoney2/mymoney/mymoneybudget.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/kmymoney2/mymoney/mymoneybudget.cpp b/kmymoney2/mymoney/mymoneybudget.cpp index 46b8ca8..3cb7793 100644 --- a/kmymoney2/mymoney/mymoneybudget.cpp +++ b/kmymoney2/mymoney/mymoneybudget.cpp @@ -22,8 +22,8 @@ // ---------------------------------------------------------------------------- // QT Includes -#include <qstring.h> -#include <qdom.h> +#include <tqstring.h> +#include <tqdom.h> // ---------------------------------------------------------------------------- // KDE Includes @@ -33,7 +33,7 @@ #include "mymoneybudget.h" -const QStringList MyMoneyBudget::AccountGroup::kBudgetLevelText = QStringList::split(",","none,monthly,monthbymonth,yearly,invalid",true); +const TQStringList MyMoneyBudget::AccountGroup::kBudgetLevelText = TQStringList::split(",","none,monthly,monthbymonth,yearly,invalid",true); const int BUDGET_VERSION = 2; bool MyMoneyBudget::AccountGroup::isZero(void) const @@ -80,7 +80,7 @@ void MyMoneyBudget::AccountGroup::convertToYearly(void) void MyMoneyBudget::AccountGroup::convertToMonthByMonth(void) { MyMoneyBudget::PeriodGroup period; - QDate date; + TQDate date; switch(m_budgetlevel) { case eMonthByMonth: @@ -126,14 +126,14 @@ MyMoneyBudget::AccountGroup MyMoneyBudget::AccountGroup::operator += (const MyMo // now both budgets should be of the same type and we simply need // to iterate over the period list and add the values - QMap<QDate, MyMoneyBudget::PeriodGroup> periods = m_periods; - QMap<QDate, MyMoneyBudget::PeriodGroup> rPeriods = r.m_periods; - QMap<QDate, MyMoneyBudget::PeriodGroup>::const_iterator it_p; - QMap<QDate, MyMoneyBudget::PeriodGroup>::const_iterator it_pr; + TQMap<TQDate, MyMoneyBudget::PeriodGroup> periods = m_periods; + TQMap<TQDate, MyMoneyBudget::PeriodGroup> rPeriods = r.m_periods; + TQMap<TQDate, MyMoneyBudget::PeriodGroup>::const_iterator it_p; + TQMap<TQDate, MyMoneyBudget::PeriodGroup>::const_iterator it_pr; m_periods.clear(); it_p = periods.begin(); it_pr = rPeriods.begin(); - QDate date = (*it_p).startDate(); + TQDate date = (*it_p).startDate(); while(it_p != periods.end()) { MyMoneyBudget::PeriodGroup period = *it_p; if(it_pr != rPeriods.end()) { @@ -161,19 +161,19 @@ MyMoneyBudget::MyMoneyBudget(void) : { } -MyMoneyBudget::MyMoneyBudget(const QString& _name) : +MyMoneyBudget::MyMoneyBudget(const TQString& _name) : m_name(_name) { } -MyMoneyBudget::MyMoneyBudget(const QDomElement& node) : +MyMoneyBudget::MyMoneyBudget(const TQDomElement& node) : MyMoneyObject(node) { if(!read(node)) clearId(); } -MyMoneyBudget::MyMoneyBudget(const QString& id, const MyMoneyBudget& budget) +MyMoneyBudget::MyMoneyBudget(const TQString& id, const MyMoneyBudget& budget) { *this = budget; m_id = id; @@ -193,7 +193,7 @@ bool MyMoneyBudget::operator == (const MyMoneyBudget& right) const (m_start == right.m_start) ); } -void MyMoneyBudget::write(QDomElement& e, QDomDocument *doc) const +void MyMoneyBudget::write(TQDomElement& e, TQDomDocument *doc) const { writeBaseXML(*doc, e); @@ -201,20 +201,20 @@ void MyMoneyBudget::write(QDomElement& e, QDomDocument *doc) const e.setAttribute("start", m_start.toString(Qt::ISODate) ); e.setAttribute("version", BUDGET_VERSION); - QMap<QString, AccountGroup>::const_iterator it; + TQMap<TQString, AccountGroup>::const_iterator it; for(it = m_accounts.begin(); it != m_accounts.end(); ++it) { // only add the account if there is a budget entered if(!(*it).balance().isZero()) { - QDomElement domAccount = doc->createElement("ACCOUNT"); + TQDomElement domAccount = doc->createElement("ACCOUNT"); domAccount.setAttribute("id", it.key()); domAccount.setAttribute("budgetlevel", AccountGroup::kBudgetLevelText[it.data().budgetLevel()]); domAccount.setAttribute("budgetsubaccounts", it.data().budgetSubaccounts()); - const QMap<QDate, PeriodGroup> periods = it.data().getPeriods(); - QMap<QDate, PeriodGroup>::const_iterator it_per; + const TQMap<TQDate, PeriodGroup> periods = it.data().getPeriods(); + TQMap<TQDate, PeriodGroup>::const_iterator it_per; for(it_per = periods.begin(); it_per != periods.end(); ++it_per) { if(!(*it_per).amount().isZero()) { - QDomElement domPeriod = doc->createElement("PERIOD"); + TQDomElement domPeriod = doc->createElement("PERIOD"); domPeriod.setAttribute("amount", (*it_per).amount().toString()); domPeriod.setAttribute("start", (*it_per).startDate().toString(Qt::ISODate)); @@ -227,7 +227,7 @@ void MyMoneyBudget::write(QDomElement& e, QDomDocument *doc) const } } -bool MyMoneyBudget::read(const QDomElement& e) +bool MyMoneyBudget::read(const TQDomElement& e) { // The goal of this reading method is 100% backward AND 100% forward // compatability. Any Budget ever created with any version of KMyMoney @@ -240,13 +240,13 @@ bool MyMoneyBudget::read(const QDomElement& e) { result = true; m_name = e.attribute("name"); - m_start = QDate::fromString(e.attribute("start"), Qt::ISODate); + m_start = TQDate::fromString(e.attribute("start"), Qt::ISODate); m_id = e.attribute("id"); - QDomNode child = e.firstChild(); + TQDomNode child = e.firstChild(); while(!child.isNull() && child.isElement()) { - QDomElement c = child.toElement(); + TQDomElement c = child.toElement(); AccountGroup account; @@ -255,7 +255,7 @@ bool MyMoneyBudget::read(const QDomElement& e) account.setId(c.attribute("id")); if(c.hasAttribute("budgetlevel")) { - int i = AccountGroup::kBudgetLevelText.findIndex(c.attribute("budgetlevel")); + int i = AccountGroup::kBudgetLevelText.tqfindIndex(c.attribute("budgetlevel")); if ( i != -1 ) account.setBudgetLevel(static_cast<AccountGroup::eBudgetLevel>(i)); } @@ -264,16 +264,16 @@ bool MyMoneyBudget::read(const QDomElement& e) account.setBudgetSubaccounts(c.attribute("budgetsubaccounts").toUInt()); } - QDomNode period = c.firstChild(); + TQDomNode period = c.firstChild(); while(!period.isNull() && period.isElement()) { - QDomElement per = period.toElement(); + TQDomElement per = period.toElement(); PeriodGroup pGroup; if("PERIOD" == per.tagName() && per.hasAttribute("amount") && per.hasAttribute("start")) { pGroup.setAmount( MyMoneyMoney(per.attribute("amount")) ); - pGroup.setStartDate( QDate::fromString(per.attribute("start"), Qt::ISODate) ); + pGroup.setStartDate( TQDate::fromString(per.attribute("start"), Qt::ISODate) ); account.addPeriod(pGroup.startDate(), pGroup); } @@ -289,27 +289,27 @@ bool MyMoneyBudget::read(const QDomElement& e) return result; } -void MyMoneyBudget::writeXML(QDomDocument& document, QDomElement& parent) const +void MyMoneyBudget::writeXML(TQDomDocument& document, TQDomElement& tqparent) const { - QDomElement el = document.createElement("BUDGET"); + TQDomElement el = document.createElement("BUDGET"); write(el,&document); - parent.appendChild(el); + tqparent.appendChild(el); } -bool MyMoneyBudget::hasReferenceTo(const QString& id) const +bool MyMoneyBudget::hasReferenceTo(const TQString& id) const { // return true if we have an assignment for this id - return (m_accounts.contains(id)); + return (m_accounts.tqcontains(id)); } -void MyMoneyBudget::removeReference(const QString& id) +void MyMoneyBudget::removeReference(const TQString& id) { - if(m_accounts.contains(id)) { + if(m_accounts.tqcontains(id)) { m_accounts.remove(id); } } -void MyMoneyBudget::setAccount(const AccountGroup &_account, const QString _id) +void MyMoneyBudget::setAccount(const AccountGroup &_account, const TQString _id) { if(_account.isZero()) { m_accounts.remove(_id); @@ -322,25 +322,25 @@ void MyMoneyBudget::setAccount(const AccountGroup &_account, const QString _id) } } -const MyMoneyBudget::AccountGroup& MyMoneyBudget::account(const QString _id) const +const MyMoneyBudget::AccountGroup& MyMoneyBudget::account(const TQString _id) const { static AccountGroup empty; - if ( m_accounts.contains(_id) ) + if ( m_accounts.tqcontains(_id) ) return m_accounts[_id]; return empty; } -void MyMoneyBudget::setBudgetStart(const QDate& _start) +void MyMoneyBudget::setBudgetStart(const TQDate& _start) { - QDate oldDate = QDate(m_start.year(), m_start.month(), 1); - m_start = QDate(_start.year(), _start.month(), 1); + TQDate oldDate = TQDate(m_start.year(), m_start.month(), 1); + m_start = TQDate(_start.year(), _start.month(), 1); if(oldDate.isValid()) { int adjust = ((m_start.year() - oldDate.year())*12) + (m_start.month() - oldDate.month()); - QMap<QString, AccountGroup>::iterator it; + TQMap<TQString, AccountGroup>::iterator it; for(it = m_accounts.begin(); it != m_accounts.end(); ++it) { - const QMap<QDate, PeriodGroup> periods = (*it).getPeriods(); - QMap<QDate, PeriodGroup>::const_iterator it_per; + const TQMap<TQDate, PeriodGroup> periods = (*it).getPeriods(); + TQMap<TQDate, PeriodGroup>::const_iterator it_per; (*it).clearPeriods(); for(it_per = periods.begin(); it_per != periods.end(); ++it_per) { PeriodGroup pgroup = (*it_per); |