summaryrefslogtreecommitdiffstats
path: root/kmymoney2/views/kaccountsview.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/views/kaccountsview.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/views/kaccountsview.cpp')
-rw-r--r--kmymoney2/views/kaccountsview.cpp146
1 files changed, 73 insertions, 73 deletions
diff --git a/kmymoney2/views/kaccountsview.cpp b/kmymoney2/views/kaccountsview.cpp
index b0800cd..f84bf63 100644
--- a/kmymoney2/views/kaccountsview.cpp
+++ b/kmymoney2/views/kaccountsview.cpp
@@ -17,10 +17,10 @@
// ----------------------------------------------------------------------------
// QT Includes
-#include <qlabel.h>
-#include <qtabwidget.h>
-#include <qpixmap.h>
-#include <qlayout.h>
+#include <tqlabel.h>
+#include <tqtabwidget.h>
+#include <tqpixmap.h>
+#include <tqlayout.h>
// ----------------------------------------------------------------------------
// KDE Includes
@@ -43,8 +43,8 @@
#include "../kmymoney2.h"
-KMyMoneyAccountIconItem::KMyMoneyAccountIconItem(QIconView *parent, const MyMoneyAccount& account) :
- KIconViewItem(parent, account.name()),
+KMyMoneyAccountIconItem::KMyMoneyAccountIconItem(TQIconView *tqparent, const MyMoneyAccount& account) :
+ KIconViewItem(tqparent, account.name()),
m_account(account),
m_reconcileFlag(false)
{
@@ -68,29 +68,29 @@ void KMyMoneyAccountIconItem::updateAccount(const MyMoneyAccount& account)
setPixmap(account.accountPixmap(m_reconcileFlag));
}
-KAccountsView::KAccountsView(QWidget *parent, const char *name) :
- KAccountsViewDecl(parent,name),
+KAccountsView::KAccountsView(TQWidget *tqparent, const char *name) :
+ KAccountsViewDecl(tqparent,name),
m_assetItem(0),
m_liabilityItem(0)
{
// create the searchline widget
- // and insert it into the existing layout
- m_searchWidget = new KListViewSearchLineWidget(m_accountTree, m_accountTree->parentWidget());
- QVBoxLayout* layout = dynamic_cast<QVBoxLayout*>(m_accountTree->parentWidget()->layout());
- if(layout) {
- layout->insertWidget(0, m_searchWidget);
+ // and insert it into the existing tqlayout
+ m_searchWidget = new KListViewSearchLineWidget(m_accountTree, m_accountTree->tqparentWidget());
+ TQVBoxLayout* tqlayout = dynamic_cast<TQVBoxLayout*>(m_accountTree->tqparentWidget()->tqlayout());
+ if(tqlayout) {
+ tqlayout->insertWidget(0, m_searchWidget);
}
// setup icons for collapse and expand button
KIconLoader *ic = KGlobal::iconLoader();
KGuiItem collapseGuiItem("",
- QIconSet(ic->loadIcon("viewmag-", KIcon::Small, KIcon::SizeSmall)),
- QString(),
- QString());
+ TQIconSet(ic->loadIcon("viewmag-", KIcon::Small, KIcon::SizeSmall)),
+ TQString(),
+ TQString());
KGuiItem expandGuiItem("",
- QIconSet(ic->loadIcon("viewmag+", KIcon::Small, KIcon::SizeSmall)),
- QString(),
- QString());
+ TQIconSet(ic->loadIcon("viewmag+", KIcon::Small, KIcon::SizeSmall)),
+ TQString(),
+ TQString());
m_collapseButton->setGuiItem(collapseGuiItem);
m_expandButton->setGuiItem(expandGuiItem);
@@ -101,21 +101,21 @@ KAccountsView::KAccountsView(QWidget *parent, const char *name) :
config->setGroup("Last Use Settings");
m_tab->setCurrentPage(config->readNumEntry("KAccountsView_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(m_accountTree, SIGNAL(selectObject(const MyMoneyObject&)), this, SIGNAL(selectObject(const MyMoneyObject&)));
- connect(m_accountTree, SIGNAL(openContextMenu(const MyMoneyObject&)), this, SIGNAL(openContextMenu(const MyMoneyObject&)));
- connect(m_accountTree, SIGNAL(valueChanged(void)), this, SLOT(slotUpdateNetWorth(void)));
- connect(m_accountTree, SIGNAL(openObject(const MyMoneyObject&)), this, SIGNAL(openObject(const MyMoneyObject&)));
- connect(m_accountTree, SIGNAL(reparent(const MyMoneyAccount&, const MyMoneyAccount&)), this, SIGNAL(reparent(const MyMoneyAccount&, const MyMoneyAccount&)));
+ connect(m_accountTree, TQT_SIGNAL(selectObject(const MyMoneyObject&)), this, TQT_SIGNAL(selectObject(const MyMoneyObject&)));
+ connect(m_accountTree, TQT_SIGNAL(openContextMenu(const MyMoneyObject&)), this, TQT_SIGNAL(openContextMenu(const MyMoneyObject&)));
+ connect(m_accountTree, TQT_SIGNAL(valueChanged(void)), this, TQT_SLOT(slotUpdateNetWorth(void)));
+ connect(m_accountTree, TQT_SIGNAL(openObject(const MyMoneyObject&)), this, TQT_SIGNAL(openObject(const MyMoneyObject&)));
+ connect(m_accountTree, TQT_SIGNAL(reparent(const MyMoneyAccount&, const MyMoneyAccount&)), this, TQT_SIGNAL(reparent(const MyMoneyAccount&, const MyMoneyAccount&)));
- connect(m_accountIcons, SIGNAL(selectionChanged(QIconViewItem*)), this, SLOT(slotSelectIcon(QIconViewItem*)));
- connect(m_accountIcons, SIGNAL(rightButtonClicked(QIconViewItem*, const QPoint&)), this, SLOT(slotOpenContext(QIconViewItem*)));
- connect(m_accountIcons, SIGNAL(executed(QIconViewItem*)), this, SLOT(slotOpenObject(QIconViewItem*)));
+ connect(m_accountIcons, TQT_SIGNAL(selectionChanged(TQIconViewItem*)), this, TQT_SLOT(slotSelectIcon(TQIconViewItem*)));
+ connect(m_accountIcons, TQT_SIGNAL(rightButtonClicked(TQIconViewItem*, const TQPoint&)), this, TQT_SLOT(slotOpenContext(TQIconViewItem*)));
+ connect(m_accountIcons, TQT_SIGNAL(executed(TQIconViewItem*)), this, TQT_SLOT(slotOpenObject(TQIconViewItem*)));
- connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadAccounts()));
- connect(m_collapseButton, SIGNAL(clicked()), this, SLOT(slotExpandCollapse()));
- connect(m_expandButton, SIGNAL(clicked()), this, SLOT(slotExpandCollapse()));
+ connect(MyMoneyFile::instance(), TQT_SIGNAL(dataChanged()), this, TQT_SLOT(slotLoadAccounts()));
+ connect(m_collapseButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotExpandCollapse()));
+ connect(m_expandButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotExpandCollapse()));
}
KAccountsView::~KAccountsView()
@@ -137,7 +137,7 @@ void KAccountsView::slotLoadAccounts(void)
slotTabChanged(m_tab->currentPage());
}
-void KAccountsView::slotTabChanged(QWidget* _tab)
+void KAccountsView::slotTabChanged(TQWidget* _tab)
{
AccountsViewTab tab = static_cast<AccountsViewTab>(m_tab->indexOf(_tab));
@@ -196,7 +196,7 @@ void KAccountsView::polish(void)
{
// don't forget base class implementation
KAccountsViewDecl::polish();
- m_accountTree->setResizeMode(QListView::LastColumn);
+ m_accountTree->setResizeMode(TQListView::LastColumn);
m_accountTree->restoreLayout("Account View Settings");
}
@@ -222,7 +222,7 @@ void KAccountsView::loadIconView(void)
::timetrace("start load accounts icon view");
// remember the positions of the icons
- QMap<QString, QPoint> posMap;
+ TQMap<TQString, TQPoint> posMap;
KMyMoneyAccountIconItem* p = dynamic_cast<KMyMoneyAccountIconItem*>(m_accountIcons->firstItem());
for(;p; p = dynamic_cast<KMyMoneyAccountIconItem*>(p->nextItem()))
posMap[p->itemObject().id()] = p->pos();
@@ -232,16 +232,16 @@ void KAccountsView::loadIconView(void)
// clear the current contents and recreate it
m_accountIcons->clear();
- QMap<QString, MyMoneyAccount> accountMap;
+ TQMap<TQString, MyMoneyAccount> accountMap;
MyMoneyFile* file = MyMoneyFile::instance();
// get account list and sort by name
- QValueList<MyMoneyAccount> alist;
+ TQValueList<MyMoneyAccount> alist;
file->accountList(alist);
- QValueList<MyMoneyAccount>::const_iterator it_a;
+ TQValueList<MyMoneyAccount>::const_iterator it_a;
for(it_a = alist.begin(); it_a != alist.end(); ++it_a) {
- accountMap[QString("%1-%2").arg((*it_a).name()).arg((*it_a).id())] = *it_a;
+ accountMap[TQString("%1-%2").tqarg((*it_a).name()).tqarg((*it_a).id())] = *it_a;
}
bool showClosedAccounts = kmymoney2->toggleAction("view_show_all_accounts")->isChecked()
@@ -249,12 +249,12 @@ void KAccountsView::loadIconView(void)
bool existNewIcons = false;
// parse list and add all asset and liability accounts
- QMap<QString, MyMoneyAccount>::const_iterator it;
+ TQMap<TQString, MyMoneyAccount>::const_iterator it;
for(it = accountMap.begin(); it != accountMap.end(); ++it) {
- QPoint loc;
+ TQPoint loc;
if((*it).isClosed() && !showClosedAccounts)
continue;
- const QString& pos = (*it).value("kmm-iconpos");
+ const TQString& pos = (*it).value("kmm-iconpos");
KMyMoneyAccountIconItem* item;
switch((*it).accountGroup()) {
case MyMoneyAccount::Equity:
@@ -271,12 +271,12 @@ void KAccountsView::loadIconView(void)
// if we have a position stored with the object and no other
// idea of it's current position, then take the one
// stored inside the object. Also, turn off auto arrangement
- if(!pos.isEmpty() && posMap[(*it).id()] == QPoint()) {
+ if(!pos.isEmpty() && posMap[(*it).id()] == TQPoint()) {
posMap[(*it).id()] = point(pos);
}
loc = posMap[(*it).id()];
- if(loc == QPoint()) {
+ if(loc == TQPoint()) {
existNewIcons = true;
} else {
m_accountIcons->setAutoArrange(false);
@@ -286,7 +286,7 @@ void KAccountsView::loadIconView(void)
if((*it).id() == m_reconciliationAccount.id())
item->setReconciliation(true);
- if(loc != QPoint()) {
+ if(loc != TQPoint()) {
item->move(loc);
}
break;
@@ -311,15 +311,15 @@ void KAccountsView::loadIconView(void)
void KAccountsView::loadListView(void)
{
- QMap<QString, bool> isOpen;
+ TQMap<TQString, bool> isOpen;
::timetrace("start load accounts list view");
// remember the id of the current selected item
KMyMoneyAccountTreeBaseItem *item = m_accountTree->selectedItem();
- QString selectedItemId = (item) ? item->id() : QString();
+ TQString selectedItemId = (item) ? item->id() : TQString();
// keep a map of all 'expanded' accounts
- QListViewItemIterator it_lvi(m_accountTree);
+ TQListViewItemIterator it_lvi(m_accountTree);
while(it_lvi.current()) {
item = dynamic_cast<KMyMoneyAccountTreeItem*>(it_lvi.current());
if(item && item->isOpen()) {
@@ -329,7 +329,7 @@ void KAccountsView::loadListView(void)
}
// remember the upper left corner of the viewport
- QPoint startPoint = m_accountTree->viewportToContents(QPoint(0, 0));
+ TQPoint startPoint = m_accountTree->viewportToContents(TQPoint(0, 0));
// turn off updates to avoid flickering during reload
m_accountTree->setUpdatesEnabled(false);
@@ -344,9 +344,9 @@ void KAccountsView::loadListView(void)
MyMoneyFile* file = MyMoneyFile::instance();
- QValueList<MyMoneySecurity> slist = file->currencyList();
+ TQValueList<MyMoneySecurity> slist = file->currencyList();
slist += file->securityList();
- QValueList<MyMoneySecurity>::const_iterator it_s;
+ TQValueList<MyMoneySecurity>::const_iterator it_s;
for(it_s = slist.begin(); it_s != slist.end(); ++it_s) {
m_securityMap[(*it_s).id()] = *it_s;
}
@@ -388,13 +388,13 @@ void KAccountsView::loadListView(void)
// scan through the list of accounts and re-expand those that were
// expanded and re-select the one that was probably selected before
- it_lvi = QListViewItemIterator(m_accountTree);
+ it_lvi = TQListViewItemIterator(m_accountTree);
while(it_lvi.current()) {
item = dynamic_cast<KMyMoneyAccountTreeItem*>(it_lvi.current());
if(item) {
if(item->id() == selectedItemId)
m_accountTree->setSelected(item, true);
- if(isOpen.find(item->id()) != isOpen.end())
+ if(isOpen.tqfind(item->id()) != isOpen.end())
item->setOpen(true);
}
++it_lvi;
@@ -403,11 +403,11 @@ void KAccountsView::loadListView(void)
// reposition viewport
m_accountTree->setContentsPos(startPoint.x(), startPoint.y());
- m_searchWidget->searchLine()->updateSearch(QString::null);
+ m_searchWidget->searchLine()->updateSearch(TQString());
// turn updates back on
m_accountTree->setUpdatesEnabled(true);
- m_accountTree->repaintContents();
+ m_accountTree->tqrepaintContents();
// and in case we need to show things expanded, we'll do so
if(KMyMoneyGlobalSettings::showAccountsExpanded())
@@ -419,7 +419,7 @@ void KAccountsView::loadListView(void)
::timetrace("done load accounts list view");
}
-bool KAccountsView::loadSubAccounts(KMyMoneyAccountTreeItem* parent, const QStringList& accountList)
+bool KAccountsView::loadSubAccounts(KMyMoneyAccountTreeItem* tqparent, const TQStringList& accountList)
{
MyMoneyFile* file = MyMoneyFile::instance();
@@ -427,10 +427,10 @@ bool KAccountsView::loadSubAccounts(KMyMoneyAccountTreeItem* parent, const QStri
bool showClosedAccounts = kmymoney2->toggleAction("view_show_all_accounts")->isChecked()
|| !KMyMoneyGlobalSettings::hideClosedAccounts();
- QStringList::const_iterator it_a;
+ TQStringList::const_iterator it_a;
for(it_a = accountList.begin(); it_a != accountList.end(); ++it_a) {
const MyMoneyAccount& acc = file->account(*it_a);
- QValueList<MyMoneyPrice> prices;
+ TQValueList<MyMoneyPrice> prices;
MyMoneySecurity security = file->baseCurrency();
try {
if(acc.isInvest()) {
@@ -452,7 +452,7 @@ bool KAccountsView::loadSubAccounts(KMyMoneyAccountTreeItem* parent, const QStri
delete e;
}
- KMyMoneyAccountTreeItem* item = new KMyMoneyAccountTreeItem(parent, acc, prices, security);
+ KMyMoneyAccountTreeItem* item = new KMyMoneyAccountTreeItem(tqparent, acc, prices, security);
if(acc.id() == m_reconciliationAccount.id())
item->setReconciliation(true);
@@ -478,14 +478,14 @@ bool KAccountsView::loadSubAccounts(KMyMoneyAccountTreeItem* parent, const QStri
return unused;
}
-void KAccountsView::slotReconcileAccount(const MyMoneyAccount& acc, const QDate& reconciliationDate, const MyMoneyMoney& endingBalance)
+void KAccountsView::slotReconcileAccount(const MyMoneyAccount& acc, const TQDate& reconciliationDate, const MyMoneyMoney& endingBalance)
{
Q_UNUSED(reconciliationDate);
Q_UNUSED(endingBalance);
// scan through the list of accounts and mark all non
// expanded and re-select the one that was probably selected before
- QListViewItemIterator it_lvi(m_accountTree);
+ TQListViewItemIterator it_lvi(m_accountTree);
KMyMoneyAccountTreeItem* item;
while(it_lvi.current()) {
item = dynamic_cast<KMyMoneyAccountTreeItem*>(it_lvi.current());
@@ -506,7 +506,7 @@ void KAccountsView::slotReconcileAccount(const MyMoneyAccount& acc, const QDate&
if(!acc.id().isEmpty()) {
// scan through the list of accounts and mark
// the one that is currently reconciled
- it_lvi = QListViewItemIterator(m_accountTree);
+ it_lvi = TQListViewItemIterator(m_accountTree);
while(it_lvi.current()) {
item = dynamic_cast<KMyMoneyAccountTreeItem*>(it_lvi.current());
if(item && item->itemObject().id() == acc.id()) {
@@ -534,19 +534,19 @@ void KAccountsView::slotUpdateNetWorth(void)
MyMoneyMoney netWorth = m_assetItem->totalValue() - m_liabilityItem->totalValue();
- QString s(i18n("Net Worth: "));
+ TQString s(i18n("Net Worth: "));
// FIXME figure out how to deal with the approximate
// if(!(file->totalValueValid(assetAccount.id()) & file->totalValueValid(liabilityAccount.id())))
// s += "~ ";
- s.replace(QString(" "), QString("&nbsp;"));
+ s.tqreplace(TQString(" "), TQString("&nbsp;"));
if(netWorth.isNegative()) {
s += "<b><font color=\"red\">";
}
const MyMoneySecurity& sec = MyMoneyFile::instance()->baseCurrency();
- QString v(netWorth.formatMoney(sec));
- s += v.replace(QString(" "), QString("&nbsp;"));
+ TQString v(netWorth.formatMoney(sec));
+ s += v.tqreplace(TQString(" "), TQString("&nbsp;"));
if(netWorth.isNegative()) {
s += "</font></b>";
}
@@ -560,42 +560,42 @@ KMyMoneyAccountIconItem* KAccountsView::selectedIcon(void) const
return dynamic_cast<KMyMoneyAccountIconItem*>(m_accountIcons->currentItem());
}
-void KAccountsView::slotSelectIcon(QIconViewItem* item)
+void KAccountsView::slotSelectIcon(TQIconViewItem* item)
{
KMyMoneyAccountIconItem* p = dynamic_cast<KMyMoneyAccountIconItem*>(item);
if(p)
emit selectObject(p->itemObject());
}
-void KAccountsView::slotOpenContext(QIconViewItem* item)
+void KAccountsView::slotOpenContext(TQIconViewItem* item)
{
KMyMoneyAccountIconItem* p = dynamic_cast<KMyMoneyAccountIconItem*>(item);
if(p)
emit openContextMenu(p->itemObject());
}
-void KAccountsView::slotOpenObject(QIconViewItem* item)
+void KAccountsView::slotOpenObject(TQIconViewItem* item)
{
KMyMoneyAccountIconItem* p = dynamic_cast<KMyMoneyAccountIconItem*>(item);
if(p)
emit openObject(p->itemObject());
}
-QString KAccountsView::point(const QPoint& val) const
+TQString KAccountsView::point(const TQPoint& val) const
{
- return QString("%1;%2").arg(val.x()).arg(val.y());
+ return TQString("%1;%2").tqarg(val.x()).tqarg(val.y());
}
-QPoint KAccountsView::point(const QString& val) const
+TQPoint KAccountsView::point(const TQString& val) const
{
- QRegExp exp("(\\d+);(\\d+)");
+ TQRegExp exp("(\\d+);(\\d+)");
int x = 0;
int y = 0;
if(exp.search(val) != -1) {
x = exp.cap(1).toInt();
y = exp.cap(2).toInt();
}
- return QPoint(x, y);
+ return TQPoint(x, y);
}
void KAccountsView::slotUpdateIconPos(unsigned int action)