[Kmymoney-devel] [PATCH 4/4] payee: Show transactions from multiple payees
Felipe F. Tonello
eu at felipetonello.com
Wed Apr 24 07:19:43 UTC 2013
From: "Felipe F. Tonello" <eu at felipetonello.com>
This patch allow users to have see all transactions that they
will merge.
Signed-off-by: Felipe F. Tonello <eu at felipetonello.com>
---
kmymoney/views/kpayeesview.cpp | 26 ++++++++++++++++++--------
kmymoney/views/kpayeesview.h | 1 +
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/kmymoney/views/kpayeesview.cpp b/kmymoney/views/kpayeesview.cpp
index 3b8259b..906e9fb 100644
--- a/kmymoney/views/kpayeesview.cpp
+++ b/kmymoney/views/kpayeesview.cpp
@@ -385,6 +385,9 @@ void KPayeesView::slotSelectPayee(QListWidgetItem* cur, QListWidgetItem* prev)
void KPayeesView::slotSelectPayee(void)
{
+ // make sure we always clear the selected list when listing again
+ m_selectedPayees.clear();
+
// check if the content of a currently selected payee was modified
// and ask to store the data
if (m_updateButton->isEnabled()) {
@@ -398,12 +401,11 @@ void KPayeesView::slotSelectPayee(void)
}
// loop over all payees and count the number of payees, also
// obtain last selected payee
- QList<MyMoneyPayee> payeesList;
- selectedPayees(payeesList);
+ selectedPayees(m_selectedPayees);
- emit selectObjects(payeesList);
+ emit selectObjects(m_selectedPayees);
- if (payeesList.isEmpty()) {
+ if (m_selectedPayees.isEmpty()) {
m_tabWidget->setEnabled(false); // disable tab widget
m_balanceLabel->hide();
m_deleteButton->setEnabled(false); //disable delete, rename and merge buttons
@@ -417,7 +419,8 @@ void KPayeesView::slotSelectPayee(void)
m_deleteButton->setEnabled(true); //re-enable delete button
// if we have multiple payees selected, clear and disable the payee information
- if (payeesList.count() > 1) {
+ // only enable merge button when multiple payees are selected
+ if (m_selectedPayees.count() > 1) {
m_tabWidget->setEnabled(false); // disable tab widget
m_renameButton->setEnabled(false); // disable also the rename button
m_mergeButton->setEnabled(true);
@@ -436,7 +439,7 @@ void KPayeesView::slotSelectPayee(void)
// selection mode of the QListView has been changed to Extended, this
// will also be the only selection and behave exactly as before - Andreas
try {
- m_payee = payeesList[0];
+ m_payee = m_selectedPayees[0];
m_newName = m_payee.name();
@@ -469,6 +472,7 @@ void KPayeesView::slotSelectPayee(void)
} catch (MyMoneyException *e) {
qDebug("exception during display of payee: %s at %s:%ld", qPrintable(e->what()), qPrintable(e->file()), e->line());
m_register->clear();
+ m_selectedPayees.clear();
m_payee = MyMoneyPayee();
delete e;
}
@@ -497,14 +501,20 @@ void KPayeesView::showTransactions(void)
// clear the register
m_register->clear();
- if (m_payee.id().isEmpty() || !m_tabWidget->isEnabled()) {
+ if (m_selectedPayees.isEmpty() || !m_tabWidget->isEnabled()) {
m_balanceLabel->setText(i18n("Balance: %1", balance.formatMoney(file->baseCurrency().smallestAccountFraction())));
return;
}
// setup the list and the pointer vector
MyMoneyTransactionFilter filter;
- filter.addPayee(m_payee.id());
+
+ for (QList<MyMoneyPayee>::const_iterator it = m_selectedPayees.constBegin();
+ it != m_selectedPayees.constEnd();
+ ++it) {
+ filter.addPayee((*it).id());
+ }
+
filter.setDateFilter(KMyMoneyGlobalSettings::startDate().date(), QDate());
// retrieve the list from the engine
diff --git a/kmymoney/views/kpayeesview.h b/kmymoney/views/kpayeesview.h
index 1fb9633..7f16393 100644
--- a/kmymoney/views/kpayeesview.h
+++ b/kmymoney/views/kpayeesview.h
@@ -166,6 +166,7 @@ signals:
private:
MyMoneyPayee m_payee;
+ QList<MyMoneyPayee> m_selectedPayees;
QString m_newName;
/**
--
1.7.11.7
More information about the KMyMoney-devel
mailing list