[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmymoney-devel
Subject:    Patch/branch to hide liabilities that have zero balance
From:       Jeremy Whiting <jpwhiting () kde ! org>
Date:       2019-06-16 3:05:32
Message-ID: CADWV2K4FFxDTs2OA63Ei5FuWOiJ-JXMyNLeCgaJUbwR6EqVYXQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,

It's been far too long since I've last made a change to some kde repository
that I don't maintain (and those that I do also tbh) I came up with a
quick/small patch to hide the liability accounts that have a zero balance
on the home screen. It cleans up my home screen quite a bit since I have
some liability accounts I haven't closed, but that have a zero balance and
don't typically need to be concerned about. I've pushed the patch to a
hide-zero-liabilities branch and attached it here. Is phabricator typically
used for code review lately? or just pushing branches and mentioning it in
the mailing list here? or something else entirely?

thanks,
Jeremy

[Attachment #5 (text/html)]

<div dir="ltr">Hello,<div><br></div><div>It&#39;s been far too long since I&#39;ve \
last made a change to some kde repository that I don&#39;t maintain (and those that I \
do also tbh) I came up with a quick/small patch to hide the liability accounts that \
have a zero balance on the home screen. It cleans up my home screen quite a bit since \
I have some liability accounts I haven&#39;t closed, but that have a zero balance and \
don&#39;t typically need to be concerned about. I&#39;ve pushed the patch to a \
hide-zero-liabilities branch and attached it here. Is phabricator typically used for \
code review lately? or just pushing branches and mentioning it in the mailing list \
here? or something else \
entirely?</div><div><br></div><div>thanks,</div><div>Jeremy</div></div>


["kmymoneychanges.diff" (application/octet-stream)]

diff --git a/kmymoney/dialogs/settings/ksettingshome.ui b/kmymoney/dialogs/settings/ksettingshome.ui
index 2750a3e76..ab3250c8b 100644
--- a/kmymoney/dialogs/settings/ksettingshome.ui
+++ b/kmymoney/dialogs/settings/ksettingshome.ui
@@ -232,6 +232,13 @@ Use the buttons and checkboxes to customize the layout of the home page.</string
         </property>
        </widget>
       </item>
+      <item row="6" column="0" colspan="3">
+       <widget class="QCheckBox" name="kcfg_HideZeroBalanceLiabilities">
+	<property name="text">
+         <string>Hide liability accounts with zero balance</string>
+	</property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
diff --git a/kmymoney/settings/kmymoney.kcfg b/kmymoney/settings/kmymoney.kcfg
index d7d5119db..2d09befd6 100644
--- a/kmymoney/settings/kmymoney.kcfg
+++ b/kmymoney/settings/kmymoney.kcfg
@@ -192,6 +192,10 @@
    <label>Show date of last reconciliation on the Homepage</label>
    <default>false</default>
   </entry>
+  <entry name="HideZeroBalanceLiabilities" type="Bool">
+    <label>Hide zero balance liabilities on the Homepage</label>
+    <default>false</default>
+  </entry>
  </group>
  <group name="Color Options">
   <entry name="useCustomColors" type="Bool">
diff --git a/kmymoney/views/khomeview_p.h b/kmymoney/views/khomeview_p.h
index 43f28c036..06f9ee683 100644
--- a/kmymoney/views/khomeview_p.h
+++ b/kmymoney/views/khomeview_p.h
@@ -1230,7 +1230,13 @@ public:
           case Account::Type::Loan:
             // list account if it's the last in the hierarchy or has transactions in it
             if ((*it).accountList().isEmpty() || (file->transactionCount((*it).id()) > 0)) {
-              liabilities << *it;
+	      // Add it if we are not hiding zero balance liabilities, or the balance is not zero
+              MyMoneyMoney value = 
+		      MyMoneyFile::instance()->balance((*it).id(), QDate::currentDate());
+	      if (!KMyMoneySettings::hideZeroBalanceLiabilities() ||
+			      value != 0) {
+                liabilities << *it;
+              }
             }
             break;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic