From 2e468c14b439802f49909a5bd384b737c08290cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Fri, 27 Apr 2012 21:37:51 +0200 Subject: [PATCH] Account/Category modification are immediatly reported in other panels --- src/model/Category.hpp | 8 ++++++++ src/model/User.cpp | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/model/Category.hpp b/src/model/Category.hpp index 2c17377..ead5511 100644 --- a/src/model/Category.hpp +++ b/src/model/Category.hpp @@ -33,6 +33,14 @@ struct Category QString font; bool fix_cost; + bool operator() (const Category& cat1, const Category& cat2) const + { + if (cat1.fix_cost) return true; + if (cat2.fix_cost) return false; + + return cat1.name < cat2.name; + } + bool operator == (int catId) { return id == catId; diff --git a/src/model/User.cpp b/src/model/User.cpp index dd6fa5d..76468f4 100644 --- a/src/model/User.cpp +++ b/src/model/User.cpp @@ -45,6 +45,9 @@ void User::InvalidateOperations() } _operations.clear(); + + std::sort(_accounts.begin(), _accounts.end(), Account()); + std::sort(_categories.begin(), _categories.end(), Category()); } Category User::GetCategory(int catId)