summaryrefslogtreecommitdiffstats
path: root/kmymoney2/kmymoneyutils.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-05 06:00:29 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-05 06:00:29 +0000
commitfecb0e67b23e8b83ba7fc881bb57bc48c0852d62 (patch)
tree6b8614802f0d01b353bc9ba78aff2090846c198e /kmymoney2/kmymoneyutils.cpp
parentdadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (diff)
downloadkmymoney-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/kmymoneyutils.cpp')
-rw-r--r--kmymoney2/kmymoneyutils.cpp120
1 files changed, 60 insertions, 60 deletions
diff --git a/kmymoney2/kmymoneyutils.cpp b/kmymoney2/kmymoneyutils.cpp
index 83cf113..fdff861 100644
--- a/kmymoney2/kmymoneyutils.cpp
+++ b/kmymoney2/kmymoneyutils.cpp
@@ -51,15 +51,15 @@ KMyMoneyUtils::~KMyMoneyUtils()
{
}
-const QString KMyMoneyUtils::accountTypeToString(const MyMoneyAccount::accountTypeE accountType)
+const TQString KMyMoneyUtils::accountTypeToString(const MyMoneyAccount::accountTypeE accountType)
{
return MyMoneyAccount::accountTypeToString(accountType);
}
-MyMoneyAccount::accountTypeE KMyMoneyUtils::stringToAccountType(const QString& type)
+MyMoneyAccount::accountTypeE KMyMoneyUtils::stringToAccountType(const TQString& type)
{
MyMoneyAccount::accountTypeE rc = MyMoneyAccount::UnknownAccountType;
- QString tmp = type.lower();
+ TQString tmp = type.lower();
if(tmp == i18n("Checking").lower())
rc = MyMoneyAccount::Checkings;
@@ -97,10 +97,10 @@ MyMoneyAccount::accountTypeE KMyMoneyUtils::stringToAccountType(const QString& t
return rc;
}
-MyMoneySecurity::eSECURITYTYPE KMyMoneyUtils::stringToSecurity(const QString& txt)
+MyMoneySecurity::eSECURITYTYPE KMyMoneyUtils::stringToSecurity(const TQString& txt)
{
MyMoneySecurity::eSECURITYTYPE rc = MyMoneySecurity::SECURITY_NONE;
- QString tmp = txt.lower();
+ TQString tmp = txt.lower();
if(tmp == i18n("Stock").lower())
rc = MyMoneySecurity::SECURITY_STOCK;
@@ -114,27 +114,27 @@ MyMoneySecurity::eSECURITYTYPE KMyMoneyUtils::stringToSecurity(const QString& tx
return rc;
}
-const QString KMyMoneyUtils::securityTypeToString(const MyMoneySecurity::eSECURITYTYPE securityType)
+const TQString KMyMoneyUtils::securityTypeToString(const MyMoneySecurity::eSECURITYTYPE securityType)
{
return i18n(MyMoneySecurity::securityTypeToString(securityType));
}
-const QString KMyMoneyUtils::occurenceToString(const MyMoneySchedule::occurenceE occurence)
+const TQString KMyMoneyUtils::occurenceToString(const MyMoneySchedule::occurenceE occurence)
{
return i18n(MyMoneySchedule::occurenceToString(occurence));
}
-const QString KMyMoneyUtils::paymentMethodToString(MyMoneySchedule::paymentTypeE paymentType)
+const TQString KMyMoneyUtils::paymentMethodToString(MyMoneySchedule::paymentTypeE paymentType)
{
return i18n(MyMoneySchedule::paymentMethodToString(paymentType));
}
-const QString KMyMoneyUtils::weekendOptionToString(MyMoneySchedule::weekendOptionE weekendOption)
+const TQString KMyMoneyUtils::weekendOptionToString(MyMoneySchedule::weekendOptionE weekendOption)
{
return i18n(MyMoneySchedule::weekendOptionToString(weekendOption));
}
-const QString KMyMoneyUtils::scheduleTypeToString(MyMoneySchedule::typeE type)
+const TQString KMyMoneyUtils::scheduleTypeToString(MyMoneySchedule::typeE type)
{
return i18n(MyMoneySchedule::scheduleTypeToString(type));
}
@@ -144,7 +144,7 @@ KGuiItem KMyMoneyUtils::scheduleNewGuiItem(void)
KIconLoader *ic = KGlobal::iconLoader();
KGuiItem splitGuiItem( i18n("&New Schedule..."),
- QIconSet(ic->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
+ TQIconSet(ic->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
i18n("Create a new schedule."),
i18n("Use this to create a new schedule."));
@@ -156,32 +156,32 @@ KGuiItem KMyMoneyUtils::accountsFilterGuiItem(void)
KIconLoader *ic = KGlobal::iconLoader();
KGuiItem splitGuiItem( i18n("&Filter"),
- QIconSet(ic->loadIcon("filter", KIcon::Small, KIcon::SizeSmall)),
+ TQIconSet(ic->loadIcon("filter", KIcon::Small, KIcon::SizeSmall)),
i18n("Filter out accounts"),
i18n("Use this to filter out accounts"));
return splitGuiItem;
}
-QPixmap KMyMoneyUtils::billScheduleIcon(int size)
+TQPixmap KMyMoneyUtils::billScheduleIcon(int size)
{
KIconLoader *ic = KGlobal::iconLoader();
return ic->loadIcon("billschedule", KIcon::User, size);
}
-QPixmap KMyMoneyUtils::depositScheduleIcon(int size)
+TQPixmap KMyMoneyUtils::depositScheduleIcon(int size)
{
KIconLoader *ic = KGlobal::iconLoader();
return ic->loadIcon("depositschedule", KIcon::User, size);
}
-QPixmap KMyMoneyUtils::transferScheduleIcon(int size)
+TQPixmap KMyMoneyUtils::transferScheduleIcon(int size)
{
KIconLoader *ic = KGlobal::iconLoader();
return ic->loadIcon("transferschedule", KIcon::User, size);
}
-QPixmap KMyMoneyUtils::scheduleIcon(int size)
+TQPixmap KMyMoneyUtils::scheduleIcon(int size)
{
KIconLoader *ic = KGlobal::iconLoader();
return ic->loadIcon("schedule", KIcon::User, size);
@@ -202,16 +202,16 @@ const char* homePageItems[] = {
0
};
-const QString KMyMoneyUtils::homePageItemToString(const int idx)
+const TQString KMyMoneyUtils::homePageItemToString(const int idx)
{
- QString rc;
+ TQString rc;
if(abs(idx) > 0 && abs(idx) < static_cast<int>(sizeof(homePageItems)/sizeof(homePageItems[0]))) {
rc = i18n(homePageItems[abs(idx-1)]);
}
return rc;
}
-int KMyMoneyUtils::stringToHomePageItem(const QString& txt)
+int KMyMoneyUtils::stringToHomePageItem(const TQString& txt)
{
int idx = 0;
for(idx = 0; homePageItems[idx] != 0; ++idx) {
@@ -221,20 +221,20 @@ int KMyMoneyUtils::stringToHomePageItem(const QString& txt)
return 0;
}
-bool KMyMoneyUtils::appendCorrectFileExt(QString& str, const QString& strExtToUse)
+bool KMyMoneyUtils::appendCorrectFileExt(TQString& str, const TQString& strExtToUse)
{
bool rc = false;
if(!str.isEmpty()) {
//find last . delminator
- int nLoc = str.findRev('.');
+ int nLoc = str.tqfindRev('.');
if(nLoc != -1) {
- QString strExt, strTemp;
+ TQString strExt, strTemp;
strTemp = str.left(nLoc + 1);
strExt = str.right(str.length() - (nLoc + 1));
- if(strExt.find(strExtToUse, 0, FALSE) == -1) {
+ if(strExt.tqfind(strExtToUse, 0, FALSE) == -1) {
// if the extension given contains a period, we remove our's
- if(strExtToUse.find('.') != -1)
+ if(strExtToUse.tqfind('.') != -1)
strTemp = strTemp.left(strTemp.length()-1);
//append extension to make complete file name
strTemp.append(strExtToUse);
@@ -259,45 +259,45 @@ void KMyMoneyUtils::checkConstants(void)
Q_ASSERT(static_cast<int>(KLocale::AfterMoney) == static_cast<int>(MyMoneyMoney::AfterMoney));
}
-QString KMyMoneyUtils::variableCSS(void)
+TQString KMyMoneyUtils::variableCSS(void)
{
- QColor tcolor = KGlobalSettings::textColor();
+ TQColor tcolor = KGlobalSettings::textColor();
- QString css;
+ TQString css;
css += "<style type=\"text/css\">\n<!--\n";
- css += QString(".row-even, .item0 { background-color: %1; color: %2 }\n")
- .arg((KMyMoneyGlobalSettings::listBGColor()).name()).arg(tcolor.name());
- css += QString(".row-odd, .item1 { background-color: %1; color: %2 }\n")
- .arg((KMyMoneyGlobalSettings::listColor()).name()).arg(tcolor.name());
+ css += TQString(".row-even, .item0 { background-color: %1; color: %2 }\n")
+ .tqarg((KMyMoneyGlobalSettings::listBGColor()).name()).tqarg(tcolor.name());
+ css += TQString(".row-odd, .item1 { background-color: %1; color: %2 }\n")
+ .tqarg((KMyMoneyGlobalSettings::listColor()).name()).tqarg(tcolor.name());
css += "-->\n</style>\n";
return css;
}
-QString KMyMoneyUtils::findResource(const char* type, const QString& filename)
+TQString KMyMoneyUtils::findResource(const char* type, const TQString& filename)
{
- QString language = KGlobal::locale()->language();
- QString country = KGlobal::locale()->country();
- QString rc, mask;
+ TQString language = KGlobal::locale()->language();
+ TQString country = KGlobal::locale()->country();
+ TQString rc, tqmask;
// check that the placeholder is present
- if(!filename.find("%1")) {
+ if(!filename.tqfind("%1")) {
qWarning("%%1 not found in '%s'", filename.latin1());
return filename;
}
// search the given resource
- mask = filename.arg("_%1.%2");
- rc = KGlobal::dirs()->findResource(type, mask.arg(country).arg(language));
+ tqmask = filename.tqarg("_%1.%2");
+ rc = KGlobal::dirs()->findResource(type, tqmask.tqarg(country).tqarg(language));
if(rc.isEmpty()) {
- mask = filename.arg("_%1");
- rc = KGlobal::dirs()->findResource(type, mask.arg(language));
+ tqmask = filename.tqarg("_%1");
+ rc = KGlobal::dirs()->findResource(type, tqmask.tqarg(language));
}
if(rc.isEmpty()) {
- // qDebug(QString("html/home_%1.html not found").arg(country).latin1());
- rc = KGlobal::dirs()->findResource(type, mask.arg(country));
+ // qDebug(TQString("html/home_%1.html not found").tqarg(country).latin1());
+ rc = KGlobal::dirs()->findResource(type, tqmask.tqarg(country));
}
if(rc.isEmpty()) {
- rc = KGlobal::dirs()->findResource(type, filename.arg(""));
+ rc = KGlobal::dirs()->findResource(type, filename.tqarg(""));
}
if(rc.isEmpty()) {
@@ -308,7 +308,7 @@ QString KMyMoneyUtils::findResource(const char* type, const QString& filename)
const MyMoneySplit KMyMoneyUtils::stockSplit(const MyMoneyTransaction& t)
{
- QValueList<MyMoneySplit>::ConstIterator it_s;
+ TQValueList<MyMoneySplit>::ConstIterator it_s;
MyMoneySplit investmentAccountSplit;
for(it_s = t.splits().begin(); it_s != t.splits().end(); ++it_s) {
if(!(*it_s).accountId().isEmpty()) {
@@ -341,7 +341,7 @@ KMyMoneyUtils::transactionTypeE KMyMoneyUtils::transactionType(const MyMoneyTran
// FIXME check for loan transaction here
return SplitTransaction;
}
- QString ida, idb;
+ TQString ida, idb;
ida = t.splits()[0].accountId();
idb = t.splits()[1].accountId();
if(ida.isEmpty() || idb.isEmpty())
@@ -358,7 +358,7 @@ KMyMoneyUtils::transactionTypeE KMyMoneyUtils::transactionType(const MyMoneyTran
return Normal;
}
-void KMyMoneyUtils::calculateAutoLoan(const MyMoneySchedule& schedule, MyMoneyTransaction& transaction, const QMap<QString, MyMoneyMoney>& balances)
+void KMyMoneyUtils::calculateAutoLoan(const MyMoneySchedule& schedule, MyMoneyTransaction& transaction, const TQMap<TQString, MyMoneyMoney>& balances)
{
try {
MyMoneyForecast::calculateAutoLoan(schedule, transaction, balances);
@@ -368,22 +368,22 @@ void KMyMoneyUtils::calculateAutoLoan(const MyMoneySchedule& schedule, MyMoneyTr
}
}
-QString KMyMoneyUtils::nextCheckNumber(const MyMoneyAccount& acc)
+TQString KMyMoneyUtils::nextCheckNumber(const MyMoneyAccount& acc)
{
// determine next check number
- QString number;
- QRegExp exp(QString("(.*\\D)?(\\d+)(\\D.*)?"));
+ TQString number;
+ TQRegExp exp(TQString("(.*\\D)?(\\d+)(\\D.*)?"));
if(exp.search(acc.value("lastNumberUsed")) != -1) {
- number = QString("%1%2%3").arg(exp.cap(1)).arg(exp.cap(2).toULongLong() + 1).arg(exp.cap(3));
+ number = TQString("%1%2%3").tqarg(exp.cap(1)).tqarg(exp.cap(2).toULongLong() + 1).tqarg(exp.cap(3));
} else {
number = "1";
}
return number;
}
-QString KMyMoneyUtils::reconcileStateToString(MyMoneySplit::reconcileFlagE flag, bool text)
+TQString KMyMoneyUtils::reconcileStateToString(MyMoneySplit::reconcileFlagE flag, bool text)
{
- QString txt;
+ TQString txt;
if(text) {
switch(flag) {
case MyMoneySplit::NotReconciled:
@@ -429,7 +429,7 @@ MyMoneyTransaction KMyMoneyUtils::scheduledTransaction(const MyMoneySchedule& sc
try {
if (schedule.type() == MyMoneySchedule::TYPE_LOANPAYMENT) {
- calculateAutoLoan(schedule, t, QMap<QString, MyMoneyMoney>());
+ calculateAutoLoan(schedule, t, TQMap<TQString, MyMoneyMoney>());
}
} catch (MyMoneyException* e) {
qDebug("Unable to load schedule details for '%s' during transaction match: %s", schedule.name().data(), e->what().data());
@@ -437,13 +437,13 @@ MyMoneyTransaction KMyMoneyUtils::scheduledTransaction(const MyMoneySchedule& sc
}
t.clearId();
- t.setEntryDate(QDate());
+ t.setEntryDate(TQDate());
return t;
}
-void KMyMoneyUtils::previouslyUsedCategories(const QString& investmentAccount, QString& feesId, QString& interestId)
+void KMyMoneyUtils::previouslyUsedCategories(const TQString& investmentAccount, TQString& feesId, TQString& interestId)
{
- feesId = interestId = QString();
+ feesId = interestId = TQString();
MyMoneyFile* file = MyMoneyFile::instance();
try {
MyMoneyAccount acc = file->account(investmentAccount);
@@ -451,15 +451,15 @@ void KMyMoneyUtils::previouslyUsedCategories(const QString& investmentAccount, Q
filter.setReportAllSplits(false);
// since we assume an investment account here, we need to collect the stock accounts as well
filter.addAccount(acc.accountList());
- QValueList< QPair<MyMoneyTransaction, MyMoneySplit> > list;
+ TQValueList< TQPair<MyMoneyTransaction, MyMoneySplit> > list;
file->transactionList(list, filter);
- QValueList< QPair<MyMoneyTransaction, MyMoneySplit> >::const_iterator it_t;
+ TQValueList< TQPair<MyMoneyTransaction, MyMoneySplit> >::const_iterator it_t;
for(it_t = list.begin(); it_t != list.end(); ++it_t) {
const MyMoneyTransaction& t = (*it_t).first;
const MyMoneySplit&s = (*it_t).second;
MyMoneySplit assetAccountSplit;
- QValueList<MyMoneySplit> feeSplits;
- QValueList<MyMoneySplit> interestSplits;
+ TQValueList<MyMoneySplit> feeSplits;
+ TQValueList<MyMoneySplit> interestSplits;
MyMoneySecurity security;
MyMoneySecurity currency;
MyMoneySplit::investTransactionTypeE transactionType;