summaryrefslogtreecommitdiffstats
path: root/kmymoney2/widgets/kmymoneyaccountselector.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/widgets/kmymoneyaccountselector.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/widgets/kmymoneyaccountselector.cpp')
-rw-r--r--kmymoney2/widgets/kmymoneyaccountselector.cpp204
1 files changed, 102 insertions, 102 deletions
diff --git a/kmymoney2/widgets/kmymoneyaccountselector.cpp b/kmymoney2/widgets/kmymoneyaccountselector.cpp
index f1596b4..762591f 100644
--- a/kmymoney2/widgets/kmymoneyaccountselector.cpp
+++ b/kmymoney2/widgets/kmymoneyaccountselector.cpp
@@ -23,13 +23,13 @@
// ----------------------------------------------------------------------------
// QT Includes
-#include <qlayout.h>
-#include <qheader.h>
-#include <qlabel.h>
-#include <qtimer.h>
-#include <qpainter.h>
-#include <qstyle.h>
-#include <qrect.h>
+#include <tqlayout.h>
+#include <tqheader.h>
+#include <tqlabel.h>
+#include <tqtimer.h>
+#include <tqpainter.h>
+#include <tqstyle.h>
+#include <tqrect.h>
// ----------------------------------------------------------------------------
// KDE Includes
@@ -49,8 +49,8 @@
#include "../kmymoneyutils.h"
#include "../kmymoneyglobalsettings.h"
-kMyMoneyAccountSelector::kMyMoneyAccountSelector(QWidget *parent, const char *name, QWidget::WFlags flags, const bool createButtons) :
- KMyMoneySelector(parent, name, flags),
+kMyMoneyAccountSelector::kMyMoneyAccountSelector(TQWidget *tqparent, const char *name, TQWidget::WFlags flags, const bool createButtons) :
+ KMyMoneySelector(tqparent, name, flags),
m_allAccountsButton(0),
m_noAccountButton(0),
m_incomeCategoriesButton(0),
@@ -58,7 +58,7 @@ kMyMoneyAccountSelector::kMyMoneyAccountSelector(QWidget *parent, const char *na
{
if(createButtons) {
- QVBoxLayout* buttonLayout = new QVBoxLayout( 0, 0, 6, "accountSelectorButtonLayout");
+ TQVBoxLayout* buttonLayout = new TQVBoxLayout( 0, 0, 6, "accountSelectorButtonLayout");
m_allAccountsButton = new KPushButton( this, "m_allAccountsButton" );
m_allAccountsButton->setText( i18n( "All" ) );
@@ -76,14 +76,14 @@ kMyMoneyAccountSelector::kMyMoneyAccountSelector(QWidget *parent, const char *na
m_noAccountButton->setText( i18n( "None" ) );
buttonLayout->addWidget( m_noAccountButton );
- QSpacerItem* spacer = new QSpacerItem( 0, 67, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ TQSpacerItem* spacer = new TQSpacerItem( 0, 67, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
buttonLayout->addItem( spacer );
m_layout->addLayout( buttonLayout );
- connect(m_allAccountsButton, SIGNAL(clicked()), this, SLOT(slotSelectAllAccounts()));
- connect(m_noAccountButton, SIGNAL(clicked()), this, SLOT(slotDeselectAllAccounts()));
- connect(m_incomeCategoriesButton, SIGNAL(clicked()), this, SLOT(slotSelectIncomeCategories()));
- connect(m_expenseCategoriesButton, SIGNAL(clicked()), this, SLOT(slotSelectExpenseCategories()));
+ connect(m_allAccountsButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSelectAllAccounts()));
+ connect(m_noAccountButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotDeselectAllAccounts()));
+ connect(m_incomeCategoriesButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSelectIncomeCategories()));
+ connect(m_expenseCategoriesButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSelectExpenseCategories()));
}
// sort the list of accounts in ascending order
@@ -104,10 +104,10 @@ void kMyMoneyAccountSelector::removeButtons(void)
void kMyMoneyAccountSelector::selectCategories(const bool income, const bool expense)
{
- QListViewItem* it_v;
+ TQListViewItem* it_v;
for(it_v = m_listView->firstChild(); it_v != 0; it_v = it_v->nextSibling()) {
- if(static_cast<QCheckListItem*>(it_v)->text() == i18n("Income categories"))
+ if(static_cast<TQCheckListItem*>(it_v)->text() == i18n("Income categories"))
selectAllSubItems(it_v, income);
else
selectAllSubItems(it_v, expense);
@@ -115,35 +115,35 @@ void kMyMoneyAccountSelector::selectCategories(const bool income, const bool exp
emit stateChanged();
}
-void kMyMoneyAccountSelector::setSelectionMode(QListView::SelectionMode mode)
+void kMyMoneyAccountSelector::setSelectionMode(TQListView::SelectionMode mode)
{
- m_incomeCategoriesButton->setHidden(mode == QListView::Multi);
- m_expenseCategoriesButton->setHidden(mode == QListView::Multi);
+ m_incomeCategoriesButton->setHidden(mode == TQListView::Multi);
+ m_expenseCategoriesButton->setHidden(mode == TQListView::Multi);
KMyMoneySelector::setSelectionMode(mode);
}
-QStringList kMyMoneyAccountSelector::accountList(const QValueList<MyMoneyAccount::accountTypeE>& filterList) const
+TQStringList kMyMoneyAccountSelector::accountList(const TQValueList<MyMoneyAccount::accountTypeE>& filterList) const
{
- QStringList list;
- QListViewItemIterator it;
- QListViewItem* it_v;
- QValueList<MyMoneyAccount::accountTypeE>::ConstIterator it_f;
+ TQStringList list;
+ TQListViewItemIterator it;
+ TQListViewItem* it_v;
+ TQValueList<MyMoneyAccount::accountTypeE>::ConstIterator it_f;
- it = QListViewItemIterator(m_listView, QListViewItemIterator::Selectable);
+ it = TQListViewItemIterator(m_listView, TQListViewItemIterator::Selectable);
while((it_v = it.current()) != 0) {
{
if(it_v->rtti() == 1) {
KMyMoneyCheckListItem* it_c = dynamic_cast<KMyMoneyCheckListItem*>(it_v);
- if(it_c->type() == QCheckListItem::CheckBox) {
+ if(it_c->type() == TQCheckListItem::CheckBox) {
MyMoneyAccount acc = MyMoneyFile::instance()->account(it_c->id());
- it_f = filterList.find(acc.accountType());
+ it_f = filterList.tqfind(acc.accountType());
if(filterList.count() == 0 || it_f != filterList.end())
list << it_c->id();
}
} else if(it_v->rtti() == 0) {
KMyMoneyListViewItem* it_c = dynamic_cast<KMyMoneyListViewItem*>(it_v);
MyMoneyAccount acc = MyMoneyFile::instance()->account(it_c->id());
- it_f = filterList.find(acc.accountType());
+ it_f = filterList.tqfind(acc.accountType());
if(filterList.count() == 0 || it_f != filterList.end())
list << it_c->id();
}
@@ -153,7 +153,7 @@ QStringList kMyMoneyAccountSelector::accountList(const QValueList<MyMoneyAccoun
return list;
}
-bool kMyMoneyAccountSelector::match(const QRegExp& exp, QListViewItem* item) const
+bool kMyMoneyAccountSelector::match(const TQRegExp& exp, TQListViewItem* item) const
{
if(!item->isSelectable())
return false;
@@ -169,12 +169,12 @@ bool kMyMoneyAccountSelector::match(const QRegExp& exp, QListViewItem* item) con
return exp.search(it_l->key(1, true)) != -1;
}
-bool kMyMoneyAccountSelector::contains(const QString& txt) const
+bool kMyMoneyAccountSelector::tqcontains(const TQString& txt) const
{
- QListViewItemIterator it(m_listView, QListViewItemIterator::Selectable);
- QListViewItem* it_v;
+ TQListViewItemIterator it(m_listView, TQListViewItemIterator::Selectable);
+ TQListViewItem* it_v;
- QString baseName = i18n("Asset") + "|" +
+ TQString baseName = i18n("Asset") + "|" +
i18n("Liability") + "|" +
i18n("Income")+ "|" +
i18n("Expense")+ "|" +
@@ -182,7 +182,7 @@ bool kMyMoneyAccountSelector::contains(const QString& txt) const
i18n("Security");
while((it_v = it.current()) != 0) {
- QRegExp exp(QString("^(?:%1):%2$").arg(baseName).arg(QRegExp::escape(txt)));
+ TQRegExp exp(TQString("^(?:%1):%2$").tqarg(baseName).tqarg(TQRegExp::escape(txt)));
if(it_v->rtti() == 1) {
KMyMoneyCheckListItem* it_c = dynamic_cast<KMyMoneyCheckListItem*>(it_v);
if(exp.search(it_c->key(1, true)) != -1) {
@@ -200,24 +200,24 @@ bool kMyMoneyAccountSelector::contains(const QString& txt) const
}
# if 0
-void kMyMoneyAccountSelector::update(const QString& /* id */)
+void kMyMoneyAccountSelector::update(const TQString& /* id */)
{
- QListViewItem* it_v = m_listView->currentItem();
- QString previousHighlighted;
+ TQListViewItem* it_v = m_listView->currentItem();
+ TQString previousHighlighted;
bool state = false;
- if(m_selMode == QListView::Multi && it_v) {
+ if(m_selMode == TQListView::Multi && it_v) {
if(it_v->rtti() == 1) {
KMyMoneyCheckListItem* it_c = static_cast<KMyMoneyCheckListItem*>(it_v);
- if(it_c->type() == QCheckListItem::CheckBox) {
+ if(it_c->type() == TQCheckListItem::CheckBox) {
previousHighlighted = it_c->id();
state = it_c->isOn();
}
}
}
- QStringList list = selectedAccounts();
- QStringList::Iterator it;
+ TQStringList list = selectedAccounts();
+ TQStringList::Iterator it;
if(!m_typeList.isEmpty())
loadList(m_typeList);
@@ -233,7 +233,7 @@ void kMyMoneyAccountSelector::update(const QString& /* id */)
setSelected(*it, true);
}
- if(m_selMode == QListView::Multi) {
+ if(m_selMode == TQListView::Multi) {
// make the previous highlighted item highlighted again
if(!previousHighlighted.isEmpty()) {
setSelected(previousHighlighted);
@@ -287,8 +287,8 @@ void AccountSet::addAccountType(MyMoneyAccount::accountTypeE type)
void AccountSet::removeAccountType(MyMoneyAccount::accountTypeE type)
{
- QValueList<MyMoneyAccount::accountTypeE>::iterator it;
- it = m_typeList.find(type);
+ TQValueList<MyMoneyAccount::accountTypeE>::iterator it;
+ it = m_typeList.tqfind(type);
if(it != m_typeList.end()) {
m_typeList.remove(it);
}
@@ -301,93 +301,93 @@ void AccountSet::clear(void)
int AccountSet::load(kMyMoneyAccountSelector* selector)
{
- QStringList list;
- QStringList::ConstIterator it_l;
+ TQStringList list;
+ TQStringList::ConstIterator it_l;
int count = 0;
int typeMask = 0;
- QString currentId;
+ TQString currentId;
- if(selector->selectionMode() == QListView::Single) {
- QStringList list;
+ if(selector->selectionMode() == TQListView::Single) {
+ TQStringList list;
selector->selectedItems(list);
if(list.count() > 0)
currentId = list.first();
}
- if((m_typeList.contains(MyMoneyAccount::Checkings)
- + m_typeList.contains(MyMoneyAccount::Savings)
- + m_typeList.contains(MyMoneyAccount::Cash)
- + m_typeList.contains(MyMoneyAccount::AssetLoan)
- + m_typeList.contains(MyMoneyAccount::CertificateDep)
- + m_typeList.contains(MyMoneyAccount::Investment)
- + m_typeList.contains(MyMoneyAccount::Stock)
- + m_typeList.contains(MyMoneyAccount::MoneyMarket)
- + m_typeList.contains(MyMoneyAccount::Asset)
- + m_typeList.contains(MyMoneyAccount::Currency)) > 0)
+ if((m_typeList.tqcontains(MyMoneyAccount::Checkings)
+ + m_typeList.tqcontains(MyMoneyAccount::Savings)
+ + m_typeList.tqcontains(MyMoneyAccount::Cash)
+ + m_typeList.tqcontains(MyMoneyAccount::AssetLoan)
+ + m_typeList.tqcontains(MyMoneyAccount::CertificateDep)
+ + m_typeList.tqcontains(MyMoneyAccount::Investment)
+ + m_typeList.tqcontains(MyMoneyAccount::Stock)
+ + m_typeList.tqcontains(MyMoneyAccount::MoneyMarket)
+ + m_typeList.tqcontains(MyMoneyAccount::Asset)
+ + m_typeList.tqcontains(MyMoneyAccount::Currency)) > 0)
typeMask |= KMyMoneyUtils::asset;
- if((m_typeList.contains(MyMoneyAccount::CreditCard)
- + m_typeList.contains(MyMoneyAccount::Loan)
- + m_typeList.contains(MyMoneyAccount::Liability)) > 0)
+ if((m_typeList.tqcontains(MyMoneyAccount::CreditCard)
+ + m_typeList.tqcontains(MyMoneyAccount::Loan)
+ + m_typeList.tqcontains(MyMoneyAccount::Liability)) > 0)
typeMask |= KMyMoneyUtils::liability;
- if((m_typeList.contains(MyMoneyAccount::Income)) > 0)
+ if((m_typeList.tqcontains(MyMoneyAccount::Income)) > 0)
typeMask |= KMyMoneyUtils::income;
- if((m_typeList.contains(MyMoneyAccount::Expense)) > 0)
+ if((m_typeList.tqcontains(MyMoneyAccount::Expense)) > 0)
typeMask |= KMyMoneyUtils::expense;
- if((m_typeList.contains(MyMoneyAccount::Equity)) > 0)
+ if((m_typeList.tqcontains(MyMoneyAccount::Equity)) > 0)
typeMask |= KMyMoneyUtils::equity;
selector->clear();
KListView* lv = selector->listView();
m_count = 0;
- QString key;
- QListViewItem* after = 0;
+ TQString key;
+ TQListViewItem* after = 0;
// create the favorite section first and sort it to the beginning
- key = QString("A%1").arg(i18n("Favorites"));
+ key = TQString("A%1").tqarg(i18n("Favorites"));
m_favorites = selector->newItem(i18n("Favorites"), key);
- for(int mask = 0x01; mask != KMyMoneyUtils::last; mask <<= 1) {
- QListViewItem* item = 0;
- if((typeMask & mask & KMyMoneyUtils::asset) != 0) {
+ for(int tqmask = 0x01; tqmask != KMyMoneyUtils::last; tqmask <<= 1) {
+ TQListViewItem* item = 0;
+ if((typeMask & tqmask & KMyMoneyUtils::asset) != 0) {
++m_count;
- key = QString("B%1").arg(i18n("Asset"));
+ key = TQString("B%1").tqarg(i18n("Asset"));
item = selector->newItem(i18n("Asset accounts"), key);
list = m_file->asset().accountList();
}
- if((typeMask & mask & KMyMoneyUtils::liability) != 0) {
+ if((typeMask & tqmask & KMyMoneyUtils::liability) != 0) {
++m_count;
- key = QString("C%1").arg(i18n("Liability"));
+ key = TQString("C%1").tqarg(i18n("Liability"));
item = selector->newItem(i18n("Liability accounts"), key);
list = m_file->liability().accountList();
}
- if((typeMask & mask & KMyMoneyUtils::income) != 0) {
+ if((typeMask & tqmask & KMyMoneyUtils::income) != 0) {
++m_count;
- key = QString("D%1").arg(i18n("Income"));
+ key = TQString("D%1").tqarg(i18n("Income"));
item = selector->newItem(i18n("Income categories"), key);
list = m_file->income().accountList();
- if(selector->selectionMode() == QListView::Multi) {
+ if(selector->selectionMode() == TQListView::Multi) {
selector->m_incomeCategoriesButton->show();
}
}
- if((typeMask & mask & KMyMoneyUtils::expense) != 0) {
+ if((typeMask & tqmask & KMyMoneyUtils::expense) != 0) {
++m_count;
- key = QString("E%1").arg(i18n("Expense"));
+ key = TQString("E%1").tqarg(i18n("Expense"));
item = selector->newItem(i18n("Expense categories"), key);
list = m_file->expense().accountList();
- if(selector->selectionMode() == QListView::Multi) {
+ if(selector->selectionMode() == TQListView::Multi) {
selector->m_expenseCategoriesButton->show();
}
}
- if((typeMask & mask & KMyMoneyUtils::equity) != 0) {
+ if((typeMask & tqmask & KMyMoneyUtils::equity) != 0) {
++m_count;
- key = QString("F%1").arg(i18n("Equity"));
+ key = TQString("F%1").tqarg(i18n("Equity"));
item = selector->newItem(i18n("Equity accounts"), key);
list = m_file->equity().accountList();
}
@@ -405,11 +405,11 @@ int AccountSet::load(kMyMoneyAccountSelector* selector)
//if it is still open or it has been set to show closed accounts
if(includeAccount(acc)
&& (!isHidingClosedAccounts() || !acc.isClosed()) ) {
- QString tmpKey;
+ TQString tmpKey;
tmpKey = key + MyMoneyFile::AccountSeperator + acc.name();
- QListViewItem* subItem = selector->newItem(item, acc.name(), tmpKey, acc.id());
+ TQListViewItem* subItem = selector->newItem(item, acc.name(), tmpKey, acc.id());
if(acc.value("PreferredAccount") == "Yes"
- && m_typeList.contains(acc.accountType())) {
+ && m_typeList.tqcontains(acc.accountType())) {
selector->newItem(m_favorites, acc.name(), tmpKey, acc.id());
}
if(acc.accountList().count() > 0) {
@@ -418,7 +418,7 @@ int AccountSet::load(kMyMoneyAccountSelector* selector)
}
//disable the item if it has been added only because a subaccount matches the type
- if( !m_typeList.contains(acc.accountType()) ) {
+ if( !m_typeList.tqcontains(acc.accountType()) ) {
subItem->setEnabled(false);
}
}
@@ -429,7 +429,7 @@ int AccountSet::load(kMyMoneyAccountSelector* selector)
// if we don't have a favorite account or the selector is for multi-mode
// we get rid of the favorite entry and subentries.
- if(m_favorites->childCount() == 0 || selector->selectionMode() == QListView::Multi) {
+ if(m_favorites->childCount() == 0 || selector->selectionMode() == TQListView::Multi) {
delete m_favorites;
m_favorites = 0;
}
@@ -449,10 +449,10 @@ int AccountSet::load(kMyMoneyAccountSelector* selector)
return count;
}
-int AccountSet::load(kMyMoneyAccountSelector* selector, const QString& baseName, const QValueList<QString>& accountIdList, const bool clear)
+int AccountSet::load(kMyMoneyAccountSelector* selector, const TQString& baseName, const TQValueList<TQString>& accountIdList, const bool clear)
{
int count = 0;
- QListViewItem* item = 0;
+ TQListViewItem* item = 0;
m_typeList.clear();
if(clear) {
@@ -463,14 +463,14 @@ int AccountSet::load(kMyMoneyAccountSelector* selector, const QString& baseName,
item = selector->newItem(baseName);
++m_count;
- QValueList<QString>::ConstIterator it;
+ TQValueList<TQString>::ConstIterator it;
for(it = accountIdList.begin(); it != accountIdList.end(); ++it) {
const MyMoneyAccount& acc = m_file->account(*it);
if(acc.isClosed())
continue;
- QString tmpKey;
+ TQString tmpKey;
// the first character must be preset. Since we don't know any sort order here, we just use A
- tmpKey = QString("A%1%2%3").arg(baseName, MyMoneyFile::AccountSeperator, acc.name());
+ tmpKey = TQString("A%1%2%3").tqarg(baseName, MyMoneyFile::AccountSeperator, acc.name());
selector->newItem(item, acc.name(), tmpKey, acc.id());
++m_count;
++count;
@@ -486,9 +486,9 @@ int AccountSet::load(kMyMoneyAccountSelector* selector, const QString& baseName,
return count;
}
-int AccountSet::loadSubAccounts(kMyMoneyAccountSelector* selector, QListViewItem* parent, const QString& key, const QStringList& list)
+int AccountSet::loadSubAccounts(kMyMoneyAccountSelector* selector, TQListViewItem* tqparent, const TQString& key, const TQStringList& list)
{
- QStringList::ConstIterator it_l;
+ TQStringList::ConstIterator it_l;
int count = 0;
for(it_l = list.begin(); it_l != list.end(); ++it_l) {
@@ -499,13 +499,13 @@ int AccountSet::loadSubAccounts(kMyMoneyAccountSelector* selector, QListViewItem
if(includeAccount(acc)
&& !acc.isClosed()) {
- QString tmpKey;
+ TQString tmpKey;
tmpKey = key + MyMoneyFile::AccountSeperator + acc.name();
++count;
++m_count;
- QListViewItem* item = selector->newItem(parent, acc.name(), tmpKey, acc.id());
+ TQListViewItem* item = selector->newItem(tqparent, acc.name(), tmpKey, acc.id());
if(acc.value("PreferredAccount") == "Yes"
- && m_typeList.contains(acc.accountType())) {
+ && m_typeList.tqcontains(acc.accountType())) {
selector->newItem(m_favorites, acc.name(), tmpKey, acc.id());
}
if(acc.accountList().count() > 0) {
@@ -514,7 +514,7 @@ int AccountSet::loadSubAccounts(kMyMoneyAccountSelector* selector, QListViewItem
}
//disable the item if it has been added only because a subaccount matches the type
- if( !m_typeList.contains(acc.accountType()) ) {
+ if( !m_typeList.tqcontains(acc.accountType()) ) {
item->setEnabled(false);
}
}
@@ -524,13 +524,13 @@ int AccountSet::loadSubAccounts(kMyMoneyAccountSelector* selector, QListViewItem
bool AccountSet::includeAccount(const MyMoneyAccount& acc)
{
- if( m_typeList.contains(acc.accountType()) )
+ if( m_typeList.tqcontains(acc.accountType()) )
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 = m_file->account(*it_acc);
if( includeAccount(account) )