From 59d770c9280343d3b2d241742396ad2dcc31a8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 11 Dec 2010 09:51:44 +0100 Subject: [PATCH 01/72] Add lib directory check in Makefile --- INSTALL | 1 + Makefile | 5 ++++- src/view/AccountPanel.cpp | 32 ++++++++++++----------------- src/view/PreferencesPanel.cpp | 38 ++++++++++++++--------------------- src/view/SearchPanel.cpp | 7 +++---- src/view/StatsPanel.cpp | 29 +++++++++++--------------- src/view/UsersDialog.cpp | 6 ++++-- src/view/wxUI.cpp | 2 +- 8 files changed, 53 insertions(+), 67 deletions(-) diff --git a/INSTALL b/INSTALL index a1fdb2d..794d553 100644 --- a/INSTALL +++ b/INSTALL @@ -14,6 +14,7 @@ php5 ** Compilation of extra libraries ** lib is not included by default and must be downloaded http://indefero.soutade.fr/p/kisscount/downloads/ +It must be decompressed beside "src" directory. cd lib/wxsqlite3-1.9.9 ./configure diff --git a/Makefile b/Makefile index cd69603..d753805 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ HEADERS+=$(wildcard src/controller/*.h) HEADERS+=src/main.h src/sha1.h OBJS=$(SOURCES:.cpp=.o) -all: kc +all: check kc clean: rm -f *~ src/*~ src/*.o src/model/*.o src/model/*~ src/view/*.o src/view/grid/*.o src/view/grid/*~ src/view/*~ src/controller/*.o src/controller/*~ kc @@ -28,6 +28,9 @@ clean: %.o : src/model/%.cpp src/view/%.cpp src/view/grid/%.cpp src/controller/%.cpp src/%.cpp $(CXX) $(CXXFLAGS) $< -c +check: + if ! test -d lib ; then echo lib directory not found, please see INSTALL ; return 1 ; fi + kc: $(OBJS) $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index f90a83c..5bf71e4 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -126,32 +126,26 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(* wxButton* buttonGroup = new wxButton(this, GROUP_ID, _("Group")); wxButton* buttonUnGroup = new wxButton(this, UNGROUP_ID, _("UnGroup")); - vbox3->Add(&_tree, 0); - vbox3->Add(-1, 30); - vbox3->Add(buttonGroup, 0); - vbox3->Add(-1, 10); - vbox3->Add(buttonUnGroup, 0); + vbox3->Add(&_tree, 0, wxGROW|wxALL, 2); + vbox3->Add(buttonGroup, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); + vbox3->Add(buttonUnGroup, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); - hbox->Add(vbox3, 0); - hbox2->Add(_accountsGrid, 0); - hbox2->Add(_calendar, 0); + hbox->Add(vbox3, 0, wxGROW|wxALL, 2); + hbox2->Add(_accountsGrid, 0, wxGROW|wxALL, 2); + hbox2->Add(_calendar, 0, wxALL, 2); vbox2->Add(hbox2, 0); - vbox2->Add(-1, 10); - vbox2->Add(_grid, 0); - hbox->Add(vbox2, 0); - vbox->Add(_statsGrid, 0); - vbox->Add(-1, 10); - vbox->Add(chart, 0); - hbox->Add(-1, 10); - vbox->Add(_checkCheckMode, 0); - hbox->Add(-1, 10); - hbox->Add(vbox, 0); + vbox2->Add(_grid, 0, wxGROW|wxALL, 2); + hbox->Add(vbox2, 0, wxGROW|wxALL, 2); + vbox->Add(_statsGrid, 0, wxGROW); + vbox->Add(chart, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10); + vbox->Add(_checkCheckMode, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10); + hbox->Add(vbox, 0, wxGROW|wxALL, 2); ChangeUser(); Fit(); - SetMinSize(wxSize(rect.width-rect.x, rect.height-rect.y-128)); + SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); SetScrollbars(10, 10, 100/10, 100/10); } diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 7e73bf6..4bc9bc3 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -65,8 +65,8 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p // User staticBoxSizer = new wxStaticBoxSizer (staticUser, wxVERTICAL); - gridBagSizer = new wxGridBagSizer(10, 10); - staticBoxSizer->Add(gridBagSizer); + gridBagSizer = new wxGridBagSizer(2, 3); + staticBoxSizer->Add(gridBagSizer, 0, wxGROW|wxALL, 2); label = new wxStaticText(this, wxID_ANY, _("Name")); gridBagSizer->Add(label, wxGBPosition(0, 0)); @@ -82,8 +82,7 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p gridBagSizer->Add(buttonChangePassword, wxGBPosition(1, 1)); gridBagSizer->Add(killMe, wxGBPosition(1, 2)); - vbox->Add(staticBoxSizer); - vbox->Add(-1, 20); + vbox->Add(staticBoxSizer, 0, wxALL, 10); // Account staticBoxSizer = new wxStaticBoxSizer (staticAccount, wxVERTICAL); @@ -96,15 +95,14 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p InitAccounts(user); - staticBoxSizer->Add(_accountsGrid); + staticBoxSizer->Add(_accountsGrid, 0, wxGROW|wxALL, 2); - hbox1->Add(staticBoxSizer); - hbox1->Add(-1, 20); + hbox1->Add(staticBoxSizer, 0, wxALL); staticBoxSizer = new wxStaticBoxSizer (staticSharedWith, wxVERTICAL); _sharedWith = new wxCheckListBox(this, SHARED_WITH_ID); - staticBoxSizer->Add(_sharedWith); + staticBoxSizer->Add(_sharedWith, 0, wxGROW); users = _kiss->GetUsers(); @@ -114,8 +112,8 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p _sharedWith->Enable(false); - hbox1->Add(staticBoxSizer); - hbox1->Add(-1, 20); + hbox1->Add(staticBoxSizer, 0, wxLEFT, 5); + vbox->Add(hbox1, 0, wxGROW|wxALL, 10); // Categories staticBoxSizer = new wxStaticBoxSizer (staticCategories, wxVERTICAL); @@ -126,15 +124,11 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p _categoriesGrid = new wxMyGrid(this, CATEGORIES_GRID_ID, clicks, 4); } - staticBoxSizer->Add(_categoriesGrid); + staticBoxSizer->Add(_categoriesGrid, 0, wxGROW|wxALL, 2); InitCategories(user); - vbox->Add(hbox1); - vbox->Add(-1, 20); - - vbox->Add(staticBoxSizer); - vbox->Add(-1, 20); + vbox->Add(staticBoxSizer, 0, wxALL, 10); // Operation Order staticBoxSizer = new wxStaticBoxSizer (staticOperationOrder, wxVERTICAL); @@ -142,10 +136,9 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p _operationOrder = new wxComboBox(this, OPERATION_ORDER_ID); _operationOrder->SetWindowStyle(wxCB_READONLY); - staticBoxSizer->Add(_operationOrder); + staticBoxSizer->Add(_operationOrder, 0, wxGROW|wxALL, 2); - hbox2->Add(staticBoxSizer); - hbox2->Add(-1, 20); + hbox2->Add(staticBoxSizer, 0); InitOperationOrder(user); @@ -155,16 +148,15 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p _language = new wxBitmapComboBox(this, LANGUAGE_ID); _language->SetWindowStyle(wxCB_READONLY); - staticBoxSizer->Add(_language); + staticBoxSizer->Add(_language, 0, wxGROW|wxALL, 2); - hbox2->Add(staticBoxSizer); - hbox2->Add(-1, 20); + hbox2->Add(staticBoxSizer, 0, wxLEFT, 10); InitLanguage(user); _language->Fit(); - vbox->Add(hbox2); + vbox->Add(hbox2, 0, wxALL, 10); Fit(); SetMinSize(GetSize()); diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 1318a0c..bd71c76 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -107,16 +107,15 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*pa gridBagSizer->Add(_account, wxGBPosition(1, 7)); gridBagSizer->Add(_searchButton, wxGBPosition(2, 0)); - vbox->Add(gridBagSizer); - vbox->Add(-1, 20); + vbox->Add(gridBagSizer, 0, wxGROW|wxALL, 5); _grid = new GridAccount(_kiss, this, GRID_ID); - vbox->Add(_grid); + vbox->Add(_grid, 0, wxGROW|wxALL, 5); Fit(); - SetMinSize(wxSize(rect.width-rect.x, rect.height-rect.y-128)); + SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); SetScrollbars(10, 10, 100/10, 100/10); Hide(); diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 62ca913..0f2e6da 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -60,16 +60,13 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ki _yearTo->Select(i); wxStaticText* label = new wxStaticText(this, wxID_ANY, _("From")); - hbox->Add(label); - hbox->Add(-1, 10); - hbox->Add(_monthFrom); - hbox->Add(_yearFrom); + hbox->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); + hbox->Add(_monthFrom, 0, wxRIGHT, 5); + hbox->Add(_yearFrom, 0, wxRIGHT, 20); - hbox->Add(-1, 30); label = new wxStaticText(this, wxID_ANY, _("To")); - hbox->Add(label); - hbox->Add(-1, 10); - hbox->Add(_monthTo); + hbox->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); + hbox->Add(_monthTo, 0, wxRIGHT, 5); hbox->Add(_yearTo); _account = new wxCheckListBox(this, ACCOUNTS_ID); @@ -106,9 +103,8 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ki _statsGrid->SetCellAlignment(i, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); } - _vbox2->Add(_account); - _vbox2->Add(-1, 10); - _vbox2->Add(_statsGrid); + _vbox2->Add(_account, 0, wxGROW|wxALL, 5); + _vbox2->Add(_statsGrid, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); _pie = new PiePlot(); @@ -133,11 +129,10 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ki chart->SetMinSize(// chart->GetSize() wxSize(200,250)); - _vbox2->Add(-1, 10); - _vbox2->Add(chart); + _vbox2->Add(chart, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 10); - vbox->Add(hbox); - vbox->Add(_hbox2); + vbox->Add(hbox, 0, wxALIGN_CENTER_VERTICAL|wxGROW|wxALL, 5); + vbox->Add(_hbox2, 0, wxGROW|wxALL, 5); wxCommandEvent event ; OnRangeChange(event); @@ -295,7 +290,7 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT _chart->SetMinSize(// chart->GetSize() wxSize(750,550)); - _hbox2->Add(_chart); + _hbox2->Add(_chart, 0, wxGROW|wxALL, 5); total = 0.0; for(categoriesIt = categories.begin(); categoriesIt != categories.end(); categoriesIt++) @@ -317,7 +312,7 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT _pie->DatasetChanged(_dataset); - _hbox2->Add(_vbox2); + _hbox2->Add(_vbox2, 0, wxGROW|wxALL, 5); Layout(); } diff --git a/src/view/UsersDialog.cpp b/src/view/UsersDialog.cpp index ce60891..c53d52e 100644 --- a/src/view/UsersDialog.cpp +++ b/src/view/UsersDialog.cpp @@ -33,6 +33,7 @@ UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), - wxStaticText* label; wxCommandEvent event; + wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); gridBagSizer = new wxGridBagSizer(4, 4); label = new wxStaticText(this, -1, _("User ")); @@ -63,10 +64,11 @@ UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), - _users->Select(0); - SetSizer(gridBagSizer); + hbox->Add(gridBagSizer, 0, wxGROW|wxALL, 10); + SetSizer(hbox); _users->SetFocus(); - Layout(); + Fit(); Center(); if (users_list.size() == 0) diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 0d267fb..d5e17a4 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -250,7 +250,7 @@ void wxUI::ShowPanel(wxPanel* panel) } _curPanel = panel; - _hbox->Add(panel); + _hbox->Add(panel, 1, wxGROW|wxALL, 0); _curPanel->Show(); Layout(); } From a43dd6bd95b9280a635f0c5775d521e9be4d7f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 12 Dec 2010 20:30:52 +0100 Subject: [PATCH 02/72] Add ChangeLog --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ChangeLog diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..2b00522 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,3 @@ + +v0.2_dev (12/12/10) + Better use of sizers (so better interface!) From 9101da3e2b056aa2871ae00ec854d290b6feccea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Wed, 15 Dec 2010 19:13:16 +0100 Subject: [PATCH 03/72] First work for KissPanel --- src/view/AccountPanel.cpp | 20 +++++++++++++- src/view/AccountPanel.h | 16 +++++------ src/view/ButtonPanel.h | 1 - src/view/KissPanel.h | 51 +++++++++++++++++++++++++++++++++++ src/view/PreferencesPanel.cpp | 20 ++++++++++++-- src/view/PreferencesPanel.h | 17 ++++++------ src/view/SearchPanel.cpp | 22 ++++++++++++--- src/view/SearchPanel.h | 18 ++++++------- src/view/StatsPanel.cpp | 20 ++++++++++++-- src/view/StatsPanel.h | 14 ++++------ src/view/view.h | 2 ++ 11 files changed, 155 insertions(+), 46 deletions(-) create mode 100644 src/view/KissPanel.h diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 5bf71e4..5ba728d 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -38,7 +38,7 @@ EVT_BUTTON(GROUP_ID, AccountPanel::OnGroup) EVT_BUTTON(UNGROUP_ID, AccountPanel::OnUnGroup) END_EVENT_TABLE() -AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*parent)), _curMonth(-1), _curYear(-1), _kiss(kiss), _wxUI(parent), _tree(this, CALENDAR_TREE_ID, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT) +AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _curMonth(-1), _curYear(-1), _tree(this, CALENDAR_TREE_ID, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT) { wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL); @@ -156,6 +156,24 @@ AccountPanel::~AccountPanel() delete[] _accounts; } +KissPanel* AccountPanel::CreatePanel() +{ + return new AccountPanel(_kiss, _wxUI); +} + +wxBitmapButton* AccountPanel::GetButton(int id) +{ + if (!_KissButton) + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(ACCOUNT_ICON)), wxDefaultPosition, wxSize(128, 128)); + + return _KissButton; +} + +wxString AccountPanel::GetToolTip() +{ + return _("Operations"); +} + void AccountPanel::InitStatsGrid(User* user) { int i; diff --git a/src/view/AccountPanel.h b/src/view/AccountPanel.h index 09d0928..4be0bca 100644 --- a/src/view/AccountPanel.h +++ b/src/view/AccountPanel.h @@ -25,26 +25,27 @@ #include #include #include -#include #include "grid/CalendarEditor.h" #include "grid/wxGridCellBitmapRenderer.h" #include "view.h" #include -#include "wxUI.h" #include #include "grid/GridAccount.h" #include -class wxUI; -class KissCount; - -class AccountPanel: public wxScrolledWindow +class AccountPanel: public KissPanel { public: AccountPanel(KissCount* kiss, wxUI *parent); ~AccountPanel(); + + KissPanel* CreatePanel(); + wxBitmapButton* GetButton(int id); + wxString GetToolTip(); + void OnShow(wxShowEvent& event); + void ChangeUser(); void LoadYear(int year, bool showMonth=true); void ShowMonth(int month, int year); @@ -56,7 +57,6 @@ public: void OnTreeChange(wxTreeEvent& event); void OnMenuGenerate(wxCommandEvent& event); void OnMenuDelete(wxCommandEvent& event); - void OnShow(wxShowEvent& event); void OnCalendarChange(wxCalendarEvent& event); void OnCheckMode(wxCommandEvent& event); void OnGroup(wxCommandEvent& event); @@ -65,8 +65,6 @@ public: int _curMonth, _curYear; private: - KissCount* _kiss; - wxUI* _wxUI; wxTreeCtrl _tree; wxCalendarCtrl* _calendar; GridAccount* _grid; diff --git a/src/view/ButtonPanel.h b/src/view/ButtonPanel.h index 6e6e171..6b93c2b 100644 --- a/src/view/ButtonPanel.h +++ b/src/view/ButtonPanel.h @@ -21,7 +21,6 @@ #define BUTTONPANEL_H #include -#include #include #include "wxUI.h" diff --git a/src/view/KissPanel.h b/src/view/KissPanel.h new file mode 100644 index 0000000..ed139a1 --- /dev/null +++ b/src/view/KissPanel.h @@ -0,0 +1,51 @@ +/* + Copyright 2010 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef KISSPANEL_H +#define KISSPANEL_H + +#include +#include +#include + +class wxUI; +class KissCount; + +class KissPanel: public wxScrolledWindow +{ +public: + KissPanel(KissCount* kiss, wxUI* parent) : + wxScrolledWindow((wxFrame*)parent), + _kiss(kiss), + _wxUI(parent), + _KissButton(NULL) + {Hide();} + + virtual void OnShow(wxShowEvent& event)=0; + virtual KissPanel* CreatePanel()=0; + virtual wxBitmapButton* GetButton(int id) {return NULL;} + virtual wxString GetToolTip() {return wxT("");} + +protected: + KissCount* _kiss; + wxUI* _wxUI; + wxBitmapButton* _KissButton; +}; + +#endif diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 4bc9bc3..92447b7 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -38,7 +38,7 @@ EVT_CHECKLISTBOX(SHARED_WITH_ID, PreferencesPanel::OnSharedChange) EVT_SHOW(PreferencesPanel::OnShow) END_EVENT_TABLE() -PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent), _sharedWith(NULL), _curAccountRow(-1) +PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _sharedWith(NULL), _curAccountRow(-1) { wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); wxBoxSizer *hbox1 = new wxBoxSizer(wxHORIZONTAL); @@ -160,8 +160,24 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*p Fit(); SetMinSize(GetSize()); +} - Hide(); +KissPanel* PreferencesPanel::CreatePanel() +{ + return new PreferencesPanel(_kiss, _wxUI); +} + +wxBitmapButton* PreferencesPanel::GetButton(int id) +{ + if (!_KissButton) + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(PREFS_ICON)), wxDefaultPosition, wxSize(128, 128)); + + return _KissButton; +} + +wxString PreferencesPanel::GetToolTip() +{ + return _("Preferences"); } void PreferencesPanel::InitAccounts(User* user) diff --git a/src/view/PreferencesPanel.h b/src/view/PreferencesPanel.h index e45437c..1731e2a 100644 --- a/src/view/PreferencesPanel.h +++ b/src/view/PreferencesPanel.h @@ -31,20 +31,22 @@ #include #include -#include -#include "wxUI.h" +#include "view.h" #include #include "PasswordDialog.h" #include "SupportedLanguages.h" #include "wxGridCellStarEditor.h" -class wxUI; -class KissCount; - -class PreferencesPanel: public wxPanel +class PreferencesPanel: public KissPanel { public: PreferencesPanel(KissCount* kiss, wxUI *parent); + + KissPanel* CreatePanel(); + wxBitmapButton* GetButton(int id); + wxString GetToolTip(); + void OnShow(wxShowEvent& event); + void ChangeUser(); void OnAccountModified(wxGridEvent& event); @@ -55,12 +57,9 @@ public: void OnChangePassword(wxCommandEvent& event); void OnOperationOrderChange(wxCommandEvent& event); void OnLanguageChange(wxCommandEvent& event); - void OnShow(wxShowEvent& event); void OnKillMe(wxCommandEvent& event); private: - KissCount* _kiss; - wxUI* _wxUI; wxGrid* _accountsGrid; wxGrid* _categoriesGrid; wxTextCtrl* _name; diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index bd71c76..8156832 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -34,7 +34,7 @@ END_EVENT_TABLE() s.Replace(wxT("\\\'"), wxT("\'"), true); \ } -SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*parent)), _kiss(kiss), _wxUI(parent), _operations(NULL) +SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _operations(NULL) { DEFAULT_FONT(font); User* user = _kiss->GetUser(); @@ -117,8 +117,6 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*pa SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); SetScrollbars(10, 10, 100/10, 100/10); - - Hide(); } SearchPanel::~SearchPanel() @@ -126,6 +124,24 @@ SearchPanel::~SearchPanel() if (_operations) delete _operations; } +KissPanel* SearchPanel::CreatePanel() +{ + return new SearchPanel(_kiss, _wxUI); +} + +wxBitmapButton* SearchPanel::GetButton(int id) +{ + if (!_KissButton) + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(SEARCH_ICON)), wxDefaultPosition, wxSize(128, 128)); + + return _KissButton; +} + +wxString SearchPanel::GetToolTip() +{ + return _("Search"); +} + void SearchPanel::OnButtonSearch(wxCommandEvent& event) { wxString *description=NULL, *amountFrom=NULL, *amountTo=NULL; diff --git a/src/view/SearchPanel.h b/src/view/SearchPanel.h index d6476a4..2872d4a 100644 --- a/src/view/SearchPanel.h +++ b/src/view/SearchPanel.h @@ -24,35 +24,33 @@ #include #include #include +#include "view.h" #include "grid/CalendarEditor.h" #include "grid/wxGridCellBitmapRenderer.h" -#include "AccountPanel.h" #include "grid/GridAccount.h" -#include "view.h" +#include "AccountPanel.h" -#include -#include "wxUI.h" #include -class wxUI; -class KissCount; class GridAccount; -class SearchPanel: public wxScrolledWindow +class SearchPanel: public KissPanel { public: SearchPanel(KissCount* kiss, wxUI *parent); ~SearchPanel(); + KissPanel* CreatePanel(); + wxBitmapButton* GetButton(int id); + wxString GetToolTip(); + void OnShow(wxShowEvent& event); + void OnButtonSearch(wxCommandEvent& event); void OnOperationModified(wxGridEvent& event); - void OnShow(wxShowEvent& event); void OnCalendarFromChange(wxCalendarEvent& event); void OnCalendarToChange(wxCalendarEvent& event); private: - KissCount* _kiss; - wxUI* _wxUI; std::vector *_operations; wxCalendarCtrl* _calendarFrom, *_calendarTo; GridAccount *_grid; diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 0f2e6da..8468a4a 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -26,7 +26,7 @@ EVT_CHOICE(RANGE_ID, StatsPanel::OnRangeChange) EVT_CHECKLISTBOX(ACCOUNTS_ID, StatsPanel::OnAccountsChange) END_EVENT_TABLE() -StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent), _plot(NULL), _chart(NULL) +StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _plot(NULL), _chart(NULL) { wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); _hbox2 = new wxBoxSizer(wxHORIZONTAL); @@ -138,8 +138,24 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ki OnRangeChange(event); Fit(); +} - Hide(); +KissPanel* StatsPanel::CreatePanel() +{ + return new StatsPanel(_kiss, _wxUI); +} + +wxBitmapButton* StatsPanel::GetButton(int id) +{ + if (!_KissButton) + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(STATS_ICON)), wxDefaultPosition, wxSize(128, 128)); + + return _KissButton; +} + +wxString StatsPanel::GetToolTip() +{ + return _("Statistics"); } void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearTo) diff --git a/src/view/StatsPanel.h b/src/view/StatsPanel.h index b4fd2af..702212b 100644 --- a/src/view/StatsPanel.h +++ b/src/view/StatsPanel.h @@ -34,24 +34,20 @@ #include #include -#include "wxUI.h" -#include #include "view.h" +#include -class wxUI; -class KissCount; - -class StatsPanel: public wxPanel //public wxScrolledWindow +class StatsPanel: public KissPanel { public: StatsPanel(KissCount* kiss, wxUI *parent); - //~StatsPanel(); + KissPanel* CreatePanel(); + wxBitmapButton* GetButton(int id); + wxString GetToolTip(); void OnShow(wxShowEvent& event); private: - KissCount* _kiss; - wxUI* _wxUI; wxCalendarCtrl* _calendarFrom, *_calendarTo; wxChoice* _monthFrom, *_yearFrom, *_monthTo, *_yearTo; wxGrid *_statsGrid; diff --git a/src/view/view.h b/src/view/view.h index f475a42..f935997 100644 --- a/src/view/view.h +++ b/src/view/view.h @@ -38,4 +38,6 @@ #define ABOUT_ICON "ressources/icons/windows-users-icon.png" #define QUIT_ICON "ressources/icons/system-log-out.png" +#include "KissPanel.h" + #endif From 7c85467a5a744a10bb6fac92695acce6c4ac87f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Mon, 20 Dec 2010 19:28:24 +0100 Subject: [PATCH 04/72] Use a factory to create panels instead of hard coded panels --- src/view/ButtonPanel.cpp | 118 -------------- src/view/ButtonPanel.h | 64 -------- src/view/wxUI.cpp | 336 +++++++++++++++++++-------------------- src/view/wxUI.h | 27 ++-- 4 files changed, 183 insertions(+), 362 deletions(-) delete mode 100644 src/view/ButtonPanel.cpp delete mode 100644 src/view/ButtonPanel.h diff --git a/src/view/ButtonPanel.cpp b/src/view/ButtonPanel.cpp deleted file mode 100644 index e145ea5..0000000 --- a/src/view/ButtonPanel.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright 2010 Grégory Soutadé - - This file is part of KissCount. - - KissCount is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - KissCount is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with KissCount. If not, see . -*/ - -#include "ButtonPanel.h" - -enum {BUTTON_ACCOUNT_ID=1, BUTTON_STATS_ID, BUTTON_SEARCH_ID, BUTTON_PREFS_ID, BUTTON_CHANGE_USER_ID, BUTTON_ABOUT_ID, BUTTON_QUIT_ID}; - -BEGIN_EVENT_TABLE(ButtonPanel, wxPanel) -EVT_BUTTON(BUTTON_ACCOUNT_ID, ButtonPanel::OnButtonAccount) -EVT_BUTTON(BUTTON_STATS_ID, ButtonPanel::OnButtonStats) -EVT_BUTTON(BUTTON_SEARCH_ID, ButtonPanel::OnButtonSearch) -EVT_BUTTON(BUTTON_PREFS_ID, ButtonPanel::OnButtonPreferences) -EVT_BUTTON(BUTTON_CHANGE_USER_ID, ButtonPanel::OnButtonChangeUser) -EVT_BUTTON(BUTTON_ABOUT_ID, ButtonPanel::OnButtonAbout) -EVT_BUTTON(BUTTON_QUIT_ID, ButtonPanel::OnButtonQuit) -END_EVENT_TABLE() - -ButtonPanel::ButtonPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent) -{ - wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); - _account = new wxBitmapButton(this, BUTTON_ACCOUNT_ID, wxBitmap(wxT(ACCOUNT_ICON)), wxDefaultPosition, wxSize(128, 128)); - _stats = new wxBitmapButton(this, BUTTON_STATS_ID, wxBitmap(wxT(STATS_ICON)), wxDefaultPosition, wxSize(128, 128)); - _search = new wxBitmapButton(this, BUTTON_SEARCH_ID, wxBitmap(wxT(SEARCH_ICON)), wxDefaultPosition, wxSize(128, 128)); - _prefs = new wxBitmapButton(this, BUTTON_PREFS_ID, wxBitmap(wxT(PREFS_ICON)), wxDefaultPosition, wxSize(128, 128)); - _changeUser = new wxBitmapButton(this, BUTTON_CHANGE_USER_ID, wxBitmap(wxT(CHANGE_USER_ICON)), wxDefaultPosition, wxSize(128, 128)); - _about = new wxBitmapButton(this, BUTTON_ABOUT_ID, wxBitmap(wxT(ABOUT_ICON)), wxDefaultPosition, wxSize(128, 128)); - _quit = new wxBitmapButton(this, BUTTON_QUIT_ID, wxBitmap(wxT(QUIT_ICON)), wxDefaultPosition, wxSize(128, 128)); - - SetSizer(hbox); - - hbox->Add(_account); - hbox->Add(_stats); - hbox->Add(_search); - hbox->Add(_prefs); - hbox->Add(_changeUser); - hbox->Add(_about); - hbox->Add(_quit); - - Fit(); - SetMinSize(GetSize()); -} - -ButtonPanel::~ButtonPanel() -{ - delete _account; - delete _stats; - delete _prefs; - delete _changeUser; -} - -void ButtonPanel::SetToolTips() -{ - _account->SetToolTip(_("Operations")); - _stats->SetToolTip(_("Statistics")); - _search->SetToolTip(_("Search")); - _prefs->SetToolTip(_("Preferences")); - _changeUser->SetToolTip(_("Change user")); - _about->SetToolTip(_("About")); - _quit->SetToolTip(_("Quit")); -} - -void ButtonPanel::OnButtonAccount(wxCommandEvent& event) -{ - _wxUI->ShowAccount(); -} - -void ButtonPanel::OnButtonStats(wxCommandEvent& event) -{ - _wxUI->ShowStats(); -} - -void ButtonPanel::OnButtonSearch(wxCommandEvent& event) -{ - _wxUI->ShowSearch(); -} - -void ButtonPanel::OnButtonPreferences(wxCommandEvent& event) -{ - _wxUI->ShowPreferences(); -} - -void ButtonPanel::OnButtonChangeUser(wxCommandEvent& event) -{ - _wxUI->ChangeUser(); -} - -void ButtonPanel::OnButtonAbout(wxCommandEvent& event) -{ - wxMessageBox( _("Personal accounting software\n\nhttp://indefero.soutade.fr/p/kisscount/\n\nLicenced under GNU GPL v3\n\nCopyright (C) 2010 Grégory Soutadé"), - wxT("KissCount " APP_VERSION "\n\n"), - wxOK | wxICON_INFORMATION, _wxUI ); -} - -void ButtonPanel::OnButtonQuit(wxCommandEvent& event) -{ - wxMessageDialog dialog(_wxUI, _("Quit KissCount ?"), wxT("KissCount"), wxYES_NO); - if (dialog.ShowModal() == wxID_NO) - { - return; - } - _wxUI->Close(true); -} diff --git a/src/view/ButtonPanel.h b/src/view/ButtonPanel.h deleted file mode 100644 index 6b93c2b..0000000 --- a/src/view/ButtonPanel.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright 2010 Grégory Soutadé - - This file is part of KissCount. - - KissCount is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - KissCount is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with KissCount. If not, see . -*/ - -#ifndef BUTTONPANEL_H -#define BUTTONPANEL_H - -#include - -#include -#include "wxUI.h" - -#include "view.h" - -class KissCount; -class wxUI; - -class ButtonPanel: public wxPanel -{ -public: - - ButtonPanel(KissCount* kiss, wxUI *parent); - ~ButtonPanel(); - - void SetToolTips(); - - void OnButtonAccount(wxCommandEvent& event); - void OnButtonStats(wxCommandEvent& event); - void OnButtonSearch(wxCommandEvent& event); - void OnButtonPreferences(wxCommandEvent& event); - void OnButtonChangeUser(wxCommandEvent& event); - void OnButtonAbout(wxCommandEvent& event); - void OnButtonQuit(wxCommandEvent& event); - -private: - KissCount* _kiss; - wxUI* _wxUI; - wxBitmapButton* _account; - wxBitmapButton* _stats; - wxBitmapButton* _search; - wxBitmapButton* _prefs; - wxBitmapButton* _changeUser; - wxBitmapButton* _about; - wxBitmapButton* _quit; - - DECLARE_EVENT_TABLE(); -}; - -#endif diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index d5e17a4..c2a5f76 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -19,38 +19,64 @@ #include "wxUI.h" +enum {BUTTON_CHANGE_USER_ID=-4, BUTTON_ABOUT_ID=-5, BUTTON_QUIT_ID=-6}; + +BEGIN_EVENT_TABLE(wxUI, wxFrame) +EVT_BUTTON(BUTTON_CHANGE_USER_ID, wxUI::OnButtonChangeUser) +EVT_BUTTON(BUTTON_ABOUT_ID, wxUI::OnButtonAbout) +EVT_BUTTON(BUTTON_QUIT_ID, wxUI::OnButtonQuit) +END_EVENT_TABLE() + wxString months[12] ; wxColour categoryColors[12] = {wxColour(0x00, 0x45, 0x86), - wxColour(0xFF, 0x3E, 0x0E), - wxColour(0xFF, 0xD3, 0x20), - wxColour(0x58, 0x9D, 0x1B), - wxColour(0x7E, 0x00, 0x21), - wxColour(0x83, 0xCC, 0xFF), - wxColour(0x31, 0x40, 0x04), - wxColour(0xB0, 0xCF, 0x00), - wxColour(0x4B, 0x1F, 0x6F), - wxColour(0xFF, 0x93, 0x0E), - wxColour(0xC5, 0x00, 0x0D), - wxColour(0x00, 0x84, 0xD1)}; + wxColour(0xFF, 0x3E, 0x0E), + wxColour(0xFF, 0xD3, 0x20), + wxColour(0x58, 0x9D, 0x1B), + wxColour(0x7E, 0x00, 0x21), + wxColour(0x83, 0xCC, 0xFF), + wxColour(0x31, 0x40, 0x04), + wxColour(0xB0, 0xCF, 0x00), + wxColour(0x4B, 0x1F, 0x6F), + wxColour(0xFF, 0x93, 0x0E), + wxColour(0xC5, 0x00, 0x0D), + wxColour(0x00, 0x84, 0xD1)}; wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame(NULL, wxID_ANY, title, pos, size), _kiss(kiss), _buttonPanel(NULL), _accountPanel(NULL), _statsPanel(NULL), - _searchPanel(NULL), _preferencesPanel(NULL), _curPanel(NULL), _locale(NULL), _needReload(false) + : wxFrame(NULL, -1, title, pos, size), _kiss(kiss), + _curPanel(NULL), _locale(NULL), _needReload(false) { - _hbox = new wxBoxSizer(wxVERTICAL); - _buttonPanel = new ButtonPanel(_kiss, this); + _vbox = new wxBoxSizer(wxVERTICAL); + _buttonsBox = new wxBoxSizer(wxHORIZONTAL); + // ButtonPanel* buttons = new ButtonPanel(_kiss, this); + // wxMenu *menuFile = new wxMenu; - SetSizer(_hbox); + // menuFile->Append( ID_About, wxT("&About...") ); + // menuFile->AppendSeparator(); + // menuFile->Append( ID_Quit, wxT("E&xit") ); - _hbox->Add(_buttonPanel); + // wxMenuBar *menuBar = new wxMenuBar; + // menuBar->Append( menuFile, wxT("&File") ); + + // SetMenuBar( menuBar ); + + // CreateStatusBar(); + // SetStatusText( wxT("Welcome to wxWidgets!") ); + _buttonsBox->Add(new wxBitmapButton(this, BUTTON_CHANGE_USER_ID, wxBitmap(wxT(CHANGE_USER_ICON)), wxDefaultPosition, wxSize(128, 128))); + _buttonsBox->Add(new wxBitmapButton(this, BUTTON_ABOUT_ID, wxBitmap(wxT(ABOUT_ICON)), wxDefaultPosition, wxSize(128, 128))); + _buttonsBox->Add(new wxBitmapButton(this, BUTTON_QUIT_ID, wxBitmap(wxT(QUIT_ICON)), wxDefaultPosition, wxSize(128, 128))); + + SetSizer(_vbox); + + _vbox->Add(_buttonsBox, 0, wxGROW); } wxUI::~wxUI() { - if (_accountPanel) delete _accountPanel; - if (_preferencesPanel) delete _preferencesPanel; - if (_searchPanel) delete _searchPanel; - if (_statsPanel) delete _statsPanel; + int i; + + for (i=0; i<(int)_panels.size(); i++) + Disconnect(i, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxUI::OnButtonClicked), _panels[i], this); + if (_locale) delete _locale; } @@ -64,31 +90,31 @@ bool wxUI::SetLanguage(long language) // load language if possible, fall back to english otherwise if(wxLocale::IsAvailable(language)) { - _locale = new wxLocale( language, wxLOCALE_CONV_ENCODING ); + _locale = new wxLocale( language, wxLOCALE_CONV_ENCODING ); #ifdef __WXGTK__ - _locale->AddCatalogLookupPathPrefix(wxT("./ressources/po")); + _locale->AddCatalogLookupPathPrefix(wxT("./ressources/po")); #endif - _locale->AddCatalog(wxT("french")); - _locale->AddCatalog(wxT("kisscount")); + _locale->AddCatalog(wxT("french")); + _locale->AddCatalog(wxT("kisscount")); - _language = (wxLanguage) language; + _language = (wxLanguage) language; } if (_locale == NULL || !_locale->IsOk()) { - if (_locale) delete _locale; - _locale = new wxLocale(); + if (_locale) delete _locale; + _locale = new wxLocale(); #ifdef __WXGTK__ - _locale->AddCatalogLookupPathPrefix(wxT("./ressources/po")); + _locale->AddCatalogLookupPathPrefix(wxT("./ressources/po")); #endif - _locale->AddCatalog(wxT("kisscount")); + _locale->AddCatalog(wxT("kisscount")); - _language = wxLANGUAGE_ENGLISH; - res = false; + _language = wxLANGUAGE_ENGLISH; + res = false; } months[0] = _("january"); @@ -104,30 +130,108 @@ bool wxUI::SetLanguage(long language) months[10] = _("november"); months[11] = _("december") ; - if (_buttonPanel) - _buttonPanel->SetToolTips(); - return res; } -void wxUI::ShowAccount() +#define ADD_PANEL(panelName, id) \ + panel = new panelName(_kiss, this); \ + button = panel->GetButton(id); \ + button->SetToolTip(panel->GetToolTip()); \ + _buttonsBox->Insert(id, button); \ + _buttons.insert(_buttons.begin()+id, button); \ + _panels.push_back(panel); \ + Connect(id, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxUI::OnButtonClicked), panel, this); + +void wxUI::InitPanels() { - ShowPanel(_accountPanel); + KissPanel* panel; + wxBitmapButton* button; + _panels.clear(); + + ADD_PANEL(AccountPanel, 0); + ADD_PANEL(StatsPanel, 1); + ADD_PANEL(SearchPanel, 2); + ADD_PANEL(PreferencesPanel, 3); } -void wxUI::ShowSearch() +void wxUI::LoadPanels() { - ShowPanel(_searchPanel); + std::vector::iterator it; + KissPanel* temp; + int i; + + if (_curPanel) + { + _vbox->Detach(_curPanel); + _curPanel = NULL; + } + + if (_panels.size()) + { + for (i=0; i<(int)_panels.size(); i++) + { + temp = _panels[i]->CreatePanel(); + Disconnect(i, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxUI::OnButtonClicked), _panels[i], this); + _panels[i] = temp; + Connect(i, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxUI::OnButtonClicked), temp, this); + std::cout << temp->GetToolTip().mb_str() << "\n"; + _buttons[i]->SetToolTip(temp->GetToolTip()); + } + } + else + InitPanels(); } -void wxUI::ShowStats() +void wxUI::LoadUser() { - ShowPanel(_statsPanel); + User* user = _kiss->GetUser(); + LoadPanels(); + + if (user->_preferences[wxT("language")] != wxT("")) + SetLanguage(user->GetLanguage()); + + if (_panels.size()) + ShowPanel(_panels[0]); } -void wxUI::ShowPreferences() +void wxUI::ShowPanel(KissPanel* panel) { - ShowPanel(_preferencesPanel); + wxShowEvent event; + int i; + + if (!panel) return; + + if (_curPanel) + { + _vbox->Detach(_curPanel); + _curPanel->Hide(); + } + + if (_needReload) + { + for(i=0; i<(int)_panels.size(); i++) + if (_panels[i] == panel) break; + LoadPanels(); + _needReload = false; + _curPanel = _panels[i]; + } + else + _curPanel = panel; + + _curPanel->OnShow(event); + _vbox->Add(_curPanel); + _curPanel->Show(); + Layout(); +} + +void wxUI::OnButtonClicked(wxCommandEvent& event) +{ + ShowPanel(_panels[event.GetId()]); +} + +void wxUI::OnButtonChangeUser(wxCommandEvent& event) +{ + ChangeUser(); } void wxUI::ChangeUser() @@ -135,151 +239,47 @@ void wxUI::ChangeUser() UsersDialog u(_kiss, this); } -void wxUI::LoadUser() +void wxUI::OnButtonAbout(wxCommandEvent& event) { - User* user = _kiss->GetUser(); - wxShowEvent event; - - if (_curPanel) - { - _hbox->Detach(_curPanel); - _curPanel = NULL; - } - - if (_accountPanel) - delete _accountPanel; - - if (_preferencesPanel) - delete _preferencesPanel; - - if (_searchPanel) - delete _searchPanel; - - if (_statsPanel) - delete _statsPanel; - - if (user->_preferences[wxT("language")].Length()) - SetLanguage(user->GetLanguage()); - - _accountPanel = new AccountPanel(_kiss, this); - _statsPanel = new StatsPanel(_kiss, this); - _searchPanel = new SearchPanel(_kiss, this); - _preferencesPanel = new PreferencesPanel(_kiss, this); - - ShowPanel(_accountPanel); - _accountPanel->OnShow(event); + wxMessageBox( _("Personal accounting software\n\nhttp://indefero.soutade.fr/p/kisscount/\n\nLicenced under GNU GPL v3\n\nCopyright (C) 2010 Grégory Soutadé"), + wxT("KissCount " APP_VERSION "\n\n"), + wxOK | wxICON_INFORMATION, this ); } -void wxUI::ShowPanel(wxPanel* panel) +void wxUI::OnButtonQuit(wxCommandEvent& event) { - int month, year=-1, account=0, preferences=0, search=0, stats=0; - wxShowEvent event; - - if (!panel || (panel == _curPanel && !_needReload)) return; - - if (_curPanel) + wxMessageDialog dialog(this, _("Quit KissCount ?"), wxT("KissCount"), wxYES_NO); + if (dialog.ShowModal() == wxID_NO) { - _hbox->Detach(_curPanel); - _curPanel->Hide(); + return; } - if (_needReload) - { - if (panel == _accountPanel) - { - account = 1; - month = _accountPanel->_curMonth; - year = _accountPanel->_curYear; - } - - if (panel == _preferencesPanel) - { - preferences = 1; - } - - if (panel == _searchPanel) - { - search = 1; - } - - if (panel == _statsPanel) - { - stats = 1; - } - - delete _accountPanel; - delete _preferencesPanel; - delete _searchPanel; - delete _statsPanel; - - _accountPanel = new AccountPanel(_kiss, this); - if (year != -1) - { - _kiss->LoadYear(year, true); - _accountPanel->ShowMonth(month, year); - } - _preferencesPanel = new PreferencesPanel(_kiss, this); - _searchPanel = new SearchPanel(_kiss, this); - _statsPanel = new StatsPanel(_kiss, this); - - if (account) - { - _accountPanel->OnShow(event); - panel = _accountPanel; - } - else if (preferences) - { - _preferencesPanel->OnShow(event); - panel = _preferencesPanel; - } - else if (search) - { - _searchPanel->OnShow(event); - panel = _searchPanel; - } - else if (stats) - { - _statsPanel->OnShow(event); - panel = _statsPanel; - } - - _hbox->Detach(_accountPanel); - _accountPanel->Hide(); - - _needReload = false; - } - - _curPanel = panel; - _hbox->Add(panel, 1, wxGROW|wxALL, 0); - _curPanel->Show(); - Layout(); + Close(true); } void wxUI::GenerateMonth(int month, int year) { - _accountPanel->GenerateMonth(month, year); + ((AccountPanel*)_panels[0])->GenerateMonth(month, year); } void wxUI::KillMe() { + std::vector::iterator it; + if (_curPanel) { - _hbox->Detach(_curPanel); - _curPanel = NULL; + _vbox->Detach(_curPanel); + _curPanel = NULL; } - if (_accountPanel) - delete _accountPanel; + for (it=_panels.begin(); it!= _panels.end(); it++) + { + if (*it) delete *it; + _buttonsBox->Remove(0); + _buttons.erase(_buttons.begin()); + } - if (_preferencesPanel) - delete _preferencesPanel; - - if (_searchPanel) - delete _searchPanel; - - _accountPanel = NULL; - _preferencesPanel = NULL; - _searchPanel = NULL; + _panels.clear(); } void wxUI::NeedReload() diff --git a/src/view/wxUI.h b/src/view/wxUI.h index b42684f..9522c70 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -22,7 +22,6 @@ #include #include "AccountPanel.h" -#include "ButtonPanel.h" #include "PreferencesPanel.h" #include "UsersDialog.h" #include "GenerateDialog.h" @@ -35,10 +34,8 @@ #include "grid/wxGridCellButtonEditor.h" class KissCount; -class ButtonPanel; class AccountPanel; class PreferencesPanel; -class StatsPanel; extern wxString months[12]; extern wxColour categoryColors[12]; @@ -56,29 +53,35 @@ public: void LoadUser(); void ShowAccount(); - void ShowStats(); void ShowSearch(); void ShowPreferences(); void GenerateMonth(int month, int year); void KillMe(); - void ShowPanel(wxPanel* panel); + void ShowPanel(KissPanel* panel); void NeedReload(); wxLanguage _language; + void OnButtonClicked(wxCommandEvent& event); + void OnButtonChangeUser(wxCommandEvent& event); + void OnButtonAbout(wxCommandEvent& event); + void OnButtonQuit(wxCommandEvent& event); + private: KissCount *_kiss; - wxBoxSizer *_hbox; - ButtonPanel *_buttonPanel; - AccountPanel *_accountPanel; - StatsPanel *_statsPanel; - SearchPanel *_searchPanel; - PreferencesPanel *_preferencesPanel; - wxPanel *_curPanel; + wxBoxSizer *_vbox, *_buttonsBox; + KissPanel *_curPanel; + std::vector _panels; + std::vector _buttons; wxLocale *_locale; bool _needReload; + + void InitPanels(); + void LoadPanels(); + + DECLARE_EVENT_TABLE(); }; #endif From 6317511fd8abeeb3e1a6e961a319b9b5087bc1b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Mon, 20 Dec 2010 20:17:46 +0100 Subject: [PATCH 05/72] Forgot to remove debugging disply --- ChangeLog | 7 ++++++- TODO | 1 - src/view/wxUI.cpp | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b00522..5879e5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ -v0.2_dev (12/12/10) +v0.2_dev (20/12/10) + +** User ** Better use of sizers (so better interface!) + +** Dev ** + Use a factory to create panels (prepare for plug-in) diff --git a/TODO b/TODO index eb78945..25bf88d 100644 --- a/TODO +++ b/TODO @@ -3,7 +3,6 @@ Version 0.2 Statistics (need to add months/years label on graph) Auto completion (already up into wxwidgets 2.9) Using tabulation to navigate throw interface (Search Panel) -Improve Scrolled Windows and widgets placement Can type a letter with a comboboxes Windows version Need packaging (.deb) diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index c2a5f76..142827e 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -174,7 +174,6 @@ void wxUI::LoadPanels() Disconnect(i, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxUI::OnButtonClicked), _panels[i], this); _panels[i] = temp; Connect(i, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxUI::OnButtonClicked), temp, this); - std::cout << temp->GetToolTip().mb_str() << "\n"; _buttons[i]->SetToolTip(temp->GetToolTip()); } } From c527fad7563b3bb6cd234c214c04420f88d1d219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 6 Jan 2011 18:18:31 +0100 Subject: [PATCH 06/72] Bug of new year --- src/model/Database.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 0b83830..53278ce 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -661,6 +661,10 @@ bool Database::LoadOperation(User* user, const wxString& id) op.transfert = set.GetAsString(wxT("transfert")); op.formula = set.GetAsString(wxT("formula")); op.meta = set.GetBool(wxT("meta")); + + if (!user->_operations[op.year]) + user->_operations[op.year] = new std::map >(); + for (it = (*user->_operations[op.year])[op.month].begin(); it != (*user->_operations[op.year])[op.month].end(); it++) From 5bf9e2f871812d29e29e69bf4f35f99045784e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 6 Jan 2011 18:27:58 +0100 Subject: [PATCH 07/72] Bad version number --- src/controller/KissCount.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index 7eb3a0a..0da2a31 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -29,7 +29,7 @@ #include -#define APP_VERSION "v0.1" +#define APP_VERSION "v0.2 dev" class wxUI; class Database; From c0c5a090f675967ebf2db9102864780a2e2abcae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 6 Jan 2011 18:32:45 +0100 Subject: [PATCH 08/72] Update package.sh to take care of spaces in version number --- tools/package.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/package.sh b/tools/package.sh index fba1944..f4ec3bc 100755 --- a/tools/package.sh +++ b/tools/package.sh @@ -6,16 +6,16 @@ VERSION=`cat src/controller/KissCount.h | grep APP_VERSION | cut -d\" -f2` DIR="KissCount_build_${VERSION}_${DATE}_${ARCH}" FILE="$DIR.tar.bz2" -rm -f $FILE -rm -rf $DIR +rm -f "$FILE" +rm -rf "$DIR" if [ "$1" == "clean" ] ; then make clean fi make || (echo "Compilation failed" ; exit 1) -mkdir -p $DIR/lib -cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* $DIR/lib -cp -r kc init.sql ressources tools/launch_kc.sh TODO CONTRIBUTORS COPYING README README.fr www $DIR -find $DIR -type f -executable -exec strip \{\} \; -tar -jcf $FILE $DIR -rm -rf $DIR +mkdir -p "$DIR"/lib +cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DIR"/lib +cp -r kc init.sql ressources tools/launch_kc.sh TODO CONTRIBUTORS COPYING README README.fr www "$DIR" +find "$DIR" -type f -executable -exec strip \{\} \; +tar -jcf "$FILE" "$DIR" +rm -rf "$DIR" echo "Packaged !" \ No newline at end of file From e6ca15f5f3aff993e9b6788cc65a367d82feec18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 6 Jan 2011 18:59:23 +0100 Subject: [PATCH 09/72] Better fix for previous bug --- src/model/Database.cpp | 46 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 53278ce..3b6b754 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -662,33 +662,33 @@ bool Database::LoadOperation(User* user, const wxString& id) op.formula = set.GetAsString(wxT("formula")); op.meta = set.GetBool(wxT("meta")); - if (!user->_operations[op.year]) - user->_operations[op.year] = new std::map >(); - - for (it = (*user->_operations[op.year])[op.month].begin(); - it != (*user->_operations[op.year])[op.month].end(); - it++) + if (user->_operations[op.year]) { - if (!op.fix_cost && it->fix_cost) continue; - if (op.fix_cost && !it->fix_cost) + for (it = (*user->_operations[op.year])[op.month].begin(); + it != (*user->_operations[op.year])[op.month].end(); + it++) { - it--; - break; - } - if (it->day > op.day) - { - it--; - break; + if (!op.fix_cost && it->fix_cost) continue; + if (op.fix_cost && !it->fix_cost) + { + it--; + break; + } + if (it->day > op.day) + { + it--; + break; + } } + if (it == (*user->_operations[op.year])[op.month].end()) + (*user->_operations[op.year])[op.month].push_back(op); + else + (*user->_operations[op.year])[op.month].insert(it, op); + // if (op.fix_cost) + // else + // (*user->_operations[op.year])[op.month].push_back(op); + ret = true; } - if (it == (*user->_operations[op.year])[op.month].end()) - (*user->_operations[op.year])[op.month].push_back(op); - else - (*user->_operations[op.year])[op.month].insert(it, op); - // if (op.fix_cost) - // else - // (*user->_operations[op.year])[op.month].push_back(op); - ret = true; } set.Finalize(); From d2d8e47dbcd1bce8e43a919022195251b9bcf928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 6 Jan 2011 20:19:03 +0100 Subject: [PATCH 10/72] Bug on GenerateMonth with different years --- src/controller/KissCount.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 18203a5..4113bc4 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -296,8 +296,8 @@ void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int year } // Re Generate parents - for(it = (*_user->_operations[yearFrom])[monthTo].begin(); - it != (*_user->_operations[yearFrom])[monthTo].end(); + for(it = (*_user->_operations[yearTo])[monthTo].begin(); + it != (*_user->_operations[yearTo])[monthTo].end(); it++) { if (it->parent.Length()) @@ -305,8 +305,8 @@ void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int year it->parent = meta[it->parent]; UpdateOperation(*it); - for(it2 = (*_user->_operations[yearFrom])[monthTo].begin(); - it2 != (*_user->_operations[yearFrom])[monthTo].end(); + for(it2 = (*_user->_operations[yearTo])[monthTo].begin(); + it2 != (*_user->_operations[yearTo])[monthTo].end(); it2++) if (it2->id == it->parent) { From d71f055dfc1f9b9d8f3ad8bbb8048f2d2bab9522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 8 Jan 2011 12:17:54 +0100 Subject: [PATCH 11/72] Fix several bugs in StatsPanel : Bad selection of year with multiple years Bad year range check Unordered accounts (makes account selection points to bad indexes on account graph) --- ChangeLog | 5 ++++- src/model/User.h | 5 +++++ src/view/StatsPanel.cpp | 41 +++++++++++++++++++++-------------------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5879e5a..4c97cec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,11 @@ -v0.2_dev (20/12/10) +v0.2_dev (06/01/2011) ** User ** Better use of sizers (so better interface!) ** Dev ** Use a factory to create panels (prepare for plug-in) + +** Bugs ** + Bug on GenerateMonth with different years diff --git a/src/model/User.h b/src/model/User.h index 3e9b689..509186d 100644 --- a/src/model/User.h +++ b/src/model/User.h @@ -51,14 +51,19 @@ public: wxString GetCategoryName(wxString& catId); wxString GetCategoryId(wxString& catName); const wxFont GetCategoryFont(wxString& catId); + Account GetAccount(const wxString& accountId); wxString GetAccountName(const wxString& accountId); wxString GetAccountId(wxString& accountName); + int GetCategoriesNumber(); int GetAccountsNumber(); int GetOperationsNumber(int month, int year); + wxLanguage GetLanguage(); + void LinkOrUnlinkOperation(Operation& op); + void Group(const Operation& op); bool Group(std::vector* ops, const Operation& op); void UnGroup(const Operation& op); diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 8468a4a..0a5a650 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -54,10 +54,12 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _yearTo->Append(wxString::Format(wxT("%d"), it->first)); } - _monthFrom->Select(0); - _monthTo->Select(11); + if (i) i--; + _yearFrom->Select(i); _yearTo->Select(i); + _monthFrom->Select(0); + _monthTo->Select(11); wxStaticText* label = new wxStaticText(this, wxID_ANY, _("From")); hbox->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); @@ -163,12 +165,11 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT std::map > > accountAmounts; std::map categories; std::map > operations; - std::map >::iterator accountIdIt2; + std::vector::iterator accountIt; std::map::iterator categoriesIt; - std::map > >::iterator accountIdIt; std::map >::iterator accountYearIt; double total; - int size, i, a, b, percents, account, nbDays; + int account, size, i, a, b, percents, nbDays; double *amounts; wxString value; User* user = _kiss->GetUser(); @@ -204,10 +205,10 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT dataset->AddSerie((double *) amounts, nbDays); delete[] amounts; - for (account = 0, i = 0, accountIdIt2 = operations.begin(); accountIdIt2 != operations.end(); - accountIdIt2++, i++, account++) + for (account = 0, i = 0, accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); + account++, accountIt++, i++) { - if (!((wxCheckListBox*)_account)->IsChecked(account)) + if (!_account->IsChecked(account)) { i-- ; continue; @@ -218,11 +219,11 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT for (a=0; afirst][a]; + amounts[a*2+1] = operations[accountIt->id][a]; } dataset->AddSerie((double *) amounts, nbDays); // set serie names to be displayed on legend - dataset->SetSerieName(i+1, user->GetAccountName(accountIdIt2->first)); + dataset->SetSerieName(i+1, user->GetAccountName(accountIt->id)); delete[] amounts; } } @@ -245,34 +246,34 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT dataset->AddSerie((double *) amounts, size); delete[] amounts; - for (account = 0, i = 0, accountIdIt = accountAmounts.begin(); accountIdIt != accountAmounts.end(); - accountIdIt++, i++, account++) + for (account = 0, i = 0, accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); + account++, accountIt++, i++) { - if (!((wxCheckListBox*)_account)->IsChecked(account)) + if (!_account->IsChecked(account)) { i-- ; continue; } - size = accountAmounts[accountIdIt->first].size(); + size = accountAmounts[accountIt->id].size(); amounts = new double[size*12*2]; size = 0; - for(a = 0, accountYearIt = accountAmounts[accountIdIt->first].begin(); - accountYearIt != accountAmounts[accountIdIt->first].end(); + for(a = 0, accountYearIt = accountAmounts[accountIt->id].begin(); + accountYearIt != accountAmounts[accountIt->id].end(); accountYearIt++, a++) { for(b = 0; b<12; b++) { - if (!accountAmounts[accountIdIt->first][accountYearIt->first].count(b)) + if (!accountAmounts[accountIt->id][accountYearIt->first].count(b)) continue; amounts[size*2+0] = a*12+b; - amounts[size*2+1] = accountAmounts[accountIdIt->first][accountYearIt->first][b]; + amounts[size*2+1] = accountAmounts[accountIt->id][accountYearIt->first][b]; size++; } } dataset->AddSerie((double *) amounts, size); // set serie names to be displayed on legend - dataset->SetSerieName(i+1, user->GetAccountName(accountIdIt->first)); + dataset->SetSerieName(i+1, user->GetAccountName(accountIt->id)); delete[] amounts; } } @@ -351,7 +352,7 @@ void StatsPanel::OnRangeChange(wxCommandEvent& event) monthTo = _monthTo->GetCurrentSelection(); _yearTo->GetStringSelection().ToLong(&yearTo); - if (yearTo > yearFrom || + if (yearTo < yearFrom || (yearFrom == yearTo && monthFrom > monthTo)) { wxMessageBox(_("Invalide date range"), _("KissCount"), wxICON_ERROR | wxOK); From 0975d12c86e54a9bc6221954e7026d40651e31da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 8 Jan 2011 12:20:22 +0100 Subject: [PATCH 12/72] Update ChangeLog --- ChangeLog | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4c97cec..7c220c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ -v0.2_dev (06/01/2011) +v0.2_dev (08/01/2011) ** User ** Better use of sizers (so better interface!) @@ -9,3 +9,7 @@ v0.2_dev (06/01/2011) ** Bugs ** Bug on GenerateMonth with different years + In StatsPanel : + Bad selection of year with multiple years + Bad year range check + Unordered accounts (makes account selection points to bad indexes on account graph) From a4b01362de1dda1653759545b1049bbdebe8d663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 16 Jan 2011 20:50:48 +0100 Subject: [PATCH 13/72] Fix a bug in account creation --- src/view/PreferencesPanel.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 92447b7..508076f 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -238,6 +238,12 @@ void PreferencesPanel::AddAccount(int line, Account ac) _accountsGrid->SetReadOnly(line, ACCOUNT_DEFAULT, true); _accountsGrid->SetReadOnly(line, ACCOUNT_BLOCKED, true); } + else + { + _accountsGrid->SetReadOnly(line, ACCOUNT_DEFAULT, false); + _accountsGrid->SetReadOnly(line, ACCOUNT_BLOCKED, false); + _accountsGrid->SetReadOnly(line, ACCOUNT_DELETE, false); + } } else { @@ -488,6 +494,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) new_account.shared = false; new_account.blocked = false; + new_account.is_owner = true; AddAccount(row, new_account); _kiss->AddAccount(new_account); @@ -495,7 +502,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) _accountsGrid->AppendRows(); new_account.id = wxT("0"); - AddAccount(row, new_account); + AddAccount(row+1, new_account); } _wxUI->Layout(); From 87b68db3190aa6fce33956bd258afef6d1ad2618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 16 Jan 2011 20:51:15 +0100 Subject: [PATCH 14/72] Update Changelog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 7c220c0..9a0b39d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,3 +13,4 @@ v0.2_dev (08/01/2011) Bad selection of year with multiple years Bad year range check Unordered accounts (makes account selection points to bad indexes on account graph) + Bug in account creation (read only fields) From 81884250bcbf17ca44c6eb19ec60ea2869c39731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 23 Jan 2011 09:51:08 +0100 Subject: [PATCH 15/72] Solve bug of scrollbar and window when there is a lot of operations in AccountPanel --- ChangeLog | 5 +++-- src/view/AccountPanel.cpp | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a0b39d..422cb9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -v0.2_dev (08/01/2011) +v0.2_dev (23/01/2011) ** User ** Better use of sizers (so better interface!) + No further problems with scrollbar in AccountPanel when there is a lot of operations ** Dev ** Use a factory to create panels (prepare for plug-in) @@ -13,4 +14,4 @@ v0.2_dev (08/01/2011) Bad selection of year with multiple years Bad year range check Unordered accounts (makes account selection points to bad indexes on account graph) - Bug in account creation (read only fields) + Bug in account creation (readonly fields) diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 5ba728d..5963e7f 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -146,6 +146,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare Fit(); SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); + SetMaxSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); SetScrollbars(10, 10, 100/10, 100/10); } @@ -573,6 +574,8 @@ void AccountPanel::UpdateStats() void AccountPanel::OnOperationModified(wxGridEvent& event) { UpdateStats(); + + Fit(); } void AccountPanel::OnAccountModified(wxGridEvent& event) From c0591e981541c642ed913e671889988bed035a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Tue, 25 Jan 2011 20:26:29 +0100 Subject: [PATCH 16/72] Add cross compilation support --- ChangeLog | 3 ++- Makefile | 13 ++++++++----- tools/package.sh | 6 +++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 422cb9e..a18d440 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ -v0.2_dev (23/01/2011) +v0.2_dev (25/01/2011) ** User ** Better use of sizers (so better interface!) @@ -7,6 +7,7 @@ v0.2_dev (23/01/2011) ** Dev ** Use a factory to create panels (prepare for plug-in) + Better cross compilation support (Makefile and package.sh) ** Bugs ** Bug on GenerateMonth with different years diff --git a/Makefile b/Makefile index d753805..d110e41 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ -CXXFLAGS=`wx-config --cxxflags` -Wall -Isrc -ggdb +CXXFLAGS+=`wx-config --cxxflags` -Wall -Isrc -ggdb CXXFLAGS+=-I./lib/wxsqlite3-1.9.9/include CXXFLAGS+=-I./lib/freechart/include -LDFLAGS=`wx-config --libs` +LDFLAGS+=`wx-config --libs` LDFLAGS+=-L./lib/wxsqlite3-1.9.9/lib/ -lwxcode_gtk2u_wxsqlite3-2.8 LDFLAGS+=-L./lib/freechart/lib -lwxcode_gtk2u_freechart-2.8 -CXX=g++ +CXX=$(PREFIX)g++ SOURCES=$(wildcard src/model/*.cpp) SOURCES+=$(wildcard src/view/*.cpp) @@ -34,5 +34,8 @@ check: kc: $(OBJS) $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) -generate_locals: - ./generate_locales.sh +generate_locales: + ./tools/generate_locales.sh + +package: + ./tools/package.sh diff --git a/tools/package.sh b/tools/package.sh index f4ec3bc..b0685a5 100755 --- a/tools/package.sh +++ b/tools/package.sh @@ -1,7 +1,7 @@ #!/bin/bash DATE=`date +%d.%m.%Y` -ARCH=`uname -m` +ARCH=`${PREFIX}gcc -dumpmachine | cut -d- -f1` VERSION=`cat src/controller/KissCount.h | grep APP_VERSION | cut -d\" -f2` DIR="KissCount_build_${VERSION}_${DATE}_${ARCH}" FILE="$DIR.tar.bz2" @@ -15,7 +15,7 @@ make || (echo "Compilation failed" ; exit 1) mkdir -p "$DIR"/lib cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DIR"/lib cp -r kc init.sql ressources tools/launch_kc.sh TODO CONTRIBUTORS COPYING README README.fr www "$DIR" -find "$DIR" -type f -executable -exec strip \{\} \; +find "$DIR" -type f -executable -exec ${PREFIX}strip \{\} \; tar -jcf "$FILE" "$DIR" rm -rf "$DIR" -echo "Packaged !" \ No newline at end of file +echo "Packaged into $FILE !" \ No newline at end of file From d0d614beee440a306276db718a2f6dff2caf1aff Mon Sep 17 00:00:00 2001 From: www-data Date: Wed, 26 Jan 2011 11:58:32 +0100 Subject: [PATCH 17/72] Update version to avoid spaces for package.sh --- ressources/po/kisscount.pot | 219 +++++++++++++++++------------------- src/controller/KissCount.h | 2 +- 2 files changed, 104 insertions(+), 117 deletions(-) diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 7bd4551..078a06e 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,26 +8,25 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-12-02 19:11+0100\n" +"POT-Creation-Date: 2011-01-26 11:41+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/view/StatsPanel.cpp:327 src/view/PreferencesPanel.cpp:775 +#: src/view/StatsPanel.cpp:339 src/view/PreferencesPanel.cpp:790 msgid " - " msgstr "" -#: src/view/UsersDialog.cpp:118 src/view/PreferencesPanel.cpp:456 -#: src/view/PreferencesPanel.cpp:476 src/view/PreferencesPanel.cpp:677 -#: src/view/PreferencesPanel.cpp:696 src/view/PreferencesPanel.cpp:733 +#: src/view/PreferencesPanel.cpp:470 src/view/PreferencesPanel.cpp:490 +#: src/view/PreferencesPanel.cpp:692 src/view/PreferencesPanel.cpp:711 +#: src/view/PreferencesPanel.cpp:748 src/view/UsersDialog.cpp:120 msgid " already exists" msgstr "" -#: src/view/SearchPanel.cpp:226 +#: src/view/SearchPanel.cpp:242 msgid " entries found" msgstr "" @@ -35,11 +34,11 @@ msgstr "" msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:742 +#: src/view/AccountPanel.cpp:757 msgid " operations ?" msgstr "" -#: src/view/PreferencesPanel.cpp:782 +#: src/view/PreferencesPanel.cpp:797 msgid " profil ?" msgstr "" @@ -47,19 +46,15 @@ msgstr "" msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "" -#: src/view/SearchPanel.cpp:228 +#: src/view/SearchPanel.cpp:244 msgid "1 entry found" msgstr "" -#: src/view/ButtonPanel.cpp:74 -msgid "About" -msgstr "" - #: src/view/SearchPanel.cpp:90 src/view/grid/GridAccount.cpp:64 msgid "Account" msgstr "" -#: src/view/PreferencesPanel.cpp:456 src/view/PreferencesPanel.cpp:476 +#: src/view/PreferencesPanel.cpp:470 src/view/PreferencesPanel.cpp:490 msgid "Account " msgstr "" @@ -75,49 +70,49 @@ msgstr "" msgid "Account number" msgstr "" -#: src/view/StatsPanel.cpp:292 src/view/PreferencesPanel.cpp:59 +#: src/view/StatsPanel.cpp:304 src/view/PreferencesPanel.cpp:59 msgid "Accounts" msgstr "" -#: src/view/SearchPanel.cpp:87 +#: src/view/SearchPanel.cpp:86 msgid "Amount from" msgstr "" -#: src/view/SearchPanel.cpp:88 +#: src/view/SearchPanel.cpp:87 msgid "Amount to" msgstr "" -#: src/view/PreferencesPanel.cpp:408 src/view/PreferencesPanel.cpp:782 -#: src/view/AccountPanel.cpp:737 +#: src/view/AccountPanel.cpp:752 src/view/PreferencesPanel.cpp:422 +#: src/view/PreferencesPanel.cpp:797 msgid "Are you sure want to delete " msgstr "" -#: src/view/PreferencesPanel.cpp:657 src/view/grid/GridAccount.cpp:814 +#: src/view/PreferencesPanel.cpp:672 src/view/grid/GridAccount.cpp:825 msgid "Are you sure want to delete : \n" msgstr "" -#: src/view/PreferencesPanel.cpp:343 +#: src/view/PreferencesPanel.cpp:357 msgid "Ascending" msgstr "" -#: src/view/PreferencesPanel.cpp:267 +#: src/view/PreferencesPanel.cpp:281 msgid "Background color" msgstr "" -#: src/view/PreferencesPanel.cpp:187 +#: src/view/PreferencesPanel.cpp:195 msgid "Blocked" msgstr "" -#: src/view/UsersDialog.cpp:51 src/view/GenerateDialog.cpp:60 -#: src/view/PasswordDialog.cpp:56 +#: src/view/GenerateDialog.cpp:60 src/view/PasswordDialog.cpp:56 +#: src/view/UsersDialog.cpp:52 msgid "Cancel" msgstr "" -#: src/view/grid/GridAccount.cpp:1245 src/view/grid/GridAccount.cpp:1252 +#: src/view/grid/GridAccount.cpp:1256 src/view/grid/GridAccount.cpp:1263 msgid "Cannot group these operations" msgstr "" -#: src/view/grid/GridAccount.cpp:1371 src/view/grid/GridAccount.cpp:1377 +#: src/view/grid/GridAccount.cpp:1382 src/view/grid/GridAccount.cpp:1388 msgid "Cannot ungroup these operations" msgstr "" @@ -125,11 +120,11 @@ msgstr "" msgid "Categories" msgstr "" -#: src/view/SearchPanel.cpp:89 src/view/grid/GridAccount.cpp:64 +#: src/view/SearchPanel.cpp:88 src/view/grid/GridAccount.cpp:64 msgid "Category" msgstr "" -#: src/view/PreferencesPanel.cpp:677 src/view/PreferencesPanel.cpp:696 +#: src/view/PreferencesPanel.cpp:692 src/view/PreferencesPanel.cpp:711 msgid "Category " msgstr "" @@ -145,10 +140,6 @@ msgstr "" msgid "Change password" msgstr "" -#: src/view/ButtonPanel.cpp:73 -msgid "Change user" -msgstr "" - #: src/view/AccountPanel.cpp:122 msgid "Check mode" msgstr "" @@ -161,7 +152,7 @@ msgstr "" msgid "Confirm password " msgstr "" -#: src/view/StatsPanel.cpp:130 src/view/AccountPanel.cpp:116 +#: src/view/AccountPanel.cpp:116 src/view/StatsPanel.cpp:128 msgid "Cost repartition" msgstr "" @@ -169,11 +160,11 @@ msgstr "" msgid "Credit" msgstr "" -#: src/view/AccountPanel.cpp:202 +#: src/view/AccountPanel.cpp:215 msgid "Cur Credit" msgstr "" -#: src/view/AccountPanel.cpp:203 +#: src/view/AccountPanel.cpp:216 msgid "Cur Debit" msgstr "" @@ -197,38 +188,38 @@ msgstr "" msgid "Debit" msgstr "" -#: src/view/PreferencesPanel.cpp:186 +#: src/view/PreferencesPanel.cpp:194 msgid "Default" msgstr "" -#: src/view/PreferencesPanel.cpp:188 src/view/PreferencesPanel.cpp:270 -#: src/view/AccountPanel.cpp:596 +#: src/view/AccountPanel.cpp:611 src/view/PreferencesPanel.cpp:196 +#: src/view/PreferencesPanel.cpp:284 msgid "Delete" msgstr "" -#: src/view/PreferencesPanel.cpp:344 +#: src/view/PreferencesPanel.cpp:358 msgid "Descending" msgstr "" -#: src/view/SearchPanel.cpp:86 src/view/grid/GridAccount.cpp:64 +#: src/view/SearchPanel.cpp:85 src/view/grid/GridAccount.cpp:64 msgid "Description" msgstr "" -#: src/view/UsersDialog.cpp:88 src/view/UsersDialog.cpp:118 -#: src/view/SearchPanel.cpp:141 src/view/SearchPanel.cpp:151 -#: src/view/SearchPanel.cpp:165 src/view/SearchPanel.cpp:176 -#: src/view/PreferencesPanel.cpp:404 src/view/PreferencesPanel.cpp:456 -#: src/view/PreferencesPanel.cpp:476 src/view/PreferencesPanel.cpp:677 -#: src/view/PreferencesPanel.cpp:696 src/view/PreferencesPanel.cpp:727 -#: src/view/PreferencesPanel.cpp:733 src/view/PasswordDialog.cpp:72 -#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:733 -#: src/view/grid/GridAccount.cpp:1245 src/view/grid/GridAccount.cpp:1252 -#: src/view/grid/GridAccount.cpp:1371 src/view/grid/GridAccount.cpp:1377 -#: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:38 -#: src/model/Database.cpp:55 src/model/Database.cpp:95 -#: src/model/Database.cpp:102 src/model/Database.cpp:120 -#: src/model/Database.cpp:147 src/model/Database.cpp:155 -#: src/model/Database.cpp:176 +#: src/model/Database.cpp:38 src/model/Database.cpp:55 +#: src/model/Database.cpp:95 src/model/Database.cpp:102 +#: src/model/Database.cpp:120 src/model/Database.cpp:147 +#: src/model/Database.cpp:155 src/model/Database.cpp:176 +#: src/view/AccountPanel.cpp:748 src/view/PasswordDialog.cpp:72 +#: src/view/PasswordDialog.cpp:78 src/view/PreferencesPanel.cpp:418 +#: src/view/PreferencesPanel.cpp:470 src/view/PreferencesPanel.cpp:490 +#: src/view/PreferencesPanel.cpp:692 src/view/PreferencesPanel.cpp:711 +#: src/view/PreferencesPanel.cpp:742 src/view/PreferencesPanel.cpp:748 +#: src/view/SearchPanel.cpp:157 src/view/SearchPanel.cpp:167 +#: src/view/SearchPanel.cpp:181 src/view/SearchPanel.cpp:192 +#: src/view/UsersDialog.cpp:90 src/view/UsersDialog.cpp:120 +#: src/view/grid/GridAccount.cpp:1256 src/view/grid/GridAccount.cpp:1263 +#: src/view/grid/GridAccount.cpp:1382 src/view/grid/GridAccount.cpp:1388 +#: src/view/grid/wxGridCellFormulaEditor.cpp:69 msgid "Error" msgstr "" @@ -240,20 +231,20 @@ msgstr "" msgid "Final value" msgstr "" +#: src/controller/KissCount.cpp:359 src/model/Database.cpp:331 #: src/view/SearchPanel.cpp:76 src/view/grid/GridAccount.cpp:323 -#: src/model/Database.cpp:331 src/controller/KissCount.cpp:359 msgid "Fix" msgstr "" -#: src/view/PreferencesPanel.cpp:269 +#: src/view/PreferencesPanel.cpp:283 msgid "Font" msgstr "" -#: src/view/PreferencesPanel.cpp:268 +#: src/view/PreferencesPanel.cpp:282 msgid "Foreground color" msgstr "" -#: src/view/StatsPanel.cpp:62 +#: src/view/StatsPanel.cpp:64 msgid "From" msgstr "" @@ -261,7 +252,7 @@ msgstr "" msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:593 +#: src/view/AccountPanel.cpp:608 src/view/GenerateDialog.cpp:31 msgid "Generate month" msgstr "" @@ -281,19 +272,19 @@ msgstr "" msgid "Initial value" msgstr "" -#: src/view/SearchPanel.cpp:151 +#: src/view/SearchPanel.cpp:167 msgid "Invalid amount from" msgstr "" -#: src/view/SearchPanel.cpp:176 +#: src/view/SearchPanel.cpp:192 msgid "Invalid amount range" msgstr "" -#: src/view/SearchPanel.cpp:165 +#: src/view/SearchPanel.cpp:181 msgid "Invalid amount to" msgstr "" -#: src/view/SearchPanel.cpp:141 +#: src/view/SearchPanel.cpp:157 msgid "Invalid date range" msgstr "" @@ -301,7 +292,7 @@ msgstr "" msgid "Invalid formula !" msgstr "" -#: src/view/PreferencesPanel.cpp:727 +#: src/view/PreferencesPanel.cpp:742 msgid "Invalid name" msgstr "" @@ -309,19 +300,19 @@ msgstr "" msgid "Invalid old password" msgstr "" -#: src/view/UsersDialog.cpp:88 +#: src/view/UsersDialog.cpp:90 msgid "Invalid password" msgstr "" -#: src/view/StatsPanel.cpp:346 +#: src/view/StatsPanel.cpp:358 msgid "Invalide date range" msgstr "" -#: src/view/PreferencesPanel.cpp:404 +#: src/view/PreferencesPanel.cpp:418 msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:733 +#: src/view/AccountPanel.cpp:748 msgid "It must be at least one month !" msgstr "" @@ -329,8 +320,8 @@ msgstr "" msgid "Kill me" msgstr "" -#: src/view/StatsPanel.cpp:346 src/view/PreferencesPanel.cpp:767 -#: src/view/PreferencesPanel.cpp:770 +#: src/view/StatsPanel.cpp:358 src/view/PreferencesPanel.cpp:782 +#: src/view/PreferencesPanel.cpp:785 msgid "KissCount" msgstr "" @@ -338,24 +329,24 @@ msgstr "" msgid "Language" msgstr "" -#: src/view/PreferencesPanel.cpp:770 +#: src/view/PreferencesPanel.cpp:785 msgid "Language not changed" msgstr "" -#: src/view/PreferencesPanel.cpp:767 +#: src/view/PreferencesPanel.cpp:782 msgid "Language successfully changed, please go to another panel" msgstr "" -#: src/view/PreferencesPanel.cpp:71 src/view/PreferencesPanel.cpp:184 -#: src/view/PreferencesPanel.cpp:266 +#: src/view/PreferencesPanel.cpp:71 src/view/PreferencesPanel.cpp:192 +#: src/view/PreferencesPanel.cpp:280 msgid "Name" msgstr "" -#: src/view/PreferencesPanel.cpp:739 +#: src/view/PreferencesPanel.cpp:754 msgid "Name changed" msgstr "" -#: src/view/UsersDialog.cpp:52 src/view/UsersDialog.cpp:107 +#: src/view/UsersDialog.cpp:53 src/view/UsersDialog.cpp:109 msgid "New User" msgstr "" @@ -369,7 +360,7 @@ msgid "" "\n" msgstr "" -#: src/view/SearchPanel.cpp:231 +#: src/view/SearchPanel.cpp:247 msgid "No entry found" msgstr "" @@ -381,12 +372,12 @@ msgstr "" msgid "Not checked" msgstr "" -#: src/view/PreferencesPanel.cpp:185 +#: src/view/PreferencesPanel.cpp:193 msgid "Number" msgstr "" -#: src/view/UsersDialog.cpp:50 src/view/GenerateDialog.cpp:59 -#: src/view/PasswordDialog.cpp:55 +#: src/view/GenerateDialog.cpp:59 src/view/PasswordDialog.cpp:55 +#: src/view/UsersDialog.cpp:51 msgid "OK" msgstr "" @@ -402,7 +393,7 @@ msgstr "" msgid "Operation order" msgstr "" -#: src/view/ButtonPanel.cpp:69 +#: src/view/AccountPanel.cpp:175 src/view/SearchPanel.cpp:89 msgid "Operations" msgstr "" @@ -410,7 +401,7 @@ msgstr "" msgid "Other" msgstr "" -#: src/view/UsersDialog.cpp:43 +#: src/view/UsersDialog.cpp:44 msgid "Password " msgstr "" @@ -418,7 +409,7 @@ msgstr "" msgid "Password changed" msgstr "" -#: src/view/ButtonPanel.cpp:105 +#: src/view/wxUI.cpp:243 msgid "" "Personal accounting software\n" "\n" @@ -433,8 +424,8 @@ msgstr "" msgid "Please retype new password" msgstr "" -#: src/view/PreferencesPanel.cpp:741 src/view/PreferencesPanel.cpp:775 -#: src/view/ButtonPanel.cpp:72 +#: src/view/PreferencesPanel.cpp:180 src/view/PreferencesPanel.cpp:756 +#: src/view/PreferencesPanel.cpp:790 msgid "Preferences" msgstr "" @@ -442,24 +433,20 @@ msgstr "" msgid "Query failed !\n" msgstr "" -#: src/view/ButtonPanel.cpp:75 -msgid "Quit" -msgstr "" - -#: src/view/ButtonPanel.cpp:112 +#: src/view/wxUI.cpp:250 msgid "Quit KissCount ?" msgstr "" -#: src/view/AccountPanel.cpp:204 +#: src/view/AccountPanel.cpp:217 msgid "Remains" msgstr "" -#: src/view/SearchPanel.cpp:84 src/view/SearchPanel.cpp:242 -#: src/view/ButtonPanel.cpp:71 +#: src/view/SearchPanel.cpp:83 src/view/SearchPanel.cpp:142 +#: src/view/SearchPanel.cpp:258 msgid "Search" msgstr "" -#: src/view/StatsPanel.cpp:122 src/view/AccountPanel.cpp:90 +#: src/view/AccountPanel.cpp:90 src/view/StatsPanel.cpp:120 msgid "Serie 1" msgstr "" @@ -467,7 +454,7 @@ msgstr "" msgid "Shared with" msgstr "" -#: src/view/StatsPanel.cpp:327 src/view/ButtonPanel.cpp:70 +#: src/view/StatsPanel.cpp:160 src/view/StatsPanel.cpp:339 msgid "Statistics" msgstr "" @@ -479,11 +466,11 @@ msgstr "" msgid "To " msgstr "" -#: src/view/AccountPanel.cpp:186 +#: src/view/AccountPanel.cpp:199 msgid "Total Credit" msgstr "" -#: src/view/AccountPanel.cpp:187 +#: src/view/AccountPanel.cpp:200 msgid "Total Debit" msgstr "" @@ -512,8 +499,8 @@ msgstr "" msgid "User" msgstr "" -#: src/view/UsersDialog.cpp:38 src/view/UsersDialog.cpp:118 -#: src/view/PreferencesPanel.cpp:733 +#: src/view/PreferencesPanel.cpp:748 src/view/UsersDialog.cpp:39 +#: src/view/UsersDialog.cpp:120 msgid "User " msgstr "" @@ -521,58 +508,58 @@ msgstr "" msgid "Users" msgstr "" -#: src/view/grid/GridAccount.cpp:1022 +#: src/view/grid/GridAccount.cpp:1033 msgid "Warning" msgstr "" -#: src/view/grid/GridAccount.cpp:1022 +#: src/view/grid/GridAccount.cpp:1033 msgid "You made a debit on a blocked account" msgstr "" -#: src/view/wxUI.cpp:110 +#: src/view/wxUI.cpp:123 msgid "april" msgstr "" -#: src/view/wxUI.cpp:114 +#: src/view/wxUI.cpp:127 msgid "august" msgstr "" -#: src/view/wxUI.cpp:118 +#: src/view/wxUI.cpp:131 msgid "december" msgstr "" -#: src/view/wxUI.cpp:108 +#: src/view/wxUI.cpp:121 msgid "february" msgstr "" -#: src/view/wxUI.cpp:107 +#: src/view/wxUI.cpp:120 msgid "january" msgstr "" -#: src/view/wxUI.cpp:113 +#: src/view/wxUI.cpp:126 msgid "july" msgstr "" -#: src/view/wxUI.cpp:112 +#: src/view/wxUI.cpp:125 msgid "june" msgstr "" -#: src/view/wxUI.cpp:109 +#: src/view/wxUI.cpp:122 msgid "march" msgstr "" -#: src/view/wxUI.cpp:111 +#: src/view/wxUI.cpp:124 msgid "may" msgstr "" -#: src/view/wxUI.cpp:117 +#: src/view/wxUI.cpp:130 msgid "november" msgstr "" -#: src/view/wxUI.cpp:116 +#: src/view/wxUI.cpp:129 msgid "october" msgstr "" -#: src/view/wxUI.cpp:115 +#: src/view/wxUI.cpp:128 msgid "september" msgstr "" diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index 0da2a31..8cb6f63 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -29,7 +29,7 @@ #include -#define APP_VERSION "v0.2 dev" +#define APP_VERSION "v0.2_dev" class wxUI; class Database; From 9c423efd834f42fa8c9acec1e4e3cfe581005d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 29 Jan 2011 11:41:14 +0100 Subject: [PATCH 18/72] Fix a bug in search engine and enhance grouped operations displays --- ChangeLog | 4 +++- src/model/Database.cpp | 6 ++++-- src/view/grid/GridAccount.cpp | 5 +++-- src/view/grid/GridAccount.h | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 422cb9e..1455602 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,10 @@ -v0.2_dev (23/01/2011) +v0.2_dev (29/01/2011) ** User ** Better use of sizers (so better interface!) No further problems with scrollbar in AccountPanel when there is a lot of operations + Better fit of interface when displaying grouped operations ** Dev ** Use a factory to create panels (prepare for plug-in) @@ -15,3 +16,4 @@ v0.2_dev (23/01/2011) Bad year range check Unordered accounts (makes account selection points to bad indexes on account graph) Bug in account creation (readonly fields) + Bug in search bad computation of month with start_date and end_date diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 3b6b754..ea9b9d0 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1291,7 +1291,8 @@ std::vector* Database::Search(User* user, wxString* description, wxDa if (firstCond) req += wxT(" AND ") ; else firstCond = true; req += wxT("("); req += wxT("year >= ") + yearFrom ; - req += wxT(" AND (month > '") + monthFrom + wxT("' OR (month == '") + monthFrom + wxT("' AND day >= '") + dayFrom + wxT("'))"); + req += wxT(" AND (month > '") + monthFrom + wxT("' OR (month == '") + monthFrom + wxT("' AND day >= '") + dayFrom + wxT("')"); + req += wxT(" OR (month < '") + monthFrom + wxT("' AND year > '") + yearFrom + wxT("'))"); req += wxT(")"); } @@ -1300,7 +1301,8 @@ std::vector* Database::Search(User* user, wxString* description, wxDa if (firstCond) req += wxT(" AND ") ; else firstCond = true; req += wxT("("); req += wxT("year <= ") + yearTo ; - req += wxT(" AND (month < '") + monthTo + wxT("' OR (month == '") + monthTo + wxT("' AND day <= '") + dayTo + wxT("'))"); + req += wxT(" AND (month < '") + monthTo + wxT("' OR (month == '") + monthTo + wxT("' AND day <= '") + dayTo + wxT("')"); + req += wxT(" OR (month > '") + monthTo + wxT("' AND year < '") + yearTo + wxT("'))"); req += wxT(")"); } diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 95595f9..832ba9f 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -40,8 +40,8 @@ EVT_GRID_CELL_LEFT_CLICK(GridAccount::OnCellLeftClick ) END_EVENT_TABLE() enum {GRID_ID}; -GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id) : wxGrid(parent, id), _fixCosts(0), _week1(0), - _week2(0), _week3(0), _week4(0), _kiss(kiss), +GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id) : wxGrid(parent, id), _fixCosts(0), _week1(0), + _week2(0), _week3(0), _week4(0), _parent(parent), _kiss(kiss), _loadOperations(false), _curMonth(0), _curYear(0) { @@ -676,6 +676,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) ComputeWeeks(); inModification = false; + _parent->Fit(); return; } diff --git a/src/view/grid/GridAccount.h b/src/view/grid/GridAccount.h index c943922..c1856a8 100644 --- a/src/view/grid/GridAccount.h +++ b/src/view/grid/GridAccount.h @@ -61,6 +61,7 @@ public: std::vector _displayedOperations; private: + wxWindow* _parent; KissCount* _kiss; bool _displayLines; wxString* _categories, *_accounts; From e477e3a70c13c6ad97c5288363aef1eead30bab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 29 Jan 2011 12:02:49 +0100 Subject: [PATCH 19/72] Grouped operations have bad month/year in SearchPanel --- ChangeLog | 3 ++- src/view/SearchPanel.cpp | 1 + src/view/grid/GridAccount.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a185b3d..62f9967 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ v0.2_dev (29/01/2011) ** User ** Better use of sizers (so better interface!) - No further problems with scrollbar in AccountPanel when there is a lot of operations + No further problems with scrollbar in AccountPanel/SearchPanel when there is a lot of operations Better fit of interface when displaying grouped operations ** Dev ** @@ -17,3 +17,4 @@ v0.2_dev (29/01/2011) Unordered accounts (makes account selection points to bad indexes on account graph) Bug in account creation (readonly fields) Bug in search bad computation of month with start_date and end_date + Grouped operations have bad month/year in SearchPanel diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 8156832..a64c737 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -116,6 +116,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent Fit(); SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); + SetMaxSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); SetScrollbars(10, 10, 100/10, 100/10); } diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 832ba9f..575e5c3 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -664,7 +664,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) for (i=1, it=op.childs.begin(); it!=op.childs.end(); it++, i++) { op2 = GetOperation(*it); - InsertOperationWithWeek(user, op2, row+i, op2.fix_cost, _curMonth, _curYear); + InsertOperationWithWeek(user, op2, row+i, op2.fix_cost, op2.month, op2.year); } } else From 998541279017965d8a49a1f0dadc66048023eace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 29 Jan 2011 12:24:07 +0100 Subject: [PATCH 20/72] Categories fonts not updated for new category New category had read only fields in PreferencesPanel Scrollbar for PreferencesPanel --- ChangeLog | 4 +++- src/controller/KissCount.cpp | 1 + src/view/PreferencesPanel.cpp | 19 ++++++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62f9967..766b41c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ v0.2_dev (29/01/2011) ** User ** Better use of sizers (so better interface!) - No further problems with scrollbar in AccountPanel/SearchPanel when there is a lot of operations + No further problems with scrollbar in AccountPanel/SearchPanel/PreferencesPanel when there is a lot of operations Better fit of interface when displaying grouped operations ** Dev ** @@ -18,3 +18,5 @@ v0.2_dev (29/01/2011) Bug in account creation (readonly fields) Bug in search bad computation of month with start_date and end_date Grouped operations have bad month/year in SearchPanel + Categories fonts not updated for new category --> crash + New category had read only fields in PreferencesPanel diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 4113bc4..3f97e29 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -230,6 +230,7 @@ wxString KissCount::AddCategory(Category& category) category.id = id; _user->_categories.push_back(category); + _user->_categoriesFonts.push_back(ExtractFont(wxT(""))); return id; } diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 508076f..1829390 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -52,6 +52,7 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(ki wxStaticBoxSizer * staticBoxSizer; std::list users; std::list::iterator it; + wxRect rect = wxDisplay().GetGeometry(); SetSizer(vbox); @@ -159,7 +160,10 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(ki vbox->Add(hbox2, 0, wxALL, 10); Fit(); - SetMinSize(GetSize()); + + SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); + SetMaxSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); + SetScrollbars(10, 10, 100/10, 100/10); } KissPanel* PreferencesPanel::CreatePanel() @@ -437,7 +441,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) _accountsGrid->SetCellValue(0, ACCOUNT_DEFAULT, wxT("1")); } - _wxUI->Layout(); + Fit(); inModification = false; _wxUI->NeedReload(); return; @@ -505,7 +509,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) AddAccount(row+1, new_account); } - _wxUI->Layout(); + Fit(); _wxUI->NeedReload(); inModification = false; } @@ -680,7 +684,7 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) _kiss->DeleteCategory(user->_categories[row]); } - _wxUI->Layout(); + Fit(); _wxUI->NeedReload(); inModification = false; return; @@ -716,12 +720,17 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) _kiss->AddCategory(new_cat); AddCategory(row, new_cat); + _categoriesGrid->SetReadOnly(row, CATEGORY_BACKGROUND_COLOR, false); + _categoriesGrid->SetReadOnly(row, CATEGORY_FOREGROUND_COLOR, false); + _categoriesGrid->SetReadOnly(row, CATEGORY_FONT, false); + _categoriesGrid->SetReadOnly(row, CATEGORY_DELETE, false); + new_cat.id = wxT("0"); _categoriesGrid->AppendRows(); AddCategory(++row, new_cat); } - _wxUI->Layout(); + Fit(); _wxUI->NeedReload(); inModification = false; From 8a22ed135a6ed09bd0bd3776324366918f0e4988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 29 Jan 2011 13:04:15 +0100 Subject: [PATCH 21/72] Update Copyright --- ChangeLog | 1 + src/ParseExp.h | 2 +- src/controller/KissCount.h | 2 +- src/main.h | 2 +- src/model/Account.h | 2 +- src/model/Category.h | 2 +- src/model/Database.h | 2 +- src/model/Operation.h | 2 +- src/model/User.h | 2 +- src/model/model.h | 2 +- src/sha1.h | 2 +- src/view/AccountPanel.h | 2 +- src/view/GenerateDialog.h | 2 +- src/view/KissPanel.h | 2 +- src/view/PasswordDialog.h | 2 +- src/view/PreferencesPanel.h | 2 +- src/view/SearchPanel.h | 2 +- src/view/StatsPanel.h | 2 +- src/view/SupportedLanguages.h | 2 +- src/view/UsersDialog.h | 2 +- src/view/grid/CalendarEditor.h | 2 +- src/view/grid/GridAccount.h | 2 +- src/view/grid/wxGridCellBitmapRenderer.h | 2 +- src/view/grid/wxGridCellButtonEditor.h | 2 +- src/view/grid/wxGridCellButtonRenderer.h | 2 +- src/view/grid/wxGridCellFormulaEditor.h | 2 +- src/view/grid/wxGridCellTabStringRenderer.h | 2 +- src/view/grid/wxGridCellTreeButtonEditor.h | 2 +- src/view/grid/wxGridCellTreeButtonRenderer.h | 2 +- src/view/view.h | 2 +- src/view/wxGridCellStarEditor.h | 2 +- src/view/wxUI.cpp | 2 +- src/view/wxUI.h | 2 +- 33 files changed, 33 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 766b41c..fe146fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ v0.2_dev (29/01/2011) ** Dev ** Use a factory to create panels (prepare for plug-in) Better cross compilation support (Makefile and package.sh) + Update Copyright ** Bugs ** Bug on GenerateMonth with different years diff --git a/src/ParseExp.h b/src/ParseExp.h index 00c09c5..41bb170 100644 --- a/src/ParseExp.h +++ b/src/ParseExp.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index 8cb6f63..137a5d9 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/main.h b/src/main.h index 7563d00..68b9370 100644 --- a/src/main.h +++ b/src/main.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/model/Account.h b/src/model/Account.h index 7c56b71..ce94877 100644 --- a/src/model/Account.h +++ b/src/model/Account.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/model/Category.h b/src/model/Category.h index af2f29a..43d6a78 100644 --- a/src/model/Category.h +++ b/src/model/Category.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/model/Database.h b/src/model/Database.h index 0a2d090..aa23d3f 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/model/Operation.h b/src/model/Operation.h index 7fe7202..0328bb2 100644 --- a/src/model/Operation.h +++ b/src/model/Operation.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/model/User.h b/src/model/User.h index 509186d..e24b14b 100644 --- a/src/model/User.h +++ b/src/model/User.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/model/model.h b/src/model/model.h index 9b1ab4e..e3dcf33 100644 --- a/src/model/model.h +++ b/src/model/model.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/sha1.h b/src/sha1.h index c99cd9f..7448b70 100644 --- a/src/sha1.h +++ b/src/sha1.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/AccountPanel.h b/src/view/AccountPanel.h index 4be0bca..62b7fa1 100644 --- a/src/view/AccountPanel.h +++ b/src/view/AccountPanel.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/GenerateDialog.h b/src/view/GenerateDialog.h index 8187ddc..f3c2d4a 100644 --- a/src/view/GenerateDialog.h +++ b/src/view/GenerateDialog.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/KissPanel.h b/src/view/KissPanel.h index ed139a1..339638b 100644 --- a/src/view/KissPanel.h +++ b/src/view/KissPanel.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/PasswordDialog.h b/src/view/PasswordDialog.h index e52d468..cbd1a7d 100644 --- a/src/view/PasswordDialog.h +++ b/src/view/PasswordDialog.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/PreferencesPanel.h b/src/view/PreferencesPanel.h index 1731e2a..e7632bc 100644 --- a/src/view/PreferencesPanel.h +++ b/src/view/PreferencesPanel.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/SearchPanel.h b/src/view/SearchPanel.h index 2872d4a..554d4b7 100644 --- a/src/view/SearchPanel.h +++ b/src/view/SearchPanel.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/StatsPanel.h b/src/view/StatsPanel.h index 702212b..e429d3d 100644 --- a/src/view/StatsPanel.h +++ b/src/view/StatsPanel.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/SupportedLanguages.h b/src/view/SupportedLanguages.h index 44019c0..c6e70a1 100644 --- a/src/view/SupportedLanguages.h +++ b/src/view/SupportedLanguages.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/UsersDialog.h b/src/view/UsersDialog.h index 4799826..86ed765 100644 --- a/src/view/UsersDialog.h +++ b/src/view/UsersDialog.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/CalendarEditor.h b/src/view/grid/CalendarEditor.h index 2bd33c0..544ef98 100644 --- a/src/view/grid/CalendarEditor.h +++ b/src/view/grid/CalendarEditor.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/GridAccount.h b/src/view/grid/GridAccount.h index c1856a8..cd875cf 100644 --- a/src/view/grid/GridAccount.h +++ b/src/view/grid/GridAccount.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellBitmapRenderer.h b/src/view/grid/wxGridCellBitmapRenderer.h index d0f97ee..782c9ce 100644 --- a/src/view/grid/wxGridCellBitmapRenderer.h +++ b/src/view/grid/wxGridCellBitmapRenderer.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellButtonEditor.h b/src/view/grid/wxGridCellButtonEditor.h index d57f841..21c6b6b 100644 --- a/src/view/grid/wxGridCellButtonEditor.h +++ b/src/view/grid/wxGridCellButtonEditor.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellButtonRenderer.h b/src/view/grid/wxGridCellButtonRenderer.h index 32ef204..4a41a23 100644 --- a/src/view/grid/wxGridCellButtonRenderer.h +++ b/src/view/grid/wxGridCellButtonRenderer.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellFormulaEditor.h b/src/view/grid/wxGridCellFormulaEditor.h index 636a677..50ee5aa 100644 --- a/src/view/grid/wxGridCellFormulaEditor.h +++ b/src/view/grid/wxGridCellFormulaEditor.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellTabStringRenderer.h b/src/view/grid/wxGridCellTabStringRenderer.h index d57ecab..53d7715 100644 --- a/src/view/grid/wxGridCellTabStringRenderer.h +++ b/src/view/grid/wxGridCellTabStringRenderer.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellTreeButtonEditor.h b/src/view/grid/wxGridCellTreeButtonEditor.h index 992008e..3109f18 100644 --- a/src/view/grid/wxGridCellTreeButtonEditor.h +++ b/src/view/grid/wxGridCellTreeButtonEditor.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellTreeButtonRenderer.h b/src/view/grid/wxGridCellTreeButtonRenderer.h index 13f29e8..33c4f6a 100644 --- a/src/view/grid/wxGridCellTreeButtonRenderer.h +++ b/src/view/grid/wxGridCellTreeButtonRenderer.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/view.h b/src/view/view.h index f935997..2fa167a 100644 --- a/src/view/view.h +++ b/src/view/view.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/wxGridCellStarEditor.h b/src/view/wxGridCellStarEditor.h index 1937348..9709c4e 100644 --- a/src/view/wxGridCellStarEditor.h +++ b/src/view/wxGridCellStarEditor.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 142827e..128f988 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -240,7 +240,7 @@ void wxUI::ChangeUser() void wxUI::OnButtonAbout(wxCommandEvent& event) { - wxMessageBox( _("Personal accounting software\n\nhttp://indefero.soutade.fr/p/kisscount/\n\nLicenced under GNU GPL v3\n\nCopyright (C) 2010 Grégory Soutadé"), + wxMessageBox( _("Personal accounting software\n\nhttp://indefero.soutade.fr/p/kisscount/\n\nLicenced under GNU GPL v3\n\nCopyright (C) 2010-2011 Grégory Soutadé"), wxT("KissCount " APP_VERSION "\n\n"), wxOK | wxICON_INFORMATION, this ); } diff --git a/src/view/wxUI.h b/src/view/wxUI.h index 9522c70..fbb0a29 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. From a2990ede8a42853db8421e2a342b6944371ed903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 29 Jan 2011 16:43:00 +0100 Subject: [PATCH 22/72] Forgot to remove font when deleting category --- src/controller/KissCount.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 3f97e29..7cf3545 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -256,6 +256,7 @@ void KissCount::DeleteCategory(Category& category) if (_user->_categories[i].id == category.id) { _user->_categories.erase(_user->_categories.begin()+i); + _user->_categoriesFonts.erase(_user->_categoriesFonts.begin()+i); break; } } From 1151daf8613bf464cf340306bf9d1056e8d31306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 29 Jan 2011 20:53:44 +0100 Subject: [PATCH 23/72] Show stats for current month even if next month has not been generated Bug : Update all panels after generating/deleting month --- ChangeLog | 2 ++ src/controller/KissCount.cpp | 5 +++++ src/controller/KissCount.h | 2 ++ src/model/Database.cpp | 32 ++++++++++++++++++++++++++++++++ src/model/Database.h | 1 + src/view/AccountPanel.cpp | 2 ++ src/view/StatsPanel.cpp | 29 ++++++++++++++++++++++++----- 7 files changed, 68 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe146fa..aaeb6b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ v0.2_dev (29/01/2011) Better use of sizers (so better interface!) No further problems with scrollbar in AccountPanel/SearchPanel/PreferencesPanel when there is a lot of operations Better fit of interface when displaying grouped operations + Show stats for current month even if next month has not been generated ** Dev ** Use a factory to create panels (prepare for plug-in) @@ -21,3 +22,4 @@ v0.2_dev (29/01/2011) Grouped operations have bad month/year in SearchPanel Categories fonts not updated for new category --> crash New category had read only fields in PreferencesPanel + Update all panels after generating/deleting month diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 7cf3545..47df870 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -93,6 +93,11 @@ double KissCount::GetAccountAmount(const wxString& id, int month, int year) return _db->GetAccountAmount(id, month, year); } +double KissCount::CalcAccountAmount(const wxString& id, int month, int year, bool* had_values) +{ + return _db->CalcAccountAmount(id, month, year, had_values); +} + void KissCount::UpdateOperation(Operation& op) { // Unlink diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index 137a5d9..9f60ee6 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -60,6 +60,8 @@ public: double GetAccountAmount(const wxString& id, int month, int year); void SetAccountAmount(int month, int year, const wxString& accountId, double value); + double CalcAccountAmount(const wxString& id, int month, int year, bool* had_values); + wxString AddAccount(Account& ac); void UpdateAccount(Account& ac); void DeleteAccount(Account& ac); diff --git a/src/model/Database.cpp b/src/model/Database.cpp index ea9b9d0..1a81dac 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -429,6 +429,38 @@ double Database::GetAccountAmount(const wxString& id, int month, int year) return res; } +double Database::CalcAccountAmount(const wxString& id, int month, int year, bool* had_values) +{ + wxSQLite3ResultSet set; + wxString req; + double res; + + req = wxT("SELECT SUM(id) AS id, SUM(amount) AS amount FROM operation WHERE account='") + id ; + req += wxT("' AND month='") + wxString::Format(wxT("%d"), month); + req += wxT("' AND year='") + wxString::Format(wxT("%d"), year); + req += wxT("'"); + req += wxT(" AND meta='0'"); + + EXECUTE_SQL_QUERY(req , set, 0.0); + + if (set.NextRow()) + { + res = set.GetDouble(wxT("amount")); + if (had_values) + *had_values = set.GetInt(wxT("id")) > 0 ; + } + else + { + res=0.0; + if (had_values) + *had_values = false; + } + + set.Finalize(); + + return res; +} + bool Database::GetOperation(const wxString& id, Operation* op) { wxSQLite3ResultSet set; diff --git a/src/model/Database.h b/src/model/Database.h index aa23d3f..bced1e4 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -62,6 +62,7 @@ public: double GetAccountAmount(const wxString& id, int month, int year); void SetAccountAmount(int month, int year, const wxString& accountId, double amount); + double CalcAccountAmount(const wxString& id, int month, int year, bool* had_values); wxString AddAccount(User* user, Account& ac); void UpdateAccount(Account& ac); diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 5963e7f..9edd09c 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -784,6 +784,7 @@ void AccountPanel::OnMenuDelete(wxCommandEvent& event) month = ops[year][0]; ShowMonth(month, year); } + _wxUI->NeedReload(); } void AccountPanel::GenerateMonth(int month, int year) @@ -856,6 +857,7 @@ void AccountPanel::GenerateMonth(int month, int year) _tree.SelectItem(node, true); ShowMonth(month, year); + _wxUI->NeedReload(); } void AccountPanel::OnShow(wxShowEvent& event) diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 0a5a650..e9c32e2 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -174,6 +174,7 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT wxString value; User* user = _kiss->GetUser(); wxDateTime date; + bool failed; if (_chart) { @@ -256,18 +257,36 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT } size = accountAmounts[accountIt->id].size(); - amounts = new double[size*12*2]; + amounts = new double[size*13*2]; size = 0; for(a = 0, accountYearIt = accountAmounts[accountIt->id].begin(); accountYearIt != accountAmounts[accountIt->id].end(); accountYearIt++, a++) { - for(b = 0; b<12; b++) + for(b = 0; b<=12; b++) { - if (!accountAmounts[accountIt->id][accountYearIt->first].count(b)) - continue; amounts[size*2+0] = a*12+b; - amounts[size*2+1] = accountAmounts[accountIt->id][accountYearIt->first][b]; + if (!accountAmounts[accountIt->id][accountYearIt->first].count(b)) + { + /* + If previously afiled, continue to avoid to set + account to 0 (only for display) + */ + if (!b || failed) continue; + /* + Compute cur month value (if there are operations) + as next month value + */ + amounts[size*2+1] = + accountAmounts[accountIt->id][accountYearIt->first][b-1] + + _kiss->CalcAccountAmount(accountIt->id, b-1, accountYearIt->first, NULL); + failed = true; + } + else + { + amounts[size*2+1] = accountAmounts[accountIt->id][accountYearIt->first][b]; + failed = false; + } size++; } } From bd4809042bad4f09728916420f4be78c684b1534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 29 Jan 2011 21:01:01 +0100 Subject: [PATCH 24/72] Use a sizer for menu generate --- src/view/GenerateDialog.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/view/GenerateDialog.cpp b/src/view/GenerateDialog.cpp index d1fb549..235cf6f 100644 --- a/src/view/GenerateDialog.cpp +++ b/src/view/GenerateDialog.cpp @@ -38,10 +38,11 @@ GenerateDialog::GenerateDialog(KissCount* kiss, wxUI *parent, int month, int yea wxCommandEvent event; std::vector::iterator monthIt; - curDate.SetToCurrent(); - + wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); gridBagSizer = new wxGridBagSizer(4, 5); + curDate.SetToCurrent(); + label = new wxStaticText(this, wxID_ANY, _("From ")); gridBagSizer->Add(label, wxGBPosition(0, 0)); _yearFrom = new wxChoice(this, YEAR_FROM_ID); @@ -133,9 +134,10 @@ GenerateDialog::GenerateDialog(KissCount* kiss, wxUI *parent, int month, int yea } } - SetSizer(gridBagSizer); + hbox->Add(gridBagSizer, 0, wxGROW|wxALL, 10); + SetSizer(hbox); - Layout(); + Fit(); Center(); } From 0c344a0273b6c09049b21beb63c8cf41cd334960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 5 Feb 2011 21:02:03 +0100 Subject: [PATCH 25/72] Add Windows specific code --- Makefile | 10 ++ init.sql | 0 ressources/po/kisscount.pot | 196 +++++++++++++++++----------------- src/sha1.cpp | 28 ++++- src/view/AccountPanel.cpp | 2 +- src/view/PreferencesPanel.cpp | 4 +- src/view/SearchPanel.cpp | 2 +- src/view/StatsPanel.cpp | 2 +- src/view/grid/GridAccount.cpp | 53 ++++----- src/view/grid/GridAccount.h | 2 - src/view/view.h | 18 ++-- src/view/wxUI.cpp | 8 +- src/view/wxUI.h | 3 + 13 files changed, 185 insertions(+), 143 deletions(-) mode change 100644 => 100755 init.sql diff --git a/Makefile b/Makefile index d110e41..092e224 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,13 @@ CXXFLAGS+=-I./lib/wxsqlite3-1.9.9/include CXXFLAGS+=-I./lib/freechart/include LDFLAGS+=`wx-config --libs` +ifdef WIN32 +LDFLAGS+=-L./lib/wxsqlite3-1.9.9/lib/ -lwxcode_msw_wxsqlite3-2.8 +LDFLAGS+=-L./lib/freechart/lib -lwxcode_msw_freechart-2.8 +else LDFLAGS+=-L./lib/wxsqlite3-1.9.9/lib/ -lwxcode_gtk2u_wxsqlite3-2.8 LDFLAGS+=-L./lib/freechart/lib -lwxcode_gtk2u_freechart-2.8 +endif CXX=$(PREFIX)g++ @@ -37,5 +42,10 @@ kc: $(OBJS) generate_locales: ./tools/generate_locales.sh +ifdef WIN32 +package: + ./tools/package_win32.sh +else package: ./tools/package.sh +endif \ No newline at end of file diff --git a/init.sql b/init.sql old mode 100644 new mode 100755 diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 078a06e..78c114b 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-01-26 11:41+0100\n" +"POT-Creation-Date: 2011-02-05 20:46+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,17 +16,17 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/view/StatsPanel.cpp:339 src/view/PreferencesPanel.cpp:790 +#: src/view/StatsPanel.cpp:358 src/view/PreferencesPanel.cpp:799 msgid " - " msgstr "" -#: src/view/PreferencesPanel.cpp:470 src/view/PreferencesPanel.cpp:490 -#: src/view/PreferencesPanel.cpp:692 src/view/PreferencesPanel.cpp:711 -#: src/view/PreferencesPanel.cpp:748 src/view/UsersDialog.cpp:120 +#: src/view/PreferencesPanel.cpp:474 src/view/PreferencesPanel.cpp:494 +#: src/view/PreferencesPanel.cpp:696 src/view/PreferencesPanel.cpp:715 +#: src/view/PreferencesPanel.cpp:757 src/view/UsersDialog.cpp:120 msgid " already exists" msgstr "" -#: src/view/SearchPanel.cpp:242 +#: src/view/SearchPanel.cpp:243 msgid " entries found" msgstr "" @@ -38,7 +38,7 @@ msgstr "" msgid " operations ?" msgstr "" -#: src/view/PreferencesPanel.cpp:797 +#: src/view/PreferencesPanel.cpp:806 msgid " profil ?" msgstr "" @@ -46,19 +46,19 @@ msgstr "" msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "" -#: src/view/SearchPanel.cpp:244 +#: src/view/SearchPanel.cpp:245 msgid "1 entry found" msgstr "" -#: src/view/SearchPanel.cpp:90 src/view/grid/GridAccount.cpp:64 +#: src/view/SearchPanel.cpp:90 src/view/grid/GridAccount.cpp:67 msgid "Account" msgstr "" -#: src/view/PreferencesPanel.cpp:470 src/view/PreferencesPanel.cpp:490 +#: src/view/PreferencesPanel.cpp:474 src/view/PreferencesPanel.cpp:494 msgid "Account " msgstr "" -#: src/controller/KissCount.cpp:343 +#: src/controller/KissCount.cpp:350 msgid "Account 1" msgstr "" @@ -70,7 +70,7 @@ msgstr "" msgid "Account number" msgstr "" -#: src/view/StatsPanel.cpp:304 src/view/PreferencesPanel.cpp:59 +#: src/view/StatsPanel.cpp:323 src/view/PreferencesPanel.cpp:60 msgid "Accounts" msgstr "" @@ -82,57 +82,57 @@ msgstr "" msgid "Amount to" msgstr "" -#: src/view/AccountPanel.cpp:752 src/view/PreferencesPanel.cpp:422 -#: src/view/PreferencesPanel.cpp:797 +#: src/view/AccountPanel.cpp:752 src/view/PreferencesPanel.cpp:426 +#: src/view/PreferencesPanel.cpp:806 msgid "Are you sure want to delete " msgstr "" -#: src/view/PreferencesPanel.cpp:672 src/view/grid/GridAccount.cpp:825 +#: src/view/PreferencesPanel.cpp:676 src/view/grid/GridAccount.cpp:829 msgid "Are you sure want to delete : \n" msgstr "" -#: src/view/PreferencesPanel.cpp:357 +#: src/view/PreferencesPanel.cpp:361 msgid "Ascending" msgstr "" -#: src/view/PreferencesPanel.cpp:281 +#: src/view/PreferencesPanel.cpp:285 msgid "Background color" msgstr "" -#: src/view/PreferencesPanel.cpp:195 +#: src/view/PreferencesPanel.cpp:199 msgid "Blocked" msgstr "" -#: src/view/GenerateDialog.cpp:60 src/view/PasswordDialog.cpp:56 +#: src/view/GenerateDialog.cpp:61 src/view/PasswordDialog.cpp:56 #: src/view/UsersDialog.cpp:52 msgid "Cancel" msgstr "" -#: src/view/grid/GridAccount.cpp:1256 src/view/grid/GridAccount.cpp:1263 +#: src/view/grid/GridAccount.cpp:1260 src/view/grid/GridAccount.cpp:1267 msgid "Cannot group these operations" msgstr "" -#: src/view/grid/GridAccount.cpp:1382 src/view/grid/GridAccount.cpp:1388 +#: src/view/grid/GridAccount.cpp:1386 src/view/grid/GridAccount.cpp:1392 msgid "Cannot ungroup these operations" msgstr "" -#: src/view/PreferencesPanel.cpp:60 +#: src/view/PreferencesPanel.cpp:61 msgid "Categories" msgstr "" -#: src/view/SearchPanel.cpp:88 src/view/grid/GridAccount.cpp:64 +#: src/view/SearchPanel.cpp:88 src/view/grid/GridAccount.cpp:67 msgid "Category" msgstr "" -#: src/view/PreferencesPanel.cpp:692 src/view/PreferencesPanel.cpp:711 +#: src/view/PreferencesPanel.cpp:696 src/view/PreferencesPanel.cpp:715 msgid "Category " msgstr "" -#: src/view/PreferencesPanel.cpp:77 +#: src/view/PreferencesPanel.cpp:78 msgid "Change Name" msgstr "" -#: src/view/PreferencesPanel.cpp:78 +#: src/view/PreferencesPanel.cpp:79 msgid "Change Password" msgstr "" @@ -156,7 +156,7 @@ msgstr "" msgid "Cost repartition" msgstr "" -#: src/view/grid/GridAccount.cpp:64 +#: src/view/grid/GridAccount.cpp:67 msgid "Credit" msgstr "" @@ -172,7 +172,7 @@ msgstr "" msgid "Current value" msgstr "" -#: src/view/grid/GridAccount.cpp:64 +#: src/view/grid/GridAccount.cpp:67 msgid "Date" msgstr "" @@ -184,24 +184,24 @@ msgstr "" msgid "Date to" msgstr "" -#: src/view/grid/GridAccount.cpp:64 +#: src/view/grid/GridAccount.cpp:67 msgid "Debit" msgstr "" -#: src/view/PreferencesPanel.cpp:194 +#: src/view/PreferencesPanel.cpp:198 msgid "Default" msgstr "" -#: src/view/AccountPanel.cpp:611 src/view/PreferencesPanel.cpp:196 -#: src/view/PreferencesPanel.cpp:284 +#: src/view/AccountPanel.cpp:611 src/view/PreferencesPanel.cpp:200 +#: src/view/PreferencesPanel.cpp:288 msgid "Delete" msgstr "" -#: src/view/PreferencesPanel.cpp:358 +#: src/view/PreferencesPanel.cpp:362 msgid "Descending" msgstr "" -#: src/view/SearchPanel.cpp:85 src/view/grid/GridAccount.cpp:64 +#: src/view/SearchPanel.cpp:85 src/view/grid/GridAccount.cpp:67 msgid "Description" msgstr "" @@ -210,15 +210,15 @@ msgstr "" #: src/model/Database.cpp:120 src/model/Database.cpp:147 #: src/model/Database.cpp:155 src/model/Database.cpp:176 #: src/view/AccountPanel.cpp:748 src/view/PasswordDialog.cpp:72 -#: src/view/PasswordDialog.cpp:78 src/view/PreferencesPanel.cpp:418 -#: src/view/PreferencesPanel.cpp:470 src/view/PreferencesPanel.cpp:490 -#: src/view/PreferencesPanel.cpp:692 src/view/PreferencesPanel.cpp:711 -#: src/view/PreferencesPanel.cpp:742 src/view/PreferencesPanel.cpp:748 -#: src/view/SearchPanel.cpp:157 src/view/SearchPanel.cpp:167 -#: src/view/SearchPanel.cpp:181 src/view/SearchPanel.cpp:192 +#: src/view/PasswordDialog.cpp:78 src/view/PreferencesPanel.cpp:422 +#: src/view/PreferencesPanel.cpp:474 src/view/PreferencesPanel.cpp:494 +#: src/view/PreferencesPanel.cpp:696 src/view/PreferencesPanel.cpp:715 +#: src/view/PreferencesPanel.cpp:751 src/view/PreferencesPanel.cpp:757 +#: src/view/SearchPanel.cpp:158 src/view/SearchPanel.cpp:168 +#: src/view/SearchPanel.cpp:182 src/view/SearchPanel.cpp:193 #: src/view/UsersDialog.cpp:90 src/view/UsersDialog.cpp:120 -#: src/view/grid/GridAccount.cpp:1256 src/view/grid/GridAccount.cpp:1263 -#: src/view/grid/GridAccount.cpp:1382 src/view/grid/GridAccount.cpp:1388 +#: src/view/grid/GridAccount.cpp:1260 src/view/grid/GridAccount.cpp:1267 +#: src/view/grid/GridAccount.cpp:1386 src/view/grid/GridAccount.cpp:1392 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 msgid "Error" msgstr "" @@ -231,16 +231,16 @@ msgstr "" msgid "Final value" msgstr "" -#: src/controller/KissCount.cpp:359 src/model/Database.cpp:331 -#: src/view/SearchPanel.cpp:76 src/view/grid/GridAccount.cpp:323 +#: src/controller/KissCount.cpp:366 src/model/Database.cpp:331 +#: src/view/SearchPanel.cpp:76 src/view/grid/GridAccount.cpp:326 msgid "Fix" msgstr "" -#: src/view/PreferencesPanel.cpp:283 +#: src/view/PreferencesPanel.cpp:287 msgid "Font" msgstr "" -#: src/view/PreferencesPanel.cpp:282 +#: src/view/PreferencesPanel.cpp:286 msgid "Foreground color" msgstr "" @@ -248,7 +248,7 @@ msgstr "" msgid "From" msgstr "" -#: src/view/GenerateDialog.cpp:45 +#: src/view/GenerateDialog.cpp:46 msgid "From " msgstr "" @@ -256,7 +256,7 @@ msgstr "" msgid "Generate month" msgstr "" -#: src/controller/KissCount.cpp:361 +#: src/controller/KissCount.cpp:368 msgid "Groceries" msgstr "" @@ -264,7 +264,7 @@ msgstr "" msgid "Group" msgstr "" -#: src/controller/KissCount.cpp:363 +#: src/controller/KissCount.cpp:370 msgid "Hobbies" msgstr "" @@ -272,19 +272,19 @@ msgstr "" msgid "Initial value" msgstr "" -#: src/view/SearchPanel.cpp:167 +#: src/view/SearchPanel.cpp:168 msgid "Invalid amount from" msgstr "" -#: src/view/SearchPanel.cpp:192 +#: src/view/SearchPanel.cpp:193 msgid "Invalid amount range" msgstr "" -#: src/view/SearchPanel.cpp:181 +#: src/view/SearchPanel.cpp:182 msgid "Invalid amount to" msgstr "" -#: src/view/SearchPanel.cpp:157 +#: src/view/SearchPanel.cpp:158 msgid "Invalid date range" msgstr "" @@ -292,7 +292,7 @@ msgstr "" msgid "Invalid formula !" msgstr "" -#: src/view/PreferencesPanel.cpp:742 +#: src/view/PreferencesPanel.cpp:751 msgid "Invalid name" msgstr "" @@ -304,11 +304,11 @@ msgstr "" msgid "Invalid password" msgstr "" -#: src/view/StatsPanel.cpp:358 +#: src/view/StatsPanel.cpp:377 msgid "Invalide date range" msgstr "" -#: src/view/PreferencesPanel.cpp:418 +#: src/view/PreferencesPanel.cpp:422 msgid "It must be at least one account !" msgstr "" @@ -316,33 +316,33 @@ msgstr "" msgid "It must be at least one month !" msgstr "" -#: src/view/PreferencesPanel.cpp:79 +#: src/view/PreferencesPanel.cpp:80 msgid "Kill me" msgstr "" -#: src/view/StatsPanel.cpp:358 src/view/PreferencesPanel.cpp:782 -#: src/view/PreferencesPanel.cpp:785 +#: src/view/StatsPanel.cpp:377 src/view/PreferencesPanel.cpp:791 +#: src/view/PreferencesPanel.cpp:794 msgid "KissCount" msgstr "" -#: src/view/PreferencesPanel.cpp:61 +#: src/view/PreferencesPanel.cpp:62 msgid "Language" msgstr "" -#: src/view/PreferencesPanel.cpp:785 +#: src/view/PreferencesPanel.cpp:794 msgid "Language not changed" msgstr "" -#: src/view/PreferencesPanel.cpp:782 +#: src/view/PreferencesPanel.cpp:791 msgid "Language successfully changed, please go to another panel" msgstr "" -#: src/view/PreferencesPanel.cpp:71 src/view/PreferencesPanel.cpp:192 -#: src/view/PreferencesPanel.cpp:280 +#: src/view/PreferencesPanel.cpp:72 src/view/PreferencesPanel.cpp:196 +#: src/view/PreferencesPanel.cpp:284 msgid "Name" msgstr "" -#: src/view/PreferencesPanel.cpp:754 +#: src/view/PreferencesPanel.cpp:763 msgid "Name changed" msgstr "" @@ -360,7 +360,7 @@ msgid "" "\n" msgstr "" -#: src/view/SearchPanel.cpp:247 +#: src/view/SearchPanel.cpp:248 msgid "No entry found" msgstr "" @@ -372,11 +372,11 @@ msgstr "" msgid "Not checked" msgstr "" -#: src/view/PreferencesPanel.cpp:193 +#: src/view/PreferencesPanel.cpp:197 msgid "Number" msgstr "" -#: src/view/GenerateDialog.cpp:59 src/view/PasswordDialog.cpp:55 +#: src/view/GenerateDialog.cpp:60 src/view/PasswordDialog.cpp:55 #: src/view/UsersDialog.cpp:51 msgid "OK" msgstr "" @@ -385,11 +385,11 @@ msgstr "" msgid "Old password " msgstr "" -#: src/controller/KissCount.cpp:365 +#: src/controller/KissCount.cpp:372 msgid "Operating exepense" msgstr "" -#: src/view/PreferencesPanel.cpp:62 +#: src/view/PreferencesPanel.cpp:63 msgid "Operation order" msgstr "" @@ -397,7 +397,7 @@ msgstr "" msgid "Operations" msgstr "" -#: src/controller/KissCount.cpp:369 +#: src/controller/KissCount.cpp:376 msgid "Other" msgstr "" @@ -409,7 +409,7 @@ msgstr "" msgid "Password changed" msgstr "" -#: src/view/wxUI.cpp:243 +#: src/view/wxUI.cpp:245 msgid "" "Personal accounting software\n" "\n" @@ -417,15 +417,15 @@ msgid "" "\n" "Licenced under GNU GPL v3\n" "\n" -"Copyright (C) 2010 Grégory Soutadé" +"Copyright (C) 2010-2011 Grégory Soutadé" msgstr "" #: src/view/PasswordDialog.cpp:78 msgid "Please retype new password" msgstr "" -#: src/view/PreferencesPanel.cpp:180 src/view/PreferencesPanel.cpp:756 -#: src/view/PreferencesPanel.cpp:790 +#: src/view/PreferencesPanel.cpp:184 src/view/PreferencesPanel.cpp:765 +#: src/view/PreferencesPanel.cpp:799 msgid "Preferences" msgstr "" @@ -433,7 +433,7 @@ msgstr "" msgid "Query failed !\n" msgstr "" -#: src/view/wxUI.cpp:250 +#: src/view/wxUI.cpp:252 msgid "Quit KissCount ?" msgstr "" @@ -441,8 +441,8 @@ msgstr "" msgid "Remains" msgstr "" -#: src/view/SearchPanel.cpp:83 src/view/SearchPanel.cpp:142 -#: src/view/SearchPanel.cpp:258 +#: src/view/SearchPanel.cpp:83 src/view/SearchPanel.cpp:143 +#: src/view/SearchPanel.cpp:259 msgid "Search" msgstr "" @@ -450,11 +450,11 @@ msgstr "" msgid "Serie 1" msgstr "" -#: src/view/PreferencesPanel.cpp:63 +#: src/view/PreferencesPanel.cpp:64 msgid "Shared with" msgstr "" -#: src/view/StatsPanel.cpp:160 src/view/StatsPanel.cpp:339 +#: src/view/StatsPanel.cpp:160 src/view/StatsPanel.cpp:358 msgid "Statistics" msgstr "" @@ -462,7 +462,7 @@ msgstr "" msgid "To" msgstr "" -#: src/view/GenerateDialog.cpp:52 +#: src/view/GenerateDialog.cpp:53 msgid "To " msgstr "" @@ -483,7 +483,7 @@ msgstr "" msgid "Unable to open Database" msgstr "" -#: src/controller/KissCount.cpp:367 +#: src/controller/KissCount.cpp:374 msgid "Unexpected" msgstr "" @@ -495,11 +495,11 @@ msgstr "" msgid "Update failed !\n" msgstr "" -#: src/view/PreferencesPanel.cpp:58 +#: src/view/PreferencesPanel.cpp:59 msgid "User" msgstr "" -#: src/view/PreferencesPanel.cpp:748 src/view/UsersDialog.cpp:39 +#: src/view/PreferencesPanel.cpp:757 src/view/UsersDialog.cpp:39 #: src/view/UsersDialog.cpp:120 msgid "User " msgstr "" @@ -508,58 +508,58 @@ msgstr "" msgid "Users" msgstr "" -#: src/view/grid/GridAccount.cpp:1033 +#: src/view/grid/GridAccount.cpp:1037 msgid "Warning" msgstr "" -#: src/view/grid/GridAccount.cpp:1033 +#: src/view/grid/GridAccount.cpp:1037 msgid "You made a debit on a blocked account" msgstr "" -#: src/view/wxUI.cpp:123 +#: src/view/wxUI.cpp:125 msgid "april" msgstr "" -#: src/view/wxUI.cpp:127 +#: src/view/wxUI.cpp:129 msgid "august" msgstr "" -#: src/view/wxUI.cpp:131 +#: src/view/wxUI.cpp:133 msgid "december" msgstr "" -#: src/view/wxUI.cpp:121 +#: src/view/wxUI.cpp:123 msgid "february" msgstr "" -#: src/view/wxUI.cpp:120 +#: src/view/wxUI.cpp:122 msgid "january" msgstr "" -#: src/view/wxUI.cpp:126 +#: src/view/wxUI.cpp:128 msgid "july" msgstr "" -#: src/view/wxUI.cpp:125 +#: src/view/wxUI.cpp:127 msgid "june" msgstr "" -#: src/view/wxUI.cpp:122 +#: src/view/wxUI.cpp:124 msgid "march" msgstr "" -#: src/view/wxUI.cpp:124 +#: src/view/wxUI.cpp:126 msgid "may" msgstr "" -#: src/view/wxUI.cpp:130 +#: src/view/wxUI.cpp:132 msgid "november" msgstr "" -#: src/view/wxUI.cpp:129 +#: src/view/wxUI.cpp:131 msgid "october" msgstr "" -#: src/view/wxUI.cpp:128 +#: src/view/wxUI.cpp:130 msgid "september" msgstr "" diff --git a/src/sha1.cpp b/src/sha1.cpp index e365a1e..012ff77 100644 --- a/src/sha1.cpp +++ b/src/sha1.cpp @@ -28,9 +28,35 @@ /* this is only to get definitions for memcpy(), ntohl() and htonl() */ //#include "../git-compat-util.h" #include -#include #include "sha1.h" +#ifndef WIN32 +#include +#else +#if BYTE_ORDER == BIG_ENDIAN + +#define htons(n) (n) +#define ntohs(n) (n) +#define htonl(n) (n) +#define ntohl(n) (n) + +#else + +#define htons(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8)) +#define ntohs(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8)) + +#define htonl(n) (((((unsigned long)(n) & 0xFF)) << 24) | \ + ((((unsigned long)(n) & 0xFF00)) << 8) | \ + ((((unsigned long)(n) & 0xFF0000)) >> 8) | \ + ((((unsigned long)(n) & 0xFF000000)) >> 24)) + +#define ntohl(n) (((((unsigned long)(n) & 0xFF)) << 24) | \ + ((((unsigned long)(n) & 0xFF00)) << 8) | \ + ((((unsigned long)(n) & 0xFF0000)) >> 8) | \ + ((((unsigned long)(n) & 0xFF000000)) >> 24)) +#endif +#endif + #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) /* diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 9edd09c..e38b70c 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -165,7 +165,7 @@ KissPanel* AccountPanel::CreatePanel() wxBitmapButton* AccountPanel::GetButton(int id) { if (!_KissButton) - _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(ACCOUNT_ICON)), wxDefaultPosition, wxSize(128, 128)); + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(ACCOUNT_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128)); return _KissButton; } diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 1829390..bc62be6 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -174,7 +174,7 @@ KissPanel* PreferencesPanel::CreatePanel() wxBitmapButton* PreferencesPanel::GetButton(int id) { if (!_KissButton) - _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(PREFS_ICON)), wxDefaultPosition, wxSize(128, 128)); + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(PREFS_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128)); return _KissButton; } @@ -348,7 +348,7 @@ void PreferencesPanel::InitLanguage(User* user) for (i=0; iAppend(languages[i].name, wxBitmap(languages[i].icon)); + _language->Append(languages[i].name, wxBitmap(languages[i].icon, wxBITMAP_TYPE_PNG)); if (languages[i].language == _wxUI->_language) select = i; } diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index a64c737..28df4c8 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -133,7 +133,7 @@ KissPanel* SearchPanel::CreatePanel() wxBitmapButton* SearchPanel::GetButton(int id) { if (!_KissButton) - _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(SEARCH_ICON)), wxDefaultPosition, wxSize(128, 128)); + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(SEARCH_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128)); return _KissButton; } diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index e9c32e2..9611f48 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -150,7 +150,7 @@ KissPanel* StatsPanel::CreatePanel() wxBitmapButton* StatsPanel::GetButton(int id) { if (!_KissButton) - _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(STATS_ICON)), wxDefaultPosition, wxSize(128, 128)); + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(STATS_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128)); return _KissButton; } diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 575e5c3..921a759 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -39,14 +39,17 @@ BEGIN_EVENT_TABLE(GridAccount, wxGrid) EVT_GRID_CELL_LEFT_CLICK(GridAccount::OnCellLeftClick ) END_EVENT_TABLE() +enum {TREE, DESCRIPTION, OP_DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, OP_DELETE, CHECKED, NUMBER_COLS_OPS}; + enum {GRID_ID}; + GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id) : wxGrid(parent, id), _fixCosts(0), _week1(0), _week2(0), _week3(0), _week4(0), _parent(parent), _kiss(kiss), _loadOperations(false), _curMonth(0), _curYear(0) { - wxBitmap deleteBitmap(wxT(DELETE_ICON)); - wxBitmap checkedBitmap(wxT(CHECKED_ICON)); + wxBitmap deleteBitmap(wxT(DELETE_ICON), wxBITMAP_TYPE_PNG); + wxBitmap checkedBitmap(wxT(CHECKED_ICON), wxBITMAP_TYPE_PNG); DEFAULT_FONT(font); int i; User* user = _kiss->GetUser(); @@ -70,7 +73,7 @@ GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id) : wxG SetReadOnly(0, i, true); SetCellAlignment(0, i, wxALIGN_CENTRE, wxALIGN_CENTRE); } - SetCellRenderer(0, DELETE, new wxGridCellBitmapRenderer(deleteBitmap)); + SetCellRenderer(0, OP_DELETE, new wxGridCellBitmapRenderer(deleteBitmap)); SetCellRenderer(0, CHECKED, new wxGridCellBitmapRenderer(checkedBitmap)); _accounts = new wxString[user->GetAccountsNumber()]; @@ -92,9 +95,9 @@ GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id) : wxG AutoSizeColumn(TREE, false); AutoSizeColumn(CATEGORY, false); - AutoSizeColumn(DATE, false); + AutoSizeColumn(OP_DATE, false); AutoSizeColumn(ACCOUNT, false); - AutoSizeColumn(DELETE, false); + AutoSizeColumn(OP_DELETE, false); AutoSizeColumn(CHECKED, false); } @@ -226,9 +229,9 @@ void GridAccount::LoadOperations(std::vector* operations, bool canAdd AutoSizeColumn(TREE, false); AutoSizeColumn(CATEGORY, false); - AutoSizeColumn(DATE, false); + AutoSizeColumn(OP_DATE, false); AutoSizeColumn(ACCOUNT, false); - AutoSizeColumn(DELETE, false); + AutoSizeColumn(OP_DELETE, false); AutoSizeColumn(CHECKED, false); _loadOperations = false; @@ -302,7 +305,7 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, SetCellRenderer(line, TREE, new wxGridCellTreeButtonRenderer()); SetCellEditor(line, TREE, new wxGridCellTreeButtonEditor()); - SetReadOnly(line, DATE, true); + SetReadOnly(line, OP_DATE, true); SetReadOnly(line, CREDIT, true); SetReadOnly(line, DEBIT, true); SetReadOnly(line, CATEGORY, true); @@ -332,12 +335,12 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, { cat = user->GetCategory(op.category); - SetCellEditor(line, DATE, new CalendarEditor(op.day, month, year)); + SetCellEditor(line, OP_DATE, new CalendarEditor(op.day, month, year)); description = op.description; UNESCAPE_CHARS(description); SetCellValue(line, DESCRIPTION, description); SetCellRenderer(line, DESCRIPTION, new wxGridCellTabStringRenderer ()); - SetCellValue(line, DATE, wxString::Format(wxT("%02d/%02d/%d"), op.day+1, month+1, year)); + SetCellValue(line, OP_DATE, wxString::Format(wxT("%02d/%02d/%d"), op.day+1, month+1, year)); if (op.amount < 0) SetCellValue(line, DEBIT, wxString::Format(wxT("%.2lf"), -op.amount)); else @@ -347,8 +350,8 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, SetCellValue(line, ACCOUNT, user->GetAccountName(op.account)); if (!fix && !op.meta) SetCellValue(line, CATEGORY, cat.name); - SetCellRenderer(line, DELETE, new wxGridCellBoolRenderer ()); - SetCellEditor(line, DELETE, new wxGridCellBoolEditor ()); + SetCellRenderer(line, OP_DELETE, new wxGridCellBoolRenderer ()); + SetCellEditor(line, OP_DELETE, new wxGridCellBoolEditor ()); SetCellRenderer(line, CHECKED, new wxGridCellBoolRenderer ()); SetCellEditor(line, CHECKED, new wxGridCellFastBoolEditor ()); @@ -391,16 +394,16 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, } else { - SetCellEditor(line, DATE, new CalendarEditor(0, month, year)); + SetCellEditor(line, OP_DATE, new CalendarEditor(0, month, year)); if (curDate.GetMonth() == month && curDate.GetYear() == year) { if (!fix) - SetCellValue(line, DATE, wxString::Format(wxT("%02d/%02d/%d"), curDate.GetDay(), month+1, year)); - SetCellEditor(line, DATE, new CalendarEditor(curDate.GetDay()-1, month, year)); + SetCellValue(line, OP_DATE, wxString::Format(wxT("%02d/%02d/%d"), curDate.GetDay(), month+1, year)); + SetCellEditor(line, OP_DATE, new CalendarEditor(curDate.GetDay()-1, month, year)); } else - SetCellEditor(line, DATE, new CalendarEditor(0, month, year)); + SetCellEditor(line, OP_DATE, new CalendarEditor(0, month, year)); if (fix) { @@ -412,13 +415,13 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, } SetReadOnly(line, CHECKED, true); - SetReadOnly(line, DELETE, true); + SetReadOnly(line, OP_DELETE, true); } - SetCellAlignment(line, DATE, wxALIGN_CENTRE, wxALIGN_CENTRE); + SetCellAlignment(line, OP_DATE, wxALIGN_CENTRE, wxALIGN_CENTRE); SetCellAlignment(line, DEBIT, wxALIGN_RIGHT, wxALIGN_CENTRE); SetCellAlignment(line, CREDIT, wxALIGN_RIGHT, wxALIGN_CENTRE); - SetCellAlignment(line, DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE); + SetCellAlignment(line, OP_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE); SetCellAlignment(line, CHECKED, wxALIGN_CENTRE, wxALIGN_CENTRE); AutoSizeRow(line); @@ -430,7 +433,7 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, // From http://nomadsync.cvs.sourceforge.net/nomadsync/nomadsync/src/ void GridAccount::OnCellLeftClick(wxGridEvent& evt) { - if (evt.GetCol() != TREE && evt.GetCol() != DELETE && evt.GetCol() != CHECKED) { evt.Skip() ; return;} + if (evt.GetCol() != TREE && evt.GetCol() != OP_DELETE && evt.GetCol() != CHECKED) { evt.Skip() ; return;} // This forces the cell to go into edit mode directly //m_waitForSlowClick = TRUE; @@ -692,7 +695,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) op_complete--; } - value = GetCellValue(row, DATE); + value = GetCellValue(row, OP_DATE); if (value.Length()) { date.ParseFormat(value, wxT("%d/%m/%Y")); @@ -821,7 +824,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) } } - if (col == DELETE) + if (col == OP_DELETE) { wxMessageDialog dialog(this, _("Are you sure want to delete : \n")+new_op.description, wxT("KissCount"), wxYES_NO); if (dialog.ShowModal() == wxID_NO) @@ -835,7 +838,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) // Modify a fix operation if (row < _fixCosts) { - if (col == DELETE) + if (col == OP_DELETE) { if (cur_op.parent.Length()) user->UnGroup(_displayedOperations[row]); @@ -943,7 +946,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) new_op.parent = cur_op.parent; new_op.childs = cur_op.childs; - if (col == DELETE) + if (col == OP_DELETE) { if (cur_op.parent.Length()) user->UnGroup(_displayedOperations[row]); @@ -1078,7 +1081,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) SET_ROW_FONT(row, font); } - SetCellValue(row, DATE, wxString::Format(wxT("%02d/%02d/%d"), new_op.day+1, _curMonth+1, _curYear)); + SetCellValue(row, OP_DATE, wxString::Format(wxT("%02d/%02d/%d"), new_op.day+1, _curMonth+1, _curYear)); if (!_displayedOperations[row].amount) { diff --git a/src/view/grid/GridAccount.h b/src/view/grid/GridAccount.h index cd875cf..77f0a2a 100644 --- a/src/view/grid/GridAccount.h +++ b/src/view/grid/GridAccount.h @@ -35,8 +35,6 @@ class KissCount; -enum {TREE, DESCRIPTION, DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, DELETE, CHECKED, NUMBER_COLS_OPS}; - class GridAccount : public wxGrid { public: diff --git a/src/view/view.h b/src/view/view.h index 2fa167a..d253acd 100644 --- a/src/view/view.h +++ b/src/view/view.h @@ -28,15 +28,15 @@ #define DEFAULT_FONT_SIZE 12 #define DEFAULT_FONT(font_name) wxFont font_name(DEFAULT_FONT_SIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, DEFAULT_FONT_NAME); -#define DELETE_ICON "ressources/icons/process-stop.png" -#define CHECKED_ICON "ressources/icons/tick-icon.png" -#define ACCOUNT_ICON "ressources/icons/administrator-icon.png" -#define STATS_ICON "ressources/icons/chart-icon.png" -#define SEARCH_ICON "ressources/icons/Search-icon.png" -#define PREFS_ICON "ressources/icons/options-icon.png" -#define CHANGE_USER_ICON "ressources/icons/Clients-icon.png" -#define ABOUT_ICON "ressources/icons/windows-users-icon.png" -#define QUIT_ICON "ressources/icons/system-log-out.png" +#define DELETE_ICON "./ressources/icons/process-stop.png" +#define CHECKED_ICON "./ressources/icons/tick-icon.png" +#define ACCOUNT_ICON "./ressources/icons/administrator-icon.png" +#define STATS_ICON "./ressources/icons/chart-icon.png" +#define SEARCH_ICON "./ressources/icons/Search-icon.png" +#define PREFS_ICON "./ressources/icons/options-icon.png" +#define CHANGE_USER_ICON "./ressources/icons/Clients-icon.png" +#define ABOUT_ICON "./ressources/icons/windows-users-icon.png" +#define QUIT_ICON "./ressources/icons/system-log-out.png" #include "KissPanel.h" diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 128f988..c405210 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -45,6 +45,8 @@ wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxS : wxFrame(NULL, -1, title, pos, size), _kiss(kiss), _curPanel(NULL), _locale(NULL), _needReload(false) { + wxInitAllImageHandlers(); + _vbox = new wxBoxSizer(wxVERTICAL); _buttonsBox = new wxBoxSizer(wxHORIZONTAL); // ButtonPanel* buttons = new ButtonPanel(_kiss, this); @@ -61,9 +63,9 @@ wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxS // CreateStatusBar(); // SetStatusText( wxT("Welcome to wxWidgets!") ); - _buttonsBox->Add(new wxBitmapButton(this, BUTTON_CHANGE_USER_ID, wxBitmap(wxT(CHANGE_USER_ICON)), wxDefaultPosition, wxSize(128, 128))); - _buttonsBox->Add(new wxBitmapButton(this, BUTTON_ABOUT_ID, wxBitmap(wxT(ABOUT_ICON)), wxDefaultPosition, wxSize(128, 128))); - _buttonsBox->Add(new wxBitmapButton(this, BUTTON_QUIT_ID, wxBitmap(wxT(QUIT_ICON)), wxDefaultPosition, wxSize(128, 128))); + _buttonsBox->Add(new wxBitmapButton(this, BUTTON_CHANGE_USER_ID, wxBitmap(wxT(CHANGE_USER_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128))); + _buttonsBox->Add(new wxBitmapButton(this, BUTTON_ABOUT_ID, wxBitmap(wxT(ABOUT_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128))); + _buttonsBox->Add(new wxBitmapButton(this, BUTTON_QUIT_ID, wxBitmap(wxT(QUIT_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128))); SetSizer(_vbox); diff --git a/src/view/wxUI.h b/src/view/wxUI.h index fbb0a29..631d01c 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -33,6 +33,9 @@ #include "grid/wxGridCellButtonRenderer.h" #include "grid/wxGridCellButtonEditor.h" +#undef _ +#define _(s) wxString(wxGetTranslation(s)) + class KissCount; class AccountPanel; class PreferencesPanel; From 37a199ead2a2d8109e1f91c81040ec63e74a4e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 6 Feb 2011 09:07:57 +0100 Subject: [PATCH 26/72] Little adjustement concerning _() macro (maybe it s a compiler problem) --- src/view/wxUI.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/view/wxUI.h b/src/view/wxUI.h index 631d01c..8c3376f 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -33,8 +33,10 @@ #include "grid/wxGridCellButtonRenderer.h" #include "grid/wxGridCellButtonEditor.h" +#ifdef WIN32 #undef _ #define _(s) wxString(wxGetTranslation(s)) +#endif class KissCount; class AccountPanel; From 1b03559b2b20528890daf296c9bab1c0c09c3a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 6 Feb 2011 09:18:43 +0100 Subject: [PATCH 27/72] Forgot package_win32.sh --- tools/package.sh | 2 +- tools/package_win32.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 tools/package_win32.sh diff --git a/tools/package.sh b/tools/package.sh index b0685a5..3649c25 100755 --- a/tools/package.sh +++ b/tools/package.sh @@ -1,7 +1,7 @@ #!/bin/bash DATE=`date +%d.%m.%Y` -ARCH=`${PREFIX}gcc -dumpmachine | cut -d- -f1` +[ -z "$ARCH" ] && ARCH=`${PREFIX}gcc -dumpmachine | cut -d- -f1` VERSION=`cat src/controller/KissCount.h | grep APP_VERSION | cut -d\" -f2` DIR="KissCount_build_${VERSION}_${DATE}_${ARCH}" FILE="$DIR.tar.bz2" diff --git a/tools/package_win32.sh b/tools/package_win32.sh new file mode 100755 index 0000000..2aba7d2 --- /dev/null +++ b/tools/package_win32.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +DATE=`date +%d.%m.%Y` +[ -z "$ARCH" ] && ARCH=`${PREFIX}gcc -dumpmachine | cut -d- -f1` +VERSION=`cat src/controller/KissCount.h | grep APP_VERSION | cut -d\" -f2` +DIR="KissCount_build_${VERSION}_${DATE}_${ARCH}" +FILE="$DIR.tar.bz2" + +rm -f "$FILE" +rm -rf "$DIR" +if [ "$1" == "clean" ] ; then +make clean +fi +make || (echo "Compilation failed" ; exit 1) +mkdir -p "$DIR" +cp -r lib/freechart/lib/*.dll* lib/wxsqlite3-1.9.9/lib/*.dll* "$DIR" +cp -r kc init.sql ressources tools/launch_kc.sh TODO CONTRIBUTORS COPYING README README.fr www "$DIR" +find "$DIR" -type f -executable -exec ${PREFIX}strip \{\} \; +tar -jcf "$FILE" "$DIR" +rm -rf "$DIR" +echo "Packaged into $FILE !" \ No newline at end of file From 2b07cb0b30b464ee07434fe96868e8abefb8cf50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Tue, 8 Feb 2011 21:17:35 +0100 Subject: [PATCH 28/72] Possibility to choose a replacement when delete accounts and categories --- ChangeLog | 1 + ressources/po/french.mo | Bin 7454 -> 7564 bytes ressources/po/french.po | 326 +++++++++++++++++----------------- ressources/po/kisscount.pot | 118 ++++++------ src/controller/KissCount.cpp | 21 ++- src/controller/KissCount.h | 4 +- src/model/Database.cpp | 18 +- src/model/Database.h | 4 +- src/view/PreferencesPanel.cpp | 47 +++-- 9 files changed, 299 insertions(+), 240 deletions(-) diff --git a/ChangeLog b/ChangeLog index aaeb6b8..c823bfa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ v0.2_dev (29/01/2011) No further problems with scrollbar in AccountPanel/SearchPanel/PreferencesPanel when there is a lot of operations Better fit of interface when displaying grouped operations Show stats for current month even if next month has not been generated + Possibility to choose a replacement when deleting accounts and categories ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/ressources/po/french.mo b/ressources/po/french.mo index c503e56824e33e979b769251208c7ba410a29257..78aa5d287f325c989ed29dcc053348902647f585 100644 GIT binary patch delta 3018 zcmZ|Qe@sjH}Ridc3;jjb?C z?q)wUvzBej+S045%~>s%oB4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cW)yR4 z*1^IcX!`6YCc^9g~UR3*iScZp@Me^Kb5^6Ax4bcqzs6&*AT7g2;j7m@|um;so z9jb#MY9KwRCEbI1z7O}{0Mdn9k{Y>RffTt~oTT@^i-cYWFI>QqqxQJpJcMfaebkZ- zBX5=a3iTSEwEL&*{#n%7xqw;tpOvTa7pWD@L9OUwjHQ29MM4eNnJuUl*@-K$7uC^m z^BcQ=8a2>gPz|3m|3aOq%jQ+omfS!+AH{#Ko{vLM9Ze&l8NEQH5ladEKaXFnB)W;! z;{|3Ns^Re~oy0EU0pd(u@)CbNpzOlUCo5%q+wC&J(MV`1qB zF_X|4xyQPoIU+eg0H{6qvtn1PKYp=Ewg+#vH&;hxhXt%s5 zCb}$tw^?rHn4*PfCK{CCT2DMr+(oP)cEU$x;P3VB-5z#~e(Lv~H(m<*sY1f8&r=B9V5VsM! z<`O!IdXIGR;<`t}DNd>R9O?&Px#bt(vxNQ)V2zL*K@h`C>M;HZ`UPI~oHAljEa8(-Y2x zCL~sb$`g-{=MSYNf9;#RBE3D(*51}J^yjqKe4#r3\n" "Language-Team: \n" @@ -19,21 +19,21 @@ msgstr "" # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # -#: src/view/StatsPanel.cpp:327 -#: src/view/PreferencesPanel.cpp:775 +#: src/view/StatsPanel.cpp:358 +#: src/view/PreferencesPanel.cpp:817 msgid " - " msgstr " - " -#: src/view/UsersDialog.cpp:118 -#: src/view/PreferencesPanel.cpp:456 -#: src/view/PreferencesPanel.cpp:476 -#: src/view/PreferencesPanel.cpp:677 -#: src/view/PreferencesPanel.cpp:696 +#: src/view/UsersDialog.cpp:120 +#: src/view/PreferencesPanel.cpp:485 +#: src/view/PreferencesPanel.cpp:505 +#: src/view/PreferencesPanel.cpp:714 #: src/view/PreferencesPanel.cpp:733 +#: src/view/PreferencesPanel.cpp:775 msgid " already exists" msgstr " existe déjà" -#: src/view/SearchPanel.cpp:226 +#: src/view/SearchPanel.cpp:243 msgid " entries found" msgstr " entrées trouvées" @@ -41,11 +41,11 @@ msgstr " entrées trouvées" msgid " not found, aborting" msgstr " non trouvé, arrêt" -#: src/view/AccountPanel.cpp:742 +#: src/view/AccountPanel.cpp:757 msgid " operations ?" msgstr " opérations ?" -#: src/view/PreferencesPanel.cpp:782 +#: src/view/PreferencesPanel.cpp:824 msgid " profil ?" msgstr " profil ?" @@ -53,25 +53,21 @@ msgstr " profil ?" msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "!! Attention !! S'il y a eu un bug, l'ancienne base de donnée va être supprimée !" -#: src/view/SearchPanel.cpp:228 +#: src/view/SearchPanel.cpp:245 msgid "1 entry found" msgstr "1 entrée trouvée" -#: src/view/ButtonPanel.cpp:74 -msgid "About" -msgstr "A propos" - #: src/view/SearchPanel.cpp:90 -#: src/view/grid/GridAccount.cpp:64 +#: src/view/grid/GridAccount.cpp:67 msgid "Account" msgstr "Compte" -#: src/view/PreferencesPanel.cpp:456 -#: src/view/PreferencesPanel.cpp:476 +#: src/view/PreferencesPanel.cpp:485 +#: src/view/PreferencesPanel.cpp:505 msgid "Account " msgstr "Le compte " -#: src/controller/KissCount.cpp:343 +#: src/controller/KissCount.cpp:363 msgid "Account 1" msgstr "Compte 1" @@ -83,77 +79,75 @@ msgstr "Nom du compte" msgid "Account number" msgstr "Numéro de compte" -#: src/view/StatsPanel.cpp:292 -#: src/view/PreferencesPanel.cpp:59 +#: src/view/StatsPanel.cpp:323 +#: src/view/PreferencesPanel.cpp:60 msgid "Accounts" msgstr "Comptes" -#: src/view/SearchPanel.cpp:87 +#: src/view/SearchPanel.cpp:86 msgid "Amount from" msgstr "Montant min" -#: src/view/SearchPanel.cpp:88 +#: src/view/SearchPanel.cpp:87 msgid "Amount to" msgstr "Montant max" -#: src/view/PreferencesPanel.cpp:408 -#: src/view/PreferencesPanel.cpp:782 -#: src/view/AccountPanel.cpp:737 +#: src/view/PreferencesPanel.cpp:824 +#: src/view/AccountPanel.cpp:752 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " -#: src/view/PreferencesPanel.cpp:657 -#: src/view/grid/GridAccount.cpp:814 +#: src/view/grid/GridAccount.cpp:829 msgid "Are you sure want to delete : \n" msgstr "Etes vous sûr de vouloir supprimer : \n" -#: src/view/PreferencesPanel.cpp:343 +#: src/view/PreferencesPanel.cpp:361 msgid "Ascending" msgstr "Croissant" -#: src/view/PreferencesPanel.cpp:267 +#: src/view/PreferencesPanel.cpp:285 msgid "Background color" msgstr "Couleur d'arrière plan" -#: src/view/PreferencesPanel.cpp:187 +#: src/view/PreferencesPanel.cpp:199 msgid "Blocked" msgstr "Bloqué" -#: src/view/UsersDialog.cpp:51 -#: src/view/GenerateDialog.cpp:60 +#: src/view/UsersDialog.cpp:52 +#: src/view/GenerateDialog.cpp:61 #: src/view/PasswordDialog.cpp:56 msgid "Cancel" msgstr "Annuler" -#: src/view/grid/GridAccount.cpp:1245 -#: src/view/grid/GridAccount.cpp:1252 +#: src/view/grid/GridAccount.cpp:1263 +#: src/view/grid/GridAccount.cpp:1270 msgid "Cannot group these operations" msgstr "Impossible de grouper ces opérations" -#: src/view/grid/GridAccount.cpp:1371 -#: src/view/grid/GridAccount.cpp:1377 +#: src/view/grid/GridAccount.cpp:1389 +#: src/view/grid/GridAccount.cpp:1395 msgid "Cannot ungroup these operations" msgstr "Impossible de dégrouper ces opérations" -#: src/view/PreferencesPanel.cpp:60 +#: src/view/PreferencesPanel.cpp:61 msgid "Categories" msgstr "Catégories" -#: src/view/SearchPanel.cpp:89 -#: src/view/grid/GridAccount.cpp:64 +#: src/view/SearchPanel.cpp:88 +#: src/view/grid/GridAccount.cpp:67 msgid "Category" msgstr "Catégorie" -#: src/view/PreferencesPanel.cpp:677 -#: src/view/PreferencesPanel.cpp:696 +#: src/view/PreferencesPanel.cpp:714 +#: src/view/PreferencesPanel.cpp:733 msgid "Category " msgstr "La catégorie " -#: src/view/PreferencesPanel.cpp:77 +#: src/view/PreferencesPanel.cpp:78 msgid "Change Name" msgstr "Changer de nom" -#: src/view/PreferencesPanel.cpp:78 +#: src/view/PreferencesPanel.cpp:79 msgid "Change Password" msgstr "Changer le mot de passe" @@ -161,10 +155,6 @@ msgstr "Changer le mot de passe" msgid "Change password" msgstr "Changer le mot de passe" -#: src/view/ButtonPanel.cpp:73 -msgid "Change user" -msgstr "Changer d'utilisateur" - #: src/view/AccountPanel.cpp:122 msgid "Check mode" msgstr "Mode rapprochement" @@ -177,20 +167,20 @@ msgstr "Rapprochée" msgid "Confirm password " msgstr "Confirmer le mot de passe " -#: src/view/StatsPanel.cpp:130 +#: src/view/StatsPanel.cpp:128 #: src/view/AccountPanel.cpp:116 msgid "Cost repartition" msgstr "Répartition des coûts" -#: src/view/grid/GridAccount.cpp:64 +#: src/view/grid/GridAccount.cpp:67 msgid "Credit" msgstr "Crédit" -#: src/view/AccountPanel.cpp:202 +#: src/view/AccountPanel.cpp:215 msgid "Cur Credit" msgstr "Cur Crédit" -#: src/view/AccountPanel.cpp:203 +#: src/view/AccountPanel.cpp:216 msgid "Cur Debit" msgstr "Cur Débit" @@ -198,7 +188,7 @@ msgstr "Cur Débit" msgid "Current value" msgstr "Valeur courante" -#: src/view/grid/GridAccount.cpp:64 +#: src/view/grid/GridAccount.cpp:67 msgid "Date" msgstr "Date" @@ -210,49 +200,49 @@ msgstr "Date min" msgid "Date to" msgstr "Date max" -#: src/view/grid/GridAccount.cpp:64 +#: src/view/grid/GridAccount.cpp:67 msgid "Debit" msgstr "Débit" -#: src/view/PreferencesPanel.cpp:186 +#: src/view/PreferencesPanel.cpp:198 msgid "Default" msgstr "Défaut" -#: src/view/PreferencesPanel.cpp:188 -#: src/view/PreferencesPanel.cpp:270 -#: src/view/AccountPanel.cpp:596 +#: src/view/PreferencesPanel.cpp:200 +#: src/view/PreferencesPanel.cpp:288 +#: src/view/AccountPanel.cpp:611 msgid "Delete" msgstr "Supprimer" -#: src/view/PreferencesPanel.cpp:344 +#: src/view/PreferencesPanel.cpp:362 msgid "Descending" msgstr "Décroissant" -#: src/view/SearchPanel.cpp:86 -#: src/view/grid/GridAccount.cpp:64 +#: src/view/SearchPanel.cpp:85 +#: src/view/grid/GridAccount.cpp:67 msgid "Description" msgstr "Description" -#: src/view/UsersDialog.cpp:88 -#: src/view/UsersDialog.cpp:118 -#: src/view/SearchPanel.cpp:141 -#: src/view/SearchPanel.cpp:151 -#: src/view/SearchPanel.cpp:165 -#: src/view/SearchPanel.cpp:176 -#: src/view/PreferencesPanel.cpp:404 -#: src/view/PreferencesPanel.cpp:456 -#: src/view/PreferencesPanel.cpp:476 -#: src/view/PreferencesPanel.cpp:677 -#: src/view/PreferencesPanel.cpp:696 -#: src/view/PreferencesPanel.cpp:727 +#: src/view/UsersDialog.cpp:90 +#: src/view/UsersDialog.cpp:120 +#: src/view/SearchPanel.cpp:158 +#: src/view/SearchPanel.cpp:168 +#: src/view/SearchPanel.cpp:182 +#: src/view/SearchPanel.cpp:193 +#: src/view/PreferencesPanel.cpp:422 +#: src/view/PreferencesPanel.cpp:485 +#: src/view/PreferencesPanel.cpp:505 +#: src/view/PreferencesPanel.cpp:714 #: src/view/PreferencesPanel.cpp:733 +#: src/view/PreferencesPanel.cpp:769 +#: src/view/PreferencesPanel.cpp:775 #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 -#: src/view/AccountPanel.cpp:733 -#: src/view/grid/GridAccount.cpp:1245 -#: src/view/grid/GridAccount.cpp:1252 -#: src/view/grid/GridAccount.cpp:1371 -#: src/view/grid/GridAccount.cpp:1377 +#: src/view/AccountPanel.cpp:748 +#: src/view/grid/GridAccount.cpp:1263 +#: src/view/grid/GridAccount.cpp:1270 +#: src/view/grid/GridAccount.cpp:1389 +#: src/view/grid/GridAccount.cpp:1395 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 #: src/model/Database.cpp:38 #: src/model/Database.cpp:55 @@ -274,34 +264,34 @@ msgid "Final value" msgstr "Valeur finale" #: src/view/SearchPanel.cpp:76 -#: src/view/grid/GridAccount.cpp:323 +#: src/view/grid/GridAccount.cpp:326 #: src/model/Database.cpp:331 -#: src/controller/KissCount.cpp:359 +#: src/controller/KissCount.cpp:379 msgid "Fix" msgstr "Fixe" -#: src/view/PreferencesPanel.cpp:269 +#: src/view/PreferencesPanel.cpp:287 msgid "Font" msgstr "Police" -#: src/view/PreferencesPanel.cpp:268 +#: src/view/PreferencesPanel.cpp:286 msgid "Foreground color" msgstr "Couleur d'avant plan" -#: src/view/StatsPanel.cpp:62 +#: src/view/StatsPanel.cpp:64 msgid "From" msgstr "De" -#: src/view/GenerateDialog.cpp:45 +#: src/view/GenerateDialog.cpp:46 msgid "From " msgstr "A partir de " #: src/view/GenerateDialog.cpp:31 -#: src/view/AccountPanel.cpp:593 +#: src/view/AccountPanel.cpp:608 msgid "Generate month" msgstr "Générer mois" -#: src/controller/KissCount.cpp:361 +#: src/controller/KissCount.cpp:381 msgid "Groceries" msgstr "Courses" @@ -309,7 +299,7 @@ msgstr "Courses" msgid "Group" msgstr "Grouper" -#: src/controller/KissCount.cpp:363 +#: src/controller/KissCount.cpp:383 msgid "Hobbies" msgstr "Loisirs" @@ -317,19 +307,19 @@ msgstr "Loisirs" msgid "Initial value" msgstr "Valeur initiale" -#: src/view/SearchPanel.cpp:151 +#: src/view/SearchPanel.cpp:168 msgid "Invalid amount from" msgstr "Montant min invalide" -#: src/view/SearchPanel.cpp:176 +#: src/view/SearchPanel.cpp:193 msgid "Invalid amount range" msgstr "Intervalle des montants invalide" -#: src/view/SearchPanel.cpp:165 +#: src/view/SearchPanel.cpp:182 msgid "Invalid amount to" msgstr "Montant max invalide" -#: src/view/SearchPanel.cpp:141 +#: src/view/SearchPanel.cpp:158 msgid "Invalid date range" msgstr "Intervalle de temps invalide" @@ -337,7 +327,7 @@ msgstr "Intervalle de temps invalide" msgid "Invalid formula !" msgstr "Formule invalide !" -#: src/view/PreferencesPanel.cpp:727 +#: src/view/PreferencesPanel.cpp:769 msgid "Invalid name" msgstr "Nom invalide" @@ -345,56 +335,56 @@ msgstr "Nom invalide" msgid "Invalid old password" msgstr "Ancien mot de passe invalide" -#: src/view/UsersDialog.cpp:88 +#: src/view/UsersDialog.cpp:90 msgid "Invalid password" msgstr "Mot de passe invalide" -#: src/view/StatsPanel.cpp:346 +#: src/view/StatsPanel.cpp:377 msgid "Invalide date range" msgstr "Intervalle de temps invalide" -#: src/view/PreferencesPanel.cpp:404 +#: src/view/PreferencesPanel.cpp:422 msgid "It must be at least one account !" msgstr "Il doit y avoir au moins un compte !" -#: src/view/AccountPanel.cpp:733 +#: src/view/AccountPanel.cpp:748 msgid "It must be at least one month !" msgstr "Il doit rester au moins un mois" -#: src/view/PreferencesPanel.cpp:79 +#: src/view/PreferencesPanel.cpp:80 msgid "Kill me" msgstr "Kill me" -#: src/view/StatsPanel.cpp:346 -#: src/view/PreferencesPanel.cpp:767 -#: src/view/PreferencesPanel.cpp:770 +#: src/view/StatsPanel.cpp:377 +#: src/view/PreferencesPanel.cpp:809 +#: src/view/PreferencesPanel.cpp:812 msgid "KissCount" msgstr "KissCount" -#: src/view/PreferencesPanel.cpp:61 +#: src/view/PreferencesPanel.cpp:62 msgid "Language" msgstr "Langue" -#: src/view/PreferencesPanel.cpp:770 +#: src/view/PreferencesPanel.cpp:812 msgid "Language not changed" msgstr "Langue non changée" -#: src/view/PreferencesPanel.cpp:767 +#: src/view/PreferencesPanel.cpp:809 msgid "Language successfully changed, please go to another panel" msgstr "Langue changée, allez sur un autre panneau pour rendre le changement effectif" -#: src/view/PreferencesPanel.cpp:71 -#: src/view/PreferencesPanel.cpp:184 -#: src/view/PreferencesPanel.cpp:266 +#: src/view/PreferencesPanel.cpp:72 +#: src/view/PreferencesPanel.cpp:196 +#: src/view/PreferencesPanel.cpp:284 msgid "Name" msgstr "Nom" -#: src/view/PreferencesPanel.cpp:739 +#: src/view/PreferencesPanel.cpp:781 msgid "Name changed" msgstr "Nom changé" -#: src/view/UsersDialog.cpp:52 -#: src/view/UsersDialog.cpp:107 +#: src/view/UsersDialog.cpp:53 +#: src/view/UsersDialog.cpp:109 msgid "New User" msgstr "Nouvel utilisateur" @@ -410,7 +400,7 @@ msgstr "" "Aucune base de données trouvée, voulez vous en créer une nouvelle ?\n" "\n" -#: src/view/SearchPanel.cpp:231 +#: src/view/SearchPanel.cpp:248 msgid "No entry found" msgstr "Pas d'entrée trouvée" @@ -418,16 +408,21 @@ msgstr "Pas d'entrée trouvée" msgid "Non fix" msgstr "Courantes" +#: src/view/PreferencesPanel.cpp:429 +#: src/view/PreferencesPanel.cpp:689 +msgid "None" +msgstr "Aucun" + #: src/view/SearchPanel.cpp:76 msgid "Not checked" msgstr "Non rapprochée" -#: src/view/PreferencesPanel.cpp:185 +#: src/view/PreferencesPanel.cpp:197 msgid "Number" msgstr "Numéro de compte" -#: src/view/UsersDialog.cpp:50 -#: src/view/GenerateDialog.cpp:59 +#: src/view/UsersDialog.cpp:51 +#: src/view/GenerateDialog.cpp:60 #: src/view/PasswordDialog.cpp:55 msgid "OK" msgstr "OK" @@ -436,23 +431,24 @@ msgstr "OK" msgid "Old password " msgstr "Ancien mot de passe " -#: src/controller/KissCount.cpp:365 +#: src/controller/KissCount.cpp:385 msgid "Operating exepense" msgstr "Fonctionnement" -#: src/view/PreferencesPanel.cpp:62 +#: src/view/PreferencesPanel.cpp:63 msgid "Operation order" msgstr "Ordre des opérations" -#: src/view/ButtonPanel.cpp:69 +#: src/view/SearchPanel.cpp:89 +#: src/view/AccountPanel.cpp:175 msgid "Operations" msgstr "Opérations" -#: src/controller/KissCount.cpp:369 +#: src/controller/KissCount.cpp:389 msgid "Other" msgstr "Autres" -#: src/view/UsersDialog.cpp:43 +#: src/view/UsersDialog.cpp:44 msgid "Password " msgstr "Mot de passe " @@ -460,7 +456,7 @@ msgstr "Mot de passe " msgid "Password changed" msgstr "Mot de passe changé" -#: src/view/ButtonPanel.cpp:105 +#: src/view/wxUI.cpp:245 msgid "" "Personal accounting software\n" "\n" @@ -468,7 +464,7 @@ msgid "" "\n" "Licenced under GNU GPL v3\n" "\n" -"Copyright (C) 2010 Grégory Soutadé" +"Copyright (C) 2010-2011 Grégory Soutadé" msgstr "" "Logiciel de comptabilité personnelle\n" "\n" @@ -476,15 +472,15 @@ msgstr "" "\n" "Licence GNU GPL v3\n" "\n" -"Copyright (C) 2010 Grégory Soutadé" +"Copyright (C) 2010-2011 Grégory Soutadé" #: src/view/PasswordDialog.cpp:78 msgid "Please retype new password" msgstr "Re entrez le mot de passe" -#: src/view/PreferencesPanel.cpp:741 -#: src/view/PreferencesPanel.cpp:775 -#: src/view/ButtonPanel.cpp:72 +#: src/view/PreferencesPanel.cpp:184 +#: src/view/PreferencesPanel.cpp:783 +#: src/view/PreferencesPanel.cpp:817 msgid "Preferences" msgstr "Préférences" @@ -492,35 +488,31 @@ msgstr "Préférences" msgid "Query failed !\n" msgstr "La requête a échouée !\n" -#: src/view/ButtonPanel.cpp:75 -msgid "Quit" -msgstr "Quitter" - -#: src/view/ButtonPanel.cpp:112 +#: src/view/wxUI.cpp:252 msgid "Quit KissCount ?" msgstr "Quitter KissCount ?" -#: src/view/AccountPanel.cpp:204 +#: src/view/AccountPanel.cpp:217 msgid "Remains" msgstr "Restant" -#: src/view/SearchPanel.cpp:84 -#: src/view/SearchPanel.cpp:242 -#: src/view/ButtonPanel.cpp:71 +#: src/view/SearchPanel.cpp:83 +#: src/view/SearchPanel.cpp:143 +#: src/view/SearchPanel.cpp:259 msgid "Search" msgstr "Chercher" -#: src/view/StatsPanel.cpp:122 +#: src/view/StatsPanel.cpp:120 #: src/view/AccountPanel.cpp:90 msgid "Serie 1" msgstr "Série 1" -#: src/view/PreferencesPanel.cpp:63 +#: src/view/PreferencesPanel.cpp:64 msgid "Shared with" msgstr "Partagé avec" -#: src/view/StatsPanel.cpp:327 -#: src/view/ButtonPanel.cpp:70 +#: src/view/StatsPanel.cpp:160 +#: src/view/StatsPanel.cpp:358 msgid "Statistics" msgstr "Statistiques" @@ -528,15 +520,15 @@ msgstr "Statistiques" msgid "To" msgstr "A" -#: src/view/GenerateDialog.cpp:52 +#: src/view/GenerateDialog.cpp:53 msgid "To " msgstr "Vers " -#: src/view/AccountPanel.cpp:186 +#: src/view/AccountPanel.cpp:199 msgid "Total Credit" msgstr "Total Crédit" -#: src/view/AccountPanel.cpp:187 +#: src/view/AccountPanel.cpp:200 msgid "Total Debit" msgstr "Total Débit" @@ -551,7 +543,7 @@ msgstr "Dégrouper" msgid "Unable to open Database" msgstr "Impossible d'ouvrir la base de données" -#: src/controller/KissCount.cpp:367 +#: src/controller/KissCount.cpp:387 msgid "Unexpected" msgstr "Exceptionnel" @@ -565,13 +557,13 @@ msgstr "Inconnu" msgid "Update failed !\n" msgstr "La mise à jour à échouée !\n" -#: src/view/PreferencesPanel.cpp:58 +#: src/view/PreferencesPanel.cpp:59 msgid "User" msgstr "Utilisateur" -#: src/view/UsersDialog.cpp:38 -#: src/view/UsersDialog.cpp:118 -#: src/view/PreferencesPanel.cpp:733 +#: src/view/UsersDialog.cpp:39 +#: src/view/UsersDialog.cpp:120 +#: src/view/PreferencesPanel.cpp:775 msgid "User " msgstr "Utilisateur " @@ -579,62 +571,76 @@ msgstr "Utilisateur " msgid "Users" msgstr "Utilisateurs" -#: src/view/grid/GridAccount.cpp:1022 +#: src/view/grid/GridAccount.cpp:1037 msgid "Warning" msgstr "Attention" -#: src/view/grid/GridAccount.cpp:1022 +#: src/view/PreferencesPanel.cpp:434 +msgid "Wich account will replace this one ?" +msgstr "Quel compte va remplacer celui-ci ?" + +#: src/view/PreferencesPanel.cpp:694 +msgid "Wich category will replace this one ?" +msgstr "Quelle catégorie va remplacer celle-ci" + +#: src/view/grid/GridAccount.cpp:1037 msgid "You made a debit on a blocked account" msgstr "Vous avez effectué une opération de débit sur un compte bloqué" -#: src/view/wxUI.cpp:110 +#: src/view/wxUI.cpp:125 msgid "april" msgstr "avril" -#: src/view/wxUI.cpp:114 +#: src/view/wxUI.cpp:129 msgid "august" msgstr "août" -#: src/view/wxUI.cpp:118 +#: src/view/wxUI.cpp:133 msgid "december" msgstr "décembre" -#: src/view/wxUI.cpp:108 +#: src/view/wxUI.cpp:123 msgid "february" msgstr "février" -#: src/view/wxUI.cpp:107 +#: src/view/wxUI.cpp:122 msgid "january" msgstr "janvier" -#: src/view/wxUI.cpp:113 +#: src/view/wxUI.cpp:128 msgid "july" msgstr "juillet" -#: src/view/wxUI.cpp:112 +#: src/view/wxUI.cpp:127 msgid "june" msgstr "juin" -#: src/view/wxUI.cpp:109 +#: src/view/wxUI.cpp:124 msgid "march" msgstr "mars" -#: src/view/wxUI.cpp:111 +#: src/view/wxUI.cpp:126 msgid "may" msgstr "mai" -#: src/view/wxUI.cpp:117 +#: src/view/wxUI.cpp:132 msgid "november" msgstr "novembre" -#: src/view/wxUI.cpp:116 +#: src/view/wxUI.cpp:131 msgid "october" msgstr "octobre" -#: src/view/wxUI.cpp:115 +#: src/view/wxUI.cpp:130 msgid "september" msgstr "septembre" +#~ msgid "About" +#~ msgstr "A propos" +#~ msgid "Change user" +#~ msgstr "Changer d'utilisateur" +#~ msgid "Quit" +#~ msgstr "Quitter" #~ msgid "Both" #~ msgstr "Les deux" #~ msgid "Color" diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 78c114b..118038d 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,21 +8,22 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-05 20:46+0100\n" +"POT-Creation-Date: 2011-02-08 21:12+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/view/StatsPanel.cpp:358 src/view/PreferencesPanel.cpp:799 +#: src/view/StatsPanel.cpp:358 src/view/PreferencesPanel.cpp:817 msgid " - " msgstr "" -#: src/view/PreferencesPanel.cpp:474 src/view/PreferencesPanel.cpp:494 -#: src/view/PreferencesPanel.cpp:696 src/view/PreferencesPanel.cpp:715 -#: src/view/PreferencesPanel.cpp:757 src/view/UsersDialog.cpp:120 +#: src/view/UsersDialog.cpp:120 src/view/PreferencesPanel.cpp:485 +#: src/view/PreferencesPanel.cpp:505 src/view/PreferencesPanel.cpp:714 +#: src/view/PreferencesPanel.cpp:733 src/view/PreferencesPanel.cpp:775 msgid " already exists" msgstr "" @@ -38,7 +39,7 @@ msgstr "" msgid " operations ?" msgstr "" -#: src/view/PreferencesPanel.cpp:806 +#: src/view/PreferencesPanel.cpp:824 msgid " profil ?" msgstr "" @@ -54,11 +55,11 @@ msgstr "" msgid "Account" msgstr "" -#: src/view/PreferencesPanel.cpp:474 src/view/PreferencesPanel.cpp:494 +#: src/view/PreferencesPanel.cpp:485 src/view/PreferencesPanel.cpp:505 msgid "Account " msgstr "" -#: src/controller/KissCount.cpp:350 +#: src/controller/KissCount.cpp:363 msgid "Account 1" msgstr "" @@ -82,12 +83,11 @@ msgstr "" msgid "Amount to" msgstr "" -#: src/view/AccountPanel.cpp:752 src/view/PreferencesPanel.cpp:426 -#: src/view/PreferencesPanel.cpp:806 +#: src/view/PreferencesPanel.cpp:824 src/view/AccountPanel.cpp:752 msgid "Are you sure want to delete " msgstr "" -#: src/view/PreferencesPanel.cpp:676 src/view/grid/GridAccount.cpp:829 +#: src/view/grid/GridAccount.cpp:829 msgid "Are you sure want to delete : \n" msgstr "" @@ -103,16 +103,16 @@ msgstr "" msgid "Blocked" msgstr "" -#: src/view/GenerateDialog.cpp:61 src/view/PasswordDialog.cpp:56 -#: src/view/UsersDialog.cpp:52 +#: src/view/UsersDialog.cpp:52 src/view/GenerateDialog.cpp:61 +#: src/view/PasswordDialog.cpp:56 msgid "Cancel" msgstr "" -#: src/view/grid/GridAccount.cpp:1260 src/view/grid/GridAccount.cpp:1267 +#: src/view/grid/GridAccount.cpp:1263 src/view/grid/GridAccount.cpp:1270 msgid "Cannot group these operations" msgstr "" -#: src/view/grid/GridAccount.cpp:1386 src/view/grid/GridAccount.cpp:1392 +#: src/view/grid/GridAccount.cpp:1389 src/view/grid/GridAccount.cpp:1395 msgid "Cannot ungroup these operations" msgstr "" @@ -124,7 +124,7 @@ msgstr "" msgid "Category" msgstr "" -#: src/view/PreferencesPanel.cpp:696 src/view/PreferencesPanel.cpp:715 +#: src/view/PreferencesPanel.cpp:714 src/view/PreferencesPanel.cpp:733 msgid "Category " msgstr "" @@ -152,7 +152,7 @@ msgstr "" msgid "Confirm password " msgstr "" -#: src/view/AccountPanel.cpp:116 src/view/StatsPanel.cpp:128 +#: src/view/StatsPanel.cpp:128 src/view/AccountPanel.cpp:116 msgid "Cost repartition" msgstr "" @@ -192,8 +192,8 @@ msgstr "" msgid "Default" msgstr "" -#: src/view/AccountPanel.cpp:611 src/view/PreferencesPanel.cpp:200 -#: src/view/PreferencesPanel.cpp:288 +#: src/view/PreferencesPanel.cpp:200 src/view/PreferencesPanel.cpp:288 +#: src/view/AccountPanel.cpp:611 msgid "Delete" msgstr "" @@ -205,21 +205,21 @@ msgstr "" msgid "Description" msgstr "" -#: src/model/Database.cpp:38 src/model/Database.cpp:55 -#: src/model/Database.cpp:95 src/model/Database.cpp:102 -#: src/model/Database.cpp:120 src/model/Database.cpp:147 -#: src/model/Database.cpp:155 src/model/Database.cpp:176 -#: src/view/AccountPanel.cpp:748 src/view/PasswordDialog.cpp:72 -#: src/view/PasswordDialog.cpp:78 src/view/PreferencesPanel.cpp:422 -#: src/view/PreferencesPanel.cpp:474 src/view/PreferencesPanel.cpp:494 -#: src/view/PreferencesPanel.cpp:696 src/view/PreferencesPanel.cpp:715 -#: src/view/PreferencesPanel.cpp:751 src/view/PreferencesPanel.cpp:757 +#: src/view/UsersDialog.cpp:90 src/view/UsersDialog.cpp:120 #: src/view/SearchPanel.cpp:158 src/view/SearchPanel.cpp:168 #: src/view/SearchPanel.cpp:182 src/view/SearchPanel.cpp:193 -#: src/view/UsersDialog.cpp:90 src/view/UsersDialog.cpp:120 -#: src/view/grid/GridAccount.cpp:1260 src/view/grid/GridAccount.cpp:1267 -#: src/view/grid/GridAccount.cpp:1386 src/view/grid/GridAccount.cpp:1392 -#: src/view/grid/wxGridCellFormulaEditor.cpp:69 +#: src/view/PreferencesPanel.cpp:422 src/view/PreferencesPanel.cpp:485 +#: src/view/PreferencesPanel.cpp:505 src/view/PreferencesPanel.cpp:714 +#: src/view/PreferencesPanel.cpp:733 src/view/PreferencesPanel.cpp:769 +#: src/view/PreferencesPanel.cpp:775 src/view/PasswordDialog.cpp:72 +#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:748 +#: src/view/grid/GridAccount.cpp:1263 src/view/grid/GridAccount.cpp:1270 +#: src/view/grid/GridAccount.cpp:1389 src/view/grid/GridAccount.cpp:1395 +#: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:38 +#: src/model/Database.cpp:55 src/model/Database.cpp:95 +#: src/model/Database.cpp:102 src/model/Database.cpp:120 +#: src/model/Database.cpp:147 src/model/Database.cpp:155 +#: src/model/Database.cpp:176 msgid "Error" msgstr "" @@ -231,8 +231,8 @@ msgstr "" msgid "Final value" msgstr "" -#: src/controller/KissCount.cpp:366 src/model/Database.cpp:331 #: src/view/SearchPanel.cpp:76 src/view/grid/GridAccount.cpp:326 +#: src/model/Database.cpp:331 src/controller/KissCount.cpp:379 msgid "Fix" msgstr "" @@ -252,11 +252,11 @@ msgstr "" msgid "From " msgstr "" -#: src/view/AccountPanel.cpp:608 src/view/GenerateDialog.cpp:31 +#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:608 msgid "Generate month" msgstr "" -#: src/controller/KissCount.cpp:368 +#: src/controller/KissCount.cpp:381 msgid "Groceries" msgstr "" @@ -264,7 +264,7 @@ msgstr "" msgid "Group" msgstr "" -#: src/controller/KissCount.cpp:370 +#: src/controller/KissCount.cpp:383 msgid "Hobbies" msgstr "" @@ -292,7 +292,7 @@ msgstr "" msgid "Invalid formula !" msgstr "" -#: src/view/PreferencesPanel.cpp:751 +#: src/view/PreferencesPanel.cpp:769 msgid "Invalid name" msgstr "" @@ -320,8 +320,8 @@ msgstr "" msgid "Kill me" msgstr "" -#: src/view/StatsPanel.cpp:377 src/view/PreferencesPanel.cpp:791 -#: src/view/PreferencesPanel.cpp:794 +#: src/view/StatsPanel.cpp:377 src/view/PreferencesPanel.cpp:809 +#: src/view/PreferencesPanel.cpp:812 msgid "KissCount" msgstr "" @@ -329,11 +329,11 @@ msgstr "" msgid "Language" msgstr "" -#: src/view/PreferencesPanel.cpp:794 +#: src/view/PreferencesPanel.cpp:812 msgid "Language not changed" msgstr "" -#: src/view/PreferencesPanel.cpp:791 +#: src/view/PreferencesPanel.cpp:809 msgid "Language successfully changed, please go to another panel" msgstr "" @@ -342,7 +342,7 @@ msgstr "" msgid "Name" msgstr "" -#: src/view/PreferencesPanel.cpp:763 +#: src/view/PreferencesPanel.cpp:781 msgid "Name changed" msgstr "" @@ -368,6 +368,10 @@ msgstr "" msgid "Non fix" msgstr "" +#: src/view/PreferencesPanel.cpp:429 src/view/PreferencesPanel.cpp:689 +msgid "None" +msgstr "" + #: src/view/SearchPanel.cpp:76 msgid "Not checked" msgstr "" @@ -376,8 +380,8 @@ msgstr "" msgid "Number" msgstr "" -#: src/view/GenerateDialog.cpp:60 src/view/PasswordDialog.cpp:55 -#: src/view/UsersDialog.cpp:51 +#: src/view/UsersDialog.cpp:51 src/view/GenerateDialog.cpp:60 +#: src/view/PasswordDialog.cpp:55 msgid "OK" msgstr "" @@ -385,7 +389,7 @@ msgstr "" msgid "Old password " msgstr "" -#: src/controller/KissCount.cpp:372 +#: src/controller/KissCount.cpp:385 msgid "Operating exepense" msgstr "" @@ -393,11 +397,11 @@ msgstr "" msgid "Operation order" msgstr "" -#: src/view/AccountPanel.cpp:175 src/view/SearchPanel.cpp:89 +#: src/view/SearchPanel.cpp:89 src/view/AccountPanel.cpp:175 msgid "Operations" msgstr "" -#: src/controller/KissCount.cpp:376 +#: src/controller/KissCount.cpp:389 msgid "Other" msgstr "" @@ -424,8 +428,8 @@ msgstr "" msgid "Please retype new password" msgstr "" -#: src/view/PreferencesPanel.cpp:184 src/view/PreferencesPanel.cpp:765 -#: src/view/PreferencesPanel.cpp:799 +#: src/view/PreferencesPanel.cpp:184 src/view/PreferencesPanel.cpp:783 +#: src/view/PreferencesPanel.cpp:817 msgid "Preferences" msgstr "" @@ -446,7 +450,7 @@ msgstr "" msgid "Search" msgstr "" -#: src/view/AccountPanel.cpp:90 src/view/StatsPanel.cpp:120 +#: src/view/StatsPanel.cpp:120 src/view/AccountPanel.cpp:90 msgid "Serie 1" msgstr "" @@ -483,7 +487,7 @@ msgstr "" msgid "Unable to open Database" msgstr "" -#: src/controller/KissCount.cpp:374 +#: src/controller/KissCount.cpp:387 msgid "Unexpected" msgstr "" @@ -499,8 +503,8 @@ msgstr "" msgid "User" msgstr "" -#: src/view/PreferencesPanel.cpp:757 src/view/UsersDialog.cpp:39 -#: src/view/UsersDialog.cpp:120 +#: src/view/UsersDialog.cpp:39 src/view/UsersDialog.cpp:120 +#: src/view/PreferencesPanel.cpp:775 msgid "User " msgstr "" @@ -512,6 +516,14 @@ msgstr "" msgid "Warning" msgstr "" +#: src/view/PreferencesPanel.cpp:434 +msgid "Wich account will replace this one ?" +msgstr "" + +#: src/view/PreferencesPanel.cpp:694 +msgid "Wich category will replace this one ?" +msgstr "" + #: src/view/grid/GridAccount.cpp:1037 msgid "You made a debit on a blocked account" msgstr "" diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 47df870..a8c6245 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -194,18 +194,24 @@ void KissCount::UpdateAccount(Account& ac) std::sort(_user->_accounts.begin(), _user->_accounts.end(), sortAccounts); } -void KissCount::DeleteAccount(Account& ac) +void KissCount::DeleteAccount(Account& ac, const wxString& replacement) { std::vector::iterator it; int i; + std::map >* >::iterator it2; - _db->DeleteAccount(_user, ac); + _db->DeleteAccount(_user, ac, replacement); for (i=0, it=_user->_accounts.begin(); it !=_user->_accounts.end(); it++, i++) if (it->id == ac.id) { _user->_accounts.erase(_user->_accounts.begin()+i); break; } + + for (it2= _user->_operations.begin(); + it2 != _user->_operations.end(); + it2++) + LoadYear(it2->first, true); } void KissCount::AddSharedAccount(Account& ac, const wxString& granted) @@ -253,9 +259,11 @@ void KissCount::UpdateCategory(Category& category) } } -void KissCount::DeleteCategory(Category& category) +void KissCount::DeleteCategory(Category& category, const wxString& replacement) { - _db->DeleteCategory(_user, category); + std::map >* >::iterator it; + + _db->DeleteCategory(_user, category, replacement); for (int i=0; i<_user->GetCategoriesNumber();i++) if (_user->_categories[i].id == category.id) @@ -264,6 +272,11 @@ void KissCount::DeleteCategory(Category& category) _user->_categoriesFonts.erase(_user->_categoriesFonts.begin()+i); break; } + + for (it= _user->_operations.begin(); + it != _user->_operations.end(); + it++) + LoadYear(it->first, true); } std::map > KissCount::GetAllOperations() diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index 9f60ee6..b27fbda 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -64,7 +64,7 @@ public: wxString AddAccount(Account& ac); void UpdateAccount(Account& ac); - void DeleteAccount(Account& ac); + void DeleteAccount(Account& ac, const wxString& replacement); void AddSharedAccount(Account& ac, const wxString& granted); void RemoveSharedAccount(Account& ac, const wxString& granted); std::map getSharedAccountOwners(const wxString& account); @@ -72,7 +72,7 @@ public: wxString AddCategory(Category& category); void UpdateCategory(Category& category); - void DeleteCategory(Category& category); + void DeleteCategory(Category& category, const wxString& replacement); std::map > GetAllOperations(); diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 1a81dac..96ac4cb 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -853,7 +853,7 @@ void Database::UpdateAccount(Account& ac) } } -void Database::DeleteAccount(User* user, Account& ac) +void Database::DeleteAccount(User* user, Account& ac, const wxString& replacement) { wxString req; @@ -872,6 +872,12 @@ void Database::DeleteAccount(User* user, Account& ac) req = wxT("DELETE FROM account_amount WHERE account='") + ac.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); + + req = wxT("UPDATE operation SET account='") + replacement + wxT("'"); + // req += wxT(", transfert='0'"); + req += wxT(" WHERE account='") + ac.id + wxT("'"); + + EXECUTE_SQL_UPDATE(req, ); } else RemoveSharedAccount(ac, user->_id); @@ -973,7 +979,7 @@ void Database::UpdateCategory(Category& category) EXECUTE_SQL_UPDATE(req, ); } -void Database::DeleteCategory(User* user, Category& category) +void Database::DeleteCategory(User* user, Category& category, const wxString& replacement) { wxString req; @@ -986,6 +992,12 @@ void Database::DeleteCategory(User* user, Category& category) req += wxT(" WHERE parent='") + category.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); + + req = wxT("UPDATE operation SET category='") + replacement + wxT("'"); + req += wxT(" WHERE category='") + category.id + wxT("'"); + req += wxT(" AND user='") + user->_id + wxT("'"); + + EXECUTE_SQL_UPDATE(req, ); } bool Database::LoadCategory(const wxString& id, const wxString& name, Category& category) @@ -1217,7 +1229,7 @@ void Database::KillMe(User* user) if (!user->_accounts.empty()) { for (it = user->_accounts.begin(); it != user->_accounts.end(); it++) - DeleteAccount(user, *it); + DeleteAccount(user, *it, wxT("0")); it = user->_accounts.begin(); if (it->is_owner) diff --git a/src/model/Database.h b/src/model/Database.h index bced1e4..fbf037e 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -66,13 +66,13 @@ public: wxString AddAccount(User* user, Account& ac); void UpdateAccount(Account& ac); - void DeleteAccount(User* user, Account& ac); + void DeleteAccount(User* user, Account& ac, const wxString& replacement); void AddSharedAccount(Account& ac, const wxString& granted); void RemoveSharedAccount(Account& ac, const wxString& granted); wxString AddCategory(User* user, Category& category); void UpdateCategory(Category& category); - void DeleteCategory(User* user, Category& category); + void DeleteCategory(User* user, Category& category, const wxString& replacement); bool LoadCategory(const wxString& id, const wxString& name, Category& category); std::map > GetAllOperations(User* user); diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index bc62be6..b554341 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -376,7 +376,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) int row = event.GetRow(); int col = event.GetCol(); static bool inModification = false ; - int i; + int i, a; if (inModification) return; @@ -423,15 +423,23 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) _accountsGrid->SetCellValue(row, col, wxT("0")); return; } - wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+new_account.name, wxT("KissCount"), wxYES_NO); - if (dialog.ShowModal() == wxID_NO) + wxString *accounts = new wxString[user->GetAccountsNumber()]; + accounts[0] = _("None"); + a = 0; + for(i=0; i < user->GetAccountsNumber(); i++) + if (user->_accounts[i].id != new_account.id) + accounts[++a] = user->_accounts[i].name; + wxSingleChoiceDialog dialog(_wxUI, _("Wich account will replace this one ?"), wxT("KissCount"), user->GetAccountsNumber(), accounts); + + if (dialog.ShowModal() == wxID_CANCEL) { - _accountsGrid->SetCellValue(row, col, wxT("0")); + _accountsGrid->SetCellValue(row, col, wxT("0")); } - else + else { - _accountsGrid->DeleteRows(row, 1); - _kiss->DeleteAccount(new_account); + _accountsGrid->DeleteRows(row, 1); + i = dialog.GetSelection(); + _kiss->DeleteAccount(new_account, (!i) ? wxT("0") : user->_accounts[i].id); } if (user->_accounts.size() == 1) @@ -591,6 +599,7 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) int col = event.GetCol(); static bool inModification = false ; Category new_cat, cat_tmp; + int i, a; if (inModification) return; @@ -673,19 +682,25 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) new_cat.id = user->_categories[row].id; if (col == CATEGORY_DELETE) { - wxMessageDialog dialog(_wxUI, _("Are you sure want to delete : \n")+new_cat.name, wxT("KissCount"), wxYES_NO); - if (dialog.ShowModal() == wxID_NO) + wxString *categories = new wxString[user->GetCategoriesNumber()]; + categories[0] = _("None"); + a = 0; + for(i=0; i < user->GetCategoriesNumber(); i++) + if (user->_categories[i].id != new_cat.id) + categories[++a] = user->_categories[i].name; + wxSingleChoiceDialog dialog(_wxUI, _("Wich category will replace this one ?"), wxT("KissCount"), user->GetCategoriesNumber(), categories); + if (dialog.ShowModal() == wxID_CANCEL) { - _categoriesGrid->SetCellValue(row, col, wxT("0")); + _categoriesGrid->SetCellValue(row, col, wxT("0")); } - else + else { - _categoriesGrid->DeleteRows(row, 1); - _kiss->DeleteCategory(user->_categories[row]); + _categoriesGrid->DeleteRows(row, 1); + i = dialog.GetSelection(); + _kiss->DeleteCategory(user->_categories[row], (!i) ? wxT("0") : user->_accounts[i].id); + Fit(); + _wxUI->NeedReload(); } - - Fit(); - _wxUI->NeedReload(); inModification = false; return; } From aec66e72121712895ed7c738668141d07040837b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Wed, 9 Feb 2011 20:50:21 +0100 Subject: [PATCH 29/72] Bugs on precedent commit --- src/model/Database.cpp | 8 ++++++++ src/model/User.cpp | 10 +++++----- src/model/User.h | 10 +++++----- src/view/PreferencesPanel.cpp | 4 ++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 96ac4cb..29b0abd 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -998,6 +998,14 @@ void Database::DeleteCategory(User* user, Category& category, const wxString& re req += wxT(" AND user='") + user->_id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); + + if (replacement == user->_categories[0].id) + { + req = wxT("UPDATE operation SET fix_cost='1'"); + req += wxT(" WHERE category='") + replacement + wxT("'"); + + EXECUTE_SQL_UPDATE(req, ); + } } bool Database::LoadCategory(const wxString& id, const wxString& name, Category& category) diff --git a/src/model/User.cpp b/src/model/User.cpp index 8a905f5..60a6154 100644 --- a/src/model/User.cpp +++ b/src/model/User.cpp @@ -35,7 +35,7 @@ User::~User() } } -Category User::GetCategory(wxString& catId) +Category User::GetCategory(const wxString& catId) { Category cat; std::vector::iterator it; @@ -57,7 +57,7 @@ Category User::GetCategory(wxString& catId) return cat; } -wxString User::GetCategoryName(wxString& catId) +wxString User::GetCategoryName(const wxString& catId) { Category cat; std::vector::iterator it; @@ -72,7 +72,7 @@ wxString User::GetCategoryName(wxString& catId) return _("Unknown") ; } -wxString User::GetCategoryId(wxString& catName) +wxString User::GetCategoryId(const wxString& catName) { std::vector::iterator it; Category cat; @@ -87,7 +87,7 @@ wxString User::GetCategoryId(wxString& catName) return wxT("0") ; } -const wxFont User::GetCategoryFont(wxString& catId) +const wxFont User::GetCategoryFont(const wxString& catId) { wxFont f; Category cat; @@ -120,7 +120,7 @@ wxString User::GetAccountName(const wxString& accountId) return _("Unknown") ; } -wxString User::GetAccountId(wxString& accountName) +wxString User::GetAccountId(const wxString& accountName) { std::vector::iterator it; for (it=_accounts.begin(); it !=_accounts.end(); it++) diff --git a/src/model/User.h b/src/model/User.h index e24b14b..b7062fd 100644 --- a/src/model/User.h +++ b/src/model/User.h @@ -47,14 +47,14 @@ public: std::vector _categoriesFonts; std::map _preferences; - Category GetCategory(wxString& catId); - wxString GetCategoryName(wxString& catId); - wxString GetCategoryId(wxString& catName); - const wxFont GetCategoryFont(wxString& catId); + Category GetCategory(const wxString& catId); + wxString GetCategoryName(const wxString& catId); + wxString GetCategoryId(const wxString& catName); + const wxFont GetCategoryFont(const wxString& catId); Account GetAccount(const wxString& accountId); wxString GetAccountName(const wxString& accountId); - wxString GetAccountId(wxString& accountName); + wxString GetAccountId(const wxString& accountName); int GetCategoriesNumber(); int GetAccountsNumber(); diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index b554341..ccd9438 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -439,7 +439,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) { _accountsGrid->DeleteRows(row, 1); i = dialog.GetSelection(); - _kiss->DeleteAccount(new_account, (!i) ? wxT("0") : user->_accounts[i].id); + _kiss->DeleteAccount(new_account, (!i) ? wxT("0") : user->GetAccountId(accounts[i])); } if (user->_accounts.size() == 1) @@ -697,7 +697,7 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) { _categoriesGrid->DeleteRows(row, 1); i = dialog.GetSelection(); - _kiss->DeleteCategory(user->_categories[row], (!i) ? wxT("0") : user->_accounts[i].id); + _kiss->DeleteCategory(user->_categories[row], (!i) ? wxT("0") : user->GetCategoryId(categories[i])); Fit(); _wxUI->NeedReload(); } From ab176b9fc3a3f04b2e514dea91d2505519d9e6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Wed, 9 Feb 2011 21:36:29 +0100 Subject: [PATCH 30/72] Possibility to find operations with unknown category/account --- ChangeLog | 3 ++- src/model/Database.cpp | 6 +++--- src/view/SearchPanel.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c823bfa..8e01e19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2_dev (29/01/2011) +v0.2_dev (09/02/2011) ** User ** Better use of sizers (so better interface!) @@ -6,6 +6,7 @@ v0.2_dev (29/01/2011) Better fit of interface when displaying grouped operations Show stats for current month even if next month has not been generated Possibility to choose a replacement when deleting accounts and categories + Possibility to find operations with unknown category/account ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 29b0abd..7543b48 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1421,8 +1421,8 @@ std::vector* Database::Search(User* user, wxString* description, wxDa for (; it != accounts.end(); it++) req += wxT("', '") + *it ; - req += wxT("')"); - req += wxT(" OR user ='") + user->_id + wxT("')"); + req += wxT("'))"); + // req += wxT(" OR user ='") + user->_id + wxT("')"); } else { @@ -1443,7 +1443,7 @@ std::vector* Database::Search(User* user, wxString* description, wxDa req += wxT(", month ") + user->_preferences[wxT("operation_order")] ; req += wxT(", day ") + user->_preferences[wxT("operation_order")] ; - // std::cout << req.mb_str() << "\n"; + std::cout << req.mb_str() << "\n"; EXECUTE_SQL_QUERY(req, set, res); diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 28df4c8..d7ed322 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -70,6 +70,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _amountTo = new wxTextCtrl(this, wxID_ANY); _category = new wxCheckListBox(this, wxID_ANY); + _category->Append(_("Unknown")); for(categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++) _category->Append(categoryIt->name); @@ -77,6 +78,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _optype = new wxCheckListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, stypes); _account = new wxCheckListBox(this, wxID_ANY); + _account->Append(_("Unknown")); for(accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); accountIt++) _account->Append(accountIt->name); @@ -223,7 +225,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event) for(i=0; iGetCategoriesNumber(); i++) if (_category->IsChecked(i)) - categories.push_back(user->_categories[i].id); + categories.push_back((i) ? user->_categories[i].id : wxT("0")); types |= (_optype->IsChecked(0)) ? FIX_OP : 0; types |= (_optype->IsChecked(1)) ? NON_FIX_OP : 0; @@ -232,7 +234,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event) for(i=0; iGetAccountsNumber(); i++) if (_account->IsChecked(i)) - accounts.push_back(user->_accounts[i].id); + accounts.push_back((i) ? user->_accounts[i].id : wxT("0")); if (_operations) delete _operations; From 142837b59eb9b519b96fa80bfc1b8c964e749a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 10 Feb 2011 20:04:33 +0100 Subject: [PATCH 31/72] Bug in previous commit --- src/model/Database.cpp | 2 +- src/view/SearchPanel.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 7543b48..7172458 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1443,7 +1443,7 @@ std::vector* Database::Search(User* user, wxString* description, wxDa req += wxT(", month ") + user->_preferences[wxT("operation_order")] ; req += wxT(", day ") + user->_preferences[wxT("operation_order")] ; - std::cout << req.mb_str() << "\n"; + // std::cout << req.mb_str() << "\n"; EXECUTE_SQL_QUERY(req, set, res); diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index d7ed322..f8aae6f 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -225,7 +225,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event) for(i=0; iGetCategoriesNumber(); i++) if (_category->IsChecked(i)) - categories.push_back((i) ? user->_categories[i].id : wxT("0")); + categories.push_back((i) ? user->_categories[i-1].id : wxT("0")); types |= (_optype->IsChecked(0)) ? FIX_OP : 0; types |= (_optype->IsChecked(1)) ? NON_FIX_OP : 0; @@ -234,7 +234,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event) for(i=0; iGetAccountsNumber(); i++) if (_account->IsChecked(i)) - accounts.push_back((i) ? user->_accounts[i].id : wxT("0")); + accounts.push_back((i) ? user->_accounts[i-1].id : wxT("0")); if (_operations) delete _operations; From c03562851a7af53682ca584f5159e69b4deea486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 13 Feb 2011 19:30:12 +0100 Subject: [PATCH 32/72] Possibility to work on multiple operations (rename, change category, change account) New database version (2) : fix_cost for categories virtual account --- ChangeLog | 7 +- init.sql | 6 +- ressources/po/french.mo | Bin 7564 -> 7754 bytes ressources/po/french.po | 193 ++++++++++-------- ressources/po/kisscount.pot | 149 ++++++++------ src/ParseExp.cpp | 2 +- src/controller/KissCount.cpp | 14 +- src/main.cpp | 2 +- src/model/Category.h | 1 + src/model/Database.cpp | 87 ++------ src/model/Database.h | 59 ++++++ src/model/Database_Update.cpp | 130 ++++++++++++ src/model/User.cpp | 9 +- src/model/User.h | 1 + src/sha1.cpp | 2 +- src/view/AccountPanel.cpp | 2 +- src/view/GenerateDialog.cpp | 2 +- src/view/PasswordDialog.cpp | 2 +- src/view/PreferencesPanel.cpp | 5 +- src/view/SearchPanel.cpp | 157 +++++++++++++- src/view/SearchPanel.h | 8 +- src/view/StatsPanel.cpp | 4 +- src/view/SupportedLanguages.cpp | 2 +- src/view/UsersDialog.cpp | 2 +- src/view/grid/CalendarEditor.cpp | 2 +- src/view/grid/GridAccount.cpp | 62 +++++- src/view/grid/GridAccount.h | 10 +- src/view/grid/wxGridCellBitmapRenderer.cpp | 2 +- src/view/grid/wxGridCellButtonEditor.cpp | 2 +- src/view/grid/wxGridCellButtonRenderer.cpp | 2 +- src/view/grid/wxGridCellFormulaEditor.cpp | 2 +- src/view/grid/wxGridCellTabStringRenderer.cpp | 2 +- src/view/grid/wxGridCellTreeButtonEditor.cpp | 2 +- .../grid/wxGridCellTreeButtonRenderer.cpp | 2 +- src/view/wxGridCellStarEditor.cpp | 2 +- src/view/wxUI.cpp | 4 +- www/User.php | 2 +- www/database.php | 2 +- www/index.php | 4 +- www/kisscount.php | 2 +- 40 files changed, 682 insertions(+), 268 deletions(-) create mode 100644 src/model/Database_Update.cpp diff --git a/ChangeLog b/ChangeLog index 8e01e19..8dddf06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2_dev (09/02/2011) +v0.2_dev (13/02/2011) ** User ** Better use of sizers (so better interface!) @@ -7,11 +7,16 @@ v0.2_dev (09/02/2011) Show stats for current month even if next month has not been generated Possibility to choose a replacement when deleting accounts and categories Possibility to find operations with unknown category/account + Possibility to work on multiple operations (rename, change category, change account) ** Dev ** Use a factory to create panels (prepare for plug-in) Better cross compilation support (Makefile and package.sh) Update Copyright + New database version (2) : + fix_cost for categories + virtual account + Database checking & upgrading ** Bugs ** Bug on GenerateMonth with different years diff --git a/init.sql b/init.sql index 08b9bcc..86d246d 100755 --- a/init.sql +++ b/init.sql @@ -1,9 +1,9 @@ -CREATE TABLE kisscount(db_version VARCHAR(20)); +CREATE TABLE kisscount(db_version VARCHAR(20)); CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR(255), password VARCHAR(255)); CREATE TABLE account(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), number VARCHAR(255), shared CHAR(1), blocked CHAR(1), default_account CHAR(1)); CREATE TABLE shared_account(account REFERENCES account(id), user REFERENCES user(id)); CREATE TABLE account_amount(id INTEGER PRIMARY KEY, account REFERENCES account(id), year INTEGER, month INTEGER, amount FLOAT); CREATE TABLE operation(id INTEGER PRIMARY KEY, parent REFERENCES operation(id), user REFERENCES user(id), account REFERENCES account(id), year INTEGER, month INTEGER, day INTEGER, amount FLOAT, description VARCHAR(255), category REFERENCES category(id), fix_cost CHAR(1), checked CHAR(1), formula VARCHAR(255), transfert REFERENCES operation(id), meta CHAR(1)); -CREATE TABLE category(id INTEGER PRIMARY KEY, user REFERENCES user(id), parent REFERENCES category(id), name VARCHAR(255), backcolor VARCHAR(10), forecolor VARCHAR(10), font VARCHAR(255)); +CREATE TABLE category(id INTEGER PRIMARY KEY, user REFERENCES user(id), parent REFERENCES category(id), name VARCHAR(255), backcolor VARCHAR(10), forecolor VARCHAR(10), font VARCHAR(255), fix_cost CHAR(1)); CREATE TABLE preference(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), value VARCHAR(255)); -INSERT INTO kisscount ("db_version") VALUES ("1"); \ No newline at end of file +INSERT INTO kisscount ("db_version") VALUES ("2"); \ No newline at end of file diff --git a/ressources/po/french.mo b/ressources/po/french.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09i&so$f?mnlWfv%cgo8O{ldJEOTU+Bd_Y4Q6! z)K7CIDieNG$02*(fh5(vW%p-LTXYrmJMnuO`H!veK3gGbMLyKw$-_r+7V2;vK&|{B zYQT3<1DwUVco|8e8^%5;W0O#axCph7X~+xX7N9awJBs{kWvh6gOoUM#?nDiA7&W2y zQK|g^RsS5mgkK_Kx)tg1?>8ck+-}qY-a#$!ENY9-n-@_1U5QXo%5ETUk-LqW@efwv zSNmRh*5OIUEKEbSt3VB~5S7xUsELQ|`wnv-DkDememsWiCvuU(ObWlC2A;zIPFad- zP=T8HeAGbI=5o{_TVvLvwx|(RzXer)6RMx>s0HpMD7q;GL+bp;uLjskXfnO8CETdv zo=dCTOlZH0h?RsgF`Iar(CTzO634Y-0WpJEO=vQegrDd=e(YznF!qquqE4!QdduvY z_FXH|wSrhfj3d?)+G`y=T}ug_foFBY^&GK|2ol9a9HDN#+-5YG_me-g2s(6up6>@8SCInu_*4q_8Ak$8~MrMF=f5hC;k z$woQxwW$kK-SYL#^Fs z-~ytL-A_fmxBL*g^k`$!cL|-X$zwV{Nq!}|deH8^69cX7-nITX!Hl0+B*BCZcbTW=MM$`s~p{$>PzUKU*at+C@m!G|t^XUUE#z+sbsiplD3hj* X!M1?6>!^2KbGTLZZXYcila}x=yTTpS diff --git a/ressources/po/french.po b/ressources/po/french.po index e3884ef..431accb 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-08 21:12+0100\n" +"POT-Creation-Date: 2011-02-13 19:27+0100\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -25,19 +25,19 @@ msgid " - " msgstr " - " #: src/view/UsersDialog.cpp:120 -#: src/view/PreferencesPanel.cpp:485 -#: src/view/PreferencesPanel.cpp:505 -#: src/view/PreferencesPanel.cpp:714 -#: src/view/PreferencesPanel.cpp:733 +#: src/view/PreferencesPanel.cpp:482 +#: src/view/PreferencesPanel.cpp:502 +#: src/view/PreferencesPanel.cpp:712 +#: src/view/PreferencesPanel.cpp:731 #: src/view/PreferencesPanel.cpp:775 msgid " already exists" msgstr " existe déjà" -#: src/view/SearchPanel.cpp:243 +#: src/view/SearchPanel.cpp:269 msgid " entries found" msgstr " entrées trouvées" -#: src/model/Database.cpp:147 +#: src/model/Database.cpp:96 msgid " not found, aborting" msgstr " non trouvé, arrêt" @@ -49,21 +49,21 @@ msgstr " opérations ?" msgid " profil ?" msgstr " profil ?" -#: src/model/Database.cpp:136 +#: src/model/Database.cpp:85 msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "!! Attention !! S'il y a eu un bug, l'ancienne base de donnée va être supprimée !" -#: src/view/SearchPanel.cpp:245 +#: src/view/SearchPanel.cpp:271 msgid "1 entry found" msgstr "1 entrée trouvée" -#: src/view/SearchPanel.cpp:90 +#: src/view/SearchPanel.cpp:99 #: src/view/grid/GridAccount.cpp:67 msgid "Account" msgstr "Compte" -#: src/view/PreferencesPanel.cpp:485 -#: src/view/PreferencesPanel.cpp:505 +#: src/view/PreferencesPanel.cpp:482 +#: src/view/PreferencesPanel.cpp:502 msgid "Account " msgstr "Le compte " @@ -84,11 +84,11 @@ msgstr "Numéro de compte" msgid "Accounts" msgstr "Comptes" -#: src/view/SearchPanel.cpp:86 +#: src/view/SearchPanel.cpp:95 msgid "Amount from" msgstr "Montant min" -#: src/view/SearchPanel.cpp:87 +#: src/view/SearchPanel.cpp:96 msgid "Amount to" msgstr "Montant max" @@ -97,7 +97,7 @@ msgstr "Montant max" msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " -#: src/view/grid/GridAccount.cpp:829 +#: src/view/grid/GridAccount.cpp:836 msgid "Are you sure want to delete : \n" msgstr "Etes vous sûr de vouloir supprimer : \n" @@ -119,13 +119,13 @@ msgstr "Bloqué" msgid "Cancel" msgstr "Annuler" -#: src/view/grid/GridAccount.cpp:1263 -#: src/view/grid/GridAccount.cpp:1270 +#: src/view/grid/GridAccount.cpp:1267 +#: src/view/grid/GridAccount.cpp:1274 msgid "Cannot group these operations" msgstr "Impossible de grouper ces opérations" -#: src/view/grid/GridAccount.cpp:1389 -#: src/view/grid/GridAccount.cpp:1395 +#: src/view/grid/GridAccount.cpp:1393 +#: src/view/grid/GridAccount.cpp:1399 msgid "Cannot ungroup these operations" msgstr "Impossible de dégrouper ces opérations" @@ -133,13 +133,13 @@ msgstr "Impossible de dégrouper ces opérations" msgid "Categories" msgstr "Catégories" -#: src/view/SearchPanel.cpp:88 +#: src/view/SearchPanel.cpp:97 #: src/view/grid/GridAccount.cpp:67 msgid "Category" msgstr "Catégorie" -#: src/view/PreferencesPanel.cpp:714 -#: src/view/PreferencesPanel.cpp:733 +#: src/view/PreferencesPanel.cpp:712 +#: src/view/PreferencesPanel.cpp:731 msgid "Category " msgstr "La catégorie " @@ -151,6 +151,14 @@ msgstr "Changer de nom" msgid "Change Password" msgstr "Changer le mot de passe" +#: src/view/SearchPanel.cpp:125 +msgid "Change account" +msgstr "Changer de compte" + +#: src/view/SearchPanel.cpp:126 +msgid "Change category" +msgstr "Changer la catégorie" + #: src/view/PasswordDialog.cpp:29 msgid "Change password" msgstr "Changer le mot de passe" @@ -159,10 +167,18 @@ msgstr "Changer le mot de passe" msgid "Check mode" msgstr "Mode rapprochement" -#: src/view/SearchPanel.cpp:76 +#: src/view/SearchPanel.cpp:84 msgid "Checked" msgstr "Rapprochée" +#: src/view/SearchPanel.cpp:309 +msgid "Choose a new account" +msgstr "Nouveau compte" + +#: src/view/SearchPanel.cpp:351 +msgid "Choose a new category" +msgstr "Nouvelle catégorie" + #: src/view/PasswordDialog.cpp:46 msgid "Confirm password " msgstr "Confirmer le mot de passe " @@ -192,11 +208,11 @@ msgstr "Valeur courante" msgid "Date" msgstr "Date" -#: src/view/SearchPanel.cpp:49 +#: src/view/SearchPanel.cpp:56 msgid "Date from" msgstr "Date min" -#: src/view/SearchPanel.cpp:50 +#: src/view/SearchPanel.cpp:57 msgid "Date to" msgstr "Date max" @@ -218,44 +234,47 @@ msgstr "Supprimer" msgid "Descending" msgstr "Décroissant" -#: src/view/SearchPanel.cpp:85 +#: src/view/SearchPanel.cpp:94 #: src/view/grid/GridAccount.cpp:67 msgid "Description" msgstr "Description" +#: src/view/SearchPanel.cpp:394 +msgid "Enter a new description" +msgstr "Nouvelle description" + #: src/view/UsersDialog.cpp:90 #: src/view/UsersDialog.cpp:120 -#: src/view/SearchPanel.cpp:158 -#: src/view/SearchPanel.cpp:168 -#: src/view/SearchPanel.cpp:182 -#: src/view/SearchPanel.cpp:193 +#: src/view/SearchPanel.cpp:179 +#: src/view/SearchPanel.cpp:189 +#: src/view/SearchPanel.cpp:203 +#: src/view/SearchPanel.cpp:214 #: src/view/PreferencesPanel.cpp:422 -#: src/view/PreferencesPanel.cpp:485 -#: src/view/PreferencesPanel.cpp:505 -#: src/view/PreferencesPanel.cpp:714 -#: src/view/PreferencesPanel.cpp:733 +#: src/view/PreferencesPanel.cpp:482 +#: src/view/PreferencesPanel.cpp:502 +#: src/view/PreferencesPanel.cpp:712 +#: src/view/PreferencesPanel.cpp:731 #: src/view/PreferencesPanel.cpp:769 #: src/view/PreferencesPanel.cpp:775 #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 #: src/view/AccountPanel.cpp:748 -#: src/view/grid/GridAccount.cpp:1263 -#: src/view/grid/GridAccount.cpp:1270 -#: src/view/grid/GridAccount.cpp:1389 -#: src/view/grid/GridAccount.cpp:1395 +#: src/view/grid/GridAccount.cpp:1267 +#: src/view/grid/GridAccount.cpp:1274 +#: src/view/grid/GridAccount.cpp:1393 +#: src/view/grid/GridAccount.cpp:1399 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 -#: src/model/Database.cpp:38 -#: src/model/Database.cpp:55 -#: src/model/Database.cpp:95 -#: src/model/Database.cpp:102 -#: src/model/Database.cpp:120 -#: src/model/Database.cpp:147 -#: src/model/Database.cpp:155 -#: src/model/Database.cpp:176 +#: src/model/Database.cpp:42 +#: src/model/Database.cpp:49 +#: src/model/Database.cpp:67 +#: src/model/Database.cpp:96 +#: src/model/Database.cpp:104 +#: src/model/Database.cpp:125 +#: src/model/Database_Update.cpp:23 msgid "Error" msgstr "Erreur" -#: src/model/Database.cpp:176 +#: src/model/Database.cpp:125 msgid "Error creating original database" msgstr "Erreur durant la création de la base de données initiale" @@ -263,9 +282,8 @@ msgstr "Erreur durant la création de la base de données initiale" msgid "Final value" msgstr "Valeur finale" -#: src/view/SearchPanel.cpp:76 -#: src/view/grid/GridAccount.cpp:326 -#: src/model/Database.cpp:331 +#: src/view/SearchPanel.cpp:84 +#: src/view/grid/GridAccount.cpp:329 #: src/controller/KissCount.cpp:379 msgid "Fix" msgstr "Fixe" @@ -307,19 +325,19 @@ msgstr "Loisirs" msgid "Initial value" msgstr "Valeur initiale" -#: src/view/SearchPanel.cpp:168 +#: src/view/SearchPanel.cpp:189 msgid "Invalid amount from" msgstr "Montant min invalide" -#: src/view/SearchPanel.cpp:193 +#: src/view/SearchPanel.cpp:214 msgid "Invalid amount range" msgstr "Intervalle des montants invalide" -#: src/view/SearchPanel.cpp:182 +#: src/view/SearchPanel.cpp:203 msgid "Invalid amount to" msgstr "Montant max invalide" -#: src/view/SearchPanel.cpp:158 +#: src/view/SearchPanel.cpp:179 msgid "Invalid date range" msgstr "Intervalle de temps invalide" @@ -358,6 +376,7 @@ msgstr "Kill me" #: src/view/StatsPanel.cpp:377 #: src/view/PreferencesPanel.cpp:809 #: src/view/PreferencesPanel.cpp:812 +#: src/model/Database_Update.cpp:127 msgid "KissCount" msgstr "KissCount" @@ -392,7 +411,7 @@ msgstr "Nouvel utilisateur" msgid "New password " msgstr "Nouveau mot de passe " -#: src/model/Database.cpp:135 +#: src/model/Database.cpp:84 msgid "" "No database found, would you like to create a new one ?\n" "\n" @@ -400,20 +419,22 @@ msgstr "" "Aucune base de données trouvée, voulez vous en créer une nouvelle ?\n" "\n" -#: src/view/SearchPanel.cpp:248 +#: src/view/SearchPanel.cpp:274 msgid "No entry found" msgstr "Pas d'entrée trouvée" -#: src/view/SearchPanel.cpp:76 +#: src/view/SearchPanel.cpp:84 msgid "Non fix" msgstr "Courantes" -#: src/view/PreferencesPanel.cpp:429 -#: src/view/PreferencesPanel.cpp:689 +#: src/view/SearchPanel.cpp:304 +#: src/view/SearchPanel.cpp:346 +#: src/view/PreferencesPanel.cpp:427 +#: src/view/PreferencesPanel.cpp:687 msgid "None" msgstr "Aucun" -#: src/view/SearchPanel.cpp:76 +#: src/view/SearchPanel.cpp:84 msgid "Not checked" msgstr "Non rapprochée" @@ -439,7 +460,7 @@ msgstr "Fonctionnement" msgid "Operation order" msgstr "Ordre des opérations" -#: src/view/SearchPanel.cpp:89 +#: src/view/SearchPanel.cpp:98 #: src/view/AccountPanel.cpp:175 msgid "Operations" msgstr "Opérations" @@ -456,7 +477,7 @@ msgstr "Mot de passe " msgid "Password changed" msgstr "Mot de passe changé" -#: src/view/wxUI.cpp:245 +#: src/view/wxUI.cpp:247 msgid "" "Personal accounting software\n" "\n" @@ -484,11 +505,7 @@ msgstr "Re entrez le mot de passe" msgid "Preferences" msgstr "Préférences" -#: src/model/Database.cpp:55 -msgid "Query failed !\n" -msgstr "La requête a échouée !\n" - -#: src/view/wxUI.cpp:252 +#: src/view/wxUI.cpp:254 msgid "Quit KissCount ?" msgstr "Quitter KissCount ?" @@ -496,9 +513,13 @@ msgstr "Quitter KissCount ?" msgid "Remains" msgstr "Restant" -#: src/view/SearchPanel.cpp:83 -#: src/view/SearchPanel.cpp:143 -#: src/view/SearchPanel.cpp:259 +#: src/view/SearchPanel.cpp:127 +msgid "Rename" +msgstr "Renommer" + +#: src/view/SearchPanel.cpp:92 +#: src/view/SearchPanel.cpp:164 +#: src/view/SearchPanel.cpp:410 msgid "Search" msgstr "Chercher" @@ -536,10 +557,10 @@ msgstr "Total Débit" msgid "UnGroup" msgstr "Dégrouper" -#: src/model/Database.cpp:95 -#: src/model/Database.cpp:102 -#: src/model/Database.cpp:120 -#: src/model/Database.cpp:155 +#: src/model/Database.cpp:42 +#: src/model/Database.cpp:49 +#: src/model/Database.cpp:67 +#: src/model/Database.cpp:104 msgid "Unable to open Database" msgstr "Impossible d'ouvrir la base de données" @@ -547,16 +568,14 @@ msgstr "Impossible d'ouvrir la base de données" msgid "Unexpected" msgstr "Exceptionnel" -#: src/model/User.cpp:52 -#: src/model/User.cpp:72 -#: src/model/User.cpp:120 +#: src/view/SearchPanel.cpp:80 +#: src/view/SearchPanel.cpp:88 +#: src/model/User.cpp:59 +#: src/model/User.cpp:79 +#: src/model/User.cpp:127 msgid "Unknown" msgstr "Inconnu" -#: src/model/Database.cpp:38 -msgid "Update failed !\n" -msgstr "La mise à jour à échouée !\n" - #: src/view/PreferencesPanel.cpp:59 msgid "User" msgstr "Utilisateur" @@ -571,19 +590,19 @@ msgstr "Utilisateur " msgid "Users" msgstr "Utilisateurs" -#: src/view/grid/GridAccount.cpp:1037 +#: src/view/grid/GridAccount.cpp:1044 msgid "Warning" msgstr "Attention" -#: src/view/PreferencesPanel.cpp:434 +#: src/view/PreferencesPanel.cpp:432 msgid "Wich account will replace this one ?" msgstr "Quel compte va remplacer celui-ci ?" -#: src/view/PreferencesPanel.cpp:694 +#: src/view/PreferencesPanel.cpp:692 msgid "Wich category will replace this one ?" msgstr "Quelle catégorie va remplacer celle-ci" -#: src/view/grid/GridAccount.cpp:1037 +#: src/view/grid/GridAccount.cpp:1044 msgid "You made a debit on a blocked account" msgstr "Vous avez effectué une opération de débit sur un compte bloqué" @@ -635,6 +654,10 @@ msgstr "octobre" msgid "september" msgstr "septembre" +#~ msgid "Query failed !\n" +#~ msgstr "La requête a échouée !\n" +#~ msgid "Update failed !\n" +#~ msgstr "La mise à jour à échouée !\n" #~ msgid "About" #~ msgstr "A propos" #~ msgid "Change user" diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 118038d..cf1ed36 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-08 21:12+0100\n" +"POT-Creation-Date: 2011-02-13 19:27+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,17 +21,17 @@ msgstr "" msgid " - " msgstr "" -#: src/view/UsersDialog.cpp:120 src/view/PreferencesPanel.cpp:485 -#: src/view/PreferencesPanel.cpp:505 src/view/PreferencesPanel.cpp:714 -#: src/view/PreferencesPanel.cpp:733 src/view/PreferencesPanel.cpp:775 +#: src/view/UsersDialog.cpp:120 src/view/PreferencesPanel.cpp:482 +#: src/view/PreferencesPanel.cpp:502 src/view/PreferencesPanel.cpp:712 +#: src/view/PreferencesPanel.cpp:731 src/view/PreferencesPanel.cpp:775 msgid " already exists" msgstr "" -#: src/view/SearchPanel.cpp:243 +#: src/view/SearchPanel.cpp:269 msgid " entries found" msgstr "" -#: src/model/Database.cpp:147 +#: src/model/Database.cpp:96 msgid " not found, aborting" msgstr "" @@ -43,19 +43,19 @@ msgstr "" msgid " profil ?" msgstr "" -#: src/model/Database.cpp:136 +#: src/model/Database.cpp:85 msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "" -#: src/view/SearchPanel.cpp:245 +#: src/view/SearchPanel.cpp:271 msgid "1 entry found" msgstr "" -#: src/view/SearchPanel.cpp:90 src/view/grid/GridAccount.cpp:67 +#: src/view/SearchPanel.cpp:99 src/view/grid/GridAccount.cpp:67 msgid "Account" msgstr "" -#: src/view/PreferencesPanel.cpp:485 src/view/PreferencesPanel.cpp:505 +#: src/view/PreferencesPanel.cpp:482 src/view/PreferencesPanel.cpp:502 msgid "Account " msgstr "" @@ -75,11 +75,11 @@ msgstr "" msgid "Accounts" msgstr "" -#: src/view/SearchPanel.cpp:86 +#: src/view/SearchPanel.cpp:95 msgid "Amount from" msgstr "" -#: src/view/SearchPanel.cpp:87 +#: src/view/SearchPanel.cpp:96 msgid "Amount to" msgstr "" @@ -87,7 +87,7 @@ msgstr "" msgid "Are you sure want to delete " msgstr "" -#: src/view/grid/GridAccount.cpp:829 +#: src/view/grid/GridAccount.cpp:836 msgid "Are you sure want to delete : \n" msgstr "" @@ -108,11 +108,11 @@ msgstr "" msgid "Cancel" msgstr "" -#: src/view/grid/GridAccount.cpp:1263 src/view/grid/GridAccount.cpp:1270 +#: src/view/grid/GridAccount.cpp:1267 src/view/grid/GridAccount.cpp:1274 msgid "Cannot group these operations" msgstr "" -#: src/view/grid/GridAccount.cpp:1389 src/view/grid/GridAccount.cpp:1395 +#: src/view/grid/GridAccount.cpp:1393 src/view/grid/GridAccount.cpp:1399 msgid "Cannot ungroup these operations" msgstr "" @@ -120,11 +120,11 @@ msgstr "" msgid "Categories" msgstr "" -#: src/view/SearchPanel.cpp:88 src/view/grid/GridAccount.cpp:67 +#: src/view/SearchPanel.cpp:97 src/view/grid/GridAccount.cpp:67 msgid "Category" msgstr "" -#: src/view/PreferencesPanel.cpp:714 src/view/PreferencesPanel.cpp:733 +#: src/view/PreferencesPanel.cpp:712 src/view/PreferencesPanel.cpp:731 msgid "Category " msgstr "" @@ -136,6 +136,14 @@ msgstr "" msgid "Change Password" msgstr "" +#: src/view/SearchPanel.cpp:125 +msgid "Change account" +msgstr "" + +#: src/view/SearchPanel.cpp:126 +msgid "Change category" +msgstr "" + #: src/view/PasswordDialog.cpp:29 msgid "Change password" msgstr "" @@ -144,10 +152,18 @@ msgstr "" msgid "Check mode" msgstr "" -#: src/view/SearchPanel.cpp:76 +#: src/view/SearchPanel.cpp:84 msgid "Checked" msgstr "" +#: src/view/SearchPanel.cpp:309 +msgid "Choose a new account" +msgstr "" + +#: src/view/SearchPanel.cpp:351 +msgid "Choose a new category" +msgstr "" + #: src/view/PasswordDialog.cpp:46 msgid "Confirm password " msgstr "" @@ -176,11 +192,11 @@ msgstr "" msgid "Date" msgstr "" -#: src/view/SearchPanel.cpp:49 +#: src/view/SearchPanel.cpp:56 msgid "Date from" msgstr "" -#: src/view/SearchPanel.cpp:50 +#: src/view/SearchPanel.cpp:57 msgid "Date to" msgstr "" @@ -201,29 +217,32 @@ msgstr "" msgid "Descending" msgstr "" -#: src/view/SearchPanel.cpp:85 src/view/grid/GridAccount.cpp:67 +#: src/view/SearchPanel.cpp:94 src/view/grid/GridAccount.cpp:67 msgid "Description" msgstr "" +#: src/view/SearchPanel.cpp:394 +msgid "Enter a new description" +msgstr "" + #: src/view/UsersDialog.cpp:90 src/view/UsersDialog.cpp:120 -#: src/view/SearchPanel.cpp:158 src/view/SearchPanel.cpp:168 -#: src/view/SearchPanel.cpp:182 src/view/SearchPanel.cpp:193 -#: src/view/PreferencesPanel.cpp:422 src/view/PreferencesPanel.cpp:485 -#: src/view/PreferencesPanel.cpp:505 src/view/PreferencesPanel.cpp:714 -#: src/view/PreferencesPanel.cpp:733 src/view/PreferencesPanel.cpp:769 +#: src/view/SearchPanel.cpp:179 src/view/SearchPanel.cpp:189 +#: src/view/SearchPanel.cpp:203 src/view/SearchPanel.cpp:214 +#: src/view/PreferencesPanel.cpp:422 src/view/PreferencesPanel.cpp:482 +#: src/view/PreferencesPanel.cpp:502 src/view/PreferencesPanel.cpp:712 +#: src/view/PreferencesPanel.cpp:731 src/view/PreferencesPanel.cpp:769 #: src/view/PreferencesPanel.cpp:775 src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:748 -#: src/view/grid/GridAccount.cpp:1263 src/view/grid/GridAccount.cpp:1270 -#: src/view/grid/GridAccount.cpp:1389 src/view/grid/GridAccount.cpp:1395 -#: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:38 -#: src/model/Database.cpp:55 src/model/Database.cpp:95 -#: src/model/Database.cpp:102 src/model/Database.cpp:120 -#: src/model/Database.cpp:147 src/model/Database.cpp:155 -#: src/model/Database.cpp:176 +#: src/view/grid/GridAccount.cpp:1267 src/view/grid/GridAccount.cpp:1274 +#: src/view/grid/GridAccount.cpp:1393 src/view/grid/GridAccount.cpp:1399 +#: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:42 +#: src/model/Database.cpp:49 src/model/Database.cpp:67 +#: src/model/Database.cpp:96 src/model/Database.cpp:104 +#: src/model/Database.cpp:125 src/model/Database_Update.cpp:23 msgid "Error" msgstr "" -#: src/model/Database.cpp:176 +#: src/model/Database.cpp:125 msgid "Error creating original database" msgstr "" @@ -231,8 +250,8 @@ msgstr "" msgid "Final value" msgstr "" -#: src/view/SearchPanel.cpp:76 src/view/grid/GridAccount.cpp:326 -#: src/model/Database.cpp:331 src/controller/KissCount.cpp:379 +#: src/view/SearchPanel.cpp:84 src/view/grid/GridAccount.cpp:329 +#: src/controller/KissCount.cpp:379 msgid "Fix" msgstr "" @@ -272,19 +291,19 @@ msgstr "" msgid "Initial value" msgstr "" -#: src/view/SearchPanel.cpp:168 +#: src/view/SearchPanel.cpp:189 msgid "Invalid amount from" msgstr "" -#: src/view/SearchPanel.cpp:193 +#: src/view/SearchPanel.cpp:214 msgid "Invalid amount range" msgstr "" -#: src/view/SearchPanel.cpp:182 +#: src/view/SearchPanel.cpp:203 msgid "Invalid amount to" msgstr "" -#: src/view/SearchPanel.cpp:158 +#: src/view/SearchPanel.cpp:179 msgid "Invalid date range" msgstr "" @@ -321,7 +340,7 @@ msgid "Kill me" msgstr "" #: src/view/StatsPanel.cpp:377 src/view/PreferencesPanel.cpp:809 -#: src/view/PreferencesPanel.cpp:812 +#: src/view/PreferencesPanel.cpp:812 src/model/Database_Update.cpp:127 msgid "KissCount" msgstr "" @@ -354,25 +373,26 @@ msgstr "" msgid "New password " msgstr "" -#: src/model/Database.cpp:135 +#: src/model/Database.cpp:84 msgid "" "No database found, would you like to create a new one ?\n" "\n" msgstr "" -#: src/view/SearchPanel.cpp:248 +#: src/view/SearchPanel.cpp:274 msgid "No entry found" msgstr "" -#: src/view/SearchPanel.cpp:76 +#: src/view/SearchPanel.cpp:84 msgid "Non fix" msgstr "" -#: src/view/PreferencesPanel.cpp:429 src/view/PreferencesPanel.cpp:689 +#: src/view/SearchPanel.cpp:304 src/view/SearchPanel.cpp:346 +#: src/view/PreferencesPanel.cpp:427 src/view/PreferencesPanel.cpp:687 msgid "None" msgstr "" -#: src/view/SearchPanel.cpp:76 +#: src/view/SearchPanel.cpp:84 msgid "Not checked" msgstr "" @@ -397,7 +417,7 @@ msgstr "" msgid "Operation order" msgstr "" -#: src/view/SearchPanel.cpp:89 src/view/AccountPanel.cpp:175 +#: src/view/SearchPanel.cpp:98 src/view/AccountPanel.cpp:175 msgid "Operations" msgstr "" @@ -413,7 +433,7 @@ msgstr "" msgid "Password changed" msgstr "" -#: src/view/wxUI.cpp:245 +#: src/view/wxUI.cpp:247 msgid "" "Personal accounting software\n" "\n" @@ -433,11 +453,7 @@ msgstr "" msgid "Preferences" msgstr "" -#: src/model/Database.cpp:55 -msgid "Query failed !\n" -msgstr "" - -#: src/view/wxUI.cpp:252 +#: src/view/wxUI.cpp:254 msgid "Quit KissCount ?" msgstr "" @@ -445,8 +461,12 @@ msgstr "" msgid "Remains" msgstr "" -#: src/view/SearchPanel.cpp:83 src/view/SearchPanel.cpp:143 -#: src/view/SearchPanel.cpp:259 +#: src/view/SearchPanel.cpp:127 +msgid "Rename" +msgstr "" + +#: src/view/SearchPanel.cpp:92 src/view/SearchPanel.cpp:164 +#: src/view/SearchPanel.cpp:410 msgid "Search" msgstr "" @@ -482,8 +502,8 @@ msgstr "" msgid "UnGroup" msgstr "" -#: src/model/Database.cpp:95 src/model/Database.cpp:102 -#: src/model/Database.cpp:120 src/model/Database.cpp:155 +#: src/model/Database.cpp:42 src/model/Database.cpp:49 +#: src/model/Database.cpp:67 src/model/Database.cpp:104 msgid "Unable to open Database" msgstr "" @@ -491,14 +511,11 @@ msgstr "" msgid "Unexpected" msgstr "" -#: src/model/User.cpp:52 src/model/User.cpp:72 src/model/User.cpp:120 +#: src/view/SearchPanel.cpp:80 src/view/SearchPanel.cpp:88 +#: src/model/User.cpp:59 src/model/User.cpp:79 src/model/User.cpp:127 msgid "Unknown" msgstr "" -#: src/model/Database.cpp:38 -msgid "Update failed !\n" -msgstr "" - #: src/view/PreferencesPanel.cpp:59 msgid "User" msgstr "" @@ -512,19 +529,19 @@ msgstr "" msgid "Users" msgstr "" -#: src/view/grid/GridAccount.cpp:1037 +#: src/view/grid/GridAccount.cpp:1044 msgid "Warning" msgstr "" -#: src/view/PreferencesPanel.cpp:434 +#: src/view/PreferencesPanel.cpp:432 msgid "Wich account will replace this one ?" msgstr "" -#: src/view/PreferencesPanel.cpp:694 +#: src/view/PreferencesPanel.cpp:692 msgid "Wich category will replace this one ?" msgstr "" -#: src/view/grid/GridAccount.cpp:1037 +#: src/view/grid/GridAccount.cpp:1044 msgid "You made a debit on a blocked account" msgstr "" diff --git a/src/ParseExp.cpp b/src/ParseExp.cpp index 81f7e37..e6162b7 100644 --- a/src/ParseExp.cpp +++ b/src/ParseExp.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index a8c6245..9c33bd4 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. @@ -376,17 +376,17 @@ void KissCount::NewUser(const wxString& name) AddAccount(ac); - cat.parent = wxT("0") ; cat.name = _("Fix") ; cat.backcolor = OWN_YELLOW ; cat.forecolor = *wxBLACK; + cat.parent = wxT("0") ; cat.name = _("Fix") ; cat.backcolor = OWN_YELLOW ; cat.forecolor = *wxBLACK; cat.fix_cost = true; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = _("Groceries") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; + cat.parent = wxT("0") ; cat.name = _("Groceries") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = _("Hobbies") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; + cat.parent = wxT("0") ; cat.name = _("Hobbies") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = _("Operating exepense") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; + cat.parent = wxT("0") ; cat.name = _("Operating exepense") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = _("Unexpected") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; + cat.parent = wxT("0") ; cat.name = _("Unexpected") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = _("Other") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; + cat.parent = wxT("0") ; cat.name = _("Other") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); SetOperationOrder(wxT("ASC")); diff --git a/src/main.cpp b/src/main.cpp index 4061e71..97c33f4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/model/Category.h b/src/model/Category.h index 43d6a78..7eec57a 100644 --- a/src/model/Category.h +++ b/src/model/Category.h @@ -29,6 +29,7 @@ public: wxColour backcolor; wxColour forecolor; wxString font; + bool fix_cost; }; #endif diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 7172458..05baac6 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. @@ -19,59 +19,6 @@ #include "Database.h" -// if (!_db.CheckSyntax(req)) -// { -// wxString s = req; -// std::cout << s.mb_str() << " is invalid !\n" ; -// code_if_syntax_fail; -// return return_value; -// } - -#define EXECUTE_SQL_UPDATE_WITH_CODE(req, return_value, code_if_fail, code_if_syntax_fail) \ - do{ \ - try \ - { \ - _db.ExecuteUpdate(req); \ - } \ - catch (wxSQLite3Exception e) \ - { \ - wxMessageBox(_("Update failed !\n") + req, _("Error"), wxICON_ERROR | wxOK); \ - std::cerr << __FUNCTION__ << "\n" ; \ - std::cerr << req.mb_str() << "\n" ; \ - std::cerr << e.GetMessage().mb_str() << "\n" ; \ - code_if_fail; \ - return return_value; \ - } \ - } while(0); - -#define EXECUTE_SQL_QUERY_WITH_CODE(req, res, return_value, code_if_fail, code_if_syntax_fail) \ - do{ \ - try \ - { \ - res = _db.ExecuteQuery(req); \ - } \ - catch (wxSQLite3Exception e) \ - { \ - wxMessageBox(_("Query failed !\n") + req, _("Error"), wxICON_ERROR | wxOK); \ - std::cerr << __FUNCTION__ << "\n" ; \ - std::cerr << req.mb_str() << "\n" ; \ - std::cerr << e.GetMessage().mb_str() << "\n" ; \ - code_if_fail; \ - return return_value; \ - } \ - } while(0); - -#define EXECUTE_SQL_QUERY(req, res, return_value) EXECUTE_SQL_QUERY_WITH_CODE(req, res, return_value, {}, {}) - -#define EXECUTE_SQL_UPDATE(req, return_value) EXECUTE_SQL_UPDATE_WITH_CODE(req, return_value, {}, {}) - -#define ESCAPE_CHARS(s) { \ - if (s.Find(wxT("\\\"")) == wxNOT_FOUND) \ - s.Replace(wxT("\""), wxT("\\\""), true); \ - if (s.Find(wxT("\\\'")) == wxNOT_FOUND) \ - s.Replace(wxT("\'"), wxT("\\\'"), true); \ - } - static inline wxString DoubleToString(double d) { wxString res; @@ -124,6 +71,8 @@ Database::Database(const char* filename, KissCount* kiss) : _kiss(kiss) } bdd_file.close(); + + CheckDatabaseVersion(); } void Database::CreateDatabase() @@ -317,7 +266,7 @@ User* Database::LoadUser(const wxString& name) set.Finalize(); } - req = wxT("SELECT * FROM category WHERE user='") + user->_id + wxT("' ORDER BY name ASC"); + req = wxT("SELECT * FROM category WHERE user='") + user->_id + wxT("' ORDER BY fix_cost DESC, name ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); while (set.NextRow()) @@ -328,16 +277,10 @@ User* Database::LoadUser(const wxString& name) category.backcolor = wxColour(set.GetAsString(wxT("backcolor"))); category.forecolor = wxColour(set.GetAsString(wxT("forecolor"))); category.font = set.GetAsString(wxT("font")); - if (category.name != _("Fix")) - { - user->_categories.push_back(category); - user->_categoriesFonts.push_back(_kiss->ExtractFont(category.font)); - } - else - { - user->_categories.insert(user->_categories.begin(), category); - user->_categoriesFonts.insert(user->_categoriesFonts.begin(), _kiss->ExtractFont(category.font)); - } + category.fix_cost = set.GetBool(wxT("fix_cost")); + + user->_categories.push_back(category); + user->_categoriesFonts.push_back(_kiss->ExtractFont(category.font)); } set.Finalize(); @@ -563,6 +506,10 @@ void Database::UpdateOperation(Operation& op) req += wxT(", amount='") + DoubleToString(op.amount) + wxT("'"); req += wxT(", description=\"") + op.description + wxT("\""); req += wxT(", category='") + op.category + wxT("'"); + if (op.fix_cost) + req += wxT(", fix_cost='1'"); + else + req += wxT(", fix_cost='0'"); if (op.checked) req += wxT(", checked='1'"); else @@ -939,13 +886,17 @@ wxString Database::AddCategory(User* user, Category& category) forecolor += wxString::Format(wxT("%02X"), category.forecolor.Green()); forecolor += wxString::Format(wxT("%02X"), category.forecolor.Blue()); - req = wxT("INSERT INTO category ('user', 'parent', 'name', 'backcolor', 'forecolor', font) VALUES ('") ; + req = wxT("INSERT INTO category ('user', 'parent', 'name', 'backcolor', 'forecolor', 'font', 'fix_cost') VALUES ('") ; req += user->_id + wxT("'"); req += wxT(", '") + category.parent + wxT("'"); req += wxT(", '") + category.name + wxT("'"); req += wxT(", '") + backcolor + wxT("'"); req += wxT(", '") + forecolor + wxT("'"); req += wxT(", '") + category.font + wxT("'"); + if (category.fix_cost) + req += wxT(", '1'"); + else + req += wxT(", '0'"); req += wxT(")"); EXECUTE_SQL_UPDATE(req, wxT("0")); @@ -974,6 +925,10 @@ void Database::UpdateCategory(Category& category) req += wxT(", backcolor='") + backcolor + wxT("'"); req += wxT(", forecolor='") + forecolor + wxT("'"); req += wxT(", font='") + category.font + wxT("'"); + if (category.fix_cost) + req += wxT(", fix_cost='1'"); + else + req += wxT(", fix_cost='0'"); req += wxT(" WHERE id='") + category.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); diff --git a/src/model/Database.h b/src/model/Database.h index fbf037e..8ac25df 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -30,6 +30,8 @@ #include "model.h" #include "../controller/KissCount.h" +#define DATABASE_VERSION 2 + #define BDD_FILE "kc.bdd" #define INIT_SCRIPT "init.sql" @@ -38,6 +40,59 @@ #define CHECKED_OP (1 << 2) #define NOT_CHECKED_OP (1 << 3) +// if (!_db.CheckSyntax(req)) +// { +// wxString s = req; +// std::cout << s.mb_str() << " is invalid !\n" ; +// code_if_syntax_fail; +// return return_value; +// } + +#define EXECUTE_SQL_UPDATE_WITH_CODE(req, return_value, code_if_fail, code_if_syntax_fail) \ + do{ \ + try \ + { \ + _db.ExecuteUpdate(req); \ + } \ + catch (wxSQLite3Exception e) \ + { \ + wxMessageBox(_("Update failed !\n") + req, _("Error"), wxICON_ERROR | wxOK); \ + std::cerr << __FUNCTION__ << "\n" ; \ + std::cerr << req.mb_str() << "\n" ; \ + std::cerr << e.GetMessage().mb_str() << "\n" ; \ + code_if_fail; \ + return return_value; \ + } \ + } while(0); + +#define EXECUTE_SQL_QUERY_WITH_CODE(req, res, return_value, code_if_fail, code_if_syntax_fail) \ + do{ \ + try \ + { \ + res = _db.ExecuteQuery(req); \ + } \ + catch (wxSQLite3Exception e) \ + { \ + wxMessageBox(_("Query failed !\n") + req, _("Error"), wxICON_ERROR | wxOK); \ + std::cerr << __FUNCTION__ << "\n" ; \ + std::cerr << req.mb_str() << "\n" ; \ + std::cerr << e.GetMessage().mb_str() << "\n" ; \ + code_if_fail; \ + return return_value; \ + } \ + } while(0); + +#define EXECUTE_SQL_QUERY(req, res, return_value) EXECUTE_SQL_QUERY_WITH_CODE(req, res, return_value, {}, {}) + +#define EXECUTE_SQL_UPDATE(req, return_value) EXECUTE_SQL_UPDATE_WITH_CODE(req, return_value, {}, {}) + +#define ESCAPE_CHARS(s) { \ + if (s.Find(wxT("\\\"")) == wxNOT_FOUND) \ + s.Replace(wxT("\""), wxT("\\\""), true); \ + if (s.Find(wxT("\\\'")) == wxNOT_FOUND) \ + s.Replace(wxT("\'"), wxT("\\\'"), true); \ + } + class KissCount; class User; @@ -104,6 +159,10 @@ public: std::map* GetNotChecked(User* user, int month, int year); +/* Database Update */ + + void CheckDatabaseVersion(); + private: KissCount* _kiss; wxSQLite3Database _db; diff --git a/src/model/Database_Update.cpp b/src/model/Database_Update.cpp new file mode 100644 index 0000000..b391901 --- /dev/null +++ b/src/model/Database_Update.cpp @@ -0,0 +1,130 @@ +/* + Copyright 2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "Database.h" + +#define ON_ERROR(m) \ + wxMessageBox(wxT(m), _("Error"), wxICON_ERROR | wxOK); \ + throw std::string(m); + +typedef void (*update_func)(wxSQLite3Database& _db) ; + +#define UPDATE_TABLE(from, to, step) EXECUTE_SQL_UPDATE_WITH_CODE(req, , throw std::string("Error while upgrading from version " from " to version " to ", step " step);, }); + +static void Version_1_to_2(wxSQLite3Database& _db) +{ + wxString req ; + wxSQLite3ResultSet set; + + /* Category */ + req = wxT("ALTER TABLE category ADD fix_cost CHAR(1)"); + + UPDATE_TABLE("1", "2", "1"); + + req = wxT("UPDATE category SET fix_cost='0'"); + + UPDATE_TABLE("1", "2", "2"); + + req = wxT("UPDATE category SET fix_cost='1' WHERE id IN ("); + req += wxT("SELECT MIN(category.id) FROM category, user WHERE category.user = user.id"); + req += wxT(")"); + + UPDATE_TABLE("1", "2", "3"); + + /* Account */ + req = wxT("ALTER TABLE account ADD virtual CHAR(1)"); + + UPDATE_TABLE("1", "2", "4"); + + req = wxT("UPDATE account SET virtual='0'"); + + UPDATE_TABLE("1", "2", "5"); + +} + +static update_func updates[] = { + Version_1_to_2 +}; + +void Database::CheckDatabaseVersion() +{ + wxString req ; + wxSQLite3ResultSet set; + long int version; + int i; + + req = wxT("SELECT db_version FROM kisscount"); + + EXECUTE_SQL_QUERY_WITH_CODE(req, set, , ON_ERROR("Unable to get database version"), {}); + + if (!set.GetAsString(wxT("db_version")).ToLong(&version)) + { + ON_ERROR("Invalid database version"); + } + + if (version == DATABASE_VERSION) return; + + if (version > DATABASE_VERSION) + { + ON_ERROR("Your current version of KissCount is too old and can't load this database. Please upgrade KissCount"); + } + + version--; + + // Maybe one update is impossible + for(i=version; i >* >::iterator it; @@ -33,6 +38,8 @@ User::~User() delete it->second; } } + + _operations.clear(); } Category User::GetCategory(const wxString& catId) diff --git a/src/model/User.h b/src/model/User.h index b7062fd..c650dc3 100644 --- a/src/model/User.h +++ b/src/model/User.h @@ -37,6 +37,7 @@ class User public: User(Database* db); ~User(); + void InvalidateOperations(); wxString _id; wxString _name; diff --git a/src/sha1.cpp b/src/sha1.cpp index 012ff77..8930673 100644 --- a/src/sha1.cpp +++ b/src/sha1.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index e38b70c..f7bc5b4 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/GenerateDialog.cpp b/src/view/GenerateDialog.cpp index 235cf6f..3d5d8ef 100644 --- a/src/view/GenerateDialog.cpp +++ b/src/view/GenerateDialog.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/PasswordDialog.cpp b/src/view/PasswordDialog.cpp index 5d4a21b..4071f2a 100644 --- a/src/view/PasswordDialog.cpp +++ b/src/view/PasswordDialog.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index ccd9438..3098b89 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. @@ -680,6 +680,7 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) if (user->GetCategoriesNumber() && row < user->GetCategoriesNumber()) { new_cat.id = user->_categories[row].id; + new_cat.fix_cost = user->_categories[row].fix_cost; if (col == CATEGORY_DELETE) { wxString *categories = new wxString[user->GetCategoriesNumber()]; @@ -731,6 +732,8 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) inModification = false; return ; } + + new_cat.fix_cost = false; _kiss->AddCategory(new_cat); AddCategory(row, new_cat); diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index f8aae6f..5ae40ae 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. @@ -19,13 +19,17 @@ #include "AccountPanel.h" -enum {SEARCH_ID, GRID_ID, CALENDAR_FROM_ID, CALENDAR_TO_ID}; +enum {SEARCH_ID, GRID_ID, CALENDAR_FROM_ID, CALENDAR_TO_ID, + CHANGE_ACCOUNT_ID, CHANGE_CATEGORY_ID, RENAME_ID}; BEGIN_EVENT_TABLE(SearchPanel, wxPanel) EVT_BUTTON(SEARCH_ID, SearchPanel::OnButtonSearch) EVT_CALENDAR_SEL_CHANGED(CALENDAR_FROM_ID, SearchPanel::OnCalendarFromChange) EVT_CALENDAR_SEL_CHANGED(CALENDAR_TO_ID, SearchPanel::OnCalendarToChange) EVT_GRID_CMD_CELL_CHANGE(GRID_ID, SearchPanel::OnOperationModified) +EVT_BUTTON(CHANGE_ACCOUNT_ID, SearchPanel::OnButtonChangeAccount) +EVT_BUTTON(CHANGE_CATEGORY_ID, SearchPanel::OnButtonChangeCategory) +EVT_BUTTON(RENAME_ID, SearchPanel::OnButtonRename) EVT_SHOW(SearchPanel::OnShow) END_EVENT_TABLE() @@ -44,6 +48,9 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent wxRect rect = wxDisplay().GetGeometry(); wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); + wxBoxSizer *vbox2 = new wxBoxSizer(wxVERTICAL); + wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); + SetSizer(vbox); _checkDateFrom = new wxCheckBox(this, wxID_ANY, _("Date from")); @@ -113,7 +120,19 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _grid = new GridAccount(_kiss, this, GRID_ID); - vbox->Add(_grid, 0, wxGROW|wxALL, 5); + hbox->Add(_grid, 0, wxGROW|wxALL, 5); + + _changeAccountButton = new wxButton(this, CHANGE_ACCOUNT_ID, _("Change account")); + _changeCategoryButton = new wxButton(this, CHANGE_CATEGORY_ID, _("Change category")); + _renameButton = new wxButton(this, RENAME_ID, _("Rename")); + + vbox2->Add(_changeAccountButton, wxALL, 15); + vbox2->Add(_changeCategoryButton, wxALL, 15); + vbox2->Add(_renameButton, wxALL, 15); + + hbox->Add(vbox2, 0, wxALL, 15); + + vbox->Add(hbox, 0, wxGROW|wxALL, 5); Fit(); @@ -145,7 +164,7 @@ wxString SearchPanel::GetToolTip() return _("Search"); } -void SearchPanel::OnButtonSearch(wxCommandEvent& event) +void SearchPanel::Search() { wxString *description=NULL, *amountFrom=NULL, *amountTo=NULL; std::vector categories, accounts; @@ -240,6 +259,11 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event) delete _operations; _operations = _kiss->Search(description, dateFrom, dateTo, amountFrom, amountTo, categories,types, accounts); +} + +void SearchPanel::OnButtonSearch(wxCommandEvent& event) +{ + Search(); if (_operations->size() > 1) wxMessageBox(wxString::Format(wxT("%d"), _operations->size()) + _(" entries found"), wxT("KissCount"), wxICON_INFORMATION | wxOK); @@ -256,6 +280,131 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event) _wxUI->Layout(); } +static void ChangeAccount(Operation* op, void** params) +{ + wxString* account = (wxString*) params[0]; + + op->account = *account; +} + +void SearchPanel::OnButtonChangeAccount(wxCommandEvent& event) +{ + int i, a; + std::vector rows; + User* user = _kiss->GetUser(); + wxString *accounts = new wxString[user->GetAccountsNumber()+1]; + std::vector::iterator it; + wxString account; + void * params[] = {&account}; + + if (!_operations) return; + + _grid->GetSelectedOperations(&rows); + + accounts[0] = _("None"); + a = 0; + for(i=0; i < user->GetAccountsNumber(); i++) + accounts[++a] = user->_accounts[i].name; + + wxSingleChoiceDialog dialog(_wxUI, _("Choose a new account"), wxT("KissCount"), user->GetAccountsNumber()+1, accounts); + + if (dialog.ShowModal() == wxID_CANCEL) + return; + + a = dialog.GetSelection(); + account = (a) ? user->_accounts[a-1].id : wxT("0"); + + _grid->MassUpdate(rows, ChangeAccount, params); + + _wxUI->NeedReload(); +} + +static void ChangeCategory(Operation* op, void** params) +{ + wxString* category = (wxString*) params[0]; + bool* fix = (bool*) params[1]; + + op->category = *category; + op->fix_cost = * fix; +} + +void SearchPanel::OnButtonChangeCategory(wxCommandEvent& event) +{ + int i, a; + std::vector rows; + User* user = _kiss->GetUser(); + wxString *categories = new wxString[user->GetCategoriesNumber()+1]; + std::vector::iterator it; + wxString category; + bool fix; + void * params[] = {&category, &fix}; + + if (!_operations) return; + + _grid->GetSelectedOperations(&rows); + + categories[0] = _("None"); + a = 0; + for(i=0; i < user->GetCategoriesNumber(); i++) + categories[++a] = user->_categories[i].name; + + wxSingleChoiceDialog dialog(_wxUI, _("Choose a new category"), wxT("KissCount"), user->GetCategoriesNumber()+1, categories); + + if (dialog.ShowModal() == wxID_CANCEL) + return; + + a = dialog.GetSelection(); + + if (a) + { + category = user->_categories[a-1].id ; + fix = user->_categories[a-1].fix_cost; + } + else + { + category = wxT("0"); + fix = false; + } + + _grid->MassUpdate(rows, ChangeCategory, params); + + _wxUI->NeedReload(); +} + +static void ChangeName(Operation* op, void** params) +{ + wxString* description = (wxString*) params[0]; + + op->description = *description; +} + +void SearchPanel::OnButtonRename(wxCommandEvent& event) +{ + std::vector rows; + User* user = _kiss->GetUser(); + std::vector::iterator it; + wxString category; + wxString description; + void * params[] = {&description}; + + if (!_operations) return; + + _grid->GetSelectedOperations(&rows); + + wxTextEntryDialog u(this, wxT(""), _("Enter a new description")); + + if (u.ShowModal() == wxID_CANCEL) + return; + + description = u.GetValue(); + + if (!description.size()) return; + + _grid->MassUpdate(rows, ChangeName, params); + + _wxUI->NeedReload(); +} + void SearchPanel::OnShow(wxShowEvent& event) { _wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") + _("Search")); diff --git a/src/view/SearchPanel.h b/src/view/SearchPanel.h index 554d4b7..07bff94 100644 --- a/src/view/SearchPanel.h +++ b/src/view/SearchPanel.h @@ -50,14 +50,20 @@ public: void OnCalendarFromChange(wxCalendarEvent& event); void OnCalendarToChange(wxCalendarEvent& event); + void OnButtonChangeAccount(wxCommandEvent& event); + void OnButtonChangeCategory(wxCommandEvent& event); + void OnButtonRename(wxCommandEvent& event); + private: + void Search(); + std::vector *_operations; wxCalendarCtrl* _calendarFrom, *_calendarTo; GridAccount *_grid; wxCheckBox *_checkDateFrom, *_checkDateTo; wxTextCtrl* _description, *_amountFrom, *_amountTo; wxCheckListBox* _category, *_account, *_optype; - wxButton* _searchButton; + wxButton* _searchButton, *_renameButton, *_changeAccountButton, *_changeCategoryButton; DECLARE_EVENT_TABLE(); }; diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 9611f48..ae18f85 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. @@ -29,8 +29,8 @@ END_EVENT_TABLE() StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _plot(NULL), _chart(NULL) { wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); - _hbox2 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); + _hbox2 = new wxBoxSizer(wxHORIZONTAL); _vbox2 = new wxBoxSizer(wxVERTICAL); int i; User* user = _kiss->GetUser(); diff --git a/src/view/SupportedLanguages.cpp b/src/view/SupportedLanguages.cpp index dde3792..44062ca 100644 --- a/src/view/SupportedLanguages.cpp +++ b/src/view/SupportedLanguages.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/UsersDialog.cpp b/src/view/UsersDialog.cpp index c53d52e..fcb846b 100644 --- a/src/view/UsersDialog.cpp +++ b/src/view/UsersDialog.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/CalendarEditor.cpp b/src/view/grid/CalendarEditor.cpp index a799e5e..c2b3cca 100644 --- a/src/view/grid/CalendarEditor.cpp +++ b/src/view/grid/CalendarEditor.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 921a759..b90885b 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. @@ -120,6 +120,9 @@ wxPen GridAccount::GetRowGridLinePen (int row) { row == _week4) return wxPen(*wxBLACK, 1, wxSOLID); } + else + if (row == 0) + return wxPen(*wxBLACK, 1, wxSOLID); return GetCellBackgroundColour(row, 0); } @@ -542,13 +545,13 @@ void GridAccount::InsertIntoGrid(Operation& op) InsertOperationWithWeek(user, (*_operations)[a], i, op.fix_cost, _curMonth, _curYear); } -void GridAccount::RemoveMeta(Operation op, int line, bool removeRoot, bool deleteOp) +int GridAccount::RemoveMeta(Operation op, int line, bool removeRoot, bool deleteOp) { std::vector::iterator it, it2; wxGridCellTreeButtonRenderer* treeRenderer; - int i; + int i, deletedOperations = 0; Operation op2; - + treeRenderer = (wxGridCellTreeButtonRenderer*) GetCellRenderer(line, TREE); for(i=0; i<(int)op.childs.size(); i++) @@ -561,6 +564,7 @@ void GridAccount::RemoveMeta(Operation op, int line, bool removeRoot, bool delet if (treeRenderer->IsCollapsed()) { DeleteRows(line+1, 1); + deletedOperations++; if (op2.fix_cost) _fixCosts--; _displayedOperations.erase(_displayedOperations.begin()+line+1); } @@ -585,9 +589,12 @@ void GridAccount::RemoveMeta(Operation op, int line, bool removeRoot, bool delet DeleteOperation(op); _kiss->DeleteOperation(op); } + deletedOperations++; } treeRenderer->DecRef(); + + return deletedOperations; } void GridAccount::CheckMeta(Operation& op, int line, bool check) @@ -1201,7 +1208,7 @@ void GridAccount::GetSelectedOperations(std::vector* rows) if (*it == row) break; - if (it != rows->end()) continue; + if (it != rows->end() || !row) continue; rows->push_back(row); } @@ -1218,7 +1225,7 @@ void GridAccount::GetSelectedOperations(std::vector* rows) if (*it == c.GetRow()) break; - if (it != rows->end()) continue; + if (it != rows->end() || !c.GetRow()) continue; rows->push_back(c.GetRow()); } @@ -1474,3 +1481,46 @@ removeLastGroup: ComputeWeeks(); } + +void GridAccount::MassUpdate(std::vector& rows, updateOperationFunc func, void** params) +{ + int i, b; + std::vector::iterator it; + Operation op, op2; + + if (rows.size()) + { + for(i=0; i<(int)rows.size(); i++) + { + op = _displayedOperations[rows[i]]; + + func (&op, params); + + UpdateOperation(op); + + if (op.meta) + { + for(b=0; b<(int)op.childs.size(); b++) + { + op2 = GetOperation(op.childs[b]); + func (&op2, params); + UpdateOperation(op2); + } + } + } + } + else + { + for(it=_operations->begin(); it!=_operations->end(); it++) + { + func (&(*it), params); + _kiss->UpdateOperation(*it); + } + } + + DeleteRows(1, GetNumberRows()-1); + + LoadOperations(_operations, false, false, 0, 0); + + Layout(); +} diff --git a/src/view/grid/GridAccount.h b/src/view/grid/GridAccount.h index 77f0a2a..6130d51 100644 --- a/src/view/grid/GridAccount.h +++ b/src/view/grid/GridAccount.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,8 @@ class KissCount; +typedef void (*updateOperationFunc)(Operation* op, void** params); + class GridAccount : public wxGrid { public: @@ -48,6 +51,10 @@ public: void InsertOperationWithWeek(User* user, Operation& op, int line, bool fix, int month, int year) ; void InsertOperation(User* user, Operation& op, int line, bool fix, int month, int year) ; + void GetSelectedOperations(std::vector* rows); + + void MassUpdate(std::vector& rows, updateOperationFunc func, void** params); + void Group(); void UnGroup(); @@ -74,13 +81,12 @@ private: void InsertIntoGrid(Operation& op); void DeleteOperation(const Operation& op); void UpdateMeta(Operation& op); - void RemoveMeta(Operation op, int line, bool removeRoot, bool deleteOp); + int RemoveMeta(Operation op, int line, bool removeRoot, bool deleteOp); void CheckMeta(Operation& op, int line, bool check); Operation& GetOperation(const wxString& id); void UpdateOperation(Operation& op); int GetDisplayedRow(const wxString& id); - void GetSelectedOperations(std::vector* rows); DECLARE_EVENT_TABLE(); }; diff --git a/src/view/grid/wxGridCellBitmapRenderer.cpp b/src/view/grid/wxGridCellBitmapRenderer.cpp index e48319f..84149e0 100644 --- a/src/view/grid/wxGridCellBitmapRenderer.cpp +++ b/src/view/grid/wxGridCellBitmapRenderer.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellButtonEditor.cpp b/src/view/grid/wxGridCellButtonEditor.cpp index b1836a8..4d85bc8 100644 --- a/src/view/grid/wxGridCellButtonEditor.cpp +++ b/src/view/grid/wxGridCellButtonEditor.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellButtonRenderer.cpp b/src/view/grid/wxGridCellButtonRenderer.cpp index 1278e63..98951fe 100644 --- a/src/view/grid/wxGridCellButtonRenderer.cpp +++ b/src/view/grid/wxGridCellButtonRenderer.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellFormulaEditor.cpp b/src/view/grid/wxGridCellFormulaEditor.cpp index a5d08ae..619023e 100644 --- a/src/view/grid/wxGridCellFormulaEditor.cpp +++ b/src/view/grid/wxGridCellFormulaEditor.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellTabStringRenderer.cpp b/src/view/grid/wxGridCellTabStringRenderer.cpp index ee9eedd..3c4d514 100644 --- a/src/view/grid/wxGridCellTabStringRenderer.cpp +++ b/src/view/grid/wxGridCellTabStringRenderer.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellTreeButtonEditor.cpp b/src/view/grid/wxGridCellTreeButtonEditor.cpp index 4fb6215..fb13875 100644 --- a/src/view/grid/wxGridCellTreeButtonEditor.cpp +++ b/src/view/grid/wxGridCellTreeButtonEditor.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/grid/wxGridCellTreeButtonRenderer.cpp b/src/view/grid/wxGridCellTreeButtonRenderer.cpp index 846cc5f..828b837 100644 --- a/src/view/grid/wxGridCellTreeButtonRenderer.cpp +++ b/src/view/grid/wxGridCellTreeButtonRenderer.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/wxGridCellStarEditor.cpp b/src/view/wxGridCellStarEditor.cpp index 1db025e..0642f0f 100644 --- a/src/view/wxGridCellStarEditor.cpp +++ b/src/view/wxGridCellStarEditor.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index c405210..0eedd29 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -1,5 +1,5 @@ /* - Copyright 2010 Grégory Soutadé + Copyright 2010-2011 Grégory Soutadé This file is part of KissCount. @@ -199,6 +199,7 @@ void wxUI::ShowPanel(KissPanel* panel) { wxShowEvent event; int i; + User* user = _kiss->GetUser(); if (!panel) return; @@ -210,6 +211,7 @@ void wxUI::ShowPanel(KissPanel* panel) if (_needReload) { + user->InvalidateOperations(); for(i=0; i<(int)_panels.size(); i++) if (_panels[i] == panel) break; LoadPanels(); diff --git a/www/User.php b/www/User.php index 87eea4f..888ec77 100644 --- a/www/User.php +++ b/www/User.php @@ -1,6 +1,6 @@ fetchArray())

-
KissCount © 2010 Grégory Soutadé
+
KissCount © 2010-2011 Grégory Soutadé
\ No newline at end of file diff --git a/www/kisscount.php b/www/kisscount.php index 5e15ca7..bd0f32d 100644 --- a/www/kisscount.php +++ b/www/kisscount.php @@ -1,6 +1,6 @@ Date: Mon, 14 Feb 2011 20:56:59 +0100 Subject: [PATCH 33/72] Add virtual accounts (potential bugs) --- ChangeLog | 3 +- init.sql | 2 +- src/controller/KissCount.cpp | 10 +++- src/controller/KissCount.h | 1 + src/model/Account.h | 1 + src/model/Database.cpp | 102 ++++++++++++++++++++++++++++------ src/model/Database.h | 7 ++- src/model/Database_Update.cpp | 10 +++- src/model/Operation.h | 1 + src/model/User.cpp | 7 +++ src/view/AccountPanel.cpp | 11 +++- src/view/PreferencesPanel.cpp | 16 +++++- src/view/grid/GridAccount.cpp | 4 ++ www/index.php | 2 +- 14 files changed, 150 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8dddf06..f23b3bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2_dev (13/02/2011) +v0.2_dev (14/02/2011) ** User ** Better use of sizers (so better interface!) @@ -8,6 +8,7 @@ v0.2_dev (13/02/2011) Possibility to choose a replacement when deleting accounts and categories Possibility to find operations with unknown category/account Possibility to work on multiple operations (rename, change category, change account) + Add virtual accounts ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/init.sql b/init.sql index 86d246d..56b957e 100755 --- a/init.sql +++ b/init.sql @@ -3,7 +3,7 @@ CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR(255), password VARCHAR(2 CREATE TABLE account(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), number VARCHAR(255), shared CHAR(1), blocked CHAR(1), default_account CHAR(1)); CREATE TABLE shared_account(account REFERENCES account(id), user REFERENCES user(id)); CREATE TABLE account_amount(id INTEGER PRIMARY KEY, account REFERENCES account(id), year INTEGER, month INTEGER, amount FLOAT); -CREATE TABLE operation(id INTEGER PRIMARY KEY, parent REFERENCES operation(id), user REFERENCES user(id), account REFERENCES account(id), year INTEGER, month INTEGER, day INTEGER, amount FLOAT, description VARCHAR(255), category REFERENCES category(id), fix_cost CHAR(1), checked CHAR(1), formula VARCHAR(255), transfert REFERENCES operation(id), meta CHAR(1)); +CREATE TABLE operation(id INTEGER PRIMARY KEY, parent REFERENCES operation(id), user REFERENCES user(id), account REFERENCES account(id), year INTEGER, month INTEGER, day INTEGER, amount FLOAT, description VARCHAR(255), category REFERENCES category(id), fix_cost CHAR(1), checked CHAR(1), formula VARCHAR(255), transfert REFERENCES operation(id), meta CHAR(1), virtual CHAR(1)); CREATE TABLE category(id INTEGER PRIMARY KEY, user REFERENCES user(id), parent REFERENCES category(id), name VARCHAR(255), backcolor VARCHAR(10), forecolor VARCHAR(10), font VARCHAR(255), fix_cost CHAR(1)); CREATE TABLE preference(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), value VARCHAR(255)); INSERT INTO kisscount ("db_version") VALUES ("2"); \ No newline at end of file diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 9c33bd4..53f3bae 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -104,7 +104,7 @@ void KissCount::UpdateOperation(Operation& op) op.transfert = wxT(""); _user->LinkOrUnlinkOperation(op); - _db->UpdateOperation(op); + _db->UpdateOperation(_user, op); // Link _user->LinkOrUnlinkOperation(op); @@ -127,7 +127,7 @@ void KissCount::DeleteOperation(Operation& op) op.transfert = wxT(""); _user->LinkOrUnlinkOperation(op); } - _db->DeleteOperation(op); + _db->DeleteOperation(_user, op); } void KissCount::DeleteOperations(int month, int year) @@ -310,6 +310,7 @@ void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int year op.checked = false; op.id = AddOperation(op); op.childs.clear(); + op._virtual = false; if (op.meta) meta[it->id] = op.id; (*_user->_operations[yearTo])[monthTo].push_back(op); @@ -494,6 +495,11 @@ std::map* KissCount::GetNotChecked(int month, int year) return _db->GetNotChecked(_user, month, year); } +std::map* KissCount::GetVirtualAmount(int month, int year) +{ + return _db->GetVirtualAmount(_user, month, year); +} + wxFont KissCount::ExtractFont(wxString strFont) { long int pos, pointSize, family, style, weight; diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index b27fbda..229af3f 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -97,6 +97,7 @@ public: std::map* categories); std::map* GetNotChecked(int month, int year); + std::map* GetVirtualAmount(int month, int year); static wxFont ExtractFont(wxString strFont); static wxString CompactFont(const wxFont& font); diff --git a/src/model/Account.h b/src/model/Account.h index ce94877..211759a 100644 --- a/src/model/Account.h +++ b/src/model/Account.h @@ -33,6 +33,7 @@ public: bool blocked; bool _default; bool is_owner; + bool _virtual; }; #endif diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 05baac6..6b5e8a9 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -222,6 +222,7 @@ User* Database::LoadUser(const wxString& name) account.shared = set.GetBool(wxT("shared")); account.blocked = set.GetBool(wxT("blocked")); account._default = set.GetBool(wxT("default_account")); + account._virtual = set.GetBool(wxT("virtual")); account.is_owner = true; user->_accounts.push_back(account); } @@ -239,6 +240,7 @@ User* Database::LoadUser(const wxString& name) account.shared = set.GetBool(wxT("shared")); account.blocked = set.GetBool(wxT("blocked")); account._default = set.GetBool(wxT("default_account")); + account._virtual = set.GetBool(wxT("virtual")); account.is_owner = false; user->_accounts.push_back(account); } @@ -339,6 +341,7 @@ void Database::LoadYear(User* user, int year) op.transfert = set.GetAsString(wxT("transfert")); op.formula = set.GetAsString(wxT("formula")); op.meta = set.GetBool(wxT("meta")); + op._virtual = set.GetBool(wxT("virtual")); (*user->_operations[op.year])[op.month].push_back(op); } @@ -427,26 +430,30 @@ bool Database::GetOperation(const wxString& id, Operation* op) op->fix_cost = set.GetBool(wxT("fix_cost")); op->checked = set.GetBool(wxT("checked")); op->transfert = set.GetAsString(wxT("transfert")); - op->formula = set.GetAsString(wxT("formula")); + op->formula = set.GetAsString(wxT("formula")); op->meta = set.GetBool(wxT("meta")); + op->_virtual = set.GetBool(wxT("virtual")); return true; } -void Database::LinkOrUnlinkOperation(Operation& op) +void Database::LinkOrUnlinkOperation(User* user, Operation& op) { Operation linked; wxString req; wxSQLite3ResultSet set; + Account account, account2; + bool _virtual; if (op.transfert.Length()) { // No one or not linked if (!GetOperation(op.transfert, &linked) || op.description != linked.description || op.amount != -linked.amount || op.account == linked.account) { - req = wxT("UPDATE operation SET transfert='' where id='") + op.id + wxT("'") ; + req = wxT("UPDATE operation SET transfert='' virtual='0' WHERE id='") + op.id + wxT("'") ; EXECUTE_SQL_UPDATE(req, ); op.transfert = wxT(""); + op._virtual = 0; return; } } @@ -459,11 +466,11 @@ void Database::LinkOrUnlinkOperation(Operation& op) if (set.NextRow()) { - req = wxT("UPDATE operation SET transfert='' where id='") + set.GetAsString(wxT("id")) + wxT("'") ; + req = wxT("UPDATE operation SET transfert='', virtual='0' WHERE id='") + set.GetAsString(wxT("id")) + wxT("'") ; EXECUTE_SQL_UPDATE(req, ); } - req = wxT("SELECT id FROM operation WHERE description=\"") + op.description + wxT("\""); + req = wxT("SELECT id, account FROM operation WHERE description=\"") + op.description + wxT("\""); req += wxT(" AND month='") + wxString::Format(wxT("%d"), op.month) + wxT("'"); req += wxT(" AND year='") + wxString::Format(wxT("%d"), op.year) + wxT("'"); req += wxT(" AND amount='") + DoubleToString(-op.amount) + wxT("'"); @@ -473,6 +480,8 @@ void Database::LinkOrUnlinkOperation(Operation& op) EXECUTE_SQL_QUERY(req, set, ); + op._virtual = false; + // Don't need to link if (!set.NextRow()) return ; @@ -481,19 +490,37 @@ void Database::LinkOrUnlinkOperation(Operation& op) op.transfert = linked.id; - req = wxT("UPDATE operation SET transfert='") + linked.id + wxT("' where id='") + op.id + wxT("'") ; + account = user->GetAccount(op.account); + account2 = user->GetAccount(set.GetAsString(wxT("account"))); + + _virtual = account._virtual || account2._virtual; + + req = wxT("UPDATE operation SET transfert='") + linked.id + wxT("'"); + if (_virtual) + req += wxT(", virtual='1'"); + else + req += wxT(", virtual='0'"); + req += wxT(" WHERE id='") + op.id + wxT("'") ; + EXECUTE_SQL_UPDATE(req, ); - req = wxT("UPDATE operation SET transfert='") + op.id + wxT("' where id='") + linked.id + wxT("'") ; + req = wxT("UPDATE operation SET transfert='") + op.id + wxT("'") ; + if (_virtual) + req += wxT(", virtual='1'"); + else + req += wxT(", virtual='0'"); + req += wxT(" WHERE id='") + linked.id + wxT("'") ; EXECUTE_SQL_UPDATE(req, ); + + op._virtual = _virtual; } } -void Database::UpdateOperation(Operation& op) +void Database::UpdateOperation(User* user, Operation& op) { wxString req; - LinkOrUnlinkOperation(op); + LinkOrUnlinkOperation(user, op); ESCAPE_CHARS(op.description); @@ -519,12 +546,16 @@ void Database::UpdateOperation(Operation& op) req += wxT(", meta='1'"); else req += wxT(", meta='0'"); + if (op._virtual) + req += wxT(", virtual='1'"); + else + req += wxT(", virtual='0'"); req += wxT(", formula='") + op.formula + wxT("'"); req += wxT(" WHERE id='") + op.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); - LinkOrUnlinkOperation(op); + LinkOrUnlinkOperation(user, op); } wxString Database::AddOperation(User* user, Operation& op) @@ -534,7 +565,7 @@ wxString Database::AddOperation(User* user, Operation& op) ESCAPE_CHARS(op.description); - req = wxT("INSERT INTO operation ('user', 'parent', 'account', 'year', 'month', 'day', 'amount', 'description', 'category', 'fix_cost', 'formula', 'transfert', 'meta') VALUES ('") ; + req = wxT("INSERT INTO operation ('user', 'parent', 'account', 'year', 'month', 'day', 'amount', 'description', 'category', 'fix_cost', 'formula', 'transfert', 'meta', 'virtual') VALUES ('") ; req += user->_id + wxT("'"); req += wxT(", '") + op.parent + wxT("'"); req += wxT(", '") + op.account + wxT("'"); @@ -554,6 +585,10 @@ wxString Database::AddOperation(User* user, Operation& op) req += wxT(", '1'") ; else req += wxT(", '0'") ; + if (op._virtual) + req += wxT(", '1'") ; + else + req += wxT(", '0'") ; req += wxT(")"); EXECUTE_SQL_UPDATE(req, wxT("0")); @@ -562,19 +597,19 @@ wxString Database::AddOperation(User* user, Operation& op) op.id = res; - LinkOrUnlinkOperation(op); + LinkOrUnlinkOperation(user, op); return res; } -void Database::DeleteOperation(Operation& op) +void Database::DeleteOperation(User* user, Operation& op) { wxString req; req = wxT("DELETE FROM operation WHERE id='") + op.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); - LinkOrUnlinkOperation(op); + LinkOrUnlinkOperation(user, op); } void Database::DeleteOperations(User* user, int month, int year) @@ -638,8 +673,9 @@ bool Database::LoadOperation(User* user, const wxString& id) op.fix_cost = set.GetBool(wxT("fix_cost")); op.checked = set.GetBool(wxT("checked")); op.transfert = set.GetAsString(wxT("transfert")); - op.formula = set.GetAsString(wxT("formula")); + op.formula = set.GetAsString(wxT("formula")); op.meta = set.GetBool(wxT("meta")); + op._virtual = set.GetBool(wxT("virtual")); if (user->_operations[op.year]) { @@ -747,7 +783,7 @@ wxString Database::AddAccount(User* user, Account& ac) { wxString req; - req = wxT("INSERT INTO account ('user', 'name', 'number', 'shared', 'blocked', 'default_account') VALUES ('") ; + req = wxT("INSERT INTO account ('user', 'name', 'number', 'shared', 'blocked', 'default_account', 'virtual') VALUES ('") ; req += user->_id + wxT("'"); req += wxT(", '") + ac.name + wxT("'"); req += wxT(", '") + ac.number + wxT("'"); @@ -763,6 +799,10 @@ wxString Database::AddAccount(User* user, Account& ac) req += wxT(", '1'") ; else req += wxT(", '0'") ; + if (ac._virtual) + req += wxT(", '1'") ; + else + req += wxT(", '0'") ; req += wxT(")"); EXECUTE_SQL_UPDATE(req, wxT("0")); @@ -788,6 +828,10 @@ void Database::UpdateAccount(Account& ac) req += wxT(", default_account='1'"); else req += wxT(", default_account='0'"); + if (ac._virtual) + req += wxT(", virtual='1'"); + else + req += wxT(", virtual='0'"); req += wxT(" WHERE id='") + ac.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); @@ -1595,6 +1639,32 @@ std::map* Database::GetNotChecked(User* user, int month, int y return res; } +std::map* Database::GetVirtualAmount(User* user, int month, int year) +{ + std::vector::iterator accountIt; + std::map* res = new std::map; + wxSQLite3ResultSet set; + wxString req; + + for (accountIt = user->_accounts.begin() ;accountIt != user->_accounts.end(); accountIt++) + { + req = wxT("SELECT SUM(amount) AS amount FROM operation WHERE account='") + accountIt->id + wxT("'"); + req += wxT(" AND virtual='1'"); + req += wxT(" AND meta='0'"); + req += wxT(" AND (year < '") + wxString::Format(wxT("%d"), year) + wxT("'") ; + req += wxT(" OR (year == '") + wxString::Format(wxT("%d"), year) + wxT("'") ; + req += wxT(" AND month < '") + wxString::Format(wxT("%d"), month) + wxT("'") ; + req += wxT("))"); + + EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, delete res, delete res); + + if (set.NextRow()) + (*res)[accountIt->id] = set.GetDouble(wxT("amount")); + } + + return res; +} + std::map Database::getSharedAccountOwners(const wxString& account) { std::map res; diff --git a/src/model/Database.h b/src/model/Database.h index 8ac25df..c10f4f7 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -107,9 +107,9 @@ public: User* LoadUser(const wxString& name); void LoadYear(User* user, int year); - void UpdateOperation(Operation& op); + void UpdateOperation(User* user, Operation& op); wxString AddOperation(User* user, Operation& op); - void DeleteOperation(Operation& op); + void DeleteOperation(User* user, Operation& op); void DeleteOperations(User* user, int month, int year); bool LoadOperation(User* user, const wxString& id); double MetaAmount(const wxString& id); @@ -158,6 +158,7 @@ public: wxString getSharedAccountOwner(const wxString& account); std::map* GetNotChecked(User* user, int month, int year); + std::map* GetVirtualAmount(User* user, int month, int year); /* Database Update */ @@ -169,7 +170,7 @@ private: void CreateDatabase(); wxString HashPassword(const wxString& password); - void LinkOrUnlinkOperation(Operation& op); + void LinkOrUnlinkOperation(User* user, Operation& op); }; #endif diff --git a/src/model/Database_Update.cpp b/src/model/Database_Update.cpp index b391901..65d861d 100644 --- a/src/model/Database_Update.cpp +++ b/src/model/Database_Update.cpp @@ -55,7 +55,15 @@ static void Version_1_to_2(wxSQLite3Database& _db) req = wxT("UPDATE account SET virtual='0'"); UPDATE_TABLE("1", "2", "5"); - + + /* Operation */ + req = wxT("ALTER TABLE operation ADD virtual CHAR(1)"); + + UPDATE_TABLE("1", "2", "6"); + + req = wxT("UPDATE operation SET virtual='0'"); + + UPDATE_TABLE("1", "2", "7"); } static update_func updates[] = { diff --git a/src/model/Operation.h b/src/model/Operation.h index 0328bb2..a0f22b5 100644 --- a/src/model/Operation.h +++ b/src/model/Operation.h @@ -36,6 +36,7 @@ public: wxString transfert; wxString formula; bool meta; + bool _virtual; std::vector childs; } ; diff --git a/src/model/User.cpp b/src/model/User.cpp index 6c16bca..e168932 100644 --- a/src/model/User.cpp +++ b/src/model/User.cpp @@ -168,6 +168,7 @@ wxLanguage User::GetLanguage() void User::LinkOrUnlinkOperation(Operation& op) { std::vector::iterator it; + Account account, account2; // Not Linked if (!op.transfert.Length()) @@ -177,6 +178,7 @@ void User::LinkOrUnlinkOperation(Operation& op) if (it->id != op.id && it->transfert == op.id) { it->transfert = wxT(""); + it->_virtual = false; return; } } @@ -188,11 +190,16 @@ void User::LinkOrUnlinkOperation(Operation& op) { if (it->id != op.id && it->id == op.transfert) { + account = GetAccount(it->account); + account2 = GetAccount(op.account); it->transfert = op.id; + it->_virtual = account._virtual || account2._virtual; + op._virtual = account._virtual || account2._virtual; return; } } op.transfert = wxT(""); + op._virtual = false; } } diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index f7bc5b4..4e8ebf0 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -434,6 +434,7 @@ void AccountPanel::UpdateStats() unsigned int day; bool checkMode = _checkCheckMode->IsChecked(); std::map* notChecked = NULL; + std::map* virtuals = NULL; Account account; Operation op; bool blocked_account ; @@ -443,6 +444,7 @@ void AccountPanel::UpdateStats() if (checkMode) { notChecked = _kiss->GetNotChecked(_curMonth, _curYear); + virtuals = _kiss->GetVirtualAmount(_curMonth, _curYear); } day = _calendar->GetDate().GetDay()-1; @@ -454,6 +456,12 @@ void AccountPanel::UpdateStats() { curAccountAmount[doubleIt->first] = _accountsInitValues[doubleIt->first]; finalAccountAmount[doubleIt->first] = _accountsInitValues[doubleIt->first]; + + if (virtuals) + { + curAccountAmount[doubleIt->first] += -(*virtuals)[doubleIt->first]; + finalAccountAmount[doubleIt->first] += -(*virtuals)[doubleIt->first]; + } } for (it=_curOperations->begin(); it!=_curOperations->end(); it++) @@ -547,7 +555,7 @@ void AccountPanel::UpdateStats() else { value = _accountsInitValues[accountIt->id]; - value2 = (*notChecked)[accountIt->id]; + value2 = (*notChecked)[accountIt->id] + (*virtuals)[accountIt->id]; _accountsGrid->SetCellValue(i, ACCOUNT_INIT, wxString::Format(wxT("%.2lf (%.2lf)"), value, value-value2)); value = curAccountAmount[accountIt->id]; @@ -563,6 +571,7 @@ void AccountPanel::UpdateStats() _accountsGrid->AutoSizeColumn(ACCOUNT_FINAL, true); if (notChecked) delete notChecked; + if (virtuals) delete virtuals; _statsGrid->AutoSizeColumn(1, true); diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 3098b89..6013280 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -19,7 +19,7 @@ #include "PreferencesPanel.h" -enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_BLOCKED, ACCOUNT_DELETE, NUMBER_COLS_ACCOUNT}; +enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_VIRTUAL, ACCOUNT_BLOCKED, ACCOUNT_DELETE, NUMBER_COLS_ACCOUNT}; enum {CATEGORY_NAME, CATEGORY_BACKGROUND_COLOR, CATEGORY_FOREGROUND_COLOR, CATEGORY_FONT, CATEGORY_DELETE, NUMBER_COLS_CATEGORY}; enum {CATEGORIES_GRID_ID=1, ACCOUNTS_GRID_ID, NAME_ID, CHANGE_NAME_ID, CHANGE_PASSWORD_ID, KILL_ME_ID, LANGUAGE_ID, @@ -196,6 +196,7 @@ void PreferencesPanel::InitAccounts(User* user) _accountsGrid->SetColLabelValue(ACCOUNT_NAME, _("Name")); _accountsGrid->SetColLabelValue(ACCOUNT_NUMBER, _("Number")); _accountsGrid->SetColLabelValue(ACCOUNT_DEFAULT, _("Default")); + _accountsGrid->SetColLabelValue(ACCOUNT_VIRTUAL, _("Virtual")); _accountsGrid->SetColLabelValue(ACCOUNT_BLOCKED, _("Blocked")); _accountsGrid->SetColLabelValue(ACCOUNT_DELETE, _("Delete")); _accountsGrid->SetDefaultCellFont(font); @@ -224,6 +225,8 @@ void PreferencesPanel::AddAccount(int line, Account ac) _accountsGrid->SetCellEditor(line, ACCOUNT_NUMBER, new wxGridCellStarEditor ()); _accountsGrid->SetCellRenderer(line, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellEditor(line, ACCOUNT_DEFAULT, new wxGridCellFastBoolEditor ()); + _accountsGrid->SetCellRenderer(line, ACCOUNT_VIRTUAL, new wxGridCellBoolRenderer ()); + _accountsGrid->SetCellEditor(line, ACCOUNT_VIRTUAL, new wxGridCellFastBoolEditor ()); _accountsGrid->SetCellRenderer(line, ACCOUNT_BLOCKED, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellEditor(line, ACCOUNT_BLOCKED, new wxGridCellFastBoolEditor ()); _accountsGrid->SetCellRenderer(line, ACCOUNT_DELETE, new wxGridCellBoolRenderer ()); @@ -232,6 +235,7 @@ void PreferencesPanel::AddAccount(int line, Account ac) _accountsGrid->SetCellValue(line, ACCOUNT_BLOCKED, (ac.blocked)?wxT("1"):wxT("0")); _accountsGrid->SetCellAlignment(line, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE); + _accountsGrid->SetCellAlignment(line, ACCOUNT_VIRTUAL, wxALIGN_CENTRE, wxALIGN_CENTRE); _accountsGrid->SetCellAlignment(line, ACCOUNT_BLOCKED, wxALIGN_CENTRE, wxALIGN_CENTRE); _accountsGrid->SetCellAlignment(line, ACCOUNT_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE); @@ -240,11 +244,13 @@ void PreferencesPanel::AddAccount(int line, Account ac) _accountsGrid->SetReadOnly(line, ACCOUNT_NAME, true); _accountsGrid->SetReadOnly(line, ACCOUNT_NUMBER, true); _accountsGrid->SetReadOnly(line, ACCOUNT_DEFAULT, true); + _accountsGrid->SetReadOnly(line, ACCOUNT_VIRTUAL, true); _accountsGrid->SetReadOnly(line, ACCOUNT_BLOCKED, true); } else { _accountsGrid->SetReadOnly(line, ACCOUNT_DEFAULT, false); + _accountsGrid->SetReadOnly(line, ACCOUNT_VIRTUAL, false); _accountsGrid->SetReadOnly(line, ACCOUNT_BLOCKED, false); _accountsGrid->SetReadOnly(line, ACCOUNT_DELETE, false); } @@ -252,6 +258,7 @@ void PreferencesPanel::AddAccount(int line, Account ac) else { _accountsGrid->SetReadOnly(line, ACCOUNT_DEFAULT, true); + _accountsGrid->SetReadOnly(line, ACCOUNT_VIRTUAL, true); _accountsGrid->SetReadOnly(line, ACCOUNT_BLOCKED, true); _accountsGrid->SetReadOnly(line, ACCOUNT_DELETE, true); @@ -402,6 +409,12 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) else new_account._default = false; + value = _accountsGrid->GetCellValue(row, ACCOUNT_VIRTUAL); + if (value.Length() && value != wxT("0")) + new_account._virtual = true; + else + new_account._virtual = false; + value = _accountsGrid->GetCellValue(row, ACCOUNT_BLOCKED); if (value.Length() && value != wxT("0")) new_account.blocked = true; @@ -507,6 +520,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) new_account.shared = false; new_account.blocked = false; new_account.is_owner = true; + new_account._virtual = false; AddAccount(row, new_account); _kiss->AddAccount(new_account); diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index b90885b..ca836f5 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -901,6 +901,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) new_op.meta = cur_op.meta; new_op.parent = cur_op.parent; new_op.childs = cur_op.childs; + new_op._virtual = cur_op._virtual; if (cur_op.day != new_op.day) { @@ -929,6 +930,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) fix_op = true; new_op.fix_cost = true; new_op.meta = false; + new_op._virtual = false; for(i=0; i\n"; echo "\n"; echo "

\n"; - echo "
KissCount © 2010 Grégory Soutadé
\n"; + echo "
KissCount © 2010-2011 Grégory Soutadé
\n"; die(); } else From 92252f33c3327e3acb22927dceb10d015245db0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Tue, 15 Feb 2011 19:17:18 +0100 Subject: [PATCH 34/72] Searchs aren't case sensitive enough. Default categories in native language (even if switching language at runtime) --- ChangeLog | 4 +- ressources/po/french.mo | Bin 7754 -> 7825 bytes ressources/po/french.po | 140 +++++++++++++++++----------------- ressources/po/kisscount.pot | 110 +++++++++++++------------- src/controller/KissCount.cpp | 18 +++-- src/model/Database.cpp | 2 +- src/view/AccountPanel.cpp | 2 +- src/view/PreferencesPanel.cpp | 2 +- src/view/grid/GridAccount.cpp | 2 +- 9 files changed, 148 insertions(+), 132 deletions(-) diff --git a/ChangeLog b/ChangeLog index f23b3bc..5c06f43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2_dev (14/02/2011) +v0.2_dev (15/02/2011) ** User ** Better use of sizers (so better interface!) @@ -9,6 +9,8 @@ v0.2_dev (14/02/2011) Possibility to find operations with unknown category/account Possibility to work on multiple operations (rename, change category, change account) Add virtual accounts + Searchs aren't case sensitive enough + Default categories in native language (even if switching language at runtime) ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/ressources/po/french.mo b/ressources/po/french.mo index d0ccb9479a9553883bf6cd9ce92b0e9fccd6d77e..18167fc8d5a6e6576b51322776b4b692305d83d2 100644 GIT binary patch delta 3042 zcmYk;d2AI$9Ki7bS_>4Rv6r@}#f?9-1xo?4@a+Irr+)pk`p@Pa2il7#PT1+$= zF(MH!LToe`qkst-5ENpFi4qfp_=jK!k|2Txzu))9giU|@ncbb8<2SPpjtqFIH2F(z z#w&s2d7=X`FC&Eg_+evC9J{kaXoT-!3;YP1;}_TpkK)aE8k^t+9EE?!`$L+Aki~Tw z+T>KU-fZMA84{druo|tf33)ecLo2?H4r~{8#INH0UonU4^JoYE;!T*zXbP|yTE8bY z#j$AnlhJl7Fq{6vA_~r|3LVJCcwHCWi8fG=cJw7W^RMw1{25!~MRY)oXvBfELf>nT zcGwlE5_%&^4gndaw!X~s{9oq43 z^!?AU6COjC=0XedZ$~Yt(!zI+>X|J8=cT8wB2*) zdzaA6T|qON!RQ-ec1!Ya1I@YNj5=^)aG@8P@_}eZ#-IZ%L)r+_uoe^84lkn}v?Luq zFF*&-3+=FPv^3ryj@BQSq+mzo=!oW`YqtQMX#%ZSjW$?=u6-@~-p+V`4?5FN(E)!R zJs6*V6a5~$@cc(C!sI`((3u7D#nI@9Ct&JxiB_NkScrDCJX(dmw+0<}5`C`*t-l4$ z+;*JVAcQy3de>NA_g}b9fqS7j-;!(I8C}Es&=*JIB%FwhHS9tMxDU<1eze0Q=u-ZG ztVTGE4&V}+!E4d1*69r7VK=}3eiZCzHk#T5`r?M@3uvld#_qTeZSXWYfIrXyUx{YX zi0!oI@wBvJV$A6)lwPAjG zNpjIlw22m?nd*VQ-y5B1KXh*m#iR|EQ84v0&=*!<309*i{TN;I1M&GGwEj_a)1F2f zJc~}`BHCeSo3?Q@2OV%e`hNGe%hIl07MOqfi_l%tAX#pd+q~_t!;hfa(S|mo zGxV5AOd?i$!BIsFBpxT`5qA^*EIYu-#Bjo+yWhXZW5hkFQV35*#iem{v2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4na%00v%vOJYS7ozXN?) z51<_$L@V(DI^e13=h1J_3IBlJe;IS}Ru=X5Ku+hz-}r%Oi6)~R&x^;a&{FP<`?cs= zo6eUM3LCFZ03twaZ^K_~PoTG{>R^@kE{>|o<0@(`hde|2842%Y(A z^vP<_HQp6{En16S{~lVgCjO2my7NENfeO$W7o#1H zh?b+Joq;`YF51CX9EIGHLmGDZUB}5}A{j$` z!WW23(X=gQ$I1Hc^p7XD;h?z9H!VC)o+Ca?E}_t&n%qTPvUy~!-+!B>9!M4t|G`+& zIfU0DJVBba8SJbhzM!j!>p7J?L>?xE#CNF~Sx;;(%?Q$y^dPp4q+$G_Y}`wza2QDj zkV#}Xu{}VN$tE(6+(T?7PiIljIZI;70!c9L5&ED`5qhy*s^ihXik4LwlM}zl>AJa#BFbh^-&-i#*F6 z+63|4khveF4Z8PCjZa>Y!xm(?9i+teayeqDb0 e8%cF%GBT4=igO1HEh!pY_h*Mgsk`6IzWOg@hw38$ diff --git a/ressources/po/french.po b/ressources/po/french.po index 431accb..9d82426 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-13 19:27+0100\n" +"POT-Creation-Date: 2011-02-15 19:15+0100\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -20,16 +20,16 @@ msgstr "" # FIRST AUTHOR , YEAR. # #: src/view/StatsPanel.cpp:358 -#: src/view/PreferencesPanel.cpp:817 +#: src/view/PreferencesPanel.cpp:831 msgid " - " msgstr " - " #: src/view/UsersDialog.cpp:120 -#: src/view/PreferencesPanel.cpp:482 -#: src/view/PreferencesPanel.cpp:502 -#: src/view/PreferencesPanel.cpp:712 -#: src/view/PreferencesPanel.cpp:731 -#: src/view/PreferencesPanel.cpp:775 +#: src/view/PreferencesPanel.cpp:495 +#: src/view/PreferencesPanel.cpp:515 +#: src/view/PreferencesPanel.cpp:726 +#: src/view/PreferencesPanel.cpp:745 +#: src/view/PreferencesPanel.cpp:789 msgid " already exists" msgstr " existe déjà" @@ -41,11 +41,11 @@ msgstr " entrées trouvées" msgid " not found, aborting" msgstr " non trouvé, arrêt" -#: src/view/AccountPanel.cpp:757 +#: src/view/AccountPanel.cpp:766 msgid " operations ?" msgstr " opérations ?" -#: src/view/PreferencesPanel.cpp:824 +#: src/view/PreferencesPanel.cpp:838 msgid " profil ?" msgstr " profil ?" @@ -62,12 +62,12 @@ msgstr "1 entrée trouvée" msgid "Account" msgstr "Compte" -#: src/view/PreferencesPanel.cpp:482 -#: src/view/PreferencesPanel.cpp:502 +#: src/view/PreferencesPanel.cpp:495 +#: src/view/PreferencesPanel.cpp:515 msgid "Account " msgstr "Le compte " -#: src/controller/KissCount.cpp:363 +#: src/controller/KissCount.cpp:370 msgid "Account 1" msgstr "Compte 1" @@ -92,8 +92,8 @@ msgstr "Montant min" msgid "Amount to" msgstr "Montant max" -#: src/view/PreferencesPanel.cpp:824 -#: src/view/AccountPanel.cpp:752 +#: src/view/PreferencesPanel.cpp:838 +#: src/view/AccountPanel.cpp:761 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " @@ -101,15 +101,15 @@ msgstr "Etes vous sûr de vouloir supprimer " msgid "Are you sure want to delete : \n" msgstr "Etes vous sûr de vouloir supprimer : \n" -#: src/view/PreferencesPanel.cpp:361 +#: src/view/PreferencesPanel.cpp:368 msgid "Ascending" msgstr "Croissant" -#: src/view/PreferencesPanel.cpp:285 +#: src/view/PreferencesPanel.cpp:292 msgid "Background color" msgstr "Couleur d'arrière plan" -#: src/view/PreferencesPanel.cpp:199 +#: src/view/PreferencesPanel.cpp:200 msgid "Blocked" msgstr "Bloqué" @@ -119,13 +119,13 @@ msgstr "Bloqué" msgid "Cancel" msgstr "Annuler" -#: src/view/grid/GridAccount.cpp:1267 -#: src/view/grid/GridAccount.cpp:1274 +#: src/view/grid/GridAccount.cpp:1271 +#: src/view/grid/GridAccount.cpp:1278 msgid "Cannot group these operations" msgstr "Impossible de grouper ces opérations" -#: src/view/grid/GridAccount.cpp:1393 -#: src/view/grid/GridAccount.cpp:1399 +#: src/view/grid/GridAccount.cpp:1397 +#: src/view/grid/GridAccount.cpp:1403 msgid "Cannot ungroup these operations" msgstr "Impossible de dégrouper ces opérations" @@ -138,8 +138,8 @@ msgstr "Catégories" msgid "Category" msgstr "Catégorie" -#: src/view/PreferencesPanel.cpp:712 -#: src/view/PreferencesPanel.cpp:731 +#: src/view/PreferencesPanel.cpp:726 +#: src/view/PreferencesPanel.cpp:745 msgid "Category " msgstr "La catégorie " @@ -224,13 +224,13 @@ msgstr "Débit" msgid "Default" msgstr "Défaut" -#: src/view/PreferencesPanel.cpp:200 -#: src/view/PreferencesPanel.cpp:288 -#: src/view/AccountPanel.cpp:611 +#: src/view/PreferencesPanel.cpp:201 +#: src/view/PreferencesPanel.cpp:295 +#: src/view/AccountPanel.cpp:620 msgid "Delete" msgstr "Supprimer" -#: src/view/PreferencesPanel.cpp:362 +#: src/view/PreferencesPanel.cpp:369 msgid "Descending" msgstr "Décroissant" @@ -249,20 +249,20 @@ msgstr "Nouvelle description" #: src/view/SearchPanel.cpp:189 #: src/view/SearchPanel.cpp:203 #: src/view/SearchPanel.cpp:214 -#: src/view/PreferencesPanel.cpp:422 -#: src/view/PreferencesPanel.cpp:482 -#: src/view/PreferencesPanel.cpp:502 -#: src/view/PreferencesPanel.cpp:712 -#: src/view/PreferencesPanel.cpp:731 -#: src/view/PreferencesPanel.cpp:769 -#: src/view/PreferencesPanel.cpp:775 +#: src/view/PreferencesPanel.cpp:435 +#: src/view/PreferencesPanel.cpp:495 +#: src/view/PreferencesPanel.cpp:515 +#: src/view/PreferencesPanel.cpp:726 +#: src/view/PreferencesPanel.cpp:745 +#: src/view/PreferencesPanel.cpp:783 +#: src/view/PreferencesPanel.cpp:789 #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 -#: src/view/AccountPanel.cpp:748 -#: src/view/grid/GridAccount.cpp:1267 -#: src/view/grid/GridAccount.cpp:1274 -#: src/view/grid/GridAccount.cpp:1393 -#: src/view/grid/GridAccount.cpp:1399 +#: src/view/AccountPanel.cpp:757 +#: src/view/grid/GridAccount.cpp:1271 +#: src/view/grid/GridAccount.cpp:1278 +#: src/view/grid/GridAccount.cpp:1397 +#: src/view/grid/GridAccount.cpp:1403 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 #: src/model/Database.cpp:42 #: src/model/Database.cpp:49 @@ -284,15 +284,15 @@ msgstr "Valeur finale" #: src/view/SearchPanel.cpp:84 #: src/view/grid/GridAccount.cpp:329 -#: src/controller/KissCount.cpp:379 +#: src/controller/KissCount.cpp:361 msgid "Fix" msgstr "Fixe" -#: src/view/PreferencesPanel.cpp:287 +#: src/view/PreferencesPanel.cpp:294 msgid "Font" msgstr "Police" -#: src/view/PreferencesPanel.cpp:286 +#: src/view/PreferencesPanel.cpp:293 msgid "Foreground color" msgstr "Couleur d'avant plan" @@ -305,11 +305,11 @@ msgid "From " msgstr "A partir de " #: src/view/GenerateDialog.cpp:31 -#: src/view/AccountPanel.cpp:608 +#: src/view/AccountPanel.cpp:617 msgid "Generate month" msgstr "Générer mois" -#: src/controller/KissCount.cpp:381 +#: src/controller/KissCount.cpp:361 msgid "Groceries" msgstr "Courses" @@ -317,7 +317,7 @@ msgstr "Courses" msgid "Group" msgstr "Grouper" -#: src/controller/KissCount.cpp:383 +#: src/controller/KissCount.cpp:361 msgid "Hobbies" msgstr "Loisirs" @@ -345,7 +345,7 @@ msgstr "Intervalle de temps invalide" msgid "Invalid formula !" msgstr "Formule invalide !" -#: src/view/PreferencesPanel.cpp:769 +#: src/view/PreferencesPanel.cpp:783 msgid "Invalid name" msgstr "Nom invalide" @@ -361,11 +361,11 @@ msgstr "Mot de passe invalide" msgid "Invalide date range" msgstr "Intervalle de temps invalide" -#: src/view/PreferencesPanel.cpp:422 +#: src/view/PreferencesPanel.cpp:435 msgid "It must be at least one account !" msgstr "Il doit y avoir au moins un compte !" -#: src/view/AccountPanel.cpp:748 +#: src/view/AccountPanel.cpp:757 msgid "It must be at least one month !" msgstr "Il doit rester au moins un mois" @@ -374,9 +374,9 @@ msgid "Kill me" msgstr "Kill me" #: src/view/StatsPanel.cpp:377 -#: src/view/PreferencesPanel.cpp:809 -#: src/view/PreferencesPanel.cpp:812 -#: src/model/Database_Update.cpp:127 +#: src/view/PreferencesPanel.cpp:823 +#: src/view/PreferencesPanel.cpp:826 +#: src/model/Database_Update.cpp:135 msgid "KissCount" msgstr "KissCount" @@ -384,21 +384,21 @@ msgstr "KissCount" msgid "Language" msgstr "Langue" -#: src/view/PreferencesPanel.cpp:812 +#: src/view/PreferencesPanel.cpp:826 msgid "Language not changed" msgstr "Langue non changée" -#: src/view/PreferencesPanel.cpp:809 +#: src/view/PreferencesPanel.cpp:823 msgid "Language successfully changed, please go to another panel" msgstr "Langue changée, allez sur un autre panneau pour rendre le changement effectif" #: src/view/PreferencesPanel.cpp:72 #: src/view/PreferencesPanel.cpp:196 -#: src/view/PreferencesPanel.cpp:284 +#: src/view/PreferencesPanel.cpp:291 msgid "Name" msgstr "Nom" -#: src/view/PreferencesPanel.cpp:781 +#: src/view/PreferencesPanel.cpp:795 msgid "Name changed" msgstr "Nom changé" @@ -429,8 +429,8 @@ msgstr "Courantes" #: src/view/SearchPanel.cpp:304 #: src/view/SearchPanel.cpp:346 -#: src/view/PreferencesPanel.cpp:427 -#: src/view/PreferencesPanel.cpp:687 +#: src/view/PreferencesPanel.cpp:440 +#: src/view/PreferencesPanel.cpp:701 msgid "None" msgstr "Aucun" @@ -452,8 +452,8 @@ msgstr "OK" msgid "Old password " msgstr "Ancien mot de passe " -#: src/controller/KissCount.cpp:385 -msgid "Operating exepense" +#: src/controller/KissCount.cpp:361 +msgid "Operating expense" msgstr "Fonctionnement" #: src/view/PreferencesPanel.cpp:63 @@ -465,7 +465,7 @@ msgstr "Ordre des opérations" msgid "Operations" msgstr "Opérations" -#: src/controller/KissCount.cpp:389 +#: src/controller/KissCount.cpp:362 msgid "Other" msgstr "Autres" @@ -500,8 +500,8 @@ msgid "Please retype new password" msgstr "Re entrez le mot de passe" #: src/view/PreferencesPanel.cpp:184 -#: src/view/PreferencesPanel.cpp:783 -#: src/view/PreferencesPanel.cpp:817 +#: src/view/PreferencesPanel.cpp:797 +#: src/view/PreferencesPanel.cpp:831 msgid "Preferences" msgstr "Préférences" @@ -564,7 +564,7 @@ msgstr "Dégrouper" msgid "Unable to open Database" msgstr "Impossible d'ouvrir la base de données" -#: src/controller/KissCount.cpp:387 +#: src/controller/KissCount.cpp:362 msgid "Unexpected" msgstr "Exceptionnel" @@ -582,7 +582,7 @@ msgstr "Utilisateur" #: src/view/UsersDialog.cpp:39 #: src/view/UsersDialog.cpp:120 -#: src/view/PreferencesPanel.cpp:775 +#: src/view/PreferencesPanel.cpp:789 msgid "User " msgstr "Utilisateur " @@ -590,19 +590,23 @@ msgstr "Utilisateur " msgid "Users" msgstr "Utilisateurs" -#: src/view/grid/GridAccount.cpp:1044 +#: src/view/PreferencesPanel.cpp:199 +msgid "Virtual" +msgstr "Virtuel" + +#: src/view/grid/GridAccount.cpp:1048 msgid "Warning" msgstr "Attention" -#: src/view/PreferencesPanel.cpp:432 +#: src/view/PreferencesPanel.cpp:445 msgid "Wich account will replace this one ?" msgstr "Quel compte va remplacer celui-ci ?" -#: src/view/PreferencesPanel.cpp:692 +#: src/view/PreferencesPanel.cpp:706 msgid "Wich category will replace this one ?" msgstr "Quelle catégorie va remplacer celle-ci" -#: src/view/grid/GridAccount.cpp:1044 +#: src/view/grid/GridAccount.cpp:1048 msgid "You made a debit on a blocked account" msgstr "Vous avez effectué une opération de débit sur un compte bloqué" diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index cf1ed36..7c9e767 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-13 19:27+0100\n" +"POT-Creation-Date: 2011-02-15 19:15+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,13 +17,13 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/view/StatsPanel.cpp:358 src/view/PreferencesPanel.cpp:817 +#: src/view/StatsPanel.cpp:358 src/view/PreferencesPanel.cpp:831 msgid " - " msgstr "" -#: src/view/UsersDialog.cpp:120 src/view/PreferencesPanel.cpp:482 -#: src/view/PreferencesPanel.cpp:502 src/view/PreferencesPanel.cpp:712 -#: src/view/PreferencesPanel.cpp:731 src/view/PreferencesPanel.cpp:775 +#: src/view/UsersDialog.cpp:120 src/view/PreferencesPanel.cpp:495 +#: src/view/PreferencesPanel.cpp:515 src/view/PreferencesPanel.cpp:726 +#: src/view/PreferencesPanel.cpp:745 src/view/PreferencesPanel.cpp:789 msgid " already exists" msgstr "" @@ -35,11 +35,11 @@ msgstr "" msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:757 +#: src/view/AccountPanel.cpp:766 msgid " operations ?" msgstr "" -#: src/view/PreferencesPanel.cpp:824 +#: src/view/PreferencesPanel.cpp:838 msgid " profil ?" msgstr "" @@ -55,11 +55,11 @@ msgstr "" msgid "Account" msgstr "" -#: src/view/PreferencesPanel.cpp:482 src/view/PreferencesPanel.cpp:502 +#: src/view/PreferencesPanel.cpp:495 src/view/PreferencesPanel.cpp:515 msgid "Account " msgstr "" -#: src/controller/KissCount.cpp:363 +#: src/controller/KissCount.cpp:370 msgid "Account 1" msgstr "" @@ -83,7 +83,7 @@ msgstr "" msgid "Amount to" msgstr "" -#: src/view/PreferencesPanel.cpp:824 src/view/AccountPanel.cpp:752 +#: src/view/PreferencesPanel.cpp:838 src/view/AccountPanel.cpp:761 msgid "Are you sure want to delete " msgstr "" @@ -91,15 +91,15 @@ msgstr "" msgid "Are you sure want to delete : \n" msgstr "" -#: src/view/PreferencesPanel.cpp:361 +#: src/view/PreferencesPanel.cpp:368 msgid "Ascending" msgstr "" -#: src/view/PreferencesPanel.cpp:285 +#: src/view/PreferencesPanel.cpp:292 msgid "Background color" msgstr "" -#: src/view/PreferencesPanel.cpp:199 +#: src/view/PreferencesPanel.cpp:200 msgid "Blocked" msgstr "" @@ -108,11 +108,11 @@ msgstr "" msgid "Cancel" msgstr "" -#: src/view/grid/GridAccount.cpp:1267 src/view/grid/GridAccount.cpp:1274 +#: src/view/grid/GridAccount.cpp:1271 src/view/grid/GridAccount.cpp:1278 msgid "Cannot group these operations" msgstr "" -#: src/view/grid/GridAccount.cpp:1393 src/view/grid/GridAccount.cpp:1399 +#: src/view/grid/GridAccount.cpp:1397 src/view/grid/GridAccount.cpp:1403 msgid "Cannot ungroup these operations" msgstr "" @@ -124,7 +124,7 @@ msgstr "" msgid "Category" msgstr "" -#: src/view/PreferencesPanel.cpp:712 src/view/PreferencesPanel.cpp:731 +#: src/view/PreferencesPanel.cpp:726 src/view/PreferencesPanel.cpp:745 msgid "Category " msgstr "" @@ -208,12 +208,12 @@ msgstr "" msgid "Default" msgstr "" -#: src/view/PreferencesPanel.cpp:200 src/view/PreferencesPanel.cpp:288 -#: src/view/AccountPanel.cpp:611 +#: src/view/PreferencesPanel.cpp:201 src/view/PreferencesPanel.cpp:295 +#: src/view/AccountPanel.cpp:620 msgid "Delete" msgstr "" -#: src/view/PreferencesPanel.cpp:362 +#: src/view/PreferencesPanel.cpp:369 msgid "Descending" msgstr "" @@ -228,13 +228,13 @@ msgstr "" #: src/view/UsersDialog.cpp:90 src/view/UsersDialog.cpp:120 #: src/view/SearchPanel.cpp:179 src/view/SearchPanel.cpp:189 #: src/view/SearchPanel.cpp:203 src/view/SearchPanel.cpp:214 -#: src/view/PreferencesPanel.cpp:422 src/view/PreferencesPanel.cpp:482 -#: src/view/PreferencesPanel.cpp:502 src/view/PreferencesPanel.cpp:712 -#: src/view/PreferencesPanel.cpp:731 src/view/PreferencesPanel.cpp:769 -#: src/view/PreferencesPanel.cpp:775 src/view/PasswordDialog.cpp:72 -#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:748 -#: src/view/grid/GridAccount.cpp:1267 src/view/grid/GridAccount.cpp:1274 -#: src/view/grid/GridAccount.cpp:1393 src/view/grid/GridAccount.cpp:1399 +#: src/view/PreferencesPanel.cpp:435 src/view/PreferencesPanel.cpp:495 +#: src/view/PreferencesPanel.cpp:515 src/view/PreferencesPanel.cpp:726 +#: src/view/PreferencesPanel.cpp:745 src/view/PreferencesPanel.cpp:783 +#: src/view/PreferencesPanel.cpp:789 src/view/PasswordDialog.cpp:72 +#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:757 +#: src/view/grid/GridAccount.cpp:1271 src/view/grid/GridAccount.cpp:1278 +#: src/view/grid/GridAccount.cpp:1397 src/view/grid/GridAccount.cpp:1403 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:42 #: src/model/Database.cpp:49 src/model/Database.cpp:67 #: src/model/Database.cpp:96 src/model/Database.cpp:104 @@ -251,15 +251,15 @@ msgid "Final value" msgstr "" #: src/view/SearchPanel.cpp:84 src/view/grid/GridAccount.cpp:329 -#: src/controller/KissCount.cpp:379 +#: src/controller/KissCount.cpp:361 msgid "Fix" msgstr "" -#: src/view/PreferencesPanel.cpp:287 +#: src/view/PreferencesPanel.cpp:294 msgid "Font" msgstr "" -#: src/view/PreferencesPanel.cpp:286 +#: src/view/PreferencesPanel.cpp:293 msgid "Foreground color" msgstr "" @@ -271,11 +271,11 @@ msgstr "" msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:608 +#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:617 msgid "Generate month" msgstr "" -#: src/controller/KissCount.cpp:381 +#: src/controller/KissCount.cpp:361 msgid "Groceries" msgstr "" @@ -283,7 +283,7 @@ msgstr "" msgid "Group" msgstr "" -#: src/controller/KissCount.cpp:383 +#: src/controller/KissCount.cpp:361 msgid "Hobbies" msgstr "" @@ -311,7 +311,7 @@ msgstr "" msgid "Invalid formula !" msgstr "" -#: src/view/PreferencesPanel.cpp:769 +#: src/view/PreferencesPanel.cpp:783 msgid "Invalid name" msgstr "" @@ -327,11 +327,11 @@ msgstr "" msgid "Invalide date range" msgstr "" -#: src/view/PreferencesPanel.cpp:422 +#: src/view/PreferencesPanel.cpp:435 msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:748 +#: src/view/AccountPanel.cpp:757 msgid "It must be at least one month !" msgstr "" @@ -339,8 +339,8 @@ msgstr "" msgid "Kill me" msgstr "" -#: src/view/StatsPanel.cpp:377 src/view/PreferencesPanel.cpp:809 -#: src/view/PreferencesPanel.cpp:812 src/model/Database_Update.cpp:127 +#: src/view/StatsPanel.cpp:377 src/view/PreferencesPanel.cpp:823 +#: src/view/PreferencesPanel.cpp:826 src/model/Database_Update.cpp:135 msgid "KissCount" msgstr "" @@ -348,20 +348,20 @@ msgstr "" msgid "Language" msgstr "" -#: src/view/PreferencesPanel.cpp:812 +#: src/view/PreferencesPanel.cpp:826 msgid "Language not changed" msgstr "" -#: src/view/PreferencesPanel.cpp:809 +#: src/view/PreferencesPanel.cpp:823 msgid "Language successfully changed, please go to another panel" msgstr "" #: src/view/PreferencesPanel.cpp:72 src/view/PreferencesPanel.cpp:196 -#: src/view/PreferencesPanel.cpp:284 +#: src/view/PreferencesPanel.cpp:291 msgid "Name" msgstr "" -#: src/view/PreferencesPanel.cpp:781 +#: src/view/PreferencesPanel.cpp:795 msgid "Name changed" msgstr "" @@ -388,7 +388,7 @@ msgid "Non fix" msgstr "" #: src/view/SearchPanel.cpp:304 src/view/SearchPanel.cpp:346 -#: src/view/PreferencesPanel.cpp:427 src/view/PreferencesPanel.cpp:687 +#: src/view/PreferencesPanel.cpp:440 src/view/PreferencesPanel.cpp:701 msgid "None" msgstr "" @@ -409,8 +409,8 @@ msgstr "" msgid "Old password " msgstr "" -#: src/controller/KissCount.cpp:385 -msgid "Operating exepense" +#: src/controller/KissCount.cpp:361 +msgid "Operating expense" msgstr "" #: src/view/PreferencesPanel.cpp:63 @@ -421,7 +421,7 @@ msgstr "" msgid "Operations" msgstr "" -#: src/controller/KissCount.cpp:389 +#: src/controller/KissCount.cpp:362 msgid "Other" msgstr "" @@ -448,8 +448,8 @@ msgstr "" msgid "Please retype new password" msgstr "" -#: src/view/PreferencesPanel.cpp:184 src/view/PreferencesPanel.cpp:783 -#: src/view/PreferencesPanel.cpp:817 +#: src/view/PreferencesPanel.cpp:184 src/view/PreferencesPanel.cpp:797 +#: src/view/PreferencesPanel.cpp:831 msgid "Preferences" msgstr "" @@ -507,7 +507,7 @@ msgstr "" msgid "Unable to open Database" msgstr "" -#: src/controller/KissCount.cpp:387 +#: src/controller/KissCount.cpp:362 msgid "Unexpected" msgstr "" @@ -521,7 +521,7 @@ msgid "User" msgstr "" #: src/view/UsersDialog.cpp:39 src/view/UsersDialog.cpp:120 -#: src/view/PreferencesPanel.cpp:775 +#: src/view/PreferencesPanel.cpp:789 msgid "User " msgstr "" @@ -529,19 +529,23 @@ msgstr "" msgid "Users" msgstr "" -#: src/view/grid/GridAccount.cpp:1044 +#: src/view/PreferencesPanel.cpp:199 +msgid "Virtual" +msgstr "" + +#: src/view/grid/GridAccount.cpp:1048 msgid "Warning" msgstr "" -#: src/view/PreferencesPanel.cpp:432 +#: src/view/PreferencesPanel.cpp:445 msgid "Wich account will replace this one ?" msgstr "" -#: src/view/PreferencesPanel.cpp:692 +#: src/view/PreferencesPanel.cpp:706 msgid "Wich category will replace this one ?" msgstr "" -#: src/view/grid/GridAccount.cpp:1044 +#: src/view/grid/GridAccount.cpp:1048 msgid "You made a debit on a blocked account" msgstr "" diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 53f3bae..75648dc 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -356,6 +356,12 @@ void KissCount::ChangeName(const wxString& name) _user->_name = name; } +// To enable translation during xgettext +wxString default_cats[] = { + _("Fix"), _("Groceries"), _("Hobbies"), _("Operating expense"), + _("Unexpected"), _("Other") +}; + void KissCount::NewUser(const wxString& name) { wxDateTime curDate; @@ -377,17 +383,17 @@ void KissCount::NewUser(const wxString& name) AddAccount(ac); - cat.parent = wxT("0") ; cat.name = _("Fix") ; cat.backcolor = OWN_YELLOW ; cat.forecolor = *wxBLACK; cat.fix_cost = true; + cat.parent = wxT("0") ; cat.name = wxT("Fix") ; cat.backcolor = OWN_YELLOW ; cat.forecolor = *wxBLACK; cat.fix_cost = true; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = _("Groceries") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Groceries") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = _("Hobbies") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Hobbies") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = _("Operating exepense") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Operating exepense") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = _("Unexpected") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Unexpected") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = _("Other") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Other") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); SetOperationOrder(wxT("ASC")); diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 6b5e8a9..1821a23 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1331,7 +1331,7 @@ std::vector* Database::Search(User* user, wxString* description, wxDa ESCAPE_CHARS(desc); if (wildcards) - req += wxT("description LIKE '%") + desc + wxT("%'"); + req += wxT("UPPER(description) LIKE UPPER('%") + desc + wxT("%')"); else req += wxT("description=\"") + desc + wxT("\""); firstCond = true; diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 4e8ebf0..abe6a24 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -77,7 +77,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare categoryIt != user->_categories.end(); categoryIt++, i++) { - _categories[i] = categoryIt->name ; + _categories[i] = wxGetTranslation(categoryIt->name) ; _categoriesIndexes[categoryIt->name] = i; } diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 6013280..3ee4c5b 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -314,7 +314,7 @@ void PreferencesPanel::AddCategory(int line, Category cat) if (cat.id != wxT("0")) { - _categoriesGrid->SetCellValue(line, CATEGORY_NAME, cat.name); + _categoriesGrid->SetCellValue(line, CATEGORY_NAME, wxGetTranslation(cat.name)); SET_ROW_COLOR(line, cat.backcolor, cat.forecolor); if (line) { diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index ca836f5..c19be25 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -352,7 +352,7 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, if (!op.meta) SetCellValue(line, ACCOUNT, user->GetAccountName(op.account)); if (!fix && !op.meta) - SetCellValue(line, CATEGORY, cat.name); + SetCellValue(line, CATEGORY, wxGetTranslation(cat.name)); SetCellRenderer(line, OP_DELETE, new wxGridCellBoolRenderer ()); SetCellEditor(line, OP_DELETE, new wxGridCellBoolEditor ()); SetCellRenderer(line, CHECKED, new wxGridCellBoolRenderer ()); From 4cb57641d89f2b906b28950a2da82180ab8d6025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 17 Feb 2011 19:48:27 +0100 Subject: [PATCH 35/72] Take in accountt debit for virtual operations (and forgot them on check mode) --- ChangeLog | 2 +- src/view/AccountPanel.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c06f43..6210ec6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,7 +18,7 @@ v0.2_dev (15/02/2011) Update Copyright New database version (2) : fix_cost for categories - virtual account + virtual field for account and operation Database checking & upgrading ** Bugs ** diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index abe6a24..7c3003d 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -486,17 +486,17 @@ void AccountPanel::UpdateStats() if (op.amount >= 0) { - if (!op.transfert.Length()) + if (!op.transfert.Length() || (op._virtual && checkMode)) totalCredit += op.amount; if (day >= op.day) { - if (!op.transfert.Length()) + if (!op.transfert.Length() || (op._virtual && checkMode)) curCredit += op.amount; - if (!checkMode || (checkMode && op.checked)) + if ((!checkMode || (checkMode && op.checked)) && !op._virtual) curAccountAmount[op.account] += op.amount; } - if (!checkMode || (checkMode && op.checked)) + if ((!checkMode || (checkMode && op.checked)) && !op._virtual) finalAccountAmount[op.account] += op.amount; } else @@ -504,7 +504,7 @@ void AccountPanel::UpdateStats() if (!op.transfert.Length()) _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ; - if (!op.transfert.Length()) + if (!op.transfert.Length() || op._virtual) totalDebit += -op.amount; if (blocked_account) @@ -512,12 +512,12 @@ void AccountPanel::UpdateStats() if (day >= op.day) { - if (!op.transfert.Length()) + if (!op.transfert.Length() || op._virtual) curDebit += -op.amount; - if (!checkMode || (checkMode && op.checked)) + if (!checkMode || (checkMode && op.checked && !op._virtual)) curAccountAmount[op.account] += op.amount; } - if (!checkMode || (checkMode && op.checked)) + if (!checkMode || (checkMode && op.checked && !op._virtual)) finalAccountAmount[op.account] += op.amount; } } From 8792ac2a8e017956737b36122a5ecd80fa105242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 19 Feb 2011 13:41:59 +0100 Subject: [PATCH 36/72] Add Real mode --- ChangeLog | 3 +- TODO | 2 + src/view/AccountPanel.cpp | 170 +++++++++++++++++++++++++--------- src/view/AccountPanel.h | 5 +- src/view/grid/GridAccount.cpp | 2 +- 5 files changed, 136 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6210ec6..d5ee552 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2_dev (15/02/2011) +v0.2_dev (19/02/2011) ** User ** Better use of sizers (so better interface!) @@ -11,6 +11,7 @@ v0.2_dev (15/02/2011) Add virtual accounts Searchs aren't case sensitive enough Default categories in native language (even if switching language at runtime) + Add Real mode ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/TODO b/TODO index 25bf88d..3561de6 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,8 @@ Using tabulation to navigate throw interface (Search Panel) Can type a letter with a comboboxes Windows version Need packaging (.deb) +Real mode +Choosing accounts & categories position Cool for 0.2: Database auto saving at startup diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 7c3003d..23940b1 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -21,7 +21,9 @@ enum {ACCOUNT_NUMBER, ACCOUNT_NAME, ACCOUNT_INIT, ACCOUNT_CUR, ACCOUNT_FINAL, NUMBER_COLS_ACCOUNTS}; enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, REMAINS, STATS_ROW, CATS_STATS}; -enum {CALENDAR_TREE_ID=1, OPS_GRID_ID, CALENDAR_ID, ACCOUNTS_GRID_ID, MENU_GENERATE_ID, MENU_DELETE_ID, CHECK_MODE_ID, GROUP_ID, UNGROUP_ID}; +enum {CALENDAR_TREE_ID=1, OPS_GRID_ID, CALENDAR_ID, ACCOUNTS_GRID_ID, MENU_GENERATE_ID, MENU_DELETE_ID, DISPLAY_MODE_ID, GROUP_ID, UNGROUP_ID}; + +enum {VIRTUAL_MODE=0, REAL_MODE, CHECK_MODE}; BEGIN_EVENT_TABLE(AccountPanel, wxPanel) EVT_GRID_CMD_CELL_CHANGE(OPS_GRID_ID, AccountPanel::OnOperationModified) @@ -33,7 +35,7 @@ EVT_MENU(MENU_GENERATE_ID, AccountPanel::OnMenuGenerate) EVT_MENU(MENU_DELETE_ID, AccountPanel::OnMenuDelete) EVT_SHOW(AccountPanel::OnShow) EVT_CALENDAR_SEL_CHANGED(CALENDAR_ID, AccountPanel::OnCalendarChange) -EVT_CHECKBOX(CHECK_MODE_ID, AccountPanel::OnCheckMode) +EVT_RADIOBOX(DISPLAY_MODE_ID, AccountPanel::OnModeChange) EVT_BUTTON(GROUP_ID, AccountPanel::OnGroup) EVT_BUTTON(UNGROUP_ID, AccountPanel::OnUnGroup) END_EVENT_TABLE() @@ -119,7 +121,9 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare chart->SetMinSize(// chart->GetSize() wxSize(200,250)); - _checkCheckMode = new wxCheckBox(this, CHECK_MODE_ID, _("Check mode")); + wxString modes[3] = {_("Virtual"), _("Real"), _("Check")}; + _radioMode = new wxRadioBox(this, DISPLAY_MODE_ID, _("Mode"), wxDefaultPosition, wxDefaultSize, + 3, modes); _tree.SetIndent(5); @@ -138,7 +142,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare hbox->Add(vbox2, 0, wxGROW|wxALL, 2); vbox->Add(_statsGrid, 0, wxGROW); vbox->Add(chart, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10); - vbox->Add(_checkCheckMode, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10); + vbox->Add(_radioMode, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10); hbox->Add(vbox, 0, wxGROW|wxALL, 2); ChangeUser(); @@ -432,20 +436,22 @@ void AccountPanel::UpdateStats() std::map::iterator intIt; std::vector::iterator accountIt; unsigned int day; - bool checkMode = _checkCheckMode->IsChecked(); + int mode; std::map* notChecked = NULL; std::map* virtuals = NULL; Account account; Operation op; bool blocked_account ; + mode = _radioMode->GetSelection(); + curCredit = curDebit = totalCredit = totalDebit = percents = 0.0; - if (checkMode) - { + if (mode == CHECK_MODE) notChecked = _kiss->GetNotChecked(_curMonth, _curYear); - virtuals = _kiss->GetVirtualAmount(_curMonth, _curYear); - } + + if (mode == REAL_MODE || mode == CHECK_MODE) + virtuals = _kiss->GetVirtualAmount(_curMonth, _curYear); day = _calendar->GetDate().GetDay()-1; @@ -457,7 +463,7 @@ void AccountPanel::UpdateStats() curAccountAmount[doubleIt->first] = _accountsInitValues[doubleIt->first]; finalAccountAmount[doubleIt->first] = _accountsInitValues[doubleIt->first]; - if (virtuals) + if (mode == REAL_MODE || mode == CHECK_MODE) { curAccountAmount[doubleIt->first] += -(*virtuals)[doubleIt->first]; finalAccountAmount[doubleIt->first] += -(*virtuals)[doubleIt->first]; @@ -484,41 +490,119 @@ void AccountPanel::UpdateStats() } } - if (op.amount >= 0) + + switch(mode) { - if (!op.transfert.Length() || (op._virtual && checkMode)) - totalCredit += op.amount; - - if (day >= op.day) + case VIRTUAL_MODE: + if (op.amount >= 0) { - if (!op.transfert.Length() || (op._virtual && checkMode)) - curCredit += op.amount; - if ((!checkMode || (checkMode && op.checked)) && !op._virtual) - curAccountAmount[op.account] += op.amount; + if (!op.transfert.Length()) + totalCredit += op.amount; + + if (day >= op.day) + { + if (!op.transfert.Length()) + curCredit += op.amount; + curAccountAmount[op.account] += op.amount; + } + finalAccountAmount[op.account] += op.amount; } - if ((!checkMode || (checkMode && op.checked)) && !op._virtual) - finalAccountAmount[op.account] += op.amount; - } - else - { - if (!op.transfert.Length()) - _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ; - - if (!op.transfert.Length() || op._virtual) - totalDebit += -op.amount; - - if (blocked_account) - op.amount = -op.amount; - - if (day >= op.day) + else { - if (!op.transfert.Length() || op._virtual) - curDebit += -op.amount; - if (!checkMode || (checkMode && op.checked && !op._virtual)) - curAccountAmount[op.account] += op.amount; + if (!op.transfert.Length()) + _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ; + + if (!op.transfert.Length() || op._virtual) + totalDebit += -op.amount; + + if (blocked_account) + op.amount = -op.amount; + + if (day >= op.day) + { + if (!op.transfert.Length() || op._virtual) + curDebit += -op.amount; + curAccountAmount[op.account] += op.amount; + } + finalAccountAmount[op.account] += op.amount; } - if (!checkMode || (checkMode && op.checked && !op._virtual)) - finalAccountAmount[op.account] += op.amount; + break; + case REAL_MODE: + if (op.amount >= 0) + { + if (!op.transfert.Length()) + totalCredit += op.amount; + + if (day >= op.day) + { + if (!op.transfert.Length()) + curCredit += op.amount; + if (!op._virtual) + curAccountAmount[op.account] += op.amount; + } + if (!op._virtual) + finalAccountAmount[op.account] += op.amount; + } + else + { + if (!op.transfert.Length()) + _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ; + + if (!op.transfert.Length() && !op._virtual) + totalDebit += -op.amount; + + if (blocked_account) + op.amount = -op.amount; + + if (day >= op.day) + { + if (!op.transfert.Length() && !op._virtual) + curDebit += -op.amount; + if (!op._virtual) + curAccountAmount[op.account] += op.amount; + } + if (!op._virtual) + finalAccountAmount[op.account] += op.amount; + } + break; + case CHECK_MODE: + if (op.amount >= 0) + { + if (!op.transfert.Length() && !op._virtual) + totalCredit += op.amount; + + if (day >= op.day) + { + if (!op.transfert.Length() && !op._virtual) + curCredit += op.amount; + if (op.checked && !op._virtual) + curAccountAmount[op.account] += op.amount; + } + if (op.checked && !op._virtual) + finalAccountAmount[op.account] += op.amount; + } + else + { + if (!op.transfert.Length()) + _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ; + + if (!op.transfert.Length() && !op._virtual) + totalDebit += -op.amount; + + if (blocked_account) + op.amount = -op.amount; + + if (day >= op.day) + { + if (!op.transfert.Length() && !op._virtual) + curDebit += -op.amount; + if (op.checked && !op._virtual) + curAccountAmount[op.account] += op.amount; + } + if (op.checked && !op._virtual) + finalAccountAmount[op.account] += op.amount; + } + break; } } @@ -542,9 +626,11 @@ void AccountPanel::UpdateStats() for (i=0, accountIt=user->_accounts.begin(); accountIt!=user->_accounts.end(); accountIt++, i++) { - if (!checkMode || !notChecked) + if (mode != CHECK_MODE) { value = _accountsInitValues[accountIt->id]; + if (mode == REAL_MODE) + value -= (*virtuals)[accountIt->id]; _accountsGrid->SetCellValue(i, ACCOUNT_INIT, wxString::Format(wxT("%.2lf"), value)); value = curAccountAmount[accountIt->id]; _accountsGrid->SetCellValue(i, ACCOUNT_CUR, wxString::Format(wxT("%.2lf"), value)); @@ -882,7 +968,7 @@ void AccountPanel::OnCalendarChange(wxCalendarEvent& event) UpdateStats(); } -void AccountPanel::OnCheckMode(wxCommandEvent& event) +void AccountPanel::OnModeChange(wxCommandEvent& event) { UpdateStats(); } diff --git a/src/view/AccountPanel.h b/src/view/AccountPanel.h index 62b7fa1..3cedd38 100644 --- a/src/view/AccountPanel.h +++ b/src/view/AccountPanel.h @@ -25,6 +25,7 @@ #include #include #include +#include #include "grid/CalendarEditor.h" #include "grid/wxGridCellBitmapRenderer.h" @@ -58,7 +59,7 @@ public: void OnMenuGenerate(wxCommandEvent& event); void OnMenuDelete(wxCommandEvent& event); void OnCalendarChange(wxCalendarEvent& event); - void OnCheckMode(wxCommandEvent& event); + void OnModeChange(wxCommandEvent& event); void OnGroup(wxCommandEvent& event); void OnUnGroup(wxCommandEvent& event); @@ -71,7 +72,7 @@ private: wxGrid *_statsGrid, *_accountsGrid; PiePlot* _pie; double *_categoriesValues; - wxCheckBox *_checkCheckMode; + wxRadioBox *_radioMode; std::map _categoriesIndexes; std::vector* _curOperations; wxString* _categories, *_accounts; diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index c19be25..12dfcdb 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -774,7 +774,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) { new_op.category = op_tmp.category; new_op.account = op_tmp.account; - SetCellValue(row, CATEGORY, user->GetCategoryName(new_op.category)); + SetCellValue(row, CATEGORY, wxGetTranslation(user->GetCategoryName(new_op.category))); SetCellValue(row, ACCOUNT, user->GetAccountName(new_op.account)); op_complete -= 2; } From 46df6c01d397cb308d95e6bd1620a271a34a2984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 19 Feb 2011 20:30:52 +0100 Subject: [PATCH 37/72] Bug with categories translation --- src/view/grid/GridAccount.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 12dfcdb..1b61ba1 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -88,7 +88,7 @@ GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id) : wxG categoryIt != user->_categories.end(); categoryIt++, i++) { - _categories[i] = categoryIt->name ; + _categories[i] = wxGetTranslation(categoryIt->name) ; } Connect(id, wxEVT_GRID_CELL_CHANGE, wxGridEventHandler(GridAccount::OnOperationModified), NULL, this); From 16e90b8fc0e27379d0f5e24e7f79fe2419202126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 20 Feb 2011 14:22:31 +0100 Subject: [PATCH 38/72] Database is now at ~/.kisscount/kc.bdd --- ChangeLog | 1 + init.sql | 2 +- ressources/po/french.mo | Bin 7825 -> 7924 bytes ressources/po/french.po | 100 +++++++++++++++++++++--------------- ressources/po/kisscount.pot | 87 ++++++++++++++++++------------- src/model/Database.cpp | 37 +++++++++---- src/model/Database.h | 7 ++- src/view/SearchPanel.cpp | 3 +- src/view/StatsPanel.cpp | 2 +- 9 files changed, 146 insertions(+), 93 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5ee552..842186c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ v0.2_dev (19/02/2011) Searchs aren't case sensitive enough Default categories in native language (even if switching language at runtime) Add Real mode + Database is now at ~/.kisscount/kc.bdd ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/init.sql b/init.sql index 56b957e..ecba2f0 100755 --- a/init.sql +++ b/init.sql @@ -1,6 +1,6 @@ CREATE TABLE kisscount(db_version VARCHAR(20)); CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR(255), password VARCHAR(255)); -CREATE TABLE account(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), number VARCHAR(255), shared CHAR(1), blocked CHAR(1), default_account CHAR(1)); +CREATE TABLE account(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), number VARCHAR(255), shared CHAR(1), blocked CHAR(1), default_account CHAR(1), virtual CHAR(1)); CREATE TABLE shared_account(account REFERENCES account(id), user REFERENCES user(id)); CREATE TABLE account_amount(id INTEGER PRIMARY KEY, account REFERENCES account(id), year INTEGER, month INTEGER, amount FLOAT); CREATE TABLE operation(id INTEGER PRIMARY KEY, parent REFERENCES operation(id), user REFERENCES user(id), account REFERENCES account(id), year INTEGER, month INTEGER, day INTEGER, amount FLOAT, description VARCHAR(255), category REFERENCES category(id), fix_cost CHAR(1), checked CHAR(1), formula VARCHAR(255), transfert REFERENCES operation(id), meta CHAR(1), virtual CHAR(1)); diff --git a/ressources/po/french.mo b/ressources/po/french.mo index 18167fc8d5a6e6576b51322776b4b692305d83d2..86795eda38137bb93572af681356b8d9920b620c 100644 GIT binary patch delta 2943 zcmYk-drZ}39LMp8!$l4k<&r2D^&}yfVTiZ}-VzJViG_j1MGEnxAYl?FkogmDBzei5 zxy*E0vzg1e;ZbL!l7?%ga}{KZRc==Pk*1r>R!f_`Kj%C(e>>mvdVbIExj)bEoL$pz zO?NIOgzYw5+lVw`ZJ04<@W)8LxW11zCKLy782*Gq@jBjzcQ6*?V~la*7@ULSQTeNI z2s)@HJ5c4`L_Ut$%eNXlj4E&nY15oR6+Dj`*hL(JgEl{b*5kNOLv@gi5jX`$;WSkF z3XH-wRQsDz?e4&6`Zs$>Xl92{136*ud#(K#PW~^bj($VU{3Z^^2r9*68frijQ3IKY z>bMBiVF^;jR3eLP>Xc9arjdjiZb5al-rjFPHM9fO&~DVq9K;cL6jlB#dhncmehsx{ zf1*0NjT)F{srz_Ty(DyaX3|J#gcIz8DX0NWMU8kiCSnO{=3dl{+b{vQ+4}>??wBrA zxld6Y_oM3niudDRsI5tfWBt`p0i`s6Lew73M>SA}`B;w{`625OR7b~9<-1V>J&P*e zhniRnqg4B;sQT%s70g1dY+gL;?;L7iXt@sA+ z#S|RJa;Sq@sOQC~j;m1vsYP|X!rJ862d$`z?Whj7qXxDIwU_UpW_$ou?kK9k(@5W@ z2X!X;Q1!3c=YOCE@DFMNF7`o2qUt+CZ6XODAY(LU;B0Fhs=`jx$akZbe4q7wR71y5 z9i6gvqw4jbCh$3`-Z@nHeq<#b^8<;h5M!>O3KsHCY43`VEK`O$3w1Vs9cl}>ptqYKkSR$Oe&* zi5(dnPzI`eHmc)%)Zu*$wI!vfr7yQG!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YQ5-Tduzx6B86g`J_yd&1{MN@e!-k(NKv+42= zN_TYNG3ZJsp$nRZX0`$+V-P&nBGtbbJ0V#B)Sycqbl@;)#$_$Xh)mT z6?)AkrVy*W;i@Kv5|0oIh}#MOEIYw+Vl?5^DK=9RsKEBe8!V+RW(SztuOeMw;YlwBp zYng=|S5oq;7)wkf9w6N6rOClrh2=9Sd7`}56CMixY?cxp=}N+rb{pZh`XJ#E_u`Dy zUyt+acRG_OvL^L@*1)u;1xuGNSeW{~<)>+>J=q^MN-oSff%makELZDyT~B%bnCXm7bT8mdwqsN$t!pYxEy6^89oF diff --git a/ressources/po/french.po b/ressources/po/french.po index 9d82426..b7269a0 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-15 19:15+0100\n" +"POT-Creation-Date: 2011-02-20 12:04+0100\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -37,11 +37,11 @@ msgstr " existe déjà" msgid " entries found" msgstr " entrées trouvées" -#: src/model/Database.cpp:96 +#: src/model/Database.cpp:103 msgid " not found, aborting" msgstr " non trouvé, arrêt" -#: src/view/AccountPanel.cpp:766 +#: src/view/AccountPanel.cpp:852 msgid " operations ?" msgstr " opérations ?" @@ -49,7 +49,7 @@ msgstr " opérations ?" msgid " profil ?" msgstr " profil ?" -#: src/model/Database.cpp:85 +#: src/model/Database.cpp:92 msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "!! Attention !! S'il y a eu un bug, l'ancienne base de donnée va être supprimée !" @@ -71,11 +71,11 @@ msgstr "Le compte " msgid "Account 1" msgstr "Compte 1" -#: src/view/AccountPanel.cpp:106 +#: src/view/AccountPanel.cpp:108 msgid "Account name" msgstr "Nom du compte" -#: src/view/AccountPanel.cpp:105 +#: src/view/AccountPanel.cpp:107 msgid "Account number" msgstr "Numéro de compte" @@ -93,7 +93,7 @@ msgid "Amount to" msgstr "Montant max" #: src/view/PreferencesPanel.cpp:838 -#: src/view/AccountPanel.cpp:761 +#: src/view/AccountPanel.cpp:847 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " @@ -163,9 +163,9 @@ msgstr "Changer la catégorie" msgid "Change password" msgstr "Changer le mot de passe" -#: src/view/AccountPanel.cpp:122 -msgid "Check mode" -msgstr "Mode rapprochement" +#: src/view/AccountPanel.cpp:124 +msgid "Check" +msgstr "Rapprochement" #: src/view/SearchPanel.cpp:84 msgid "Checked" @@ -184,7 +184,7 @@ msgid "Confirm password " msgstr "Confirmer le mot de passe " #: src/view/StatsPanel.cpp:128 -#: src/view/AccountPanel.cpp:116 +#: src/view/AccountPanel.cpp:118 msgid "Cost repartition" msgstr "Répartition des coûts" @@ -192,15 +192,15 @@ msgstr "Répartition des coûts" msgid "Credit" msgstr "Crédit" -#: src/view/AccountPanel.cpp:215 +#: src/view/AccountPanel.cpp:219 msgid "Cur Credit" msgstr "Cur Crédit" -#: src/view/AccountPanel.cpp:216 +#: src/view/AccountPanel.cpp:220 msgid "Cur Debit" msgstr "Cur Débit" -#: src/view/AccountPanel.cpp:108 +#: src/view/AccountPanel.cpp:110 msgid "Current value" msgstr "Valeur courante" @@ -226,7 +226,7 @@ msgstr "Défaut" #: src/view/PreferencesPanel.cpp:201 #: src/view/PreferencesPanel.cpp:295 -#: src/view/AccountPanel.cpp:620 +#: src/view/AccountPanel.cpp:706 msgid "Delete" msgstr "Supprimer" @@ -239,7 +239,7 @@ msgstr "Décroissant" msgid "Description" msgstr "Description" -#: src/view/SearchPanel.cpp:394 +#: src/view/SearchPanel.cpp:393 msgid "Enter a new description" msgstr "Nouvelle description" @@ -258,27 +258,29 @@ msgstr "Nouvelle description" #: src/view/PreferencesPanel.cpp:789 #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 -#: src/view/AccountPanel.cpp:757 +#: src/view/AccountPanel.cpp:843 #: src/view/grid/GridAccount.cpp:1271 #: src/view/grid/GridAccount.cpp:1278 #: src/view/grid/GridAccount.cpp:1397 #: src/view/grid/GridAccount.cpp:1403 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 -#: src/model/Database.cpp:42 -#: src/model/Database.cpp:49 -#: src/model/Database.cpp:67 -#: src/model/Database.cpp:96 -#: src/model/Database.cpp:104 -#: src/model/Database.cpp:125 +#: src/model/Database.cpp:45 +#: src/model/Database.cpp:52 +#: src/model/Database.cpp:70 +#: src/model/Database.cpp:103 +#: src/model/Database.cpp:109 +#: src/model/Database.cpp:115 +#: src/model/Database.cpp:123 +#: src/model/Database.cpp:144 #: src/model/Database_Update.cpp:23 msgid "Error" msgstr "Erreur" -#: src/model/Database.cpp:125 +#: src/model/Database.cpp:144 msgid "Error creating original database" msgstr "Erreur durant la création de la base de données initiale" -#: src/view/AccountPanel.cpp:109 +#: src/view/AccountPanel.cpp:111 msgid "Final value" msgstr "Valeur finale" @@ -305,7 +307,7 @@ msgid "From " msgstr "A partir de " #: src/view/GenerateDialog.cpp:31 -#: src/view/AccountPanel.cpp:617 +#: src/view/AccountPanel.cpp:703 msgid "Generate month" msgstr "Générer mois" @@ -313,7 +315,7 @@ msgstr "Générer mois" msgid "Groceries" msgstr "Courses" -#: src/view/AccountPanel.cpp:126 +#: src/view/AccountPanel.cpp:130 msgid "Group" msgstr "Grouper" @@ -321,7 +323,7 @@ msgstr "Grouper" msgid "Hobbies" msgstr "Loisirs" -#: src/view/AccountPanel.cpp:107 +#: src/view/AccountPanel.cpp:109 msgid "Initial value" msgstr "Valeur initiale" @@ -365,7 +367,7 @@ msgstr "Intervalle de temps invalide" msgid "It must be at least one account !" msgstr "Il doit y avoir au moins un compte !" -#: src/view/AccountPanel.cpp:757 +#: src/view/AccountPanel.cpp:843 msgid "It must be at least one month !" msgstr "Il doit rester au moins un mois" @@ -392,6 +394,10 @@ msgstr "Langue non changée" msgid "Language successfully changed, please go to another panel" msgstr "Langue changée, allez sur un autre panneau pour rendre le changement effectif" +#: src/view/AccountPanel.cpp:125 +msgid "Mode" +msgstr "Mode" + #: src/view/PreferencesPanel.cpp:72 #: src/view/PreferencesPanel.cpp:196 #: src/view/PreferencesPanel.cpp:291 @@ -411,7 +417,7 @@ msgstr "Nouvel utilisateur" msgid "New password " msgstr "Nouveau mot de passe " -#: src/model/Database.cpp:84 +#: src/model/Database.cpp:91 msgid "" "No database found, would you like to create a new one ?\n" "\n" @@ -461,7 +467,7 @@ msgid "Operation order" msgstr "Ordre des opérations" #: src/view/SearchPanel.cpp:98 -#: src/view/AccountPanel.cpp:175 +#: src/view/AccountPanel.cpp:179 msgid "Operations" msgstr "Opérations" @@ -509,7 +515,11 @@ msgstr "Préférences" msgid "Quit KissCount ?" msgstr "Quitter KissCount ?" -#: src/view/AccountPanel.cpp:217 +#: src/view/AccountPanel.cpp:124 +msgid "Real" +msgstr "Réel" + +#: src/view/AccountPanel.cpp:221 msgid "Remains" msgstr "Restant" @@ -519,12 +529,12 @@ msgstr "Renommer" #: src/view/SearchPanel.cpp:92 #: src/view/SearchPanel.cpp:164 -#: src/view/SearchPanel.cpp:410 +#: src/view/SearchPanel.cpp:409 msgid "Search" msgstr "Chercher" #: src/view/StatsPanel.cpp:120 -#: src/view/AccountPanel.cpp:90 +#: src/view/AccountPanel.cpp:92 msgid "Serie 1" msgstr "Série 1" @@ -545,22 +555,27 @@ msgstr "A" msgid "To " msgstr "Vers " -#: src/view/AccountPanel.cpp:199 +#: src/view/AccountPanel.cpp:203 msgid "Total Credit" msgstr "Total Crédit" -#: src/view/AccountPanel.cpp:200 +#: src/view/AccountPanel.cpp:204 msgid "Total Debit" msgstr "Total Débit" -#: src/view/AccountPanel.cpp:127 +#: src/view/AccountPanel.cpp:131 msgid "UnGroup" msgstr "Dégrouper" -#: src/model/Database.cpp:42 -#: src/model/Database.cpp:49 -#: src/model/Database.cpp:67 -#: src/model/Database.cpp:104 +#: src/model/Database.cpp:109 +#: src/model/Database.cpp:115 +msgid "Unable to Create " +msgstr "Impossible de créer " + +#: src/model/Database.cpp:45 +#: src/model/Database.cpp:52 +#: src/model/Database.cpp:70 +#: src/model/Database.cpp:123 msgid "Unable to open Database" msgstr "Impossible d'ouvrir la base de données" @@ -591,6 +606,7 @@ msgid "Users" msgstr "Utilisateurs" #: src/view/PreferencesPanel.cpp:199 +#: src/view/AccountPanel.cpp:124 msgid "Virtual" msgstr "Virtuel" @@ -658,6 +674,8 @@ msgstr "octobre" msgid "september" msgstr "septembre" +#~ msgid "Check mode" +#~ msgstr "Mode rapprochement" #~ msgid "Query failed !\n" #~ msgstr "La requête a échouée !\n" #~ msgid "Update failed !\n" diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 7c9e767..edc14d7 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-15 19:15+0100\n" +"POT-Creation-Date: 2011-02-20 12:04+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -31,11 +31,11 @@ msgstr "" msgid " entries found" msgstr "" -#: src/model/Database.cpp:96 +#: src/model/Database.cpp:103 msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:766 +#: src/view/AccountPanel.cpp:852 msgid " operations ?" msgstr "" @@ -43,7 +43,7 @@ msgstr "" msgid " profil ?" msgstr "" -#: src/model/Database.cpp:85 +#: src/model/Database.cpp:92 msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "" @@ -63,11 +63,11 @@ msgstr "" msgid "Account 1" msgstr "" -#: src/view/AccountPanel.cpp:106 +#: src/view/AccountPanel.cpp:108 msgid "Account name" msgstr "" -#: src/view/AccountPanel.cpp:105 +#: src/view/AccountPanel.cpp:107 msgid "Account number" msgstr "" @@ -83,7 +83,7 @@ msgstr "" msgid "Amount to" msgstr "" -#: src/view/PreferencesPanel.cpp:838 src/view/AccountPanel.cpp:761 +#: src/view/PreferencesPanel.cpp:838 src/view/AccountPanel.cpp:847 msgid "Are you sure want to delete " msgstr "" @@ -148,8 +148,8 @@ msgstr "" msgid "Change password" msgstr "" -#: src/view/AccountPanel.cpp:122 -msgid "Check mode" +#: src/view/AccountPanel.cpp:124 +msgid "Check" msgstr "" #: src/view/SearchPanel.cpp:84 @@ -168,7 +168,7 @@ msgstr "" msgid "Confirm password " msgstr "" -#: src/view/StatsPanel.cpp:128 src/view/AccountPanel.cpp:116 +#: src/view/StatsPanel.cpp:128 src/view/AccountPanel.cpp:118 msgid "Cost repartition" msgstr "" @@ -176,15 +176,15 @@ msgstr "" msgid "Credit" msgstr "" -#: src/view/AccountPanel.cpp:215 +#: src/view/AccountPanel.cpp:219 msgid "Cur Credit" msgstr "" -#: src/view/AccountPanel.cpp:216 +#: src/view/AccountPanel.cpp:220 msgid "Cur Debit" msgstr "" -#: src/view/AccountPanel.cpp:108 +#: src/view/AccountPanel.cpp:110 msgid "Current value" msgstr "" @@ -209,7 +209,7 @@ msgid "Default" msgstr "" #: src/view/PreferencesPanel.cpp:201 src/view/PreferencesPanel.cpp:295 -#: src/view/AccountPanel.cpp:620 +#: src/view/AccountPanel.cpp:706 msgid "Delete" msgstr "" @@ -221,7 +221,7 @@ msgstr "" msgid "Description" msgstr "" -#: src/view/SearchPanel.cpp:394 +#: src/view/SearchPanel.cpp:393 msgid "Enter a new description" msgstr "" @@ -232,21 +232,22 @@ msgstr "" #: src/view/PreferencesPanel.cpp:515 src/view/PreferencesPanel.cpp:726 #: src/view/PreferencesPanel.cpp:745 src/view/PreferencesPanel.cpp:783 #: src/view/PreferencesPanel.cpp:789 src/view/PasswordDialog.cpp:72 -#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:757 +#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:843 #: src/view/grid/GridAccount.cpp:1271 src/view/grid/GridAccount.cpp:1278 #: src/view/grid/GridAccount.cpp:1397 src/view/grid/GridAccount.cpp:1403 -#: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:42 -#: src/model/Database.cpp:49 src/model/Database.cpp:67 -#: src/model/Database.cpp:96 src/model/Database.cpp:104 -#: src/model/Database.cpp:125 src/model/Database_Update.cpp:23 +#: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:45 +#: src/model/Database.cpp:52 src/model/Database.cpp:70 +#: src/model/Database.cpp:103 src/model/Database.cpp:109 +#: src/model/Database.cpp:115 src/model/Database.cpp:123 +#: src/model/Database.cpp:144 src/model/Database_Update.cpp:23 msgid "Error" msgstr "" -#: src/model/Database.cpp:125 +#: src/model/Database.cpp:144 msgid "Error creating original database" msgstr "" -#: src/view/AccountPanel.cpp:109 +#: src/view/AccountPanel.cpp:111 msgid "Final value" msgstr "" @@ -271,7 +272,7 @@ msgstr "" msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:617 +#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:703 msgid "Generate month" msgstr "" @@ -279,7 +280,7 @@ msgstr "" msgid "Groceries" msgstr "" -#: src/view/AccountPanel.cpp:126 +#: src/view/AccountPanel.cpp:130 msgid "Group" msgstr "" @@ -287,7 +288,7 @@ msgstr "" msgid "Hobbies" msgstr "" -#: src/view/AccountPanel.cpp:107 +#: src/view/AccountPanel.cpp:109 msgid "Initial value" msgstr "" @@ -331,7 +332,7 @@ msgstr "" msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:757 +#: src/view/AccountPanel.cpp:843 msgid "It must be at least one month !" msgstr "" @@ -356,6 +357,10 @@ msgstr "" msgid "Language successfully changed, please go to another panel" msgstr "" +#: src/view/AccountPanel.cpp:125 +msgid "Mode" +msgstr "" + #: src/view/PreferencesPanel.cpp:72 src/view/PreferencesPanel.cpp:196 #: src/view/PreferencesPanel.cpp:291 msgid "Name" @@ -373,7 +378,7 @@ msgstr "" msgid "New password " msgstr "" -#: src/model/Database.cpp:84 +#: src/model/Database.cpp:91 msgid "" "No database found, would you like to create a new one ?\n" "\n" @@ -417,7 +422,7 @@ msgstr "" msgid "Operation order" msgstr "" -#: src/view/SearchPanel.cpp:98 src/view/AccountPanel.cpp:175 +#: src/view/SearchPanel.cpp:98 src/view/AccountPanel.cpp:179 msgid "Operations" msgstr "" @@ -457,7 +462,11 @@ msgstr "" msgid "Quit KissCount ?" msgstr "" -#: src/view/AccountPanel.cpp:217 +#: src/view/AccountPanel.cpp:124 +msgid "Real" +msgstr "" + +#: src/view/AccountPanel.cpp:221 msgid "Remains" msgstr "" @@ -466,11 +475,11 @@ msgid "Rename" msgstr "" #: src/view/SearchPanel.cpp:92 src/view/SearchPanel.cpp:164 -#: src/view/SearchPanel.cpp:410 +#: src/view/SearchPanel.cpp:409 msgid "Search" msgstr "" -#: src/view/StatsPanel.cpp:120 src/view/AccountPanel.cpp:90 +#: src/view/StatsPanel.cpp:120 src/view/AccountPanel.cpp:92 msgid "Serie 1" msgstr "" @@ -490,20 +499,24 @@ msgstr "" msgid "To " msgstr "" -#: src/view/AccountPanel.cpp:199 +#: src/view/AccountPanel.cpp:203 msgid "Total Credit" msgstr "" -#: src/view/AccountPanel.cpp:200 +#: src/view/AccountPanel.cpp:204 msgid "Total Debit" msgstr "" -#: src/view/AccountPanel.cpp:127 +#: src/view/AccountPanel.cpp:131 msgid "UnGroup" msgstr "" -#: src/model/Database.cpp:42 src/model/Database.cpp:49 -#: src/model/Database.cpp:67 src/model/Database.cpp:104 +#: src/model/Database.cpp:109 src/model/Database.cpp:115 +msgid "Unable to Create " +msgstr "" + +#: src/model/Database.cpp:45 src/model/Database.cpp:52 +#: src/model/Database.cpp:70 src/model/Database.cpp:123 msgid "Unable to open Database" msgstr "" @@ -529,7 +542,7 @@ msgstr "" msgid "Users" msgstr "" -#: src/view/PreferencesPanel.cpp:199 +#: src/view/PreferencesPanel.cpp:199 src/view/AccountPanel.cpp:124 msgid "Virtual" msgstr "" diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 1821a23..3c07537 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -32,6 +32,9 @@ static inline wxString DoubleToString(double d) Database::Database(const char* filename, KissCount* kiss) : _kiss(kiss) { std::ifstream bdd_file; + + std::string sPath = std::string(wxGetHomeDir().mb_str()) + std::string(BDD_FILE); + wxString wPath = wxGetHomeDir() + wxT(BDD_FILE); if (filename) { @@ -53,7 +56,7 @@ Database::Database(const char* filename, KissCount* kiss) : _kiss(kiss) else { // If default BDD file, assume this can be the first load - bdd_file.open(BDD_FILE, std::ifstream::in); + bdd_file.open(sPath.c_str(), std::ifstream::in); if (!bdd_file.good()) { @@ -61,11 +64,11 @@ Database::Database(const char* filename, KissCount* kiss) : _kiss(kiss) } else { - _db.Open(wxT(BDD_FILE)); + _db.Open(wPath); if (!_db.IsOpen()) { wxMessageBox(_("Unable to open Database"), _("Error"), wxICON_ERROR | wxOK ); - throw std::string("Unable to open ") + BDD_FILE; + throw std::string("Unable to open ") + sPath; } } } @@ -80,7 +83,11 @@ void Database::CreateDatabase() std::ifstream init_script; std::string line; wxString wxline; - + std::string sPath = std::string(wxGetHomeDir().mb_str()) + std::string(BDD_FILE); + wxString wPath = wxGetHomeDir() + wxT(BDD_FILE); + wxFileName dirname( wxGetHomeDir() +wxT("/.kisscount/"), wxPATH_UNIX); + wxFileName filename (wPath); + wxFile file; wxString message = _("No database found, would you like to create a new one ?\n\n"); message += _("!! Warning !! If there was a bug, the old database will be suppressed !"); @@ -97,12 +104,24 @@ void Database::CreateDatabase() throw "init.sql not found, aborting"; } - _db.Open(wxT(BDD_FILE)); + if (!dirname.DirExists() && !dirname.Mkdir()) + { + wxMessageBox(_("Unable to Create ") + wxGetHomeDir() +wxT("/.kisscount/"), _("Error"), wxICON_ERROR | wxOK ); + throw std::string("Unable to create ") + std::string(wxGetHomeDir().mb_str()) + std::string("/.kisscount/"); + } + + if (!filename.FileExists() && !file.Create(wPath, false, wxS_IRUSR|wxS_IWUSR|wxS_IXUSR)) + { + wxMessageBox(_("Unable to Create ") + wPath, _("Error"), wxICON_ERROR | wxOK ); + throw std::string("Unable to create ") + sPath; + } + + _db.Open(wPath); if (!_db.IsOpen()) { wxMessageBox(_("Unable to open Database"), _("Error"), wxICON_ERROR | wxOK ); - throw std::string("Unable to open ") + BDD_FILE; + throw std::string("Unable to open ") + sPath; } do @@ -123,7 +142,7 @@ void Database::CreateDatabase() catch (...) { wxMessageBox(_("Error creating original database"), _("Error"), wxICON_ERROR | wxOK ); - remove(BDD_FILE); + remove(sPath.c_str()); throw line; } } while (init_script); @@ -210,7 +229,7 @@ User* Database::LoadUser(const wxString& name) set.Finalize(); - req = wxT("SELECT * FROM account WHERE user='") + user->_id + wxT("' ORDER BY default_account DESC, name ASC"); + req = wxT("SELECT * FROM account WHERE user='") + user->_id + wxT("' ORDER BY default_account DESC, blocked, virtual, name ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); @@ -228,7 +247,7 @@ User* Database::LoadUser(const wxString& name) } set.Finalize(); - req = wxT("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='") + user->_id + wxT("') ORDER BY name ASC"); + req = wxT("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='") + user->_id + wxT("') ORDER BY blocked, virtual, name ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); diff --git a/src/model/Database.h b/src/model/Database.h index c10f4f7..88d5c16 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -25,6 +25,9 @@ #include #include #include +#include +#include +#include #include #include "model.h" @@ -32,8 +35,8 @@ #define DATABASE_VERSION 2 -#define BDD_FILE "kc.bdd" -#define INIT_SCRIPT "init.sql" +#define BDD_FILE "/.kisscount/kc.bdd" +#define INIT_SCRIPT "init.sql" #define FIX_OP (1 << 0) #define NON_FIX_OP (1 << 1) diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 5ae40ae..3e7fa8b 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -79,7 +79,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _category = new wxCheckListBox(this, wxID_ANY); _category->Append(_("Unknown")); for(categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++) - _category->Append(categoryIt->name); + _category->Append(wxGetTranslation(categoryIt->name)); wxString stypes[] = {_("Fix"), _("Non fix"), _("Checked"), _("Not checked")}; _optype = new wxCheckListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, stypes); @@ -381,7 +381,6 @@ static void ChangeName(Operation* op, void** params) void SearchPanel::OnButtonRename(wxCommandEvent& event) { std::vector rows; - User* user = _kiss->GetUser(); std::vector::iterator it; wxString category; wxString description; diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index ae18f85..3fec614 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -84,7 +84,7 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), categoryIt++, i++) { _categoriesIndexes[categoryIt->id] = i; - _categories[i] = categoryIt->name ; + _categories[i] = wxGetTranslation(categoryIt->name) ; } DEFAULT_FONT(font); From 5451d3c4ce2c64170ec67ab7e12f0f844a99b2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 24 Feb 2011 20:59:30 +0100 Subject: [PATCH 39/72] Fix a bug with categories (again) Disable interface during mass update (cursor not changed :() Resize search icon --- ressources/icons/Search-icon.png | Bin 12736 -> 12584 bytes src/model/Database.cpp | 1 + src/model/User.cpp | 2 +- src/view/grid/GridAccount.cpp | 18 ++++++++++++++---- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ressources/icons/Search-icon.png b/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7Ray#s zJA`AhUg3f>K#4gucAS@HeEFNHEJM0bj#$gT@}J2!6a8li&aBuyRw`JtKlW)ndUIzv z#MC3Sm^J%2uLKSDQbCC`gp@ceKlRxGG)uq F{{eKY%!dE~ diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 3c07537..7fe6165 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1047,6 +1047,7 @@ bool Database::LoadCategory(const wxString& id, const wxString& name, Category& category.backcolor = wxColour(set.GetAsString(wxT("backcolor"))); category.forecolor = wxColour(set.GetAsString(wxT("forecolor"))); category.font = set.GetAsString(wxT("font")); + category.fix_cost = set.GetBool(wxT("fix_cost")); ret = true; } diff --git a/src/model/User.cpp b/src/model/User.cpp index e168932..5299bb1 100644 --- a/src/model/User.cpp +++ b/src/model/User.cpp @@ -85,7 +85,7 @@ wxString User::GetCategoryId(const wxString& catName) Category cat; for (it=_categories.begin(); it !=_categories.end(); it++) - if (it->name == catName) + if (wxGetTranslation(it->name) == catName) return it->id; if ( _db->LoadCategory(wxT(""), catName, cat)) diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 1b61ba1..e961f62 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -25,14 +25,14 @@ SetCellTextColour(row, i, forecolor); \ } -#define SET_ROW_FONT(row, font) for(int i=0; i& rows, updateOperationFunc func, v std::vector::iterator it; Operation op, op2; + _parent->Disable(); + + _parent->SetCursor(wxCursor(wxCURSOR_ARROWWAIT)); + + _parent->Update(); + if (rows.size()) { for(i=0; i<(int)rows.size(); i++) @@ -1527,4 +1533,8 @@ void GridAccount::MassUpdate(std::vector& rows, updateOperationFunc func, v LoadOperations(_operations, false, false, 0, 0); Layout(); + + _parent->Enable(); + + _parent->SetCursor(wxNullCursor); } From 9e53f9b73d450bf0524282cc5a8a6f44d65a8ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 24 Feb 2011 21:00:52 +0100 Subject: [PATCH 40/72] Try another cursor --- src/view/grid/GridAccount.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index e961f62..558b597 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -1494,7 +1494,7 @@ void GridAccount::MassUpdate(std::vector& rows, updateOperationFunc func, v _parent->Disable(); - _parent->SetCursor(wxCursor(wxCURSOR_ARROWWAIT)); + _parent->SetCursor(wxCursor(wxCURSOR_WAIT)); _parent->Update(); From 7f08ad06eaabf401be0aa989597ece4eff5044e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 5 Mar 2011 12:26:35 +0100 Subject: [PATCH 41/72] First attempt to make a Debian package --- Makefile | 12 ++++++- debian/Makefile | 64 ++++++++++++++++++++++++++++++++++++++ debian/changelog | 5 +++ debian/compat | 1 + debian/control | 17 ++++++++++ debian/copyright | 29 +++++++++++++++++ debian/dirs | 1 + debian/docs | 2 ++ debian/files | 1 + debian/kisscount-install | 1 + debian/menu | 2 ++ debian/rules | 28 +++++++++++++++++ debian/source/format | 1 + src/controller/KissCount.h | 2 +- tools/package.sh | 23 +++++++++++++- 15 files changed, 186 insertions(+), 3 deletions(-) create mode 100644 debian/Makefile create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/docs create mode 100644 debian/files create mode 100644 debian/kisscount-install create mode 100644 debian/menu create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/Makefile b/Makefile index 092e224..d845dc0 100644 --- a/Makefile +++ b/Makefile @@ -48,4 +48,14 @@ package: else package: ./tools/package.sh -endif \ No newline at end of file +endif + +install: + mkdir -p $(DESTDIR)/usr/lib/kisscount/ + mkdir -p $(DESTDIR)/usr/bin + cp kc $(DESTDIR)/usr/lib/kisscount/ + cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* $(DESTDIR)/usr/lib/kisscount/ + cp tools/launch_kc.sh $(DESTDIR)/usr/lib/kisscount/ + cp -r ressources $(DESTDIR)/usr/lib/kisscount/ + cp init.sql $(DESTDIR)/usr/lib/kisscount/ + ln -s $(DESTDIR)/usr/lib/kisscount/launch_kc.sh $(DESTDIR)/usr/bin/kc diff --git a/debian/Makefile b/debian/Makefile new file mode 100644 index 0000000..f1aedfa --- /dev/null +++ b/debian/Makefile @@ -0,0 +1,64 @@ +CXXFLAGS+=`wx-config --cxxflags` -Wall -Isrc -ggdb +CXXFLAGS+=-I./lib/wxsqlite3-1.9.9/include +CXXFLAGS+=-I./lib/freechart/include + +LDFLAGS+=`wx-config --libs` +ifdef WIN32 +LDFLAGS+=-L./lib/wxsqlite3-1.9.9/lib/ -lwxcode_msw_wxsqlite3-2.8 +LDFLAGS+=-L./lib/freechart/lib -lwxcode_msw_freechart-2.8 +else +LDFLAGS+=-L./lib/wxsqlite3-1.9.9/lib/ -lwxcode_gtk2u_wxsqlite3-2.8 +LDFLAGS+=-L./lib/freechart/lib -lwxcode_gtk2u_freechart-2.8 +endif + +CXX=$(PREFIX)g++ + +SOURCES=$(wildcard src/model/*.cpp) +SOURCES+=$(wildcard src/view/*.cpp) +SOURCES+=$(wildcard src/view/grid/*.cpp) +SOURCES+=$(wildcard src/controller/*.cpp) +SOURCES+=src/main.cpp src/sha1.cpp src/ParseExp.cpp +HEADERS=$(wildcard src/model/*.h) +HEADERS+=$(wildcard src/view/*.h) +HEADERS+=$(wildcard src/view/grid/*.h) +HEADERS+=$(wildcard src/controller/*.h) +HEADERS+=src/main.h src/sha1.h +OBJS=$(SOURCES:.cpp=.o) + +all: check kc + +clean: + rm -f *~ src/*~ src/*.o src/model/*.o src/model/*~ src/view/*.o src/view/grid/*.o src/view/grid/*~ src/view/*~ src/controller/*.o src/controller/*~ kc + +# %.o : src/model/%.cpp src/view/%.cpp src/view/grid/%.cpp src/controller/%.cpp src/%.cpp +# $(CXX) $(CXXFLAGS) $< -c + +check: +# if ! test -d lib ; then echo lib directory not found, please see INSTALL ; return 1 ; fi + +#kc: $(OBJS) +# $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) + +kc: + cp ../kc . + +generate_locales: + ./tools/generate_locales.sh + +ifdef WIN32 +package: + ./tools/package_win32.sh +else +package: + ./tools/package.sh +endif + +install: + mkdir -p $(DESTDIR)/usr/lib/kisscount/ + mkdir -p $(DESTDIR)/usr/bin + cp kc $(DESTDIR)/usr/lib/kisscount/ + cp -r ressources $(DESTDIR)/usr/lib/kisscount/ + cp -r lib/*.so* $(DESTDIR)/usr/lib/kisscount/ + cp tools/launch_kc.sh $(DESTDIR)/usr/lib/kisscount/ + cp init.sql $(DESTDIR)/usr/lib/kisscount/ + ln -s $(DESTDIR)/usr/lib/kisscount/launch_kc.sh $(DESTDIR)/usr/bin/kc diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..bc81166 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +kisscount (0.2-1) unstable; urgency=low + + * Initial release + + -- Grégory Soutadé Sat, 26 Feb 2011 13:13:52 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..7e56d22 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: kisscount +Section: misc +Priority: extra +Maintainer: Grégory Soutadé +Build-Depends: debhelper (>= 7.0.50~), libsqlite3-dev, libwxgtk2.8-dev (>= 2.8.10) +Standards-Version: 3.9.1 +Homepage: http://indefero.soutade.fr/p/kisscount/ +#Vcs-Git: git://git.debian.org/collab-maint/kisscount.git +#Vcs-Browser: http://git.debian.org/?p=collab-maint/kisscount.git;a=summary + +Package: kisscount +Architecture: amd64 +Depends: ${misc:Depends} +Description: Personal accounting software + KissCount is a personal accounting software. + It focuses on simplicity and everyday + users requirements. \ No newline at end of file diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..22a3eb9 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,29 @@ +Format: http://dep.debian.net/deps/dep5 +Upstream-Name: kisscount +Source: http://indefero.soutade.fr/p/kisscount/ + +Files: * +Copyright: 2010-2011 Grégory Soutadé + +License: GPL-3.0+ + +Files: debian/* +Copyright: 2011 Grégory Soutadé +License: GPL-3.0+ + +License: GPL-3.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..f03a978 --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ +/usr/lib/kisscount \ No newline at end of file diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..dccc5d8 --- /dev/null +++ b/debian/docs @@ -0,0 +1,2 @@ +README +README.fr diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..78c876a --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +kisscount_0.2-1_amd64.deb misc extra diff --git a/debian/kisscount-install b/debian/kisscount-install new file mode 100644 index 0000000..064631e --- /dev/null +++ b/debian/kisscount-install @@ -0,0 +1 @@ +usr/bin/kc diff --git a/debian/menu b/debian/menu new file mode 100644 index 0000000..ed7c806 --- /dev/null +++ b/debian/menu @@ -0,0 +1,2 @@ +?package(kisscount):needs="X11" section="Applications/Office"\ + title="kisscount" command="/usr/bin/kc" diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..d9e62e5 --- /dev/null +++ b/debian/rules @@ -0,0 +1,28 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +%: + dh $@ + +# clean: + +# build: +# $(MAKE) + +# binary: + +# binary-arch: + +# binary-indep: + +# install: +# $(MAKE) install DESTDIR=$(CURDIR)/debian/kisscount/ +override_dh_shlibdeps: \ No newline at end of file diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index 229af3f..9614bd7 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -29,7 +29,7 @@ #include -#define APP_VERSION "v0.2_dev" +#define APP_VERSION "0.2" class wxUI; class Database; diff --git a/tools/package.sh b/tools/package.sh index 3649c25..49ad2f1 100755 --- a/tools/package.sh +++ b/tools/package.sh @@ -5,6 +5,11 @@ DATE=`date +%d.%m.%Y` VERSION=`cat src/controller/KissCount.h | grep APP_VERSION | cut -d\" -f2` DIR="KissCount_build_${VERSION}_${DATE}_${ARCH}" FILE="$DIR.tar.bz2" +DEB_DIR="kisscount-${VERSION}" +DEB_FILE="$DEB_DIR.tar.gz" +DEBEMAIL=soutade@gmail.com +DEBFULLNAME="Grégory Soutadé" +export DEBEMAIL DEBFULLNAME rm -f "$FILE" rm -rf "$DIR" @@ -18,4 +23,20 @@ cp -r kc init.sql ressources tools/launch_kc.sh TODO CONTRIBUTORS COPYING README find "$DIR" -type f -executable -exec ${PREFIX}strip \{\} \; tar -jcf "$FILE" "$DIR" rm -rf "$DIR" -echo "Packaged into $FILE !" \ No newline at end of file + +# Debian packaging +rm -rf "$DEB_DIR" "$DEB_FILE" +mkdir -p "$DEB_DIR/lib" +cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DEB_DIR/lib" +cp -r kc debian init.sql README* ressources tools "$DEB_DIR" +#tar -zcf "$DEB_FILE" "$DEB_DIR" +cd "$DEB_DIR" +mv debian/Makefile . +ln -s ../../src +#sed -i s/i686/$ARCH/g debian/control +#dh_make -f "../$DEB_FILE" --copyright gpl3 --email $DEBEMAIL -s +[ "${ARCH}" == "x86_64" ] && ARCH="amd64" +debuild -us -uc -b -i -a${ARCH} +cd - + +echo "Packaged into $FILE and kisscount_${VERSION}-1_${ARCH}.deb !" \ No newline at end of file From 6a20953757e1f8aca34234b09d9d36836c8f96f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 6 Mar 2011 17:20:42 +0100 Subject: [PATCH 42/72] Add Debian packaging --- ChangeLog | 3 ++- INSTALL | 6 +++--- Makefile | 24 ++++++++++++++-------- README | 2 +- README.fr | 2 +- TODO | 2 +- debian/Makefile | 24 ++++++++++++++-------- debian/control | 8 ++++---- debian/dirs | 1 - debian/docs | 3 +++ debian/files | 1 - debian/kisscount-install | 1 - debian/kisscount.manpages | 1 + debian/rules | 1 - kc.1 | 35 +++++++++++++++++++++++++++++++++ init.sql => ressources/init.sql | 0 src/model/Database.h | 2 +- src/view/SupportedLanguages.h | 2 +- src/view/view.h | 20 ++++++++++--------- src/view/wxUI.cpp | 4 ++-- tools/launch_kc.sh | 4 ---- tools/package.sh | 4 ++-- 22 files changed, 100 insertions(+), 50 deletions(-) delete mode 100644 debian/dirs delete mode 100644 debian/files delete mode 100644 debian/kisscount-install create mode 100644 debian/kisscount.manpages create mode 100644 kc.1 rename init.sql => ressources/init.sql (100%) mode change 100755 => 100644 delete mode 100755 tools/launch_kc.sh diff --git a/ChangeLog b/ChangeLog index 842186c..b36a622 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2_dev (19/02/2011) +v0.2 (06/03/2011) ** User ** Better use of sizers (so better interface!) @@ -13,6 +13,7 @@ v0.2_dev (19/02/2011) Default categories in native language (even if switching language at runtime) Add Real mode Database is now at ~/.kisscount/kc.bdd + Add Debian's packages !! ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/INSTALL b/INSTALL index 794d553..aa12c3d 100644 --- a/INSTALL +++ b/INSTALL @@ -26,9 +26,9 @@ cd - ** Compilation of KissCount ** +make clean make - +sudo make install ** Execution ** -export LD_LIBRARY_PATH=$PWD/lib/freechart/lib:$PWD/lib/wxsqlite3-1.9.9/lib/ -./kc +kc diff --git a/Makefile b/Makefile index d845dc0..314290c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,14 @@ +LIB_DIR=$(DESTDIR)"/usr/lib/kisscount/" +SHARE_DIR=$(DESTDIR)"/usr/share/kisscount/" +DOC_DIR=$(DESTDIR)"/usr/share/doc/kisscount/" +BIN_DIR=$(DESTDIR)"/usr/bin/" + CXXFLAGS+=`wx-config --cxxflags` -Wall -Isrc -ggdb CXXFLAGS+=-I./lib/wxsqlite3-1.9.9/include CXXFLAGS+=-I./lib/freechart/include +CXXFLAGS+=-Wl,--rpath,"$(LIB_DIR)" +CXXFLAGS+=-DRESSOURCES_ROOT="\"$(SHARE_DIR)\"" +#CXXFLAGS+=-DRESSOURCES_ROOT="\"./ressources/\"" LDFLAGS+=`wx-config --libs` ifdef WIN32 @@ -51,11 +59,11 @@ package: endif install: - mkdir -p $(DESTDIR)/usr/lib/kisscount/ - mkdir -p $(DESTDIR)/usr/bin - cp kc $(DESTDIR)/usr/lib/kisscount/ - cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* $(DESTDIR)/usr/lib/kisscount/ - cp tools/launch_kc.sh $(DESTDIR)/usr/lib/kisscount/ - cp -r ressources $(DESTDIR)/usr/lib/kisscount/ - cp init.sql $(DESTDIR)/usr/lib/kisscount/ - ln -s $(DESTDIR)/usr/lib/kisscount/launch_kc.sh $(DESTDIR)/usr/bin/kc + mkdir -p $(LIB_DIR) $(BIN_DIR) $(SHARE_DIR) $(DOC_DIR) + cp kc $(BIN_DIR) + cp -rf lib/*.so* $(LIB_DIR) + cp -rf ressources/* $(SHARE_DIR) + cp -rf README* ChangeLog CONTRIBUTORS COPYING TODO $(DOC_DIR) + +remove: + rm -rf $(LIB_DIR) $(SHARE_DIR) $(DOC_DIR) $(BIN_DIR)/kc diff --git a/README b/README index de07df8..816937c 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ KissCount is personnal account software delivered under GPL v3 licence terms. -Current version is 0.1 +Current version is 0.2 wxWidgets 2.8 and sqlite3 are needed diff --git a/README.fr b/README.fr index d352efa..9c2b61c 100644 --- a/README.fr +++ b/README.fr @@ -1,6 +1,6 @@ KissCount est un logiciel de gestion de comptes personnels délivré sous licence GPL v3 -La version actuelle est 0.1 +La version actuelle est 0.2 wxWidgets 2.8 et sqlite3 sont nécessaires diff --git a/TODO b/TODO index 3561de6..a3e3a44 100644 --- a/TODO +++ b/TODO @@ -5,7 +5,6 @@ Auto completion (already up into wxwidgets 2.9) Using tabulation to navigate throw interface (Search Panel) Can type a letter with a comboboxes Windows version -Need packaging (.deb) Real mode Choosing accounts & categories position @@ -14,6 +13,7 @@ Database auto saving at startup Use caches for created panels (avoid destroying/creating panels for nothing) Add search function to web view Need optimizations by caching operations and categories (using hastables) +Packaging for more distributions =============================================================== Next version diff --git a/debian/Makefile b/debian/Makefile index f1aedfa..76a2bc2 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -1,6 +1,14 @@ +LIB_DIR=$(DESTDIR)"/usr/lib/kisscount/" +SHARE_DIR=$(DESTDIR)"/usr/share/kisscount/" +DOC_DIR=$(DESTDIR)"/usr/share/doc/kisscount/" +BIN_DIR=$(DESTDIR)"/usr/bin/" + CXXFLAGS+=`wx-config --cxxflags` -Wall -Isrc -ggdb CXXFLAGS+=-I./lib/wxsqlite3-1.9.9/include CXXFLAGS+=-I./lib/freechart/include +CXXFLAGS+=-Wl,--rpath,"$(LIB_DIR)" +CXXFLAGS+=-DRESSOURCES_ROOT="\"$(SHARE_DIR)\"" +#CXXFLAGS+=-DRESSOURCES_ROOT="\"./ressources/\"" LDFLAGS+=`wx-config --libs` ifdef WIN32 @@ -54,11 +62,11 @@ package: endif install: - mkdir -p $(DESTDIR)/usr/lib/kisscount/ - mkdir -p $(DESTDIR)/usr/bin - cp kc $(DESTDIR)/usr/lib/kisscount/ - cp -r ressources $(DESTDIR)/usr/lib/kisscount/ - cp -r lib/*.so* $(DESTDIR)/usr/lib/kisscount/ - cp tools/launch_kc.sh $(DESTDIR)/usr/lib/kisscount/ - cp init.sql $(DESTDIR)/usr/lib/kisscount/ - ln -s $(DESTDIR)/usr/lib/kisscount/launch_kc.sh $(DESTDIR)/usr/bin/kc + mkdir -p $(LIB_DIR) $(BIN_DIR) $(SHARE_DIR) $(DOC_DIR) + cp kc $(BIN_DIR) + cp -rf lib/*.so* $(LIB_DIR) + cp -rf ressources/* $(SHARE_DIR) + cp -rf README* ChangeLog CONTRIBUTORS TODO $(DOC_DIR) + +remove: + rm -rf $(LIB_DIR) $(SHARE_DIR) $(DOC_DIR) $(BIN_DIR)/kc diff --git a/debian/control b/debian/control index 7e56d22..ed6d6f2 100644 --- a/debian/control +++ b/debian/control @@ -5,12 +5,12 @@ Maintainer: Grégory Soutadé Build-Depends: debhelper (>= 7.0.50~), libsqlite3-dev, libwxgtk2.8-dev (>= 2.8.10) Standards-Version: 3.9.1 Homepage: http://indefero.soutade.fr/p/kisscount/ -#Vcs-Git: git://git.debian.org/collab-maint/kisscount.git -#Vcs-Browser: http://git.debian.org/?p=collab-maint/kisscount.git;a=summary +Vcs-Git: git://soutade.fr/kisscount.git +Vcs-Browser: http://indefero.soutade.fr/p/kisscount/source/tree/master/ Package: kisscount -Architecture: amd64 -Depends: ${misc:Depends} +Architecture: any +Depends: ${shlibs:Depends} ${misc:Depends} Description: Personal accounting software KissCount is a personal accounting software. It focuses on simplicity and everyday diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index f03a978..0000000 --- a/debian/dirs +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/kisscount \ No newline at end of file diff --git a/debian/docs b/debian/docs index dccc5d8..c2788bf 100644 --- a/debian/docs +++ b/debian/docs @@ -1,2 +1,5 @@ README README.fr +ChangeLog +TODO +CONTRIBUTORS diff --git a/debian/files b/debian/files deleted file mode 100644 index 78c876a..0000000 --- a/debian/files +++ /dev/null @@ -1 +0,0 @@ -kisscount_0.2-1_amd64.deb misc extra diff --git a/debian/kisscount-install b/debian/kisscount-install deleted file mode 100644 index 064631e..0000000 --- a/debian/kisscount-install +++ /dev/null @@ -1 +0,0 @@ -usr/bin/kc diff --git a/debian/kisscount.manpages b/debian/kisscount.manpages new file mode 100644 index 0000000..3a00e83 --- /dev/null +++ b/debian/kisscount.manpages @@ -0,0 +1 @@ +kc.1 \ No newline at end of file diff --git a/debian/rules b/debian/rules index d9e62e5..bb5c21c 100755 --- a/debian/rules +++ b/debian/rules @@ -25,4 +25,3 @@ export DH_VERBOSE=1 # install: # $(MAKE) install DESTDIR=$(CURDIR)/debian/kisscount/ -override_dh_shlibdeps: \ No newline at end of file diff --git a/kc.1 b/kc.1 new file mode 100644 index 0000000..b37925d --- /dev/null +++ b/kc.1 @@ -0,0 +1,35 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH KC 1 "February 26, 2011" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +KissCount \- Personal Accounting Software +.SH SYNOPSIS +.B kc +.RI [ bdd_file ] +.SH DESCRIPTION +KissCount is a personal accounting software. Its goal is to be as simple as possible (matching KISS philosophy). +.br +It focuses on PERSONAL accounting (not companies/associations). You only have to enter operations and see what you have (or not). +.TP +.B bdd_file +Choose another database file than ~/.kisscount/kc.bdd +.SH FILES +Default database is ~/.kisscount/kc.bdd +.SH AUTHOR +KissCount was written by . +.PP +This manual page was written by Grégory Soutadé , diff --git a/init.sql b/ressources/init.sql old mode 100755 new mode 100644 similarity index 100% rename from init.sql rename to ressources/init.sql diff --git a/src/model/Database.h b/src/model/Database.h index 88d5c16..2126190 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -36,7 +36,7 @@ #define DATABASE_VERSION 2 #define BDD_FILE "/.kisscount/kc.bdd" -#define INIT_SCRIPT "init.sql" +#define INIT_SCRIPT RESSOURCES_ROOT "init.sql" #define FIX_OP (1 << 0) #define NON_FIX_OP (1 << 1) diff --git a/src/view/SupportedLanguages.h b/src/view/SupportedLanguages.h index c6e70a1..2df9936 100644 --- a/src/view/SupportedLanguages.h +++ b/src/view/SupportedLanguages.h @@ -29,7 +29,7 @@ typedef struct { } language ; #define NB_SUPPORTED_LANGUAGES 2 -#define ICONS_PATH "./ressources/icons" +#define ICONS_PATH RESSOURCES_ROOT "icons/" extern language languages[NB_SUPPORTED_LANGUAGES]; diff --git a/src/view/view.h b/src/view/view.h index d253acd..7e64524 100644 --- a/src/view/view.h +++ b/src/view/view.h @@ -28,15 +28,17 @@ #define DEFAULT_FONT_SIZE 12 #define DEFAULT_FONT(font_name) wxFont font_name(DEFAULT_FONT_SIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, DEFAULT_FONT_NAME); -#define DELETE_ICON "./ressources/icons/process-stop.png" -#define CHECKED_ICON "./ressources/icons/tick-icon.png" -#define ACCOUNT_ICON "./ressources/icons/administrator-icon.png" -#define STATS_ICON "./ressources/icons/chart-icon.png" -#define SEARCH_ICON "./ressources/icons/Search-icon.png" -#define PREFS_ICON "./ressources/icons/options-icon.png" -#define CHANGE_USER_ICON "./ressources/icons/Clients-icon.png" -#define ABOUT_ICON "./ressources/icons/windows-users-icon.png" -#define QUIT_ICON "./ressources/icons/system-log-out.png" +#define DELETE_ICON RESSOURCES_ROOT "icons/process-stop.png" +#define CHECKED_ICON RESSOURCES_ROOT "icons/tick-icon.png" +#define ACCOUNT_ICON RESSOURCES_ROOT "icons/administrator-icon.png" +#define STATS_ICON RESSOURCES_ROOT "icons/chart-icon.png" +#define SEARCH_ICON RESSOURCES_ROOT "icons/Search-icon.png" +#define PREFS_ICON RESSOURCES_ROOT "icons/options-icon.png" +#define CHANGE_USER_ICON RESSOURCES_ROOT "icons/Clients-icon.png" +#define ABOUT_ICON RESSOURCES_ROOT "icons/windows-users-icon.png" +#define QUIT_ICON RESSOURCES_ROOT "icons/system-log-out.png" + +#define LANG_ROOT RESSOURCES_ROOT "po/" #include "KissPanel.h" diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 0eedd29..59c78ee 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -95,7 +95,7 @@ bool wxUI::SetLanguage(long language) _locale = new wxLocale( language, wxLOCALE_CONV_ENCODING ); #ifdef __WXGTK__ - _locale->AddCatalogLookupPathPrefix(wxT("./ressources/po")); + _locale->AddCatalogLookupPathPrefix(wxT(LANG_ROOT)); #endif _locale->AddCatalog(wxT("french")); @@ -110,7 +110,7 @@ bool wxUI::SetLanguage(long language) _locale = new wxLocale(); #ifdef __WXGTK__ - _locale->AddCatalogLookupPathPrefix(wxT("./ressources/po")); + _locale->AddCatalogLookupPathPrefix(wxT(LANG_ROOT)); #endif _locale->AddCatalog(wxT("kisscount")); diff --git a/tools/launch_kc.sh b/tools/launch_kc.sh deleted file mode 100755 index 854f4aa..0000000 --- a/tools/launch_kc.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -export LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH -./kc $* diff --git a/tools/package.sh b/tools/package.sh index 49ad2f1..3329985 100755 --- a/tools/package.sh +++ b/tools/package.sh @@ -19,7 +19,7 @@ fi make || (echo "Compilation failed" ; exit 1) mkdir -p "$DIR"/lib cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DIR"/lib -cp -r kc init.sql ressources tools/launch_kc.sh TODO CONTRIBUTORS COPYING README README.fr www "$DIR" +cp -r kc ressources tools/launch_kc.sh TODO CONTRIBUTORS COPYING README* www "$DIR" find "$DIR" -type f -executable -exec ${PREFIX}strip \{\} \; tar -jcf "$FILE" "$DIR" rm -rf "$DIR" @@ -28,7 +28,7 @@ rm -rf "$DIR" rm -rf "$DEB_DIR" "$DEB_FILE" mkdir -p "$DEB_DIR/lib" cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DEB_DIR/lib" -cp -r kc debian init.sql README* ressources tools "$DEB_DIR" +cp -r kc.1 kc debian README* ChangeLog TODO CONTRIBUTORS ressources "$DEB_DIR" #tar -zcf "$DEB_FILE" "$DEB_DIR" cd "$DEB_DIR" mv debian/Makefile . From 221bd7eb40fdc5614a9abbc280cc190782e697a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 6 Mar 2011 18:32:16 +0100 Subject: [PATCH 43/72] Fixs for Debian packaging --- debian/rules | 3 +++ tools/package.sh | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index bb5c21c..5c7d3aa 100755 --- a/debian/rules +++ b/debian/rules @@ -25,3 +25,6 @@ export DH_VERBOSE=1 # install: # $(MAKE) install DESTDIR=$(CURDIR)/debian/kisscount/ + + +override_dh_strip: diff --git a/tools/package.sh b/tools/package.sh index 3329985..42aea44 100755 --- a/tools/package.sh +++ b/tools/package.sh @@ -19,7 +19,7 @@ fi make || (echo "Compilation failed" ; exit 1) mkdir -p "$DIR"/lib cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DIR"/lib -cp -r kc ressources tools/launch_kc.sh TODO CONTRIBUTORS COPYING README* www "$DIR" +cp -r kc ressources TODO CONTRIBUTORS COPYING README* www "$DIR" find "$DIR" -type f -executable -exec ${PREFIX}strip \{\} \; tar -jcf "$FILE" "$DIR" rm -rf "$DIR" @@ -29,6 +29,7 @@ rm -rf "$DEB_DIR" "$DEB_FILE" mkdir -p "$DEB_DIR/lib" cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DEB_DIR/lib" cp -r kc.1 kc debian README* ChangeLog TODO CONTRIBUTORS ressources "$DEB_DIR" +${PREFIX}strip lib/* kc #tar -zcf "$DEB_FILE" "$DEB_DIR" cd "$DEB_DIR" mv debian/Makefile . From 6773ef05dd93fc91f7379f681ceb8b03ce2d151c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 6 Mar 2011 18:37:44 +0100 Subject: [PATCH 44/72] Fixs for Debian packaging --- tools/package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/package.sh b/tools/package.sh index 42aea44..95a8eb5 100755 --- a/tools/package.sh +++ b/tools/package.sh @@ -29,7 +29,7 @@ rm -rf "$DEB_DIR" "$DEB_FILE" mkdir -p "$DEB_DIR/lib" cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DEB_DIR/lib" cp -r kc.1 kc debian README* ChangeLog TODO CONTRIBUTORS ressources "$DEB_DIR" -${PREFIX}strip lib/* kc +${PREFIX}strip "$DEB_DIR/lib/*" kc #tar -zcf "$DEB_FILE" "$DEB_DIR" cd "$DEB_DIR" mv debian/Makefile . From 4ae3f211cda0acdb2d5e4192a2bc8da733fefa1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Mon, 7 Mar 2011 09:06:37 +0100 Subject: [PATCH 45/72] Fixs for Debian packaging --- tools/package.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/package.sh b/tools/package.sh index 95a8eb5..b66dde8 100755 --- a/tools/package.sh +++ b/tools/package.sh @@ -5,8 +5,9 @@ DATE=`date +%d.%m.%Y` VERSION=`cat src/controller/KissCount.h | grep APP_VERSION | cut -d\" -f2` DIR="KissCount_build_${VERSION}_${DATE}_${ARCH}" FILE="$DIR.tar.bz2" + +# Debian packaging DEB_DIR="kisscount-${VERSION}" -DEB_FILE="$DEB_DIR.tar.gz" DEBEMAIL=soutade@gmail.com DEBFULLNAME="Grégory Soutadé" export DEBEMAIL DEBFULLNAME @@ -25,6 +26,8 @@ tar -jcf "$FILE" "$DIR" rm -rf "$DIR" # Debian packaging +if [ -d "debian" ] ; then +DEB_FILE="kisscount_${VERSION}-1_${ARCH}.deb" rm -rf "$DEB_DIR" "$DEB_FILE" mkdir -p "$DEB_DIR/lib" cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DEB_DIR/lib" @@ -37,7 +40,13 @@ ln -s ../../src #sed -i s/i686/$ARCH/g debian/control #dh_make -f "../$DEB_FILE" --copyright gpl3 --email $DEBEMAIL -s [ "${ARCH}" == "x86_64" ] && ARCH="amd64" +[ "${ARCH}" == "i686" ] && ARCH="i386" debuild -us -uc -b -i -a${ARCH} cd - +fi -echo "Packaged into $FILE and kisscount_${VERSION}-1_${ARCH}.deb !" \ No newline at end of file +if [ -z "$DEB_FILE" ] ; then + echo "Packaged into $FILE !" +else + echo "Packaged into $FILE and $DEB_FILE !" +fi From 2c56271e1b9220a2121ff350ee1cb7a001b2ceba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 13 Mar 2011 19:15:21 +0100 Subject: [PATCH 46/72] Temp commit --- Makefile | 35 ++++++++++++++++---------- src/controller/KissCount.cpp | 47 ++++++++++++++++++++++++++++++++++- src/controller/KissCount.h | 9 +++++++ src/model/Database.h | 2 +- src/model/model.h | 8 +++--- src/view/grid/GridAccount.cpp | 18 +++++++++++--- src/view/grid/GridAccount.h | 8 ++++-- src/view/wxUI.cpp | 1 + src/view/wxUI.h | 3 +++ 9 files changed, 106 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 314290c..333d0e7 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,8 @@ CXXFLAGS+=-DRESSOURCES_ROOT="\"$(SHARE_DIR)\"" #CXXFLAGS+=-DRESSOURCES_ROOT="\"./ressources/\"" LDFLAGS+=`wx-config --libs` +LDFLAGS+=-lofx + ifdef WIN32 LDFLAGS+=-L./lib/wxsqlite3-1.9.9/lib/ -lwxcode_msw_wxsqlite3-2.8 LDFLAGS+=-L./lib/freechart/lib -lwxcode_msw_freechart-2.8 @@ -21,25 +23,32 @@ endif CXX=$(PREFIX)g++ -SOURCES=$(wildcard src/model/*.cpp) -SOURCES+=$(wildcard src/view/*.cpp) -SOURCES+=$(wildcard src/view/grid/*.cpp) -SOURCES+=$(wildcard src/controller/*.cpp) -SOURCES+=src/main.cpp src/sha1.cpp src/ParseExp.cpp -HEADERS=$(wildcard src/model/*.h) -HEADERS+=$(wildcard src/view/*.h) -HEADERS+=$(wildcard src/view/grid/*.h) -HEADERS+=$(wildcard src/controller/*.h) -HEADERS+=src/main.h src/sha1.h +# SOURCES=$(wildcard src/model/*.cpp) +# SOURCES+=$(wildcard src/model/import/*.cpp) +# SOURCES+=$(wildcard src/model/export/*.cpp) +# SOURCES+=$(wildcard src/view/*.cpp) +# SOURCES+=$(wildcard src/view/grid/*.cpp) +# SOURCES+=$(wildcard src/controller/*.cpp) +# SOURCES+=$(wildcard src/*.cpp) +SOURCES=$(shell find src -name '*.cpp' -type f | tr '\n' ' ') +# HEADERS=$(wildcard src/model/*.h) +# HEADERS+=$(wildcard src/model/import/*.h) +# HEADERS+=$(wildcard src/model/export/*.h) +# HEADERS+=$(wildcard src/view/*.h) +# HEADERS+=$(wildcard src/view/grid/*.h) +# HEADERS+=$(wildcard src/controller/*.h) +# HEADERS+=$(wildcard src/*.h) +HEADERS=$(shell find src -name '*.h' -type f) OBJS=$(SOURCES:.cpp=.o) all: check kc clean: - rm -f *~ src/*~ src/*.o src/model/*.o src/model/*~ src/view/*.o src/view/grid/*.o src/view/grid/*~ src/view/*~ src/controller/*.o src/controller/*~ kc + find src -type f -name '*.[o~]' -exec rm -f \{\} \; + rm -f kc -%.o : src/model/%.cpp src/view/%.cpp src/view/grid/%.cpp src/controller/%.cpp src/%.cpp - $(CXX) $(CXXFLAGS) $< -c +%.o : src/model/%.cpp src/model/import/%.cpp src/model/export/%.cpp src/view/%.cpp src/view/grid/%.cpp src/controller/%.cpp src/%.cpp + $(CXX) $(CXXFLAGS) -c $< check: if ! test -d lib ; then echo lib directory not found, please see INSTALL ; return 1 ; fi diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 75648dc..f2a0449 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -19,6 +19,8 @@ #include "KissCount.h" +std::vector KissCount::_importEngines; + KissCount::KissCount(const char* bdd_filename) : _user(NULL) { wxRect rect = wxDisplay().GetGeometry(); @@ -40,7 +42,7 @@ KissCount::KissCount(const char* bdd_filename) : _user(NULL) _wxUI->Close(true); throw s; } - + _wxUI->ChangeUser(); _wxUI->Enable(); } @@ -561,3 +563,46 @@ wxString KissCount::CompactFont(const wxFont& font) return res; } + +void KissCount::UnRegisterImportEngine(ImportEngine* engine) +{ + std::vector::iterator it; + + for(it=_importEngines.begin(); it!=_importEngines.end(); it++) + if (*it == engine) + { + _importEngines.erase(it); + break; + } +} + +void KissCount::RegisterImportEngine(ImportEngine* engine) +{ + _importEngines.push_back(engine); +} + +wxString KissCount::GetImportEngineExtensions() +{ + wxString res; + std::vector::iterator it; + int i; + + for(i=0; i<(int)_importEngines.size()-1; i++) + res = res + _importEngines[i]->GetFileExt() + wxT("|") ; + + if (_importEngines.size()) + res = res + _importEngines[i]->GetFileExt(); + + return res; +} + +ImportEngine* KissCount::GetImportEngine(wxString path) +{ + std::vector::iterator it; + + for(it=_importEngines.begin(); it!=_importEngines.end(); it++) + if ((*it)->HandleFile(path, _user, _db)) + return *it; + + return NULL; +} diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index 9614bd7..5c8b241 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -33,6 +34,7 @@ class wxUI; class Database; +class ImportEngine; class KissCount { @@ -102,10 +104,17 @@ public: static wxFont ExtractFont(wxString strFont); static wxString CompactFont(const wxFont& font); + static void RegisterImportEngine(ImportEngine* engine); + static void UnRegisterImportEngine(ImportEngine* engine); + + wxString GetImportEngineExtensions(); + ImportEngine* GetImportEngine(wxString path); + private: wxUI* _wxUI; Database* _db; User* _user; + static std::vector _importEngines; }; #endif diff --git a/src/model/Database.h b/src/model/Database.h index 2126190..0d64f1f 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -30,8 +30,8 @@ #include #include -#include "model.h" #include "../controller/KissCount.h" +#include "model.h" #define DATABASE_VERSION 2 diff --git a/src/model/model.h b/src/model/model.h index e3dcf33..4d11dc9 100644 --- a/src/model/model.h +++ b/src/model/model.h @@ -25,9 +25,9 @@ class Database; class Account; class Operation; -#include "User.h" -#include "Database.h" -#include "Account.h" -#include "Operation.h" +#include +#include +#include +#include #endif diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 558b597..b3a79a7 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -43,10 +43,13 @@ enum {TREE, DESCRIPTION, OP_DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, OP_DELETE, C enum {GRID_ID}; -GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id) : wxGrid(parent, id), _fixCosts(0), _week1(0), - _week2(0), _week3(0), _week4(0), _parent(parent), _kiss(kiss), - _loadOperations(false), - _curMonth(0), _curYear(0) +GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id, + bool canAddOperation, bool setWeek, bool synchronizeWithDatabase) + : wxGrid(parent, id), _fixCosts(0), _week1(0), + _week2(0), _week3(0), _week4(0), _parent(parent), _kiss(kiss), + _canAddOperation(canAddOperation), _setWeek(setWeek), + _databaseSynchronization(synchronizeWithDatabase), _loadOperations(false), + _curMonth(0), _curYear(0) { wxBitmap deleteBitmap(wxT(DELETE_ICON), wxBITMAP_TYPE_PNG); wxBitmap checkedBitmap(wxT(CHECKED_ICON), wxBITMAP_TYPE_PNG); @@ -174,6 +177,13 @@ int GridAccount::GetDisplayedRow(const wxString& id) return -1; } +void GridAccount::ClearGrid() +{ + std::vector operations; + + LoadOperations(&operations, false, false, 0, 0); +} + void GridAccount::LoadOperations(std::vector* operations, bool canAddOperation, bool setWeek, int month, int year) { std::vector::iterator it; diff --git a/src/view/grid/GridAccount.h b/src/view/grid/GridAccount.h index 6130d51..1533290 100644 --- a/src/view/grid/GridAccount.h +++ b/src/view/grid/GridAccount.h @@ -41,13 +41,15 @@ typedef void (*updateOperationFunc)(Operation* op, void** params); class GridAccount : public wxGrid { public: - GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id); + GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id, + bool canAddOperation, bool setWeek, bool synchronizeWithDatabase); ~GridAccount(); wxPen GetColGridLinePen (int col); wxPen GetRowGridLinePen (int row); - void LoadOperations(std::vector* operations, bool canAddOperation, bool setWeek, int month, int year); + virtual void ClearGrid(); + void LoadOperations(std::vector* operations, int month, int year); void InsertOperationWithWeek(User* user, Operation& op, int line, bool fix, int month, int year) ; void InsertOperation(User* user, Operation& op, int line, bool fix, int month, int year) ; @@ -69,6 +71,8 @@ private: wxWindow* _parent; KissCount* _kiss; bool _displayLines; + bool _canAddOperation, setWeek; + bool _databaseSynchronization; wxString* _categories, *_accounts; std::vector* _operations; bool _canAddOperation, _loadOperations; diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 59c78ee..b6b2663 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -154,6 +154,7 @@ void wxUI::InitPanels() ADD_PANEL(StatsPanel, 1); ADD_PANEL(SearchPanel, 2); ADD_PANEL(PreferencesPanel, 3); + ADD_PANEL(ImportPanel, 4); } void wxUI::LoadPanels() diff --git a/src/view/wxUI.h b/src/view/wxUI.h index 8c3376f..e7c8c52 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -20,6 +20,8 @@ #ifndef WXUI_H #define WXUI_H +class ImportEngine; + #include #include "AccountPanel.h" #include "PreferencesPanel.h" @@ -27,6 +29,7 @@ #include "GenerateDialog.h" #include "SearchPanel.h" #include "StatsPanel.h" +#include "ImportPanel.h" #include #include "grid/wxMyGrid.h" #include "grid/wxGridCellFastBoolEditor.h" From d2f23fd6a088fb39ae77d5d06a009b10c55cedaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 13 Mar 2011 19:22:17 +0100 Subject: [PATCH 47/72] Temp commit --- src/view/AccountPanel.cpp | 4 ++-- src/view/SearchPanel.cpp | 4 ++-- src/view/grid/GridAccount.cpp | 17 +++++++++-------- src/view/grid/GridAccount.h | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 23940b1..6762f7e 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -96,7 +96,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare _pie->SetLegend(new Legend(wxBOTTOM, wxCENTER)); - _grid = new GridAccount(_kiss, this, OPS_GRID_ID); + _grid = new GridAccount(_kiss, this, OPS_GRID_ID, true, true, true); _accountsGrid = new wxGrid(this, ACCOUNTS_GRID_ID); _accountsGrid->CreateGrid(0, NUMBER_COLS_ACCOUNTS); @@ -363,7 +363,7 @@ void AccountPanel::ShowMonth(int month, int year) // Operations are ordered _curOperations = &((*user->_operations[year])[month]); - _grid->LoadOperations(_curOperations, true, true, _curMonth, _curYear); + _grid->LoadOperations(_curOperations, _curMonth, _curYear); InitAccountsGrid(user, month, year); diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 3e7fa8b..ba20a76 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -118,7 +118,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent vbox->Add(gridBagSizer, 0, wxGROW|wxALL, 5); - _grid = new GridAccount(_kiss, this, GRID_ID); + _grid = new GridAccount(_kiss, this, GRID_ID, false, false, true); hbox->Add(_grid, 0, wxGROW|wxALL, 5); @@ -275,7 +275,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event) return; } - _grid->LoadOperations(_operations, false, false, 0, 0); + _grid->LoadOperations(_operations, 0, 0); _wxUI->Layout(); } diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index b3a79a7..bd89b5f 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -162,7 +162,8 @@ void GridAccount::UpdateOperation(Operation& op) for(i=0; i < (int)_operations->size(); i++) if ((*_operations)[i].id == op.id) { - _kiss->UpdateOperation(op); + if (_databaseSynchronization) + _kiss->UpdateOperation(op); (*_operations)[i] = op; break; } @@ -181,10 +182,10 @@ void GridAccount::ClearGrid() { std::vector operations; - LoadOperations(&operations, false, false, 0, 0); + LoadOperations(&operations, 0, 0); } -void GridAccount::LoadOperations(std::vector* operations, bool canAddOperation, bool setWeek, int month, int year) +void GridAccount::LoadOperations(std::vector* operations, int month, int year) { std::vector::iterator it; User* user = _kiss->GetUser(); @@ -195,7 +196,6 @@ void GridAccount::LoadOperations(std::vector* operations, bool canAdd _loadOperations = true; _operations = operations; - _canAddOperation = canAddOperation; _curMonth = month; _curYear = year; _displayedOperations.clear(); @@ -210,7 +210,7 @@ void GridAccount::LoadOperations(std::vector* operations, bool canAdd { if (it->parent.Length()) continue; - if (setWeek) + if (_setWeek) InsertOperationWithWeek(user, *it, ++curLine, true, it->month, it->year); else InsertOperation(user, *it, ++curLine, true, it->month, it->year); @@ -222,7 +222,7 @@ void GridAccount::LoadOperations(std::vector* operations, bool canAdd { if (it->parent.Length()) continue; - if (setWeek) + if (_setWeek) InsertOperationWithWeek(user, *it, ++curLine, false, it->month, it->year); else InsertOperation(user, *it, ++curLine, false, it->month, it->year); @@ -1534,13 +1534,14 @@ void GridAccount::MassUpdate(std::vector& rows, updateOperationFunc func, v for(it=_operations->begin(); it!=_operations->end(); it++) { func (&(*it), params); - _kiss->UpdateOperation(*it); + if (_databaseSynchronization) + _kiss->UpdateOperation(*it); } } DeleteRows(1, GetNumberRows()-1); - LoadOperations(_operations, false, false, 0, 0); + LoadOperations(_operations, 0, 0); Layout(); diff --git a/src/view/grid/GridAccount.h b/src/view/grid/GridAccount.h index 1533290..72c6bdf 100644 --- a/src/view/grid/GridAccount.h +++ b/src/view/grid/GridAccount.h @@ -71,11 +71,11 @@ private: wxWindow* _parent; KissCount* _kiss; bool _displayLines; - bool _canAddOperation, setWeek; + bool _canAddOperation, _setWeek; bool _databaseSynchronization; wxString* _categories, *_accounts; std::vector* _operations; - bool _canAddOperation, _loadOperations; + bool _loadOperations; int _curMonth, _curYear; void SetWeek(int week, int line); From 6da33cbe3573c81f284fdd71bf71e4b1466ece46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 20 Mar 2011 19:08:24 +0100 Subject: [PATCH 48/72] First pass for imports (with OFX imports) --- Makefile | 14 -- src/controller/KissCount.cpp | 23 +-- src/controller/KissCount.h | 3 +- src/model/Account.cpp | 34 ++++ src/model/Account.h | 2 + src/model/Database.h | 1 + src/model/Operation.cpp | 48 +++++ src/model/Operation.h | 6 + src/model/User.h | 3 + src/model/import/ImportEngine.cpp | 269 +++++++++++++++++++++++++++ src/model/import/ImportEngine.h | 75 ++++++++ src/model/import/OFXImportEngine.cpp | 153 +++++++++++++++ src/model/import/OFXImportEngine.h | 44 +++++ src/view/ImportPanel.cpp | 246 ++++++++++++++++++++++++ src/view/ImportPanel.h | 66 +++++++ src/view/grid/GridAccount.cpp | 51 ++--- src/view/grid/GridAccount.h | 2 + 17 files changed, 992 insertions(+), 48 deletions(-) create mode 100644 src/model/Account.cpp create mode 100644 src/model/Operation.cpp create mode 100644 src/model/import/ImportEngine.cpp create mode 100644 src/model/import/ImportEngine.h create mode 100644 src/model/import/OFXImportEngine.cpp create mode 100644 src/model/import/OFXImportEngine.h create mode 100644 src/view/ImportPanel.cpp create mode 100644 src/view/ImportPanel.h diff --git a/Makefile b/Makefile index 333d0e7..1833740 100644 --- a/Makefile +++ b/Makefile @@ -23,21 +23,7 @@ endif CXX=$(PREFIX)g++ -# SOURCES=$(wildcard src/model/*.cpp) -# SOURCES+=$(wildcard src/model/import/*.cpp) -# SOURCES+=$(wildcard src/model/export/*.cpp) -# SOURCES+=$(wildcard src/view/*.cpp) -# SOURCES+=$(wildcard src/view/grid/*.cpp) -# SOURCES+=$(wildcard src/controller/*.cpp) -# SOURCES+=$(wildcard src/*.cpp) SOURCES=$(shell find src -name '*.cpp' -type f | tr '\n' ' ') -# HEADERS=$(wildcard src/model/*.h) -# HEADERS+=$(wildcard src/model/import/*.h) -# HEADERS+=$(wildcard src/model/export/*.h) -# HEADERS+=$(wildcard src/view/*.h) -# HEADERS+=$(wildcard src/view/grid/*.h) -# HEADERS+=$(wildcard src/controller/*.h) -# HEADERS+=$(wildcard src/*.h) HEADERS=$(shell find src -name '*.h' -type f) OBJS=$(SOURCES:.cpp=.o) diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index f2a0449..e62b21c 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -174,14 +174,6 @@ wxString KissCount::AddAccount(Account& ac) return ac.id; } -bool sortAccounts(Account ac1, Account ac2) -{ - if (ac1._default) return true; - if (ac2._default) return false; - - return (ac1.name.Cmp(ac2.name) < 0); -} - void KissCount::UpdateAccount(Account& ac) { std::vector::iterator it; @@ -427,6 +419,11 @@ void KissCount::SetOperationOrder(const wxString& order) _db->UpdatePreference(_user, wxT("operation_order")); } +const wxString& KissCount::GetOperationOrder() +{ + return _user->_preferences[wxT("operation_order")] ; +} + std::vector* KissCount::Search(wxString* description, wxDateTime* dateFrom, wxDateTime* dateTo, wxString* amountFrom, wxString* amountTo, std::vector categories, int types, std::vector accounts) @@ -435,7 +432,7 @@ std::vector* KissCount::Search(wxString* description, wxDateTime* dat return _db->Search(_user, description, dateFrom, dateTo, amountFrom, amountTo, categories, types, accounts, true); } -bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month, int year) +bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType) { std::vector* operations; wxDateTime* date ; @@ -452,7 +449,11 @@ bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month date = new wxDateTime(0, (wxDateTime::Month)month, year); - operations = _db->Search(_user, &op.description, date, NULL, NULL, NULL, v, op.fix_cost ? FIX_OP : NON_FIX_OP, v, false); + if (limitToType) + operations = _db->Search(_user, &op.description, date, NULL, NULL, NULL, v, op.fix_cost ? FIX_OP : NON_FIX_OP, v, false); + else + operations = _db->Search(_user, &op.description, date, NULL, NULL, NULL, v, ALL_OP, v, false); + delete date; @@ -601,7 +602,7 @@ ImportEngine* KissCount::GetImportEngine(wxString path) std::vector::iterator it; for(it=_importEngines.begin(); it!=_importEngines.end(); it++) - if ((*it)->HandleFile(path, _user, _db)) + if ((*it)->HandleFile(path, _user, _db, this)) return *it; return NULL; diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index 5c8b241..dd52399 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -83,12 +83,13 @@ public: void SetLanguage(wxLanguage language); void SetOperationOrder(const wxString& order); + const wxString& GetOperationOrder(); std::vector* Search(wxString* description, wxDateTime* dateFrom, wxDateTime* dateTo, wxString* amountFrom, wxString* amountTo, std::vector categories, int types, std::vector accounts); - bool SearchPreviousOperation(Operation* res, Operation& op, int month, int year); + bool SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType); void GetStats(int monthFrom, int yearFrom, int monthTo, int yearTo, std::map > >* accountAmounts, diff --git a/src/model/Account.cpp b/src/model/Account.cpp new file mode 100644 index 0000000..b207df9 --- /dev/null +++ b/src/model/Account.cpp @@ -0,0 +1,34 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "Account.h" + +bool sortAccounts(Account ac1, Account ac2) +{ + if (ac1._default) return true; + if (ac2._default) return false; + + if (!ac1.blocked && ac2.blocked) return true; + if (ac1.blocked && !ac2.blocked) return false; + + if (!ac1._virtual && ac2._virtual) return true; + if (ac1._virtual && !ac2._virtual) return false; + + return (ac1.name.Cmp(ac2.name) < 0); +} diff --git a/src/model/Account.h b/src/model/Account.h index 211759a..3cf953c 100644 --- a/src/model/Account.h +++ b/src/model/Account.h @@ -36,4 +36,6 @@ public: bool _virtual; }; +bool sortAccounts(Account ac1, Account ac2); + #endif diff --git a/src/model/Database.h b/src/model/Database.h index 0d64f1f..cef09a3 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -42,6 +42,7 @@ #define NON_FIX_OP (1 << 1) #define CHECKED_OP (1 << 2) #define NOT_CHECKED_OP (1 << 3) +#define ALL_OP (~0) // if (!_db.CheckSyntax(req)) // { diff --git a/src/model/Operation.cpp b/src/model/Operation.cpp new file mode 100644 index 0000000..6617318 --- /dev/null +++ b/src/model/Operation.cpp @@ -0,0 +1,48 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "Operation.h" + +bool sortOperations(Operation op1, Operation op2) +{ + if (!op1.fix_cost && op2.fix_cost) return false; + if (op1.fix_cost && !op2.fix_cost) return true; + + if (op1.year < op2.year) + return true; + else if (op1.year == op2.year) + { + if (op1.month < op2.month) + return true; + else if (op1.month == op2.month) + { + if (op1.day < op2.day) + return true; + else if (op1.day == op2.day) + return (op1.description.Cmp(op2.description) < 0); + } + } + + return false; +} + +bool reverseSortOperations(Operation op1, Operation op2) +{ + return !sortOperations(op1, op2); +} diff --git a/src/model/Operation.h b/src/model/Operation.h index a0f22b5..842ca47 100644 --- a/src/model/Operation.h +++ b/src/model/Operation.h @@ -20,6 +20,9 @@ #ifndef OPERATION_H #define OPERATION_H +#include +#include + class Operation { public: wxString id; @@ -40,4 +43,7 @@ public: std::vector childs; } ; +bool sortOperations(Operation op1, Operation op2); +bool reverseSortOperations(Operation op1, Operation op2); + #endif diff --git a/src/model/User.h b/src/model/User.h index c650dc3..b2847f3 100644 --- a/src/model/User.h +++ b/src/model/User.h @@ -29,8 +29,10 @@ #include "Account.h" #include "Operation.h" #include "Database.h" +#include "import/ImportEngine.h" class Database; +class ImportPattern; class User { @@ -47,6 +49,7 @@ public: std::vector _categories; std::vector _categoriesFonts; std::map _preferences; + std::map _importPatterns; Category GetCategory(const wxString& catId); wxString GetCategoryName(const wxString& catId); diff --git a/src/model/import/ImportEngine.cpp b/src/model/import/ImportEngine.cpp new file mode 100644 index 0000000..134aafd --- /dev/null +++ b/src/model/import/ImportEngine.cpp @@ -0,0 +1,269 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "ImportEngine.h" + +ImportEngine::ImportEngine() +{ +} + +ImportEngine::~ImportEngine() +{ +} + +bool ImportEngine::HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss) +{ + _path = path; + _user = user; + _db = db; + _kiss = kiss; + + _accounts.clear(); + _unresolvedAccounts.clear(); + _operations.clear(); + _descriptions.clear(); + + return path.EndsWith(_shortExt) || path.EndsWith(_shortExt.Upper()); +} + +wxString ImportEngine::GetFileExt() +{ + return wxGetTranslation(_longExt); +} + +std::vector ExplodeString(wxString& s) +{ + wxString tmp = s, cur = wxT(""); + std::vector res; + + while (tmp.Len()) + { + if (tmp.StartsWith(wxT(" ")) || + tmp.StartsWith(wxT("\t")) || + tmp.StartsWith(wxT("\n")) || + tmp.StartsWith(wxT("\r"))) + { + if (cur.Len()) + { + res.push_back(cur); + cur = wxT(""); + } + tmp = tmp.Mid(1); + continue; + } + cur += tmp.SubString(0, 0); + tmp = tmp.Mid(1); + } + + if (cur.Len()) + res.push_back(cur); + + return res; +} + +/* + Remove : + - head spaces + - tail spaces + - every word starting by a number + */ +wxString ImportEngine::RemoveUnused(wxString& s) +{ + wxString tmp = s, tmp2; + wxString res; + + tmp = tmp.Trim(true); + tmp = tmp.Trim(false); + + while (tmp.Len()) + { + tmp2 = tmp.SubString(0, 0); + if (tmp2.IsNumber()) + { + do + { + tmp = tmp.Mid(1); + tmp2 = tmp.SubString(0, 0); + } while (tmp.Len() && tmp2 != wxT(" ") && + tmp2 != wxT("\t") && + tmp2 != wxT("\r") && + tmp2 != wxT("\n")); + } + res += tmp2; + tmp = tmp.Mid(1); + } + + return res; +} + +/* + Find a pattern between the two strings: + %mX : lower string of orig[X] + %MX : upper string of orig[X] + %fX : First case in upper case of orig[X] + %wX : word orig[X] + other : constants + */ +wxString ImportEngine::FindPattern(wxString& orig, wxString& dest) +{ + wxString pattern, cur_pat; + int i, a; + std::vector tok1 = ExplodeString(orig); + std::vector tok2 = ExplodeString(dest); + int size1 = tok1.size(), size2 = tok2.size(); + + for(i=0; i tok1 = ExplodeString(pattern.filter); + std::vector tok2 = ExplodeString(op.description); + int size1 = tok1.size(), i; + long pos; + + op.description = wxT(""); + + for(i=0; i_importPatterns[key1] = pattern; + + for(i=pos+1; i<(int)_operations.size(); i++) + { + key2 = RemoveUnused(_descriptions[_operations[i].id]); + + if (key1 == key2) + { + ApplyPattern(_user->_importPatterns[key2], _operations[i]); + nbOpUpdated++; + } + } + + return nbOpUpdated; +} + +void ImportEngine::MatchPattern(wxString& originalKey, Operation& op) +{ + wxString key1; + ImportPattern pattern; + + if (!_user) return; + + key1 = RemoveUnused(originalKey); + + if (!_user->_importPatterns.count(key1)) + { + pattern.filter = FindPattern(originalKey, op.description); + pattern.account = op.account; + pattern.category = op.category; + + _user->_importPatterns[key1] = pattern; + + // std::cout << "New pattern " << key1.mb_str() << "\t" << pattern.filter.mb_str() << std::endl; + } + else + { + op.description = _descriptions[op.id]; + ApplyPattern(_user->_importPatterns[key1], op); + } +} diff --git a/src/model/import/ImportEngine.h b/src/model/import/ImportEngine.h new file mode 100644 index 0000000..af18bf3 --- /dev/null +++ b/src/model/import/ImportEngine.h @@ -0,0 +1,75 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef IMPORTENGINE_H +#define IMPORTENGINE_H + +#include +#include + +class KissCount; + +class ImportPattern { +public: + wxString filter; + wxString account; + wxString category; +} ; + +class ImportEngine { +public: + ImportEngine(); + ~ImportEngine(); + + // Get supported file extension. Example : + // "OFX files (*.ofx)|*.ofx" + virtual wxString GetFileExt(); + + // Handle the file + virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss); + + // Parse the file and return accounts that doesn't match + virtual std::vector ParseFile()=0; + + // Final Step + virtual std::vector* GetOperations(std::map& accounts)=0; + + void MatchPattern(wxString& key, Operation& op); + int UpdatePattern(int pos); + +protected: + Database* _db; + User* _user; + wxString _path; + KissCount* _kiss; + + wxString _shortExt; + wxString _longExt; + + std::map _accounts; + std::vector _unresolvedAccounts; + std::vector _operations; + std::map _descriptions; + + wxString RemoveUnused(wxString& s); + void ApplyPattern(ImportPattern& pattern, Operation& op); + wxString FindPattern(wxString& s1, wxString& s2); +}; + +#endif diff --git a/src/model/import/OFXImportEngine.cpp b/src/model/import/OFXImportEngine.cpp new file mode 100644 index 0000000..e6a3c30 --- /dev/null +++ b/src/model/import/OFXImportEngine.cpp @@ -0,0 +1,153 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "OFXImportEngine.h" + +static OFXImportEngine ofxImportEngine; + +int OFXImportEngine::account_cb(const struct OfxAccountData data, void * account_data) +{ + int i; + OFXImportEngine* _this = (OFXImportEngine*) account_data; + wxString account_number = wxString(data.account_number, wxConvUTF8); + + _this->_curAccount = wxT(""); + + for (i=0; i<(int)_this->_user->_accounts.size(); i++) + { + if (_this->_user->_accounts[i].number == account_number) + { + _this->_accounts[account_number] = _this->_user->_accounts[i].id; + _this->_curAccount = _this->_user->_accounts[i].id; + // std::cout << "Account " << data.account_number << " is " << i << std::endl; + //_this->_unresolvedAccounts.push_back(account_number); + break; + } + } + + if (!_this->_curAccount.Len()) + { + _this->_accounts[account_number] = wxT("unknown-") + account_number; + _this->_unresolvedAccounts.push_back(account_number); + } + + return 0; +} + +int OFXImportEngine::transaction_cb(const struct OfxTransactionData data, void * transaction_data) +{ + static int id=0; + OFXImportEngine* _this = (OFXImportEngine*) transaction_data; + Operation op; + struct tm t; + + if (!data.amount_valid || + (!data.date_posted_valid && !data.date_initiated_valid)) return 1; + + op.id = wxString::Format(wxT("%d"), ++id); + op.parent = wxT(""); + op.category = wxT("0"); + op.fix_cost = false; + op.account = _this->_curAccount; + op.checked = false; + op.transfert = wxT(""); + op.formula = wxT(""); + op.meta = false; + op._virtual = false; + + op.amount = data.amount; + + if (data.date_initiated_valid) + gmtime_r(&data.date_initiated, &t); + else + gmtime_r(&data.date_posted, &t); + + op.day = t.tm_mday; + op.month = t.tm_mon; + op.year = t.tm_year+1900; + + if (data.name_valid) + op.description = wxString(data.name, wxConvUTF8); + + if (data.memo_valid) + { + if (op.description.Len()) + op.description += wxT(" "); + op.description += wxString(data.memo, wxConvUTF8); + } + + _this->_operations.push_back(op); + _this->_descriptions[op.id] = op.description; + + _this->MatchPattern(op.description, op); + + return 0; +} + +int OFXImportEngine::account_balance_cb(const struct OfxStatementData data, void * statement_data) +{ + OFXImportEngine* _this = (OFXImportEngine*) statement_data; + + return 0; +} + +OFXImportEngine::OFXImportEngine() +{ + KissCount::RegisterImportEngine(this); + + _ctx = libofx_get_new_context(); + + if (!_ctx) + throw std::string("Unable to initialize libofx"); + + ofx_set_account_cb(_ctx, account_cb, this); + ofx_set_transaction_cb(_ctx, transaction_cb, this); + ofx_set_statement_cb(_ctx, account_balance_cb, this); + + _shortExt = wxT("ofx"); + _longExt = _("OFX files (*.ofx)|*.ofx"); +} + +OFXImportEngine::~OFXImportEngine() +{ + if (_ctx) + libofx_free_context(_ctx); +} + +bool OFXImportEngine::HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss) +{ + if (!ImportEngine::HandleFile(path, user, db, kiss)) return false; + + return !libofx_proc_file(_ctx, path.mb_str(), AUTODETECT); +} + +std::vector OFXImportEngine::ParseFile() +{ + return _unresolvedAccounts; +} + +std::vector* OFXImportEngine::GetOperations(std::map& accounts) +{ + if (_kiss->GetOperationOrder() == wxT("ASC")) + std::sort(_operations.begin(), _operations.end(), sortOperations); + else + std::sort(_operations.begin(), _operations.end(), reverseSortOperations); + + return &_operations; +} diff --git a/src/model/import/OFXImportEngine.h b/src/model/import/OFXImportEngine.h new file mode 100644 index 0000000..803505a --- /dev/null +++ b/src/model/import/OFXImportEngine.h @@ -0,0 +1,44 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef OFXIMPORTENGINE_H +#define OFXIMPORTENGINE_H + +#include "ImportEngine.h" +#include + +class OFXImportEngine : public ImportEngine { +public: + OFXImportEngine(); + ~OFXImportEngine(); + + virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss); + virtual std::vector ParseFile(); + virtual std::vector* GetOperations(std::map& accounts); + +private: + LibofxContextPtr _ctx; + wxString _curAccount; + + static int account_cb(const struct OfxAccountData data, void * account_data); + static int transaction_cb(const struct OfxTransactionData data, void * transaction_data); + static int account_balance_cb(const struct OfxStatementData data, void * statement_data); +}; + +#endif diff --git a/src/view/ImportPanel.cpp b/src/view/ImportPanel.cpp new file mode 100644 index 0000000..2dc8f2a --- /dev/null +++ b/src/view/ImportPanel.cpp @@ -0,0 +1,246 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "ImportPanel.h" + +enum {OPEN_FILE_ID=1, BUTTON_OPEN_ID, NAME_ID, BUTTON_LOAD_ID, BUTTON_INTEGRATE_ID, OPS_GRID_ID}; + +BEGIN_EVENT_TABLE(ImportPanel, wxPanel) +EVT_GRID_CMD_CELL_CHANGE(OPS_GRID_ID, ImportPanel::OnOperationModified) +EVT_BUTTON(BUTTON_OPEN_ID, ImportPanel::OnFile) +EVT_TEXT_ENTER(OPEN_FILE_ID, ImportPanel::OnFileEnter) +EVT_BUTTON(BUTTON_LOAD_ID, ImportPanel::OnLoadOperations) +EVT_SHOW(ImportPanel::OnShow) +END_EVENT_TABLE() + +ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent) +{ + wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); + wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); + wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL); + wxButton* buttonOpen; + wxRect rect = wxDisplay().GetGeometry(); + int w, h; + wxStaticBox* staticAccount = new wxStaticBox(this, wxID_ANY, _("Unresolved accounts")); + + SetSizer(vbox); + + _fileTxt = new wxTextCtrl(this, OPEN_FILE_ID); + _fileTxt->SetWindowStyle(_fileTxt->GetWindowStyle() | wxTE_PROCESS_ENTER); + _fileTxt->GetSize(&w, &h); + wxSize size(rect.width/3, h); + _fileTxt->SetMinSize(size); + buttonOpen = new wxButton(this, BUTTON_OPEN_ID, wxT("...")); + + _buttonLoadOperations = new wxButton(this, BUTTON_LOAD_ID, wxT("Load operations")); + _buttonLoadOperations->Disable(); + + _buttonIntegrate = new wxButton(this, BUTTON_INTEGRATE_ID, wxT("Integrate operations")); + _buttonIntegrate->Disable(); + + hbox->Add(_fileTxt, 0, wxGROW|wxALL, 5); + hbox->Add(buttonOpen, 0, wxALL, 5); + hbox->Add(_buttonLoadOperations, 0, wxALL, 5); + hbox->Add(_buttonIntegrate, 0, wxALL, 5); + + vbox->Add(hbox, 0); + + _accountsGrid = new wxGrid(this, wxID_ANY); + _accountsGrid->CreateGrid(0, 2); + _accountsGrid->SetRowLabelSize(0); + _accountsGrid->SetColLabelValue(0, _("File account")); + _accountsGrid->SetColLabelValue(1, _("Internal account")); + _accountsGrid->Fit(); + + wxStaticBoxSizer* staticBoxSizer = new wxStaticBoxSizer (staticAccount, wxVERTICAL); + staticBoxSizer->Add(_accountsGrid, 0, wxGROW|wxALL, 2); + + _operationsGrid = new GridAccount(kiss, this, OPS_GRID_ID, false, false, false); + + hbox2->Add(staticBoxSizer, 0, wxGROW|wxALL, 15); + hbox2->Add(_operationsGrid, 0, wxGROW|wxALL, 15); + + vbox->Add(hbox2, wxGROW); + + Fit(); + + SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); + SetMaxSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); + SetScrollbars(10, 10, 100/10, 100/10); +} + +KissPanel* ImportPanel::CreatePanel() +{ + return new ImportPanel(_kiss, _wxUI); +} + +wxBitmapButton* ImportPanel::GetButton(int id) +{ + if (!_KissButton) + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(PREFS_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128)); + + return _KissButton; +} + +wxString ImportPanel::GetToolTip() +{ + return _("Import"); +} + +void ImportPanel::OnShow(wxShowEvent& event) +{ + _wxUI->SetTitle(_("KissCount - Import")); +} + +void ImportPanel::OnFile(wxCommandEvent& WXUNUSED(event)) +{ + wxFileDialog openFileDialog(this, _("Choose a database to open"), wxT(""), wxT(""), + _kiss->GetImportEngineExtensions(), wxFD_OPEN|wxFD_FILE_MUST_EXIST); + + if (openFileDialog.ShowModal() == wxID_CANCEL) + return; + + _fileTxt->Clear(); + + *_fileTxt << openFileDialog.GetPath(); + + ProcessFile(); +} + +void ImportPanel::OnFileEnter(wxCommandEvent& WXUNUSED(event)) +{ + ProcessFile(); +} + +void ImportPanel::ProcessFile() +{ + std::vector accounts; + User* user = _kiss->GetUser(); + int i; + wxGridCellChoiceEditor* accountEditor; + wxString* userAccounts; + std::map resolvedAccounts; + wxCommandEvent event; + + wxString path = _fileTxt->GetLineText(0); + + _buttonLoadOperations->Disable(); + _buttonIntegrate->Disable(); + _accountsGrid->ClearGrid(); + _operationsGrid->ClearGrid(); + + _importEngine = _kiss->GetImportEngine(path); + + if (!_importEngine) + { + wxMessageBox(_("Any engine can process this file !"), wxT("KissCount"), wxICON_INFORMATION | wxOK); + + return ; + } + + accounts = _importEngine->ParseFile(); + + if (accounts.size()) + { + int nb_accounts = user->GetAccountsNumber(); + userAccounts = new wxString[nb_accounts+1]; + + userAccounts[0] = _("Create one"); + + for(i=0; i_accounts[i].name; + + accountEditor = new wxGridCellChoiceEditor(nb_accounts+1, userAccounts, false); + + _buttonLoadOperations->Enable(); + + // std::cout << "Insert " << accounts.size() << " rows\n"; + _accountsGrid->AppendRows(accounts.size()); + + for (i=0; i<(int)accounts.size(); i++) + { + _accountsGrid->SetCellValue(i, 0, accounts[i]); + _accountsGrid->SetReadOnly(i, 0); + _accountsGrid->SetCellValue(i, 1, userAccounts[0]); + + _accountsGrid->SetCellEditor(i, 1, accountEditor); + } + + _accountsGrid->AutoSize(); + _accountsGrid->Layout(); + } + else + { + OnLoadOperations(event); + } + Layout(); +} + +void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) +{ + std::map resolvedAccounts; + int i; + User* user = _kiss->GetUser(); + + for(i=0; i<_accountsGrid->GetNumberRows(); i++) + { + resolvedAccounts[_accountsGrid->GetCellValue(i, 0)] = + user->GetAccountId(_accountsGrid->GetCellValue(i, 1)); + } + + _operations = _importEngine->GetOperations(resolvedAccounts); + + if (_operations->size()) + { + _operationsGrid->LoadOperations(_operations, 0, 0); + _buttonIntegrate->Enable(); + + Fit(); + } + else + { + wxMessageBox(_("No operation found into this file"), wxT("KissCount"), wxICON_INFORMATION | wxOK); + } +} + +void ImportPanel::OnOperationModified(wxGridEvent& event) +{ + int col = event.GetCol(); + int row; + static bool update = false; + + if (col != DESCRIPTION && col != CATEGORY && col != ACCOUNT) return ; + + if (update) return; + + update = true; + + row = event.GetRow(); + + _operationsGrid->ClearGrid(); + + if (_importEngine->UpdatePattern(row-1) > 1) + _operationsGrid->LoadOperations(_operations, 0, 0); + + // sleep(1); + + Fit(); + + update = false; +} diff --git a/src/view/ImportPanel.h b/src/view/ImportPanel.h new file mode 100644 index 0000000..545b7e2 --- /dev/null +++ b/src/view/ImportPanel.h @@ -0,0 +1,66 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef IMPORTPANEL_H +#define IMPORTPANEL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "view.h" +#include +#include + +class ImportPanel: public KissPanel +{ +public: + ImportPanel(KissCount* kiss, wxUI *parent); + + KissPanel* CreatePanel(); + wxBitmapButton* GetButton(int id); + wxString GetToolTip(); + void OnShow(wxShowEvent& event); + + void OnFile(wxCommandEvent& WXUNUSED(event)); + void OnFileEnter(wxCommandEvent& WXUNUSED(event)); + void OnLoadOperations(wxCommandEvent& WXUNUSED(event)); + void OnOperationModified(wxGridEvent& event); + +private: + wxGrid* _accountsGrid; + wxTextCtrl* _fileTxt; + GridAccount* _operationsGrid; + ImportEngine* _importEngine; + wxButton* _buttonLoadOperations, *_buttonIntegrate; + std::vector* _operations; + + void ProcessFile(); + + DECLARE_EVENT_TABLE(); +}; + +#endif diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index bd89b5f..f65c1ce 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -39,8 +39,6 @@ BEGIN_EVENT_TABLE(GridAccount, wxGrid) EVT_GRID_CELL_LEFT_CLICK(GridAccount::OnCellLeftClick ) END_EVENT_TABLE() -enum {TREE, DESCRIPTION, OP_DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, OP_DELETE, CHECKED, NUMBER_COLS_OPS}; - enum {GRID_ID}; GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id, @@ -201,9 +199,11 @@ void GridAccount::LoadOperations(std::vector* operations, int month, _displayedOperations.clear(); _displayedOperations.push_back(NULLop); // Header _fixCosts = 0; - it = _operations->begin(); + if (GetNumberRows () > 1) + DeleteRows(1, GetNumberRows ()-1); + if (_canAddOperation) { for (;it != _operations->end() && it->fix_cost; it++) @@ -331,7 +331,13 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, SetCellEditor(line, CREDIT, new wxGridCellFloatEditor(wxID_ANY, 2)); wxGridCellChoiceEditor* accountEditor = new wxGridCellChoiceEditor(user->GetAccountsNumber(), _accounts, false); SetCellEditor(line, ACCOUNT, accountEditor); - wxGridCellChoiceEditor* categoryEditor = new wxGridCellChoiceEditor(user->GetCategoriesNumber()-1, _categories+1, false); + wxGridCellChoiceEditor* categoryEditor ; + + if (_canAddOperation) + categoryEditor = new wxGridCellChoiceEditor(user->GetCategoriesNumber()-1, _categories+1, false); + else + categoryEditor = new wxGridCellChoiceEditor(user->GetCategoriesNumber(), _categories, false); + SetCellEditor(line, CATEGORY, categoryEditor); if (fix) @@ -669,7 +675,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) Category cat ; // Avoid recursives calls - if (inModification) return; + if (inModification || _loadOperations) return; inModification = true ; @@ -722,6 +728,23 @@ void GridAccount::OnOperationModified(wxGridEvent& event) op_complete--; } + if (col == DESCRIPTION && + (!GetCellValue(row, CATEGORY).Length() || + !GetCellValue(row, ACCOUNT).Length() || + !_canAddOperation)) + { + if (_kiss->SearchPreviousOperation(&op_tmp, new_op, new_op.month, new_op.year, _canAddOperation)) + { + new_op.category = op_tmp.category; + new_op.account = op_tmp.account; + SetCellValue(row, CATEGORY, wxGetTranslation(user->GetCategoryName(new_op.category))); + SetCellValue(row, ACCOUNT, user->GetAccountName(new_op.account)); + op_complete -= 2; + col = CATEGORY; + new_op.fix_cost = (new_op.category == user->GetCategoryId(wxT("Fix"))); + } + } + value = GetCellValue(row, DEBIT); if (value.Length()) { @@ -753,7 +776,6 @@ void GridAccount::OnOperationModified(wxGridEvent& event) pEditor->DecRef(); } - value = GetCellValue(row, CATEGORY); if (value.Length()) { @@ -775,21 +797,6 @@ void GridAccount::OnOperationModified(wxGridEvent& event) new_op.checked = false; op_complete--; - if (col == DESCRIPTION && - (!GetCellValue(row, CATEGORY).Length() || - !GetCellValue(row, ACCOUNT).Length())) - { - new_op.fix_cost = row <= _fixCosts; - if (_kiss->SearchPreviousOperation(&op_tmp, new_op, _curMonth, _curYear)) - { - new_op.category = op_tmp.category; - new_op.account = op_tmp.account; - SetCellValue(row, CATEGORY, wxGetTranslation(user->GetCategoryName(new_op.category))); - SetCellValue(row, ACCOUNT, user->GetAccountName(new_op.account)); - op_complete -= 2; - } - } - cur_op = (_displayedOperations)[row] ; if (col == CHECKED || col == CATEGORY) @@ -1539,7 +1546,7 @@ void GridAccount::MassUpdate(std::vector& rows, updateOperationFunc func, v } } - DeleteRows(1, GetNumberRows()-1); + ClearGrid(); LoadOperations(_operations, 0, 0); diff --git a/src/view/grid/GridAccount.h b/src/view/grid/GridAccount.h index 72c6bdf..c1c6926 100644 --- a/src/view/grid/GridAccount.h +++ b/src/view/grid/GridAccount.h @@ -36,6 +36,8 @@ class KissCount; +enum {TREE, DESCRIPTION, OP_DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, OP_DELETE, CHECKED, NUMBER_COLS_OPS}; + typedef void (*updateOperationFunc)(Operation* op, void** params); class GridAccount : public wxGrid From 35f660b234f2645565e4a222e48e5493c4763a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Wed, 23 Mar 2011 20:35:29 +0100 Subject: [PATCH 49/72] Functionnal version of ImportPanel --- ChangeLog | 4 +- Makefile | 5 +- ressources/icons/SOURCE | 1 + ressources/icons/import-icon.png | Bin 0 -> 4894 bytes ressources/init.sql | 3 +- src/controller/KissCount.cpp | 5 ++ src/controller/KissCount.h | 1 + src/model/Database.cpp | 57 +++++++++++++++++ src/model/Database.h | 2 + src/model/Database_Update.cpp | 5 ++ src/model/User.h | 1 + src/model/import/ImportEngine.cpp | 61 ++++++++++++++---- src/model/import/ImportEngine.h | 12 ++-- src/model/import/OFXImportEngine.cpp | 17 +---- src/model/import/OFXImportEngine.h | 4 +- src/view/ImportPanel.cpp | 91 ++++++++++++++++++++++++--- src/view/ImportPanel.h | 3 + src/view/view.h | 1 + 18 files changed, 225 insertions(+), 48 deletions(-) create mode 100644 ressources/icons/import-icon.png diff --git a/ChangeLog b/ChangeLog index b36a622..f3ee6ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2 (06/03/2011) +v0.2 (23/03/2011) ** User ** Better use of sizers (so better interface!) @@ -14,6 +14,7 @@ v0.2 (06/03/2011) Add Real mode Database is now at ~/.kisscount/kc.bdd Add Debian's packages !! + Add Import Panel and OFX imports ** Dev ** Use a factory to create panels (prepare for plug-in) @@ -22,6 +23,7 @@ v0.2 (06/03/2011) New database version (2) : fix_cost for categories virtual field for account and operation + import_panel Database checking & upgrading ** Bugs ** diff --git a/Makefile b/Makefile index 1833740..52ae73f 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,9 @@ CXXFLAGS+=`wx-config --cxxflags` -Wall -Isrc -ggdb CXXFLAGS+=-I./lib/wxsqlite3-1.9.9/include CXXFLAGS+=-I./lib/freechart/include CXXFLAGS+=-Wl,--rpath,"$(LIB_DIR)" -CXXFLAGS+=-DRESSOURCES_ROOT="\"$(SHARE_DIR)\"" -#CXXFLAGS+=-DRESSOURCES_ROOT="\"./ressources/\"" +#CXXFLAGS+=-DRESSOURCES_ROOT="\"$(SHARE_DIR)\"" +# For developpers +CXXFLAGS+=-DRESSOURCES_ROOT="\"./ressources/\"" LDFLAGS+=`wx-config --libs` LDFLAGS+=-lofx diff --git a/ressources/icons/SOURCE b/ressources/icons/SOURCE index db176a4..2e0b92e 100644 --- a/ressources/icons/SOURCE +++ b/ressources/icons/SOURCE @@ -1 +1,2 @@ http://www.iconarchive.com/category/application-icons.html +http://www.webidev.com/fr/WebiInscrit diff --git a/ressources/icons/import-icon.png b/ressources/icons/import-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..11ce262cbbeadbffb48058dd6c0c418f76ffd5e8 GIT binary patch literal 4894 zcmV+(6XEQMP)`xg=_mJ@<&2|-v0 zSb`7>5W`f^H-ky-?E}4AnX$~6fQH+iSxCX3 z4+hlgRm&GnENH9_FwRRTA)tf+B=sEUB2@qgAs|Zxsw}}UEbKWn#DDwIQEFN2UnCLw z`tM(S$hiE_rYAEZpz*e+)&u0HEsa&tbt@MSNs3Zvn0C2o@iIz5DJ38z#em=fT%<@~ z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&3ihW z?;Y=l6{m2{-CRHj;pX#>SqdQ#4u{>ga5#Lyf;h))F}y`b!)N zfW%_4pMLn^hbxPVi_zTN>>hYd1|oaXxj=Z|&v!q&-!{)n~*d^K>z^&fzHm(d&A-I{gNcj!~Y}UoNKzS?>u<$;Io5+gC_ta0VEv) zWTXj57k_W})L5g~+d#+VO)pp@E_Qfq8%>~u65jRMdCXz3Dn zy}pM8A5socMaoVT01^NOd^Y~sahjqaHD3n624Dd&(j^HXDTELiVK40v6?{s7oGui9 zS_C+bT>z;+PfQmbfG&h^4;u6S%S`&%NJeV)rF3V1N(4}(z&jeiL=Le32Lgu+O8^Z> Qg#Z8m07*qoM6N<$f^AGe>;M1& literal 0 HcmV?d00001 diff --git a/ressources/init.sql b/ressources/init.sql index ecba2f0..ab44767 100644 --- a/ressources/init.sql +++ b/ressources/init.sql @@ -6,4 +6,5 @@ CREATE TABLE account_amount(id INTEGER PRIMARY KEY, account REFERENCES account(i CREATE TABLE operation(id INTEGER PRIMARY KEY, parent REFERENCES operation(id), user REFERENCES user(id), account REFERENCES account(id), year INTEGER, month INTEGER, day INTEGER, amount FLOAT, description VARCHAR(255), category REFERENCES category(id), fix_cost CHAR(1), checked CHAR(1), formula VARCHAR(255), transfert REFERENCES operation(id), meta CHAR(1), virtual CHAR(1)); CREATE TABLE category(id INTEGER PRIMARY KEY, user REFERENCES user(id), parent REFERENCES category(id), name VARCHAR(255), backcolor VARCHAR(10), forecolor VARCHAR(10), font VARCHAR(255), fix_cost CHAR(1)); CREATE TABLE preference(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), value VARCHAR(255)); -INSERT INTO kisscount ("db_version") VALUES ("2"); \ No newline at end of file +CREATE TABLE import_pattern(id INTEGER PRIMARY KEY, user REFERENCES user(id), description VARCHAR(255), pattern VARCHAR(255), account REFERENCES account(id), category REFERENCES category(id)); +INSERT INTO kisscount ("db_version") VALUES ("2"); diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index e62b21c..4c5772e 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -607,3 +607,8 @@ ImportEngine* KissCount::GetImportEngine(wxString path) return NULL; } + +void KissCount::UpdateImportPattern() +{ + _db->UpdateImportPattern(_user); +} diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index dd52399..e741390 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -111,6 +111,7 @@ public: wxString GetImportEngineExtensions(); ImportEngine* GetImportEngine(wxString path); + void UpdateImportPattern(); private: wxUI* _wxUI; Database* _db; diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 7fe6165..735ba5f 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -209,6 +209,7 @@ User* Database::LoadUser(const wxString& name) User* user; Account account; Category category; + ImportPattern importPattern; std::vector::iterator it; @@ -314,6 +315,20 @@ User* Database::LoadUser(const wxString& name) set.Finalize(); + req = wxT("SELECT * FROM import_pattern WHERE user='") + user->_id + wxT("'"); + EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); + + while (set.NextRow()) + { + importPattern.pattern = set.GetAsString(wxT("pattern")); + importPattern.account = set.GetAsString(wxT("account")); + importPattern.category = set.GetAsString(wxT("category")); + + user->_importPatterns[set.GetAsString(wxT("description"))] = importPattern; + } + + set.Finalize(); + return user; } @@ -1725,3 +1740,45 @@ wxString Database::getSharedAccountOwner(const wxString& account) return set2.GetAsString(wxT("name")); } + +void Database::UpdateImportPattern(User* user) +{ + std::map::iterator it; + wxString req, key; + + for (it = user->_importPatterns.begin(); + it != user->_importPatterns.end(); + it++) + { + if (it->second.pattern == NULL_IMPORT_PATTERN) continue; + + key = ImportEngine::RemoveUnused(it->first); + + req = wxT("UPDATE import_pattern SET ") ; + req += wxT("pattern='") + it->second.pattern + wxT("'"); + req += wxT(", account='") + it->second.account + wxT("'"); + req += wxT(", category='") + it->second.category + wxT("'"); + req += wxT(" WHERE description='") + key + wxT("'"); + + try + { + if (!_db.ExecuteUpdate(req)) + { + req = wxT("INSERT INTO import_pattern ('user', 'description', 'pattern', 'account', 'category') VALUES ('") ; + req += user->_id + wxT("'"); + req += wxT(" ,'") + key + wxT("'"); + req += wxT(" ,'") + it->second.pattern + wxT("'"); + req += wxT(" ,'") + it->second.account + wxT("'"); + req += wxT(" ,'") + it->second.category + wxT("'"); + req += wxT(")"); + EXECUTE_SQL_UPDATE(req, ); + } + } + catch (wxSQLite3Exception e) + { + std::cerr << req.mb_str() << "\n" ; + std::cerr << e.GetMessage().mb_str() << "\n" ; + return ; + } + } +} diff --git a/src/model/Database.h b/src/model/Database.h index cef09a3..e0732c8 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -164,6 +164,8 @@ public: std::map* GetNotChecked(User* user, int month, int year); std::map* GetVirtualAmount(User* user, int month, int year); + void UpdateImportPattern(User* user); + /* Database Update */ void CheckDatabaseVersion(); diff --git a/src/model/Database_Update.cpp b/src/model/Database_Update.cpp index 65d861d..dbfc113 100644 --- a/src/model/Database_Update.cpp +++ b/src/model/Database_Update.cpp @@ -64,6 +64,11 @@ static void Version_1_to_2(wxSQLite3Database& _db) req = wxT("UPDATE operation SET virtual='0'"); UPDATE_TABLE("1", "2", "7"); + + /* Import Pattern */ + req = wxT("CREATE TABLE import_pattern(id INTEGER PRIMARY KEY, user REFERENCES user(id), description VARCHAR(255), pattern VARCHAR(255), account REFERENCES account(id), category REFERENCES category(id))"); + + UPDATE_TABLE("1", "2", "8"); } static update_func updates[] = { diff --git a/src/model/User.h b/src/model/User.h index b2847f3..dbc89cc 100644 --- a/src/model/User.h +++ b/src/model/User.h @@ -73,6 +73,7 @@ public: void UnGroup(const Operation& op); void ResolveGroups(int year); + void UpdateImportPattern(User* user); private: Database* _db; }; diff --git a/src/model/import/ImportEngine.cpp b/src/model/import/ImportEngine.cpp index 134aafd..90e7b30 100644 --- a/src/model/import/ImportEngine.cpp +++ b/src/model/import/ImportEngine.cpp @@ -83,7 +83,7 @@ std::vector ExplodeString(wxString& s) - tail spaces - every word starting by a number */ -wxString ImportEngine::RemoveUnused(wxString& s) +wxString ImportEngine::RemoveUnused(const wxString& s) { wxString tmp = s, tmp2; wxString res; @@ -124,9 +124,16 @@ wxString ImportEngine::FindPattern(wxString& orig, wxString& dest) { wxString pattern, cur_pat; int i, a; - std::vector tok1 = ExplodeString(orig); - std::vector tok2 = ExplodeString(dest); - int size1 = tok1.size(), size2 = tok2.size(); + std::vector tok1; + std::vector tok2; + int size1, size2; + + if (orig == dest) return NULL_IMPORT_PATTERN; + + tok1 = ExplodeString(orig); + tok2 = ExplodeString(dest); + size1 = tok1.size(); + size2 = tok2.size(); for(i=0; i tok1 = ExplodeString(pattern.filter); - std::vector tok2 = ExplodeString(op.description); - int size1 = tok1.size(), i; + std::vector tok1; + std::vector tok2; + int size1, i; long pos; + op.account = pattern.account; + op.category = pattern.category; + + if (pattern.pattern == NULL_IMPORT_PATTERN) return; + + tok1 = ExplodeString(pattern.pattern); + tok2 = ExplodeString(op.description); + size1 = tok1.size(); + op.description = wxT(""); for(i=0; i_importPatterns.count(key1)) { - pattern.filter = FindPattern(originalKey, op.description); + pattern.pattern = FindPattern(originalKey, op.description); pattern.account = op.account; pattern.category = op.category; _user->_importPatterns[key1] = pattern; - // std::cout << "New pattern " << key1.mb_str() << "\t" << pattern.filter.mb_str() << std::endl; + // std::cout << "New pattern " << key1.mb_str() << "\t" << pattern.pattern.mb_str() << std::endl; } else { @@ -267,3 +281,26 @@ void ImportEngine::MatchPattern(wxString& originalKey, Operation& op) ApplyPattern(_user->_importPatterns[key1], op); } } + +std::vector ImportEngine::ParseFile() +{ + return _unresolvedAccounts; +} + +std::vector* ImportEngine::GetOperations(std::map& accounts) +{ + int i; + + for(i=0; i<(int)_operations.size(); i++) + { + if (_operations[i].account.StartsWith(wxT("unknown-"))) + _operations[i].account = accounts[_operations[i].account.Mid(8)]; + } + + if (_kiss->GetOperationOrder() == wxT("ASC")) + std::sort(_operations.begin(), _operations.end(), sortOperations); + else + std::sort(_operations.begin(), _operations.end(), reverseSortOperations); + + return &_operations; +} diff --git a/src/model/import/ImportEngine.h b/src/model/import/ImportEngine.h index af18bf3..efc54a1 100644 --- a/src/model/import/ImportEngine.h +++ b/src/model/import/ImportEngine.h @@ -27,11 +27,13 @@ class KissCount; class ImportPattern { public: - wxString filter; + wxString pattern; wxString account; wxString category; } ; +#define NULL_IMPORT_PATTERN wxT("(nil)") + class ImportEngine { public: ImportEngine(); @@ -42,17 +44,18 @@ public: virtual wxString GetFileExt(); // Handle the file - virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss); + virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss)=0; // Parse the file and return accounts that doesn't match - virtual std::vector ParseFile()=0; + virtual std::vector ParseFile(); // Final Step - virtual std::vector* GetOperations(std::map& accounts)=0; + virtual std::vector* GetOperations(std::map& accounts); void MatchPattern(wxString& key, Operation& op); int UpdatePattern(int pos); + static wxString RemoveUnused(const wxString& s); protected: Database* _db; User* _user; @@ -67,7 +70,6 @@ protected: std::vector _operations; std::map _descriptions; - wxString RemoveUnused(wxString& s); void ApplyPattern(ImportPattern& pattern, Operation& op); wxString FindPattern(wxString& s1, wxString& s2); }; diff --git a/src/model/import/OFXImportEngine.cpp b/src/model/import/OFXImportEngine.cpp index e6a3c30..0ad607c 100644 --- a/src/model/import/OFXImportEngine.cpp +++ b/src/model/import/OFXImportEngine.cpp @@ -43,7 +43,7 @@ int OFXImportEngine::account_cb(const struct OfxAccountData data, void * account if (!_this->_curAccount.Len()) { - _this->_accounts[account_number] = wxT("unknown-") + account_number; + _this->_curAccount = _this->_accounts[account_number] = wxT("unknown-") + account_number; _this->_unresolvedAccounts.push_back(account_number); } @@ -136,18 +136,3 @@ bool OFXImportEngine::HandleFile(const wxString& path, User* user, Database* db, return !libofx_proc_file(_ctx, path.mb_str(), AUTODETECT); } - -std::vector OFXImportEngine::ParseFile() -{ - return _unresolvedAccounts; -} - -std::vector* OFXImportEngine::GetOperations(std::map& accounts) -{ - if (_kiss->GetOperationOrder() == wxT("ASC")) - std::sort(_operations.begin(), _operations.end(), sortOperations); - else - std::sort(_operations.begin(), _operations.end(), reverseSortOperations); - - return &_operations; -} diff --git a/src/model/import/OFXImportEngine.h b/src/model/import/OFXImportEngine.h index 803505a..3c3324f 100644 --- a/src/model/import/OFXImportEngine.h +++ b/src/model/import/OFXImportEngine.h @@ -29,8 +29,8 @@ public: ~OFXImportEngine(); virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss); - virtual std::vector ParseFile(); - virtual std::vector* GetOperations(std::map& accounts); + /* virtual std::vector ParseFile(); */ + /* virtual std::vector* GetOperations(std::map& accounts); */ private: LibofxContextPtr _ctx; diff --git a/src/view/ImportPanel.cpp b/src/view/ImportPanel.cpp index 2dc8f2a..04cf600 100644 --- a/src/view/ImportPanel.cpp +++ b/src/view/ImportPanel.cpp @@ -19,11 +19,12 @@ #include "ImportPanel.h" -enum {OPEN_FILE_ID=1, BUTTON_OPEN_ID, NAME_ID, BUTTON_LOAD_ID, BUTTON_INTEGRATE_ID, OPS_GRID_ID}; +enum {OPEN_FILE_ID=1, BUTTON_OPEN_ID, NAME_ID, BUTTON_LOAD_ID, BUTTON_INTEGRATE_ID, CHECK_SAVE_ID, OPS_GRID_ID}; BEGIN_EVENT_TABLE(ImportPanel, wxPanel) EVT_GRID_CMD_CELL_CHANGE(OPS_GRID_ID, ImportPanel::OnOperationModified) EVT_BUTTON(BUTTON_OPEN_ID, ImportPanel::OnFile) +EVT_BUTTON(BUTTON_INTEGRATE_ID, ImportPanel::OnIntegrate) EVT_TEXT_ENTER(OPEN_FILE_ID, ImportPanel::OnFileEnter) EVT_BUTTON(BUTTON_LOAD_ID, ImportPanel::OnLoadOperations) EVT_SHOW(ImportPanel::OnShow) @@ -33,7 +34,7 @@ ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent { wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL); + _hbox = new wxBoxSizer(wxHORIZONTAL); wxButton* buttonOpen; wxRect rect = wxDisplay().GetGeometry(); int w, h; @@ -54,10 +55,13 @@ ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _buttonIntegrate = new wxButton(this, BUTTON_INTEGRATE_ID, wxT("Integrate operations")); _buttonIntegrate->Disable(); + _checkSaveImportPatterns = new wxCheckBox(this, CHECK_SAVE_ID, wxT("Save import patterns")); + hbox->Add(_fileTxt, 0, wxGROW|wxALL, 5); hbox->Add(buttonOpen, 0, wxALL, 5); hbox->Add(_buttonLoadOperations, 0, wxALL, 5); hbox->Add(_buttonIntegrate, 0, wxALL, 5); + hbox->Add(_checkSaveImportPatterns, 0, wxALL, 5); vbox->Add(hbox, 0); @@ -73,10 +77,10 @@ ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _operationsGrid = new GridAccount(kiss, this, OPS_GRID_ID, false, false, false); - hbox2->Add(staticBoxSizer, 0, wxGROW|wxALL, 15); - hbox2->Add(_operationsGrid, 0, wxGROW|wxALL, 15); + _hbox->Add(staticBoxSizer, 0, wxGROW|wxALL, 15); + _hbox->Add(_operationsGrid, 0, wxGROW|wxALL, 15); - vbox->Add(hbox2, wxGROW); + vbox->Add(_hbox, wxGROW); Fit(); @@ -93,7 +97,7 @@ KissPanel* ImportPanel::CreatePanel() wxBitmapButton* ImportPanel::GetButton(int id) { if (!_KissButton) - _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(PREFS_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128)); + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(IMPORT_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128)); return _KissButton; } @@ -195,8 +199,9 @@ void ImportPanel::ProcessFile() void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) { std::map resolvedAccounts; - int i; + int i, nbAccounts; User* user = _kiss->GetUser(); + Account account; for(i=0; i<_accountsGrid->GetNumberRows(); i++) { @@ -204,13 +209,57 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) user->GetAccountId(_accountsGrid->GetCellValue(i, 1)); } + nbAccounts = 0; + for(i=0; i<_accountsGrid->GetNumberRows(); i++) + { + if (_accountsGrid->GetCellValue(i, 1) == _("Create one")) + nbAccounts++; + } + + if (nbAccounts) + { + wxString message = wxString::Format(wxT("%d"), nbAccounts); + message += _(" account(s) will be created, is it ok ?"); + + wxMessageDialog dialog(_wxUI, message, wxT("KissCount"), wxYES_NO); + if (dialog.ShowModal() == wxID_NO) + return; + + for(i=0; i<_accountsGrid->GetNumberRows(); i++) + { + if (_accountsGrid->GetCellValue(i, 1) == _("Create one")) + { + account.name = _accountsGrid->GetCellValue(i, 0); + account.number = _accountsGrid->GetCellValue(i, 0); + account.shared = false; + account.blocked = false; + account._default = false; + account.is_owner = true; + account._virtual = false; + + resolvedAccounts[_accountsGrid->GetCellValue(i, 0)] = _kiss->AddAccount(account); + } + } + + _accountsGrid->DeleteRows(0, _accountsGrid->GetNumberRows ()); + + _wxUI->NeedReload(); + } + _operations = _importEngine->GetOperations(resolvedAccounts); if (_operations->size()) { + _hbox->Detach(_operationsGrid); + delete _operationsGrid; + _operationsGrid = new GridAccount(_kiss, this, OPS_GRID_ID, false, false, false); + _hbox->Add(_operationsGrid, 0, wxGROW|wxALL, 15); + _operationsGrid->LoadOperations(_operations, 0, 0); _buttonIntegrate->Enable(); + _buttonLoadOperations->Disable(); + Fit(); } else @@ -219,6 +268,32 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) } } +void ImportPanel::OnIntegrate(wxCommandEvent& WXUNUSED(event)) +{ + int i; + + if (!_operations->size()) return; + + wxMessageDialog dialog(_wxUI, _("Are you sure want to integrate these operations ?"), wxT("KissCount"), wxYES_NO); + if (dialog.ShowModal() == wxID_NO) + return; + + _buttonIntegrate->Disable(); + + for(i=0; i<(int)_operations->size(); i++) + _kiss->AddOperation((*_operations)[i]); + + // if (_checkSaveImportPatterns->IsChecked()) + _kiss->UpdateImportPattern(); + + _operations->clear(); + _operationsGrid->ClearGrid(); + + wxMessageBox(_("Operations successfully imported"), wxT("KissCount"), wxICON_INFORMATION | wxOK); + + _wxUI->NeedReload(); +} + void ImportPanel::OnOperationModified(wxGridEvent& event) { int col = event.GetCol(); @@ -238,8 +313,6 @@ void ImportPanel::OnOperationModified(wxGridEvent& event) if (_importEngine->UpdatePattern(row-1) > 1) _operationsGrid->LoadOperations(_operations, 0, 0); - // sleep(1); - Fit(); update = false; diff --git a/src/view/ImportPanel.h b/src/view/ImportPanel.h index 545b7e2..3c30f71 100644 --- a/src/view/ImportPanel.h +++ b/src/view/ImportPanel.h @@ -48,14 +48,17 @@ public: void OnFile(wxCommandEvent& WXUNUSED(event)); void OnFileEnter(wxCommandEvent& WXUNUSED(event)); void OnLoadOperations(wxCommandEvent& WXUNUSED(event)); + void OnIntegrate(wxCommandEvent& WXUNUSED(event)); void OnOperationModified(wxGridEvent& event); private: + wxBoxSizer *_hbox; wxGrid* _accountsGrid; wxTextCtrl* _fileTxt; GridAccount* _operationsGrid; ImportEngine* _importEngine; wxButton* _buttonLoadOperations, *_buttonIntegrate; + wxCheckBox *_checkSaveImportPatterns; std::vector* _operations; void ProcessFile(); diff --git a/src/view/view.h b/src/view/view.h index 7e64524..de0c0d4 100644 --- a/src/view/view.h +++ b/src/view/view.h @@ -34,6 +34,7 @@ #define STATS_ICON RESSOURCES_ROOT "icons/chart-icon.png" #define SEARCH_ICON RESSOURCES_ROOT "icons/Search-icon.png" #define PREFS_ICON RESSOURCES_ROOT "icons/options-icon.png" +#define IMPORT_ICON RESSOURCES_ROOT "icons/import-icon.png" #define CHANGE_USER_ICON RESSOURCES_ROOT "icons/Clients-icon.png" #define ABOUT_ICON RESSOURCES_ROOT "icons/windows-users-icon.png" #define QUIT_ICON RESSOURCES_ROOT "icons/system-log-out.png" From 478728f69e8631f797323f2ae51c5c2ed85e804d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 24 Mar 2011 19:23:25 +0100 Subject: [PATCH 50/72] Update french.po Add libofx-dev dependency for debian packages --- debian/control | 2 +- ressources/po/french.mo | Bin 7924 -> 8929 bytes ressources/po/french.po | 112 ++++++++++++++++++++++++++---------- ressources/po/kisscount.pot | 103 +++++++++++++++++++++++++-------- 4 files changed, 162 insertions(+), 55 deletions(-) diff --git a/debian/control b/debian/control index ed6d6f2..0e8763c 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: kisscount Section: misc Priority: extra Maintainer: Grégory Soutadé -Build-Depends: debhelper (>= 7.0.50~), libsqlite3-dev, libwxgtk2.8-dev (>= 2.8.10) +Build-Depends: debhelper (>= 7.0.50~), libsqlite3-dev, libwxgtk2.8-dev (>= 2.8.10), libofx-dev Standards-Version: 3.9.1 Homepage: http://indefero.soutade.fr/p/kisscount/ Vcs-Git: git://soutade.fr/kisscount.git diff --git a/ressources/po/french.mo b/ressources/po/french.mo index 86795eda38137bb93572af681356b8d9920b620c..c82854978545cfa0ae11ea1bac84be5dfee02387 100644 GIT binary patch literal 8929 zcmbW54~%71eaFx8M{%rLQKZlUXHnc;nYX*cg0ds9%+BmA>(1^BGy4Zr&^zy)H*U)b{he z_uTj1?6SmoGr#va_ug~Q`JLbSo!|MLdFK3c9xz-FBfo?E+d0O37e4wbez<<|8^)Xs z{~Kc-Ou3w zypX|2pUa`XzY?n7YaoASgdeJ!oBjR!Jv;DRp5F!4&)x7M_z5U`oP-y^ufx~F??UPI zBdC5~fYNIn4|RVYEXD~Ly14{073NC+d@EEx!%+S1^!GPGwKE0P&S5D1XW@k~f~tQv zwD4Xidp`zM@2gPr`y^C<--i5|r~UoELVf=uC_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Slab^F zd)9f>7Q{2Q{KP%y7Ti;=pd27`$OwC0KSU+AJOH00bM5#4^Drlxh@N~MIhy}dk#hLo z=nTrs$vP4w_2i%90b7`9ebL&^IvNfUr1px8BUgx z6{MKx$Rz#4rN~E-EiXd7rsZS|nMK-?=ZKCz5yDUUK+3U1@BdIzMfAYySgq$Tnye(_ ziQdgxqBr3oq92!eB#!9dAvO&}_vwdaDtVAhB>G+O5gqzX$PbtP`-oA|pX)dNKy7_> zV0NRwdWoACf88xj80@~E@T1$(aiklQxYzwKadKQ;aA7b|>t7V8ZK!q!B;9e#lh3+E zDL!|8%8<~RlvSS4+|(RT`-0qpJb!*cab96)M_P&}bh%TC#|@-sxP8<6g&|z=BCv+<_*5l^*3Zll3c1to--Oav&&`sYFPw10w GKF{B!Z6+)L diff --git a/ressources/po/french.po b/ressources/po/french.po index b7269a0..ce4436f 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-20 12:04+0100\n" +"POT-Creation-Date: 2011-03-24 19:19+0100\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -24,6 +24,10 @@ msgstr "" msgid " - " msgstr " - " +#: src/view/ImportPanel.cpp:222 +msgid " account(s) will be created, is it ok ?" +msgstr " comptes vont être créés, êtes vous d'accord ?" + #: src/view/UsersDialog.cpp:120 #: src/view/PreferencesPanel.cpp:495 #: src/view/PreferencesPanel.cpp:515 @@ -58,7 +62,7 @@ msgid "1 entry found" msgstr "1 entrée trouvée" #: src/view/SearchPanel.cpp:99 -#: src/view/grid/GridAccount.cpp:67 +#: src/view/grid/GridAccount.cpp:68 msgid "Account" msgstr "Compte" @@ -67,7 +71,7 @@ msgstr "Compte" msgid "Account " msgstr "Le compte " -#: src/controller/KissCount.cpp:370 +#: src/controller/KissCount.cpp:364 msgid "Account 1" msgstr "Compte 1" @@ -92,15 +96,23 @@ msgstr "Montant min" msgid "Amount to" msgstr "Montant max" +#: src/view/ImportPanel.cpp:156 +msgid "Any engine can process this file !" +msgstr "Format de fichier non reconnu" + #: src/view/PreferencesPanel.cpp:838 #: src/view/AccountPanel.cpp:847 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " -#: src/view/grid/GridAccount.cpp:836 +#: src/view/grid/GridAccount.cpp:853 msgid "Are you sure want to delete : \n" msgstr "Etes vous sûr de vouloir supprimer : \n" +#: src/view/ImportPanel.cpp:277 +msgid "Are you sure want to integrate these operations ?" +msgstr "Etes vous sûr de vouloir intégreer ces opérations" + #: src/view/PreferencesPanel.cpp:368 msgid "Ascending" msgstr "Croissant" @@ -119,13 +131,13 @@ msgstr "Bloqué" msgid "Cancel" msgstr "Annuler" -#: src/view/grid/GridAccount.cpp:1271 -#: src/view/grid/GridAccount.cpp:1278 +#: src/view/grid/GridAccount.cpp:1288 +#: src/view/grid/GridAccount.cpp:1295 msgid "Cannot group these operations" msgstr "Impossible de grouper ces opérations" -#: src/view/grid/GridAccount.cpp:1397 -#: src/view/grid/GridAccount.cpp:1403 +#: src/view/grid/GridAccount.cpp:1414 +#: src/view/grid/GridAccount.cpp:1420 msgid "Cannot ungroup these operations" msgstr "Impossible de dégrouper ces opérations" @@ -134,7 +146,7 @@ msgid "Categories" msgstr "Catégories" #: src/view/SearchPanel.cpp:97 -#: src/view/grid/GridAccount.cpp:67 +#: src/view/grid/GridAccount.cpp:68 msgid "Category" msgstr "Catégorie" @@ -171,6 +183,10 @@ msgstr "Rapprochement" msgid "Checked" msgstr "Rapprochée" +#: src/view/ImportPanel.cpp:117 +msgid "Choose a database to open" +msgstr "Choisissez une base de données à ouvrir" + #: src/view/SearchPanel.cpp:309 msgid "Choose a new account" msgstr "Nouveau compte" @@ -188,7 +204,13 @@ msgstr "Confirmer le mot de passe " msgid "Cost repartition" msgstr "Répartition des coûts" -#: src/view/grid/GridAccount.cpp:67 +#: src/view/ImportPanel.cpp:168 +#: src/view/ImportPanel.cpp:215 +#: src/view/ImportPanel.cpp:230 +msgid "Create one" +msgstr "En créer un" + +#: src/view/grid/GridAccount.cpp:68 msgid "Credit" msgstr "Crédit" @@ -204,7 +226,7 @@ msgstr "Cur Débit" msgid "Current value" msgstr "Valeur courante" -#: src/view/grid/GridAccount.cpp:67 +#: src/view/grid/GridAccount.cpp:68 msgid "Date" msgstr "Date" @@ -216,7 +238,7 @@ msgstr "Date min" msgid "Date to" msgstr "Date max" -#: src/view/grid/GridAccount.cpp:67 +#: src/view/grid/GridAccount.cpp:68 msgid "Debit" msgstr "Débit" @@ -235,7 +257,7 @@ msgid "Descending" msgstr "Décroissant" #: src/view/SearchPanel.cpp:94 -#: src/view/grid/GridAccount.cpp:67 +#: src/view/grid/GridAccount.cpp:68 msgid "Description" msgstr "Description" @@ -259,10 +281,10 @@ msgstr "Nouvelle description" #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 #: src/view/AccountPanel.cpp:843 -#: src/view/grid/GridAccount.cpp:1271 -#: src/view/grid/GridAccount.cpp:1278 -#: src/view/grid/GridAccount.cpp:1397 -#: src/view/grid/GridAccount.cpp:1403 +#: src/view/grid/GridAccount.cpp:1288 +#: src/view/grid/GridAccount.cpp:1295 +#: src/view/grid/GridAccount.cpp:1414 +#: src/view/grid/GridAccount.cpp:1420 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 #: src/model/Database.cpp:45 #: src/model/Database.cpp:52 @@ -280,13 +302,17 @@ msgstr "Erreur" msgid "Error creating original database" msgstr "Erreur durant la création de la base de données initiale" +#: src/view/ImportPanel.cpp:71 +msgid "File account" +msgstr "Compte du fichier" + #: src/view/AccountPanel.cpp:111 msgid "Final value" msgstr "Valeur finale" #: src/view/SearchPanel.cpp:84 -#: src/view/grid/GridAccount.cpp:329 -#: src/controller/KissCount.cpp:361 +#: src/view/grid/GridAccount.cpp:345 +#: src/controller/KissCount.cpp:355 msgid "Fix" msgstr "Fixe" @@ -311,7 +337,7 @@ msgstr "A partir de " msgid "Generate month" msgstr "Générer mois" -#: src/controller/KissCount.cpp:361 +#: src/controller/KissCount.cpp:355 msgid "Groceries" msgstr "Courses" @@ -319,14 +345,22 @@ msgstr "Courses" msgid "Group" msgstr "Grouper" -#: src/controller/KissCount.cpp:361 +#: src/controller/KissCount.cpp:355 msgid "Hobbies" msgstr "Loisirs" +#: src/view/ImportPanel.cpp:107 +msgid "Import" +msgstr "Import" + #: src/view/AccountPanel.cpp:109 msgid "Initial value" msgstr "Valeur initiale" +#: src/view/ImportPanel.cpp:72 +msgid "Internal account" +msgstr "Compte interne" + #: src/view/SearchPanel.cpp:189 msgid "Invalid amount from" msgstr "Montant min invalide" @@ -378,10 +412,14 @@ msgstr "Kill me" #: src/view/StatsPanel.cpp:377 #: src/view/PreferencesPanel.cpp:823 #: src/view/PreferencesPanel.cpp:826 -#: src/model/Database_Update.cpp:135 +#: src/model/Database_Update.cpp:140 msgid "KissCount" msgstr "KissCount" +#: src/view/ImportPanel.cpp:112 +msgid "KissCount - Import" +msgstr "KissCount - Import" + #: src/view/PreferencesPanel.cpp:62 msgid "Language" msgstr "Langue" @@ -429,6 +467,10 @@ msgstr "" msgid "No entry found" msgstr "Pas d'entrée trouvée" +#: src/view/ImportPanel.cpp:267 +msgid "No operation found into this file" +msgstr "Aucun opération trouvée dans ce fichier" + #: src/view/SearchPanel.cpp:84 msgid "Non fix" msgstr "Courantes" @@ -448,6 +490,10 @@ msgstr "Non rapprochée" msgid "Number" msgstr "Numéro de compte" +#: src/model/import/OFXImportEngine.cpp:124 +msgid "OFX files (*.ofx)|*.ofx" +msgstr "Fichiers OFX (*.ofx)|*.ofx" + #: src/view/UsersDialog.cpp:51 #: src/view/GenerateDialog.cpp:60 #: src/view/PasswordDialog.cpp:55 @@ -458,7 +504,7 @@ msgstr "OK" msgid "Old password " msgstr "Ancien mot de passe " -#: src/controller/KissCount.cpp:361 +#: src/controller/KissCount.cpp:355 msgid "Operating expense" msgstr "Fonctionnement" @@ -471,7 +517,11 @@ msgstr "Ordre des opérations" msgid "Operations" msgstr "Opérations" -#: src/controller/KissCount.cpp:362 +#: src/view/ImportPanel.cpp:292 +msgid "Operations successfully imported" +msgstr "les opérations ont été importées avec succès" + +#: src/controller/KissCount.cpp:356 msgid "Other" msgstr "Autres" @@ -483,7 +533,7 @@ msgstr "Mot de passe " msgid "Password changed" msgstr "Mot de passe changé" -#: src/view/wxUI.cpp:247 +#: src/view/wxUI.cpp:248 msgid "" "Personal accounting software\n" "\n" @@ -511,7 +561,7 @@ msgstr "Re entrez le mot de passe" msgid "Preferences" msgstr "Préférences" -#: src/view/wxUI.cpp:254 +#: src/view/wxUI.cpp:255 msgid "Quit KissCount ?" msgstr "Quitter KissCount ?" @@ -579,7 +629,7 @@ msgstr "Impossible de créer " msgid "Unable to open Database" msgstr "Impossible d'ouvrir la base de données" -#: src/controller/KissCount.cpp:362 +#: src/controller/KissCount.cpp:356 msgid "Unexpected" msgstr "Exceptionnel" @@ -591,6 +641,10 @@ msgstr "Exceptionnel" msgid "Unknown" msgstr "Inconnu" +#: src/view/ImportPanel.cpp:41 +msgid "Unresolved accounts" +msgstr "Comptes non résolus" + #: src/view/PreferencesPanel.cpp:59 msgid "User" msgstr "Utilisateur" @@ -610,7 +664,7 @@ msgstr "Utilisateurs" msgid "Virtual" msgstr "Virtuel" -#: src/view/grid/GridAccount.cpp:1048 +#: src/view/grid/GridAccount.cpp:1065 msgid "Warning" msgstr "Attention" @@ -622,7 +676,7 @@ msgstr "Quel compte va remplacer celui-ci ?" msgid "Wich category will replace this one ?" msgstr "Quelle catégorie va remplacer celle-ci" -#: src/view/grid/GridAccount.cpp:1048 +#: src/view/grid/GridAccount.cpp:1065 msgid "You made a debit on a blocked account" msgstr "Vous avez effectué une opération de débit sur un compte bloqué" diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index edc14d7..0e3490f 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-20 12:04+0100\n" +"POT-Creation-Date: 2011-03-24 19:19+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,6 +21,10 @@ msgstr "" msgid " - " msgstr "" +#: src/view/ImportPanel.cpp:222 +msgid " account(s) will be created, is it ok ?" +msgstr "" + #: src/view/UsersDialog.cpp:120 src/view/PreferencesPanel.cpp:495 #: src/view/PreferencesPanel.cpp:515 src/view/PreferencesPanel.cpp:726 #: src/view/PreferencesPanel.cpp:745 src/view/PreferencesPanel.cpp:789 @@ -51,7 +55,7 @@ msgstr "" msgid "1 entry found" msgstr "" -#: src/view/SearchPanel.cpp:99 src/view/grid/GridAccount.cpp:67 +#: src/view/SearchPanel.cpp:99 src/view/grid/GridAccount.cpp:68 msgid "Account" msgstr "" @@ -59,7 +63,7 @@ msgstr "" msgid "Account " msgstr "" -#: src/controller/KissCount.cpp:370 +#: src/controller/KissCount.cpp:364 msgid "Account 1" msgstr "" @@ -83,14 +87,22 @@ msgstr "" msgid "Amount to" msgstr "" +#: src/view/ImportPanel.cpp:156 +msgid "Any engine can process this file !" +msgstr "" + #: src/view/PreferencesPanel.cpp:838 src/view/AccountPanel.cpp:847 msgid "Are you sure want to delete " msgstr "" -#: src/view/grid/GridAccount.cpp:836 +#: src/view/grid/GridAccount.cpp:853 msgid "Are you sure want to delete : \n" msgstr "" +#: src/view/ImportPanel.cpp:277 +msgid "Are you sure want to integrate these operations ?" +msgstr "" + #: src/view/PreferencesPanel.cpp:368 msgid "Ascending" msgstr "" @@ -108,11 +120,11 @@ msgstr "" msgid "Cancel" msgstr "" -#: src/view/grid/GridAccount.cpp:1271 src/view/grid/GridAccount.cpp:1278 +#: src/view/grid/GridAccount.cpp:1288 src/view/grid/GridAccount.cpp:1295 msgid "Cannot group these operations" msgstr "" -#: src/view/grid/GridAccount.cpp:1397 src/view/grid/GridAccount.cpp:1403 +#: src/view/grid/GridAccount.cpp:1414 src/view/grid/GridAccount.cpp:1420 msgid "Cannot ungroup these operations" msgstr "" @@ -120,7 +132,7 @@ msgstr "" msgid "Categories" msgstr "" -#: src/view/SearchPanel.cpp:97 src/view/grid/GridAccount.cpp:67 +#: src/view/SearchPanel.cpp:97 src/view/grid/GridAccount.cpp:68 msgid "Category" msgstr "" @@ -156,6 +168,10 @@ msgstr "" msgid "Checked" msgstr "" +#: src/view/ImportPanel.cpp:117 +msgid "Choose a database to open" +msgstr "" + #: src/view/SearchPanel.cpp:309 msgid "Choose a new account" msgstr "" @@ -172,7 +188,12 @@ msgstr "" msgid "Cost repartition" msgstr "" -#: src/view/grid/GridAccount.cpp:67 +#: src/view/ImportPanel.cpp:168 src/view/ImportPanel.cpp:215 +#: src/view/ImportPanel.cpp:230 +msgid "Create one" +msgstr "" + +#: src/view/grid/GridAccount.cpp:68 msgid "Credit" msgstr "" @@ -188,7 +209,7 @@ msgstr "" msgid "Current value" msgstr "" -#: src/view/grid/GridAccount.cpp:67 +#: src/view/grid/GridAccount.cpp:68 msgid "Date" msgstr "" @@ -200,7 +221,7 @@ msgstr "" msgid "Date to" msgstr "" -#: src/view/grid/GridAccount.cpp:67 +#: src/view/grid/GridAccount.cpp:68 msgid "Debit" msgstr "" @@ -217,7 +238,7 @@ msgstr "" msgid "Descending" msgstr "" -#: src/view/SearchPanel.cpp:94 src/view/grid/GridAccount.cpp:67 +#: src/view/SearchPanel.cpp:94 src/view/grid/GridAccount.cpp:68 msgid "Description" msgstr "" @@ -233,8 +254,8 @@ msgstr "" #: src/view/PreferencesPanel.cpp:745 src/view/PreferencesPanel.cpp:783 #: src/view/PreferencesPanel.cpp:789 src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:843 -#: src/view/grid/GridAccount.cpp:1271 src/view/grid/GridAccount.cpp:1278 -#: src/view/grid/GridAccount.cpp:1397 src/view/grid/GridAccount.cpp:1403 +#: src/view/grid/GridAccount.cpp:1288 src/view/grid/GridAccount.cpp:1295 +#: src/view/grid/GridAccount.cpp:1414 src/view/grid/GridAccount.cpp:1420 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:45 #: src/model/Database.cpp:52 src/model/Database.cpp:70 #: src/model/Database.cpp:103 src/model/Database.cpp:109 @@ -247,12 +268,16 @@ msgstr "" msgid "Error creating original database" msgstr "" +#: src/view/ImportPanel.cpp:71 +msgid "File account" +msgstr "" + #: src/view/AccountPanel.cpp:111 msgid "Final value" msgstr "" -#: src/view/SearchPanel.cpp:84 src/view/grid/GridAccount.cpp:329 -#: src/controller/KissCount.cpp:361 +#: src/view/SearchPanel.cpp:84 src/view/grid/GridAccount.cpp:345 +#: src/controller/KissCount.cpp:355 msgid "Fix" msgstr "" @@ -276,7 +301,7 @@ msgstr "" msgid "Generate month" msgstr "" -#: src/controller/KissCount.cpp:361 +#: src/controller/KissCount.cpp:355 msgid "Groceries" msgstr "" @@ -284,14 +309,22 @@ msgstr "" msgid "Group" msgstr "" -#: src/controller/KissCount.cpp:361 +#: src/controller/KissCount.cpp:355 msgid "Hobbies" msgstr "" +#: src/view/ImportPanel.cpp:107 +msgid "Import" +msgstr "" + #: src/view/AccountPanel.cpp:109 msgid "Initial value" msgstr "" +#: src/view/ImportPanel.cpp:72 +msgid "Internal account" +msgstr "" + #: src/view/SearchPanel.cpp:189 msgid "Invalid amount from" msgstr "" @@ -341,10 +374,14 @@ msgid "Kill me" msgstr "" #: src/view/StatsPanel.cpp:377 src/view/PreferencesPanel.cpp:823 -#: src/view/PreferencesPanel.cpp:826 src/model/Database_Update.cpp:135 +#: src/view/PreferencesPanel.cpp:826 src/model/Database_Update.cpp:140 msgid "KissCount" msgstr "" +#: src/view/ImportPanel.cpp:112 +msgid "KissCount - Import" +msgstr "" + #: src/view/PreferencesPanel.cpp:62 msgid "Language" msgstr "" @@ -388,6 +425,10 @@ msgstr "" msgid "No entry found" msgstr "" +#: src/view/ImportPanel.cpp:267 +msgid "No operation found into this file" +msgstr "" + #: src/view/SearchPanel.cpp:84 msgid "Non fix" msgstr "" @@ -405,6 +446,10 @@ msgstr "" msgid "Number" msgstr "" +#: src/model/import/OFXImportEngine.cpp:124 +msgid "OFX files (*.ofx)|*.ofx" +msgstr "" + #: src/view/UsersDialog.cpp:51 src/view/GenerateDialog.cpp:60 #: src/view/PasswordDialog.cpp:55 msgid "OK" @@ -414,7 +459,7 @@ msgstr "" msgid "Old password " msgstr "" -#: src/controller/KissCount.cpp:361 +#: src/controller/KissCount.cpp:355 msgid "Operating expense" msgstr "" @@ -426,7 +471,11 @@ msgstr "" msgid "Operations" msgstr "" -#: src/controller/KissCount.cpp:362 +#: src/view/ImportPanel.cpp:292 +msgid "Operations successfully imported" +msgstr "" + +#: src/controller/KissCount.cpp:356 msgid "Other" msgstr "" @@ -438,7 +487,7 @@ msgstr "" msgid "Password changed" msgstr "" -#: src/view/wxUI.cpp:247 +#: src/view/wxUI.cpp:248 msgid "" "Personal accounting software\n" "\n" @@ -458,7 +507,7 @@ msgstr "" msgid "Preferences" msgstr "" -#: src/view/wxUI.cpp:254 +#: src/view/wxUI.cpp:255 msgid "Quit KissCount ?" msgstr "" @@ -520,7 +569,7 @@ msgstr "" msgid "Unable to open Database" msgstr "" -#: src/controller/KissCount.cpp:362 +#: src/controller/KissCount.cpp:356 msgid "Unexpected" msgstr "" @@ -529,6 +578,10 @@ msgstr "" msgid "Unknown" msgstr "" +#: src/view/ImportPanel.cpp:41 +msgid "Unresolved accounts" +msgstr "" + #: src/view/PreferencesPanel.cpp:59 msgid "User" msgstr "" @@ -546,7 +599,7 @@ msgstr "" msgid "Virtual" msgstr "" -#: src/view/grid/GridAccount.cpp:1048 +#: src/view/grid/GridAccount.cpp:1065 msgid "Warning" msgstr "" @@ -558,7 +611,7 @@ msgstr "" msgid "Wich category will replace this one ?" msgstr "" -#: src/view/grid/GridAccount.cpp:1048 +#: src/view/grid/GridAccount.cpp:1065 msgid "You made a debit on a blocked account" msgstr "" From d0b537d6c9b235b9c506582d64e8009a9b938d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Fri, 25 Mar 2011 19:36:21 +0100 Subject: [PATCH 51/72] Fix a bug : Search for previous operation failed --- src/view/grid/GridAccount.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index f65c1ce..34c65b6 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -733,6 +733,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) !GetCellValue(row, ACCOUNT).Length() || !_canAddOperation)) { + new_op.fix_cost = (row <= _fixCosts); if (_kiss->SearchPreviousOperation(&op_tmp, new_op, new_op.month, new_op.year, _canAddOperation)) { new_op.category = op_tmp.category; From d6ade299e3cabaf26d493196d032e75c02166748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 3 Apr 2011 19:11:34 +0200 Subject: [PATCH 52/72] Display virtual accounts at the end Fix a bug in LonkOrUnlinkOperation (when year was not previously loaded) Translate categories in PreferencesPanel --- src/model/Database.cpp | 4 ++-- src/model/User.cpp | 6 ++++++ src/view/PreferencesPanel.cpp | 3 ++- src/view/SearchPanel.cpp | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 735ba5f..3535a47 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -230,7 +230,7 @@ User* Database::LoadUser(const wxString& name) set.Finalize(); - req = wxT("SELECT * FROM account WHERE user='") + user->_id + wxT("' ORDER BY default_account DESC, blocked, virtual, name ASC"); + req = wxT("SELECT * FROM account WHERE user='") + user->_id + wxT("' ORDER BY default_account DESC, virtual, blocked, name ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); @@ -248,7 +248,7 @@ User* Database::LoadUser(const wxString& name) } set.Finalize(); - req = wxT("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='") + user->_id + wxT("') ORDER BY blocked, virtual, name ASC"); + req = wxT("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='") + user->_id + wxT("') ORDER BY name, blocked, virtual ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); diff --git a/src/model/User.cpp b/src/model/User.cpp index 5299bb1..1b6110f 100644 --- a/src/model/User.cpp +++ b/src/model/User.cpp @@ -170,6 +170,12 @@ void User::LinkOrUnlinkOperation(Operation& op) std::vector::iterator it; Account account, account2; + if (!_operations[op.year]) + _db->LoadYear(this, op.year); + + if (!_operations[op.year]) + return; + // Not Linked if (!op.transfert.Length()) { diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 3ee4c5b..3e97df8 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -232,6 +232,7 @@ void PreferencesPanel::AddAccount(int line, Account ac) _accountsGrid->SetCellRenderer(line, ACCOUNT_DELETE, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellEditor(line, ACCOUNT_DELETE, new wxGridCellBoolEditor ()); _accountsGrid->SetCellValue(line, ACCOUNT_DEFAULT, (ac._default)?wxT("1"):wxT("0")); + _accountsGrid->SetCellValue(line, ACCOUNT_VIRTUAL, (ac._virtual)?wxT("1"):wxT("0")); _accountsGrid->SetCellValue(line, ACCOUNT_BLOCKED, (ac.blocked)?wxT("1"):wxT("0")); _accountsGrid->SetCellAlignment(line, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE); @@ -702,7 +703,7 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) a = 0; for(i=0; i < user->GetCategoriesNumber(); i++) if (user->_categories[i].id != new_cat.id) - categories[++a] = user->_categories[i].name; + categories[++a] = wxGetTranslation(user->_categories[i].name); wxSingleChoiceDialog dialog(_wxUI, _("Wich category will replace this one ?"), wxT("KissCount"), user->GetCategoriesNumber(), categories); if (dialog.ShowModal() == wxID_CANCEL) { diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index ba20a76..dde8494 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -346,7 +346,7 @@ void SearchPanel::OnButtonChangeCategory(wxCommandEvent& event) categories[0] = _("None"); a = 0; for(i=0; i < user->GetCategoriesNumber(); i++) - categories[++a] = user->_categories[i].name; + categories[++a] = wxGetTranslation(user->_categories[i].name); wxSingleChoiceDialog dialog(_wxUI, _("Choose a new category"), wxT("KissCount"), user->GetCategoriesNumber()+1, categories); From 0e93b41bc799bb37014b2667be407de639223199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 9 Apr 2011 19:07:00 +0200 Subject: [PATCH 53/72] Update Kisscount.pot --- ressources/po/kisscount.pot | 80 ++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 0e3490f..b945f85 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-03-24 19:19+0100\n" +"POT-Creation-Date: 2011-04-03 19:13+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/view/StatsPanel.cpp:358 src/view/PreferencesPanel.cpp:831 +#: src/view/StatsPanel.cpp:358 src/view/PreferencesPanel.cpp:832 msgid " - " msgstr "" @@ -25,9 +25,9 @@ msgstr "" msgid " account(s) will be created, is it ok ?" msgstr "" -#: src/view/UsersDialog.cpp:120 src/view/PreferencesPanel.cpp:495 -#: src/view/PreferencesPanel.cpp:515 src/view/PreferencesPanel.cpp:726 -#: src/view/PreferencesPanel.cpp:745 src/view/PreferencesPanel.cpp:789 +#: src/view/UsersDialog.cpp:120 src/view/PreferencesPanel.cpp:496 +#: src/view/PreferencesPanel.cpp:516 src/view/PreferencesPanel.cpp:727 +#: src/view/PreferencesPanel.cpp:746 src/view/PreferencesPanel.cpp:790 msgid " already exists" msgstr "" @@ -43,7 +43,7 @@ msgstr "" msgid " operations ?" msgstr "" -#: src/view/PreferencesPanel.cpp:838 +#: src/view/PreferencesPanel.cpp:839 msgid " profil ?" msgstr "" @@ -59,7 +59,7 @@ msgstr "" msgid "Account" msgstr "" -#: src/view/PreferencesPanel.cpp:495 src/view/PreferencesPanel.cpp:515 +#: src/view/PreferencesPanel.cpp:496 src/view/PreferencesPanel.cpp:516 msgid "Account " msgstr "" @@ -91,11 +91,11 @@ msgstr "" msgid "Any engine can process this file !" msgstr "" -#: src/view/PreferencesPanel.cpp:838 src/view/AccountPanel.cpp:847 +#: src/view/PreferencesPanel.cpp:839 src/view/AccountPanel.cpp:847 msgid "Are you sure want to delete " msgstr "" -#: src/view/grid/GridAccount.cpp:853 +#: src/view/grid/GridAccount.cpp:854 msgid "Are you sure want to delete : \n" msgstr "" @@ -103,11 +103,11 @@ msgstr "" msgid "Are you sure want to integrate these operations ?" msgstr "" -#: src/view/PreferencesPanel.cpp:368 +#: src/view/PreferencesPanel.cpp:369 msgid "Ascending" msgstr "" -#: src/view/PreferencesPanel.cpp:292 +#: src/view/PreferencesPanel.cpp:293 msgid "Background color" msgstr "" @@ -120,11 +120,11 @@ msgstr "" msgid "Cancel" msgstr "" -#: src/view/grid/GridAccount.cpp:1288 src/view/grid/GridAccount.cpp:1295 +#: src/view/grid/GridAccount.cpp:1289 src/view/grid/GridAccount.cpp:1296 msgid "Cannot group these operations" msgstr "" -#: src/view/grid/GridAccount.cpp:1414 src/view/grid/GridAccount.cpp:1420 +#: src/view/grid/GridAccount.cpp:1415 src/view/grid/GridAccount.cpp:1421 msgid "Cannot ungroup these operations" msgstr "" @@ -136,7 +136,7 @@ msgstr "" msgid "Category" msgstr "" -#: src/view/PreferencesPanel.cpp:726 src/view/PreferencesPanel.cpp:745 +#: src/view/PreferencesPanel.cpp:727 src/view/PreferencesPanel.cpp:746 msgid "Category " msgstr "" @@ -229,12 +229,12 @@ msgstr "" msgid "Default" msgstr "" -#: src/view/PreferencesPanel.cpp:201 src/view/PreferencesPanel.cpp:295 +#: src/view/PreferencesPanel.cpp:201 src/view/PreferencesPanel.cpp:296 #: src/view/AccountPanel.cpp:706 msgid "Delete" msgstr "" -#: src/view/PreferencesPanel.cpp:369 +#: src/view/PreferencesPanel.cpp:370 msgid "Descending" msgstr "" @@ -249,13 +249,13 @@ msgstr "" #: src/view/UsersDialog.cpp:90 src/view/UsersDialog.cpp:120 #: src/view/SearchPanel.cpp:179 src/view/SearchPanel.cpp:189 #: src/view/SearchPanel.cpp:203 src/view/SearchPanel.cpp:214 -#: src/view/PreferencesPanel.cpp:435 src/view/PreferencesPanel.cpp:495 -#: src/view/PreferencesPanel.cpp:515 src/view/PreferencesPanel.cpp:726 -#: src/view/PreferencesPanel.cpp:745 src/view/PreferencesPanel.cpp:783 -#: src/view/PreferencesPanel.cpp:789 src/view/PasswordDialog.cpp:72 +#: src/view/PreferencesPanel.cpp:436 src/view/PreferencesPanel.cpp:496 +#: src/view/PreferencesPanel.cpp:516 src/view/PreferencesPanel.cpp:727 +#: src/view/PreferencesPanel.cpp:746 src/view/PreferencesPanel.cpp:784 +#: src/view/PreferencesPanel.cpp:790 src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:843 -#: src/view/grid/GridAccount.cpp:1288 src/view/grid/GridAccount.cpp:1295 -#: src/view/grid/GridAccount.cpp:1414 src/view/grid/GridAccount.cpp:1420 +#: src/view/grid/GridAccount.cpp:1289 src/view/grid/GridAccount.cpp:1296 +#: src/view/grid/GridAccount.cpp:1415 src/view/grid/GridAccount.cpp:1421 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:45 #: src/model/Database.cpp:52 src/model/Database.cpp:70 #: src/model/Database.cpp:103 src/model/Database.cpp:109 @@ -281,11 +281,11 @@ msgstr "" msgid "Fix" msgstr "" -#: src/view/PreferencesPanel.cpp:294 +#: src/view/PreferencesPanel.cpp:295 msgid "Font" msgstr "" -#: src/view/PreferencesPanel.cpp:293 +#: src/view/PreferencesPanel.cpp:294 msgid "Foreground color" msgstr "" @@ -345,7 +345,7 @@ msgstr "" msgid "Invalid formula !" msgstr "" -#: src/view/PreferencesPanel.cpp:783 +#: src/view/PreferencesPanel.cpp:784 msgid "Invalid name" msgstr "" @@ -361,7 +361,7 @@ msgstr "" msgid "Invalide date range" msgstr "" -#: src/view/PreferencesPanel.cpp:435 +#: src/view/PreferencesPanel.cpp:436 msgid "It must be at least one account !" msgstr "" @@ -373,8 +373,8 @@ msgstr "" msgid "Kill me" msgstr "" -#: src/view/StatsPanel.cpp:377 src/view/PreferencesPanel.cpp:823 -#: src/view/PreferencesPanel.cpp:826 src/model/Database_Update.cpp:140 +#: src/view/StatsPanel.cpp:377 src/view/PreferencesPanel.cpp:824 +#: src/view/PreferencesPanel.cpp:827 src/model/Database_Update.cpp:140 msgid "KissCount" msgstr "" @@ -386,11 +386,11 @@ msgstr "" msgid "Language" msgstr "" -#: src/view/PreferencesPanel.cpp:826 +#: src/view/PreferencesPanel.cpp:827 msgid "Language not changed" msgstr "" -#: src/view/PreferencesPanel.cpp:823 +#: src/view/PreferencesPanel.cpp:824 msgid "Language successfully changed, please go to another panel" msgstr "" @@ -399,11 +399,11 @@ msgid "Mode" msgstr "" #: src/view/PreferencesPanel.cpp:72 src/view/PreferencesPanel.cpp:196 -#: src/view/PreferencesPanel.cpp:291 +#: src/view/PreferencesPanel.cpp:292 msgid "Name" msgstr "" -#: src/view/PreferencesPanel.cpp:795 +#: src/view/PreferencesPanel.cpp:796 msgid "Name changed" msgstr "" @@ -434,7 +434,7 @@ msgid "Non fix" msgstr "" #: src/view/SearchPanel.cpp:304 src/view/SearchPanel.cpp:346 -#: src/view/PreferencesPanel.cpp:440 src/view/PreferencesPanel.cpp:701 +#: src/view/PreferencesPanel.cpp:441 src/view/PreferencesPanel.cpp:702 msgid "None" msgstr "" @@ -502,8 +502,8 @@ msgstr "" msgid "Please retype new password" msgstr "" -#: src/view/PreferencesPanel.cpp:184 src/view/PreferencesPanel.cpp:797 -#: src/view/PreferencesPanel.cpp:831 +#: src/view/PreferencesPanel.cpp:184 src/view/PreferencesPanel.cpp:798 +#: src/view/PreferencesPanel.cpp:832 msgid "Preferences" msgstr "" @@ -587,7 +587,7 @@ msgid "User" msgstr "" #: src/view/UsersDialog.cpp:39 src/view/UsersDialog.cpp:120 -#: src/view/PreferencesPanel.cpp:789 +#: src/view/PreferencesPanel.cpp:790 msgid "User " msgstr "" @@ -599,19 +599,19 @@ msgstr "" msgid "Virtual" msgstr "" -#: src/view/grid/GridAccount.cpp:1065 +#: src/view/grid/GridAccount.cpp:1066 msgid "Warning" msgstr "" -#: src/view/PreferencesPanel.cpp:445 +#: src/view/PreferencesPanel.cpp:446 msgid "Wich account will replace this one ?" msgstr "" -#: src/view/PreferencesPanel.cpp:706 +#: src/view/PreferencesPanel.cpp:707 msgid "Wich category will replace this one ?" msgstr "" -#: src/view/grid/GridAccount.cpp:1065 +#: src/view/grid/GridAccount.cpp:1066 msgid "You made a debit on a blocked account" msgstr "" From 7533319ad491fe85ae7eef37a378412e76410668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 9 Apr 2011 19:22:32 +0200 Subject: [PATCH 54/72] Add EnterPressed handled in UserDialog and Search (for description) --- src/view/SearchPanel.cpp | 11 +++++++++-- src/view/SearchPanel.h | 1 + src/view/UsersDialog.cpp | 17 +++++++++++------ src/view/UsersDialog.h | 1 + 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index dde8494..5753b2f 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -19,7 +19,7 @@ #include "AccountPanel.h" -enum {SEARCH_ID, GRID_ID, CALENDAR_FROM_ID, CALENDAR_TO_ID, +enum {DESCRIPTION_ID=1, SEARCH_ID, GRID_ID, CALENDAR_FROM_ID, CALENDAR_TO_ID, CHANGE_ACCOUNT_ID, CHANGE_CATEGORY_ID, RENAME_ID}; BEGIN_EVENT_TABLE(SearchPanel, wxPanel) @@ -31,6 +31,7 @@ EVT_BUTTON(CHANGE_ACCOUNT_ID, SearchPanel::OnButtonChangeAccount) EVT_BUTTON(CHANGE_CATEGORY_ID, SearchPanel::OnButtonChangeCategory) EVT_BUTTON(RENAME_ID, SearchPanel::OnButtonRename) EVT_SHOW(SearchPanel::OnShow) +EVT_TEXT_ENTER(DESCRIPTION_ID, SearchPanel::OnEnter) END_EVENT_TABLE() #define UNESCAPE_CHARS(s) { \ @@ -69,7 +70,8 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent wxCAL_MONDAY_FIRST); - _description = new wxTextCtrl(this, wxID_ANY); + _description = new wxTextCtrl(this, DESCRIPTION_ID); + _description->SetWindowStyle(_description->GetWindowStyle() | wxTE_PROCESS_ENTER); wxSize size = _description->GetSize(); size.SetWidth(size.GetWidth()*2); _description->SetMinSize(size); @@ -261,6 +263,11 @@ void SearchPanel::Search() _operations = _kiss->Search(description, dateFrom, dateTo, amountFrom, amountTo, categories,types, accounts); } +void SearchPanel::OnEnter(wxCommandEvent& event) +{ + OnButtonSearch(event); +} + void SearchPanel::OnButtonSearch(wxCommandEvent& event) { Search(); diff --git a/src/view/SearchPanel.h b/src/view/SearchPanel.h index 07bff94..ce80751 100644 --- a/src/view/SearchPanel.h +++ b/src/view/SearchPanel.h @@ -45,6 +45,7 @@ public: wxString GetToolTip(); void OnShow(wxShowEvent& event); + void OnEnter(wxCommandEvent& event); void OnButtonSearch(wxCommandEvent& event); void OnOperationModified(wxGridEvent& event); void OnCalendarFromChange(wxCalendarEvent& event); diff --git a/src/view/UsersDialog.cpp b/src/view/UsersDialog.cpp index fcb846b..5a43486 100644 --- a/src/view/UsersDialog.cpp +++ b/src/view/UsersDialog.cpp @@ -19,12 +19,13 @@ #include "UsersDialog.h" -enum {BUTTON_OK_ID=1, BUTTON_CANCEL_ID, BUTTON_NEW_USER_ID}; +enum {TEXT_PASSWORD_ID=1, BUTTON_OK_ID, BUTTON_CANCEL_ID, BUTTON_NEW_USER_ID}; BEGIN_EVENT_TABLE(UsersDialog, wxDialog) EVT_BUTTON(BUTTON_OK_ID, UsersDialog::OnOK) EVT_BUTTON(BUTTON_CANCEL_ID, UsersDialog::OnCancel) EVT_BUTTON(BUTTON_NEW_USER_ID, UsersDialog::OnNewUser) +EVT_TEXT_ENTER(TEXT_PASSWORD_ID, UsersDialog::OnEnter) END_EVENT_TABLE() UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), -1, _("Users")), _kiss(kiss), _wxUI(parent) @@ -36,18 +37,17 @@ UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), - wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); gridBagSizer = new wxGridBagSizer(4, 4); - label = new wxStaticText(this, -1, _("User ")); + label = new wxStaticText(this, wxID_ANY, _("User ")); gridBagSizer->Add(label, wxGBPosition(0, 0)); _users = new wxChoice(this, wxID_ANY); gridBagSizer->Add(_users, wxGBPosition(0, 1)); - label = new wxStaticText(this, -1, _("Password ")); + label = new wxStaticText(this, wxID_ANY, _("Password ")); gridBagSizer->Add(label, wxGBPosition(1, 0)); - _password = new wxTextCtrl(this, wxID_ANY); + _password = new wxTextCtrl(this, TEXT_PASSWORD_ID); + _password->SetWindowStyle(_password->GetWindowStyle() | wxTE_PASSWORD | wxTE_PROCESS_ENTER); gridBagSizer->Add(_password, wxGBPosition(1, 1)); - _password->SetWindowStyle(wxTE_PASSWORD); - wxButton* ok = new wxButton(this, BUTTON_OK_ID, _("OK")); wxButton* cancel = new wxButton(this, BUTTON_CANCEL_ID, _("Cancel")); wxButton* newUser = new wxButton(this, BUTTON_NEW_USER_ID, _("New User")); @@ -77,6 +77,11 @@ UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), - ShowModal(); } +void UsersDialog::OnEnter(wxCommandEvent& event) +{ + OnOK(event); +} + void UsersDialog::OnOK(wxCommandEvent& event) { // No users in database diff --git a/src/view/UsersDialog.h b/src/view/UsersDialog.h index 86ed765..d753628 100644 --- a/src/view/UsersDialog.h +++ b/src/view/UsersDialog.h @@ -37,6 +37,7 @@ class UsersDialog : public wxDialog public: UsersDialog(KissCount* kiss, wxUI *parent); + void OnEnter(wxCommandEvent& event); void OnOK(wxCommandEvent& event); void OnCancel(wxCommandEvent& event); void OnNewUser(wxCommandEvent& event); From 1fd9c7358734685b6acee2df0c772041c08ab08a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 23 Apr 2011 20:16:31 +0200 Subject: [PATCH 55/72] Add Grisbi import (need to work on categories) --- Makefile | 2 + debian/control | 2 +- src/model/import/GrisbiImportEngine.cpp | 193 ++++++++++++++++++++++++ src/model/import/GrisbiImportEngine.h | 45 ++++++ src/model/import/ImportEngine.h | 2 + src/model/import/OFXImportEngine.cpp | 2 +- 6 files changed, 244 insertions(+), 2 deletions(-) create mode 100644 src/model/import/GrisbiImportEngine.cpp create mode 100644 src/model/import/GrisbiImportEngine.h diff --git a/Makefile b/Makefile index 52ae73f..899d264 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ BIN_DIR=$(DESTDIR)"/usr/bin/" CXXFLAGS+=`wx-config --cxxflags` -Wall -Isrc -ggdb CXXFLAGS+=-I./lib/wxsqlite3-1.9.9/include CXXFLAGS+=-I./lib/freechart/include +CXXFLAGS+=-I/usr/include/libxml2 CXXFLAGS+=-Wl,--rpath,"$(LIB_DIR)" #CXXFLAGS+=-DRESSOURCES_ROOT="\"$(SHARE_DIR)\"" # For developpers @@ -13,6 +14,7 @@ CXXFLAGS+=-DRESSOURCES_ROOT="\"./ressources/\"" LDFLAGS+=`wx-config --libs` LDFLAGS+=-lofx +LDFLAGS+=-lxml2 ifdef WIN32 LDFLAGS+=-L./lib/wxsqlite3-1.9.9/lib/ -lwxcode_msw_wxsqlite3-2.8 diff --git a/debian/control b/debian/control index 0e8763c..9f5440a 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: kisscount Section: misc Priority: extra Maintainer: Grégory Soutadé -Build-Depends: debhelper (>= 7.0.50~), libsqlite3-dev, libwxgtk2.8-dev (>= 2.8.10), libofx-dev +Build-Depends: debhelper (>= 7.0.50~), libsqlite3-dev, libwxgtk2.8-dev (>= 2.8.10), libofx-dev, libxml2-dev Standards-Version: 3.9.1 Homepage: http://indefero.soutade.fr/p/kisscount/ Vcs-Git: git://soutade.fr/kisscount.git diff --git a/src/model/import/GrisbiImportEngine.cpp b/src/model/import/GrisbiImportEngine.cpp new file mode 100644 index 0000000..dcd2b2d --- /dev/null +++ b/src/model/import/GrisbiImportEngine.cpp @@ -0,0 +1,193 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "GrisbiImportEngine.h" + +static GrisbiImportEngine grisbiImportEngine; + +void GrisbiImportEngine::LoadAccount(GrisbiImportEngine* _this, const char** attrs) +{ + int i; + wxString account_number, name, id, key; + + for (i=0; attrs[i]; i+=2) + { + if (!strcmp(attrs[i], "Name")) + name = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "Number")) + id = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "Bank_account_number")) + account_number = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "Key")) + key = wxString(attrs[i+1], wxConvUTF8); + } + + account_number += key; + + for (i=0; i<(int)_this->_user->_accounts.size(); i++) + { + if (_this->_user->_accounts[i].number == account_number) + { + _this->_accounts[id] = _this->_user->_accounts[i].id; + return; + } + } + + _this->_accounts[id] = wxT("unknown-") + account_number; + _this->_unresolvedAccounts.push_back(account_number); +} + +void GrisbiImportEngine::LoadCategory(GrisbiImportEngine* _this, const char** attrs) +{ + wxString name, id; + int i; + + for (i=0; attrs[i]; i+=2) + { + if (!strcmp(attrs[i], "Na")) + name = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "Nb")) + id = wxString(attrs[i+1], wxConvUTF8); + } + + for (i=0; i<(int)_this->_user->_categories.size(); i++) + { + if (_this->_user->_categories[i].name == name) + { + _this->_categories[id] = _this->_user->_categories[i].id; + return; + } + } + + _this->_categories[id] = wxT("unknown-") + id; + _this->_unresolvedCategories.push_back(name); +} + +void GrisbiImportEngine::LoadOperation(GrisbiImportEngine* _this, const char** attrs) +{ + int i; + static int id=0; + Operation op; + wxString amount; + wxDateTime date; + + op.id = wxString::Format(wxT("%d"), ++id); + op.parent = wxT(""); + op.account = wxT("0"); + op.category = wxT("0"); + op.fix_cost = false; + op.checked = false; + op.transfert = wxT(""); + op.formula = wxT(""); + op.meta = false; + op._virtual = false; + + for (i=0; attrs[i]; i+=2) + { + if (!strcmp(attrs[i], "Ac")) + op.account = _this->_accounts[wxString(attrs[i+1], wxConvUTF8)]; + + else if (!strcmp(attrs[i], "Dt")) + { + date.ParseFormat(wxString(attrs[i+1], wxConvUTF8), wxT("%m/%d/%Y")); + op.day = date.GetDay(); + op.month = date.GetMonth(); + op.year = date.GetYear(); + } + + else if (!strcmp(attrs[i], "Am")) + { + amount = wxString(attrs[i+1], wxConvUTF8); + amount.ToDouble(&op.amount); + } + + else if (!strcmp(attrs[i], "Ca")) + op.category = _this->_categories[wxString(attrs[i+1], wxConvUTF8)]; + + else if (!strcmp(attrs[i], "No")) + op.description = wxString(attrs[i+1], wxConvUTF8); + } + + _this->_operations.push_back(op); + _this->_descriptions[op.id] = op.description; + + _this->MatchPattern(op.description, op); +} + +void GrisbiImportEngine::GrisbiStartElement(void* user_data, const xmlChar* name_, const xmlChar** attrs_) +{ + GrisbiImportEngine* _this = (GrisbiImportEngine*) user_data; + static char first = 0; + int i; + const char** attrs = (const char**) attrs_; + const char* name = (const char*) name_; + + if (!first && strcmp(name, "Grisbi")) + { + throw "Invalid file !"; + } + else + first = 1; + + if (!strcmp(name, "General")) + { + for (i=0; attrs[i]; i+=2) + { + if (!strcmp(attrs[i], "File_version") && strcmp(attrs[i+1], "0.6.0") < 0) + throw "Unsupported version !"; + + else if (!strcmp(attrs[i], "Crypt_file") && !strcmp(attrs[i+1], "1")) + throw "Crypted file !"; + } + } + + else if (!strcmp(name, "Account")) + LoadAccount(_this, attrs); + + else if (!strcmp(name, "Category")) + LoadCategory(_this, attrs); + + else if (!strcmp(name, "Transaction")) + LoadOperation(_this, attrs); +} + +GrisbiImportEngine::GrisbiImportEngine() +{ + KissCount::RegisterImportEngine(this); + + _shortExt = wxT("gsb"); + _longExt = _("Grisbi files (*.gsb)|*.gsb"); + + _sax.startElement = GrisbiStartElement ; +} + +GrisbiImportEngine::~GrisbiImportEngine() +{ +} + +bool GrisbiImportEngine::HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss) +{ + if (!ImportEngine::HandleFile(path, user, db, kiss)) return false; + + return xmlSAXUserParseFile(&_sax, this, path.mb_str()) >= 0; +} diff --git a/src/model/import/GrisbiImportEngine.h b/src/model/import/GrisbiImportEngine.h new file mode 100644 index 0000000..4d1c75b --- /dev/null +++ b/src/model/import/GrisbiImportEngine.h @@ -0,0 +1,45 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef GRISBIIMPORTENGINE_H +#define GRISBIIMPORTENGINE_H + +#include + +#include "ImportEngine.h" + +class GrisbiImportEngine : public ImportEngine { +public: + GrisbiImportEngine(); + ~GrisbiImportEngine(); + + virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss); + /* virtual std::vector ParseFile(); */ + /* virtual std::vector* GetOperations(std::map& accounts); */ + +private: + xmlSAXHandler _sax; + + static void GrisbiStartElement(void* user_data, const xmlChar* name_, const xmlChar** attrs_); + static void LoadAccount(GrisbiImportEngine* _this, const char** attrs); + static void LoadCategory(GrisbiImportEngine* _this, const char** attrs); + static void LoadOperation(GrisbiImportEngine* _this, const char** attrs); +}; + +#endif diff --git a/src/model/import/ImportEngine.h b/src/model/import/ImportEngine.h index efc54a1..9f204cd 100644 --- a/src/model/import/ImportEngine.h +++ b/src/model/import/ImportEngine.h @@ -66,7 +66,9 @@ protected: wxString _longExt; std::map _accounts; + std::map _categories; std::vector _unresolvedAccounts; + std::vector _unresolvedCategories; std::vector _operations; std::map _descriptions; diff --git a/src/model/import/OFXImportEngine.cpp b/src/model/import/OFXImportEngine.cpp index 0ad607c..2038d1f 100644 --- a/src/model/import/OFXImportEngine.cpp +++ b/src/model/import/OFXImportEngine.cpp @@ -102,7 +102,7 @@ int OFXImportEngine::transaction_cb(const struct OfxTransactionData data, void * int OFXImportEngine::account_balance_cb(const struct OfxStatementData data, void * statement_data) { - OFXImportEngine* _this = (OFXImportEngine*) statement_data; + // OFXImportEngine* _this = (OFXImportEngine*) statement_data; return 0; } From 9b914484921444a9273f066ebbc44967d20a62d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 24 Apr 2011 12:39:40 +0200 Subject: [PATCH 56/72] Change PREFIX variable in HOST --- Makefile | 2 +- tools/package.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 899d264..25f7569 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ LDFLAGS+=-L./lib/wxsqlite3-1.9.9/lib/ -lwxcode_gtk2u_wxsqlite3-2.8 LDFLAGS+=-L./lib/freechart/lib -lwxcode_gtk2u_freechart-2.8 endif -CXX=$(PREFIX)g++ +CXX=$(HOST)g++ SOURCES=$(shell find src -name '*.cpp' -type f | tr '\n' ' ') HEADERS=$(shell find src -name '*.h' -type f) diff --git a/tools/package.sh b/tools/package.sh index b66dde8..cfc153d 100755 --- a/tools/package.sh +++ b/tools/package.sh @@ -1,7 +1,7 @@ #!/bin/bash DATE=`date +%d.%m.%Y` -[ -z "$ARCH" ] && ARCH=`${PREFIX}gcc -dumpmachine | cut -d- -f1` +[ -z "$ARCH" ] && ARCH=`${HOST}gcc -dumpmachine | cut -d- -f1` VERSION=`cat src/controller/KissCount.h | grep APP_VERSION | cut -d\" -f2` DIR="KissCount_build_${VERSION}_${DATE}_${ARCH}" FILE="$DIR.tar.bz2" @@ -21,7 +21,7 @@ make || (echo "Compilation failed" ; exit 1) mkdir -p "$DIR"/lib cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DIR"/lib cp -r kc ressources TODO CONTRIBUTORS COPYING README* www "$DIR" -find "$DIR" -type f -executable -exec ${PREFIX}strip \{\} \; +find "$DIR" -type f -executable -exec ${HOST}strip \{\} \; tar -jcf "$FILE" "$DIR" rm -rf "$DIR" @@ -32,7 +32,7 @@ rm -rf "$DEB_DIR" "$DEB_FILE" mkdir -p "$DEB_DIR/lib" cp -r lib/freechart/lib/*.so* lib/wxsqlite3-1.9.9/lib/*.so* "$DEB_DIR/lib" cp -r kc.1 kc debian README* ChangeLog TODO CONTRIBUTORS ressources "$DEB_DIR" -${PREFIX}strip "$DEB_DIR/lib/*" kc +${HOST}strip "$DEB_DIR/lib/*" kc #tar -zcf "$DEB_FILE" "$DEB_DIR" cd "$DEB_DIR" mv debian/Makefile . From ec3fa8d7d5af80962f973f5bd8be8cf95353a9ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Mon, 25 Apr 2011 17:36:58 +0200 Subject: [PATCH 57/72] Use Account structure in ImportEngine instead of simply id for unresolved accounts (more information can be given) Remove "Operating expenses" default category and add "Car" in replacement --- src/controller/KissCount.cpp | 4 ++-- src/model/import/GrisbiImportEngine.cpp | 5 ++++- src/model/import/ImportEngine.cpp | 2 +- src/model/import/ImportEngine.h | 4 ++-- src/model/import/OFXImportEngine.cpp | 4 +++- src/view/ImportPanel.cpp | 24 ++++++++++++++---------- 6 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 4c5772e..28a7967 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -352,7 +352,7 @@ void KissCount::ChangeName(const wxString& name) // To enable translation during xgettext wxString default_cats[] = { - _("Fix"), _("Groceries"), _("Hobbies"), _("Operating expense"), + _("Fix"), _("Groceries"), _("Hobbies"), _("Car"), _("Unexpected"), _("Other") }; @@ -383,7 +383,7 @@ void KissCount::NewUser(const wxString& name) AddCategory(cat); cat.parent = wxT("0") ; cat.name = wxT("Hobbies") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); - cat.parent = wxT("0") ; cat.name = wxT("Operating exepense") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; + cat.parent = wxT("0") ; cat.name = wxT("Car") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); cat.parent = wxT("0") ; cat.name = wxT("Unexpected") ; cat.backcolor = OWN_GREEN; cat.forecolor = *wxBLACK; cat.fix_cost = false; AddCategory(cat); diff --git a/src/model/import/GrisbiImportEngine.cpp b/src/model/import/GrisbiImportEngine.cpp index dcd2b2d..9916c25 100644 --- a/src/model/import/GrisbiImportEngine.cpp +++ b/src/model/import/GrisbiImportEngine.cpp @@ -25,6 +25,7 @@ void GrisbiImportEngine::LoadAccount(GrisbiImportEngine* _this, const char** att { int i; wxString account_number, name, id, key; + Account ac; for (i=0; attrs[i]; i+=2) { @@ -53,7 +54,9 @@ void GrisbiImportEngine::LoadAccount(GrisbiImportEngine* _this, const char** att } _this->_accounts[id] = wxT("unknown-") + account_number; - _this->_unresolvedAccounts.push_back(account_number); + ac.number = account_number; + ac.name = name; + _this->_unresolvedAccounts.push_back(ac); } void GrisbiImportEngine::LoadCategory(GrisbiImportEngine* _this, const char** attrs) diff --git a/src/model/import/ImportEngine.cpp b/src/model/import/ImportEngine.cpp index 90e7b30..ea67397 100644 --- a/src/model/import/ImportEngine.cpp +++ b/src/model/import/ImportEngine.cpp @@ -282,7 +282,7 @@ void ImportEngine::MatchPattern(wxString& originalKey, Operation& op) } } -std::vector ImportEngine::ParseFile() +std::vector ImportEngine::ParseFile() { return _unresolvedAccounts; } diff --git a/src/model/import/ImportEngine.h b/src/model/import/ImportEngine.h index 9f204cd..ad80feb 100644 --- a/src/model/import/ImportEngine.h +++ b/src/model/import/ImportEngine.h @@ -47,7 +47,7 @@ public: virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss)=0; // Parse the file and return accounts that doesn't match - virtual std::vector ParseFile(); + virtual std::vector ParseFile(); // Final Step virtual std::vector* GetOperations(std::map& accounts); @@ -67,7 +67,7 @@ protected: std::map _accounts; std::map _categories; - std::vector _unresolvedAccounts; + std::vector _unresolvedAccounts; std::vector _unresolvedCategories; std::vector _operations; std::map _descriptions; diff --git a/src/model/import/OFXImportEngine.cpp b/src/model/import/OFXImportEngine.cpp index 2038d1f..a5039c5 100644 --- a/src/model/import/OFXImportEngine.cpp +++ b/src/model/import/OFXImportEngine.cpp @@ -26,6 +26,7 @@ int OFXImportEngine::account_cb(const struct OfxAccountData data, void * account int i; OFXImportEngine* _this = (OFXImportEngine*) account_data; wxString account_number = wxString(data.account_number, wxConvUTF8); + Account ac; _this->_curAccount = wxT(""); @@ -44,7 +45,8 @@ int OFXImportEngine::account_cb(const struct OfxAccountData data, void * account if (!_this->_curAccount.Len()) { _this->_curAccount = _this->_accounts[account_number] = wxT("unknown-") + account_number; - _this->_unresolvedAccounts.push_back(account_number); + ac.number = account_number; + _this->_unresolvedAccounts.push_back(ac); } return 0; diff --git a/src/view/ImportPanel.cpp b/src/view/ImportPanel.cpp index 04cf600..84048d4 100644 --- a/src/view/ImportPanel.cpp +++ b/src/view/ImportPanel.cpp @@ -66,10 +66,11 @@ ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent vbox->Add(hbox, 0); _accountsGrid = new wxGrid(this, wxID_ANY); - _accountsGrid->CreateGrid(0, 2); + _accountsGrid->CreateGrid(0, 3); _accountsGrid->SetRowLabelSize(0); _accountsGrid->SetColLabelValue(0, _("File account")); - _accountsGrid->SetColLabelValue(1, _("Internal account")); + _accountsGrid->SetColLabelValue(1, _("Account name")); + _accountsGrid->SetColLabelValue(2, _("Internal account")); _accountsGrid->Fit(); wxStaticBoxSizer* staticBoxSizer = new wxStaticBoxSizer (staticAccount, wxVERTICAL); @@ -134,7 +135,7 @@ void ImportPanel::OnFileEnter(wxCommandEvent& WXUNUSED(event)) void ImportPanel::ProcessFile() { - std::vector accounts; + std::vector accounts; User* user = _kiss->GetUser(); int i; wxGridCellChoiceEditor* accountEditor; @@ -174,16 +175,16 @@ void ImportPanel::ProcessFile() _buttonLoadOperations->Enable(); - // std::cout << "Insert " << accounts.size() << " rows\n"; _accountsGrid->AppendRows(accounts.size()); for (i=0; i<(int)accounts.size(); i++) { - _accountsGrid->SetCellValue(i, 0, accounts[i]); + _accountsGrid->SetCellValue(i, 0, accounts[i].number); _accountsGrid->SetReadOnly(i, 0); - _accountsGrid->SetCellValue(i, 1, userAccounts[0]); + _accountsGrid->SetCellValue(i, 1, accounts[i].name); + _accountsGrid->SetCellValue(i, 2, userAccounts[0]); - _accountsGrid->SetCellEditor(i, 1, accountEditor); + _accountsGrid->SetCellEditor(i, 2, accountEditor); } _accountsGrid->AutoSize(); @@ -212,7 +213,7 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) nbAccounts = 0; for(i=0; i<_accountsGrid->GetNumberRows(); i++) { - if (_accountsGrid->GetCellValue(i, 1) == _("Create one")) + if (_accountsGrid->GetCellValue(i, 2) == _("Create one")) nbAccounts++; } @@ -227,9 +228,12 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) for(i=0; i<_accountsGrid->GetNumberRows(); i++) { - if (_accountsGrid->GetCellValue(i, 1) == _("Create one")) + if (_accountsGrid->GetCellValue(i, 2) == _("Create one")) { - account.name = _accountsGrid->GetCellValue(i, 0); + if (_accountsGrid->GetCellValue(i, 1).Length()) + account.name = _accountsGrid->GetCellValue(i, 1); + else + account.name = _accountsGrid->GetCellValue(i, 0); account.number = _accountsGrid->GetCellValue(i, 0); account.shared = false; account.blocked = false; From c69621c2fea2e39dba85be990be4f809d418d54a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Mon, 25 Apr 2011 19:55:31 +0200 Subject: [PATCH 58/72] Add unresolved categories in ImportPanel Fix two bugs : Don't take in account unknown categories (in stats) Don't try to draw more than MAX_CATEGORIES (12) in charts --- ChangeLog | 4 +- src/model/import/GrisbiImportEngine.cpp | 11 ++- src/model/import/ImportEngine.cpp | 9 +- src/model/import/ImportEngine.h | 6 +- src/view/AccountPanel.cpp | 17 ++-- src/view/ImportPanel.cpp | 116 +++++++++++++++++++++--- src/view/ImportPanel.h | 2 +- src/view/StatsPanel.cpp | 7 +- src/view/wxUI.cpp | 2 +- src/view/wxUI.h | 2 + 10 files changed, 139 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3ee6ce..763239a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2 (23/03/2011) +v0.2 (25/04/2011) ** User ** Better use of sizers (so better interface!) @@ -38,3 +38,5 @@ v0.2 (23/03/2011) Categories fonts not updated for new category --> crash New category had read only fields in PreferencesPanel Update all panels after generating/deleting month + Don't take in account unknown categories (in stats) + Don't try to draw more than MAX_CATEGORIES (12) in charts diff --git a/src/model/import/GrisbiImportEngine.cpp b/src/model/import/GrisbiImportEngine.cpp index 9916c25..d5d0de1 100644 --- a/src/model/import/GrisbiImportEngine.cpp +++ b/src/model/import/GrisbiImportEngine.cpp @@ -63,6 +63,7 @@ void GrisbiImportEngine::LoadCategory(GrisbiImportEngine* _this, const char** at { wxString name, id; int i; + Category cat; for (i=0; attrs[i]; i+=2) { @@ -82,8 +83,10 @@ void GrisbiImportEngine::LoadCategory(GrisbiImportEngine* _this, const char** at } } - _this->_categories[id] = wxT("unknown-") + id; - _this->_unresolvedCategories.push_back(name); + _this->_categories[id] = wxT("unknown-") + name; + cat.id = id; + cat.name = name; + _this->_unresolvedCategories.push_back(cat); } void GrisbiImportEngine::LoadOperation(GrisbiImportEngine* _this, const char** attrs) @@ -96,8 +99,8 @@ void GrisbiImportEngine::LoadOperation(GrisbiImportEngine* _this, const char** a op.id = wxString::Format(wxT("%d"), ++id); op.parent = wxT(""); - op.account = wxT("0"); - op.category = wxT("0"); + op.account = wxT("unknwon-0"); + op.category = wxT("unknwon-0"); op.fix_cost = false; op.checked = false; op.transfert = wxT(""); diff --git a/src/model/import/ImportEngine.cpp b/src/model/import/ImportEngine.cpp index ea67397..c68e642 100644 --- a/src/model/import/ImportEngine.cpp +++ b/src/model/import/ImportEngine.cpp @@ -282,12 +282,13 @@ void ImportEngine::MatchPattern(wxString& originalKey, Operation& op) } } -std::vector ImportEngine::ParseFile() +void ImportEngine::ParseFile(std::vector& accounts, std::vector& categories) { - return _unresolvedAccounts; + accounts = _unresolvedAccounts; + categories = _unresolvedCategories; } -std::vector* ImportEngine::GetOperations(std::map& accounts) +std::vector* ImportEngine::GetOperations(std::map& accounts, std::map& categories) { int i; @@ -295,6 +296,8 @@ std::vector* ImportEngine::GetOperations(std::map { if (_operations[i].account.StartsWith(wxT("unknown-"))) _operations[i].account = accounts[_operations[i].account.Mid(8)]; + if (_operations[i].category.StartsWith(wxT("unknown-"))) + _operations[i].category = categories[_operations[i].category.Mid(8)]; } if (_kiss->GetOperationOrder() == wxT("ASC")) diff --git a/src/model/import/ImportEngine.h b/src/model/import/ImportEngine.h index ad80feb..b6949d5 100644 --- a/src/model/import/ImportEngine.h +++ b/src/model/import/ImportEngine.h @@ -47,10 +47,10 @@ public: virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss)=0; // Parse the file and return accounts that doesn't match - virtual std::vector ParseFile(); + virtual void ParseFile(std::vector& accounts, std::vector& categories); // Final Step - virtual std::vector* GetOperations(std::map& accounts); + virtual std::vector* GetOperations(std::map& accounts, std::map& categories); void MatchPattern(wxString& key, Operation& op); int UpdatePattern(int pos); @@ -68,7 +68,7 @@ protected: std::map _accounts; std::map _categories; std::vector _unresolvedAccounts; - std::vector _unresolvedCategories; + std::vector _unresolvedCategories; std::vector _operations; std::map _descriptions; diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 6762f7e..d4fa4a4 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -54,6 +54,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare std::vector::iterator categoryIt; DEFAULT_FONT(font); wxRect rect = wxDisplay().GetGeometry(); + int nbCategories; SetSizer(hbox); @@ -82,14 +83,16 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare _categories[i] = wxGetTranslation(categoryIt->name) ; _categoriesIndexes[categoryIt->name] = i; } - - _dataset = new CategorySimpleDataset(_categories, user->GetCategoriesNumber()); + + nbCategories = (user->GetCategoriesNumber() <= MAX_CATEGORY) ? user->GetCategoriesNumber() : MAX_CATEGORY; _categoriesValues = new double[user->GetCategoriesNumber()]; for(i=0; iGetCategoriesNumber(); i++) - _categoriesValues[i] = 0.0; + _categoriesValues[i] = 0.0; - _dataset->AddSerie(_("Serie 1"), _categoriesValues, user->GetCategoriesNumber()); + _dataset = new CategorySimpleDataset(_categories, nbCategories); + _dataset->AddSerie(_("Serie 1"), _categoriesValues, nbCategories); + _dataset->SetRenderer(new CategoryRenderer(*colorScheme)); _pie->SetDataset(_dataset); _pie->SetColorScheme(colorScheme); @@ -509,7 +512,7 @@ void AccountPanel::UpdateStats() } else { - if (!op.transfert.Length()) + if (!op.transfert.Length() && user->GetCategoryName(op.category) != _("Unknown")) _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ; if (!op.transfert.Length() || op._virtual) @@ -545,7 +548,7 @@ void AccountPanel::UpdateStats() } else { - if (!op.transfert.Length()) + if (!op.transfert.Length() && user->GetCategoryName(op.category) != _("Unknown")) _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ; if (!op.transfert.Length() && !op._virtual) @@ -583,7 +586,7 @@ void AccountPanel::UpdateStats() } else { - if (!op.transfert.Length()) + if (!op.transfert.Length() && user->GetCategoryName(op.category) != _("Unknown")) _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ; if (!op.transfert.Length() && !op._virtual) diff --git a/src/view/ImportPanel.cpp b/src/view/ImportPanel.cpp index 84048d4..d00a9d0 100644 --- a/src/view/ImportPanel.cpp +++ b/src/view/ImportPanel.cpp @@ -33,12 +33,14 @@ END_EVENT_TABLE() ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent) { wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); + wxBoxSizer *vbox2 = new wxBoxSizer(wxVERTICAL); wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); _hbox = new wxBoxSizer(wxHORIZONTAL); wxButton* buttonOpen; wxRect rect = wxDisplay().GetGeometry(); int w, h; wxStaticBox* staticAccount = new wxStaticBox(this, wxID_ANY, _("Unresolved accounts")); + wxStaticBox* staticCategory = new wxStaticBox(this, wxID_ANY, _("Unresolved categories")); SetSizer(vbox); @@ -73,12 +75,25 @@ ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _accountsGrid->SetColLabelValue(2, _("Internal account")); _accountsGrid->Fit(); + _categoriesGrid = new wxGrid(this, wxID_ANY); + _categoriesGrid->CreateGrid(0, 3); + _categoriesGrid->SetRowLabelSize(0); + _categoriesGrid->SetColLabelValue(0, _("File category")); + _categoriesGrid->SetColLabelValue(1, _("Category name")); + _categoriesGrid->SetColLabelValue(2, _("Internal category")); + _categoriesGrid->Fit(); + wxStaticBoxSizer* staticBoxSizer = new wxStaticBoxSizer (staticAccount, wxVERTICAL); staticBoxSizer->Add(_accountsGrid, 0, wxGROW|wxALL, 2); + vbox2->Add(staticBoxSizer, wxGROW|wxALL); + + staticBoxSizer = new wxStaticBoxSizer (staticCategory, wxVERTICAL); + staticBoxSizer->Add(_categoriesGrid, 0, wxGROW|wxALL, 2); + vbox2->Add(staticBoxSizer, wxGROW|wxALL); _operationsGrid = new GridAccount(kiss, this, OPS_GRID_ID, false, false, false); - _hbox->Add(staticBoxSizer, 0, wxGROW|wxALL, 15); + _hbox->Add(vbox2, 0, wxGROW|wxALL, 15); _hbox->Add(_operationsGrid, 0, wxGROW|wxALL, 15); vbox->Add(_hbox, wxGROW); @@ -136,11 +151,15 @@ void ImportPanel::OnFileEnter(wxCommandEvent& WXUNUSED(event)) void ImportPanel::ProcessFile() { std::vector accounts; + std::vector categories; User* user = _kiss->GetUser(); int i; wxGridCellChoiceEditor* accountEditor; wxString* userAccounts; std::map resolvedAccounts; + wxGridCellChoiceEditor* categoryEditor; + wxString* userCategories; + std::map resolvedCategories; wxCommandEvent event; wxString path = _fileTxt->GetLineText(0); @@ -148,6 +167,7 @@ void ImportPanel::ProcessFile() _buttonLoadOperations->Disable(); _buttonIntegrate->Disable(); _accountsGrid->ClearGrid(); + _categoriesGrid->ClearGrid(); _operationsGrid->ClearGrid(); _importEngine = _kiss->GetImportEngine(path); @@ -159,7 +179,7 @@ void ImportPanel::ProcessFile() return ; } - accounts = _importEngine->ParseFile(); + _importEngine->ParseFile(accounts, categories); if (accounts.size()) { @@ -190,7 +210,37 @@ void ImportPanel::ProcessFile() _accountsGrid->AutoSize(); _accountsGrid->Layout(); } - else + + if (categories.size()) + { + int nb_categories = user->GetCategoriesNumber(); + userCategories = new wxString[nb_categories+1]; + + userCategories[0] = _("Create one"); + + for(i=0; i_categories[i].name; + + categoryEditor = new wxGridCellChoiceEditor(nb_categories+1, userCategories, false); + + _buttonLoadOperations->Enable(); + + _categoriesGrid->AppendRows(categories.size()); + + for (i=0; i<(int)categories.size(); i++) + { + _categoriesGrid->SetCellValue(i, 0, categories[i].name); + _categoriesGrid->SetReadOnly(i, 0); + _categoriesGrid->SetCellValue(i, 2, userCategories[0]); + + _categoriesGrid->SetCellEditor(i, 2, categoryEditor); + } + + _categoriesGrid->AutoSize(); + _categoriesGrid->Layout(); + } + + if (!accounts.size() && !categories.size()) { OnLoadOperations(event); } @@ -200,27 +250,44 @@ void ImportPanel::ProcessFile() void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) { std::map resolvedAccounts; - int i, nbAccounts; + std::map resolvedCategories; + int i, nbAccounts=0, nbCategories=0; User* user = _kiss->GetUser(); Account account; + Category category; - for(i=0; i<_accountsGrid->GetNumberRows(); i++) - { - resolvedAccounts[_accountsGrid->GetCellValue(i, 0)] = - user->GetAccountId(_accountsGrid->GetCellValue(i, 1)); - } - - nbAccounts = 0; for(i=0; i<_accountsGrid->GetNumberRows(); i++) { if (_accountsGrid->GetCellValue(i, 2) == _("Create one")) nbAccounts++; + else + resolvedAccounts[_accountsGrid->GetCellValue(i, 0)] = + user->GetAccountId(_accountsGrid->GetCellValue(i, 1)); } - if (nbAccounts) + for(i=0; i<_categoriesGrid->GetNumberRows(); i++) { - wxString message = wxString::Format(wxT("%d"), nbAccounts); - message += _(" account(s) will be created, is it ok ?"); + if (_categoriesGrid->GetCellValue(i, 2) == _("Create one")) + nbCategories++; + else + resolvedCategories[_categoriesGrid->GetCellValue(i, 0)] = + user->GetAccountId(_categoriesGrid->GetCellValue(i, 1)); + } + + if (nbAccounts || nbCategories) + { + wxString message; + + if (nbAccounts) + { + message += wxString::Format(wxT("%d accounts"), nbAccounts); + if (nbCategories) message += wxT(" and "); + } + + if (nbCategories) + message += wxString::Format(wxT("%d categories"), nbCategories); + + message += _(" will be created, is it ok ?"); wxMessageDialog dialog(_wxUI, message, wxT("KissCount"), wxYES_NO); if (dialog.ShowModal() == wxID_NO) @@ -247,10 +314,29 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) _accountsGrid->DeleteRows(0, _accountsGrid->GetNumberRows ()); + for(i=0; i<_categoriesGrid->GetNumberRows(); i++) + { + if (_categoriesGrid->GetCellValue(i, 2) == _("Create one")) + { + if (_categoriesGrid->GetCellValue(i, 1).Length()) + category.name = _categoriesGrid->GetCellValue(i, 1); + else + category.name = _categoriesGrid->GetCellValue(i, 0); + category.parent = wxT("0"); + category.backcolor = OWN_GREEN ; + category.forecolor = *wxBLACK; + category.fix_cost = false; + + resolvedCategories[_categoriesGrid->GetCellValue(i, 0)] = category.id = _kiss->AddCategory(category); + } + } + + _categoriesGrid->DeleteRows(0, _categoriesGrid->GetNumberRows ()); + _wxUI->NeedReload(); } - _operations = _importEngine->GetOperations(resolvedAccounts); + _operations = _importEngine->GetOperations(resolvedAccounts, resolvedCategories); if (_operations->size()) { diff --git a/src/view/ImportPanel.h b/src/view/ImportPanel.h index 3c30f71..89b460a 100644 --- a/src/view/ImportPanel.h +++ b/src/view/ImportPanel.h @@ -53,7 +53,7 @@ public: private: wxBoxSizer *_hbox; - wxGrid* _accountsGrid; + wxGrid* _accountsGrid, *_categoriesGrid; wxTextCtrl* _fileTxt; GridAccount* _operationsGrid; ImportEngine* _importEngine; diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 3fec614..023642c 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -38,6 +38,7 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), std::vector::iterator categoryIt; std::map > operations; std::map >::iterator it; + int nbCategories; SetSizer(vbox); @@ -110,14 +111,16 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _pie = new PiePlot(); - _dataset = new CategorySimpleDataset(_categories, user->GetCategoriesNumber()); + nbCategories = (user->GetCategoriesNumber() <= MAX_CATEGORY) ? user->GetCategoriesNumber() : MAX_CATEGORY; + + _dataset = new CategorySimpleDataset(_categories, nbCategories); ColorScheme* colorScheme = new ColorScheme(categoryColors, WXSIZEOF(categoryColors)); _categoriesValues = new double[user->GetCategoriesNumber()]; for(i=0; iGetCategoriesNumber(); i++) _categoriesValues[i] = 0.0; - _dataset->AddSerie(_("Serie 1"), _categoriesValues, user->GetCategoriesNumber()); + _dataset->AddSerie(_("Serie 1"), _categoriesValues, nbCategories); _dataset->SetRenderer(new CategoryRenderer(*colorScheme)); _pie->SetDataset(_dataset); _pie->SetColorScheme(colorScheme); diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index b6b2663..25e9fb7 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -28,7 +28,7 @@ EVT_BUTTON(BUTTON_QUIT_ID, wxUI::OnButtonQuit) END_EVENT_TABLE() wxString months[12] ; -wxColour categoryColors[12] = {wxColour(0x00, 0x45, 0x86), +wxColour categoryColors[MAX_CATEGORY] = {wxColour(0x00, 0x45, 0x86), wxColour(0xFF, 0x3E, 0x0E), wxColour(0xFF, 0xD3, 0x20), wxColour(0x58, 0x9D, 0x1B), diff --git a/src/view/wxUI.h b/src/view/wxUI.h index e7c8c52..1cc0bbe 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -48,6 +48,8 @@ class PreferencesPanel; extern wxString months[12]; extern wxColour categoryColors[12]; +#define MAX_CATEGORY 12 + class wxUI: public wxFrame { public: From f7f0482521737f528280cca7b2be17e9d9926742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Tue, 26 Apr 2011 20:58:11 +0200 Subject: [PATCH 59/72] Don't display virtual values in check mode --- src/view/AccountPanel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index d4fa4a4..704ca01 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -643,8 +643,8 @@ void AccountPanel::UpdateStats() } else { - value = _accountsInitValues[accountIt->id]; - value2 = (*notChecked)[accountIt->id] + (*virtuals)[accountIt->id]; + value = _accountsInitValues[accountIt->id] - (*virtuals)[accountIt->id]; + value2 = (*notChecked)[accountIt->id]; _accountsGrid->SetCellValue(i, ACCOUNT_INIT, wxString::Format(wxT("%.2lf (%.2lf)"), value, value-value2)); value = curAccountAmount[accountIt->id]; From 2713ab5247ef03e3d79329b91d764e0a59560e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Tue, 26 Apr 2011 21:04:14 +0200 Subject: [PATCH 60/72] Update translations --- ChangeLog | 4 +- ressources/po/french.mo | Bin 8929 -> 9519 bytes ressources/po/french.po | 373 +++++++++++++++++++++--------------- ressources/po/kisscount.pot | 233 +++++++++++++--------- src/view/ImportPanel.cpp | 12 +- 5 files changed, 367 insertions(+), 255 deletions(-) diff --git a/ChangeLog b/ChangeLog index 763239a..45ff72d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2 (25/04/2011) +v0.2 (26/04/2011) ** User ** Better use of sizers (so better interface!) @@ -14,7 +14,7 @@ v0.2 (25/04/2011) Add Real mode Database is now at ~/.kisscount/kc.bdd Add Debian's packages !! - Add Import Panel and OFX imports + Add Import Panel, OFX and Grisbi imports ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/ressources/po/french.mo b/ressources/po/french.mo index c82854978545cfa0ae11ea1bac84be5dfee02387..3b52d83e066a9c02178e1ce4467046b61d814178 100644 GIT binary patch delta 4158 zcmZYBe{9tC9mny{Ra#o0z0ww1prv1+9h44AueC_6s1&3i!Ukwj7;v;-+SB%~-dziw z$cc{CUq$qA&WT!PW73#_$uWOKqHOK9#LSJqP~4a^Gm}ir+zc=c>YlH=&oP&M!|NWO z@2}5~_xF28KU{Hab?natfjxmgzqB%%tw6a{O72SE~Bo? zW>&MY05#y%SdQzl7Q?9PhA|(HqQ-j*vrNpG-_j`K!0%Bvo=2^C5?8AT`KWfi>{1lFJ?*ot~L?m$&yE9$ztPz&9KdXzC_VKMVK z4RtVLFF1}=)to@)WKN+b_BYhZKC%82)!`-UH(0^`czUhG?^@TR?%R!8&|cJ|*`Ji> ze}INMdI~kr^VVV1jU%WP9YfuiKwWYs1^87=a--+v>f$L+=43YX4C|`QKj#-?nC|1 z4WcUb62|7zI7Oo#|BYJFf*GloZZWE(b=Fo?X}94#+;5K`MGf={YGS`aP5d3Z|0lcu zF;XOR5jD}gQl7t_vBM9yPBfravKH0h7OcWfREJNXN_hmCtN8`$zEh}|?Hp>t7f|pzhC_nfkWOh|$m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9^WkS=5!ag$+0WhR+TI+9efnP@xO5*JbF9VGCT>`7feO8WLxms~3R z$_KV@6|N+D2>VvA|9TEyCfZjOJy1i*B(i{vBr54-BFQA{h@SA}q#w}_%(EqggAAgF zQl%(J;BU(d)Y}p77~V#a9fV&|Go7exBq>DSeU;bACNf_KlnRnZCX*>dWh==hZxDTh z+7p%WWDS`^mJ*d@QufUA7dWXO4wZ)F6*5Q%wrs$rWCF<{HOUsTnv{@IqSfRF^10HV zqvGez@Gok6>JhQ~E@70jONE+|^$axa`w zR$k`&vq3Lke)s_YN8wW(UsOb#zgI+sQC@n*C>Q;QR-Js9fCu diff --git a/ressources/po/french.po b/ressources/po/french.po index ce4436f..62b6dc4 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-03-24 19:19+0100\n" +"POT-Creation-Date: 2011-04-26 21:01+0200\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -19,25 +19,25 @@ msgstr "" # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # -#: src/view/StatsPanel.cpp:358 -#: src/view/PreferencesPanel.cpp:831 +#: src/view/StatsPanel.cpp:361 +#: src/view/PreferencesPanel.cpp:832 msgid " - " msgstr " - " -#: src/view/ImportPanel.cpp:222 -msgid " account(s) will be created, is it ok ?" -msgstr " comptes vont être créés, êtes vous d'accord ?" - -#: src/view/UsersDialog.cpp:120 -#: src/view/PreferencesPanel.cpp:495 -#: src/view/PreferencesPanel.cpp:515 -#: src/view/PreferencesPanel.cpp:726 -#: src/view/PreferencesPanel.cpp:745 -#: src/view/PreferencesPanel.cpp:789 +#: src/view/UsersDialog.cpp:125 +#: src/view/PreferencesPanel.cpp:496 +#: src/view/PreferencesPanel.cpp:516 +#: src/view/PreferencesPanel.cpp:727 +#: src/view/PreferencesPanel.cpp:746 +#: src/view/PreferencesPanel.cpp:790 msgid " already exists" msgstr " existe déjà" -#: src/view/SearchPanel.cpp:269 +#: src/view/ImportPanel.cpp:284 +msgid " and " +msgstr " et " + +#: src/view/SearchPanel.cpp:276 msgid " entries found" msgstr " entrées trouvées" @@ -45,29 +45,43 @@ msgstr " entrées trouvées" msgid " not found, aborting" msgstr " non trouvé, arrêt" -#: src/view/AccountPanel.cpp:852 +#: src/view/AccountPanel.cpp:855 msgid " operations ?" msgstr " opérations ?" -#: src/view/PreferencesPanel.cpp:838 +#: src/view/PreferencesPanel.cpp:839 msgid " profil ?" msgstr " profil ?" +#: src/view/ImportPanel.cpp:290 +msgid " will be created, is it ok ?" +msgstr " vont être créés, êtes vous d'accord ?" + #: src/model/Database.cpp:92 msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "!! Attention !! S'il y a eu un bug, l'ancienne base de donnée va être supprimée !" -#: src/view/SearchPanel.cpp:271 +#: src/view/ImportPanel.cpp:283 +#, c-format +msgid "%d accounts" +msgstr "%d comptes" + +#: src/view/ImportPanel.cpp:288 +#, c-format +msgid "%d categories" +msgstr "%d catégories" + +#: src/view/SearchPanel.cpp:278 msgid "1 entry found" msgstr "1 entrée trouvée" -#: src/view/SearchPanel.cpp:99 +#: src/view/SearchPanel.cpp:101 #: src/view/grid/GridAccount.cpp:68 msgid "Account" msgstr "Compte" -#: src/view/PreferencesPanel.cpp:495 -#: src/view/PreferencesPanel.cpp:515 +#: src/view/PreferencesPanel.cpp:496 +#: src/view/PreferencesPanel.cpp:516 msgid "Account " msgstr "Le compte " @@ -75,49 +89,50 @@ msgstr "Le compte " msgid "Account 1" msgstr "Compte 1" -#: src/view/AccountPanel.cpp:108 +#: src/view/ImportPanel.cpp:74 +#: src/view/AccountPanel.cpp:111 msgid "Account name" msgstr "Nom du compte" -#: src/view/AccountPanel.cpp:107 +#: src/view/AccountPanel.cpp:110 msgid "Account number" msgstr "Numéro de compte" -#: src/view/StatsPanel.cpp:323 +#: src/view/StatsPanel.cpp:326 #: src/view/PreferencesPanel.cpp:60 msgid "Accounts" msgstr "Comptes" -#: src/view/SearchPanel.cpp:95 +#: src/view/SearchPanel.cpp:97 msgid "Amount from" msgstr "Montant min" -#: src/view/SearchPanel.cpp:96 +#: src/view/SearchPanel.cpp:98 msgid "Amount to" msgstr "Montant max" -#: src/view/ImportPanel.cpp:156 +#: src/view/ImportPanel.cpp:177 msgid "Any engine can process this file !" msgstr "Format de fichier non reconnu" -#: src/view/PreferencesPanel.cpp:838 -#: src/view/AccountPanel.cpp:847 +#: src/view/PreferencesPanel.cpp:839 +#: src/view/AccountPanel.cpp:850 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " -#: src/view/grid/GridAccount.cpp:853 +#: src/view/grid/GridAccount.cpp:854 msgid "Are you sure want to delete : \n" msgstr "Etes vous sûr de vouloir supprimer : \n" -#: src/view/ImportPanel.cpp:277 +#: src/view/ImportPanel.cpp:367 msgid "Are you sure want to integrate these operations ?" msgstr "Etes vous sûr de vouloir intégreer ces opérations" -#: src/view/PreferencesPanel.cpp:368 +#: src/view/PreferencesPanel.cpp:369 msgid "Ascending" msgstr "Croissant" -#: src/view/PreferencesPanel.cpp:292 +#: src/view/PreferencesPanel.cpp:293 msgid "Background color" msgstr "Couleur d'arrière plan" @@ -131,30 +146,38 @@ msgstr "Bloqué" msgid "Cancel" msgstr "Annuler" -#: src/view/grid/GridAccount.cpp:1288 -#: src/view/grid/GridAccount.cpp:1295 +#: src/view/grid/GridAccount.cpp:1289 +#: src/view/grid/GridAccount.cpp:1296 msgid "Cannot group these operations" msgstr "Impossible de grouper ces opérations" -#: src/view/grid/GridAccount.cpp:1414 -#: src/view/grid/GridAccount.cpp:1420 +#: src/view/grid/GridAccount.cpp:1415 +#: src/view/grid/GridAccount.cpp:1421 msgid "Cannot ungroup these operations" msgstr "Impossible de dégrouper ces opérations" +#: src/controller/KissCount.cpp:355 +msgid "Car" +msgstr "Voiture" + #: src/view/PreferencesPanel.cpp:61 msgid "Categories" msgstr "Catégories" -#: src/view/SearchPanel.cpp:97 +#: src/view/SearchPanel.cpp:99 #: src/view/grid/GridAccount.cpp:68 msgid "Category" msgstr "Catégorie" -#: src/view/PreferencesPanel.cpp:726 -#: src/view/PreferencesPanel.cpp:745 +#: src/view/PreferencesPanel.cpp:727 +#: src/view/PreferencesPanel.cpp:746 msgid "Category " msgstr "La catégorie " +#: src/view/ImportPanel.cpp:82 +msgid "Category name" +msgstr "Catégorie" + #: src/view/PreferencesPanel.cpp:78 msgid "Change Name" msgstr "Changer de nom" @@ -163,11 +186,11 @@ msgstr "Changer de nom" msgid "Change Password" msgstr "Changer le mot de passe" -#: src/view/SearchPanel.cpp:125 +#: src/view/SearchPanel.cpp:127 msgid "Change account" msgstr "Changer de compte" -#: src/view/SearchPanel.cpp:126 +#: src/view/SearchPanel.cpp:128 msgid "Change category" msgstr "Changer la catégorie" @@ -175,23 +198,23 @@ msgstr "Changer la catégorie" msgid "Change password" msgstr "Changer le mot de passe" -#: src/view/AccountPanel.cpp:124 +#: src/view/AccountPanel.cpp:127 msgid "Check" msgstr "Rapprochement" -#: src/view/SearchPanel.cpp:84 +#: src/view/SearchPanel.cpp:86 msgid "Checked" msgstr "Rapprochée" -#: src/view/ImportPanel.cpp:117 +#: src/view/ImportPanel.cpp:133 msgid "Choose a database to open" msgstr "Choisissez une base de données à ouvrir" -#: src/view/SearchPanel.cpp:309 +#: src/view/SearchPanel.cpp:316 msgid "Choose a new account" msgstr "Nouveau compte" -#: src/view/SearchPanel.cpp:351 +#: src/view/SearchPanel.cpp:358 msgid "Choose a new category" msgstr "Nouvelle catégorie" @@ -199,14 +222,17 @@ msgstr "Nouvelle catégorie" msgid "Confirm password " msgstr "Confirmer le mot de passe " -#: src/view/StatsPanel.cpp:128 -#: src/view/AccountPanel.cpp:118 +#: src/view/StatsPanel.cpp:131 +#: src/view/AccountPanel.cpp:121 msgid "Cost repartition" msgstr "Répartition des coûts" -#: src/view/ImportPanel.cpp:168 -#: src/view/ImportPanel.cpp:215 -#: src/view/ImportPanel.cpp:230 +#: src/view/ImportPanel.cpp:189 +#: src/view/ImportPanel.cpp:219 +#: src/view/ImportPanel.cpp:261 +#: src/view/ImportPanel.cpp:270 +#: src/view/ImportPanel.cpp:298 +#: src/view/ImportPanel.cpp:319 msgid "Create one" msgstr "En créer un" @@ -214,15 +240,15 @@ msgstr "En créer un" msgid "Credit" msgstr "Crédit" -#: src/view/AccountPanel.cpp:219 +#: src/view/AccountPanel.cpp:222 msgid "Cur Credit" msgstr "Cur Crédit" -#: src/view/AccountPanel.cpp:220 +#: src/view/AccountPanel.cpp:223 msgid "Cur Debit" msgstr "Cur Débit" -#: src/view/AccountPanel.cpp:110 +#: src/view/AccountPanel.cpp:113 msgid "Current value" msgstr "Valeur courante" @@ -230,11 +256,11 @@ msgstr "Valeur courante" msgid "Date" msgstr "Date" -#: src/view/SearchPanel.cpp:56 +#: src/view/SearchPanel.cpp:57 msgid "Date from" msgstr "Date min" -#: src/view/SearchPanel.cpp:57 +#: src/view/SearchPanel.cpp:58 msgid "Date to" msgstr "Date max" @@ -247,44 +273,44 @@ msgid "Default" msgstr "Défaut" #: src/view/PreferencesPanel.cpp:201 -#: src/view/PreferencesPanel.cpp:295 -#: src/view/AccountPanel.cpp:706 +#: src/view/PreferencesPanel.cpp:296 +#: src/view/AccountPanel.cpp:709 msgid "Delete" msgstr "Supprimer" -#: src/view/PreferencesPanel.cpp:369 +#: src/view/PreferencesPanel.cpp:370 msgid "Descending" msgstr "Décroissant" -#: src/view/SearchPanel.cpp:94 +#: src/view/SearchPanel.cpp:96 #: src/view/grid/GridAccount.cpp:68 msgid "Description" msgstr "Description" -#: src/view/SearchPanel.cpp:393 +#: src/view/SearchPanel.cpp:400 msgid "Enter a new description" msgstr "Nouvelle description" -#: src/view/UsersDialog.cpp:90 -#: src/view/UsersDialog.cpp:120 -#: src/view/SearchPanel.cpp:179 -#: src/view/SearchPanel.cpp:189 -#: src/view/SearchPanel.cpp:203 -#: src/view/SearchPanel.cpp:214 -#: src/view/PreferencesPanel.cpp:435 -#: src/view/PreferencesPanel.cpp:495 -#: src/view/PreferencesPanel.cpp:515 -#: src/view/PreferencesPanel.cpp:726 -#: src/view/PreferencesPanel.cpp:745 -#: src/view/PreferencesPanel.cpp:783 -#: src/view/PreferencesPanel.cpp:789 +#: src/view/UsersDialog.cpp:95 +#: src/view/UsersDialog.cpp:125 +#: src/view/SearchPanel.cpp:181 +#: src/view/SearchPanel.cpp:191 +#: src/view/SearchPanel.cpp:205 +#: src/view/SearchPanel.cpp:216 +#: src/view/PreferencesPanel.cpp:436 +#: src/view/PreferencesPanel.cpp:496 +#: src/view/PreferencesPanel.cpp:516 +#: src/view/PreferencesPanel.cpp:727 +#: src/view/PreferencesPanel.cpp:746 +#: src/view/PreferencesPanel.cpp:784 +#: src/view/PreferencesPanel.cpp:790 #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 -#: src/view/AccountPanel.cpp:843 -#: src/view/grid/GridAccount.cpp:1288 -#: src/view/grid/GridAccount.cpp:1295 -#: src/view/grid/GridAccount.cpp:1414 -#: src/view/grid/GridAccount.cpp:1420 +#: src/view/AccountPanel.cpp:846 +#: src/view/grid/GridAccount.cpp:1289 +#: src/view/grid/GridAccount.cpp:1296 +#: src/view/grid/GridAccount.cpp:1415 +#: src/view/grid/GridAccount.cpp:1421 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 #: src/model/Database.cpp:45 #: src/model/Database.cpp:52 @@ -302,29 +328,33 @@ msgstr "Erreur" msgid "Error creating original database" msgstr "Erreur durant la création de la base de données initiale" -#: src/view/ImportPanel.cpp:71 +#: src/view/ImportPanel.cpp:73 msgid "File account" msgstr "Compte du fichier" -#: src/view/AccountPanel.cpp:111 +#: src/view/ImportPanel.cpp:81 +msgid "File category" +msgstr "Catégorie du fichier" + +#: src/view/AccountPanel.cpp:114 msgid "Final value" msgstr "Valeur finale" -#: src/view/SearchPanel.cpp:84 +#: src/view/SearchPanel.cpp:86 #: src/view/grid/GridAccount.cpp:345 #: src/controller/KissCount.cpp:355 msgid "Fix" msgstr "Fixe" -#: src/view/PreferencesPanel.cpp:294 +#: src/view/PreferencesPanel.cpp:295 msgid "Font" msgstr "Police" -#: src/view/PreferencesPanel.cpp:293 +#: src/view/PreferencesPanel.cpp:294 msgid "Foreground color" msgstr "Couleur d'avant plan" -#: src/view/StatsPanel.cpp:64 +#: src/view/StatsPanel.cpp:65 msgid "From" msgstr "De" @@ -333,15 +363,19 @@ msgid "From " msgstr "A partir de " #: src/view/GenerateDialog.cpp:31 -#: src/view/AccountPanel.cpp:703 +#: src/view/AccountPanel.cpp:706 msgid "Generate month" msgstr "Générer mois" +#: src/model/import/GrisbiImportEngine.cpp:185 +msgid "Grisbi files (*.gsb)|*.gsb" +msgstr "Fichiers Grisbi (*.gsb)|*.gsb" + #: src/controller/KissCount.cpp:355 msgid "Groceries" msgstr "Courses" -#: src/view/AccountPanel.cpp:130 +#: src/view/AccountPanel.cpp:133 msgid "Group" msgstr "Grouper" @@ -349,31 +383,39 @@ msgstr "Grouper" msgid "Hobbies" msgstr "Loisirs" -#: src/view/ImportPanel.cpp:107 +#: src/view/ImportPanel.cpp:123 msgid "Import" msgstr "Import" -#: src/view/AccountPanel.cpp:109 +#: src/view/AccountPanel.cpp:112 msgid "Initial value" msgstr "Valeur initiale" -#: src/view/ImportPanel.cpp:72 +#: src/view/ImportPanel.cpp:57 +msgid "Integrate operations" +msgstr "Intégrer les opérations" + +#: src/view/ImportPanel.cpp:75 msgid "Internal account" msgstr "Compte interne" -#: src/view/SearchPanel.cpp:189 +#: src/view/ImportPanel.cpp:83 +msgid "Internal category" +msgstr "Catégorie interne" + +#: src/view/SearchPanel.cpp:191 msgid "Invalid amount from" msgstr "Montant min invalide" -#: src/view/SearchPanel.cpp:214 +#: src/view/SearchPanel.cpp:216 msgid "Invalid amount range" msgstr "Intervalle des montants invalide" -#: src/view/SearchPanel.cpp:203 +#: src/view/SearchPanel.cpp:205 msgid "Invalid amount to" msgstr "Montant max invalide" -#: src/view/SearchPanel.cpp:179 +#: src/view/SearchPanel.cpp:181 msgid "Invalid date range" msgstr "Intervalle de temps invalide" @@ -381,7 +423,7 @@ msgstr "Intervalle de temps invalide" msgid "Invalid formula !" msgstr "Formule invalide !" -#: src/view/PreferencesPanel.cpp:783 +#: src/view/PreferencesPanel.cpp:784 msgid "Invalid name" msgstr "Nom invalide" @@ -389,19 +431,19 @@ msgstr "Nom invalide" msgid "Invalid old password" msgstr "Ancien mot de passe invalide" -#: src/view/UsersDialog.cpp:90 +#: src/view/UsersDialog.cpp:95 msgid "Invalid password" msgstr "Mot de passe invalide" -#: src/view/StatsPanel.cpp:377 +#: src/view/StatsPanel.cpp:380 msgid "Invalide date range" msgstr "Intervalle de temps invalide" -#: src/view/PreferencesPanel.cpp:435 +#: src/view/PreferencesPanel.cpp:436 msgid "It must be at least one account !" msgstr "Il doit y avoir au moins un compte !" -#: src/view/AccountPanel.cpp:843 +#: src/view/AccountPanel.cpp:846 msgid "It must be at least one month !" msgstr "Il doit rester au moins un mois" @@ -409,14 +451,14 @@ msgstr "Il doit rester au moins un mois" msgid "Kill me" msgstr "Kill me" -#: src/view/StatsPanel.cpp:377 -#: src/view/PreferencesPanel.cpp:823 -#: src/view/PreferencesPanel.cpp:826 +#: src/view/StatsPanel.cpp:380 +#: src/view/PreferencesPanel.cpp:824 +#: src/view/PreferencesPanel.cpp:827 #: src/model/Database_Update.cpp:140 msgid "KissCount" msgstr "KissCount" -#: src/view/ImportPanel.cpp:112 +#: src/view/ImportPanel.cpp:128 msgid "KissCount - Import" msgstr "KissCount - Import" @@ -424,30 +466,34 @@ msgstr "KissCount - Import" msgid "Language" msgstr "Langue" -#: src/view/PreferencesPanel.cpp:826 +#: src/view/PreferencesPanel.cpp:827 msgid "Language not changed" msgstr "Langue non changée" -#: src/view/PreferencesPanel.cpp:823 +#: src/view/PreferencesPanel.cpp:824 msgid "Language successfully changed, please go to another panel" msgstr "Langue changée, allez sur un autre panneau pour rendre le changement effectif" -#: src/view/AccountPanel.cpp:125 +#: src/view/ImportPanel.cpp:54 +msgid "Load operations" +msgstr "Charger les opérations" + +#: src/view/AccountPanel.cpp:128 msgid "Mode" msgstr "Mode" #: src/view/PreferencesPanel.cpp:72 #: src/view/PreferencesPanel.cpp:196 -#: src/view/PreferencesPanel.cpp:291 +#: src/view/PreferencesPanel.cpp:292 msgid "Name" msgstr "Nom" -#: src/view/PreferencesPanel.cpp:795 +#: src/view/PreferencesPanel.cpp:796 msgid "Name changed" msgstr "Nom changé" #: src/view/UsersDialog.cpp:53 -#: src/view/UsersDialog.cpp:109 +#: src/view/UsersDialog.cpp:114 msgid "New User" msgstr "Nouvel utilisateur" @@ -463,26 +509,26 @@ msgstr "" "Aucune base de données trouvée, voulez vous en créer une nouvelle ?\n" "\n" -#: src/view/SearchPanel.cpp:274 +#: src/view/SearchPanel.cpp:281 msgid "No entry found" msgstr "Pas d'entrée trouvée" -#: src/view/ImportPanel.cpp:267 +#: src/view/ImportPanel.cpp:357 msgid "No operation found into this file" msgstr "Aucun opération trouvée dans ce fichier" -#: src/view/SearchPanel.cpp:84 +#: src/view/SearchPanel.cpp:86 msgid "Non fix" msgstr "Courantes" -#: src/view/SearchPanel.cpp:304 -#: src/view/SearchPanel.cpp:346 -#: src/view/PreferencesPanel.cpp:440 -#: src/view/PreferencesPanel.cpp:701 +#: src/view/SearchPanel.cpp:311 +#: src/view/SearchPanel.cpp:353 +#: src/view/PreferencesPanel.cpp:441 +#: src/view/PreferencesPanel.cpp:702 msgid "None" msgstr "Aucun" -#: src/view/SearchPanel.cpp:84 +#: src/view/SearchPanel.cpp:86 msgid "Not checked" msgstr "Non rapprochée" @@ -490,7 +536,7 @@ msgstr "Non rapprochée" msgid "Number" msgstr "Numéro de compte" -#: src/model/import/OFXImportEngine.cpp:124 +#: src/model/import/OFXImportEngine.cpp:126 msgid "OFX files (*.ofx)|*.ofx" msgstr "Fichiers OFX (*.ofx)|*.ofx" @@ -504,20 +550,16 @@ msgstr "OK" msgid "Old password " msgstr "Ancien mot de passe " -#: src/controller/KissCount.cpp:355 -msgid "Operating expense" -msgstr "Fonctionnement" - #: src/view/PreferencesPanel.cpp:63 msgid "Operation order" msgstr "Ordre des opérations" -#: src/view/SearchPanel.cpp:98 -#: src/view/AccountPanel.cpp:179 +#: src/view/SearchPanel.cpp:100 +#: src/view/AccountPanel.cpp:182 msgid "Operations" msgstr "Opérations" -#: src/view/ImportPanel.cpp:292 +#: src/view/ImportPanel.cpp:382 msgid "Operations successfully imported" msgstr "les opérations ont été importées avec succès" @@ -525,7 +567,7 @@ msgstr "les opérations ont été importées avec succès" msgid "Other" msgstr "Autres" -#: src/view/UsersDialog.cpp:44 +#: src/view/UsersDialog.cpp:45 msgid "Password " msgstr "Mot de passe " @@ -556,8 +598,8 @@ msgid "Please retype new password" msgstr "Re entrez le mot de passe" #: src/view/PreferencesPanel.cpp:184 -#: src/view/PreferencesPanel.cpp:797 -#: src/view/PreferencesPanel.cpp:831 +#: src/view/PreferencesPanel.cpp:798 +#: src/view/PreferencesPanel.cpp:832 msgid "Preferences" msgstr "Préférences" @@ -565,26 +607,30 @@ msgstr "Préférences" msgid "Quit KissCount ?" msgstr "Quitter KissCount ?" -#: src/view/AccountPanel.cpp:124 +#: src/view/AccountPanel.cpp:127 msgid "Real" msgstr "Réel" -#: src/view/AccountPanel.cpp:221 +#: src/view/AccountPanel.cpp:224 msgid "Remains" msgstr "Restant" -#: src/view/SearchPanel.cpp:127 +#: src/view/SearchPanel.cpp:129 msgid "Rename" msgstr "Renommer" -#: src/view/SearchPanel.cpp:92 -#: src/view/SearchPanel.cpp:164 -#: src/view/SearchPanel.cpp:409 +#: src/view/ImportPanel.cpp:60 +msgid "Save import patterns" +msgstr "Sauvegarder les motifs d'import" + +#: src/view/SearchPanel.cpp:94 +#: src/view/SearchPanel.cpp:166 +#: src/view/SearchPanel.cpp:416 msgid "Search" msgstr "Chercher" -#: src/view/StatsPanel.cpp:120 -#: src/view/AccountPanel.cpp:92 +#: src/view/StatsPanel.cpp:123 +#: src/view/AccountPanel.cpp:94 msgid "Serie 1" msgstr "Série 1" @@ -592,12 +638,12 @@ msgstr "Série 1" msgid "Shared with" msgstr "Partagé avec" -#: src/view/StatsPanel.cpp:160 -#: src/view/StatsPanel.cpp:358 +#: src/view/StatsPanel.cpp:163 +#: src/view/StatsPanel.cpp:361 msgid "Statistics" msgstr "Statistiques" -#: src/view/StatsPanel.cpp:69 +#: src/view/StatsPanel.cpp:70 msgid "To" msgstr "A" @@ -605,15 +651,15 @@ msgstr "A" msgid "To " msgstr "Vers " -#: src/view/AccountPanel.cpp:203 +#: src/view/AccountPanel.cpp:206 msgid "Total Credit" msgstr "Total Crédit" -#: src/view/AccountPanel.cpp:204 +#: src/view/AccountPanel.cpp:207 msgid "Total Debit" msgstr "Total Débit" -#: src/view/AccountPanel.cpp:131 +#: src/view/AccountPanel.cpp:134 msgid "UnGroup" msgstr "Dégrouper" @@ -633,50 +679,57 @@ msgstr "Impossible d'ouvrir la base de données" msgid "Unexpected" msgstr "Exceptionnel" -#: src/view/SearchPanel.cpp:80 -#: src/view/SearchPanel.cpp:88 +#: src/view/SearchPanel.cpp:82 +#: src/view/SearchPanel.cpp:90 +#: src/view/AccountPanel.cpp:515 +#: src/view/AccountPanel.cpp:551 +#: src/view/AccountPanel.cpp:589 #: src/model/User.cpp:59 #: src/model/User.cpp:79 #: src/model/User.cpp:127 msgid "Unknown" msgstr "Inconnu" -#: src/view/ImportPanel.cpp:41 +#: src/view/ImportPanel.cpp:42 msgid "Unresolved accounts" msgstr "Comptes non résolus" +#: src/view/ImportPanel.cpp:43 +msgid "Unresolved categories" +msgstr "Catégories non résolues" + #: src/view/PreferencesPanel.cpp:59 msgid "User" msgstr "Utilisateur" -#: src/view/UsersDialog.cpp:39 -#: src/view/UsersDialog.cpp:120 -#: src/view/PreferencesPanel.cpp:789 +#: src/view/UsersDialog.cpp:40 +#: src/view/UsersDialog.cpp:125 +#: src/view/PreferencesPanel.cpp:790 msgid "User " msgstr "Utilisateur " -#: src/view/UsersDialog.cpp:30 +#: src/view/UsersDialog.cpp:31 msgid "Users" msgstr "Utilisateurs" #: src/view/PreferencesPanel.cpp:199 -#: src/view/AccountPanel.cpp:124 +#: src/view/AccountPanel.cpp:127 msgid "Virtual" msgstr "Virtuel" -#: src/view/grid/GridAccount.cpp:1065 +#: src/view/grid/GridAccount.cpp:1066 msgid "Warning" msgstr "Attention" -#: src/view/PreferencesPanel.cpp:445 +#: src/view/PreferencesPanel.cpp:446 msgid "Wich account will replace this one ?" msgstr "Quel compte va remplacer celui-ci ?" -#: src/view/PreferencesPanel.cpp:706 +#: src/view/PreferencesPanel.cpp:707 msgid "Wich category will replace this one ?" msgstr "Quelle catégorie va remplacer celle-ci" -#: src/view/grid/GridAccount.cpp:1065 +#: src/view/grid/GridAccount.cpp:1066 msgid "You made a debit on a blocked account" msgstr "Vous avez effectué une opération de débit sur un compte bloqué" @@ -728,22 +781,32 @@ msgstr "octobre" msgid "september" msgstr "septembre" +#~ msgid "Operating expense" +#~ msgstr "Fonctionnement" + #~ msgid "Check mode" #~ msgstr "Mode rapprochement" + #~ msgid "Query failed !\n" #~ msgstr "La requête a échouée !\n" + #~ msgid "Update failed !\n" #~ msgstr "La mise à jour à échouée !\n" + #~ msgid "About" #~ msgstr "A propos" + #~ msgid "Change user" #~ msgstr "Changer d'utilisateur" + #~ msgid "Quit" #~ msgstr "Quitter" + #~ msgid "Both" #~ msgstr "Les deux" + #~ msgid "Color" #~ msgstr "Couleur" + #~ msgid "Fixe" #~ msgstr "Fixe" - diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index b945f85..48b9dc6 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-03 19:13+0200\n" +"POT-Creation-Date: 2011-04-26 21:01+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,21 +17,21 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/view/StatsPanel.cpp:358 src/view/PreferencesPanel.cpp:832 +#: src/view/StatsPanel.cpp:361 src/view/PreferencesPanel.cpp:832 msgid " - " msgstr "" -#: src/view/ImportPanel.cpp:222 -msgid " account(s) will be created, is it ok ?" -msgstr "" - -#: src/view/UsersDialog.cpp:120 src/view/PreferencesPanel.cpp:496 +#: src/view/UsersDialog.cpp:125 src/view/PreferencesPanel.cpp:496 #: src/view/PreferencesPanel.cpp:516 src/view/PreferencesPanel.cpp:727 #: src/view/PreferencesPanel.cpp:746 src/view/PreferencesPanel.cpp:790 msgid " already exists" msgstr "" -#: src/view/SearchPanel.cpp:269 +#: src/view/ImportPanel.cpp:284 +msgid " and " +msgstr "" + +#: src/view/SearchPanel.cpp:276 msgid " entries found" msgstr "" @@ -39,7 +39,7 @@ msgstr "" msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:852 +#: src/view/AccountPanel.cpp:855 msgid " operations ?" msgstr "" @@ -47,15 +47,29 @@ msgstr "" msgid " profil ?" msgstr "" +#: src/view/ImportPanel.cpp:290 +msgid " will be created, is it ok ?" +msgstr "" + #: src/model/Database.cpp:92 msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "" -#: src/view/SearchPanel.cpp:271 +#: src/view/ImportPanel.cpp:283 +#, c-format +msgid "%d accounts" +msgstr "" + +#: src/view/ImportPanel.cpp:288 +#, c-format +msgid "%d categories" +msgstr "" + +#: src/view/SearchPanel.cpp:278 msgid "1 entry found" msgstr "" -#: src/view/SearchPanel.cpp:99 src/view/grid/GridAccount.cpp:68 +#: src/view/SearchPanel.cpp:101 src/view/grid/GridAccount.cpp:68 msgid "Account" msgstr "" @@ -67,31 +81,31 @@ msgstr "" msgid "Account 1" msgstr "" -#: src/view/AccountPanel.cpp:108 +#: src/view/ImportPanel.cpp:74 src/view/AccountPanel.cpp:111 msgid "Account name" msgstr "" -#: src/view/AccountPanel.cpp:107 +#: src/view/AccountPanel.cpp:110 msgid "Account number" msgstr "" -#: src/view/StatsPanel.cpp:323 src/view/PreferencesPanel.cpp:60 +#: src/view/StatsPanel.cpp:326 src/view/PreferencesPanel.cpp:60 msgid "Accounts" msgstr "" -#: src/view/SearchPanel.cpp:95 +#: src/view/SearchPanel.cpp:97 msgid "Amount from" msgstr "" -#: src/view/SearchPanel.cpp:96 +#: src/view/SearchPanel.cpp:98 msgid "Amount to" msgstr "" -#: src/view/ImportPanel.cpp:156 +#: src/view/ImportPanel.cpp:177 msgid "Any engine can process this file !" msgstr "" -#: src/view/PreferencesPanel.cpp:839 src/view/AccountPanel.cpp:847 +#: src/view/PreferencesPanel.cpp:839 src/view/AccountPanel.cpp:850 msgid "Are you sure want to delete " msgstr "" @@ -99,7 +113,7 @@ msgstr "" msgid "Are you sure want to delete : \n" msgstr "" -#: src/view/ImportPanel.cpp:277 +#: src/view/ImportPanel.cpp:367 msgid "Are you sure want to integrate these operations ?" msgstr "" @@ -128,11 +142,15 @@ msgstr "" msgid "Cannot ungroup these operations" msgstr "" +#: src/controller/KissCount.cpp:355 +msgid "Car" +msgstr "" + #: src/view/PreferencesPanel.cpp:61 msgid "Categories" msgstr "" -#: src/view/SearchPanel.cpp:97 src/view/grid/GridAccount.cpp:68 +#: src/view/SearchPanel.cpp:99 src/view/grid/GridAccount.cpp:68 msgid "Category" msgstr "" @@ -140,6 +158,10 @@ msgstr "" msgid "Category " msgstr "" +#: src/view/ImportPanel.cpp:82 +msgid "Category name" +msgstr "" + #: src/view/PreferencesPanel.cpp:78 msgid "Change Name" msgstr "" @@ -148,11 +170,11 @@ msgstr "" msgid "Change Password" msgstr "" -#: src/view/SearchPanel.cpp:125 +#: src/view/SearchPanel.cpp:127 msgid "Change account" msgstr "" -#: src/view/SearchPanel.cpp:126 +#: src/view/SearchPanel.cpp:128 msgid "Change category" msgstr "" @@ -160,23 +182,23 @@ msgstr "" msgid "Change password" msgstr "" -#: src/view/AccountPanel.cpp:124 +#: src/view/AccountPanel.cpp:127 msgid "Check" msgstr "" -#: src/view/SearchPanel.cpp:84 +#: src/view/SearchPanel.cpp:86 msgid "Checked" msgstr "" -#: src/view/ImportPanel.cpp:117 +#: src/view/ImportPanel.cpp:133 msgid "Choose a database to open" msgstr "" -#: src/view/SearchPanel.cpp:309 +#: src/view/SearchPanel.cpp:316 msgid "Choose a new account" msgstr "" -#: src/view/SearchPanel.cpp:351 +#: src/view/SearchPanel.cpp:358 msgid "Choose a new category" msgstr "" @@ -184,12 +206,13 @@ msgstr "" msgid "Confirm password " msgstr "" -#: src/view/StatsPanel.cpp:128 src/view/AccountPanel.cpp:118 +#: src/view/StatsPanel.cpp:131 src/view/AccountPanel.cpp:121 msgid "Cost repartition" msgstr "" -#: src/view/ImportPanel.cpp:168 src/view/ImportPanel.cpp:215 -#: src/view/ImportPanel.cpp:230 +#: src/view/ImportPanel.cpp:189 src/view/ImportPanel.cpp:219 +#: src/view/ImportPanel.cpp:261 src/view/ImportPanel.cpp:270 +#: src/view/ImportPanel.cpp:298 src/view/ImportPanel.cpp:319 msgid "Create one" msgstr "" @@ -197,15 +220,15 @@ msgstr "" msgid "Credit" msgstr "" -#: src/view/AccountPanel.cpp:219 +#: src/view/AccountPanel.cpp:222 msgid "Cur Credit" msgstr "" -#: src/view/AccountPanel.cpp:220 +#: src/view/AccountPanel.cpp:223 msgid "Cur Debit" msgstr "" -#: src/view/AccountPanel.cpp:110 +#: src/view/AccountPanel.cpp:113 msgid "Current value" msgstr "" @@ -213,11 +236,11 @@ msgstr "" msgid "Date" msgstr "" -#: src/view/SearchPanel.cpp:56 +#: src/view/SearchPanel.cpp:57 msgid "Date from" msgstr "" -#: src/view/SearchPanel.cpp:57 +#: src/view/SearchPanel.cpp:58 msgid "Date to" msgstr "" @@ -230,7 +253,7 @@ msgid "Default" msgstr "" #: src/view/PreferencesPanel.cpp:201 src/view/PreferencesPanel.cpp:296 -#: src/view/AccountPanel.cpp:706 +#: src/view/AccountPanel.cpp:709 msgid "Delete" msgstr "" @@ -238,22 +261,22 @@ msgstr "" msgid "Descending" msgstr "" -#: src/view/SearchPanel.cpp:94 src/view/grid/GridAccount.cpp:68 +#: src/view/SearchPanel.cpp:96 src/view/grid/GridAccount.cpp:68 msgid "Description" msgstr "" -#: src/view/SearchPanel.cpp:393 +#: src/view/SearchPanel.cpp:400 msgid "Enter a new description" msgstr "" -#: src/view/UsersDialog.cpp:90 src/view/UsersDialog.cpp:120 -#: src/view/SearchPanel.cpp:179 src/view/SearchPanel.cpp:189 -#: src/view/SearchPanel.cpp:203 src/view/SearchPanel.cpp:214 +#: src/view/UsersDialog.cpp:95 src/view/UsersDialog.cpp:125 +#: src/view/SearchPanel.cpp:181 src/view/SearchPanel.cpp:191 +#: src/view/SearchPanel.cpp:205 src/view/SearchPanel.cpp:216 #: src/view/PreferencesPanel.cpp:436 src/view/PreferencesPanel.cpp:496 #: src/view/PreferencesPanel.cpp:516 src/view/PreferencesPanel.cpp:727 #: src/view/PreferencesPanel.cpp:746 src/view/PreferencesPanel.cpp:784 #: src/view/PreferencesPanel.cpp:790 src/view/PasswordDialog.cpp:72 -#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:843 +#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:846 #: src/view/grid/GridAccount.cpp:1289 src/view/grid/GridAccount.cpp:1296 #: src/view/grid/GridAccount.cpp:1415 src/view/grid/GridAccount.cpp:1421 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:45 @@ -268,15 +291,19 @@ msgstr "" msgid "Error creating original database" msgstr "" -#: src/view/ImportPanel.cpp:71 +#: src/view/ImportPanel.cpp:73 msgid "File account" msgstr "" -#: src/view/AccountPanel.cpp:111 +#: src/view/ImportPanel.cpp:81 +msgid "File category" +msgstr "" + +#: src/view/AccountPanel.cpp:114 msgid "Final value" msgstr "" -#: src/view/SearchPanel.cpp:84 src/view/grid/GridAccount.cpp:345 +#: src/view/SearchPanel.cpp:86 src/view/grid/GridAccount.cpp:345 #: src/controller/KissCount.cpp:355 msgid "Fix" msgstr "" @@ -289,7 +316,7 @@ msgstr "" msgid "Foreground color" msgstr "" -#: src/view/StatsPanel.cpp:64 +#: src/view/StatsPanel.cpp:65 msgid "From" msgstr "" @@ -297,15 +324,19 @@ msgstr "" msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:703 +#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:706 msgid "Generate month" msgstr "" +#: src/model/import/GrisbiImportEngine.cpp:185 +msgid "Grisbi files (*.gsb)|*.gsb" +msgstr "" + #: src/controller/KissCount.cpp:355 msgid "Groceries" msgstr "" -#: src/view/AccountPanel.cpp:130 +#: src/view/AccountPanel.cpp:133 msgid "Group" msgstr "" @@ -313,31 +344,39 @@ msgstr "" msgid "Hobbies" msgstr "" -#: src/view/ImportPanel.cpp:107 +#: src/view/ImportPanel.cpp:123 msgid "Import" msgstr "" -#: src/view/AccountPanel.cpp:109 +#: src/view/AccountPanel.cpp:112 msgid "Initial value" msgstr "" -#: src/view/ImportPanel.cpp:72 +#: src/view/ImportPanel.cpp:57 +msgid "Integrate operations" +msgstr "" + +#: src/view/ImportPanel.cpp:75 msgid "Internal account" msgstr "" -#: src/view/SearchPanel.cpp:189 +#: src/view/ImportPanel.cpp:83 +msgid "Internal category" +msgstr "" + +#: src/view/SearchPanel.cpp:191 msgid "Invalid amount from" msgstr "" -#: src/view/SearchPanel.cpp:214 +#: src/view/SearchPanel.cpp:216 msgid "Invalid amount range" msgstr "" -#: src/view/SearchPanel.cpp:203 +#: src/view/SearchPanel.cpp:205 msgid "Invalid amount to" msgstr "" -#: src/view/SearchPanel.cpp:179 +#: src/view/SearchPanel.cpp:181 msgid "Invalid date range" msgstr "" @@ -353,11 +392,11 @@ msgstr "" msgid "Invalid old password" msgstr "" -#: src/view/UsersDialog.cpp:90 +#: src/view/UsersDialog.cpp:95 msgid "Invalid password" msgstr "" -#: src/view/StatsPanel.cpp:377 +#: src/view/StatsPanel.cpp:380 msgid "Invalide date range" msgstr "" @@ -365,7 +404,7 @@ msgstr "" msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:843 +#: src/view/AccountPanel.cpp:846 msgid "It must be at least one month !" msgstr "" @@ -373,12 +412,12 @@ msgstr "" msgid "Kill me" msgstr "" -#: src/view/StatsPanel.cpp:377 src/view/PreferencesPanel.cpp:824 +#: src/view/StatsPanel.cpp:380 src/view/PreferencesPanel.cpp:824 #: src/view/PreferencesPanel.cpp:827 src/model/Database_Update.cpp:140 msgid "KissCount" msgstr "" -#: src/view/ImportPanel.cpp:112 +#: src/view/ImportPanel.cpp:128 msgid "KissCount - Import" msgstr "" @@ -394,7 +433,11 @@ msgstr "" msgid "Language successfully changed, please go to another panel" msgstr "" -#: src/view/AccountPanel.cpp:125 +#: src/view/ImportPanel.cpp:54 +msgid "Load operations" +msgstr "" + +#: src/view/AccountPanel.cpp:128 msgid "Mode" msgstr "" @@ -407,7 +450,7 @@ msgstr "" msgid "Name changed" msgstr "" -#: src/view/UsersDialog.cpp:53 src/view/UsersDialog.cpp:109 +#: src/view/UsersDialog.cpp:53 src/view/UsersDialog.cpp:114 msgid "New User" msgstr "" @@ -421,24 +464,24 @@ msgid "" "\n" msgstr "" -#: src/view/SearchPanel.cpp:274 +#: src/view/SearchPanel.cpp:281 msgid "No entry found" msgstr "" -#: src/view/ImportPanel.cpp:267 +#: src/view/ImportPanel.cpp:357 msgid "No operation found into this file" msgstr "" -#: src/view/SearchPanel.cpp:84 +#: src/view/SearchPanel.cpp:86 msgid "Non fix" msgstr "" -#: src/view/SearchPanel.cpp:304 src/view/SearchPanel.cpp:346 +#: src/view/SearchPanel.cpp:311 src/view/SearchPanel.cpp:353 #: src/view/PreferencesPanel.cpp:441 src/view/PreferencesPanel.cpp:702 msgid "None" msgstr "" -#: src/view/SearchPanel.cpp:84 +#: src/view/SearchPanel.cpp:86 msgid "Not checked" msgstr "" @@ -446,7 +489,7 @@ msgstr "" msgid "Number" msgstr "" -#: src/model/import/OFXImportEngine.cpp:124 +#: src/model/import/OFXImportEngine.cpp:126 msgid "OFX files (*.ofx)|*.ofx" msgstr "" @@ -459,19 +502,15 @@ msgstr "" msgid "Old password " msgstr "" -#: src/controller/KissCount.cpp:355 -msgid "Operating expense" -msgstr "" - #: src/view/PreferencesPanel.cpp:63 msgid "Operation order" msgstr "" -#: src/view/SearchPanel.cpp:98 src/view/AccountPanel.cpp:179 +#: src/view/SearchPanel.cpp:100 src/view/AccountPanel.cpp:182 msgid "Operations" msgstr "" -#: src/view/ImportPanel.cpp:292 +#: src/view/ImportPanel.cpp:382 msgid "Operations successfully imported" msgstr "" @@ -479,7 +518,7 @@ msgstr "" msgid "Other" msgstr "" -#: src/view/UsersDialog.cpp:44 +#: src/view/UsersDialog.cpp:45 msgid "Password " msgstr "" @@ -511,24 +550,28 @@ msgstr "" msgid "Quit KissCount ?" msgstr "" -#: src/view/AccountPanel.cpp:124 +#: src/view/AccountPanel.cpp:127 msgid "Real" msgstr "" -#: src/view/AccountPanel.cpp:221 +#: src/view/AccountPanel.cpp:224 msgid "Remains" msgstr "" -#: src/view/SearchPanel.cpp:127 +#: src/view/SearchPanel.cpp:129 msgid "Rename" msgstr "" -#: src/view/SearchPanel.cpp:92 src/view/SearchPanel.cpp:164 -#: src/view/SearchPanel.cpp:409 +#: src/view/ImportPanel.cpp:60 +msgid "Save import patterns" +msgstr "" + +#: src/view/SearchPanel.cpp:94 src/view/SearchPanel.cpp:166 +#: src/view/SearchPanel.cpp:416 msgid "Search" msgstr "" -#: src/view/StatsPanel.cpp:120 src/view/AccountPanel.cpp:92 +#: src/view/StatsPanel.cpp:123 src/view/AccountPanel.cpp:94 msgid "Serie 1" msgstr "" @@ -536,11 +579,11 @@ msgstr "" msgid "Shared with" msgstr "" -#: src/view/StatsPanel.cpp:160 src/view/StatsPanel.cpp:358 +#: src/view/StatsPanel.cpp:163 src/view/StatsPanel.cpp:361 msgid "Statistics" msgstr "" -#: src/view/StatsPanel.cpp:69 +#: src/view/StatsPanel.cpp:70 msgid "To" msgstr "" @@ -548,15 +591,15 @@ msgstr "" msgid "To " msgstr "" -#: src/view/AccountPanel.cpp:203 +#: src/view/AccountPanel.cpp:206 msgid "Total Credit" msgstr "" -#: src/view/AccountPanel.cpp:204 +#: src/view/AccountPanel.cpp:207 msgid "Total Debit" msgstr "" -#: src/view/AccountPanel.cpp:131 +#: src/view/AccountPanel.cpp:134 msgid "UnGroup" msgstr "" @@ -573,29 +616,35 @@ msgstr "" msgid "Unexpected" msgstr "" -#: src/view/SearchPanel.cpp:80 src/view/SearchPanel.cpp:88 -#: src/model/User.cpp:59 src/model/User.cpp:79 src/model/User.cpp:127 +#: src/view/SearchPanel.cpp:82 src/view/SearchPanel.cpp:90 +#: src/view/AccountPanel.cpp:515 src/view/AccountPanel.cpp:551 +#: src/view/AccountPanel.cpp:589 src/model/User.cpp:59 src/model/User.cpp:79 +#: src/model/User.cpp:127 msgid "Unknown" msgstr "" -#: src/view/ImportPanel.cpp:41 +#: src/view/ImportPanel.cpp:42 msgid "Unresolved accounts" msgstr "" +#: src/view/ImportPanel.cpp:43 +msgid "Unresolved categories" +msgstr "" + #: src/view/PreferencesPanel.cpp:59 msgid "User" msgstr "" -#: src/view/UsersDialog.cpp:39 src/view/UsersDialog.cpp:120 +#: src/view/UsersDialog.cpp:40 src/view/UsersDialog.cpp:125 #: src/view/PreferencesPanel.cpp:790 msgid "User " msgstr "" -#: src/view/UsersDialog.cpp:30 +#: src/view/UsersDialog.cpp:31 msgid "Users" msgstr "" -#: src/view/PreferencesPanel.cpp:199 src/view/AccountPanel.cpp:124 +#: src/view/PreferencesPanel.cpp:199 src/view/AccountPanel.cpp:127 msgid "Virtual" msgstr "" diff --git a/src/view/ImportPanel.cpp b/src/view/ImportPanel.cpp index d00a9d0..9b4b9e0 100644 --- a/src/view/ImportPanel.cpp +++ b/src/view/ImportPanel.cpp @@ -51,13 +51,13 @@ ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _fileTxt->SetMinSize(size); buttonOpen = new wxButton(this, BUTTON_OPEN_ID, wxT("...")); - _buttonLoadOperations = new wxButton(this, BUTTON_LOAD_ID, wxT("Load operations")); + _buttonLoadOperations = new wxButton(this, BUTTON_LOAD_ID, _("Load operations")); _buttonLoadOperations->Disable(); - _buttonIntegrate = new wxButton(this, BUTTON_INTEGRATE_ID, wxT("Integrate operations")); + _buttonIntegrate = new wxButton(this, BUTTON_INTEGRATE_ID, _("Integrate operations")); _buttonIntegrate->Disable(); - _checkSaveImportPatterns = new wxCheckBox(this, CHECK_SAVE_ID, wxT("Save import patterns")); + _checkSaveImportPatterns = new wxCheckBox(this, CHECK_SAVE_ID, _("Save import patterns")); hbox->Add(_fileTxt, 0, wxGROW|wxALL, 5); hbox->Add(buttonOpen, 0, wxALL, 5); @@ -280,12 +280,12 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) if (nbAccounts) { - message += wxString::Format(wxT("%d accounts"), nbAccounts); - if (nbCategories) message += wxT(" and "); + message += wxString::Format(_("%d accounts"), nbAccounts); + if (nbCategories) message += _(" and "); } if (nbCategories) - message += wxString::Format(wxT("%d categories"), nbCategories); + message += wxString::Format(_("%d categories"), nbCategories); message += _(" will be created, is it ok ?"); From 8f5a651c5bf6c78c04f18ab2358617f988ab0c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 30 Apr 2011 12:37:16 +0200 Subject: [PATCH 61/72] Add update next months feature --- ChangeLog | 3 +- src/view/AccountPanel.cpp | 112 +++++++++++++++++++++++++++++++++++++- src/view/AccountPanel.h | 1 + 3 files changed, 114 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45ff72d..2788bd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2 (26/04/2011) +v0.2 (30/04/2011) ** User ** Better use of sizers (so better interface!) @@ -15,6 +15,7 @@ v0.2 (26/04/2011) Database is now at ~/.kisscount/kc.bdd Add Debian's packages !! Add Import Panel, OFX and Grisbi imports + Add update next months ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 704ca01..c9fe1a5 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -21,7 +21,7 @@ enum {ACCOUNT_NUMBER, ACCOUNT_NAME, ACCOUNT_INIT, ACCOUNT_CUR, ACCOUNT_FINAL, NUMBER_COLS_ACCOUNTS}; enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, REMAINS, STATS_ROW, CATS_STATS}; -enum {CALENDAR_TREE_ID=1, OPS_GRID_ID, CALENDAR_ID, ACCOUNTS_GRID_ID, MENU_GENERATE_ID, MENU_DELETE_ID, DISPLAY_MODE_ID, GROUP_ID, UNGROUP_ID}; +enum {CALENDAR_TREE_ID=1, OPS_GRID_ID, CALENDAR_ID, ACCOUNTS_GRID_ID, MENU_GENERATE_ID, MENU_DELETE_ID, DISPLAY_MODE_ID, GROUP_ID, UNGROUP_ID, UPDATE_NEXT_MONTHS_ID}; enum {VIRTUAL_MODE=0, REAL_MODE, CHECK_MODE}; @@ -38,6 +38,7 @@ EVT_CALENDAR_SEL_CHANGED(CALENDAR_ID, AccountPanel::OnCalendarChange) EVT_RADIOBOX(DISPLAY_MODE_ID, AccountPanel::OnModeChange) EVT_BUTTON(GROUP_ID, AccountPanel::OnGroup) EVT_BUTTON(UNGROUP_ID, AccountPanel::OnUnGroup) +EVT_BUTTON(UPDATE_NEXT_MONTHS_ID, AccountPanel::OnUpdateNextMonths) END_EVENT_TABLE() AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _curMonth(-1), _curYear(-1), _tree(this, CALENDAR_TREE_ID, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT) @@ -132,8 +133,10 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare wxButton* buttonGroup = new wxButton(this, GROUP_ID, _("Group")); wxButton* buttonUnGroup = new wxButton(this, UNGROUP_ID, _("UnGroup")); + wxButton* buttonUpdateNextMonths = new wxButton(this, UPDATE_NEXT_MONTHS_ID, _("Update next months")); vbox3->Add(&_tree, 0, wxGROW|wxALL, 2); + vbox3->Add(buttonUpdateNextMonths, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); vbox3->Add(buttonGroup, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); vbox3->Add(buttonUnGroup, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); @@ -985,3 +988,110 @@ void AccountPanel::OnUnGroup(wxCommandEvent& event) { _grid->UnGroup(); } + +void AccountPanel::OnUpdateNextMonths(wxCommandEvent& event) +{ + double* deltas, *cur_amounts, amount; + int i, a; + User* user = _kiss->GetUser(); + bool had_values, accounts_updated = false; + int last_month = 0, last_year = 0, account_updated = 0; + std::map > operations; + + deltas = new double[user->_accounts.size()] ; + cur_amounts = new double[user->_accounts.size()] ; + + operations = _kiss->GetAllOperations(); + + if (_curMonth == 11) + { + last_month = 0; + last_year = _curYear+1; + } + else + { + last_month = _curMonth+1; + last_year = _curYear; + } + + for (i=0; i<(int)user->_accounts.size(); i++) + { + deltas[i] = _kiss->GetAccountAmount(user->_accounts[i].id, _curMonth, _curYear); + cur_amounts[i] = deltas[i] += _kiss->CalcAccountAmount(user->_accounts[i].id, _curMonth, _curYear, &had_values); + + for (a=0; a<(int)operations[last_year].size(); a++) + if (operations[last_year][a] == last_month) break; + + if (a == (int)operations[last_year].size()) + { + deltas[i] = 0; + continue; + } + + amount = _kiss->GetAccountAmount(user->_accounts[i].id, last_month, last_year); + + deltas[i] -= amount; + + account_updated++; + } + + if (!account_updated) + goto end; + + last_month = _curMonth; + last_year = _curYear; + + while (1) + { + account_updated = 0; + + if (last_month == 11) + { + last_month = 0; + last_year = last_year+1; + } + else + last_month++; + + for (i=0; i<(int)user->_accounts.size(); i++) + { + if (deltas[i] == 0.0) continue; + + amount = _kiss->GetAccountAmount(user->_accounts[i].id, last_month, last_year); + if ((cur_amounts[i] - amount) != deltas[i]) continue; + + cur_amounts[i] = amount + deltas[i]; + _kiss->SetAccountAmount(last_month, last_year, user->_accounts[i].id, cur_amounts[i]); + cur_amounts[i] += _kiss->CalcAccountAmount(user->_accounts[i].id, last_month, last_year, &had_values); + + account_updated++; + } + + if (!account_updated) break; + + accounts_updated = true; + } + + if (last_month == 0) + { + last_month = 11; + last_year--; + } + else + last_month--; + +end: + if (accounts_updated) + { + wxString message = _("Accounts updated until ") + months[last_month]; + + message += wxT(" ") + wxString::Format(wxT("%d"), last_year); + + wxMessageBox(message, wxT("KissCount"), wxICON_INFORMATION | wxOK); + } + else + wxMessageBox(_("Any account updated !"), wxT("KissCount"), wxICON_INFORMATION | wxOK); + + delete[] deltas; + delete[] cur_amounts; +} diff --git a/src/view/AccountPanel.h b/src/view/AccountPanel.h index 3cedd38..a96dd4e 100644 --- a/src/view/AccountPanel.h +++ b/src/view/AccountPanel.h @@ -62,6 +62,7 @@ public: void OnModeChange(wxCommandEvent& event); void OnGroup(wxCommandEvent& event); void OnUnGroup(wxCommandEvent& event); + void OnUpdateNextMonths(wxCommandEvent& event); int _curMonth, _curYear; From 9c096b084605998913453ba80714c3a24d33aae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 30 Apr 2011 12:38:31 +0200 Subject: [PATCH 62/72] Update translations --- ressources/po/french.mo | Bin 9519 -> 9717 bytes ressources/po/french.po | 70 +++++++++++++++++++++--------------- ressources/po/kisscount.pot | 68 ++++++++++++++++++++--------------- 3 files changed, 81 insertions(+), 57 deletions(-) diff --git a/ressources/po/french.mo b/ressources/po/french.mo index 3b52d83e066a9c02178e1ce4467046b61d814178..70fd673e60a635598ba32a16af99d8105652bd51 100644 GIT binary patch delta 3827 zcmYk;c~F#f9LMn=2mu=EqT-1@9)t&);(C)G0Z;H z#1Gm1&#mWB6}*N~jBl>fXpXl~rHpljR?-gnXZrHNS0)2Bfr+Sz&b0e()I>^96Ip^0 zxZWP$j9Op?YT*5L|2+(-qiP!J_$X=xCr~B+9(BQWbns8qEs2W@4b%p8epgh5`k@9M zh??*ayFV7yPd2I|Q?LcP}t!O{0GS#S#ze46>E?^`4-F_d& zj*iD8hfGJiKL9oHOjJKPsD6qXQGeQI5g%=F6Y8EHLQSLwHNi`$4u3`6`+KO4BKYWs z%~AJ!EUE%|)&kVPZq#)PPzzd$x~@DxLnZkdHG%V}f$yU_ir|q}iDOU|X@a^ntuP#W zp*l=OO&}e0E3?qSX{gdKMlECoYUSm)1_Qfk=w5V-4-GT|bwUjBqn?c;s7f3~op%!HH(<`u&^^0|TG>rh2T|;3;5ek(rUf!r z(+zbi(oho|k6Pg*>vYt01=eEhzwr4HE2`AJaZ;EugHY#f=N;Fru0&1zAnN%uAJb4tzqBV@M0IcjJL4T3 zhi$n}s?2;;M~hLFSdUu39{c?P)P$;0&&Fq{3ZFtv@DjGhpE00&5!o_yPh7}kO#Vh-xyo~v+cyb3w8Yf)H9QTEYeIt^;e2|2+L6u+L=K8)xkav zXht8QUZYP@_vjl`DZjH`K$ZF`s)OsOO58$q`~cNoUFxe_8jm`^3--qp)Pmfo1qA{$ zw35xJ0r#LTcpKHhLDXw>95uiR)C$icW0@9Yfw^1u_Iid5CP|r#l@|7t>O=uOWLglD_wxK5W zK5~l!rkchm4xB{Yqh|aJsuJB%uT5`MN&BHXNJkBvjlRL7H11A4Is22eBp5Ou4Lpw9mS*Wv|KX$#wjzF&%Z z_{vce*o&&fyBLjCs0tm`KI5Ao>=)Ni1N?z1^?eM(80x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cl{PVbgU>)3s>1@*YdH_K0*g>f??XKk8&N+*hfphU1l8_Y z)D~XAOl-lx|Nl|^^`O0Sp>9aVI`p8H_PjlR1@-XVKn>slY9+$^2cMzN$Rd~?_BhL$ zi)w!|YNh937%s*LhsqLrL8-l9HR`F|j2d}84!{O`{(Dr%t*8P2h8pNy)C^dt^Z+1jwAU|kX^6?#-gr| zM_r$cY9|df^HoI06vvF_vzEL>b`zD&K>~wO^<|=l$C9IDAbE;@JxSwucGjTnZELh Z5-#^HFE@|tCDs0siCd!mEvYGC{{wV@Hktqc diff --git a/ressources/po/french.po b/ressources/po/french.po index 62b6dc4..e2aa3d0 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-26 21:01+0200\n" +"POT-Creation-Date: 2011-04-30 12:37+0200\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -45,7 +45,7 @@ msgstr " entrées trouvées" msgid " not found, aborting" msgstr " non trouvé, arrêt" -#: src/view/AccountPanel.cpp:855 +#: src/view/AccountPanel.cpp:858 msgid " operations ?" msgstr " opérations ?" @@ -90,11 +90,11 @@ msgid "Account 1" msgstr "Compte 1" #: src/view/ImportPanel.cpp:74 -#: src/view/AccountPanel.cpp:111 +#: src/view/AccountPanel.cpp:112 msgid "Account name" msgstr "Nom du compte" -#: src/view/AccountPanel.cpp:110 +#: src/view/AccountPanel.cpp:111 msgid "Account number" msgstr "Numéro de compte" @@ -103,6 +103,10 @@ msgstr "Numéro de compte" msgid "Accounts" msgstr "Comptes" +#: src/view/AccountPanel.cpp:1086 +msgid "Accounts updated until " +msgstr "Comptes mis à jours jusqu'à " + #: src/view/SearchPanel.cpp:97 msgid "Amount from" msgstr "Montant min" @@ -111,12 +115,16 @@ msgstr "Montant min" msgid "Amount to" msgstr "Montant max" +#: src/view/AccountPanel.cpp:1093 +msgid "Any account updated !" +msgstr "Aucun compte mis à jour" + #: src/view/ImportPanel.cpp:177 msgid "Any engine can process this file !" msgstr "Format de fichier non reconnu" #: src/view/PreferencesPanel.cpp:839 -#: src/view/AccountPanel.cpp:850 +#: src/view/AccountPanel.cpp:853 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " @@ -198,7 +206,7 @@ msgstr "Changer la catégorie" msgid "Change password" msgstr "Changer le mot de passe" -#: src/view/AccountPanel.cpp:127 +#: src/view/AccountPanel.cpp:128 msgid "Check" msgstr "Rapprochement" @@ -223,7 +231,7 @@ msgid "Confirm password " msgstr "Confirmer le mot de passe " #: src/view/StatsPanel.cpp:131 -#: src/view/AccountPanel.cpp:121 +#: src/view/AccountPanel.cpp:122 msgid "Cost repartition" msgstr "Répartition des coûts" @@ -240,15 +248,15 @@ msgstr "En créer un" msgid "Credit" msgstr "Crédit" -#: src/view/AccountPanel.cpp:222 +#: src/view/AccountPanel.cpp:225 msgid "Cur Credit" msgstr "Cur Crédit" -#: src/view/AccountPanel.cpp:223 +#: src/view/AccountPanel.cpp:226 msgid "Cur Debit" msgstr "Cur Débit" -#: src/view/AccountPanel.cpp:113 +#: src/view/AccountPanel.cpp:114 msgid "Current value" msgstr "Valeur courante" @@ -274,7 +282,7 @@ msgstr "Défaut" #: src/view/PreferencesPanel.cpp:201 #: src/view/PreferencesPanel.cpp:296 -#: src/view/AccountPanel.cpp:709 +#: src/view/AccountPanel.cpp:712 msgid "Delete" msgstr "Supprimer" @@ -306,7 +314,7 @@ msgstr "Nouvelle description" #: src/view/PreferencesPanel.cpp:790 #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 -#: src/view/AccountPanel.cpp:846 +#: src/view/AccountPanel.cpp:849 #: src/view/grid/GridAccount.cpp:1289 #: src/view/grid/GridAccount.cpp:1296 #: src/view/grid/GridAccount.cpp:1415 @@ -336,7 +344,7 @@ msgstr "Compte du fichier" msgid "File category" msgstr "Catégorie du fichier" -#: src/view/AccountPanel.cpp:114 +#: src/view/AccountPanel.cpp:115 msgid "Final value" msgstr "Valeur finale" @@ -363,7 +371,7 @@ msgid "From " msgstr "A partir de " #: src/view/GenerateDialog.cpp:31 -#: src/view/AccountPanel.cpp:706 +#: src/view/AccountPanel.cpp:709 msgid "Generate month" msgstr "Générer mois" @@ -375,7 +383,7 @@ msgstr "Fichiers Grisbi (*.gsb)|*.gsb" msgid "Groceries" msgstr "Courses" -#: src/view/AccountPanel.cpp:133 +#: src/view/AccountPanel.cpp:134 msgid "Group" msgstr "Grouper" @@ -387,7 +395,7 @@ msgstr "Loisirs" msgid "Import" msgstr "Import" -#: src/view/AccountPanel.cpp:112 +#: src/view/AccountPanel.cpp:113 msgid "Initial value" msgstr "Valeur initiale" @@ -443,7 +451,7 @@ msgstr "Intervalle de temps invalide" msgid "It must be at least one account !" msgstr "Il doit y avoir au moins un compte !" -#: src/view/AccountPanel.cpp:846 +#: src/view/AccountPanel.cpp:849 msgid "It must be at least one month !" msgstr "Il doit rester au moins un mois" @@ -478,7 +486,7 @@ msgstr "Langue changée, allez sur un autre panneau pour rendre le changement ef msgid "Load operations" msgstr "Charger les opérations" -#: src/view/AccountPanel.cpp:128 +#: src/view/AccountPanel.cpp:129 msgid "Mode" msgstr "Mode" @@ -555,7 +563,7 @@ msgid "Operation order" msgstr "Ordre des opérations" #: src/view/SearchPanel.cpp:100 -#: src/view/AccountPanel.cpp:182 +#: src/view/AccountPanel.cpp:185 msgid "Operations" msgstr "Opérations" @@ -607,11 +615,11 @@ msgstr "Préférences" msgid "Quit KissCount ?" msgstr "Quitter KissCount ?" -#: src/view/AccountPanel.cpp:127 +#: src/view/AccountPanel.cpp:128 msgid "Real" msgstr "Réel" -#: src/view/AccountPanel.cpp:224 +#: src/view/AccountPanel.cpp:227 msgid "Remains" msgstr "Restant" @@ -630,7 +638,7 @@ msgid "Search" msgstr "Chercher" #: src/view/StatsPanel.cpp:123 -#: src/view/AccountPanel.cpp:94 +#: src/view/AccountPanel.cpp:95 msgid "Serie 1" msgstr "Série 1" @@ -651,15 +659,15 @@ msgstr "A" msgid "To " msgstr "Vers " -#: src/view/AccountPanel.cpp:206 +#: src/view/AccountPanel.cpp:209 msgid "Total Credit" msgstr "Total Crédit" -#: src/view/AccountPanel.cpp:207 +#: src/view/AccountPanel.cpp:210 msgid "Total Debit" msgstr "Total Débit" -#: src/view/AccountPanel.cpp:134 +#: src/view/AccountPanel.cpp:135 msgid "UnGroup" msgstr "Dégrouper" @@ -681,9 +689,9 @@ msgstr "Exceptionnel" #: src/view/SearchPanel.cpp:82 #: src/view/SearchPanel.cpp:90 -#: src/view/AccountPanel.cpp:515 -#: src/view/AccountPanel.cpp:551 -#: src/view/AccountPanel.cpp:589 +#: src/view/AccountPanel.cpp:518 +#: src/view/AccountPanel.cpp:554 +#: src/view/AccountPanel.cpp:592 #: src/model/User.cpp:59 #: src/model/User.cpp:79 #: src/model/User.cpp:127 @@ -698,6 +706,10 @@ msgstr "Comptes non résolus" msgid "Unresolved categories" msgstr "Catégories non résolues" +#: src/view/AccountPanel.cpp:136 +msgid "Update next months" +msgstr "Mettre à jour mois suivants" + #: src/view/PreferencesPanel.cpp:59 msgid "User" msgstr "Utilisateur" @@ -713,7 +725,7 @@ msgid "Users" msgstr "Utilisateurs" #: src/view/PreferencesPanel.cpp:199 -#: src/view/AccountPanel.cpp:127 +#: src/view/AccountPanel.cpp:128 msgid "Virtual" msgstr "Virtuel" diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 48b9dc6..ab074bb 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-26 21:01+0200\n" +"POT-Creation-Date: 2011-04-30 12:37+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -39,7 +39,7 @@ msgstr "" msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:855 +#: src/view/AccountPanel.cpp:858 msgid " operations ?" msgstr "" @@ -81,11 +81,11 @@ msgstr "" msgid "Account 1" msgstr "" -#: src/view/ImportPanel.cpp:74 src/view/AccountPanel.cpp:111 +#: src/view/ImportPanel.cpp:74 src/view/AccountPanel.cpp:112 msgid "Account name" msgstr "" -#: src/view/AccountPanel.cpp:110 +#: src/view/AccountPanel.cpp:111 msgid "Account number" msgstr "" @@ -93,6 +93,10 @@ msgstr "" msgid "Accounts" msgstr "" +#: src/view/AccountPanel.cpp:1086 +msgid "Accounts updated until " +msgstr "" + #: src/view/SearchPanel.cpp:97 msgid "Amount from" msgstr "" @@ -101,11 +105,15 @@ msgstr "" msgid "Amount to" msgstr "" +#: src/view/AccountPanel.cpp:1093 +msgid "Any account updated !" +msgstr "" + #: src/view/ImportPanel.cpp:177 msgid "Any engine can process this file !" msgstr "" -#: src/view/PreferencesPanel.cpp:839 src/view/AccountPanel.cpp:850 +#: src/view/PreferencesPanel.cpp:839 src/view/AccountPanel.cpp:853 msgid "Are you sure want to delete " msgstr "" @@ -182,7 +190,7 @@ msgstr "" msgid "Change password" msgstr "" -#: src/view/AccountPanel.cpp:127 +#: src/view/AccountPanel.cpp:128 msgid "Check" msgstr "" @@ -206,7 +214,7 @@ msgstr "" msgid "Confirm password " msgstr "" -#: src/view/StatsPanel.cpp:131 src/view/AccountPanel.cpp:121 +#: src/view/StatsPanel.cpp:131 src/view/AccountPanel.cpp:122 msgid "Cost repartition" msgstr "" @@ -220,15 +228,15 @@ msgstr "" msgid "Credit" msgstr "" -#: src/view/AccountPanel.cpp:222 +#: src/view/AccountPanel.cpp:225 msgid "Cur Credit" msgstr "" -#: src/view/AccountPanel.cpp:223 +#: src/view/AccountPanel.cpp:226 msgid "Cur Debit" msgstr "" -#: src/view/AccountPanel.cpp:113 +#: src/view/AccountPanel.cpp:114 msgid "Current value" msgstr "" @@ -253,7 +261,7 @@ msgid "Default" msgstr "" #: src/view/PreferencesPanel.cpp:201 src/view/PreferencesPanel.cpp:296 -#: src/view/AccountPanel.cpp:709 +#: src/view/AccountPanel.cpp:712 msgid "Delete" msgstr "" @@ -276,7 +284,7 @@ msgstr "" #: src/view/PreferencesPanel.cpp:516 src/view/PreferencesPanel.cpp:727 #: src/view/PreferencesPanel.cpp:746 src/view/PreferencesPanel.cpp:784 #: src/view/PreferencesPanel.cpp:790 src/view/PasswordDialog.cpp:72 -#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:846 +#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:849 #: src/view/grid/GridAccount.cpp:1289 src/view/grid/GridAccount.cpp:1296 #: src/view/grid/GridAccount.cpp:1415 src/view/grid/GridAccount.cpp:1421 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:45 @@ -299,7 +307,7 @@ msgstr "" msgid "File category" msgstr "" -#: src/view/AccountPanel.cpp:114 +#: src/view/AccountPanel.cpp:115 msgid "Final value" msgstr "" @@ -324,7 +332,7 @@ msgstr "" msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:706 +#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:709 msgid "Generate month" msgstr "" @@ -336,7 +344,7 @@ msgstr "" msgid "Groceries" msgstr "" -#: src/view/AccountPanel.cpp:133 +#: src/view/AccountPanel.cpp:134 msgid "Group" msgstr "" @@ -348,7 +356,7 @@ msgstr "" msgid "Import" msgstr "" -#: src/view/AccountPanel.cpp:112 +#: src/view/AccountPanel.cpp:113 msgid "Initial value" msgstr "" @@ -404,7 +412,7 @@ msgstr "" msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:846 +#: src/view/AccountPanel.cpp:849 msgid "It must be at least one month !" msgstr "" @@ -437,7 +445,7 @@ msgstr "" msgid "Load operations" msgstr "" -#: src/view/AccountPanel.cpp:128 +#: src/view/AccountPanel.cpp:129 msgid "Mode" msgstr "" @@ -506,7 +514,7 @@ msgstr "" msgid "Operation order" msgstr "" -#: src/view/SearchPanel.cpp:100 src/view/AccountPanel.cpp:182 +#: src/view/SearchPanel.cpp:100 src/view/AccountPanel.cpp:185 msgid "Operations" msgstr "" @@ -550,11 +558,11 @@ msgstr "" msgid "Quit KissCount ?" msgstr "" -#: src/view/AccountPanel.cpp:127 +#: src/view/AccountPanel.cpp:128 msgid "Real" msgstr "" -#: src/view/AccountPanel.cpp:224 +#: src/view/AccountPanel.cpp:227 msgid "Remains" msgstr "" @@ -571,7 +579,7 @@ msgstr "" msgid "Search" msgstr "" -#: src/view/StatsPanel.cpp:123 src/view/AccountPanel.cpp:94 +#: src/view/StatsPanel.cpp:123 src/view/AccountPanel.cpp:95 msgid "Serie 1" msgstr "" @@ -591,15 +599,15 @@ msgstr "" msgid "To " msgstr "" -#: src/view/AccountPanel.cpp:206 +#: src/view/AccountPanel.cpp:209 msgid "Total Credit" msgstr "" -#: src/view/AccountPanel.cpp:207 +#: src/view/AccountPanel.cpp:210 msgid "Total Debit" msgstr "" -#: src/view/AccountPanel.cpp:134 +#: src/view/AccountPanel.cpp:135 msgid "UnGroup" msgstr "" @@ -617,8 +625,8 @@ msgid "Unexpected" msgstr "" #: src/view/SearchPanel.cpp:82 src/view/SearchPanel.cpp:90 -#: src/view/AccountPanel.cpp:515 src/view/AccountPanel.cpp:551 -#: src/view/AccountPanel.cpp:589 src/model/User.cpp:59 src/model/User.cpp:79 +#: src/view/AccountPanel.cpp:518 src/view/AccountPanel.cpp:554 +#: src/view/AccountPanel.cpp:592 src/model/User.cpp:59 src/model/User.cpp:79 #: src/model/User.cpp:127 msgid "Unknown" msgstr "" @@ -631,6 +639,10 @@ msgstr "" msgid "Unresolved categories" msgstr "" +#: src/view/AccountPanel.cpp:136 +msgid "Update next months" +msgstr "" + #: src/view/PreferencesPanel.cpp:59 msgid "User" msgstr "" @@ -644,7 +656,7 @@ msgstr "" msgid "Users" msgstr "" -#: src/view/PreferencesPanel.cpp:199 src/view/AccountPanel.cpp:127 +#: src/view/PreferencesPanel.cpp:199 src/view/AccountPanel.cpp:128 msgid "Virtual" msgstr "" From 33a2cd1f0cb018e9fa31af651f22326da36fefbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 28 May 2011 10:24:02 +0200 Subject: [PATCH 63/72] Change charts and real/virtual mode position --- ChangeLog | 3 ++- README | 2 +- README.fr | 2 +- src/view/AccountPanel.cpp | 4 ++-- src/view/StatsPanel.cpp | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2788bd3..fb543ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2 (30/04/2011) +v0.2 (28/05/2011) ** User ** Better use of sizers (so better interface!) @@ -16,6 +16,7 @@ v0.2 (30/04/2011) Add Debian's packages !! Add Import Panel, OFX and Grisbi imports Add update next months + Change charts and real/virtual mode position ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/README b/README index 816937c..9d79853 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ KissCount is personnal account software delivered under GPL v3 licence terms. Current version is 0.2 -wxWidgets 2.8 and sqlite3 are needed +wxWidgets 2.8, sqlite3, libofx and libxml2 are needed A modified version of wxFreeChart is used : warning during recompilation, don't overwrite autotools files with ./configure diff --git a/README.fr b/README.fr index 9c2b61c..594c3d1 100644 --- a/README.fr +++ b/README.fr @@ -2,7 +2,7 @@ KissCount est un logiciel de gestion de comptes personnels délivré sous licenc La version actuelle est 0.2 -wxWidgets 2.8 et sqlite3 sont nécessaires +wxWidgets 2.8, sqlite3, libofx et libxml2 sont nécessaires Une version modifiée de wxFreeChart est utilisée : attention à lors de la recompilation à ne pas écraser les fichiers des autotools (pas de ./configure) diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index c9fe1a5..f0f5304 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -123,7 +123,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare chart->Fit(); chart->Layout(); chart->SetMinSize(// chart->GetSize() - wxSize(200,250)); + wxSize(200,300)); wxString modes[3] = {_("Virtual"), _("Real"), _("Check")}; _radioMode = new wxRadioBox(this, DISPLAY_MODE_ID, _("Mode"), wxDefaultPosition, wxDefaultSize, @@ -139,6 +139,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare vbox3->Add(buttonUpdateNextMonths, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); vbox3->Add(buttonGroup, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); vbox3->Add(buttonUnGroup, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); + vbox3->Add(_radioMode, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 50); hbox->Add(vbox3, 0, wxGROW|wxALL, 2); hbox2->Add(_accountsGrid, 0, wxGROW|wxALL, 2); @@ -148,7 +149,6 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare hbox->Add(vbox2, 0, wxGROW|wxALL, 2); vbox->Add(_statsGrid, 0, wxGROW); vbox->Add(chart, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10); - vbox->Add(_radioMode, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10); hbox->Add(vbox, 0, wxGROW|wxALL, 2); ChangeUser(); diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 023642c..72b35f3 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -134,14 +134,14 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), chart->SetMinSize(// chart->GetSize() wxSize(200,250)); - _vbox2->Add(chart, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 10); - vbox->Add(hbox, 0, wxALIGN_CENTER_VERTICAL|wxGROW|wxALL, 5); vbox->Add(_hbox2, 0, wxGROW|wxALL, 5); wxCommandEvent event ; OnRangeChange(event); + _hbox2->Add(chart, 0, wxGROW|wxALL, 10); + Fit(); } From 6fae41b4e8512e15bfdca3cb5b2dc9b6d46fe372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 28 May 2011 19:31:42 +0200 Subject: [PATCH 64/72] Add "non fix" category to statistics (sum of all non fix categories) --- ChangeLog | 1 + TODO | 1 - src/view/AccountPanel.cpp | 24 ++++++++++++++----- src/view/StatsPanel.cpp | 49 ++++++++++++++++++++++++++++----------- src/view/StatsPanel.h | 2 +- 5 files changed, 56 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index fb543ba..bbf41af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ v0.2 (28/05/2011) Add Import Panel, OFX and Grisbi imports Add update next months Change charts and real/virtual mode position + Add "non fix" category to statistics (sum of all non fix categories) ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/TODO b/TODO index a3e3a44..5699fd1 100644 --- a/TODO +++ b/TODO @@ -5,7 +5,6 @@ Auto completion (already up into wxwidgets 2.9) Using tabulation to navigate throw interface (Search Panel) Can type a letter with a comboboxes Windows version -Real mode Choosing accounts & categories position Cool for 0.2: diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index f0f5304..68c0f28 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -20,7 +20,7 @@ #include "AccountPanel.h" enum {ACCOUNT_NUMBER, ACCOUNT_NAME, ACCOUNT_INIT, ACCOUNT_CUR, ACCOUNT_FINAL, NUMBER_COLS_ACCOUNTS}; -enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, REMAINS, STATS_ROW, CATS_STATS}; +enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, REMAINS, STATS_ROW, CATS_STATS, NON_FIX}; enum {CALENDAR_TREE_ID=1, OPS_GRID_ID, CALENDAR_ID, ACCOUNTS_GRID_ID, MENU_GENERATE_ID, MENU_DELETE_ID, DISPLAY_MODE_ID, GROUP_ID, UNGROUP_ID, UPDATE_NEXT_MONTHS_ID}; enum {VIRTUAL_MODE=0, REAL_MODE, CHECK_MODE}; @@ -188,12 +188,12 @@ wxString AccountPanel::GetToolTip() void AccountPanel::InitStatsGrid(User* user) { int i; - + int nb_categories = user->GetCategoriesNumber(); DEFAULT_FONT(font); if (!_statsGrid->GetNumberRows()) { - _statsGrid->CreateGrid(user->GetCategoriesNumber()+6, 2); + _statsGrid->CreateGrid(nb_categories+CATS_STATS, 2); // Headers + blank + categories + non fix _statsGrid->SetColLabelSize(0); _statsGrid->SetRowLabelSize(0); _statsGrid->EnableEditing(false); @@ -201,7 +201,7 @@ void AccountPanel::InitStatsGrid(User* user) else { _statsGrid->DeleteRows(0, _statsGrid->GetNumberRows()); - _statsGrid->InsertRows(0, user->GetCategoriesNumber()+6); + _statsGrid->InsertRows(0, nb_categories+CATS_STATS); } _statsGrid->SetDefaultCellFont(font); @@ -209,7 +209,7 @@ void AccountPanel::InitStatsGrid(User* user) _statsGrid->SetCellValue(TOTAL_CREDIT, 0, _("Total Credit")); _statsGrid->SetCellValue(TOTAL_DEBIT, 0, _("Total Debit")); - for(i=0; iGetCategoriesNumber(); i++) + for(i=0; iSetCellValue(CATS_STATS+i, 0, _categories[i]); _statsGrid->SetCellAlignment(CATS_STATS+i, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); @@ -225,12 +225,14 @@ void AccountPanel::InitStatsGrid(User* user) _statsGrid->SetCellValue(CUR_CREDIT, 0, _("Cur Credit")); _statsGrid->SetCellValue(CUR_DEBIT, 0, _("Cur Debit")); _statsGrid->SetCellValue(REMAINS, 0, _("Remains")); + _statsGrid->SetCellValue(NON_FIX, 0, _("Non fix")); _statsGrid->SetCellAlignment(CUR_DEBIT, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); _statsGrid->SetCellAlignment(CUR_CREDIT, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); _statsGrid->SetCellAlignment(TOTAL_DEBIT, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); _statsGrid->SetCellAlignment(TOTAL_CREDIT, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); _statsGrid->SetCellAlignment(REMAINS, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); + _statsGrid->SetCellAlignment(NON_FIX, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); } void AccountPanel::ChangeUser() @@ -627,9 +629,19 @@ void AccountPanel::UpdateStats() percents = ((double) (_categoriesValues[i]*100))/totalDebit; else percents = 0.0; - _statsGrid->SetCellValue(CATS_STATS+i, 1, wxString::Format(wxT("%.2lf (%02d %%)"), _categoriesValues[i], (int)percents)); + if (i) + _statsGrid->SetCellValue(CATS_STATS+i+1, 1, wxString::Format(wxT("%.2lf (%02d %%)"), _categoriesValues[i], (int)percents)); + else + _statsGrid->SetCellValue(CATS_STATS+i, 1, wxString::Format(wxT("%.2lf (%02d %%)"), _categoriesValues[i], (int)percents)); } + value = totalDebit - _categoriesValues[0]; + if (totalDebit != 0) + percents = ((double) (value*100))/totalDebit; + else + percents = 0.0; + _statsGrid->SetCellValue(NON_FIX, 1, wxString::Format(wxT("%.2lf (%02d %%)"), value, (int)percents)); + for (i=0, accountIt=user->_accounts.begin(); accountIt!=user->_accounts.end(); accountIt++, i++) { if (mode != CHECK_MODE) diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 72b35f3..1925d1e 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -92,7 +92,7 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _statsGrid = new wxGrid(this, wxID_ANY); - _statsGrid->CreateGrid(user->GetCategoriesNumber(), 2); + _statsGrid->CreateGrid(user->GetCategoriesNumber()+1, 2); _statsGrid->SetColLabelSize(0); _statsGrid->SetRowLabelSize(0); _statsGrid->EnableEditing(false); @@ -102,10 +102,21 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), for(i=0; iGetCategoriesNumber(); i++) { - _statsGrid->SetCellValue(i, 0, _categories[i]); - _statsGrid->SetCellAlignment(i, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); + if (i) + { + _statsGrid->SetCellValue(i+1, 0, _categories[i]); + _statsGrid->SetCellAlignment(i+1, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); + } + else + { + _statsGrid->SetCellValue(i, 0, _categories[i]); + _statsGrid->SetCellAlignment(i, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); + } } + _statsGrid->SetCellValue(1, 0, _("Non fix")); + _statsGrid->SetCellAlignment(1, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); + _vbox2->Add(_account, 0, wxGROW|wxALL, 5); _vbox2->Add(_statsGrid, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); @@ -127,11 +138,11 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _pie->SetLegend(new Legend(wxBOTTOM, wxCENTER)); - wxChartPanel* chart = new wxChartPanel(this); - chart->SetChart(new Chart(_pie, _("Cost repartition"))); - chart->Fit(); - chart->Layout(); - chart->SetMinSize(// chart->GetSize() + _chartCategories = new wxChartPanel(this); + _chartCategories->SetChart(new Chart(_pie, _("Cost repartition"))); + _chartCategories->Fit(); + _chartCategories->Layout(); + _chartCategories->SetMinSize(// chart->GetSize() wxSize(200,250)); vbox->Add(hbox, 0, wxALIGN_CENTER_VERTICAL|wxGROW|wxALL, 5); @@ -140,8 +151,6 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), wxCommandEvent event ; OnRangeChange(event); - _hbox2->Add(chart, 0, wxGROW|wxALL, 10); - Fit(); } @@ -171,7 +180,7 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT std::vector::iterator accountIt; std::map::iterator categoriesIt; std::map >::iterator accountYearIt; - double total; + double total, non_fix; int account, size, i, a, b, percents, nbDays; double *amounts; wxString value; @@ -183,6 +192,7 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT { _hbox2->Detach(_chart); _hbox2->Detach(_vbox2); + _hbox2->Detach(_chartCategories); delete _chart; } @@ -335,7 +345,7 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT for(categoriesIt = categories.begin(); categoriesIt != categories.end(); categoriesIt++) total += categoriesIt->second; - for(categoriesIt = categories.begin(); categoriesIt != categories.end(); categoriesIt++) + for(i=0, categoriesIt = categories.begin(); categoriesIt != categories.end(); categoriesIt++, i++) { _categoriesValues[_categoriesIndexes[categoriesIt->first]] = categoriesIt->second; if (total) @@ -343,15 +353,28 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT else percents = 0; value = wxString::Format(wxT("%0.2lf (%02d%%)"), categoriesIt->second, percents); - _statsGrid->SetCellValue(_categoriesIndexes[categoriesIt->first], 1, value); + if (i) + _statsGrid->SetCellValue(_categoriesIndexes[categoriesIt->first]+1, 1, value); + else + _statsGrid->SetCellValue(_categoriesIndexes[categoriesIt->first], 1, value); } + non_fix = total - _categoriesValues[0]; + + if (total) + percents = ((double) (non_fix*100))/total; + else + percents = 0; + value = wxString::Format(wxT("%0.2lf (%02d%%)"), non_fix, percents); + _statsGrid->SetCellValue(1, 1, value); + _statsGrid->AutoSizeColumn(0, true); _statsGrid->AutoSizeColumn(1, true); _pie->DatasetChanged(_dataset); _hbox2->Add(_vbox2, 0, wxGROW|wxALL, 5); + _hbox2->Add(_chartCategories, 0, wxGROW|wxALL, 10); Layout(); } diff --git a/src/view/StatsPanel.h b/src/view/StatsPanel.h index e429d3d..1e2596b 100644 --- a/src/view/StatsPanel.h +++ b/src/view/StatsPanel.h @@ -58,7 +58,7 @@ private: wxString* _categories; std::map _categoriesIndexes; wxBoxSizer *_hbox2, *_vbox2; - wxChartPanel* _chart; + wxChartPanel* _chart, *_chartCategories; wxCheckListBox* _account; void UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearTo); From 63f2a72a0684c59d4fb53be91ebd709a9bd50dda Mon Sep 17 00:00:00 2001 From: www-data Date: Thu, 2 Jun 2011 12:03:02 +0200 Subject: [PATCH 65/72] Work on web view : Add Button to show/hide sub operations Re order accounts Pack operations and their sub operations --- www/User.php | 0 www/database.php | 63 +++++++++++++++++++++++++++++++-- www/index.php | 89 ++++++++++++++++++++++++++++++++++------------- www/kisscount.css | 0 www/kisscount.php | 0 5 files changed, 124 insertions(+), 28 deletions(-) mode change 100644 => 100755 www/User.php mode change 100644 => 100755 www/database.php mode change 100644 => 100755 www/index.php mode change 100644 => 100755 www/kisscount.css mode change 100644 => 100755 www/kisscount.php diff --git a/www/User.php b/www/User.php old mode 100644 new mode 100755 diff --git a/www/database.php b/www/database.php old mode 100644 new mode 100755 index ab8c6f1..981131a --- a/www/database.php +++ b/www/database.php @@ -88,7 +88,7 @@ function LoadUser($name) $user->id = $row["id"]; - $result = $db->query("SELECT * FROM account WHERE user='$user->id' ORDER BY default_account DESC, name ASC"); + $result = $db->query("SELECT * FROM account WHERE user='$user->id' ORDER BY default_account DESC, virtual, blocked, name ASC"); $user->accounts = array(); @@ -96,7 +96,7 @@ function LoadUser($name) array_push($user->accounts, $row); // Shared accounts - $result = $db->query("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='$user->id') ORDER BY name ASC"); + $result = $db->query("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='$user->id') ORDER BY name, blocked, virtual ASC"); while ($row = $result->fetchArray()) array_push($user->accounts, $row); @@ -152,9 +152,19 @@ function GetAccountAmount($id, $month, $year) return 0; } +function array_insert($array,$pos,$val) +{ + $array2 = array_splice($array,$pos); + $array[] = $val; + $array = array_merge($array,$array2); + + return $array; +} + function LoadMonth($user, $month, $year) { global $db; + $res = array(); if (!isset($user->accounts[0])) return; @@ -170,7 +180,37 @@ function LoadMonth($user, $month, $year) $req .= " ORDER BY fix_cost DESC, year, month ASC, day "; $req .= $user->preferences["operation_order"]; - return $db->query($req); + $result = $db->query($req); + + // Pack operations and their sub operations + while ($row = $result->fetchArray()) + { + $inserted = 0; + foreach($res as $i => $value) + { + if ($value["parent"] == $row["id"]) + { + $res = array_insert($res, $i, $row); + $inserted = 1; + break; + } + + if ($row["parent"] == $value["id"]) + { + $res = array_insert($res, $i+1, $row); + $inserted = 1; + break; + } + } + + // Append + if ($inserted == 0) + { + $res = array_insert($res, $i+1, $row); + } + } + + return $res; } function MetaPositiveAmount($id) @@ -250,4 +290,21 @@ function GetAllOperations($user, &$last_year, &$last_month) return $res; } +function GetSubOperations($parent) +{ + $res = "["; + global $db; + + $req = "SELECT id FROM operation WHERE parent=\"" . $parent . "\""; + + $result = $db->query($req); + + while ($row = $result->fetchArray()) + $res .= $row["id"] . ", "; + + if (strlen($res) > 1) + $res = substr($res, 0, strlen($res)-2); + + return $res . "]"; +} ?> \ No newline at end of file diff --git a/www/index.php b/www/index.php old mode 100644 new mode 100755 index 5aab6a2..3fbf024 --- a/www/index.php +++ b/www/index.php @@ -86,16 +86,13 @@ else $_SESSION["cur_month"] = $_POST["month"]; } -if (isset($_POST["expand"])) - $_SESSION["expand"] = "1"; -else - $_SESSION["expand"] = "0"; - $operations = LoadMonth($_SESSION["user"], $_SESSION["cur_month"], $_SESSION["cur_year"]); $cur_date = mktime(0, 0, 0, date("m") , date("d"), date("Y")); $total_incomes = $total_outcomes = $cur_incomes = $cur_outcomes = 0; +$categories = array(); -while($operation = $operations->fetchArray()) +// Statistics +foreach($operations as $i => $operation) { if ($operation["meta"] == "1") continue; @@ -151,6 +148,29 @@ function changeMonths() ?> } } +function toggleOperations(parent, operations) +{ + var obj = document.getElementById(operations[0]); + var obj2 = document.getElementById(parent); + var visibility; + + if (obj.style.display == "none") + { + obj2.value = "-"; + visibility = "table-row"; + } + else + { + obj2.value = "+"; + visibility = "none"; + } + + for (var i=0; i
- >Expand groups
Disconnect @@ -208,23 +227,13 @@ function changeMonths()

- + fetchArray()) -{ - if ($_SESSION["expand"] == "1") - { - if ($operation["meta"] == "1") - continue; - } - else - { - if ($operation["parent"] != "") - continue; - } +foreach($operations as $i => $operation) +{ $category = $_SESSION["user"]->GetCategory($operation["category"]); if ($operation["fix_cost"] == "0") { @@ -237,7 +246,15 @@ while($operation = $operations->fetchArray()) else $tr_class = ""; } - echo ""; + if ($operation["meta"] == "1") + echo ""; + else + { + if ($operation["parent"] == "") + echo ""; + else + echo ""; + } echo ""; if ($operation["meta"] == "1" && $operation["amount"] == 0) { @@ -252,7 +269,7 @@ while($operation = $operations->fetchArray()) else echo ""; } - if ($operation["meta"] != "1") + if ($operation["meta"] != "1" && $category["id"] > 1) echo ""; else echo "\n"; + } + + if ($total_outcomes == 0) + $percent = 0; + else + { + $percent = ($categories[$category["id"]] * 100) / $total_outcomes; + $percent = round($percent, 0); + $percent = ($percent < 10) ? "0$percent" : "$percent"; + } + echo "\n"; } ?> diff --git a/www/kisscount.css b/www/kisscount.css old mode 100644 new mode 100755 diff --git a/www/kisscount.php b/www/kisscount.php old mode 100644 new mode 100755 From 557037f397173a71bea280d4e7943f4dbf04f68a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 16 Jun 2011 19:23:22 +0200 Subject: [PATCH 66/72] Bug on precedent commit --- src/view/AccountPanel.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 68c0f28..d999cb8 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -193,7 +193,7 @@ void AccountPanel::InitStatsGrid(User* user) if (!_statsGrid->GetNumberRows()) { - _statsGrid->CreateGrid(nb_categories+CATS_STATS, 2); // Headers + blank + categories + non fix + _statsGrid->CreateGrid(nb_categories+CATS_STATS+1, 2); // Headers + blank + categories + non fix _statsGrid->SetColLabelSize(0); _statsGrid->SetRowLabelSize(0); _statsGrid->EnableEditing(false); @@ -211,8 +211,16 @@ void AccountPanel::InitStatsGrid(User* user) for(i=0; iSetCellValue(CATS_STATS+i, 0, _categories[i]); - _statsGrid->SetCellAlignment(CATS_STATS+i, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); + if (i) + { + _statsGrid->SetCellValue(CATS_STATS+i+1, 0, _categories[i]); + _statsGrid->SetCellAlignment(CATS_STATS+i+1, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); + } + else + { + _statsGrid->SetCellValue(CATS_STATS+i, 0, _categories[i]); + _statsGrid->SetCellAlignment(CATS_STATS+i, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); + } } _statsGrid->AutoSizeColumn(0, false); From 8c5fab48f240d6788fdbca756adc4eef744c031f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 18 Jun 2011 11:43:02 +0200 Subject: [PATCH 67/72] Fix a bug (d\'ont check date for auto completion) --- src/view/grid/GridAccount.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 34c65b6..7cff7d9 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -728,7 +728,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) op_complete--; } - if (col == DESCRIPTION && + if (col == DESCRIPTION && GetCellValue(row, OP_DATE).Length() && (!GetCellValue(row, CATEGORY).Length() || !GetCellValue(row, ACCOUNT).Length() || !_canAddOperation)) From 40ca2a0f25ed22f09d0d65c8115d7444da4eebc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 2 Jul 2011 16:39:32 +0200 Subject: [PATCH 68/72] Add (XML) Export engine Add Export Panel Factorise SearchBanner Bug fix : - (Import/Export engines initialization) - virtual field not set in Search method - when deleting on search results - Auto completion now does not require date --- ressources/icons/export-icon.png | Bin 0 -> 9193 bytes src/model/export/ExportEngine.cpp | 81 ++++++++++ src/model/export/ExportEngine.h | 78 +++++++++ src/model/export/XMLExportEngine.cpp | 174 +++++++++++++++++++++ src/model/export/XMLExportEngine.h | 47 ++++++ src/view/ExportPanel.cpp | 153 ++++++++++++++++++ src/view/ExportPanel.h | 65 ++++++++ src/view/SearchBanner.cpp | 226 +++++++++++++++++++++++++++ src/view/SearchBanner.h | 60 +++++++ 9 files changed, 884 insertions(+) create mode 100644 ressources/icons/export-icon.png create mode 100644 src/model/export/ExportEngine.cpp create mode 100644 src/model/export/ExportEngine.h create mode 100644 src/model/export/XMLExportEngine.cpp create mode 100644 src/model/export/XMLExportEngine.h create mode 100644 src/view/ExportPanel.cpp create mode 100644 src/view/ExportPanel.h create mode 100644 src/view/SearchBanner.cpp create mode 100644 src/view/SearchBanner.h diff --git a/ressources/icons/export-icon.png b/ressources/icons/export-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..2e0edd7e90ae8d0c30d93a7f8c583e536a12c008 GIT binary patch literal 9193 zcmVPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipc7 z5Emym1Od$e03ZNKL_t(|+UC+3z%RR-X)R!Im-DmW-QZS+aVanLD?hcmJ4s znE-g)00IHn*gv2k5=~Q8stx1i(i}uj+{SM6jmm z0T6wX!HWoVI)IOXG1I#v20+Zr07*pXOlatgCz-)S=|5ryULoKm0Bg$TmV9_D0!`zb znTSUE>D4nCxR8KT0h|qB4m`Nhl;uqKW!Vnuo7+G{Y3$u&h{$2)_lf9bfFCTIJ9EcD zpzBaJw`2m~v9^FCee`Nl(@z26(*!yTz;OT;037r#pP8A6hP;=C)(#k^1?qVam>A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RL92m-hJw>U;gyfk9JhW(L3pGp?~_$93W5ujDsE#N7T~o3;YPLGYB9G zAQwR131tf>Klb$VPpW}H%xgOlP!$yB#Sjdr8T55}_8PrMs&Oxp{foS!aLjB1x75o(tuxJ?;UP1v}mGuG*bD zcC23Z)ti3z;QjYj;NWK0UgXJND&q&%K>q@_tQgq{u;gR0+}+jXoPOrnIn$<1Kbe`y z>tEpk3jm3Dyl&6#o$G%2vmf7c=P!P;sZKv9(3%dfn8wxTHV>#x4j(9zzWaE}p#xI9NJH#-6F$Rtm|=NHFZ zu){tbP3T<%W%hA%`lj&2vB22ABU>9;c-a|Gmnt||`xNkjYYz}!v@%%50>|LU=1wKH z3##D**TKPNB*LdpGnJ$IYmJZDk*xr;4`lK&)^q{(i)Vjo&&g(&=O0N2_w|Vt7g(i_ z{&jqy{zCzKtN={Dmlyo-GnzB#*nb#s0pNcDwW;AbIFq@%00000NkvXXu0mjflu#@r literal 0 HcmV?d00001 diff --git a/src/model/export/ExportEngine.cpp b/src/model/export/ExportEngine.cpp new file mode 100644 index 0000000..d276358 --- /dev/null +++ b/src/model/export/ExportEngine.cpp @@ -0,0 +1,81 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "ExportEngine.h" + +ExportEngine::ExportEngine() +{ +} + +ExportEngine::~ExportEngine() +{ +} + +bool ExportEngine::HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss) +{ + _path = path; + _user = user; + _db = db; + _kiss = kiss; + + return path.EndsWith(_shortExt) || path.EndsWith(_shortExt.Upper()); +} + +bool ExportEngine::SaveFile(std::vector* operations) +{ + int i; + wxString account, category; + AccountAmount accountAmount; + + if (!operations) return NULL; + + _accounts.clear(); + _categories.clear(); + _accountAmounts.clear(); + + for(i=0; i<(int)operations->size(); i++) + { + account = (*operations)[i].account; + category = (*operations)[i].category; + + accountAmount.account = account; + accountAmount.month = (*operations)[i].month; + accountAmount.year = (*operations)[i].year; + + if (account.Length()) + { + if (!_accounts.count(account)) + _accounts[account]++; + + if (!_accountAmounts.count(accountAmount)) + _accountAmounts[accountAmount] = _kiss->GetAccountAmount(accountAmount.account, accountAmount.month, accountAmount.year); + } + + if (category.Length() && !_categories.count(category)) + _categories[category]++; + } + + return true; +} + +wxString ExportEngine::GetFileExt() +{ + return wxGetTranslation(_longExt); +} + diff --git a/src/model/export/ExportEngine.h b/src/model/export/ExportEngine.h new file mode 100644 index 0000000..4ecf2f9 --- /dev/null +++ b/src/model/export/ExportEngine.h @@ -0,0 +1,78 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef EXPORTENGINE_H +#define EXPORTENGINE_H + +#include +#include + +class KissCount; + +class AccountAmount { +public: + wxString account; + int month; + int year; + bool operator()(const AccountAmount& x, const AccountAmount& y) const + { + long x1, y1; + + if (x.account != y.account) + { + x.account.ToLong(&x1); + y.account.ToLong(&y1); + + return x1 < y1; + } + + return (x.year < y.year && x.month < y.month); + } +}; + +class ExportEngine { +public: + ExportEngine(); + ~ExportEngine(); + + // Get supported file extension. Example : + // "OFX files (*.ofx)|*.ofx" + virtual wxString GetFileExt(); + + // Handle the file + virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss)=0; + + // Save operations (ExportEngin pre fill _accounts, _categories and _accountAmounts) + virtual bool SaveFile(std::vector* operations)=0; + +protected: + wxString _path; + Database* _db; + User* _user; + KissCount* _kiss; + + wxString _shortExt; + wxString _longExt; + + std::map _accounts; + std::map _categories; + std::map _accountAmounts; +}; + +#endif diff --git a/src/model/export/XMLExportEngine.cpp b/src/model/export/XMLExportEngine.cpp new file mode 100644 index 0000000..760a462 --- /dev/null +++ b/src/model/export/XMLExportEngine.cpp @@ -0,0 +1,174 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "XMLExportEngine.h" + +static XMLExportEngine xmlExportEngine; + +XMLExportEngine::XMLExportEngine() +{ + KissCount::RegisterExportEngine(this); + + _shortExt = wxT("xml"); + _longExt = _("XML files (*.xml)|*.xml"); +} + +XMLExportEngine::~XMLExportEngine() +{ +} + +bool XMLExportEngine::HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss) +{ + return ExportEngine::HandleFile(path, user, db, kiss); +} + +bool XMLExportEngine::SaveAccounts() +{ + Account account; + std::map::iterator it; + + for(it=_accounts.begin(); it!=_accounts.end(); it++) + { + account = _user->GetAccount(it->first); + + xmlTextWriterStartElement(_writer, (const xmlChar*) "account"); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "id", (const xmlChar*) account.id.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "name", (const xmlChar*) account.name.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "number", (const xmlChar*) account.number.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "shared", (const xmlChar*) (account.shared ? "1" : "0")); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "blocked", (const xmlChar*) (account.blocked ? "1" : "0")); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "default", (const xmlChar*) (account._default ? "1" : "0")); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "is_owner", (const xmlChar*) (account.is_owner ? "1" : "0")); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "virtual", (const xmlChar*) (account._virtual ? "1" : "0")); + xmlTextWriterEndElement(_writer); + } + + return true; +} + +bool XMLExportEngine::SaveAccountAmounts() +{ + std::map::iterator it; + + for(it=_accountAmounts.begin(); it!=_accountAmounts.end(); it++) + { + xmlTextWriterStartElement(_writer, (const xmlChar*) "account_amount"); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "account", (const xmlChar*) it->first.account.utf8_str().data()); + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "month", "%d", it->first.month); + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "year", "%d", it->first.year); + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "amount", "%.2lf", it->second); + xmlTextWriterEndElement(_writer); + } + + return true; +} + +bool XMLExportEngine::SaveCategories() +{ + Category category; + std::map::iterator it; + int rgb; + + for(it=_categories.begin(); it!=_categories.end(); it++) + { + category = _user->GetCategory(it->first); + + xmlTextWriterStartElement(_writer, (const xmlChar*) "category"); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "id", (const xmlChar*) category.id.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "name", (const xmlChar*) category.name.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "font", (const xmlChar*) category.font.utf8_str().data()); + rgb = category.backcolor.Blue(); + rgb |= category.backcolor.Green() << 8; + rgb |= category.backcolor.Red() << 16; + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "backcolor", "%08X", rgb); + rgb = category.forecolor.Blue(); + rgb |= category.forecolor.Green() << 8; + rgb |= category.forecolor.Red() << 16; + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "forecolor", "%08X", rgb); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "fix_cost", (const xmlChar*) (category.fix_cost ? "1" : "0")); + xmlTextWriterEndElement(_writer); + } + + return true; +} + +bool XMLExportEngine::SaveOperations(std::vector* operations) +{ + std::vector::iterator it; + + for(it=operations->begin(); it!=operations->end(); it++) + { + xmlTextWriterStartElement(_writer, (const xmlChar*) "operation"); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "id", (const xmlChar*) it->id.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "parent", (const xmlChar*) it->parent.utf8_str().data()); + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "day", "%d", it->day); + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "month", "%d", it->month); + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "year", "%d", it->year); + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "amount", "%.2lf", it->amount); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "description", (const xmlChar*) it->description.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "category", (const xmlChar*) it->category.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "fix_cost", (const xmlChar*) (it->fix_cost ? "1" : "0")); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "account", (const xmlChar*) it->account.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "checked", (const xmlChar*) (it->checked ? "1" : "0")); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "transfert", (const xmlChar*) it->transfert.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "formula", (const xmlChar*) it->formula.utf8_str().data()); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "meta", (const xmlChar*) (it->meta ? "1" : "0")); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "virtual", (const xmlChar*) (it->_virtual ? "1" : "0")); + xmlTextWriterEndElement(_writer); + } + + return true; +} + +bool XMLExportEngine::SaveFile(std::vector* operations) +{ + int rc; + + rc = ExportEngine::SaveFile(operations); + + if (!rc) return false; + + _writer = xmlNewTextWriterFilename(_path.mb_str(), 0); + + if (!_writer) + { + std::cout << "Error can't open the file" << std::endl; + return false; + } + + rc = xmlTextWriterStartDocument(_writer, NULL, "UTF-8", NULL); + + if (rc < 0) return false; + + xmlTextWriterStartElement(_writer, (const xmlChar*) "kisscount"); + xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "version", (const xmlChar*) "1"); + + SaveAccounts(); + SaveAccountAmounts(); + SaveCategories(); + SaveOperations(operations); + + xmlTextWriterEndElement(_writer); + + xmlTextWriterEndDocument(_writer); + + xmlFreeTextWriter(_writer); + + return true; +} diff --git a/src/model/export/XMLExportEngine.h b/src/model/export/XMLExportEngine.h new file mode 100644 index 0000000..f91c0f8 --- /dev/null +++ b/src/model/export/XMLExportEngine.h @@ -0,0 +1,47 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef XMLEXPORTENGINE_H +#define XMLEXPORTENGINE_H + +#include +#include + +#include +#include +#include "ExportEngine.h" + +class XMLExportEngine : public ExportEngine { +public: + XMLExportEngine(); + ~XMLExportEngine(); + + bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss); + bool SaveFile(std::vector* operations); + +private: + xmlTextWriterPtr _writer; + + bool SaveAccounts(); + bool SaveAccountAmounts(); + bool SaveCategories(); + bool SaveOperations(std::vector* operations); +}; + +#endif diff --git a/src/view/ExportPanel.cpp b/src/view/ExportPanel.cpp new file mode 100644 index 0000000..efa0499 --- /dev/null +++ b/src/view/ExportPanel.cpp @@ -0,0 +1,153 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "ExportPanel.h" + +enum {EXPORT_ID=1, SEARCH_ID, GRID_ID}; + +BEGIN_EVENT_TABLE(ExportPanel, wxPanel) +EVT_BUTTON(EXPORT_ID, ExportPanel::OnButtonExport) +EVT_BUTTON(SEARCH_ID, ExportPanel::OnButtonSearch) +EVT_SHOW(ExportPanel::OnShow) +END_EVENT_TABLE() + +ExportPanel::ExportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _operations(NULL) +{ + DEFAULT_FONT(font); + std::vector::iterator accountIt; + std::vector::iterator categoryIt; + wxDateTime firstOfMonth; + wxRect rect = wxDisplay().GetGeometry(); + + wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); + wxBoxSizer *vbox2 = new wxBoxSizer(wxVERTICAL); + wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); + + SetSizer(vbox); + + _searchButton = new wxButton(this, SEARCH_ID, _("Search")); + + _banner = new SearchBanner(kiss, this, this, OnEnter); + + vbox->Add(_banner, 0, wxGROW|wxALL, 5); + vbox->Add(_searchButton, 0, wxALL, 5); + + _grid = new GridAccount(_kiss, this, GRID_ID, false, false, false); + + hbox->Add(_grid, 0, wxGROW|wxALL, 5); + + _exportButton = new wxButton(this, EXPORT_ID, _("Export")); + + vbox2->Add(_exportButton, wxALL, 15); + + hbox->Add(vbox2, 0, wxALL, 15); + + vbox->Add(hbox, 0, wxGROW|wxALL, 5); + + Fit(); + + SetMinSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); + SetMaxSize(wxSize(rect.width-rect.x-15, rect.height-rect.y-128-25)); + SetScrollbars(10, 10, 100/10, 100/10); +} + +ExportPanel::~ExportPanel() +{ +} + +KissPanel* ExportPanel::CreatePanel() +{ + return new ExportPanel(_kiss, _wxUI); +} + +wxBitmapButton* ExportPanel::GetButton(int id) +{ + if (!_KissButton) + _KissButton = new wxBitmapButton(_wxUI, id, wxBitmap(wxT(EXPORT_ICON), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxSize(128, 128)); + + return _KissButton; +} + +wxString ExportPanel::GetToolTip() +{ + return _("Export"); +} + +void ExportPanel::OnEnter(void* caller, wxCommandEvent& event) +{ + ExportPanel* _this = (ExportPanel*) caller; + + _this->OnButtonExport(event); +} + +void ExportPanel::OnButtonSearch(wxCommandEvent& event) +{ + _operations = _banner->Search(); + + if (!_operations) return; + + if (_operations->size() > 1) + wxMessageBox(wxString::Format(wxT("%d"), _operations->size()) + _(" entries found"), wxT("KissCount"), wxICON_INFORMATION | wxOK); + else if (_operations->size() == 1) + wxMessageBox(_("1 entry found"), wxT("KissCount"), wxICON_INFORMATION | wxOK); + else + { + wxMessageBox(_("No entry found"), wxT("KissCount"), wxICON_INFORMATION | wxOK); + return; + } + + _grid->LoadOperations(_operations, 0, 0); + + _wxUI->Layout(); +} + +void ExportPanel::OnButtonExport(wxCommandEvent& event) +{ + if (!_operations || !_operations->size()) + { + wxMessageBox(_("No operation to save"), wxT("Error"), wxICON_ERROR | wxOK); + return; + } + + wxFileDialog saveFileDialog(this, _("Save as"), wxT(""), wxT(""), + _kiss->GetExportEngineExtensions(), wxFD_SAVE|wxFD_OVERWRITE_PROMPT); + + if (saveFileDialog.ShowModal() == wxID_CANCEL) + return; + + _exportEngine = _kiss->GetExportEngine(saveFileDialog.GetPath()); + + if (!_exportEngine) + { + wxMessageBox(_("Any engine can process this file !"), wxT("KissCount"), wxICON_INFORMATION | wxOK); + + return ; + } + + if (_exportEngine->SaveFile(_operations)) + wxMessageBox(_("Operations successfuly saved"), wxT("KissCount"), wxICON_INFORMATION | wxOK); + else + wxMessageBox(_("Failed to save operations"), wxT("Error"), wxICON_ERROR | wxOK); + +} + +void ExportPanel::OnShow(wxShowEvent& event) +{ + _wxUI->SetTitle(_("KissCount - Export")); +} diff --git a/src/view/ExportPanel.h b/src/view/ExportPanel.h new file mode 100644 index 0000000..67c2be8 --- /dev/null +++ b/src/view/ExportPanel.h @@ -0,0 +1,65 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef EXPORTPANEL_H +#define EXPORTPANEL_H + +#include +#include +#include +#include +#include "view.h" +#include "grid/CalendarEditor.h" +#include "grid/wxGridCellBitmapRenderer.h" +#include "grid/GridAccount.h" +#include "SearchBanner.h" +#include +#include + +class GridAccount; +class SearchBanner; +class ExportEngine; + +class ExportPanel: public KissPanel +{ +public: + ExportPanel(KissCount* kiss, wxUI *parent); + ~ExportPanel(); + + KissPanel* CreatePanel(); + wxBitmapButton* GetButton(int id); + wxString GetToolTip(); + void OnShow(wxShowEvent& event); + + void OnButtonSearch(wxCommandEvent& event); + void OnButtonExport(wxCommandEvent& event); + +private: + std::vector *_operations; + SearchBanner* _banner; + GridAccount *_grid; + wxButton* _searchButton, *_exportButton; + ExportEngine* _exportEngine; + + static void OnEnter(void* caller, wxCommandEvent& event); + + DECLARE_EVENT_TABLE(); +}; + +#endif diff --git a/src/view/SearchBanner.cpp b/src/view/SearchBanner.cpp new file mode 100644 index 0000000..3ffd8d9 --- /dev/null +++ b/src/view/SearchBanner.cpp @@ -0,0 +1,226 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "SearchBanner.h" + +enum {DESCRIPTION_ID=1, CALENDAR_FROM_ID, CALENDAR_TO_ID}; + +BEGIN_EVENT_TABLE(SearchBanner, wxPanel) +EVT_CALENDAR_SEL_CHANGED(CALENDAR_TO_ID, SearchBanner::OnCalendarToChange) +EVT_TEXT_ENTER(DESCRIPTION_ID, SearchBanner::OnEnter) +END_EVENT_TABLE() + +#define UNESCAPE_CHARS(s) { \ + s.Replace(wxT("\\\""), wxT("\""), true); \ + s.Replace(wxT("\\\'"), wxT("\'"), true); \ + } + +SearchBanner::SearchBanner(KissCount* kiss, wxPanel *parent, void* caller, OnButtonEnter enterCallback) : wxPanel(parent), _kiss(kiss), _caller(caller), _enterCallback(enterCallback), _operations(NULL) +{ + DEFAULT_FONT(font); + User* user = _kiss->GetUser(); + std::vector::iterator accountIt; + std::vector::iterator categoryIt; + wxDateTime firstOfMonth; + wxRect rect = wxDisplay().GetGeometry(); + + wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); + + SetSizer(vbox); + + _checkDateFrom = new wxCheckBox(this, wxID_ANY, _("Date from")); + _checkDateTo = new wxCheckBox(this, wxID_ANY, _("Date to")); + + _checkDateFrom->SetValue(wxT("1")); + _checkDateTo->SetValue(wxT("1")); + + wxGridBagSizer *gridBagSizer = new wxGridBagSizer(3, 10); + + firstOfMonth.SetToCurrent(); + firstOfMonth.SetDay(1); + _calendarFrom = new wxCalendarCtrl(this, CALENDAR_FROM_ID, firstOfMonth, wxDefaultPosition, wxDefaultSize, + wxCAL_MONDAY_FIRST); + _calendarTo = new wxCalendarCtrl(this, CALENDAR_TO_ID, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, + wxCAL_MONDAY_FIRST); + + + _description = new wxTextCtrl(this, DESCRIPTION_ID); + _description->SetWindowStyle(_description->GetWindowStyle() | wxTE_PROCESS_ENTER); + wxSize size = _description->GetSize(); + size.SetWidth(size.GetWidth()*2); + _description->SetMinSize(size); + _amountFrom = new wxTextCtrl(this, wxID_ANY); + _amountTo = new wxTextCtrl(this, wxID_ANY); + + _category = new wxCheckListBox(this, wxID_ANY); + _category->Append(_("Unknown")); + for(categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++) + _category->Append(wxGetTranslation(categoryIt->name)); + + wxString stypes[] = {_("Fix"), _("Non fix"), _("Checked"), _("Not checked")}; + _optype = new wxCheckListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, stypes); + + _account = new wxCheckListBox(this, wxID_ANY); + _account->Append(_("Unknown")); + for(accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); accountIt++) + _account->Append(accountIt->name); + + wxStaticText* labelDescription = new wxStaticText(this, wxID_ANY, _("Description")); + wxStaticText* labelAmountFrom = new wxStaticText(this, wxID_ANY, _("Amount from")); + wxStaticText* labelAmountTo = new wxStaticText(this, wxID_ANY, _("Amount to")); + wxStaticText* labelCategory = new wxStaticText(this, wxID_ANY, _("Category")); + wxStaticText* labelOperations = new wxStaticText(this, wxID_ANY, _("Operations")); + wxStaticText* labelAccount = new wxStaticText(this, wxID_ANY, _("Account")); + + gridBagSizer->Add(labelDescription, wxGBPosition(0, 0)); + gridBagSizer->Add(_description, wxGBPosition(1, 0)); + gridBagSizer->Add(_checkDateFrom, wxGBPosition(0, 1)); + gridBagSizer->Add(_calendarFrom, wxGBPosition(1, 1)); + gridBagSizer->Add(_checkDateTo, wxGBPosition(0, 2)); + gridBagSizer->Add(_calendarTo, wxGBPosition(1, 2)); + gridBagSizer->Add(labelAmountFrom, wxGBPosition(0, 3)); + gridBagSizer->Add(_amountFrom, wxGBPosition(1, 3)); + gridBagSizer->Add(labelAmountTo, wxGBPosition(0, 4)); + gridBagSizer->Add(_amountTo, wxGBPosition(1, 4)); + gridBagSizer->Add(labelCategory, wxGBPosition(0, 5)); + gridBagSizer->Add(_category, wxGBPosition(1, 5)); + gridBagSizer->Add(labelOperations, wxGBPosition(0, 6)); + gridBagSizer->Add(_optype, wxGBPosition(1, 6)); + gridBagSizer->Add(labelAccount, wxGBPosition(0, 7)); + gridBagSizer->Add(_account, wxGBPosition(1, 7)); + + vbox->Add(gridBagSizer, 0, wxGROW|wxALL, 5); +} + +SearchBanner::~SearchBanner() +{ + if (_operations) delete _operations; +} + +std::vector * SearchBanner::Search() +{ + wxString *description=NULL, *amountFrom=NULL, *amountTo=NULL; + std::vector categories, accounts; + wxDateTime *dateFrom=NULL, *dateTo=NULL; + User* user= _kiss->GetUser(); + int i, types=0; + std::vector::iterator it; + double af, at; + + if (_operations) + { + delete _operations; + _operations = NULL; + } + + if (_checkDateFrom->IsChecked()) + { + dateFrom = new wxDateTime; + *dateFrom = _calendarFrom->GetDate(); + } + + if (_checkDateTo->IsChecked()) + { + dateTo = new wxDateTime; + *dateTo = _calendarTo->GetDate(); + } + + if (dateFrom && dateTo && *dateFrom > *dateTo) + { + wxMessageBox(_("Invalid date range"), _("Error"), wxICON_ERROR | wxOK); + goto end; + } + + if (_amountFrom->GetLineText(0).Length()) + { + amountFrom = new wxString; + *amountFrom = _amountFrom->GetLineText(0); + if (!amountFrom->ToDouble(&af)) + { + wxMessageBox(_("Invalid amount from"), _("Error"), wxICON_ERROR | wxOK); + goto end; + } + + if (af < 0) af *= -1; + } + + if (_amountTo->GetLineText(0).Length()) + { + amountTo = new wxString; + *amountTo = _amountTo->GetLineText(0); + if (!amountTo->ToDouble(&at)) + { + wxMessageBox(_("Invalid amount to"), _("Error"), wxICON_ERROR | wxOK); + goto end; + } + + if (at < 0) at *= -1; + } + + if (amountFrom && amountTo && af > at) + { + wxMessageBox(_("Invalid amount range"), _("Error"), wxICON_ERROR | wxOK); + goto end; + } + + if (_description->GetLineText(0).Length()) + { + description = new wxString; + *description = _description->GetLineText(0); + } + + for(i=0; iGetCategoriesNumber(); i++) + if (_category->IsChecked(i)) + categories.push_back((i) ? user->_categories[i-1].id : wxT("0")); + + types |= (_optype->IsChecked(0)) ? FIX_OP : 0; + types |= (_optype->IsChecked(1)) ? NON_FIX_OP : 0; + types |= (_optype->IsChecked(2)) ? CHECKED_OP : 0; + types |= (_optype->IsChecked(3)) ? NOT_CHECKED_OP : 0; + + for(i=0; iGetAccountsNumber(); i++) + if (_account->IsChecked(i)) + accounts.push_back((i) ? user->_accounts[i-1].id : wxT("0")); + + _operations = _kiss->Search(description, dateFrom, dateTo, amountFrom, amountTo, categories,types, accounts); + +end: + delete dateFrom; + delete dateTo; + delete amountFrom; + delete amountTo; + + return _operations; +} + +void SearchBanner::OnEnter(wxCommandEvent& event) +{ + if (_enterCallback) + _enterCallback(_caller, event); +} + +void SearchBanner::OnCalendarFromChange(wxCalendarEvent& event) +{ + _checkDateFrom->SetValue(true); +} + +void SearchBanner::OnCalendarToChange(wxCalendarEvent& event) +{ + _checkDateTo->SetValue(true); +} diff --git a/src/view/SearchBanner.h b/src/view/SearchBanner.h new file mode 100644 index 0000000..bf3bc7b --- /dev/null +++ b/src/view/SearchBanner.h @@ -0,0 +1,60 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef SEARCHBANNER_H +#define SEARCHBANNER_H + +#include +#include +#include +#include +#include "view.h" +#include "grid/CalendarEditor.h" + +#include + +typedef void (*OnButtonEnter)(void* caller, wxCommandEvent& event); + +class SearchBanner: public wxPanel +{ +public: + SearchBanner(KissCount* kiss, wxPanel* parent, void* caller=NULL, OnButtonEnter enterCallback=NULL); + ~SearchBanner(); + + void OnEnter(wxCommandEvent& event); + void OnButtonSearch(wxCommandEvent& event); + void OnCalendarFromChange(wxCalendarEvent& event); + void OnCalendarToChange(wxCalendarEvent& event); + + std::vector * Search(); + +private: + KissCount* _kiss; + void* _caller; + OnButtonEnter _enterCallback; + + std::vector *_operations; + wxCalendarCtrl* _calendarFrom, *_calendarTo; + wxCheckBox *_checkDateFrom, *_checkDateTo; + wxTextCtrl* _description, *_amountFrom, *_amountTo; + wxCheckListBox* _category, *_account, *_optype; + DECLARE_EVENT_TABLE(); +}; + +#endif From ebe9ef4a62b8264b4260d52a5aff78d8e3cac41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 3 Jul 2011 07:56:48 +0200 Subject: [PATCH 69/72] Some modification where not commited previously ??? --- src/controller/KissCount.cpp | 91 +++++++++++-- src/controller/KissCount.h | 23 +++- src/model/Database.cpp | 3 +- src/model/Database.h | 9 +- src/model/export/XMLExportEngine.cpp | 6 + src/view/AccountPanel.cpp | 3 +- src/view/SearchPanel.cpp | 192 ++------------------------- src/view/SearchPanel.h | 16 +-- src/view/grid/GridAccount.cpp | 46 ++++--- src/view/view.h | 1 + src/view/wxUI.cpp | 1 + src/view/wxUI.h | 1 + 12 files changed, 165 insertions(+), 227 deletions(-) diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 28a7967..f75c109 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -19,7 +19,8 @@ #include "KissCount.h" -std::vector KissCount::_importEngines; +std::vector * KissCount::_importEngines; +std::vector * KissCount::_exportEngines; KissCount::KissCount(const char* bdd_filename) : _user(NULL) { @@ -51,6 +52,9 @@ KissCount::~KissCount() { delete _db; delete _wxUI; + delete _importEngines; + delete _exportEngines; + if (_user) delete _user; } @@ -568,18 +572,21 @@ wxString KissCount::CompactFont(const wxFont& font) void KissCount::UnRegisterImportEngine(ImportEngine* engine) { std::vector::iterator it; + std::vector* importEngines = KissCount::GetImportEngines(); - for(it=_importEngines.begin(); it!=_importEngines.end(); it++) + for(it=importEngines->begin(); it!=importEngines->end(); it++) if (*it == engine) { - _importEngines.erase(it); + importEngines->erase(it); break; } } void KissCount::RegisterImportEngine(ImportEngine* engine) { - _importEngines.push_back(engine); + std::vector* importEngines = KissCount::GetImportEngines(); + + importEngines->push_back(engine); } wxString KissCount::GetImportEngineExtensions() @@ -587,12 +594,13 @@ wxString KissCount::GetImportEngineExtensions() wxString res; std::vector::iterator it; int i; + std::vector* importEngines = KissCount::GetImportEngines(); - for(i=0; i<(int)_importEngines.size()-1; i++) - res = res + _importEngines[i]->GetFileExt() + wxT("|") ; + for(i=0; i<(int)importEngines->size()-1; i++) + res = res + (*importEngines)[i]->GetFileExt() + wxT("|") ; - if (_importEngines.size()) - res = res + _importEngines[i]->GetFileExt(); + if (importEngines->size()) + res = res + (*importEngines)[i]->GetFileExt(); return res; } @@ -600,8 +608,9 @@ wxString KissCount::GetImportEngineExtensions() ImportEngine* KissCount::GetImportEngine(wxString path) { std::vector::iterator it; + std::vector* importEngines = KissCount::GetImportEngines(); - for(it=_importEngines.begin(); it!=_importEngines.end(); it++) + for(it=importEngines->begin(); it!=importEngines->end(); it++) if ((*it)->HandleFile(path, _user, _db, this)) return *it; @@ -612,3 +621,67 @@ void KissCount::UpdateImportPattern() { _db->UpdateImportPattern(_user); } + +void KissCount::UnRegisterExportEngine(ExportEngine* engine) +{ + std::vector::iterator it; + std::vector* exportEngines = KissCount::GetExportEngines(); + + for(it=exportEngines->begin(); it!=exportEngines->end(); it++) + if (*it == engine) + { + exportEngines->erase(it); + break; + } +} + +void KissCount::RegisterExportEngine(ExportEngine* engine) +{ + std::vector* exportEngines = KissCount::GetExportEngines(); + + exportEngines->push_back(engine); +} + +wxString KissCount::GetExportEngineExtensions() +{ + wxString res; + std::vector::iterator it; + int i; + std::vector* exportEngines = KissCount::GetExportEngines(); + + for(i=0; i<(int)exportEngines->size()-1; i++) + res = res + (*exportEngines)[i]->GetFileExt() + wxT("|") ; + + if (exportEngines->size()) + res = res + (*exportEngines)[i]->GetFileExt(); + + return res; +} + +ExportEngine* KissCount::GetExportEngine(wxString path) +{ + std::vector::iterator it; + std::vector* exportEngines = KissCount::GetExportEngines(); + + for(it=exportEngines->begin(); it!=exportEngines->end(); it++) + if ((*it)->HandleFile(path, _user, _db, this)) + return *it; + + return NULL; +} + +std::vector* KissCount::GetImportEngines() +{ + if (!_importEngines) + _importEngines = new std::vector; + + return _importEngines; +} + +std::vector* KissCount::GetExportEngines() +{ + if (!_exportEngines) + _exportEngines = new std::vector; + + return _exportEngines; +} diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index e741390..6b03553 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -32,9 +33,17 @@ #define APP_VERSION "0.2" +#define ESCAPE_CHARS(s) { \ + if (s.Find(wxT("\\\"")) == wxNOT_FOUND) \ + s.Replace(wxT("\""), wxT("\\\""), true); \ + if (s.Find(wxT("\\\'")) == wxNOT_FOUND) \ + s.Replace(wxT("\'"), wxT("\\\'"), true); \ + } + class wxUI; class Database; class ImportEngine; +class ExportEngine; class KissCount { @@ -111,12 +120,24 @@ public: wxString GetImportEngineExtensions(); ImportEngine* GetImportEngine(wxString path); + static void RegisterExportEngine(ExportEngine* engine); + static void UnRegisterExportEngine(ExportEngine* engine); + + wxString GetExportEngineExtensions(); + ExportEngine* GetExportEngine(wxString path); + void UpdateImportPattern(); + private: wxUI* _wxUI; Database* _db; User* _user; - static std::vector _importEngines; + + static std::vector *GetImportEngines(); + static std::vector *GetExportEngines(); + + static std::vector *_importEngines; + static std::vector *_exportEngines; }; #endif diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 3535a47..6e0d8e1 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1496,8 +1496,9 @@ std::vector* Database::Search(User* user, wxString* description, wxDa op.fix_cost = set.GetBool(wxT("fix_cost")); op.checked = set.GetBool(wxT("checked")); op.transfert = set.GetAsString(wxT("transfert")); - op.formula = set.GetAsString(wxT("formula")); + op.formula = set.GetAsString(wxT("formula")); op.meta = set.GetBool(wxT("meta")); + op._virtual = set.GetBool(wxT("virtual")); res->push_back(op); } diff --git a/src/model/Database.h b/src/model/Database.h index e0732c8..7e7b15c 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -30,7 +30,7 @@ #include #include -#include "../controller/KissCount.h" +#include #include "model.h" #define DATABASE_VERSION 2 @@ -90,13 +90,6 @@ #define EXECUTE_SQL_UPDATE(req, return_value) EXECUTE_SQL_UPDATE_WITH_CODE(req, return_value, {}, {}) -#define ESCAPE_CHARS(s) { \ - if (s.Find(wxT("\\\"")) == wxNOT_FOUND) \ - s.Replace(wxT("\""), wxT("\\\""), true); \ - if (s.Find(wxT("\\\'")) == wxNOT_FOUND) \ - s.Replace(wxT("\'"), wxT("\\\'"), true); \ - } - class KissCount; class User; diff --git a/src/model/export/XMLExportEngine.cpp b/src/model/export/XMLExportEngine.cpp index 760a462..1cdf6e2 100644 --- a/src/model/export/XMLExportEngine.cpp +++ b/src/model/export/XMLExportEngine.cpp @@ -47,6 +47,8 @@ bool XMLExportEngine::SaveAccounts() { account = _user->GetAccount(it->first); + ESCAPE_CHARS(account.name); + xmlTextWriterStartElement(_writer, (const xmlChar*) "account"); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "id", (const xmlChar*) account.id.utf8_str().data()); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "name", (const xmlChar*) account.name.utf8_str().data()); @@ -89,6 +91,8 @@ bool XMLExportEngine::SaveCategories() { category = _user->GetCategory(it->first); + ESCAPE_CHARS(category.name); + xmlTextWriterStartElement(_writer, (const xmlChar*) "category"); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "id", (const xmlChar*) category.id.utf8_str().data()); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "name", (const xmlChar*) category.name.utf8_str().data()); @@ -114,6 +118,8 @@ bool XMLExportEngine::SaveOperations(std::vector* operations) for(it=operations->begin(); it!=operations->end(); it++) { + ESCAPE_CHARS(it->description); + xmlTextWriterStartElement(_writer, (const xmlChar*) "operation"); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "id", (const xmlChar*) it->id.utf8_str().data()); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "parent", (const xmlChar*) it->parent.utf8_str().data()); diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index d999cb8..e86beda 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -141,7 +141,8 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare vbox3->Add(buttonUnGroup, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); vbox3->Add(_radioMode, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 50); - hbox->Add(vbox3, 0, wxGROW|wxALL, 2); + hbox->Add(vbox3, 0, wxALL, 2); + // hbox->Add(vbox3, 0, wxGROW|wxALL, 2); hbox2->Add(_accountsGrid, 0, wxGROW|wxALL, 2); hbox2->Add(_calendar, 0, wxALL, 2); vbox2->Add(hbox2, 0); diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 5753b2f..dca32ee 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -19,30 +19,21 @@ #include "AccountPanel.h" -enum {DESCRIPTION_ID=1, SEARCH_ID, GRID_ID, CALENDAR_FROM_ID, CALENDAR_TO_ID, +enum {SEARCH_ID=1, GRID_ID, CHANGE_ACCOUNT_ID, CHANGE_CATEGORY_ID, RENAME_ID}; BEGIN_EVENT_TABLE(SearchPanel, wxPanel) EVT_BUTTON(SEARCH_ID, SearchPanel::OnButtonSearch) -EVT_CALENDAR_SEL_CHANGED(CALENDAR_FROM_ID, SearchPanel::OnCalendarFromChange) -EVT_CALENDAR_SEL_CHANGED(CALENDAR_TO_ID, SearchPanel::OnCalendarToChange) EVT_GRID_CMD_CELL_CHANGE(GRID_ID, SearchPanel::OnOperationModified) EVT_BUTTON(CHANGE_ACCOUNT_ID, SearchPanel::OnButtonChangeAccount) EVT_BUTTON(CHANGE_CATEGORY_ID, SearchPanel::OnButtonChangeCategory) EVT_BUTTON(RENAME_ID, SearchPanel::OnButtonRename) EVT_SHOW(SearchPanel::OnShow) -EVT_TEXT_ENTER(DESCRIPTION_ID, SearchPanel::OnEnter) END_EVENT_TABLE() -#define UNESCAPE_CHARS(s) { \ - s.Replace(wxT("\\\""), wxT("\""), true); \ - s.Replace(wxT("\\\'"), wxT("\'"), true); \ - } - SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _operations(NULL) { DEFAULT_FONT(font); - User* user = _kiss->GetUser(); std::vector::iterator accountIt; std::vector::iterator categoryIt; wxDateTime firstOfMonth; @@ -53,72 +44,13 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); SetSizer(vbox); - - _checkDateFrom = new wxCheckBox(this, wxID_ANY, _("Date from")); - _checkDateTo = new wxCheckBox(this, wxID_ANY, _("Date to")); - - _checkDateFrom->SetValue(wxT("1")); - _checkDateTo->SetValue(wxT("1")); - - wxGridBagSizer *gridBagSizer = new wxGridBagSizer(3, 10); - - firstOfMonth.SetToCurrent(); - firstOfMonth.SetDay(1); - _calendarFrom = new wxCalendarCtrl(this, CALENDAR_FROM_ID, firstOfMonth, wxDefaultPosition, wxDefaultSize, - wxCAL_MONDAY_FIRST); - _calendarTo = new wxCalendarCtrl(this, CALENDAR_TO_ID, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, - wxCAL_MONDAY_FIRST); - - _description = new wxTextCtrl(this, DESCRIPTION_ID); - _description->SetWindowStyle(_description->GetWindowStyle() | wxTE_PROCESS_ENTER); - wxSize size = _description->GetSize(); - size.SetWidth(size.GetWidth()*2); - _description->SetMinSize(size); - _amountFrom = new wxTextCtrl(this, wxID_ANY); - _amountTo = new wxTextCtrl(this, wxID_ANY); - - _category = new wxCheckListBox(this, wxID_ANY); - _category->Append(_("Unknown")); - for(categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++) - _category->Append(wxGetTranslation(categoryIt->name)); - - wxString stypes[] = {_("Fix"), _("Non fix"), _("Checked"), _("Not checked")}; - _optype = new wxCheckListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, stypes); - - _account = new wxCheckListBox(this, wxID_ANY); - _account->Append(_("Unknown")); - for(accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); accountIt++) - _account->Append(accountIt->name); - _searchButton = new wxButton(this, SEARCH_ID, _("Search")); - wxStaticText* labelDescription = new wxStaticText(this, wxID_ANY, _("Description")); - wxStaticText* labelAmountFrom = new wxStaticText(this, wxID_ANY, _("Amount from")); - wxStaticText* labelAmountTo = new wxStaticText(this, wxID_ANY, _("Amount to")); - wxStaticText* labelCategory = new wxStaticText(this, wxID_ANY, _("Category")); - wxStaticText* labelOperations = new wxStaticText(this, wxID_ANY, _("Operations")); - wxStaticText* labelAccount = new wxStaticText(this, wxID_ANY, _("Account")); + _banner = new SearchBanner(kiss, this, this, OnEnter); - gridBagSizer->Add(labelDescription, wxGBPosition(0, 0)); - gridBagSizer->Add(_description, wxGBPosition(1, 0)); - gridBagSizer->Add(_checkDateFrom, wxGBPosition(0, 1)); - gridBagSizer->Add(_calendarFrom, wxGBPosition(1, 1)); - gridBagSizer->Add(_checkDateTo, wxGBPosition(0, 2)); - gridBagSizer->Add(_calendarTo, wxGBPosition(1, 2)); - gridBagSizer->Add(labelAmountFrom, wxGBPosition(0, 3)); - gridBagSizer->Add(_amountFrom, wxGBPosition(1, 3)); - gridBagSizer->Add(labelAmountTo, wxGBPosition(0, 4)); - gridBagSizer->Add(_amountTo, wxGBPosition(1, 4)); - gridBagSizer->Add(labelCategory, wxGBPosition(0, 5)); - gridBagSizer->Add(_category, wxGBPosition(1, 5)); - gridBagSizer->Add(labelOperations, wxGBPosition(0, 6)); - gridBagSizer->Add(_optype, wxGBPosition(1, 6)); - gridBagSizer->Add(labelAccount, wxGBPosition(0, 7)); - gridBagSizer->Add(_account, wxGBPosition(1, 7)); - gridBagSizer->Add(_searchButton, wxGBPosition(2, 0)); - - vbox->Add(gridBagSizer, 0, wxGROW|wxALL, 5); + vbox->Add(_banner, 0, wxGROW|wxALL, 5); + vbox->Add(_searchButton, 0, wxALL, 5); _grid = new GridAccount(_kiss, this, GRID_ID, false, false, true); @@ -145,7 +77,6 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent SearchPanel::~SearchPanel() { - if (_operations) delete _operations; } KissPanel* SearchPanel::CreatePanel() @@ -166,111 +97,18 @@ wxString SearchPanel::GetToolTip() return _("Search"); } -void SearchPanel::Search() +void SearchPanel::OnEnter(void* caller, wxCommandEvent& event) { - wxString *description=NULL, *amountFrom=NULL, *amountTo=NULL; - std::vector categories, accounts; - wxDateTime *dateFrom=NULL, *dateTo=NULL; - User* user= _kiss->GetUser(); - int i, types=0; - std::vector::iterator it; - double af, at; + SearchPanel* _this = (SearchPanel*) caller; - if (_calendarFrom->GetDate() > _calendarTo->GetDate()) - { - wxMessageBox(_("Invalid date range"), _("Error"), wxICON_ERROR | wxOK); - return; - } - - if (_amountFrom->GetLineText(0).Length()) - { - amountFrom = new wxString; - *amountFrom = _amountFrom->GetLineText(0); - if (!amountFrom->ToDouble(&af)) - { - wxMessageBox(_("Invalid amount from"), _("Error"), wxICON_ERROR | wxOK); - delete amountFrom; - return; - } - - if (af < 0) af *= -1; - } - - if (_amountTo->GetLineText(0).Length()) - { - amountTo = new wxString; - *amountTo = _amountTo->GetLineText(0); - if (!amountTo->ToDouble(&at)) - { - wxMessageBox(_("Invalid amount to"), _("Error"), wxICON_ERROR | wxOK); - delete amountFrom; - delete amountTo; - return; - } - - if (at < 0) at *= -1; - } - - if (amountFrom && amountTo && af > at) - { - wxMessageBox(_("Invalid amount range"), _("Error"), wxICON_ERROR | wxOK); - delete amountFrom; - delete amountTo; - return; - } - - _grid->DeleteRows(1, _grid->GetNumberRows()-1); - - if (_description->GetLineText(0).Length()) - { - description = new wxString; - *description = _description->GetLineText(0); - } - - if (_checkDateFrom->IsChecked()) - { - dateFrom = new wxDateTime; - *dateFrom = _calendarFrom->GetDate(); - } - - if (_checkDateTo->IsChecked()) - { - dateTo = new wxDateTime; - *dateTo = _calendarTo->GetDate(); - } - - if (dateFrom && dateTo && *dateFrom > *dateTo) - { - ; - } - - for(i=0; iGetCategoriesNumber(); i++) - if (_category->IsChecked(i)) - categories.push_back((i) ? user->_categories[i-1].id : wxT("0")); - - types |= (_optype->IsChecked(0)) ? FIX_OP : 0; - types |= (_optype->IsChecked(1)) ? NON_FIX_OP : 0; - types |= (_optype->IsChecked(2)) ? CHECKED_OP : 0; - types |= (_optype->IsChecked(3)) ? NOT_CHECKED_OP : 0; - - for(i=0; iGetAccountsNumber(); i++) - if (_account->IsChecked(i)) - accounts.push_back((i) ? user->_accounts[i-1].id : wxT("0")); - - if (_operations) - delete _operations; - - _operations = _kiss->Search(description, dateFrom, dateTo, amountFrom, amountTo, categories,types, accounts); -} - -void SearchPanel::OnEnter(wxCommandEvent& event) -{ - OnButtonSearch(event); + _this->OnButtonSearch(event); } void SearchPanel::OnButtonSearch(wxCommandEvent& event) { - Search(); + _operations = _banner->Search(); + + if (!_operations) return; if (_operations->size() > 1) wxMessageBox(wxString::Format(wxT("%d"), _operations->size()) + _(" entries found"), wxT("KissCount"), wxICON_INFORMATION | wxOK); @@ -416,16 +254,6 @@ void SearchPanel::OnShow(wxShowEvent& event) _wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") + _("Search")); } -void SearchPanel::OnCalendarFromChange(wxCalendarEvent& event) -{ - _checkDateFrom->SetValue(true); -} - -void SearchPanel::OnCalendarToChange(wxCalendarEvent& event) -{ - _checkDateTo->SetValue(true); -} - void SearchPanel::OnOperationModified(wxGridEvent& event) { _wxUI->NeedReload(); diff --git a/src/view/SearchPanel.h b/src/view/SearchPanel.h index ce80751..b60ee0b 100644 --- a/src/view/SearchPanel.h +++ b/src/view/SearchPanel.h @@ -29,10 +29,12 @@ #include "grid/wxGridCellBitmapRenderer.h" #include "grid/GridAccount.h" #include "AccountPanel.h" +#include "SearchBanner.h" #include class GridAccount; +class SearchBanner; class SearchPanel: public KissPanel { @@ -45,26 +47,22 @@ public: wxString GetToolTip(); void OnShow(wxShowEvent& event); - void OnEnter(wxCommandEvent& event); + /* void OnEnter(wxCommandEvent& event); */ void OnButtonSearch(wxCommandEvent& event); void OnOperationModified(wxGridEvent& event); - void OnCalendarFromChange(wxCalendarEvent& event); - void OnCalendarToChange(wxCalendarEvent& event); void OnButtonChangeAccount(wxCommandEvent& event); void OnButtonChangeCategory(wxCommandEvent& event); void OnButtonRename(wxCommandEvent& event); private: - void Search(); - std::vector *_operations; - wxCalendarCtrl* _calendarFrom, *_calendarTo; + SearchBanner* _banner; GridAccount *_grid; - wxCheckBox *_checkDateFrom, *_checkDateTo; - wxTextCtrl* _description, *_amountFrom, *_amountTo; - wxCheckListBox* _category, *_account, *_optype; wxButton* _searchButton, *_renameButton, *_changeAccountButton, *_changeCategoryButton; + + static void OnEnter(void* caller, wxCommandEvent& event); + DECLARE_EVENT_TABLE(); }; diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 7cff7d9..1f52762 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -588,7 +588,8 @@ int GridAccount::RemoveMeta(Operation op, int line, bool removeRoot, bool delete if (deleteOp) { DeleteOperation(op2); - _kiss->DeleteOperation(op2); + if (_databaseSynchronization) + _kiss->DeleteOperation(op2); } } } @@ -603,7 +604,8 @@ int GridAccount::RemoveMeta(Operation op, int line, bool removeRoot, bool delete if (deleteOp) { DeleteOperation(op); - _kiss->DeleteOperation(op); + if (_databaseSynchronization) + _kiss->DeleteOperation(op); } deletedOperations++; } @@ -728,19 +730,27 @@ void GridAccount::OnOperationModified(wxGridEvent& event) op_complete--; } - if (col == DESCRIPTION && GetCellValue(row, OP_DATE).Length() && + if (col == DESCRIPTION && (!GetCellValue(row, CATEGORY).Length() || - !GetCellValue(row, ACCOUNT).Length() || - !_canAddOperation)) + !GetCellValue(row, ACCOUNT).Length())) { new_op.fix_cost = (row <= _fixCosts); - if (_kiss->SearchPreviousOperation(&op_tmp, new_op, new_op.month, new_op.year, _canAddOperation)) + if (_kiss->SearchPreviousOperation(&op_tmp, new_op, _curMonth, _curYear, _canAddOperation)) { - new_op.category = op_tmp.category; - new_op.account = op_tmp.account; - SetCellValue(row, CATEGORY, wxGetTranslation(user->GetCategoryName(new_op.category))); - SetCellValue(row, ACCOUNT, user->GetAccountName(new_op.account)); - op_complete -= 2; + if (!GetCellValue(row, CATEGORY).Length()) + { + new_op.category = op_tmp.category; + SetCellValue(row, CATEGORY, wxGetTranslation(user->GetCategoryName(new_op.category))); + op_complete--; + } + + if (!GetCellValue(row, ACCOUNT).Length()) + { + new_op.account = op_tmp.account; + SetCellValue(row, ACCOUNT, user->GetAccountName(new_op.account)); + op_complete--; + } + col = CATEGORY; new_op.fix_cost = (new_op.category == user->GetCategoryId(wxT("Fix"))); } @@ -861,7 +871,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) } // Modify a fix operation - if (row < _fixCosts) + if (row < _fixCosts || !_canAddOperation) { if (col == OP_DELETE) { @@ -885,7 +895,8 @@ void GridAccount::OnOperationModified(wxGridEvent& event) DeleteRows(row, 1); DeleteOperation(cur_op); - _kiss->DeleteOperation(cur_op); + if (_databaseSynchronization) + _kiss->DeleteOperation(cur_op); _displayedOperations.erase(_displayedOperations.begin()+row); if (cur_op.parent.Length() && op_tmp.childs.size() < 2) @@ -901,7 +912,8 @@ void GridAccount::OnOperationModified(wxGridEvent& event) row = GetDisplayedRow(cur_op.parent); DeleteRows(row, 1); DeleteOperation(op_tmp); - _kiss->DeleteOperation(op_tmp); + if (_databaseSynchronization) + _kiss->DeleteOperation(op_tmp); _displayedOperations.erase(_displayedOperations.begin()+row); _fixCosts--; } @@ -997,7 +1009,8 @@ void GridAccount::OnOperationModified(wxGridEvent& event) DeleteRows(row, 1); DeleteOperation(cur_op); _displayedOperations.erase(_displayedOperations.begin()+row); - _kiss->DeleteOperation(cur_op); + if (_databaseSynchronization) + _kiss->DeleteOperation(cur_op); if (cur_op.parent.Length() && op_tmp.childs.size() <= 1) { @@ -1012,7 +1025,8 @@ void GridAccount::OnOperationModified(wxGridEvent& event) row = GetDisplayedRow(cur_op.parent); DeleteRows(row, 1); DeleteOperation(op_tmp); - _kiss->DeleteOperation(op_tmp); + if (_databaseSynchronization) + _kiss->DeleteOperation(op_tmp); _displayedOperations.erase(_displayedOperations.begin()+row); } diff --git a/src/view/view.h b/src/view/view.h index de0c0d4..5360adb 100644 --- a/src/view/view.h +++ b/src/view/view.h @@ -35,6 +35,7 @@ #define SEARCH_ICON RESSOURCES_ROOT "icons/Search-icon.png" #define PREFS_ICON RESSOURCES_ROOT "icons/options-icon.png" #define IMPORT_ICON RESSOURCES_ROOT "icons/import-icon.png" +#define EXPORT_ICON RESSOURCES_ROOT "icons/export-icon.png" #define CHANGE_USER_ICON RESSOURCES_ROOT "icons/Clients-icon.png" #define ABOUT_ICON RESSOURCES_ROOT "icons/windows-users-icon.png" #define QUIT_ICON RESSOURCES_ROOT "icons/system-log-out.png" diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 25e9fb7..99798d2 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -155,6 +155,7 @@ void wxUI::InitPanels() ADD_PANEL(SearchPanel, 2); ADD_PANEL(PreferencesPanel, 3); ADD_PANEL(ImportPanel, 4); + ADD_PANEL(ExportPanel, 5); } void wxUI::LoadPanels() diff --git a/src/view/wxUI.h b/src/view/wxUI.h index 1cc0bbe..921ee6b 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -30,6 +30,7 @@ class ImportEngine; #include "SearchPanel.h" #include "StatsPanel.h" #include "ImportPanel.h" +#include "ExportPanel.h" #include #include "grid/wxMyGrid.h" #include "grid/wxGridCellFastBoolEditor.h" From 753b499b4898d58c1305fd428944fc4e653ee970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Mon, 4 Jul 2011 20:23:00 +0200 Subject: [PATCH 70/72] Add XMLImportEngine Fix some bugs in ImportPanel and ImportEngines --- ChangeLog | 6 +- src/controller/KissCount.cpp | 26 ++- src/controller/KissCount.h | 10 +- src/model/AccountAmount.h | 44 ++++ src/model/Database.cpp | 26 ++- src/model/Database.h | 6 +- src/model/export/ExportEngine.cpp | 44 +++- src/model/export/ExportEngine.h | 22 +- src/model/export/XMLExportEngine.cpp | 11 +- src/model/import/GrisbiImportEngine.cpp | 30 ++- src/model/import/GrisbiImportEngine.h | 2 - src/model/import/ImportEngine.cpp | 6 + src/model/import/ImportEngine.h | 5 + src/model/import/OFXImportEngine.cpp | 9 + src/model/import/XMLImportEngine.cpp | 294 ++++++++++++++++++++++++ src/model/import/XMLImportEngine.h | 44 ++++ src/view/AccountPanel.cpp | 4 +- src/view/ImportPanel.cpp | 103 ++++++--- src/view/ImportPanel.h | 5 + src/view/SearchBanner.cpp | 6 - src/view/grid/GridAccount.cpp | 11 +- 21 files changed, 597 insertions(+), 117 deletions(-) create mode 100644 src/model/AccountAmount.h create mode 100644 src/model/import/XMLImportEngine.cpp create mode 100644 src/model/import/XMLImportEngine.h diff --git a/ChangeLog b/ChangeLog index bbf41af..ff45129 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2 (28/05/2011) +v0.2 (04/07/2011) ** User ** Better use of sizers (so better interface!) @@ -14,10 +14,12 @@ v0.2 (28/05/2011) Add Real mode Database is now at ~/.kisscount/kc.bdd Add Debian's packages !! - Add Import Panel, OFX and Grisbi imports + Add Import Panel, XML, OFX and Grisbi imports + Add Export Panel (only XML) Add update next months Change charts and real/virtual mode position Add "non fix" category to statistics (sum of all non fix categories) + Auto completion does not require date to be set ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index f75c109..54793d7 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -104,23 +104,27 @@ double KissCount::CalcAccountAmount(const wxString& id, int month, int year, boo return _db->CalcAccountAmount(id, month, year, had_values); } -void KissCount::UpdateOperation(Operation& op) +void KissCount::UpdateOperation(Operation& op, bool checkTransfert) { // Unlink - op.transfert = wxT(""); - _user->LinkOrUnlinkOperation(op); + if (checkTransfert) + { + op.transfert = wxT(""); + _user->LinkOrUnlinkOperation(op); + } - _db->UpdateOperation(_user, op); + _db->UpdateOperation(_user, op, checkTransfert); // Link - _user->LinkOrUnlinkOperation(op); + if (checkTransfert) + _user->LinkOrUnlinkOperation(op); } -wxString KissCount::AddOperation(Operation& op) +wxString KissCount::AddOperation(Operation& op, bool checkTransfert) { - wxString ret = _db->AddOperation(_user, op); + wxString ret = _db->AddOperation(_user, op, checkTransfert); - if (op.transfert.Length()) + if (checkTransfert && op.transfert.Length()) _user->LinkOrUnlinkOperation(op); return ret; @@ -159,9 +163,9 @@ double KissCount::MetaPositiveAmount(const wxString& id) return _db->MetaPositiveAmount(id); } -void KissCount::SetAccountAmount(int month, int year, const wxString& accountId, double amount) +void KissCount::SetAccountAmount(const wxString& accountId, int month, int year, double amount) { - _db->SetAccountAmount(month, year, accountId, amount); + _db->SetAccountAmount(accountId, month, year, amount); } wxString KissCount::AddAccount(Account& ac) @@ -173,7 +177,7 @@ wxString KissCount::AddAccount(Account& ac) curDate.SetToCurrent(); - SetAccountAmount((int)curDate.GetMonth(), curDate.GetYear(), ac.id, 0.0); + SetAccountAmount(ac.id, (int)curDate.GetMonth(), curDate.GetYear(), 0.0); return ac.id; } diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index 6b03553..a8d0c42 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -40,6 +40,10 @@ s.Replace(wxT("\'"), wxT("\\\'"), true); \ } +#define UNESCAPE_CHARS(s) { \ + s.Replace(wxT("\\\""), wxT("\""), true); \ + s.Replace(wxT("\\\'"), wxT("\'"), true); \ + } class wxUI; class Database; class ImportEngine; @@ -62,15 +66,15 @@ public: void LoadYear(int year, bool force=false); - wxString AddOperation(Operation& op); - void UpdateOperation(Operation& op); + wxString AddOperation(Operation& op, bool checkTransfert=true); + void UpdateOperation(Operation& op, bool checkTransfert=true); void DeleteOperation(Operation& op); void DeleteOperations(int month, int year); double MetaAmount(const wxString& id); double MetaPositiveAmount(const wxString& id); double GetAccountAmount(const wxString& id, int month, int year); - void SetAccountAmount(int month, int year, const wxString& accountId, double value); + void SetAccountAmount(const wxString& accountId, int month, int year, double value); double CalcAccountAmount(const wxString& id, int month, int year, bool* had_values); wxString AddAccount(Account& ac); diff --git a/src/model/AccountAmount.h b/src/model/AccountAmount.h new file mode 100644 index 0000000..79bd690 --- /dev/null +++ b/src/model/AccountAmount.h @@ -0,0 +1,44 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef ACCOUNTAMOUNT_H +#define ACCOUNTAMOUNT_H + +class AccountAmount { +public: + wxString account; + int month; + int year; + bool operator()(const AccountAmount& x, const AccountAmount& y) const + { + long x1, y1; + + if (x.account != y.account) + { + x.account.ToLong(&x1); + y.account.ToLong(&y1); + + return x1 < y1; + } + + return (x.year < y.year || ((x.year == y.year) && x.month < y.month)); + } +}; + +#endif diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 6e0d8e1..9f6ec23 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -91,10 +91,13 @@ void Database::CreateDatabase() wxString message = _("No database found, would you like to create a new one ?\n\n"); message += _("!! Warning !! If there was a bug, the old database will be suppressed !"); - wxMessageDialog dialog(NULL, message, wxT("KissCount"), wxYES_NO); + if (dirname.DirExists()) + { + wxMessageDialog dialog(NULL, message, wxT("KissCount"), wxYES_NO); - if (dialog.ShowModal() == wxID_NO) - throw std::string("No database") ; + if (dialog.ShowModal() == wxID_NO) + throw std::string("No database") ; + } init_script.open(INIT_SCRIPT); @@ -400,7 +403,7 @@ double Database::GetAccountAmount(const wxString& id, int month, int year) res = set.GetDouble(wxT("amount")); else { - SetAccountAmount(month, year, id, 0.0); + SetAccountAmount(id, month, year, 0.0); res = 0.0; } @@ -550,11 +553,12 @@ void Database::LinkOrUnlinkOperation(User* user, Operation& op) } } -void Database::UpdateOperation(User* user, Operation& op) +void Database::UpdateOperation(User* user, Operation& op, bool checkTransfert) { wxString req; - LinkOrUnlinkOperation(user, op); + if (checkTransfert) + LinkOrUnlinkOperation(user, op); ESCAPE_CHARS(op.description); @@ -589,10 +593,11 @@ void Database::UpdateOperation(User* user, Operation& op) EXECUTE_SQL_UPDATE(req, ); - LinkOrUnlinkOperation(user, op); + if (checkTransfert) + LinkOrUnlinkOperation(user, op); } -wxString Database::AddOperation(User* user, Operation& op) +wxString Database::AddOperation(User* user, Operation& op, bool checkTransfert) { wxString req, res; wxSQLite3ResultSet set; @@ -631,7 +636,8 @@ wxString Database::AddOperation(User* user, Operation& op) op.id = res; - LinkOrUnlinkOperation(user, op); + if (checkTransfert) + LinkOrUnlinkOperation(user, op); return res; } @@ -783,7 +789,7 @@ double Database::MetaPositiveAmount(const wxString& id) return res; } -void Database::SetAccountAmount(int month, int year, const wxString& accountId, double amount) +void Database::SetAccountAmount(const wxString& accountId, int month, int year, double amount) { wxString req; req = wxT("UPDATE account_amount SET ") ; diff --git a/src/model/Database.h b/src/model/Database.h index 7e7b15c..e741ef1 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -104,8 +104,8 @@ public: User* LoadUser(const wxString& name); void LoadYear(User* user, int year); - void UpdateOperation(User* user, Operation& op); - wxString AddOperation(User* user, Operation& op); + void UpdateOperation(User* user, Operation& op, bool checkTransfert=true); + wxString AddOperation(User* user, Operation& op, bool checkTransfert=true); void DeleteOperation(User* user, Operation& op); void DeleteOperations(User* user, int month, int year); bool LoadOperation(User* user, const wxString& id); @@ -113,7 +113,7 @@ public: double MetaPositiveAmount(const wxString& id); double GetAccountAmount(const wxString& id, int month, int year); - void SetAccountAmount(int month, int year, const wxString& accountId, double amount); + void SetAccountAmount(const wxString& accountId, int month, int year, double amount); double CalcAccountAmount(const wxString& id, int month, int year, bool* had_values); wxString AddAccount(User* user, Account& ac); diff --git a/src/model/export/ExportEngine.cpp b/src/model/export/ExportEngine.cpp index d276358..db65e10 100644 --- a/src/model/export/ExportEngine.cpp +++ b/src/model/export/ExportEngine.cpp @@ -42,6 +42,10 @@ bool ExportEngine::SaveFile(std::vector* operations) int i; wxString account, category; AccountAmount accountAmount; + int minMonth = -1, minYear = -1; + unsigned int maxMonth = -1, maxYear = -1; + unsigned int month, year; + std::map::iterator it; if (!operations) return NULL; @@ -54,23 +58,45 @@ bool ExportEngine::SaveFile(std::vector* operations) account = (*operations)[i].account; category = (*operations)[i].category; - accountAmount.account = account; - accountAmount.month = (*operations)[i].month; - accountAmount.year = (*operations)[i].year; + if (minYear == -1 || (int)(*operations)[i].year < minYear) + maxYear = minYear = (*operations)[i].year; - if (account.Length()) + if (minMonth == -1 || ((int)(*operations)[i].month < minMonth && (int)(*operations)[i].year == minYear)) + maxMonth = minMonth = (*operations)[i].month; + + if ((*operations)[i].year > maxYear) { - if (!_accounts.count(account)) - _accounts[account]++; - - if (!_accountAmounts.count(accountAmount)) - _accountAmounts[accountAmount] = _kiss->GetAccountAmount(accountAmount.account, accountAmount.month, accountAmount.year); + maxYear = (*operations)[i].year; + maxMonth = (*operations)[i].month; } + if ((*operations)[i].month > maxMonth && (*operations)[i].year == maxYear) + maxMonth = (*operations)[i].month; + + if (account.Length() && !_accounts.count(account)) + _accounts[account]++; + if (category.Length() && !_categories.count(category)) _categories[category]++; } + for(it=_accounts.begin(); it!=_accounts.end(); it++) + { + month = minMonth; + for (year = minYear; year <= maxYear; year++) + { + for (; !(month > maxMonth && year == maxYear) && month < 12; month++) + { + accountAmount.account = it->first; + accountAmount.month = month; + accountAmount.year = year; + + _accountAmounts[accountAmount] = _kiss->GetAccountAmount(accountAmount.account, accountAmount.month, accountAmount.year); + } + month = 0; + } + } + return true; } diff --git a/src/model/export/ExportEngine.h b/src/model/export/ExportEngine.h index 4ecf2f9..50976f9 100644 --- a/src/model/export/ExportEngine.h +++ b/src/model/export/ExportEngine.h @@ -22,30 +22,10 @@ #include #include +#include class KissCount; -class AccountAmount { -public: - wxString account; - int month; - int year; - bool operator()(const AccountAmount& x, const AccountAmount& y) const - { - long x1, y1; - - if (x.account != y.account) - { - x.account.ToLong(&x1); - y.account.ToLong(&y1); - - return x1 < y1; - } - - return (x.year < y.year && x.month < y.month); - } -}; - class ExportEngine { public: ExportEngine(); diff --git a/src/model/export/XMLExportEngine.cpp b/src/model/export/XMLExportEngine.cpp index 1cdf6e2..be78faf 100644 --- a/src/model/export/XMLExportEngine.cpp +++ b/src/model/export/XMLExportEngine.cpp @@ -48,15 +48,16 @@ bool XMLExportEngine::SaveAccounts() account = _user->GetAccount(it->first); ESCAPE_CHARS(account.name); + ESCAPE_CHARS(account.number); xmlTextWriterStartElement(_writer, (const xmlChar*) "account"); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "id", (const xmlChar*) account.id.utf8_str().data()); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "name", (const xmlChar*) account.name.utf8_str().data()); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "number", (const xmlChar*) account.number.utf8_str().data()); - xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "shared", (const xmlChar*) (account.shared ? "1" : "0")); + // xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "shared", (const xmlChar*) (account.shared ? "1" : "0")); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "blocked", (const xmlChar*) (account.blocked ? "1" : "0")); - xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "default", (const xmlChar*) (account._default ? "1" : "0")); - xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "is_owner", (const xmlChar*) (account.is_owner ? "1" : "0")); + // xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "default", (const xmlChar*) (account._default ? "1" : "0")); + // xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "is_owner", (const xmlChar*) (account.is_owner ? "1" : "0")); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "virtual", (const xmlChar*) (account._virtual ? "1" : "0")); xmlTextWriterEndElement(_writer); } @@ -100,11 +101,11 @@ bool XMLExportEngine::SaveCategories() rgb = category.backcolor.Blue(); rgb |= category.backcolor.Green() << 8; rgb |= category.backcolor.Red() << 16; - xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "backcolor", "%08X", rgb); + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "backcolor", "0x%08X", rgb); rgb = category.forecolor.Blue(); rgb |= category.forecolor.Green() << 8; rgb |= category.forecolor.Red() << 16; - xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "forecolor", "%08X", rgb); + xmlTextWriterWriteFormatAttribute(_writer, (const xmlChar*) "forecolor", "0x%08X", rgb); xmlTextWriterWriteAttribute(_writer, (const xmlChar*) "fix_cost", (const xmlChar*) (category.fix_cost ? "1" : "0")); xmlTextWriterEndElement(_writer); } diff --git a/src/model/import/GrisbiImportEngine.cpp b/src/model/import/GrisbiImportEngine.cpp index d5d0de1..9fb267d 100644 --- a/src/model/import/GrisbiImportEngine.cpp +++ b/src/model/import/GrisbiImportEngine.cpp @@ -44,6 +44,9 @@ void GrisbiImportEngine::LoadAccount(GrisbiImportEngine* _this, const char** att account_number += key; + UNESCAPE_CHARS(name); + UNESCAPE_CHARS(account_number); + for (i=0; i<(int)_this->_user->_accounts.size(); i++) { if (_this->_user->_accounts[i].number == account_number) @@ -56,6 +59,11 @@ void GrisbiImportEngine::LoadAccount(GrisbiImportEngine* _this, const char** att _this->_accounts[id] = wxT("unknown-") + account_number; ac.number = account_number; ac.name = name; + ac.shared = false; + ac.blocked = false; + ac._default = false; + ac.is_owner = true; + ac._virtual = false; _this->_unresolvedAccounts.push_back(ac); } @@ -74,6 +82,8 @@ void GrisbiImportEngine::LoadCategory(GrisbiImportEngine* _this, const char** at id = wxString(attrs[i+1], wxConvUTF8); } + UNESCAPE_CHARS(name); + for (i=0; i<(int)_this->_user->_categories.size(); i++) { if (_this->_user->_categories[i].name == name) @@ -86,6 +96,10 @@ void GrisbiImportEngine::LoadCategory(GrisbiImportEngine* _this, const char** at _this->_categories[id] = wxT("unknown-") + name; cat.id = id; cat.name = name; + cat.parent = wxT("0"); + cat.backcolor = OWN_GREEN ; + cat.forecolor = *wxBLACK; + cat.fix_cost = false; _this->_unresolvedCategories.push_back(cat); } @@ -134,6 +148,8 @@ void GrisbiImportEngine::LoadOperation(GrisbiImportEngine* _this, const char** a op.description = wxString(attrs[i+1], wxConvUTF8); } + UNESCAPE_CHARS(op.description); + _this->_operations.push_back(op); _this->_descriptions[op.id] = op.description; @@ -193,7 +209,19 @@ GrisbiImportEngine::~GrisbiImportEngine() bool GrisbiImportEngine::HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss) { + int res = -1; + if (!ImportEngine::HandleFile(path, user, db, kiss)) return false; - return xmlSAXUserParseFile(&_sax, this, path.mb_str()) >= 0; + try + { + res = xmlSAXUserParseFile(&_sax, this, path.mb_str()); + } + catch (const char* s) + { + std::cout << "GrisbiImportEngine :: " << s << std::endl; + res = -1; + } + + return res >= 0; } diff --git a/src/model/import/GrisbiImportEngine.h b/src/model/import/GrisbiImportEngine.h index 4d1c75b..ec238ea 100644 --- a/src/model/import/GrisbiImportEngine.h +++ b/src/model/import/GrisbiImportEngine.h @@ -30,8 +30,6 @@ public: ~GrisbiImportEngine(); virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss); - /* virtual std::vector ParseFile(); */ - /* virtual std::vector* GetOperations(std::map& accounts); */ private: xmlSAXHandler _sax; diff --git a/src/model/import/ImportEngine.cpp b/src/model/import/ImportEngine.cpp index c68e642..11fc6ca 100644 --- a/src/model/import/ImportEngine.cpp +++ b/src/model/import/ImportEngine.cpp @@ -38,6 +38,7 @@ bool ImportEngine::HandleFile(const wxString& path, User* user, Database* db, Ki _unresolvedAccounts.clear(); _operations.clear(); _descriptions.clear(); + _accountAmounts.clear(); return path.EndsWith(_shortExt) || path.EndsWith(_shortExt.Upper()); } @@ -307,3 +308,8 @@ std::vector* ImportEngine::GetOperations(std::map return &_operations; } + +const std::map& ImportEngine::GetAccountAmounts() +{ + return _accountAmounts; +} diff --git a/src/model/import/ImportEngine.h b/src/model/import/ImportEngine.h index b6949d5..9db452e 100644 --- a/src/model/import/ImportEngine.h +++ b/src/model/import/ImportEngine.h @@ -22,6 +22,7 @@ #include #include +#include class KissCount; @@ -52,10 +53,13 @@ public: // Final Step virtual std::vector* GetOperations(std::map& accounts, std::map& categories); + const std::map& GetAccountAmounts(); + void MatchPattern(wxString& key, Operation& op); int UpdatePattern(int pos); static wxString RemoveUnused(const wxString& s); + protected: Database* _db; User* _user; @@ -71,6 +75,7 @@ protected: std::vector _unresolvedCategories; std::vector _operations; std::map _descriptions; + std::map _accountAmounts; void ApplyPattern(ImportPattern& pattern, Operation& op); wxString FindPattern(wxString& s1, wxString& s2); diff --git a/src/model/import/OFXImportEngine.cpp b/src/model/import/OFXImportEngine.cpp index a5039c5..25e6073 100644 --- a/src/model/import/OFXImportEngine.cpp +++ b/src/model/import/OFXImportEngine.cpp @@ -30,6 +30,8 @@ int OFXImportEngine::account_cb(const struct OfxAccountData data, void * account _this->_curAccount = wxT(""); + UNESCAPE_CHARS(account_number); + for (i=0; i<(int)_this->_user->_accounts.size(); i++) { if (_this->_user->_accounts[i].number == account_number) @@ -46,6 +48,11 @@ int OFXImportEngine::account_cb(const struct OfxAccountData data, void * account { _this->_curAccount = _this->_accounts[account_number] = wxT("unknown-") + account_number; ac.number = account_number; + ac.shared = false; + ac.blocked = false; + ac._default = false; + ac.is_owner = true; + ac._virtual = false; _this->_unresolvedAccounts.push_back(ac); } @@ -94,6 +101,8 @@ int OFXImportEngine::transaction_cb(const struct OfxTransactionData data, void * op.description += wxString(data.memo, wxConvUTF8); } + UNESCAPE_CHARS(op.description); + _this->_operations.push_back(op); _this->_descriptions[op.id] = op.description; diff --git a/src/model/import/XMLImportEngine.cpp b/src/model/import/XMLImportEngine.cpp new file mode 100644 index 0000000..692b587 --- /dev/null +++ b/src/model/import/XMLImportEngine.cpp @@ -0,0 +1,294 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "XMLImportEngine.h" + +static XMLImportEngine xmlImportEngine; + +void XMLImportEngine::LoadAccount(XMLImportEngine* _this, const char** attrs) +{ + int i; + wxString account_number, name, id; + Account ac; + + for (i=0; attrs[i]; i+=2) + { + if (!strcmp(attrs[i], "name")) + ac.name = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "id")) + ac.id = id = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "number")) + ac.number = account_number = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "blocked")) + ac.blocked = (wxString(attrs[i+1], wxConvUTF8) == wxT("1")); + + else if (!strcmp(attrs[i], "virtual")) + ac._virtual = (wxString(attrs[i+1], wxConvUTF8) == wxT("1")); + } + + UNESCAPE_CHARS(ac.name); + UNESCAPE_CHARS(ac.number); + + ac._default = false; + ac.shared = false; + ac.is_owner = true; + + if (account_number.Length()) + { + for (i=0; i<(int)_this->_user->_accounts.size(); i++) + { + if (_this->_user->_accounts[i].number == account_number) + { + _this->_accounts[id] = _this->_user->_accounts[i].id; + return; + } + } + } + + _this->_accounts[id] = wxT("unknown-") + account_number; + _this->_unresolvedAccounts.push_back(ac); +} + +void XMLImportEngine::LoadAccountAmount(XMLImportEngine* _this, const char** attrs) +{ + AccountAmount accountAmount; + int i; + long v; + double amount; + + for (i=0; attrs[i]; i+=2) + { + if (!strcmp(attrs[i], "account")) + accountAmount.account = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "month")) + { + wxString(attrs[i+1], wxConvUTF8).ToLong(&v); + accountAmount.month = v; + } + + else if (!strcmp(attrs[i], "year")) + { + wxString(attrs[i+1], wxConvUTF8).ToLong(&v); + accountAmount.year = v; + } + + else if (!strcmp(attrs[i], "amount")) + wxString(attrs[i+1], wxConvUTF8).ToDouble(&amount); + } + + _this->_accountAmounts[accountAmount] = amount; +} + +void XMLImportEngine::LoadCategory(XMLImportEngine* _this, const char** attrs) +{ + wxString name, id; + int i; + long rgb; + Category cat; + + for (i=0; attrs[i]; i+=2) + { + if (!strcmp(attrs[i], "name")) + cat.name = name = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "id")) + cat.id = id = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "font")) + cat.font = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "backcolor")) + { + wxString(attrs[i+1], wxConvUTF8).ToLong(&rgb, 16); + cat.backcolor = wxColour((rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF); + } + + else if (!strcmp(attrs[i], "forecolor")) + { + wxString(attrs[i+1], wxConvUTF8).ToLong(&rgb, 16); + cat.forecolor = wxColour((rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF); + } + + else if (!strcmp(attrs[i], "fix_cost")) + cat.fix_cost = (wxString(attrs[i+1], wxConvUTF8) == wxT("1")); + } + + UNESCAPE_CHARS(cat.name); + + for (i=0; i<(int)_this->_user->_categories.size(); i++) + { + if (_this->_user->_categories[i].name == name) + { + _this->_categories[id] = _this->_user->_categories[i].id; + return; + } + } + + _this->_categories[id] = wxT("unknown-") + name; + _this->_unresolvedCategories.push_back(cat); +} + +void XMLImportEngine::LoadOperation(XMLImportEngine* _this, const char** attrs) +{ + int i; + Operation op; + long v; + double amount; + wxString id; + + for (i=0; attrs[i]; i+=2) + { + if (!strcmp(attrs[i], "id")) + op.id = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "parent")) + op.parent = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "day")) + { + wxString(attrs[i+1], wxConvUTF8).ToLong(&v); + op.day = v; + } + + else if (!strcmp(attrs[i], "month")) + { + wxString(attrs[i+1], wxConvUTF8).ToLong(&v); + op.month = v; + } + + else if (!strcmp(attrs[i], "year")) + { + wxString(attrs[i+1], wxConvUTF8).ToLong(&v); + op.year = v; + } + + else if (!strcmp(attrs[i], "amount")) + { + wxString(attrs[i+1], wxConvUTF8).ToDouble(&amount); + op.amount = amount; + } + + else if (!strcmp(attrs[i], "description")) + op.description = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "category")) + op.category = _this->_categories[wxString(attrs[i+1], wxConvUTF8)]; + + else if (!strcmp(attrs[i], "fix_cost")) + op.fix_cost = (wxString(attrs[i+1], wxConvUTF8) == wxT("1")); + + else if (!strcmp(attrs[i], "account")) + op.account = _this->_accounts[wxString(attrs[i+1], wxConvUTF8)]; + + else if (!strcmp(attrs[i], "checked")) + op.checked = (wxString(attrs[i+1], wxConvUTF8) == wxT("1")); + + else if (!strcmp(attrs[i], "transfert")) + op.transfert = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "formula")) + op.formula = wxString(attrs[i+1], wxConvUTF8); + + else if (!strcmp(attrs[i], "meta")) + op.meta = (wxString(attrs[i+1], wxConvUTF8) == wxT("1")); + + else if (!strcmp(attrs[i], "virtual")) + op._virtual = (wxString(attrs[i+1], wxConvUTF8) == wxT("1")); + } + + UNESCAPE_CHARS(op.description); + + _this->_operations.push_back(op); + _this->_descriptions[op.id] = op.description; + + _this->MatchPattern(op.description, op); +} + +void XMLImportEngine::XmlStartElement(void* user_data, const xmlChar* name_, const xmlChar** attrs_) +{ + XMLImportEngine* _this = (XMLImportEngine*) user_data; + int i; + const char** attrs = (const char**) attrs_; + const char* name = (const char*) name_; + + // if (!first && strcmp(name, "Xml")) + // { + // throw "Invalid file !"; + // } + // else + // first = 1; + + if (!strcmp(name, "kisscount")) + { + for (i=0; attrs[i]; i+=2) + { + if (!strcmp(attrs[i], "version") && strcmp(attrs[i+1], "1")) + throw "Unsupported version !"; + } + } + + else if (!strcmp(name, "account")) + LoadAccount(_this, attrs); + + else if (!strcmp(name, "account_amount")) + LoadAccountAmount(_this, attrs); + + else if (!strcmp(name, "category")) + LoadCategory(_this, attrs); + + else if (!strcmp(name, "operation")) + LoadOperation(_this, attrs); +} + +XMLImportEngine::XMLImportEngine() +{ + KissCount::RegisterImportEngine(this); + + _shortExt = wxT("xml"); + _longExt = _("KissCount xml files (*.xml)|*.xml"); + + _sax.startElement = XmlStartElement ; +} + +XMLImportEngine::~XMLImportEngine() +{ +} + +bool XMLImportEngine::HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss) +{ + int res = -1 ; + + if (!ImportEngine::HandleFile(path, user, db, kiss)) return false; + + try + { + res = xmlSAXUserParseFile(&_sax, this, path.mb_str()) >= 0; + } + catch (const char* s) + { + std::cout << "XMLImportEngine :: " << s << std::endl; + res = -1; + } + + return res >= 0; +} diff --git a/src/model/import/XMLImportEngine.h b/src/model/import/XMLImportEngine.h new file mode 100644 index 0000000..2ab355b --- /dev/null +++ b/src/model/import/XMLImportEngine.h @@ -0,0 +1,44 @@ +/* + Copyright 2010-2011 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef XMLIMPORTENGINE_H +#define XMLIMPORTENGINE_H + +#include + +#include "ImportEngine.h" + +class XMLImportEngine : public ImportEngine { +public: + XMLImportEngine(); + ~XMLImportEngine(); + + virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss); + +private: + xmlSAXHandler _sax; + + static void XmlStartElement(void* user_data, const xmlChar* name_, const xmlChar** attrs_); + static void LoadAccount(XMLImportEngine* _this, const char** attrs); + static void LoadAccountAmount(XMLImportEngine* _this, const char** attrs); + static void LoadCategory(XMLImportEngine* _this, const char** attrs); + static void LoadOperation(XMLImportEngine* _this, const char** attrs); +}; + +#endif diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index e86beda..25c216a 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -715,7 +715,7 @@ void AccountPanel::OnAccountModified(wxGridEvent& event) _accountsGrid->GetCellValue(row, event.GetCol()).ToDouble(&amount); - _kiss->SetAccountAmount(_curMonth, _curYear, id, amount); + _kiss->SetAccountAmount(id, _curMonth, _curYear, amount); _accountsInitValues[id] = amount; UpdateStats(); @@ -1082,7 +1082,7 @@ void AccountPanel::OnUpdateNextMonths(wxCommandEvent& event) if ((cur_amounts[i] - amount) != deltas[i]) continue; cur_amounts[i] = amount + deltas[i]; - _kiss->SetAccountAmount(last_month, last_year, user->_accounts[i].id, cur_amounts[i]); + _kiss->SetAccountAmount(user->_accounts[i].id, last_month, last_year, cur_amounts[i]); cur_amounts[i] += _kiss->CalcAccountAmount(user->_accounts[i].id, last_month, last_year, &had_values); account_updated++; diff --git a/src/view/ImportPanel.cpp b/src/view/ImportPanel.cpp index 9b4b9e0..92d246c 100644 --- a/src/view/ImportPanel.cpp +++ b/src/view/ImportPanel.cpp @@ -150,8 +150,6 @@ void ImportPanel::OnFileEnter(wxCommandEvent& WXUNUSED(event)) void ImportPanel::ProcessFile() { - std::vector accounts; - std::vector categories; User* user = _kiss->GetUser(); int i; wxGridCellChoiceEditor* accountEditor; @@ -179,9 +177,9 @@ void ImportPanel::ProcessFile() return ; } - _importEngine->ParseFile(accounts, categories); + _importEngine->ParseFile(_unresolvedAccounts, _unresolvedCategories); - if (accounts.size()) + if (_unresolvedAccounts.size()) { int nb_accounts = user->GetAccountsNumber(); userAccounts = new wxString[nb_accounts+1]; @@ -195,13 +193,13 @@ void ImportPanel::ProcessFile() _buttonLoadOperations->Enable(); - _accountsGrid->AppendRows(accounts.size()); + _accountsGrid->AppendRows(_unresolvedAccounts.size()); - for (i=0; i<(int)accounts.size(); i++) + for (i=0; i<(int)_unresolvedAccounts.size(); i++) { - _accountsGrid->SetCellValue(i, 0, accounts[i].number); + _accountsGrid->SetCellValue(i, 0, _unresolvedAccounts[i].number); _accountsGrid->SetReadOnly(i, 0); - _accountsGrid->SetCellValue(i, 1, accounts[i].name); + _accountsGrid->SetCellValue(i, 1, _unresolvedAccounts[i].name); _accountsGrid->SetCellValue(i, 2, userAccounts[0]); _accountsGrid->SetCellEditor(i, 2, accountEditor); @@ -211,7 +209,7 @@ void ImportPanel::ProcessFile() _accountsGrid->Layout(); } - if (categories.size()) + if (_unresolvedCategories.size()) { int nb_categories = user->GetCategoriesNumber(); userCategories = new wxString[nb_categories+1]; @@ -225,11 +223,11 @@ void ImportPanel::ProcessFile() _buttonLoadOperations->Enable(); - _categoriesGrid->AppendRows(categories.size()); + _categoriesGrid->AppendRows(_unresolvedCategories.size()); - for (i=0; i<(int)categories.size(); i++) + for (i=0; i<(int)_unresolvedCategories.size(); i++) { - _categoriesGrid->SetCellValue(i, 0, categories[i].name); + _categoriesGrid->SetCellValue(i, 0, _unresolvedCategories[i].name); _categoriesGrid->SetReadOnly(i, 0); _categoriesGrid->SetCellValue(i, 2, userCategories[0]); @@ -240,7 +238,7 @@ void ImportPanel::ProcessFile() _categoriesGrid->Layout(); } - if (!accounts.size() && !categories.size()) + if (!_unresolvedAccounts.size() && !_unresolvedCategories.size()) { OnLoadOperations(event); } @@ -249,19 +247,20 @@ void ImportPanel::ProcessFile() void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) { - std::map resolvedAccounts; - std::map resolvedCategories; int i, nbAccounts=0, nbCategories=0; User* user = _kiss->GetUser(); Account account; Category category; + std::map accounts; + std::map categories; + wxString oldid; for(i=0; i<_accountsGrid->GetNumberRows(); i++) { if (_accountsGrid->GetCellValue(i, 2) == _("Create one")) nbAccounts++; else - resolvedAccounts[_accountsGrid->GetCellValue(i, 0)] = + accounts[_accountsGrid->GetCellValue(i, 0)] = user->GetAccountId(_accountsGrid->GetCellValue(i, 1)); } @@ -270,7 +269,7 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) if (_categoriesGrid->GetCellValue(i, 2) == _("Create one")) nbCategories++; else - resolvedCategories[_categoriesGrid->GetCellValue(i, 0)] = + categories[_categoriesGrid->GetCellValue(i, 0)] = user->GetAccountId(_categoriesGrid->GetCellValue(i, 1)); } @@ -297,18 +296,15 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) { if (_accountsGrid->GetCellValue(i, 2) == _("Create one")) { + account = _unresolvedAccounts[i] ; if (_accountsGrid->GetCellValue(i, 1).Length()) account.name = _accountsGrid->GetCellValue(i, 1); else account.name = _accountsGrid->GetCellValue(i, 0); account.number = _accountsGrid->GetCellValue(i, 0); - account.shared = false; - account.blocked = false; - account._default = false; - account.is_owner = true; - account._virtual = false; - resolvedAccounts[_accountsGrid->GetCellValue(i, 0)] = _kiss->AddAccount(account); + oldid = account.id; + _resolvedAccounts[oldid] = accounts[_accountsGrid->GetCellValue(i, 0)] = _kiss->AddAccount(account); } } @@ -318,16 +314,14 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) { if (_categoriesGrid->GetCellValue(i, 2) == _("Create one")) { + category = _unresolvedCategories[i] ; if (_categoriesGrid->GetCellValue(i, 1).Length()) category.name = _categoriesGrid->GetCellValue(i, 1); else category.name = _categoriesGrid->GetCellValue(i, 0); - category.parent = wxT("0"); - category.backcolor = OWN_GREEN ; - category.forecolor = *wxBLACK; - category.fix_cost = false; - - resolvedCategories[_categoriesGrid->GetCellValue(i, 0)] = category.id = _kiss->AddCategory(category); + + oldid = category.id; + _resolvedCategories[oldid] = categories[_categoriesGrid->GetCellValue(i, 0)] = category.id = _kiss->AddCategory(category); } } @@ -336,7 +330,7 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) _wxUI->NeedReload(); } - _operations = _importEngine->GetOperations(resolvedAccounts, resolvedCategories); + _operations = _importEngine->GetOperations(accounts, categories); if (_operations->size()) { @@ -361,6 +355,12 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event)) void ImportPanel::OnIntegrate(wxCommandEvent& WXUNUSED(event)) { int i; + std::map mapid; + wxString oldid, account; + bool update; + std::map accountAmounts; + std::map::iterator it; + double amount; if (!_operations->size()) return; @@ -371,9 +371,48 @@ void ImportPanel::OnIntegrate(wxCommandEvent& WXUNUSED(event)) _buttonIntegrate->Disable(); for(i=0; i<(int)_operations->size(); i++) - _kiss->AddOperation((*_operations)[i]); + { + oldid = (*_operations)[i].id; + _kiss->AddOperation((*_operations)[i], false); + mapid[oldid] = (*_operations)[i].id; + } - // if (_checkSaveImportPatterns->IsChecked()) + for(i=0; i<(int)_operations->size(); i++) + { + update = false; + + if ((*_operations)[i].parent.Length()) + { + (*_operations)[i].parent = mapid[(*_operations)[i].parent]; + update = true; + } + + if ((*_operations)[i].transfert.Length()) + { + (*_operations)[i].transfert = mapid[(*_operations)[i].transfert]; + update = true; + } + + if (update) + _kiss->UpdateOperation((*_operations)[i], false); + } + + accountAmounts = _importEngine->GetAccountAmounts(); + + for(it=accountAmounts.begin(); it!=accountAmounts.end(); it++) + { + account = it->first.account; + + if (_resolvedAccounts.count(account)) + account = _resolvedAccounts[account]; + + amount = _kiss->GetAccountAmount(account, it->first.month, it->first.year); + + if (!amount) + _kiss->SetAccountAmount(account, it->first.month, it->first.year, it->second); + } + + if (_checkSaveImportPatterns->IsChecked()) _kiss->UpdateImportPattern(); _operations->clear(); diff --git a/src/view/ImportPanel.h b/src/view/ImportPanel.h index 89b460a..8ef365c 100644 --- a/src/view/ImportPanel.h +++ b/src/view/ImportPanel.h @@ -61,6 +61,11 @@ private: wxCheckBox *_checkSaveImportPatterns; std::vector* _operations; + std::vector _unresolvedAccounts; + std::vector _unresolvedCategories; + std::map _resolvedAccounts; + std::map _resolvedCategories; + void ProcessFile(); DECLARE_EVENT_TABLE(); diff --git a/src/view/SearchBanner.cpp b/src/view/SearchBanner.cpp index 3ffd8d9..4ee0d91 100644 --- a/src/view/SearchBanner.cpp +++ b/src/view/SearchBanner.cpp @@ -26,11 +26,6 @@ EVT_CALENDAR_SEL_CHANGED(CALENDAR_TO_ID, SearchBanner::OnCalendarToChange) EVT_TEXT_ENTER(DESCRIPTION_ID, SearchBanner::OnEnter) END_EVENT_TABLE() -#define UNESCAPE_CHARS(s) { \ - s.Replace(wxT("\\\""), wxT("\""), true); \ - s.Replace(wxT("\\\'"), wxT("\'"), true); \ - } - SearchBanner::SearchBanner(KissCount* kiss, wxPanel *parent, void* caller, OnButtonEnter enterCallback) : wxPanel(parent), _kiss(kiss), _caller(caller), _enterCallback(enterCallback), _operations(NULL) { DEFAULT_FONT(font); @@ -38,7 +33,6 @@ SearchBanner::SearchBanner(KissCount* kiss, wxPanel *parent, void* caller, OnBut std::vector::iterator accountIt; std::vector::iterator categoryIt; wxDateTime firstOfMonth; - wxRect rect = wxDisplay().GetGeometry(); wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 1f52762..a07d7d4 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -30,11 +30,6 @@ SetCellFont(row, i, font); \ } -#define UNESCAPE_CHARS(s) { \ - s.Replace(wxT("\\\""), wxT("\""), true); \ - s.Replace(wxT("\\\'"), wxT("\'"), true); \ - } - BEGIN_EVENT_TABLE(GridAccount, wxGrid) EVT_GRID_CELL_LEFT_CLICK(GridAccount::OnCellLeftClick ) END_EVENT_TABLE() @@ -665,7 +660,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event) int op_complete = 6, i, last_day; wxString value ; wxDateTime date; - bool need_insertion = false, fix_op=false; + bool need_insertion = false; static bool inModification = false ; wxColour color ; unsigned char r, g, b; @@ -946,8 +941,6 @@ void GridAccount::OnOperationModified(wxGridEvent& event) UpdateOperation(new_op); (_displayedOperations)[row] = new_op; } - - fix_op = true; } // Add a fixCost else if (row == _fixCosts) @@ -957,7 +950,6 @@ void GridAccount::OnOperationModified(wxGridEvent& event) return ; } need_insertion = true; - fix_op = true; new_op.fix_cost = true; new_op.meta = false; new_op._virtual = false; @@ -1058,7 +1050,6 @@ void GridAccount::OnOperationModified(wxGridEvent& event) return ; } need_insertion = true; - fix_op = false; new_op.fix_cost = false; new_op.meta = false; new_op._virtual = false; From a0208a73d3eeb6d8fce15fe3adb6f21441452c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Mon, 4 Jul 2011 20:25:29 +0200 Subject: [PATCH 71/72] Update translations --- ressources/po/french.mo | Bin 9717 -> 10276 bytes ressources/po/french.po | 268 +++++++++++++++++++++--------------- ressources/po/kisscount.pot | 217 ++++++++++++++++------------- 3 files changed, 279 insertions(+), 206 deletions(-) diff --git a/ressources/po/french.mo b/ressources/po/french.mo index 70fd673e60a635598ba32a16af99d8105652bd51..c16724f51db3c9bbff15fdb2c635f866433b65ca 100644 GIT binary patch delta 4215 zcmZ|Rc~I149LMozmt83pMFc?u{ecIFXF^_7Rwk%qsAb_yEix#+>+_V^{J0T!ViTw?d9U`QjLNkbi#p+*oum3Rs2hA=w#27%x9#ySketj(yYJzo67P~s{dHkae$>%$uad%KSr&MKafA;W*$diDr!wkLQRd&IwwR!nJhrvSdSXvZKxYpqbhU|^?*-M z9iKrZ)Uivf!&Fr1(@~YmK~3QxbYl^!-|?tKN>NiDnn%N-5ya^GkD8lZsFA*as?006 z3J;^EY8Jigfs0Y+8&D%#i%M)gDv>Ac{x($N&)ef~#*T-~AsXuFBUDCTp)&pvwTMoj zD)bxbI#*ik0STx%PeD$ZY}Eau?D_Gisho@y%gjMd*-})ZtI@0XzbV=8*5QFEJKyP z0cW_#6jh1i)Lm=g1ggWoQ6uzR5G!pO>ihuI{TE{{7UH$I5LKZ!P}hBcA(iA94UOPe zd%+o0LS7bx7EK3Ksnbyj4#e&_6g4GNtUjbTrV{l9U4g1#GiKvK%*T_c1p8!Af0cAF zSF7W()`_T+mtqbsx5qc59=HQFl6|O=ykYl0wEM?U{r-$fJf3W|2D+k-4?+#Bs5|wK zj(`JwIp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I|NU>Ep$;!uuc5wp2UW_z6#mUWD?m#w5@RPPe#q>iTWKt zs!2D}g=l+`%q8>465am*8X7!{>>*Q#w!RMj&;0+jpP}88=&z)zQcm%RXX|js2dHfGVBCUr>4bdyNi)folvdQaYFi9n|NC|n0Y$e->{%C2N zKo}A`6KXCqS0iPSlda}-c#QEqC z$>dEk&^ctfTZMjj-Xg);VT;v$>qAzOL1Zb}LLMU8CX)H2P&;f-l6@qTyg?#KI$2A! zWsni%B{GhLk)b4-v?eXvb2K`U&S`wO?NR-VK49Bju~=>2fi~fRzQ%}4F7LyM!M?vE zTe-aMsO8>6QFncH(YY>fyO>YIdZqWwOz4r-uV=QeDdu93?|OW{0RQDP6Z2i(GfBsM Shm)gSzVj&?UEbBHTmJ)Bm_;H0 diff --git a/ressources/po/french.po b/ressources/po/french.po index e2aa3d0..20f08da 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-30 12:37+0200\n" +"POT-Creation-Date: 2011-07-04 20:23+0200\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -19,7 +19,7 @@ msgstr "" # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # -#: src/view/StatsPanel.cpp:361 +#: src/view/StatsPanel.cpp:384 #: src/view/PreferencesPanel.cpp:832 msgid " - " msgstr " - " @@ -33,19 +33,20 @@ msgstr " - " msgid " already exists" msgstr " existe déjà" -#: src/view/ImportPanel.cpp:284 +#: src/view/ImportPanel.cpp:283 msgid " and " msgstr " et " -#: src/view/SearchPanel.cpp:276 +#: src/view/SearchPanel.cpp:114 +#: src/view/ExportPanel.cpp:106 msgid " entries found" msgstr " entrées trouvées" -#: src/model/Database.cpp:103 +#: src/model/Database.cpp:106 msgid " not found, aborting" msgstr " non trouvé, arrêt" -#: src/view/AccountPanel.cpp:858 +#: src/view/AccountPanel.cpp:879 msgid " operations ?" msgstr " opérations ?" @@ -53,7 +54,7 @@ msgstr " opérations ?" msgid " profil ?" msgstr " profil ?" -#: src/view/ImportPanel.cpp:290 +#: src/view/ImportPanel.cpp:289 msgid " will be created, is it ok ?" msgstr " vont être créés, êtes vous d'accord ?" @@ -61,22 +62,23 @@ msgstr " vont être créés, êtes vous d'accord ?" msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "!! Attention !! S'il y a eu un bug, l'ancienne base de donnée va être supprimée !" -#: src/view/ImportPanel.cpp:283 +#: src/view/ImportPanel.cpp:282 #, c-format msgid "%d accounts" msgstr "%d comptes" -#: src/view/ImportPanel.cpp:288 +#: src/view/ImportPanel.cpp:287 #, c-format msgid "%d categories" msgstr "%d catégories" -#: src/view/SearchPanel.cpp:278 +#: src/view/SearchPanel.cpp:116 +#: src/view/ExportPanel.cpp:108 msgid "1 entry found" msgstr "1 entrée trouvée" -#: src/view/SearchPanel.cpp:101 -#: src/view/grid/GridAccount.cpp:68 +#: src/view/SearchBanner.cpp:83 +#: src/view/grid/GridAccount.cpp:63 msgid "Account" msgstr "Compte" @@ -85,7 +87,7 @@ msgstr "Compte" msgid "Account " msgstr "Le compte " -#: src/controller/KissCount.cpp:364 +#: src/controller/KissCount.cpp:372 msgid "Account 1" msgstr "Compte 1" @@ -98,37 +100,38 @@ msgstr "Nom du compte" msgid "Account number" msgstr "Numéro de compte" -#: src/view/StatsPanel.cpp:326 +#: src/view/StatsPanel.cpp:336 #: src/view/PreferencesPanel.cpp:60 msgid "Accounts" msgstr "Comptes" -#: src/view/AccountPanel.cpp:1086 +#: src/view/AccountPanel.cpp:1107 msgid "Accounts updated until " msgstr "Comptes mis à jours jusqu'à " -#: src/view/SearchPanel.cpp:97 +#: src/view/SearchBanner.cpp:79 msgid "Amount from" msgstr "Montant min" -#: src/view/SearchPanel.cpp:98 +#: src/view/SearchBanner.cpp:80 msgid "Amount to" msgstr "Montant max" -#: src/view/AccountPanel.cpp:1093 +#: src/view/AccountPanel.cpp:1114 msgid "Any account updated !" msgstr "Aucun compte mis à jour" -#: src/view/ImportPanel.cpp:177 +#: src/view/ImportPanel.cpp:175 +#: src/view/ExportPanel.cpp:138 msgid "Any engine can process this file !" msgstr "Format de fichier non reconnu" #: src/view/PreferencesPanel.cpp:839 -#: src/view/AccountPanel.cpp:853 +#: src/view/AccountPanel.cpp:874 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " -#: src/view/grid/GridAccount.cpp:854 +#: src/view/grid/GridAccount.cpp:859 msgid "Are you sure want to delete : \n" msgstr "Etes vous sûr de vouloir supprimer : \n" @@ -154,17 +157,17 @@ msgstr "Bloqué" msgid "Cancel" msgstr "Annuler" -#: src/view/grid/GridAccount.cpp:1289 -#: src/view/grid/GridAccount.cpp:1296 +#: src/view/grid/GridAccount.cpp:1294 +#: src/view/grid/GridAccount.cpp:1301 msgid "Cannot group these operations" msgstr "Impossible de grouper ces opérations" -#: src/view/grid/GridAccount.cpp:1415 -#: src/view/grid/GridAccount.cpp:1421 +#: src/view/grid/GridAccount.cpp:1420 +#: src/view/grid/GridAccount.cpp:1426 msgid "Cannot ungroup these operations" msgstr "Impossible de dégrouper ces opérations" -#: src/controller/KissCount.cpp:355 +#: src/controller/KissCount.cpp:363 msgid "Car" msgstr "Voiture" @@ -172,8 +175,8 @@ msgstr "Voiture" msgid "Categories" msgstr "Catégories" -#: src/view/SearchPanel.cpp:99 -#: src/view/grid/GridAccount.cpp:68 +#: src/view/SearchBanner.cpp:81 +#: src/view/grid/GridAccount.cpp:63 msgid "Category" msgstr "Catégorie" @@ -194,11 +197,11 @@ msgstr "Changer de nom" msgid "Change Password" msgstr "Changer le mot de passe" -#: src/view/SearchPanel.cpp:127 +#: src/view/SearchPanel.cpp:59 msgid "Change account" msgstr "Changer de compte" -#: src/view/SearchPanel.cpp:128 +#: src/view/SearchPanel.cpp:60 msgid "Change category" msgstr "Changer la catégorie" @@ -210,7 +213,7 @@ msgstr "Changer le mot de passe" msgid "Check" msgstr "Rapprochement" -#: src/view/SearchPanel.cpp:86 +#: src/view/SearchBanner.cpp:70 msgid "Checked" msgstr "Rapprochée" @@ -218,11 +221,11 @@ msgstr "Rapprochée" msgid "Choose a database to open" msgstr "Choisissez une base de données à ouvrir" -#: src/view/SearchPanel.cpp:316 +#: src/view/SearchPanel.cpp:154 msgid "Choose a new account" msgstr "Nouveau compte" -#: src/view/SearchPanel.cpp:358 +#: src/view/SearchPanel.cpp:196 msgid "Choose a new category" msgstr "Nouvelle catégorie" @@ -230,29 +233,29 @@ msgstr "Nouvelle catégorie" msgid "Confirm password " msgstr "Confirmer le mot de passe " -#: src/view/StatsPanel.cpp:131 +#: src/view/StatsPanel.cpp:142 #: src/view/AccountPanel.cpp:122 msgid "Cost repartition" msgstr "Répartition des coûts" -#: src/view/ImportPanel.cpp:189 -#: src/view/ImportPanel.cpp:219 -#: src/view/ImportPanel.cpp:261 -#: src/view/ImportPanel.cpp:270 -#: src/view/ImportPanel.cpp:298 -#: src/view/ImportPanel.cpp:319 +#: src/view/ImportPanel.cpp:187 +#: src/view/ImportPanel.cpp:217 +#: src/view/ImportPanel.cpp:260 +#: src/view/ImportPanel.cpp:269 +#: src/view/ImportPanel.cpp:297 +#: src/view/ImportPanel.cpp:315 msgid "Create one" msgstr "En créer un" -#: src/view/grid/GridAccount.cpp:68 +#: src/view/grid/GridAccount.cpp:63 msgid "Credit" msgstr "Crédit" -#: src/view/AccountPanel.cpp:225 +#: src/view/AccountPanel.cpp:234 msgid "Cur Credit" msgstr "Cur Crédit" -#: src/view/AccountPanel.cpp:226 +#: src/view/AccountPanel.cpp:235 msgid "Cur Debit" msgstr "Cur Débit" @@ -260,19 +263,19 @@ msgstr "Cur Débit" msgid "Current value" msgstr "Valeur courante" -#: src/view/grid/GridAccount.cpp:68 +#: src/view/grid/GridAccount.cpp:63 msgid "Date" msgstr "Date" -#: src/view/SearchPanel.cpp:57 +#: src/view/SearchBanner.cpp:41 msgid "Date from" msgstr "Date min" -#: src/view/SearchPanel.cpp:58 +#: src/view/SearchBanner.cpp:42 msgid "Date to" msgstr "Date max" -#: src/view/grid/GridAccount.cpp:68 +#: src/view/grid/GridAccount.cpp:63 msgid "Debit" msgstr "Débit" @@ -282,7 +285,7 @@ msgstr "Défaut" #: src/view/PreferencesPanel.cpp:201 #: src/view/PreferencesPanel.cpp:296 -#: src/view/AccountPanel.cpp:712 +#: src/view/AccountPanel.cpp:733 msgid "Delete" msgstr "Supprimer" @@ -290,21 +293,21 @@ msgstr "Supprimer" msgid "Descending" msgstr "Décroissant" -#: src/view/SearchPanel.cpp:96 -#: src/view/grid/GridAccount.cpp:68 +#: src/view/SearchBanner.cpp:78 +#: src/view/grid/GridAccount.cpp:63 msgid "Description" msgstr "Description" -#: src/view/SearchPanel.cpp:400 +#: src/view/SearchPanel.cpp:238 msgid "Enter a new description" msgstr "Nouvelle description" #: src/view/UsersDialog.cpp:95 #: src/view/UsersDialog.cpp:125 -#: src/view/SearchPanel.cpp:181 -#: src/view/SearchPanel.cpp:191 -#: src/view/SearchPanel.cpp:205 -#: src/view/SearchPanel.cpp:216 +#: src/view/SearchBanner.cpp:140 +#: src/view/SearchBanner.cpp:150 +#: src/view/SearchBanner.cpp:163 +#: src/view/SearchBanner.cpp:172 #: src/view/PreferencesPanel.cpp:436 #: src/view/PreferencesPanel.cpp:496 #: src/view/PreferencesPanel.cpp:516 @@ -314,28 +317,37 @@ msgstr "Nouvelle description" #: src/view/PreferencesPanel.cpp:790 #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 -#: src/view/AccountPanel.cpp:849 -#: src/view/grid/GridAccount.cpp:1289 -#: src/view/grid/GridAccount.cpp:1296 -#: src/view/grid/GridAccount.cpp:1415 -#: src/view/grid/GridAccount.cpp:1421 +#: src/view/AccountPanel.cpp:870 +#: src/view/grid/GridAccount.cpp:1294 +#: src/view/grid/GridAccount.cpp:1301 +#: src/view/grid/GridAccount.cpp:1420 +#: src/view/grid/GridAccount.cpp:1426 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 #: src/model/Database.cpp:45 #: src/model/Database.cpp:52 #: src/model/Database.cpp:70 -#: src/model/Database.cpp:103 -#: src/model/Database.cpp:109 -#: src/model/Database.cpp:115 -#: src/model/Database.cpp:123 -#: src/model/Database.cpp:144 +#: src/model/Database.cpp:106 +#: src/model/Database.cpp:112 +#: src/model/Database.cpp:118 +#: src/model/Database.cpp:126 +#: src/model/Database.cpp:147 #: src/model/Database_Update.cpp:23 msgid "Error" msgstr "Erreur" -#: src/model/Database.cpp:144 +#: src/model/Database.cpp:147 msgid "Error creating original database" msgstr "Erreur durant la création de la base de données initiale" +#: src/view/ExportPanel.cpp:55 +#: src/view/ExportPanel.cpp:89 +msgid "Export" +msgstr "Export" + +#: src/view/ExportPanel.cpp:146 +msgid "Failed to save operations" +msgstr "Erreur lors de la sauvegarde des opérations" + #: src/view/ImportPanel.cpp:73 msgid "File account" msgstr "Compte du fichier" @@ -348,9 +360,9 @@ msgstr "Catégorie du fichier" msgid "Final value" msgstr "Valeur finale" -#: src/view/SearchPanel.cpp:86 -#: src/view/grid/GridAccount.cpp:345 -#: src/controller/KissCount.cpp:355 +#: src/view/SearchBanner.cpp:70 +#: src/view/grid/GridAccount.cpp:340 +#: src/controller/KissCount.cpp:363 msgid "Fix" msgstr "Fixe" @@ -371,15 +383,15 @@ msgid "From " msgstr "A partir de " #: src/view/GenerateDialog.cpp:31 -#: src/view/AccountPanel.cpp:709 +#: src/view/AccountPanel.cpp:730 msgid "Generate month" msgstr "Générer mois" -#: src/model/import/GrisbiImportEngine.cpp:185 +#: src/model/import/GrisbiImportEngine.cpp:201 msgid "Grisbi files (*.gsb)|*.gsb" msgstr "Fichiers Grisbi (*.gsb)|*.gsb" -#: src/controller/KissCount.cpp:355 +#: src/controller/KissCount.cpp:363 msgid "Groceries" msgstr "Courses" @@ -387,7 +399,7 @@ msgstr "Courses" msgid "Group" msgstr "Grouper" -#: src/controller/KissCount.cpp:355 +#: src/controller/KissCount.cpp:363 msgid "Hobbies" msgstr "Loisirs" @@ -411,19 +423,19 @@ msgstr "Compte interne" msgid "Internal category" msgstr "Catégorie interne" -#: src/view/SearchPanel.cpp:191 +#: src/view/SearchBanner.cpp:150 msgid "Invalid amount from" msgstr "Montant min invalide" -#: src/view/SearchPanel.cpp:216 +#: src/view/SearchBanner.cpp:172 msgid "Invalid amount range" msgstr "Intervalle des montants invalide" -#: src/view/SearchPanel.cpp:205 +#: src/view/SearchBanner.cpp:163 msgid "Invalid amount to" msgstr "Montant max invalide" -#: src/view/SearchPanel.cpp:181 +#: src/view/SearchBanner.cpp:140 msgid "Invalid date range" msgstr "Intervalle de temps invalide" @@ -443,7 +455,7 @@ msgstr "Ancien mot de passe invalide" msgid "Invalid password" msgstr "Mot de passe invalide" -#: src/view/StatsPanel.cpp:380 +#: src/view/StatsPanel.cpp:403 msgid "Invalide date range" msgstr "Intervalle de temps invalide" @@ -451,7 +463,7 @@ msgstr "Intervalle de temps invalide" msgid "It must be at least one account !" msgstr "Il doit y avoir au moins un compte !" -#: src/view/AccountPanel.cpp:849 +#: src/view/AccountPanel.cpp:870 msgid "It must be at least one month !" msgstr "Il doit rester au moins un mois" @@ -459,17 +471,25 @@ msgstr "Il doit rester au moins un mois" msgid "Kill me" msgstr "Kill me" -#: src/view/StatsPanel.cpp:380 +#: src/view/StatsPanel.cpp:403 #: src/view/PreferencesPanel.cpp:824 #: src/view/PreferencesPanel.cpp:827 #: src/model/Database_Update.cpp:140 msgid "KissCount" msgstr "KissCount" +#: src/view/ExportPanel.cpp:152 +msgid "KissCount - Export" +msgstr "KissCount - Export" + #: src/view/ImportPanel.cpp:128 msgid "KissCount - Import" msgstr "KissCount - Import" +#: src/model/import/XMLImportEngine.cpp:268 +msgid "KissCount xml files (*.xml)|*.xml" +msgstr "Fichiers KissCount xml (*.xml)|*.xml" + #: src/view/PreferencesPanel.cpp:62 msgid "Language" msgstr "Langue" @@ -517,26 +537,33 @@ msgstr "" "Aucune base de données trouvée, voulez vous en créer une nouvelle ?\n" "\n" -#: src/view/SearchPanel.cpp:281 +#: src/view/SearchPanel.cpp:119 +#: src/view/ExportPanel.cpp:111 msgid "No entry found" msgstr "Pas d'entrée trouvée" -#: src/view/ImportPanel.cpp:357 +#: src/view/ImportPanel.cpp:351 msgid "No operation found into this file" msgstr "Aucun opération trouvée dans ce fichier" -#: src/view/SearchPanel.cpp:86 +#: src/view/ExportPanel.cpp:124 +msgid "No operation to save" +msgstr "Aucun opération à sauvegarder" + +#: src/view/StatsPanel.cpp:117 +#: src/view/SearchBanner.cpp:70 +#: src/view/AccountPanel.cpp:237 msgid "Non fix" msgstr "Courantes" -#: src/view/SearchPanel.cpp:311 -#: src/view/SearchPanel.cpp:353 +#: src/view/SearchPanel.cpp:149 +#: src/view/SearchPanel.cpp:191 #: src/view/PreferencesPanel.cpp:441 #: src/view/PreferencesPanel.cpp:702 msgid "None" msgstr "Aucun" -#: src/view/SearchPanel.cpp:86 +#: src/view/SearchBanner.cpp:70 msgid "Not checked" msgstr "Non rapprochée" @@ -544,7 +571,7 @@ msgstr "Non rapprochée" msgid "Number" msgstr "Numéro de compte" -#: src/model/import/OFXImportEngine.cpp:126 +#: src/model/import/OFXImportEngine.cpp:135 msgid "OFX files (*.ofx)|*.ofx" msgstr "Fichiers OFX (*.ofx)|*.ofx" @@ -562,16 +589,20 @@ msgstr "Ancien mot de passe " msgid "Operation order" msgstr "Ordre des opérations" -#: src/view/SearchPanel.cpp:100 -#: src/view/AccountPanel.cpp:185 +#: src/view/SearchBanner.cpp:82 +#: src/view/AccountPanel.cpp:186 msgid "Operations" msgstr "Opérations" -#: src/view/ImportPanel.cpp:382 +#: src/view/ImportPanel.cpp:421 msgid "Operations successfully imported" msgstr "les opérations ont été importées avec succès" -#: src/controller/KissCount.cpp:356 +#: src/view/ExportPanel.cpp:144 +msgid "Operations successfuly saved" +msgstr "Opérations sauvegardées avec succès" + +#: src/controller/KissCount.cpp:364 msgid "Other" msgstr "Autres" @@ -583,7 +614,7 @@ msgstr "Mot de passe " msgid "Password changed" msgstr "Mot de passe changé" -#: src/view/wxUI.cpp:248 +#: src/view/wxUI.cpp:249 msgid "" "Personal accounting software\n" "\n" @@ -611,7 +642,7 @@ msgstr "Re entrez le mot de passe" msgid "Preferences" msgstr "Préférences" -#: src/view/wxUI.cpp:255 +#: src/view/wxUI.cpp:256 msgid "Quit KissCount ?" msgstr "Quitter KissCount ?" @@ -619,25 +650,30 @@ msgstr "Quitter KissCount ?" msgid "Real" msgstr "Réel" -#: src/view/AccountPanel.cpp:227 +#: src/view/AccountPanel.cpp:236 msgid "Remains" msgstr "Restant" -#: src/view/SearchPanel.cpp:129 +#: src/view/SearchPanel.cpp:61 msgid "Rename" msgstr "Renommer" +#: src/view/ExportPanel.cpp:128 +msgid "Save as" +msgstr "Sauvegarder sous" + #: src/view/ImportPanel.cpp:60 msgid "Save import patterns" msgstr "Sauvegarder les motifs d'import" -#: src/view/SearchPanel.cpp:94 -#: src/view/SearchPanel.cpp:166 -#: src/view/SearchPanel.cpp:416 +#: src/view/SearchPanel.cpp:48 +#: src/view/SearchPanel.cpp:97 +#: src/view/SearchPanel.cpp:254 +#: src/view/ExportPanel.cpp:44 msgid "Search" msgstr "Chercher" -#: src/view/StatsPanel.cpp:123 +#: src/view/StatsPanel.cpp:134 #: src/view/AccountPanel.cpp:95 msgid "Serie 1" msgstr "Série 1" @@ -646,8 +682,8 @@ msgstr "Série 1" msgid "Shared with" msgstr "Partagé avec" -#: src/view/StatsPanel.cpp:163 -#: src/view/StatsPanel.cpp:361 +#: src/view/StatsPanel.cpp:172 +#: src/view/StatsPanel.cpp:384 msgid "Statistics" msgstr "Statistiques" @@ -659,11 +695,11 @@ msgstr "A" msgid "To " msgstr "Vers " -#: src/view/AccountPanel.cpp:209 +#: src/view/AccountPanel.cpp:210 msgid "Total Credit" msgstr "Total Crédit" -#: src/view/AccountPanel.cpp:210 +#: src/view/AccountPanel.cpp:211 msgid "Total Debit" msgstr "Total Débit" @@ -671,27 +707,27 @@ msgstr "Total Débit" msgid "UnGroup" msgstr "Dégrouper" -#: src/model/Database.cpp:109 -#: src/model/Database.cpp:115 +#: src/model/Database.cpp:112 +#: src/model/Database.cpp:118 msgid "Unable to Create " msgstr "Impossible de créer " #: src/model/Database.cpp:45 #: src/model/Database.cpp:52 #: src/model/Database.cpp:70 -#: src/model/Database.cpp:123 +#: src/model/Database.cpp:126 msgid "Unable to open Database" msgstr "Impossible d'ouvrir la base de données" -#: src/controller/KissCount.cpp:356 +#: src/controller/KissCount.cpp:364 msgid "Unexpected" msgstr "Exceptionnel" -#: src/view/SearchPanel.cpp:82 -#: src/view/SearchPanel.cpp:90 -#: src/view/AccountPanel.cpp:518 -#: src/view/AccountPanel.cpp:554 -#: src/view/AccountPanel.cpp:592 +#: src/view/SearchBanner.cpp:66 +#: src/view/SearchBanner.cpp:74 +#: src/view/AccountPanel.cpp:529 +#: src/view/AccountPanel.cpp:565 +#: src/view/AccountPanel.cpp:603 #: src/model/User.cpp:59 #: src/model/User.cpp:79 #: src/model/User.cpp:127 @@ -729,7 +765,7 @@ msgstr "Utilisateurs" msgid "Virtual" msgstr "Virtuel" -#: src/view/grid/GridAccount.cpp:1066 +#: src/view/grid/GridAccount.cpp:1071 msgid "Warning" msgstr "Attention" @@ -741,7 +777,11 @@ msgstr "Quel compte va remplacer celui-ci ?" msgid "Wich category will replace this one ?" msgstr "Quelle catégorie va remplacer celle-ci" -#: src/view/grid/GridAccount.cpp:1066 +#: src/model/export/XMLExportEngine.cpp:29 +msgid "XML files (*.xml)|*.xml" +msgstr "Fichiers XML (*.xml)|*.xml" + +#: src/view/grid/GridAccount.cpp:1071 msgid "You made a debit on a blocked account" msgstr "Vous avez effectué une opération de débit sur un compte bloqué" diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index ab074bb..6101e75 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-30 12:37+0200\n" +"POT-Creation-Date: 2011-07-04 20:23+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/view/StatsPanel.cpp:361 src/view/PreferencesPanel.cpp:832 +#: src/view/StatsPanel.cpp:384 src/view/PreferencesPanel.cpp:832 msgid " - " msgstr "" @@ -27,19 +27,19 @@ msgstr "" msgid " already exists" msgstr "" -#: src/view/ImportPanel.cpp:284 +#: src/view/ImportPanel.cpp:283 msgid " and " msgstr "" -#: src/view/SearchPanel.cpp:276 +#: src/view/SearchPanel.cpp:114 src/view/ExportPanel.cpp:106 msgid " entries found" msgstr "" -#: src/model/Database.cpp:103 +#: src/model/Database.cpp:106 msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:858 +#: src/view/AccountPanel.cpp:879 msgid " operations ?" msgstr "" @@ -47,7 +47,7 @@ msgstr "" msgid " profil ?" msgstr "" -#: src/view/ImportPanel.cpp:290 +#: src/view/ImportPanel.cpp:289 msgid " will be created, is it ok ?" msgstr "" @@ -55,21 +55,21 @@ msgstr "" msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "" -#: src/view/ImportPanel.cpp:283 +#: src/view/ImportPanel.cpp:282 #, c-format msgid "%d accounts" msgstr "" -#: src/view/ImportPanel.cpp:288 +#: src/view/ImportPanel.cpp:287 #, c-format msgid "%d categories" msgstr "" -#: src/view/SearchPanel.cpp:278 +#: src/view/SearchPanel.cpp:116 src/view/ExportPanel.cpp:108 msgid "1 entry found" msgstr "" -#: src/view/SearchPanel.cpp:101 src/view/grid/GridAccount.cpp:68 +#: src/view/SearchBanner.cpp:83 src/view/grid/GridAccount.cpp:63 msgid "Account" msgstr "" @@ -77,7 +77,7 @@ msgstr "" msgid "Account " msgstr "" -#: src/controller/KissCount.cpp:364 +#: src/controller/KissCount.cpp:372 msgid "Account 1" msgstr "" @@ -89,35 +89,35 @@ msgstr "" msgid "Account number" msgstr "" -#: src/view/StatsPanel.cpp:326 src/view/PreferencesPanel.cpp:60 +#: src/view/StatsPanel.cpp:336 src/view/PreferencesPanel.cpp:60 msgid "Accounts" msgstr "" -#: src/view/AccountPanel.cpp:1086 +#: src/view/AccountPanel.cpp:1107 msgid "Accounts updated until " msgstr "" -#: src/view/SearchPanel.cpp:97 +#: src/view/SearchBanner.cpp:79 msgid "Amount from" msgstr "" -#: src/view/SearchPanel.cpp:98 +#: src/view/SearchBanner.cpp:80 msgid "Amount to" msgstr "" -#: src/view/AccountPanel.cpp:1093 +#: src/view/AccountPanel.cpp:1114 msgid "Any account updated !" msgstr "" -#: src/view/ImportPanel.cpp:177 +#: src/view/ImportPanel.cpp:175 src/view/ExportPanel.cpp:138 msgid "Any engine can process this file !" msgstr "" -#: src/view/PreferencesPanel.cpp:839 src/view/AccountPanel.cpp:853 +#: src/view/PreferencesPanel.cpp:839 src/view/AccountPanel.cpp:874 msgid "Are you sure want to delete " msgstr "" -#: src/view/grid/GridAccount.cpp:854 +#: src/view/grid/GridAccount.cpp:859 msgid "Are you sure want to delete : \n" msgstr "" @@ -142,15 +142,15 @@ msgstr "" msgid "Cancel" msgstr "" -#: src/view/grid/GridAccount.cpp:1289 src/view/grid/GridAccount.cpp:1296 +#: src/view/grid/GridAccount.cpp:1294 src/view/grid/GridAccount.cpp:1301 msgid "Cannot group these operations" msgstr "" -#: src/view/grid/GridAccount.cpp:1415 src/view/grid/GridAccount.cpp:1421 +#: src/view/grid/GridAccount.cpp:1420 src/view/grid/GridAccount.cpp:1426 msgid "Cannot ungroup these operations" msgstr "" -#: src/controller/KissCount.cpp:355 +#: src/controller/KissCount.cpp:363 msgid "Car" msgstr "" @@ -158,7 +158,7 @@ msgstr "" msgid "Categories" msgstr "" -#: src/view/SearchPanel.cpp:99 src/view/grid/GridAccount.cpp:68 +#: src/view/SearchBanner.cpp:81 src/view/grid/GridAccount.cpp:63 msgid "Category" msgstr "" @@ -178,11 +178,11 @@ msgstr "" msgid "Change Password" msgstr "" -#: src/view/SearchPanel.cpp:127 +#: src/view/SearchPanel.cpp:59 msgid "Change account" msgstr "" -#: src/view/SearchPanel.cpp:128 +#: src/view/SearchPanel.cpp:60 msgid "Change category" msgstr "" @@ -194,7 +194,7 @@ msgstr "" msgid "Check" msgstr "" -#: src/view/SearchPanel.cpp:86 +#: src/view/SearchBanner.cpp:70 msgid "Checked" msgstr "" @@ -202,11 +202,11 @@ msgstr "" msgid "Choose a database to open" msgstr "" -#: src/view/SearchPanel.cpp:316 +#: src/view/SearchPanel.cpp:154 msgid "Choose a new account" msgstr "" -#: src/view/SearchPanel.cpp:358 +#: src/view/SearchPanel.cpp:196 msgid "Choose a new category" msgstr "" @@ -214,25 +214,25 @@ msgstr "" msgid "Confirm password " msgstr "" -#: src/view/StatsPanel.cpp:131 src/view/AccountPanel.cpp:122 +#: src/view/StatsPanel.cpp:142 src/view/AccountPanel.cpp:122 msgid "Cost repartition" msgstr "" -#: src/view/ImportPanel.cpp:189 src/view/ImportPanel.cpp:219 -#: src/view/ImportPanel.cpp:261 src/view/ImportPanel.cpp:270 -#: src/view/ImportPanel.cpp:298 src/view/ImportPanel.cpp:319 +#: src/view/ImportPanel.cpp:187 src/view/ImportPanel.cpp:217 +#: src/view/ImportPanel.cpp:260 src/view/ImportPanel.cpp:269 +#: src/view/ImportPanel.cpp:297 src/view/ImportPanel.cpp:315 msgid "Create one" msgstr "" -#: src/view/grid/GridAccount.cpp:68 +#: src/view/grid/GridAccount.cpp:63 msgid "Credit" msgstr "" -#: src/view/AccountPanel.cpp:225 +#: src/view/AccountPanel.cpp:234 msgid "Cur Credit" msgstr "" -#: src/view/AccountPanel.cpp:226 +#: src/view/AccountPanel.cpp:235 msgid "Cur Debit" msgstr "" @@ -240,19 +240,19 @@ msgstr "" msgid "Current value" msgstr "" -#: src/view/grid/GridAccount.cpp:68 +#: src/view/grid/GridAccount.cpp:63 msgid "Date" msgstr "" -#: src/view/SearchPanel.cpp:57 +#: src/view/SearchBanner.cpp:41 msgid "Date from" msgstr "" -#: src/view/SearchPanel.cpp:58 +#: src/view/SearchBanner.cpp:42 msgid "Date to" msgstr "" -#: src/view/grid/GridAccount.cpp:68 +#: src/view/grid/GridAccount.cpp:63 msgid "Debit" msgstr "" @@ -261,7 +261,7 @@ msgid "Default" msgstr "" #: src/view/PreferencesPanel.cpp:201 src/view/PreferencesPanel.cpp:296 -#: src/view/AccountPanel.cpp:712 +#: src/view/AccountPanel.cpp:733 msgid "Delete" msgstr "" @@ -269,36 +269,44 @@ msgstr "" msgid "Descending" msgstr "" -#: src/view/SearchPanel.cpp:96 src/view/grid/GridAccount.cpp:68 +#: src/view/SearchBanner.cpp:78 src/view/grid/GridAccount.cpp:63 msgid "Description" msgstr "" -#: src/view/SearchPanel.cpp:400 +#: src/view/SearchPanel.cpp:238 msgid "Enter a new description" msgstr "" #: src/view/UsersDialog.cpp:95 src/view/UsersDialog.cpp:125 -#: src/view/SearchPanel.cpp:181 src/view/SearchPanel.cpp:191 -#: src/view/SearchPanel.cpp:205 src/view/SearchPanel.cpp:216 +#: src/view/SearchBanner.cpp:140 src/view/SearchBanner.cpp:150 +#: src/view/SearchBanner.cpp:163 src/view/SearchBanner.cpp:172 #: src/view/PreferencesPanel.cpp:436 src/view/PreferencesPanel.cpp:496 #: src/view/PreferencesPanel.cpp:516 src/view/PreferencesPanel.cpp:727 #: src/view/PreferencesPanel.cpp:746 src/view/PreferencesPanel.cpp:784 #: src/view/PreferencesPanel.cpp:790 src/view/PasswordDialog.cpp:72 -#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:849 -#: src/view/grid/GridAccount.cpp:1289 src/view/grid/GridAccount.cpp:1296 -#: src/view/grid/GridAccount.cpp:1415 src/view/grid/GridAccount.cpp:1421 +#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:870 +#: src/view/grid/GridAccount.cpp:1294 src/view/grid/GridAccount.cpp:1301 +#: src/view/grid/GridAccount.cpp:1420 src/view/grid/GridAccount.cpp:1426 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:45 #: src/model/Database.cpp:52 src/model/Database.cpp:70 -#: src/model/Database.cpp:103 src/model/Database.cpp:109 -#: src/model/Database.cpp:115 src/model/Database.cpp:123 -#: src/model/Database.cpp:144 src/model/Database_Update.cpp:23 +#: src/model/Database.cpp:106 src/model/Database.cpp:112 +#: src/model/Database.cpp:118 src/model/Database.cpp:126 +#: src/model/Database.cpp:147 src/model/Database_Update.cpp:23 msgid "Error" msgstr "" -#: src/model/Database.cpp:144 +#: src/model/Database.cpp:147 msgid "Error creating original database" msgstr "" +#: src/view/ExportPanel.cpp:55 src/view/ExportPanel.cpp:89 +msgid "Export" +msgstr "" + +#: src/view/ExportPanel.cpp:146 +msgid "Failed to save operations" +msgstr "" + #: src/view/ImportPanel.cpp:73 msgid "File account" msgstr "" @@ -311,8 +319,8 @@ msgstr "" msgid "Final value" msgstr "" -#: src/view/SearchPanel.cpp:86 src/view/grid/GridAccount.cpp:345 -#: src/controller/KissCount.cpp:355 +#: src/view/SearchBanner.cpp:70 src/view/grid/GridAccount.cpp:340 +#: src/controller/KissCount.cpp:363 msgid "Fix" msgstr "" @@ -332,15 +340,15 @@ msgstr "" msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:709 +#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:730 msgid "Generate month" msgstr "" -#: src/model/import/GrisbiImportEngine.cpp:185 +#: src/model/import/GrisbiImportEngine.cpp:201 msgid "Grisbi files (*.gsb)|*.gsb" msgstr "" -#: src/controller/KissCount.cpp:355 +#: src/controller/KissCount.cpp:363 msgid "Groceries" msgstr "" @@ -348,7 +356,7 @@ msgstr "" msgid "Group" msgstr "" -#: src/controller/KissCount.cpp:355 +#: src/controller/KissCount.cpp:363 msgid "Hobbies" msgstr "" @@ -372,19 +380,19 @@ msgstr "" msgid "Internal category" msgstr "" -#: src/view/SearchPanel.cpp:191 +#: src/view/SearchBanner.cpp:150 msgid "Invalid amount from" msgstr "" -#: src/view/SearchPanel.cpp:216 +#: src/view/SearchBanner.cpp:172 msgid "Invalid amount range" msgstr "" -#: src/view/SearchPanel.cpp:205 +#: src/view/SearchBanner.cpp:163 msgid "Invalid amount to" msgstr "" -#: src/view/SearchPanel.cpp:181 +#: src/view/SearchBanner.cpp:140 msgid "Invalid date range" msgstr "" @@ -404,7 +412,7 @@ msgstr "" msgid "Invalid password" msgstr "" -#: src/view/StatsPanel.cpp:380 +#: src/view/StatsPanel.cpp:403 msgid "Invalide date range" msgstr "" @@ -412,7 +420,7 @@ msgstr "" msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:849 +#: src/view/AccountPanel.cpp:870 msgid "It must be at least one month !" msgstr "" @@ -420,15 +428,23 @@ msgstr "" msgid "Kill me" msgstr "" -#: src/view/StatsPanel.cpp:380 src/view/PreferencesPanel.cpp:824 +#: src/view/StatsPanel.cpp:403 src/view/PreferencesPanel.cpp:824 #: src/view/PreferencesPanel.cpp:827 src/model/Database_Update.cpp:140 msgid "KissCount" msgstr "" +#: src/view/ExportPanel.cpp:152 +msgid "KissCount - Export" +msgstr "" + #: src/view/ImportPanel.cpp:128 msgid "KissCount - Import" msgstr "" +#: src/model/import/XMLImportEngine.cpp:268 +msgid "KissCount xml files (*.xml)|*.xml" +msgstr "" + #: src/view/PreferencesPanel.cpp:62 msgid "Language" msgstr "" @@ -472,24 +488,29 @@ msgid "" "\n" msgstr "" -#: src/view/SearchPanel.cpp:281 +#: src/view/SearchPanel.cpp:119 src/view/ExportPanel.cpp:111 msgid "No entry found" msgstr "" -#: src/view/ImportPanel.cpp:357 +#: src/view/ImportPanel.cpp:351 msgid "No operation found into this file" msgstr "" -#: src/view/SearchPanel.cpp:86 +#: src/view/ExportPanel.cpp:124 +msgid "No operation to save" +msgstr "" + +#: src/view/StatsPanel.cpp:117 src/view/SearchBanner.cpp:70 +#: src/view/AccountPanel.cpp:237 msgid "Non fix" msgstr "" -#: src/view/SearchPanel.cpp:311 src/view/SearchPanel.cpp:353 +#: src/view/SearchPanel.cpp:149 src/view/SearchPanel.cpp:191 #: src/view/PreferencesPanel.cpp:441 src/view/PreferencesPanel.cpp:702 msgid "None" msgstr "" -#: src/view/SearchPanel.cpp:86 +#: src/view/SearchBanner.cpp:70 msgid "Not checked" msgstr "" @@ -497,7 +518,7 @@ msgstr "" msgid "Number" msgstr "" -#: src/model/import/OFXImportEngine.cpp:126 +#: src/model/import/OFXImportEngine.cpp:135 msgid "OFX files (*.ofx)|*.ofx" msgstr "" @@ -514,15 +535,19 @@ msgstr "" msgid "Operation order" msgstr "" -#: src/view/SearchPanel.cpp:100 src/view/AccountPanel.cpp:185 +#: src/view/SearchBanner.cpp:82 src/view/AccountPanel.cpp:186 msgid "Operations" msgstr "" -#: src/view/ImportPanel.cpp:382 +#: src/view/ImportPanel.cpp:421 msgid "Operations successfully imported" msgstr "" -#: src/controller/KissCount.cpp:356 +#: src/view/ExportPanel.cpp:144 +msgid "Operations successfuly saved" +msgstr "" + +#: src/controller/KissCount.cpp:364 msgid "Other" msgstr "" @@ -534,7 +559,7 @@ msgstr "" msgid "Password changed" msgstr "" -#: src/view/wxUI.cpp:248 +#: src/view/wxUI.cpp:249 msgid "" "Personal accounting software\n" "\n" @@ -554,7 +579,7 @@ msgstr "" msgid "Preferences" msgstr "" -#: src/view/wxUI.cpp:255 +#: src/view/wxUI.cpp:256 msgid "Quit KissCount ?" msgstr "" @@ -562,24 +587,28 @@ msgstr "" msgid "Real" msgstr "" -#: src/view/AccountPanel.cpp:227 +#: src/view/AccountPanel.cpp:236 msgid "Remains" msgstr "" -#: src/view/SearchPanel.cpp:129 +#: src/view/SearchPanel.cpp:61 msgid "Rename" msgstr "" +#: src/view/ExportPanel.cpp:128 +msgid "Save as" +msgstr "" + #: src/view/ImportPanel.cpp:60 msgid "Save import patterns" msgstr "" -#: src/view/SearchPanel.cpp:94 src/view/SearchPanel.cpp:166 -#: src/view/SearchPanel.cpp:416 +#: src/view/SearchPanel.cpp:48 src/view/SearchPanel.cpp:97 +#: src/view/SearchPanel.cpp:254 src/view/ExportPanel.cpp:44 msgid "Search" msgstr "" -#: src/view/StatsPanel.cpp:123 src/view/AccountPanel.cpp:95 +#: src/view/StatsPanel.cpp:134 src/view/AccountPanel.cpp:95 msgid "Serie 1" msgstr "" @@ -587,7 +616,7 @@ msgstr "" msgid "Shared with" msgstr "" -#: src/view/StatsPanel.cpp:163 src/view/StatsPanel.cpp:361 +#: src/view/StatsPanel.cpp:172 src/view/StatsPanel.cpp:384 msgid "Statistics" msgstr "" @@ -599,11 +628,11 @@ msgstr "" msgid "To " msgstr "" -#: src/view/AccountPanel.cpp:209 +#: src/view/AccountPanel.cpp:210 msgid "Total Credit" msgstr "" -#: src/view/AccountPanel.cpp:210 +#: src/view/AccountPanel.cpp:211 msgid "Total Debit" msgstr "" @@ -611,22 +640,22 @@ msgstr "" msgid "UnGroup" msgstr "" -#: src/model/Database.cpp:109 src/model/Database.cpp:115 +#: src/model/Database.cpp:112 src/model/Database.cpp:118 msgid "Unable to Create " msgstr "" #: src/model/Database.cpp:45 src/model/Database.cpp:52 -#: src/model/Database.cpp:70 src/model/Database.cpp:123 +#: src/model/Database.cpp:70 src/model/Database.cpp:126 msgid "Unable to open Database" msgstr "" -#: src/controller/KissCount.cpp:356 +#: src/controller/KissCount.cpp:364 msgid "Unexpected" msgstr "" -#: src/view/SearchPanel.cpp:82 src/view/SearchPanel.cpp:90 -#: src/view/AccountPanel.cpp:518 src/view/AccountPanel.cpp:554 -#: src/view/AccountPanel.cpp:592 src/model/User.cpp:59 src/model/User.cpp:79 +#: src/view/SearchBanner.cpp:66 src/view/SearchBanner.cpp:74 +#: src/view/AccountPanel.cpp:529 src/view/AccountPanel.cpp:565 +#: src/view/AccountPanel.cpp:603 src/model/User.cpp:59 src/model/User.cpp:79 #: src/model/User.cpp:127 msgid "Unknown" msgstr "" @@ -660,7 +689,7 @@ msgstr "" msgid "Virtual" msgstr "" -#: src/view/grid/GridAccount.cpp:1066 +#: src/view/grid/GridAccount.cpp:1071 msgid "Warning" msgstr "" @@ -672,7 +701,11 @@ msgstr "" msgid "Wich category will replace this one ?" msgstr "" -#: src/view/grid/GridAccount.cpp:1066 +#: src/model/export/XMLExportEngine.cpp:29 +msgid "XML files (*.xml)|*.xml" +msgstr "" + +#: src/view/grid/GridAccount.cpp:1071 msgid "You made a debit on a blocked account" msgstr "" From 7166da185d92fc5ce22a18d56518714f50b681c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Fri, 15 Jul 2011 17:15:30 +0200 Subject: [PATCH 72/72] Update TODO --- TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO b/TODO index 5699fd1..85a3f61 100644 --- a/TODO +++ b/TODO @@ -18,10 +18,10 @@ Packaging for more distributions Next version More translations -Import/Export module Printing (maybe in xml/html) Refactor web view code Plugins ? +WxWidgets 2.9 =============================================================== Will not be implemented
DescriptionDateDebitCreditCategoryAccount
DescriptionDateDebitCreditCategoryAccount
" . $operation["description"] . "
" . $operation["description"] . "
" . $operation["description"] . "
Non fix" . number_format($value, 2) . " ($percent %)
" . $category["name"]. "" . number_format($categories[$category["id"]], 2) . " ($percent %)