From fecb0e67b23e8b83ba7fc881bb57bc48c0852d62 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 5 Jul 2011 06:00:29 +0000 Subject: 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 --- kmymoney2/views/kcategoriesview.cpp | 84 ++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'kmymoney2/views/kcategoriesview.cpp') diff --git a/kmymoney2/views/kcategoriesview.cpp b/kmymoney2/views/kcategoriesview.cpp index e01d62b..3c31f34 100644 --- a/kmymoney2/views/kcategoriesview.cpp +++ b/kmymoney2/views/kcategoriesview.cpp @@ -23,8 +23,8 @@ // ---------------------------------------------------------------------------- // QT Includes -#include -#include +#include +#include // ---------------------------------------------------------------------------- // KDE Includes @@ -46,44 +46,44 @@ #include "../kmymoney2.h" -KCategoriesView::KCategoriesView(QWidget *parent, const char *name ) : - KCategoriesViewDecl(parent, name), +KCategoriesView::KCategoriesView(TQWidget *tqparent, const char *name ) : + KCategoriesViewDecl(tqparent, name), m_incomeItem(0), m_expenseItem(0), m_needReload(false) { // create the searchline widget - // and insert it into the existing layout - m_searchWidget = new KListViewSearchLineWidget(m_accountTree, m_accountTree->parentWidget()); - QVBoxLayout* layout = dynamic_cast(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(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); m_accountTree->setSectionHeader(i18n("Category")); - 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(slotUpdateProfit(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(slotUpdateProfit(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(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())); } KCategoriesView::~KCategoriesView() @@ -118,7 +118,7 @@ void KCategoriesView::show(void) void KCategoriesView::polish(void) { KCategoriesViewDecl::polish(); - m_accountTree->setResizeMode(QListView::LastColumn); + m_accountTree->setResizeMode(TQListView::LastColumn); m_accountTree->restoreLayout("Category View Settings"); } @@ -134,15 +134,15 @@ void KCategoriesView::slotLoadAccounts(void) void KCategoriesView::loadAccounts(void) { - QMap isOpen; + TQMap isOpen; ::timetrace("start load categories 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(it_lvi.current()); if(item && item->isOpen()) { @@ -152,7 +152,7 @@ void KCategoriesView::loadAccounts(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); @@ -167,9 +167,9 @@ void KCategoriesView::loadAccounts(void) MyMoneyFile* file = MyMoneyFile::instance(); - QValueList slist = file->currencyList(); + TQValueList slist = file->currencyList(); slist += file->securityList(); - QValueList::const_iterator it_s; + TQValueList::const_iterator it_s; for(it_s = slist.begin(); it_s != slist.end(); ++it_s) { m_securityMap[(*it_s).id()] = *it_s; } @@ -198,13 +198,13 @@ void KCategoriesView::loadAccounts(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(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; @@ -213,11 +213,11 @@ void KCategoriesView::loadAccounts(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()) @@ -229,16 +229,16 @@ void KCategoriesView::loadAccounts(void) ::timetrace("done load categories view"); } -bool KCategoriesView::loadSubAccounts(KMyMoneyAccountTreeItem* parent, const QStringList& accountList) +bool KCategoriesView::loadSubAccounts(KMyMoneyAccountTreeItem* tqparent, const TQStringList& accountList) { MyMoneyFile* file = MyMoneyFile::instance(); bool unused = false; - 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 prices; + TQValueList prices; MyMoneySecurity security = file->baseCurrency(); try { if(acc.isInvest()) { @@ -260,7 +260,7 @@ bool KCategoriesView::loadSubAccounts(KMyMoneyAccountTreeItem* parent, const QSt delete e; } - KMyMoneyAccountTreeItem* item = new KMyMoneyAccountTreeItem(parent, acc, prices, security); + KMyMoneyAccountTreeItem* item = new KMyMoneyAccountTreeItem(tqparent, acc, prices, security); unused |= loadSubAccounts(item, acc.accountList()); // no child accounts and not transactions in this account means 'unused' @@ -286,7 +286,7 @@ void KCategoriesView::slotUpdateProfit(void) MyMoneyMoney profit = m_incomeItem->totalValue() - m_expenseItem->totalValue(); - QString s(i18n("Profit: ")); + TQString s(i18n("Profit: ")); if(profit.isNegative()) s = i18n("Loss: "); @@ -294,13 +294,13 @@ void KCategoriesView::slotUpdateProfit(void) // if(!(file->totalValueValid(assetAccount.id()) & file->totalValueValid(liabilityAccount.id()))) // s += "~ "; - s.replace(QString(" "), QString(" ")); + s.tqreplace(TQString(" "), TQString(" ")); if(profit.isNegative()) { s += ""; } const MyMoneySecurity& sec = MyMoneyFile::instance()->baseCurrency(); - QString v(profit.abs().formatMoney(sec)); - s += v.replace(QString(" "), QString(" ")); + TQString v(profit.abs().formatMoney(sec)); + s += v.tqreplace(TQString(" "), TQString(" ")); if(profit.isNegative()) { s += ""; } -- cgit v1.2.1