summaryrefslogtreecommitdiffstats
path: root/kmymoney2/views/kforecastview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmymoney2/views/kforecastview.cpp')
-rw-r--r--kmymoney2/views/kforecastview.cpp160
1 files changed, 80 insertions, 80 deletions
diff --git a/kmymoney2/views/kforecastview.cpp b/kmymoney2/views/kforecastview.cpp
index c7bcb0a..bf27e7f 100644
--- a/kmymoney2/views/kforecastview.cpp
+++ b/kmymoney2/views/kforecastview.cpp
@@ -17,12 +17,12 @@
// ----------------------------------------------------------------------------
// QT Includes
-#include <qtabwidget.h>
-#include <qspinbox.h>
-#include <qlabel.h>
-#include <qbuttongroup.h>
-#include <qtextedit.h>
-#include <qlayout.h>
+#include <tqtabwidget.h>
+#include <tqspinbox.h>
+#include <tqlabel.h>
+#include <tqbuttongroup.h>
+#include <tqtextedit.h>
+#include <tqlayout.h>
// ----------------------------------------------------------------------------
// KDE Includes
@@ -46,8 +46,8 @@
#include "../reports/pivottable.h"
#include "../reports/pivotgrid.h"
-KForecastView::KForecastView(QWidget *parent, const char *name) :
- KForecastViewDecl(parent,name)
+KForecastView::KForecastView(TQWidget *tqparent, const char *name) :
+ KForecastViewDecl(tqparent,name)
{
for(int i=0; i < MaxViewTabs; ++i)
m_needReload[i] = false;
@@ -56,11 +56,11 @@ KForecastView::KForecastView(QWidget *parent, const char *name) :
config->setGroup("Last Use Settings");
m_tab->setCurrentPage(config->readNumEntry("KForecastView_LastType", 0));
- connect(m_tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(slotTabChanged(QWidget*)));
+ connect(m_tab, TQT_SIGNAL(currentChanged(TQWidget*)), this, TQT_SLOT(slotTabChanged(TQWidget*)));
- connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadForecast()));
+ connect(MyMoneyFile::instance(), TQT_SIGNAL(dataChanged()), this, TQT_SLOT(slotLoadForecast()));
- connect(m_forecastButton, SIGNAL(clicked()), this, SLOT(slotManualForecast()));
+ connect(m_forecastButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotManualForecast()));
m_forecastList->setAllColumnsShowFocus(true);
m_summaryList->setAllColumnsShowFocus(true);
@@ -68,7 +68,7 @@ KForecastView::KForecastView(QWidget *parent, const char *name) :
m_advancedList->setAllColumnsShowFocus(true);
m_forecastChart = new KReportChartView(m_tabChart, "forecastChart" );
- m_forecastChart->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+ m_forecastChart->tqsetSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding );
loadForecastSettings();
@@ -78,7 +78,7 @@ KForecastView::~KForecastView()
{
}
-void KForecastView::slotTabChanged(QWidget* _tab)
+void KForecastView::slotTabChanged(TQWidget* _tab)
{
ForecastViewTab tab = static_cast<ForecastViewTab>(m_tab->indexOf(_tab));
@@ -212,7 +212,7 @@ void KForecastView::loadListView(void)
void KForecastView::loadSummaryView(void)
{
MyMoneyForecast forecast;
- QValueList<MyMoneyAccount> accList;
+ TQValueList<MyMoneyAccount> accList;
int dropMinimum;
int dropZero;
@@ -246,7 +246,7 @@ void KForecastView::loadSummaryView(void)
//Get all accounts of the right type to calculate forecast
m_nameIdx.clear();
accList = forecast.accountList();
- QValueList<MyMoneyAccount>::const_iterator accList_t = accList.begin();
+ TQValueList<MyMoneyAccount>::const_iterator accList_t = accList.begin();
for(; accList_t != accList.end(); ++accList_t ) {
MyMoneyAccount acc = *accList_t;
if(m_nameIdx[acc.id()] != acc.id()) { //Check if the account is there
@@ -254,7 +254,7 @@ void KForecastView::loadSummaryView(void)
}
}
- QMap<QString, QString>::ConstIterator it_nc;
+ TQMap<TQString, TQString>::ConstIterator it_nc;
for(it_nc = m_nameIdx.begin(); it_nc != m_nameIdx.end(); ++it_nc) {
const MyMoneyAccount& acc = file->account(*it_nc);
@@ -269,7 +269,7 @@ void KForecastView::loadSummaryView(void)
}
//Check if the account is going to be below zero or below the minimal balance in the forecast period
- QString minimumBalance = acc.value("minimumBalance");
+ TQString minimumBalance = acc.value("minimumBalance");
MyMoneyMoney minBalance = MyMoneyMoney(minimumBalance);
//Check if the account is going to be below minimal balance
@@ -279,7 +279,7 @@ void KForecastView::loadSummaryView(void)
dropZero = forecast.daysToZeroBalance(acc);
// spit out possible warnings
- QString msg;
+ TQString msg;
// if a minimum balance has been specified, an appropriate warning will
// only be shown, if the drop below 0 is on a different day or not present
@@ -292,14 +292,14 @@ void KForecastView::loadSummaryView(void)
case -1:
break;
case 0:
- msg = QString("<font color=\"%1\">").arg(KMyMoneyGlobalSettings::listNegativeValueColor().name());
- msg += i18n("The balance of %2 is below the minimum balance %3 today.").arg(acc.name()).arg(minBalance.formatMoney(acc, currency));
- msg += QString("</font>");
+ msg = TQString("<font color=\"%1\">").tqarg(KMyMoneyGlobalSettings::listNegativeValueColor().name());
+ msg += i18n("The balance of %2 is below the minimum balance %3 today.").tqarg(acc.name()).tqarg(minBalance.formatMoney(acc, currency));
+ msg += TQString("</font>");
break;
default:
- msg = QString("<font color=\"%1\">").arg(KMyMoneyGlobalSettings::listNegativeValueColor().name());
- msg += i18n("The balance of %1 will drop below the minimum balance %2 in %3 days.").arg(acc.name()).arg(minBalance.formatMoney(acc, currency)).arg(dropMinimum-1);
- msg += QString("</font>");
+ msg = TQString("<font color=\"%1\">").tqarg(KMyMoneyGlobalSettings::listNegativeValueColor().name());
+ msg += i18n("The balance of %1 will drop below the minimum balance %2 in %3 days.").tqarg(acc.name()).tqarg(minBalance.formatMoney(acc, currency)).tqarg(dropMinimum-1);
+ msg += TQString("</font>");
}
if(!msg.isEmpty()) {
@@ -308,31 +308,31 @@ void KForecastView::loadSummaryView(void)
}
// a drop below zero is always shown
- msg = QString();
+ msg = TQString();
switch(dropZero) {
case -1:
break;
case 0:
if(acc.accountGroup() == MyMoneyAccount::Asset) {
- msg = QString("<font color=\"%1\">").arg(KMyMoneyGlobalSettings::listNegativeValueColor().name());
- msg += i18n("The balance of %1 is below %2 today.").arg(acc.name()).arg(MyMoneyMoney().formatMoney(acc, currency));
- msg += QString("</font>");
+ msg = TQString("<font color=\"%1\">").tqarg(KMyMoneyGlobalSettings::listNegativeValueColor().name());
+ msg += i18n("The balance of %1 is below %2 today.").tqarg(acc.name()).tqarg(MyMoneyMoney().formatMoney(acc, currency));
+ msg += TQString("</font>");
break;
}
if(acc.accountGroup() == MyMoneyAccount::Liability) {
- msg = i18n("The balance of %1 is above %2 today.").arg(acc.name()).arg(MyMoneyMoney().formatMoney(acc, currency));
+ msg = i18n("The balance of %1 is above %2 today.").tqarg(acc.name()).tqarg(MyMoneyMoney().formatMoney(acc, currency));
break;
}
break;
default:
if(acc.accountGroup() == MyMoneyAccount::Asset) {
- msg = QString("<font color=\"%1\">").arg(KMyMoneyGlobalSettings::listNegativeValueColor().name());
- msg += i18n("The balance of %1 will drop below %2 in %3 days.").arg(acc.name()).arg(MyMoneyMoney().formatMoney(acc, currency)).arg(dropZero);
- msg += QString("</font>");
+ msg = TQString("<font color=\"%1\">").tqarg(KMyMoneyGlobalSettings::listNegativeValueColor().name());
+ msg += i18n("The balance of %1 will drop below %2 in %3 days.").tqarg(acc.name()).tqarg(MyMoneyMoney().formatMoney(acc, currency)).tqarg(dropZero);
+ msg += TQString("</font>");
break;
}
if(acc.accountGroup() == MyMoneyAccount::Liability) {
- msg = i18n("The balance of %1 will raise above %2 in %3 days.").arg(acc.name()).arg(MyMoneyMoney().formatMoney(acc, currency)).arg(dropZero);
+ msg = i18n("The balance of %1 will raise above %2 in %3 days.").tqarg(acc.name()).tqarg(MyMoneyMoney().formatMoney(acc, currency)).tqarg(dropZero);
break;
}
}
@@ -341,12 +341,12 @@ void KForecastView::loadSummaryView(void)
}
//advice about trends
- msg = QString();
+ msg = TQString();
MyMoneyMoney accCycleVariation = forecast.accountCycleVariation(acc);
if (accCycleVariation < MyMoneyMoney(0, 1)) {
- msg = QString("<font color=\"%1\">").arg(KMyMoneyGlobalSettings::listNegativeValueColor().name());
- msg += i18n("The account %1 is decreasing %2 per cycle.").arg(acc.name()).arg(accCycleVariation.formatMoney(acc, currency));
- msg += QString("</font>");
+ msg = TQString("<font color=\"%1\">").tqarg(KMyMoneyGlobalSettings::listNegativeValueColor().name());
+ msg += i18n("The account %1 is decreasing %2 per cycle.").tqarg(acc.name()).tqarg(accCycleVariation.formatMoney(acc, currency));
+ msg += TQString("</font>");
}
if(!msg.isEmpty()) {
@@ -360,7 +360,7 @@ void KForecastView::loadSummaryView(void)
void KForecastView::loadAdvancedView(void)
{
MyMoneyFile* file = MyMoneyFile::instance();
- QValueList<MyMoneyAccount> accList;
+ TQValueList<MyMoneyAccount> accList;
MyMoneySecurity baseCurrency = file->baseCurrency();
MyMoneyForecast forecast;
int daysToBeginDay;
@@ -376,7 +376,7 @@ void KForecastView::loadAdvancedView(void)
//Get all accounts of the right type to calculate forecast
m_nameIdx.clear();
accList = forecast.accountList();
- QValueList<MyMoneyAccount>::const_iterator accList_t = accList.begin();
+ TQValueList<MyMoneyAccount>::const_iterator accList_t = accList.begin();
for(; accList_t != accList.end(); ++accList_t ) {
MyMoneyAccount acc = *accList_t;
if(m_nameIdx[acc.id()] != acc.id()) { //Check if the account is there
@@ -393,32 +393,32 @@ void KForecastView::loadAdvancedView(void)
int accountColumn = m_advancedList->addColumn(i18n("Account"), -1);
//if beginning of forecast is today, set the begin day to next cycle to avoid repeating the first cycle
- if(QDate::currentDate() < forecast.beginForecastDate()) {
- daysToBeginDay = QDate::currentDate().daysTo(forecast.beginForecastDate());
+ if(TQDate::tqcurrentDate() < forecast.beginForecastDate()) {
+ daysToBeginDay = TQDate::tqcurrentDate().daysTo(forecast.beginForecastDate());
} else {
daysToBeginDay = forecast.accountsCycle();
}
//add columns
for(int i = 1; ((i * forecast.accountsCycle()) + daysToBeginDay) <= forecast.forecastDays(); ++i) {
- int col = m_advancedList->addColumn(i18n("Min Bal %1").arg(i), -1);
- m_advancedList->setColumnAlignment(col, Qt::AlignRight);
- m_advancedList->addColumn(i18n("Min Date %1").arg(i), -1);
+ int col = m_advancedList->addColumn(i18n("Min Bal %1").tqarg(i), -1);
+ m_advancedList->setColumnAlignment(col, TQt::AlignRight);
+ m_advancedList->addColumn(i18n("Min Date %1").tqarg(i), -1);
}
for(int i = 1; ((i * forecast.accountsCycle()) + daysToBeginDay) <= forecast.forecastDays(); ++i) {
- int col = m_advancedList->addColumn(i18n("Max Bal %1").arg(i), -1);
- m_advancedList->setColumnAlignment(col, Qt::AlignRight);
- m_advancedList->addColumn(i18n("Max Date %1").arg(i), -1);
+ int col = m_advancedList->addColumn(i18n("Max Bal %1").tqarg(i), -1);
+ m_advancedList->setColumnAlignment(col, TQt::AlignRight);
+ m_advancedList->addColumn(i18n("Max Date %1").tqarg(i), -1);
}
int col = m_advancedList->addColumn(i18n("Average"), -1);
- m_advancedList->setColumnAlignment(col, Qt::AlignRight);
+ m_advancedList->setColumnAlignment(col, TQt::AlignRight);
m_advancedList->setSorting(-1);
KMyMoneyForecastListViewItem *advancedItem = 0;
- QMap<QString, QString>::ConstIterator it_nc;
+ TQMap<TQString, TQString>::ConstIterator it_nc;
for(it_nc = m_nameIdx.begin(); it_nc != m_nameIdx.end(); ++it_nc) {
const MyMoneyAccount& acc = file->account(*it_nc);
- QString amount;
+ TQString amount;
MyMoneyMoney amountMM;
MyMoneySecurity currency;
@@ -436,35 +436,35 @@ void KForecastView::loadAdvancedView(void)
int it_c = 1; // iterator for the columns of the listview
//get minimum balance list
- QValueList<QDate> minBalanceList = forecast.accountMinimumBalanceDateList(acc);
- QValueList<QDate>::Iterator t_min;
+ TQValueList<TQDate> minBalanceList = forecast.accountMinimumBalanceDateList(acc);
+ TQValueList<TQDate>::Iterator t_min;
for(t_min = minBalanceList.begin(); t_min != minBalanceList.end() ; ++t_min)
{
- QDate minDate = *t_min;
+ TQDate minDate = *t_min;
amountMM = forecast.forecastBalance(acc, minDate);
amount = amountMM.formatMoney(acc, currency);
advancedItem->setText(it_c, amount, amountMM.isNegative());
it_c++;
- QString dateString = KGlobal::locale()->formatDate(minDate, true);
+ TQString dateString = KGlobal::locale()->formatDate(minDate, true);
advancedItem->setText(it_c, dateString, amountMM.isNegative());
it_c++;
}
//get maximum balance list
- QValueList<QDate> maxBalanceList = forecast.accountMaximumBalanceDateList(acc);
- QValueList<QDate>::Iterator t_max;
+ TQValueList<TQDate> maxBalanceList = forecast.accountMaximumBalanceDateList(acc);
+ TQValueList<TQDate>::Iterator t_max;
for(t_max = maxBalanceList.begin(); t_max != maxBalanceList.end() ; ++t_max)
{
- QDate maxDate = *t_max;
+ TQDate maxDate = *t_max;
amountMM = forecast.forecastBalance(acc, maxDate);
amount = amountMM.formatMoney(acc, currency);
advancedItem->setText(it_c, amount, amountMM.isNegative());
it_c++;
- QString dateString = KGlobal::locale()->formatDate(maxDate, true);
+ TQString dateString = KGlobal::locale()->formatDate(maxDate, true);
advancedItem->setText(it_c, dateString, amountMM.isNegative());
it_c++;
}
@@ -481,15 +481,15 @@ void KForecastView::loadBudgetView(void)
{
MyMoneyFile* file = MyMoneyFile::instance();
MyMoneyForecast forecast;
-// QValueList<MyMoneyAccount> accList;
+// TQValueList<MyMoneyAccount> accList;
m_budgetList->setBaseCurrency(file->baseCurrency());
//get the settings from current page and calculate this year based on last year
- QDate historyEndDate = QDate(QDate::currentDate().year()-1, 12, 31);
- QDate historyStartDate = historyEndDate.addDays(-m_accountsCycle->value() * m_forecastCycles->value());
- QDate forecastStartDate = QDate(QDate::currentDate().year(), 1, 1);
- QDate forecastEndDate = QDate::currentDate().addDays(m_forecastDays->value());
+ TQDate historyEndDate = TQDate(TQDate::tqcurrentDate().year()-1, 12, 31);
+ TQDate historyStartDate = historyEndDate.addDays(-m_accountsCycle->value() * m_forecastCycles->value());
+ TQDate forecastStartDate = TQDate(TQDate::tqcurrentDate().year(), 1, 1);
+ TQDate forecastEndDate = TQDate::tqcurrentDate().addDays(m_forecastDays->value());
forecast.setHistoryMethod(m_historyMethod->selectedId());
MyMoneyBudget budget;
@@ -513,10 +513,10 @@ void KForecastView::loadBudgetView(void)
m_budgetList->show();
}
-QValueList<MyMoneyPrice> KForecastView::getAccountPrices(const MyMoneyAccount& acc)
+TQValueList<MyMoneyPrice> KForecastView::getAccountPrices(const MyMoneyAccount& acc)
{
MyMoneyFile* file = MyMoneyFile::instance();
- QValueList<MyMoneyPrice> prices;
+ TQValueList<MyMoneyPrice> prices;
MyMoneySecurity security = file->baseCurrency();
try {
if(acc.isInvest()) {
@@ -543,7 +543,7 @@ void KForecastView::addAssetLiabilityRows(const MyMoneyForecast& forecast)
{
MyMoneyFile* file = MyMoneyFile::instance();
- QValueList<MyMoneyPrice> basePrices;
+ TQValueList<MyMoneyPrice> basePrices;
m_assetItem = new KMyMoneyAccountTreeForecastItem( m_totalItem, file->asset(), forecast, basePrices, file->baseCurrency() );
m_assetItem->setOpen(true);
m_liabilityItem = new KMyMoneyAccountTreeForecastItem( m_totalItem, file->liability(), forecast, basePrices, file->baseCurrency());
@@ -554,7 +554,7 @@ void KForecastView::addIncomeExpenseRows(const MyMoneyForecast& forecast)
{
MyMoneyFile* file = MyMoneyFile::instance();
- QValueList<MyMoneyPrice> basePrices;
+ TQValueList<MyMoneyPrice> basePrices;
m_incomeItem = new KMyMoneyAccountTreeForecastItem( m_totalItem, file->income(), forecast, basePrices, file->baseCurrency() );
m_incomeItem->setOpen(true);
m_expenseItem = new KMyMoneyAccountTreeForecastItem( m_totalItem, file->expense(), forecast, basePrices, file->baseCurrency());
@@ -576,10 +576,10 @@ bool KForecastView::includeAccount(MyMoneyForecast& forecast, const MyMoneyAccou
if( forecast.isForecastAccount(acc) )
return true;
- QStringList accounts = acc.accountList();
+ TQStringList accounts = acc.accountList();
if(accounts.size() > 0) {
- QStringList::ConstIterator it_acc;
+ TQStringList::ConstIterator it_acc;
for(it_acc = accounts.begin(); it_acc != accounts.end(); ++it_acc) {
MyMoneyAccount account = file->account(*it_acc);
if( includeAccount(forecast, account) )
@@ -589,10 +589,10 @@ bool KForecastView::includeAccount(MyMoneyForecast& forecast, const MyMoneyAccou
return false;
}
-void KForecastView::loadAccounts(MyMoneyForecast& forecast, const MyMoneyAccount& account, KMyMoneyAccountTreeForecastItem* parentItem, int forecastType )
+void KForecastView::loadAccounts(MyMoneyForecast& forecast, const MyMoneyAccount& account, KMyMoneyAccountTreeForecastItem* tqparentItem, int forecastType )
{
- QMap<QString, QString> nameIdx;
- QStringList accList;
+ TQMap<TQString, TQString> nameIdx;
+ TQStringList accList;
MyMoneyFile* file = MyMoneyFile::instance();
KMyMoneyAccountTreeForecastItem *forecastItem = 0;
@@ -602,16 +602,16 @@ void KForecastView::loadAccounts(MyMoneyForecast& forecast, const MyMoneyAccount
if(accList.size() == 0)
return;
- QStringList::ConstIterator accList_t;
+ TQStringList::ConstIterator accList_t;
for(accList_t = accList.begin(); accList_t != accList.end(); ++accList_t ) {
MyMoneyAccount subAccount = file->account(*accList_t);
- //only add the account if it is a forecast account or the parent of a forecast account
+ //only add the account if it is a forecast account or the tqparent of a forecast account
if(includeAccount(forecast, subAccount)) {
nameIdx[subAccount.id()] = subAccount.id();
}
}
- QMap<QString, QString>::ConstIterator it_nc;
+ TQMap<TQString, TQString>::ConstIterator it_nc;
for(it_nc = nameIdx.begin(); it_nc != nameIdx.end(); ++it_nc) {
const MyMoneyAccount subAccount = file->account(*it_nc);
@@ -623,14 +623,14 @@ void KForecastView::loadAccounts(MyMoneyForecast& forecast, const MyMoneyAccount
currency = file->security(subAccount.currencyId());
}
- QString amount;
- QString vAmount;
+ TQString amount;
+ TQString vAmount;
MyMoneyMoney vAmountMM;
//get prices
- QValueList<MyMoneyPrice> prices = getAccountPrices(subAccount);
+ TQValueList<MyMoneyPrice> prices = getAccountPrices(subAccount);
- forecastItem = new KMyMoneyAccountTreeForecastItem( parentItem, subAccount, forecast, prices, currency, static_cast<KMyMoneyAccountTreeForecastItem::EForecastViewType>(forecastType) );
+ forecastItem = new KMyMoneyAccountTreeForecastItem( tqparentItem, subAccount, forecast, prices, currency, static_cast<KMyMoneyAccountTreeForecastItem::EForecastViewType>(forecastType) );
forecastItem->setOpen(true);
loadAccounts(forecast, subAccount, forecastItem, forecastType);
@@ -658,7 +658,7 @@ void KForecastView::loadChartView(void)
reportCfg.setColumnsAreDays( true );
reportCfg.setConvertCurrency( true );
reportCfg.setIncludingForecast( true );
- reportCfg.setDateFilter(QDate::currentDate(),QDate::currentDate().addDays(m_forecastDays->value()));
+ reportCfg.setDateFilter(TQDate::tqcurrentDate(),TQDate::tqcurrentDate().addDays(m_forecastDays->value()));
reports::PivotTable table(reportCfg);