Temp commit

This commit is contained in:
Grégory Soutadé 2011-03-13 19:22:17 +01:00
parent 2c56271e1b
commit d2f23fd6a0
4 changed files with 15 additions and 14 deletions

View File

@ -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);

View File

@ -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();
}

View File

@ -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<Operation> operations;
LoadOperations(&operations, false, false, 0, 0);
LoadOperations(&operations, 0, 0);
}
void GridAccount::LoadOperations(std::vector<Operation>* operations, bool canAddOperation, bool setWeek, int month, int year)
void GridAccount::LoadOperations(std::vector<Operation>* operations, int month, int year)
{
std::vector<Operation>::iterator it;
User* user = _kiss->GetUser();
@ -195,7 +196,6 @@ void GridAccount::LoadOperations(std::vector<Operation>* operations, bool canAdd
_loadOperations = true;
_operations = operations;
_canAddOperation = canAddOperation;
_curMonth = month;
_curYear = year;
_displayedOperations.clear();
@ -210,7 +210,7 @@ void GridAccount::LoadOperations(std::vector<Operation>* 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<Operation>* 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<int>& 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();

View File

@ -71,11 +71,11 @@ private:
wxWindow* _parent;
KissCount* _kiss;
bool _displayLines;
bool _canAddOperation, setWeek;
bool _canAddOperation, _setWeek;
bool _databaseSynchronization;
wxString* _categories, *_accounts;
std::vector<Operation>* _operations;
bool _canAddOperation, _loadOperations;
bool _loadOperations;
int _curMonth, _curYear;
void SetWeek(int week, int line);