[Kmymoney-devel] [PATCH 3/4] payee: Added Payees Merge KButton
Felipe F. Tonello
eu at felipetonello.com
Wed Apr 24 07:19:42 UTC 2013
From: "Felipe F. Tonello" <eu at felipetonello.com>
Adds a button next to the delete payee and enables it only when multiple
payees are selected.
Signed-off-by: Felipe F. Tonello <eu at felipetonello.com>
---
kmymoney/views/kpayeesview.cpp | 20 +++++++++++++++++---
kmymoney/views/kpayeesviewdecl.ui | 7 +++++++
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/kmymoney/views/kpayeesview.cpp b/kmymoney/views/kpayeesview.cpp
index 97a3f93..3b8259b 100644
--- a/kmymoney/views/kpayeesview.cpp
+++ b/kmymoney/views/kpayeesview.cpp
@@ -144,6 +144,13 @@ KPayeesView::KPayeesView(QWidget *parent) :
m_deleteButton->setGuiItem(deleteButtonItem);
m_deleteButton->setToolTip(deleteButtonItem.toolTip());
+ KGuiItem mergeButtonItem(QString(""),
+ KIcon("merge"),
+ i18n("Merge multiple selected payees"),
+ i18n("Use this to merge multiple selected payees."));
+ m_mergeButton->setGuiItem(mergeButtonItem);
+ m_mergeButton->setToolTip(mergeButtonItem.toolTip());
+
KGuiItem updateButtonItem(i18nc("Update payee", "Update"),
KIcon("dialog-ok"),
i18n("Accepts the entered data and stores it"),
@@ -179,6 +186,7 @@ KPayeesView::KPayeesView(QWidget *parent) :
connect(m_renameButton, SIGNAL(clicked()), this, SLOT(slotRenameButtonCliked()));
connect(m_deleteButton, SIGNAL(clicked()), kmymoney->action("payee_delete"), SLOT(trigger()));
+ connect(m_mergeButton, SIGNAL(clicked()), kmymoney->action("payee_merge"), SLOT(trigger()));
connect(m_newButton, SIGNAL(clicked()), this, SLOT(slotPayeeNew()));
connect(addressEdit, SIGNAL(textChanged()), this, SLOT(slotPayeeDataChanged()));
@@ -213,8 +221,9 @@ KPayeesView::KPayeesView(QWidget *parent) :
//At start we haven't any payee selected
m_tabWidget->setEnabled(false); // disable tab widget
- m_deleteButton->setEnabled(false); //disable delete and rename button
+ m_deleteButton->setEnabled(false); //disable delete, rename and merge buttons
m_renameButton->setEnabled(false);
+ m_mergeButton->setEnabled(false);
m_payee = MyMoneyPayee(); // make sure we don't access an undefined payee
clearItemData();
}
@@ -397,8 +406,9 @@ void KPayeesView::slotSelectPayee(void)
if (payeesList.isEmpty()) {
m_tabWidget->setEnabled(false); // disable tab widget
m_balanceLabel->hide();
- m_deleteButton->setEnabled(false); //disable delete and rename button
+ m_deleteButton->setEnabled(false); //disable delete, rename and merge buttons
m_renameButton->setEnabled(false);
+ m_mergeButton->setEnabled(false);
clearItemData();
m_payee = MyMoneyPayee();
return; // make sure we don't access an undefined payee
@@ -410,9 +420,13 @@ void KPayeesView::slotSelectPayee(void)
if (payeesList.count() > 1) {
m_tabWidget->setEnabled(false); // disable tab widget
m_renameButton->setEnabled(false); // disable also the rename button
+ m_mergeButton->setEnabled(true);
m_balanceLabel->hide();
clearItemData();
- } else m_renameButton->setEnabled(true);
+ } else {
+ m_mergeButton->setEnabled(false);
+ m_renameButton->setEnabled(true);
+ }
// otherwise we have just one selected, enable payee information widget
m_tabWidget->setEnabled(true);
diff --git a/kmymoney/views/kpayeesviewdecl.ui b/kmymoney/views/kpayeesviewdecl.ui
index 8d9c008..eb50ddc 100644
--- a/kmymoney/views/kpayeesviewdecl.ui
+++ b/kmymoney/views/kpayeesviewdecl.ui
@@ -61,6 +61,13 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="KPushButton" name="m_mergeButton">
+ <property name="text">
+ <string>Mer</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
--
1.7.11.7
More information about the KMyMoney-devel
mailing list