From c3f2b14470f08acc2fc2247b587ec03ad04e1800 Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Tue, 13 Sep 2011 18:49:27 +0000 Subject: [PATCH] Bug #658851: [Cutecash] Sort the dashboard from latest to earliest. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21256 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/gnc/fpo/ViewletModel.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gnc/fpo/ViewletModel.cpp b/src/gnc/fpo/ViewletModel.cpp index 479218ce15..679a1ca001 100644 --- a/src/gnc/fpo/ViewletModel.cpp +++ b/src/gnc/fpo/ViewletModel.cpp @@ -116,6 +116,13 @@ ViewletModel::buildSplitListDateSort(::Account *selectedAccount) return Split::fromGList(splitL); } +static bool greaterThanByDate(const ::Split* a, const ::Split* b) +{ + const ::Transaction* tx_a = xaccSplitGetParent(a); + const ::Transaction* tx_b = xaccSplitGetParent(b); + return xaccTransGetDate(tx_a) > xaccTransGetDate(tx_b); +} + SplitQList ViewletModel::buildSplitListDateSort(AccountQList accountsList) { @@ -136,7 +143,7 @@ ViewletModel::buildSplitListDateSort(AccountQList accountsList) } } - qSort(allSplitsList.begin(), allSplitsList.end(), &ViewletModel::lessThanByDate); + qSort(allSplitsList.begin(), allSplitsList.end(), &greaterThanByDate); return allSplitsList; }