From 41617afc10eca430fd2f033d662c734a67b5bd1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 29 Aug 2010 09:29:34 +0200 Subject: [PATCH] Fix a bug with passwords Fix a bug in search (wildcards) Fix a bug in wxUI (tooltips not translated) Update translation Update TODO --- TODO | 30 ++++++++++++++++++------------ ressources/po/french.mo | Bin 6164 -> 6178 bytes ressources/po/french.po | 4 ++-- src/controller/KissCount.cpp | 4 ++-- src/model/Database.cpp | 9 ++++++--- src/model/Database.h | 2 +- src/view/ButtonPanel.cpp | 19 +++++++++++-------- src/view/ButtonPanel.h | 2 ++ src/view/wxUI.cpp | 9 ++++++--- src/view/wxUI.h | 2 ++ 10 files changed, 50 insertions(+), 31 deletions(-) diff --git a/TODO b/TODO index 7256327..3fed7a3 100644 --- a/TODO +++ b/TODO @@ -1,28 +1,34 @@ Version 0.1 Statistics (need to add months/years label on graph) -Copy and paste -Import/Export module +Multiples operations into one (operation fusion) +Auto completion (already up into wxwidgets 2.9) Using tabulation to navigate throw interface (Search Panel) -Improve Scrolled Windows -Fix some bugs (especially when closing, and one when switching between SearchPanel and AccountPanel) +Improve Scrolled Windows and widgets placement +Fix some bugs (especially when closing, and one when switching between SearchPanel and AccountPanel). Is there bugs ?? Can type a letter with a comboboxes Windows version Need packaging Better build system for wxFreeChart (hacked by me) -Others translation Handle bad SQL return Category color/font -Button tooltip not translated +Shared accounts +Documentation (en) + +Cool for 0.1: +Database auto saving at startup +Use caches for created panels (avoid destroying/creating panels for nothing) =============================================================== Next version +More translations Formulas -Multiples operations into one (operation fusion) -Auto completion (already up into wxwidgets 2.9) +Import/Export module Undo/redo -Database auto saving at startup -Documentation -Use caches for created panels (avoid destroying/creating panels for nothing) -Printing \ No newline at end of file +Printing (maybe in html) + +=============================================================== +Will not be implemented + +Copy and paste diff --git a/ressources/po/french.mo b/ressources/po/french.mo index cf05a6786783adbf0dc85e75e921af1227dc76db..0fbe3c293df521e5d196138cc86761186431553e 100644 GIT binary patch delta 578 zcmXZY&npCR7{~GN8e?e3`mw(YeUmuai_#vHA_tKaB}!t8lWo>f&B;+|xw##|?jN#GrN*ifIahx~#m{6LF; znk~Zt@&roHvgS=plMgjlafEz>L->sHp6`?iO&1qG3_8$di*DoNB3g8CALCfTehiTn zQ^g`)VFur@41jwTc(K8x0DH6FWz7vU$Bi*T*i4k!aP1=H-4g=JVGgs z(JDEOoj9nDs^ciVlNiHUba4))Zz0qN)^Uu%uI3Yz;&YUfUaGfx{~o2Np+2De$tKD{ zUQzbn)h}!(N9r%ipUpeD)`Ew!(2G)(tFL)0zCUftTfxCzV0TKkUP~T3?rJHh*wd+O F^B<~vJAwcJ delta 564 zcmXZYKS%;$7{~GFPR&Y7>g-gIXeb&2xw(i4B!d17frIS^u0m78L6b`~6gagMt^L7G z9HJ#@iiQYUil%6=28n3t``|Nu?)TiizxRFbG&l~fim}iYkqb{`6t6LkH)aP@C$)1@vXHa_!=-`66h}yRl+6Nmr%V68`KI%q?s3&chXZHRQW6ay;E$W}_ ypdREAb^VL^j#2Wb`Gxvtb3Gn(!7u6pH`^~7ZkFSvq+6^sTi!v$Sw33NJpBV$gEzzg diff --git a/ressources/po/french.po b/ressources/po/french.po index a9ec922..91acde2 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -256,7 +256,7 @@ msgstr "De" #: src/view/GenerateDialog.cpp:45 msgid "From " -msgstr "De" +msgstr "A partir de " #: src/view/GenerateDialog.cpp:31 #: src/view/AccountPanel.cpp:833 @@ -460,7 +460,7 @@ msgstr "A" #: src/view/GenerateDialog.cpp:52 msgid "To " -msgstr "A" +msgstr "Vers " #: src/view/AccountPanel.cpp:171 msgid "Total Credit" diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 499be26..e72b11e 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -320,7 +320,7 @@ std::vector* KissCount::Search(wxString* description, wxDateTime* dat std::vector categories, std::vector accounts) { - return _db->Search(_user, description, dateFrom, dateTo, amountFrom, amountTo, categories, accounts); + return _db->Search(_user, description, dateFrom, dateTo, amountFrom, amountTo, categories, accounts, true); } bool KissCount::SearchPreviousOperation(Operation* res, wxString& description, int month, int year) @@ -339,7 +339,7 @@ bool KissCount::SearchPreviousOperation(Operation* res, wxString& description, i date = new wxDateTime(0, (wxDateTime::Month)month, year); - operations = Search(&description, date, NULL, NULL, NULL, v, v); + operations = _db->Search(_user, &description, date, NULL, NULL, NULL, v, v, false); delete date; diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 35a258d..89a3226 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -173,7 +173,7 @@ wxString Database::HashPassword(const wxString& password) wxString wxSHA; blk_SHA1_Init(&sha_ctx); - blk_SHA1_Update(&sha_ctx, password.c_str(), password.Length()); + blk_SHA1_Update(&sha_ctx, password.mb_str(), password.Length()); blk_SHA1_Final(sha, &sha_ctx); for(int i=0; i<20; i++) @@ -1039,7 +1039,7 @@ void Database::UpdatePreference(User* user, const wxString& preference) std::vector* Database::Search(User* user, wxString* description, wxDateTime* dateFrom, wxDateTime* dateTo, wxString* amountFrom, wxString* amountTo, - std::vector categories, std::vector accounts) + std::vector categories, std::vector accounts, bool wildcards) { wxSQLite3ResultSet set; wxString req; @@ -1069,7 +1069,10 @@ std::vector* Database::Search(User* user, wxString* description, wxDa if (description) { - req += wxT("description='") + *description + wxT("'"); + if (wildcards) + req += wxT("description LIKE '%") + *description + wxT("%'"); + else + req += wxT("description='") + *description + wxT("'"); firstCond = true; } diff --git a/src/model/Database.h b/src/model/Database.h index c18d4cc..dbff009 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -70,7 +70,7 @@ public: std::vector* Search(User* user, wxString* description, wxDateTime* dateFrom, wxDateTime* dateTo, wxString* amountFrom, wxString* amountTo, - std::vector categories, std::vector accounts); + std::vector categories, std::vector accounts, bool wildcards); void GetStats(User* user, const wxString& monthFrom, const wxString& yearFrom, const wxString& monthTo, const wxString& yearTo, std::map > >* accountAmounts, diff --git a/src/view/ButtonPanel.cpp b/src/view/ButtonPanel.cpp index 020e11d..7880dfe 100644 --- a/src/view/ButtonPanel.cpp +++ b/src/view/ButtonPanel.cpp @@ -44,14 +44,6 @@ ButtonPanel::ButtonPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ SetSizer(hbox); - _account->SetToolTip(_("Operations")); - _stats->SetToolTip(_("Statistics")); - _search->SetToolTip(_("Search")); - _prefs->SetToolTip(_("Preferences")); - _changeUser->SetToolTip(_("Change user")); - _about->SetToolTip(_("About")); - _quit->SetToolTip(_("Quit")); - hbox->Add(_account); hbox->Add(_stats); hbox->Add(_search); @@ -72,6 +64,17 @@ ButtonPanel::~ButtonPanel() 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(); diff --git a/src/view/ButtonPanel.h b/src/view/ButtonPanel.h index 010c7e4..6e6e171 100644 --- a/src/view/ButtonPanel.h +++ b/src/view/ButtonPanel.h @@ -38,6 +38,8 @@ public: ButtonPanel(KissCount* kiss, wxUI *parent); ~ButtonPanel(); + void SetToolTips(); + void OnButtonAccount(wxCommandEvent& event); void OnButtonStats(wxCommandEvent& event); void OnButtonSearch(wxCommandEvent& event); diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 95c5962..d9bfe75 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -34,11 +34,11 @@ wxColour categoryColors[12] = {wxColour(0x00, 0x45, 0x86), 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), _accountPanel(NULL), _statsPanel(NULL), + : 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) { _hbox = new wxBoxSizer(wxVERTICAL); - ButtonPanel* buttons = new ButtonPanel(_kiss, this); + _buttonPanel = new ButtonPanel(_kiss, this); // wxMenu *menuFile = new wxMenu; // menuFile->Append( ID_About, wxT("&About...") ); @@ -55,7 +55,7 @@ wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxS SetSizer(_hbox); - _hbox->Add(buttons); + _hbox->Add(_buttonPanel); } wxUI::~wxUI() @@ -117,6 +117,9 @@ bool wxUI::SetLanguage(long language) months[10] = _("november"); months[11] = _("december") ; + if (_buttonPanel) + _buttonPanel->SetToolTips(); + return res; } diff --git a/src/view/wxUI.h b/src/view/wxUI.h index 93f80c3..11898ad 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -31,6 +31,7 @@ #include class KissCount; +class ButtonPanel; class AccountPanel; class PreferencesPanel; class StatsPanel; @@ -66,6 +67,7 @@ public: private: KissCount *_kiss; wxBoxSizer *_hbox; + ButtonPanel *_buttonPanel; AccountPanel *_accountPanel; StatsPanel *_statsPanel; SearchPanel *_searchPanel;