* Fix a bug with not escaped characters
* Use GetLastRowId instead of doing another SQL request * Handle request failling * Fix a bug, wxGridCellFastBoolEditor crashes when deleted
This commit is contained in:
@@ -179,7 +179,7 @@ void PreferencesPanel::InitAccounts(User* user)
|
||||
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(curLine, ACCOUNT_DEFAULT, new wxGridCellFastBoolEditor ());
|
||||
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_DELETE, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(curLine, ACCOUNT_DELETE, new wxGridCellFastBoolEditor ());
|
||||
_accountsGrid->SetCellEditor(curLine, ACCOUNT_DELETE, new wxGridCellBoolEditor ());
|
||||
_accountsGrid->SetCellValue(curLine, ACCOUNT_SHARED, (it->shared)?wxT("1"):wxT("0"));
|
||||
_accountsGrid->SetCellValue(curLine, ACCOUNT_DEFAULT, (it->_default)?wxT("1"):wxT("0"));
|
||||
|
||||
@@ -225,7 +225,7 @@ void PreferencesPanel::InitCategories(User* user)
|
||||
if (curLine)
|
||||
{
|
||||
_categoriesGrid->SetCellRenderer(curLine, CATEGORY_DELETE, new wxGridCellBoolRenderer ());
|
||||
_categoriesGrid->SetCellEditor(curLine, CATEGORY_DELETE, new wxGridCellFastBoolEditor ());
|
||||
_categoriesGrid->SetCellEditor(curLine, CATEGORY_DELETE, new wxGridCellBoolEditor ());
|
||||
}
|
||||
|
||||
_categoriesGrid->SetCellAlignment(curLine, CATEGORY_COLOR, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
@@ -393,7 +393,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event)
|
||||
_accountsGrid->SetCellRenderer(row, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(row, ACCOUNT_DEFAULT, new wxGridCellFastBoolEditor ());
|
||||
_accountsGrid->SetCellRenderer(row, ACCOUNT_DELETE, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(row, ACCOUNT_DELETE, new wxGridCellFastBoolEditor ());
|
||||
_accountsGrid->SetCellEditor(row, ACCOUNT_DELETE, new wxGridCellBoolEditor ());
|
||||
_accountsGrid->SetCellAlignment(row, ACCOUNT_SHARED, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_accountsGrid->SetCellAlignment(row, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_accountsGrid->SetCellAlignment(row, ACCOUNT_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
@@ -502,7 +502,7 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event)
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_FONT, false);
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_DELETE, false);
|
||||
_categoriesGrid->SetCellRenderer(row, CATEGORY_DELETE, new wxGridCellBoolRenderer ());
|
||||
_categoriesGrid->SetCellEditor(row, CATEGORY_DELETE, new wxGridCellFastBoolEditor ());
|
||||
_categoriesGrid->SetCellEditor(row, CATEGORY_DELETE, new wxGridCellBoolEditor ());
|
||||
|
||||
_categoriesGrid->SetCellAlignment(row, CATEGORY_COLOR, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(row, CATEGORY_FONT, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
|
||||
@@ -34,6 +34,11 @@ END_EVENT_TABLE()
|
||||
_grid->SetCellBackgroundColour(row, i, color); \
|
||||
}
|
||||
|
||||
#define UNESCAPE_CHARS(s) { \
|
||||
s.Replace(wxT("\\\""), wxT("\""), true); \
|
||||
s.Replace(wxT("\\\'"), wxT("\'"), true); \
|
||||
}
|
||||
|
||||
SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*parent)), _kiss(kiss), _wxUI(parent), _operations(NULL)
|
||||
{
|
||||
DEFAULT_FONT(font);
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
SetCellBackgroundColour(row, i, color); \
|
||||
}
|
||||
|
||||
#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()
|
||||
@@ -111,6 +116,7 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix,
|
||||
int r, g, b;
|
||||
wxColour color;
|
||||
wxDateTime curDate;
|
||||
wxString description;
|
||||
|
||||
curDate.SetToCurrent();
|
||||
|
||||
@@ -134,7 +140,9 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix,
|
||||
if (op)
|
||||
{
|
||||
SetCellEditor(line, DATE, new CalendarEditor(op->day, op->month, op->year));
|
||||
SetCellValue(line, DESCRIPTION, op->description);
|
||||
description = op->description;
|
||||
UNESCAPE_CHARS(description);
|
||||
SetCellValue(line, DESCRIPTION, description);
|
||||
SetCellValue(line, DATE, wxString::Format(wxT("%02d/%02d/%d"), op->day+1, op->month+1, op->year));
|
||||
if (op->amount < 0)
|
||||
SetCellValue(line, DEBIT, wxString::Format(wxT("%.2lf"), -op->amount));
|
||||
@@ -144,7 +152,7 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix,
|
||||
if (!fix)
|
||||
SetCellValue(line, CATEGORY, user->GetCategoryName(op->category));
|
||||
SetCellRenderer(line, DELETE, new wxGridCellBoolRenderer ());
|
||||
SetCellEditor(line, DELETE, new wxGridCellFastBoolEditor ());
|
||||
SetCellEditor(line, DELETE, new wxGridCellBoolEditor ());
|
||||
SetCellRenderer(line, CHECKED, new wxGridCellBoolRenderer ());
|
||||
SetCellEditor(line, CHECKED, new wxGridCellFastBoolEditor ());
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
void BeginEdit (int row, int col, wxGrid* grid)
|
||||
{
|
||||
wxGridCellBoolEditor::BeginEdit(row, col, grid);
|
||||
|
||||
|
||||
wxFocusEvent event (wxEVT_KILL_FOCUS);
|
||||
if (m_control)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user