summaryrefslogtreecommitdiffstats
path: root/kmymoney2/reports/listtable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmymoney2/reports/listtable.cpp')
-rw-r--r--kmymoney2/reports/listtable.cpp172
1 files changed, 86 insertions, 86 deletions
diff --git a/kmymoney2/reports/listtable.cpp b/kmymoney2/reports/listtable.cpp
index 797b392..16db407 100644
--- a/kmymoney2/reports/listtable.cpp
+++ b/kmymoney2/reports/listtable.cpp
@@ -19,9 +19,9 @@
// ----------------------------------------------------------------------------
// QT Includes
-#include <qvaluelist.h>
-#include <qfile.h>
-#include <qtextstream.h>
+#include <tqvaluelist.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
// ----------------------------------------------------------------------------
// KDE Includes
@@ -43,7 +43,7 @@
namespace reports {
- QStringList ListTable::TableRow::m_sortCriteria;
+ TQStringList ListTable::TableRow::m_sortCriteria;
// ****************************************************************************
//
@@ -54,7 +54,7 @@ namespace reports {
class GroupIterator
{
public:
- GroupIterator ( const QString& _group, const QString& _subtotal, unsigned _depth ) : m_depth ( _depth ), m_groupField ( _group ), m_subtotalField ( _subtotal ) {}
+ GroupIterator ( const TQString& _group, const TQString& _subtotal, unsigned _depth ) : m_depth ( _depth ), m_groupField ( _group ), m_subtotalField ( _subtotal ) {}
GroupIterator ( void ) {}
void update ( const ListTable::TableRow& _row )
{
@@ -73,20 +73,20 @@ namespace reports {
const MyMoneyMoney& subtotal ( void ) const { return m_previousSubtotal; }
const MyMoneyMoney& currenttotal ( void ) const { return m_currentSubtotal; }
unsigned depth ( void ) const { return m_depth; }
- const QString& name ( void ) const { return m_currentGroup; }
- const QString& oldName ( void ) const { return m_previousGroup; }
- const QString& groupField ( void ) const { return m_groupField; }
- const QString& subtotalField ( void ) const { return m_subtotalField; }
+ const TQString& name ( void ) const { return m_currentGroup; }
+ const TQString& oldName ( void ) const { return m_previousGroup; }
+ const TQString& groupField ( void ) const { return m_groupField; }
+ const TQString& subtotalField ( void ) const { return m_subtotalField; }
// ***DV*** HACK make the currentGroup test different but look the same
void force ( void ) { m_currentGroup += " "; }
private:
MyMoneyMoney m_currentSubtotal;
MyMoneyMoney m_previousSubtotal;
unsigned m_depth;
- QString m_currentGroup;
- QString m_previousGroup;
- QString m_groupField;
- QString m_subtotalField;
+ TQString m_currentGroup;
+ TQString m_previousGroup;
+ TQString m_groupField;
+ TQString m_subtotalField;
};
// ****************************************************************************
@@ -99,7 +99,7 @@ namespace reports {
{
bool result = false;
- QStringList::const_iterator it_criterion = m_sortCriteria.begin();
+ TQStringList::const_iterator it_criterion = m_sortCriteria.begin();
while ( it_criterion != m_sortCriteria.end() )
{
if ( this->operator[] ( *it_criterion ) < _compare[ *it_criterion ] )
@@ -145,28 +145,28 @@ namespace reports {
{
}
- void ListTable::render ( QString& result, QString& csv ) const
+ void ListTable::render ( TQString& result, TQString& csv ) const
{
MyMoneyMoney grandtotal;
MyMoneyFile* file = MyMoneyFile::instance();
result = "";
csv = "";
- result += QString ( "<h2 class=\"report\">%1</h2>\n" ).arg ( m_config.name() );
+ result += TQString ( "<h2 class=\"report\">%1</h2>\n" ).arg ( m_config.name() );
csv += "\"Report: " + m_config.name() + "\"\n";
//actual dates of the report
- result += QString("<div class=\"subtitle\">");
+ result += TQString("<div class=\"subtitle\">");
if(!m_config.fromDate().isNull()) {
- result += i18n("Report date range", "%1 through %2").arg(KGlobal::locale()->formatDate(m_config.fromDate(), true)).arg(KGlobal::locale()->formatDate(m_config.toDate(), true));
- result += QString("</div>\n");
- result += QString("<div class=\"gap\">&nbsp;</div>\n");
+ result += i18n("Report date range", "%1 through %2").tqarg(KGlobal::locale()->formatDate(m_config.fromDate(), true)).tqarg(KGlobal::locale()->formatDate(m_config.toDate(), true));
+ result += TQString("</div>\n");
+ result += TQString("<div class=\"gap\">&nbsp;</div>\n");
- csv += i18n("Report date range", "%1 through %2").arg(KGlobal::locale()->formatDate(m_config.fromDate(), true)).arg(KGlobal::locale()->formatDate(m_config.toDate(), true));
- csv += QString("\n");
+ csv += i18n("Report date range", "%1 through %2").tqarg(KGlobal::locale()->formatDate(m_config.fromDate(), true)).tqarg(KGlobal::locale()->formatDate(m_config.toDate(), true));
+ csv += TQString("\n");
}
- result += QString ( "<div class=\"subtitle\">" );
+ result += TQString ( "<div class=\"subtitle\">" );
if ( m_config.isConvertCurrency() )
{
result += i18n ( "All currencies converted to %1" ).arg ( file->baseCurrency().name() );
@@ -177,23 +177,23 @@ namespace reports {
result += i18n ( "All values shown in %1 unless otherwise noted" ).arg ( file->baseCurrency().name() );
csv += i18n ( "All values shown in %1 unless otherwise noted\n" ).arg ( file->baseCurrency().name() );
}
- result += QString ( "</div>\n" );
- result += QString ( "<div class=\"gap\">&nbsp;</div>\n" );
+ result += TQString ( "</div>\n" );
+ result += TQString ( "<div class=\"gap\">&nbsp;</div>\n" );
// retrieve the configuration parameters from the report definition.
// the things that we care about for query reports are:
// how to group the rows, what columns to display, and what field
// to subtotal on
- QStringList groups = QStringList::split ( ",", m_group );
- QStringList columns = QStringList::split ( ",", m_columns );
+ TQStringList groups = TQStringList::split ( ",", m_group );
+ TQStringList columns = TQStringList::split ( ",", m_columns );
columns += m_subtotal;
- QStringList postcolumns = QStringList::split ( ",", m_postcolumns );
+ TQStringList postcolumns = TQStringList::split ( ",", m_postcolumns );
columns += postcolumns;
//
// Table header
//
- QMap<QString, QString> i18nHeaders;
+ TQMap<TQString, TQString> i18nHeaders;
i18nHeaders["postdate"] = i18n ( "Date" );
i18nHeaders["value"] = i18n ( "Amount" );
i18nHeaders["number"] = i18n ( "Num" );
@@ -246,24 +246,24 @@ namespace reports {
i18nHeaders["currentbalance"] = i18n ( "Current Balance" );
// the list of columns which represent money, so we can display them correctly
- QStringList moneyColumns = QStringList::split ( ",", "value,shares,price,latestprice,netinvvalue,buys,sells,cashincome,reinvestincome,startingbal,fees,interest,payment,balance,balancewarning,maxbalancelimit,creditwarning,maxcreditlimit,loanamount,periodicpayment,finalpayment,currentbalance" );
+ TQStringList moneyColumns = TQStringList::split ( ",", "value,shares,price,latestprice,netinvvalue,buys,sells,cashincome,reinvestincome,startingbal,fees,interest,payment,balance,balancewarning,maxbalancelimit,creditwarning,maxcreditlimit,loanamount,periodicpayment,finalpayment,currentbalance" );
// the list of columns which represent shares, which is like money except the
// transaction currency will not be displayed
- QStringList sharesColumns = QStringList::split ( ",", "shares" );
+ TQStringList sharesColumns = TQStringList::split ( ",", "shares" );
// the list of columns which represent a percentage, so we can display them correctly
- QStringList percentColumns = QStringList::split ( ",", "return,returninvestment,interestrate" );
+ TQStringList percentColumns = TQStringList::split ( ",", "return,returninvestment,interestrate" );
// the list of columns which represent dates, so we can display them correctly
- QStringList dateColumns = QStringList::split ( ",", "postdate,entrydate,nextduedate,openingdate,nextinterestchange" );
+ TQStringList dateColumns = TQStringList::split ( ",", "postdate,entrydate,nextduedate,openingdate,nextinterestchange" );
result += "<table class=\"report\">\n<thead><tr class=\"itemheader\">";
- QStringList::const_iterator it_column = columns.begin();
+ TQStringList::const_iterator it_column = columns.begin();
while ( it_column != columns.end() )
{
- QString i18nName = i18nHeaders[*it_column];
+ TQString i18nName = i18nHeaders[*it_column];
if ( i18nName.isEmpty() )
i18nName = *it_column;
result += "<th>" + i18nName + "</th>";
@@ -286,8 +286,8 @@ namespace reports {
// header. The group iterator keeps track of a subtotal also.
int depth = 1;
- QValueList<GroupIterator> groupIteratorList;
- QStringList::const_iterator it_grouplevel = groups.begin();
+ TQValueList<GroupIterator> groupIteratorList;
+ TQStringList::const_iterator it_grouplevel = groups.begin();
while ( it_grouplevel != groups.end() )
{
groupIteratorList += GroupIterator ( ( *it_grouplevel ), m_subtotal, depth++ );
@@ -302,7 +302,7 @@ namespace reports {
// ***DV***
MyMoneyMoney startingBalance;
- for ( QValueList<TableRow>::const_iterator it_row = m_rows.begin();
+ for ( TQValueList<TableRow>::const_iterator it_row = m_rows.begin();
it_row != m_rows.end();
++it_row ) {
@@ -310,7 +310,7 @@ namespace reports {
// this could be overridden using the "fraction" element of a row for each row.
// Currently (2008-02-21) this override is not used at all (ipwizard)
int fraction = file->baseCurrency().smallestAccountFraction();
- if ( ( *it_row ).find ( "fraction" ) != ( *it_row ).end() )
+ if ( ( *it_row ).tqfind ( "fraction" ) != ( *it_row ).end() )
fraction = ( *it_row ) ["fraction"].toInt();
//
@@ -328,7 +328,7 @@ namespace reports {
// then we need to force all the downstream groups to get one too.
// Update the group iterators with the current row value
- QValueList<GroupIterator>::iterator it_group = groupIteratorList.begin();
+ TQValueList<GroupIterator>::iterator it_group = groupIteratorList.begin();
while ( it_group != groupIteratorList.end() )
{
( *it_group ).update ( *it_row );
@@ -347,17 +347,17 @@ namespace reports {
grandtotal += ( *it_group ).subtotal();
grandtotal = grandtotal.convert(fraction);
- QString subtotal_html = ( *it_group ).subtotal().formatMoney ( fraction );
- QString subtotal_csv = ( *it_group ).subtotal().formatMoney ( fraction, false );
+ TQString subtotal_html = ( *it_group ).subtotal().formatMoney ( fraction );
+ TQString subtotal_csv = ( *it_group ).subtotal().formatMoney ( fraction, false );
// ***DV*** HACK fix the side-effiect from .force() method above
- QString oldName = QString ( ( *it_group ).oldName() ).stripWhiteSpace();
+ TQString oldName = TQString ( ( *it_group ).oldName() ).stripWhiteSpace();
result +=
"<tr class=\"sectionfooter\">"
- "<td class=\"left" + QString::number ( ( ( *it_group ).depth() - 1 ) ) + "\" "
+ "<td class=\"left" + TQString::number ( ( ( *it_group ).depth() - 1 ) ) + "\" "
"colspan=\"" +
- QString::number ( columns.count() - 1 - postcolumns.count() ) + "\">" +
+ TQString::number ( columns.count() - 1 - postcolumns.count() ) + "\">" +
i18n ( "Total" ) + " " + oldName + "</td>"
"<td>" + subtotal_html + "</td></tr>\n";
@@ -376,8 +376,8 @@ namespace reports {
{
row_odd = true;
result += "<tr class=\"sectionheader\">"
- "<td class=\"left" + QString::number ( ( ( *it_group ).depth() - 1 ) ) + "\" "
- "colspan=\"" + QString::number ( columns.count() ) + "\">" +
+ "<td class=\"left" + TQString::number ( ( ( *it_group ).depth() - 1 ) ) + "\" "
+ "colspan=\"" + TQString::number ( columns.count() ) + "\">" +
( *it_group ).name() + "</td></tr>\n";
csv += "\"" + ( *it_group ).name() + "\"\n";
}
@@ -390,7 +390,7 @@ namespace reports {
// skip the opening and closing balance row,
// if the balance column is not shown
- if ( ( columns.contains ( "balance" ) == 0 ) && ( ( *it_row ) ["rank"] == "-2" ) )
+ if ( ( columns.tqcontains ( "balance" ) == 0 ) && ( ( *it_row ) ["rank"] == "-2" ) )
continue;
bool need_label = true;
@@ -399,17 +399,17 @@ namespace reports {
if ( ( * it_row ) ["rank"] == "0" ) row_odd = ! row_odd;
if ( ( * it_row ) ["rank"] == "-2" )
- result += QString ( "<tr class=\"item%1\">" ).arg ( ( * it_row ) ["id"] );
+ result += TQString ( "<tr class=\"item%1\">" ).arg ( ( * it_row ) ["id"] );
else
if ( ( * it_row ) ["rank"] == "1" )
- result += QString ( "<tr class=\"%1\">" ).arg ( row_odd ? "item1" : "item0" );
+ result += TQString ( "<tr class=\"%1\">" ).arg ( row_odd ? "item1" : "item0" );
else
- result += QString ( "<tr class=\"%1\">" ).arg ( row_odd ? "row-odd " : "row-even" );
+ result += TQString ( "<tr class=\"%1\">" ).arg ( row_odd ? "row-odd " : "row-even" );
- QStringList::const_iterator it_column = columns.begin();
+ TQStringList::const_iterator it_column = columns.begin();
while ( it_column != columns.end() )
{
- QString data = ( *it_row ) [*it_column];
+ TQString data = ( *it_row ) [*it_column];
// ***DV***
if ( ( * it_row ) ["rank"] == "1" ) {
@@ -468,61 +468,61 @@ namespace reports {
// TODO: This and the i18n headings are handled
// as a set of parallel vectors. Would be much better to make a single
// vector of a properties class.
- if ( sharesColumns.contains ( *it_column ) )
+ if ( sharesColumns.tqcontains ( *it_column ) )
{
if ( data.isEmpty() ) {
- result += QString ( "<td></td>" );
+ result += TQString ( "<td></td>" );
csv += "\"\",";
}
else {
- result += QString ( "<td>%1</td>" ).arg ( MyMoneyMoney ( data ).formatMoney ( "", 3 ) );
+ result += TQString ( "<td>%1</td>" ).arg ( MyMoneyMoney ( data ).formatMoney ( "", 3 ) );
csv += "\"" + MyMoneyMoney ( data ).formatMoney ( "", 3, false ) + "\",";
}
}
- else if ( moneyColumns.contains ( *it_column ) )
+ else if ( moneyColumns.tqcontains ( *it_column ) )
{
if ( data.isEmpty() ) {
- result += QString ( "<td%1></td>" )
+ result += TQString ( "<td%1></td>" )
.arg ( ( *it_column == "value" ) ? " class=\"value\"" : "" );
csv += "\"\",";
} else if ( MyMoneyMoney( data ) == MyMoneyMoney::autoCalc ) {
- result += QString ( "<td%1>%2</td>" )
+ result += TQString ( "<td%1>%2</td>" )
.arg ( ( *it_column == "value" ) ? " class=\"value\"" : "" )
.arg (i18n("Calculated"));
csv += "\""+ i18n("Calculated") +"\",";
} else if ( *it_column == "price" ) {
- result += QString ( "<td>%2</td>" )
+ result += TQString ( "<td>%2</td>" )
.arg ( MyMoneyMoney ( data ).formatMoney ( MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision()) ) );
csv += "\"" + ( *it_row ) ["currency"] + " " + MyMoneyMoney ( data ).formatMoney ( MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision()), false ) + "\",";
} else {
- result += QString ( "<td%1>%2&nbsp;%3</td>" )
+ result += TQString ( "<td%1>%2&nbsp;%3</td>" )
.arg ( ( *it_column == "value" ) ? " class=\"value\"" : "" )
.arg ( ( *it_row ) ["currency"] )
.arg ( MyMoneyMoney ( data ).formatMoney ( fraction ) );
csv += "\"" + ( *it_row ) ["currency"] + " " + MyMoneyMoney ( data ).formatMoney ( fraction, false ) + "\",";
}
}
- else if ( percentColumns.contains ( *it_column ) )
+ else if ( percentColumns.tqcontains ( *it_column ) )
{
data = ( MyMoneyMoney ( data ) * MyMoneyMoney ( 100, 1 ) ).formatMoney ( fraction );
- result += QString ( "<td>%1%</td>" ).arg ( data );
+ result += TQString ( "<td>%1%</td>" ).arg ( data );
csv += data + "%,";
}
- else if ( dateColumns.contains ( *it_column ) )
+ else if ( dateColumns.tqcontains ( *it_column ) )
{
// do this before we possibly change data
csv += "\"" + data + "\",";
// if we have a locale() then use its date formatter
if ( KGlobal::locale() && ! data.isEmpty() ) {
- QDate qd = QDate::fromString ( data, Qt::ISODate );
+ TQDate qd = TQDate::fromString ( data, Qt::ISODate );
data = KGlobal::locale()->formatDate ( qd, true );
}
- result += QString ( "<td class=\"left\">%1</td>" ).arg ( data );
+ result += TQString ( "<td class=\"left\">%1</td>" ).arg ( data );
}
else
{
- result += QString ( "<td class=\"left\">%1</td>" ).arg ( data );
+ result += TQString ( "<td class=\"left\">%1</td>" ).arg ( data );
csv += "\"" + data + "\",";
}
++it_column;
@@ -541,7 +541,7 @@ namespace reports {
if ( m_config.isConvertCurrency() )
{
int fraction = file->baseCurrency().smallestAccountFraction();
- QValueList<GroupIterator>::iterator it_group = groupIteratorList.fromLast();
+ TQValueList<GroupIterator>::iterator it_group = groupIteratorList.fromLast();
while ( it_group != groupIteratorList.end() )
{
( *it_group ).update ( TableRow() );
@@ -552,12 +552,12 @@ namespace reports {
}
- QString subtotal_html = ( *it_group ).subtotal().formatMoney ( fraction );
- QString subtotal_csv = ( *it_group ).subtotal().formatMoney ( fraction, false );
+ TQString subtotal_html = ( *it_group ).subtotal().formatMoney ( fraction );
+ TQString subtotal_csv = ( *it_group ).subtotal().formatMoney ( fraction, false );
result += "<tr class=\"sectionfooter\">"
- "<td class=\"left" + QString::number ( ( *it_group ).depth() - 1 ) + "\" "
- "colspan=\"" + QString::number ( columns.count() - 1 - postcolumns.count() ) + "\">" +
+ "<td class=\"left" + TQString::number ( ( *it_group ).depth() - 1 ) + "\" "
+ "colspan=\"" + TQString::number ( columns.count() - 1 - postcolumns.count() ) + "\">" +
i18n ( "Total" ) + " " + ( *it_group ).oldName() + "</td>"
"<td>" + subtotal_html + "</td></tr>\n";
csv += "\"" + i18n ( "Total" ) + " " + ( *it_group ).oldName() + "\",\"" + subtotal_csv + "\"\n";
@@ -568,12 +568,12 @@ namespace reports {
// Grand total
//
- QString grandtotal_html = grandtotal.formatMoney ( fraction );
- QString grandtotal_csv = grandtotal.formatMoney ( fraction, false );
+ TQString grandtotal_html = grandtotal.formatMoney ( fraction );
+ TQString grandtotal_csv = grandtotal.formatMoney ( fraction, false );
result += "<tr class=\"sectionfooter\">"
"<td class=\"left0\" "
- "colspan=\"" + QString::number ( columns.count() - 1 - postcolumns.count() ) + "\">" +
+ "colspan=\"" + TQString::number ( columns.count() - 1 - postcolumns.count() ) + "\">" +
i18n ( "Grand Total" ) + "</td>"
"<td>" + grandtotal_html + "</td></tr>\n";
csv += "\"" + i18n ( "Grand Total" ) + "\",\"" + grandtotal_csv + "\"\n";
@@ -581,29 +581,29 @@ namespace reports {
result += "</table>\n";
}
- QString ListTable::renderHTML ( void ) const
+ TQString ListTable::renderHTML ( void ) const
{
- QString html, csv;
+ TQString html, csv;
render ( html, csv );
return html;
}
- QString ListTable::renderCSV ( void ) const
+ TQString ListTable::renderCSV ( void ) const
{
- QString html, csv;
+ TQString html, csv;
render ( html, csv );
return csv;
}
- void ListTable::dump ( const QString& file, const QString& context ) const
+ void ListTable::dump ( const TQString& file, const TQString& context ) const
{
- QFile g ( file );
+ TQFile g ( file );
g.open ( IO_WriteOnly );
if ( ! context.isEmpty() )
- QTextStream ( &g ) << context.arg ( renderHTML() );
+ TQTextStream ( &g ) << context.arg ( renderHTML() );
else
- QTextStream ( &g ) << renderHTML();
+ TQTextStream ( &g ) << renderHTML();
g.close();
}
@@ -612,15 +612,15 @@ namespace reports {
// if we're not in expert mode, we need to make sure
// that all stock accounts for the selected investment
// account are also selected
- QStringList accountList;
+ TQStringList accountList;
if(m_config.accounts(accountList)) {
if(!KMyMoneyGlobalSettings::expertMode()) {
- QStringList::const_iterator it_a, it_b;
+ TQStringList::const_iterator it_a, it_b;
for(it_a = accountList.begin(); it_a != accountList.end(); ++it_a) {
MyMoneyAccount acc = MyMoneyFile::instance()->account(*it_a);
if(acc.accountType() == MyMoneyAccount::Investment) {
for(it_b = acc.accountList().begin(); it_b != acc.accountList().end(); ++it_b) {
- if(!accountList.contains(*it_b)) {
+ if(!accountList.tqcontains(*it_b)) {
m_config.addAccount(*it_b);
}
}