Fix two bugs (Upper case in database avoiding accents, and cat/account with the same name during modification into PreferencesPanel)
Updating translations
This commit is contained in:
@@ -318,6 +318,15 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event)
|
||||
_wxUI->NeedReload();
|
||||
return;
|
||||
}
|
||||
|
||||
if (user->GetAccountId(new_account.name) != new_account.id)
|
||||
{
|
||||
wxMessageBox(_("Account ")+new_account.name+_(" already exists"), _("Error"), wxICON_ERROR | wxOK );
|
||||
_accountsGrid->SetCellValue(row, ACCOUNT_NAME, user->_accounts[row].name);
|
||||
inModification = false;
|
||||
return ;
|
||||
}
|
||||
|
||||
_kiss->UpdateAccount(new_account);
|
||||
}
|
||||
// New account
|
||||
@@ -418,6 +427,15 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event)
|
||||
inModification = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (user->GetCategoryId(new_cat.name) != new_cat.id)
|
||||
{
|
||||
wxMessageBox(_("Category ")+new_cat.name+_(" already exists"), _("Error"), wxICON_ERROR | wxOK );
|
||||
_categoriesGrid->SetCellValue(row, CATEGORY_NAME, user->_categories[row].name);
|
||||
inModification = false;
|
||||
return ;
|
||||
}
|
||||
|
||||
_kiss->UpdateCategory(new_cat);
|
||||
}
|
||||
// New category
|
||||
|
||||
@@ -19,11 +19,13 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "AccountPanel.h"
|
||||
|
||||
enum {SEARCH_ID, GRID_ID};
|
||||
enum {SEARCH_ID, GRID_ID, CALENDAR_FROM_ID, CALENDAR_TO_ID};
|
||||
|
||||
BEGIN_EVENT_TABLE(SearchPanel, wxPanel)
|
||||
EVT_BUTTON(SEARCH_ID, SearchPanel::OnButtonSearch)
|
||||
EVT_SHOW(SearchPanel::OnShow)
|
||||
EVT_CALENDAR_SEL_CHANGED(CALENDAR_FROM_ID, SearchPanel::OnCalendarFromChange)
|
||||
EVT_CALENDAR_SEL_CHANGED(CALENDAR_TO_ID, SearchPanel::OnCalendarToChange)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#define SET_ROW_COLOR(row, color) for(int i=0; i<NUMBER_COLS_OPS; i++) \
|
||||
@@ -47,9 +49,9 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*pa
|
||||
|
||||
wxGridBagSizer *gridBagSizer = new wxGridBagSizer(3, 9);
|
||||
|
||||
_calendarFrom = new wxCalendarCtrl(this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize,
|
||||
_calendarFrom = new wxCalendarCtrl(this, CALENDAR_FROM_ID, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize,
|
||||
wxCAL_MONDAY_FIRST);
|
||||
_calendarTo = new wxCalendarCtrl(this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize,
|
||||
_calendarTo = new wxCalendarCtrl(this, CALENDAR_TO_ID, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize,
|
||||
wxCAL_MONDAY_FIRST);
|
||||
|
||||
|
||||
@@ -123,7 +125,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event)
|
||||
|
||||
if (_calendarFrom->GetDate() > _calendarTo->GetDate())
|
||||
{
|
||||
wxMessageBox(_("Invalide date range"), _("Error"), wxICON_ERROR | wxOK);
|
||||
wxMessageBox(_("Invalid date range"), _("Error"), wxICON_ERROR | wxOK);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,7 +135,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event)
|
||||
*amountFrom = _amountFrom->GetLineText(0);
|
||||
if (!amountFrom->ToDouble(&af))
|
||||
{
|
||||
wxMessageBox(_("Invalide amount from"), _("Error"), wxICON_ERROR | wxOK);
|
||||
wxMessageBox(_("Invalid amount from"), _("Error"), wxICON_ERROR | wxOK);
|
||||
delete amountFrom;
|
||||
return;
|
||||
}
|
||||
@@ -145,7 +147,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event)
|
||||
*amountTo = _amountTo->GetLineText(0);
|
||||
if (!amountTo->ToDouble(&at))
|
||||
{
|
||||
wxMessageBox(_("Invalide amount to"), _("Error"), wxICON_ERROR | wxOK);
|
||||
wxMessageBox(_("Invalid amount to"), _("Error"), wxICON_ERROR | wxOK);
|
||||
delete amountFrom;
|
||||
delete amountTo;
|
||||
return;
|
||||
@@ -154,7 +156,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event)
|
||||
|
||||
if (amountFrom && amountTo && af > at)
|
||||
{
|
||||
wxMessageBox(_("Invalide amount range"), _("Error"), wxICON_ERROR | wxOK);
|
||||
wxMessageBox(_("Invalid amount range"), _("Error"), wxICON_ERROR | wxOK);
|
||||
delete amountFrom;
|
||||
delete amountTo;
|
||||
return;
|
||||
@@ -224,3 +226,12 @@ 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);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ class SearchPanel: public wxScrolledWindow
|
||||
|
||||
void OnButtonSearch(wxCommandEvent& event);
|
||||
void OnShow(wxShowEvent& event);
|
||||
void OnCalendarFromChange(wxCalendarEvent& event);
|
||||
void OnCalendarToChange(wxCalendarEvent& event);
|
||||
|
||||
private:
|
||||
KissCount* _kiss;
|
||||
|
||||
Reference in New Issue
Block a user