Use new emacs indentation rules (4 spaces instead of tabs and braces position)~
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
Copyright 2010 Grégory Soutadé
|
||||
Copyright 2010 Grégory Soutadé
|
||||
|
||||
This file is part of KissCount.
|
||||
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 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.
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PreferencesPanel.h"
|
||||
@@ -38,551 +38,551 @@ END_EVENT_TABLE()
|
||||
|
||||
PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent)
|
||||
{
|
||||
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *hbox1 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL);
|
||||
//wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxStaticBox* staticUser, *staticAccount, *staticCategories, *staticLanguage, *staticOperationOrder;
|
||||
User* user = _kiss->GetUser();
|
||||
wxGridBagSizer *gridBagSizer;
|
||||
wxStaticText* label;
|
||||
wxButton* buttonChangeName, *buttonChangePassword, *killMe;
|
||||
wxStaticBoxSizer * staticBoxSizer;
|
||||
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *hbox1 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL);
|
||||
//wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxStaticBox* staticUser, *staticAccount, *staticCategories, *staticLanguage, *staticOperationOrder;
|
||||
User* user = _kiss->GetUser();
|
||||
wxGridBagSizer *gridBagSizer;
|
||||
wxStaticText* label;
|
||||
wxButton* buttonChangeName, *buttonChangePassword, *killMe;
|
||||
wxStaticBoxSizer * staticBoxSizer;
|
||||
|
||||
SetSizer(vbox);
|
||||
SetSizer(vbox);
|
||||
|
||||
staticUser = new wxStaticBox(this, wxID_ANY, _("User"));
|
||||
staticAccount = new wxStaticBox(this, wxID_ANY, _("Accounts"));
|
||||
staticCategories = new wxStaticBox(this, wxID_ANY, _("Categories"));
|
||||
staticLanguage = new wxStaticBox(this, wxID_ANY, _("Language"));
|
||||
staticOperationOrder = new wxStaticBox(this, wxID_ANY, _("Operation order"));
|
||||
staticUser = new wxStaticBox(this, wxID_ANY, _("User"));
|
||||
staticAccount = new wxStaticBox(this, wxID_ANY, _("Accounts"));
|
||||
staticCategories = new wxStaticBox(this, wxID_ANY, _("Categories"));
|
||||
staticLanguage = new wxStaticBox(this, wxID_ANY, _("Language"));
|
||||
staticOperationOrder = new wxStaticBox(this, wxID_ANY, _("Operation order"));
|
||||
|
||||
// User
|
||||
staticBoxSizer = new wxStaticBoxSizer (staticUser, wxVERTICAL);
|
||||
// User
|
||||
staticBoxSizer = new wxStaticBoxSizer (staticUser, wxVERTICAL);
|
||||
|
||||
gridBagSizer = new wxGridBagSizer(10, 10);
|
||||
staticBoxSizer->Add(gridBagSizer);
|
||||
gridBagSizer = new wxGridBagSizer(10, 10);
|
||||
staticBoxSizer->Add(gridBagSizer);
|
||||
|
||||
label = new wxStaticText(this, wxID_ANY, _("Name"));
|
||||
gridBagSizer->Add(label, wxGBPosition(0, 0));
|
||||
label = new wxStaticText(this, wxID_ANY, _("Name"));
|
||||
gridBagSizer->Add(label, wxGBPosition(0, 0));
|
||||
|
||||
_name = new wxTextCtrl(this, NAME_ID, user->_name);
|
||||
gridBagSizer->Add(_name, wxGBPosition(0, 1));
|
||||
_name = new wxTextCtrl(this, NAME_ID, user->_name);
|
||||
gridBagSizer->Add(_name, wxGBPosition(0, 1));
|
||||
|
||||
buttonChangeName = new wxButton(this, CHANGE_NAME_ID, _("Change Name"));
|
||||
buttonChangePassword = new wxButton(this, CHANGE_PASSWORD_ID, _("Change Password"));
|
||||
killMe = new wxButton(this, KILL_ME_ID, _("Kill me"));
|
||||
buttonChangeName = new wxButton(this, CHANGE_NAME_ID, _("Change Name"));
|
||||
buttonChangePassword = new wxButton(this, CHANGE_PASSWORD_ID, _("Change Password"));
|
||||
killMe = new wxButton(this, KILL_ME_ID, _("Kill me"));
|
||||
|
||||
gridBagSizer->Add(buttonChangeName, wxGBPosition(1, 0));
|
||||
gridBagSizer->Add(buttonChangePassword, wxGBPosition(1, 1));
|
||||
gridBagSizer->Add(killMe, wxGBPosition(1, 2));
|
||||
gridBagSizer->Add(buttonChangeName, wxGBPosition(1, 0));
|
||||
gridBagSizer->Add(buttonChangePassword, wxGBPosition(1, 1));
|
||||
gridBagSizer->Add(killMe, wxGBPosition(1, 2));
|
||||
|
||||
vbox->Add(staticBoxSizer);
|
||||
vbox->Add(-1, 20);
|
||||
vbox->Add(staticBoxSizer);
|
||||
vbox->Add(-1, 20);
|
||||
|
||||
// Account
|
||||
staticBoxSizer = new wxStaticBoxSizer (staticAccount, wxVERTICAL);
|
||||
// Account
|
||||
staticBoxSizer = new wxStaticBoxSizer (staticAccount, wxVERTICAL);
|
||||
|
||||
_accountsGrid = new wxGrid(this, ACCOUNTS_GRID_ID);
|
||||
_accountsGrid = new wxGrid(this, ACCOUNTS_GRID_ID);
|
||||
|
||||
InitAccounts(user);
|
||||
InitAccounts(user);
|
||||
|
||||
staticBoxSizer->Add(_accountsGrid);
|
||||
staticBoxSizer->Add(_accountsGrid);
|
||||
|
||||
hbox1->Add(staticBoxSizer);
|
||||
hbox1->Add(-1, 20);
|
||||
hbox1->Add(staticBoxSizer);
|
||||
hbox1->Add(-1, 20);
|
||||
|
||||
// Categories
|
||||
staticBoxSizer = new wxStaticBoxSizer (staticCategories, wxVERTICAL);
|
||||
// Categories
|
||||
staticBoxSizer = new wxStaticBoxSizer (staticCategories, wxVERTICAL);
|
||||
|
||||
_categoriesGrid = new wxGrid(this, CATEGORIES_GRID_ID);
|
||||
_categoriesGrid = new wxGrid(this, CATEGORIES_GRID_ID);
|
||||
|
||||
staticBoxSizer->Add(_categoriesGrid);
|
||||
staticBoxSizer->Add(_categoriesGrid);
|
||||
|
||||
InitCategories(user);
|
||||
InitCategories(user);
|
||||
|
||||
hbox1->Add(staticBoxSizer);
|
||||
hbox1->Add(-1, 20);
|
||||
hbox1->Add(staticBoxSizer);
|
||||
hbox1->Add(-1, 20);
|
||||
|
||||
vbox->Add(hbox1);
|
||||
vbox->Add(-1, 20);
|
||||
vbox->Add(hbox1);
|
||||
vbox->Add(-1, 20);
|
||||
|
||||
// Operation Order
|
||||
staticBoxSizer = new wxStaticBoxSizer (staticOperationOrder, wxVERTICAL);
|
||||
// Operation Order
|
||||
staticBoxSizer = new wxStaticBoxSizer (staticOperationOrder, wxVERTICAL);
|
||||
|
||||
_operationOrder = new wxComboBox(this, OPERATION_ORDER_ID);
|
||||
_operationOrder->SetWindowStyle(wxCB_READONLY);
|
||||
_operationOrder = new wxComboBox(this, OPERATION_ORDER_ID);
|
||||
_operationOrder->SetWindowStyle(wxCB_READONLY);
|
||||
|
||||
staticBoxSizer->Add(_operationOrder);
|
||||
staticBoxSizer->Add(_operationOrder);
|
||||
|
||||
hbox2->Add(staticBoxSizer);
|
||||
hbox2->Add(-1, 20);
|
||||
hbox2->Add(staticBoxSizer);
|
||||
hbox2->Add(-1, 20);
|
||||
|
||||
InitOperationOrder(user);
|
||||
InitOperationOrder(user);
|
||||
|
||||
// Language
|
||||
staticBoxSizer = new wxStaticBoxSizer (staticLanguage, wxVERTICAL);
|
||||
// Language
|
||||
staticBoxSizer = new wxStaticBoxSizer (staticLanguage, wxVERTICAL);
|
||||
|
||||
_language = new wxBitmapComboBox(this, LANGUAGE_ID);
|
||||
_language->SetWindowStyle(wxCB_READONLY);
|
||||
_language = new wxBitmapComboBox(this, LANGUAGE_ID);
|
||||
_language->SetWindowStyle(wxCB_READONLY);
|
||||
|
||||
staticBoxSizer->Add(_language);
|
||||
staticBoxSizer->Add(_language);
|
||||
|
||||
hbox2->Add(staticBoxSizer);
|
||||
hbox2->Add(-1, 20);
|
||||
hbox2->Add(staticBoxSizer);
|
||||
hbox2->Add(-1, 20);
|
||||
|
||||
InitLanguage(user);
|
||||
InitLanguage(user);
|
||||
|
||||
_language->Fit();
|
||||
_language->Fit();
|
||||
|
||||
vbox->Add(hbox2);
|
||||
vbox->Add(hbox2);
|
||||
|
||||
Fit();
|
||||
SetMinSize(GetSize());
|
||||
Fit();
|
||||
SetMinSize(GetSize());
|
||||
|
||||
Hide();
|
||||
Hide();
|
||||
}
|
||||
|
||||
void PreferencesPanel::InitAccounts(User* user)
|
||||
{
|
||||
std::vector<Account>::iterator it;
|
||||
int curLine = 0;
|
||||
Account account ;
|
||||
DEFAULT_FONT(font);
|
||||
std::vector<Account>::iterator it;
|
||||
int curLine = 0;
|
||||
Account account ;
|
||||
DEFAULT_FONT(font);
|
||||
|
||||
_accountsGrid->CreateGrid(0, NUMBER_COLS_ACCOUNT);
|
||||
_accountsGrid->SetRowLabelSize(0);
|
||||
_accountsGrid->SetColLabelValue(ACCOUNT_NAME, _("Name"));
|
||||
_accountsGrid->SetColLabelValue(ACCOUNT_NUMBER, _("Number"));
|
||||
_accountsGrid->SetColLabelValue(ACCOUNT_SHARED, _("Shared"));
|
||||
_accountsGrid->SetColLabelValue(ACCOUNT_DEFAULT, _("Default"));
|
||||
_accountsGrid->SetColLabelValue(ACCOUNT_DELETE, _("Delete"));
|
||||
_accountsGrid->SetDefaultCellFont(font);
|
||||
_accountsGrid->CreateGrid(0, NUMBER_COLS_ACCOUNT);
|
||||
_accountsGrid->SetRowLabelSize(0);
|
||||
_accountsGrid->SetColLabelValue(ACCOUNT_NAME, _("Name"));
|
||||
_accountsGrid->SetColLabelValue(ACCOUNT_NUMBER, _("Number"));
|
||||
_accountsGrid->SetColLabelValue(ACCOUNT_SHARED, _("Shared"));
|
||||
_accountsGrid->SetColLabelValue(ACCOUNT_DEFAULT, _("Default"));
|
||||
_accountsGrid->SetColLabelValue(ACCOUNT_DELETE, _("Delete"));
|
||||
_accountsGrid->SetDefaultCellFont(font);
|
||||
|
||||
for (it = user->_accounts.begin(); it != user->_accounts.end(); it++, curLine++)
|
||||
for (it = user->_accounts.begin(); it != user->_accounts.end(); it++, curLine++)
|
||||
{
|
||||
_accountsGrid->AppendRows();
|
||||
_accountsGrid->AppendRows();
|
||||
|
||||
_accountsGrid->SetCellValue(curLine, ACCOUNT_NAME, it->name);
|
||||
_accountsGrid->SetCellValue(curLine, ACCOUNT_NUMBER, it->number);
|
||||
_accountsGrid->SetCellValue(curLine, ACCOUNT_NAME, it->name);
|
||||
_accountsGrid->SetCellValue(curLine, ACCOUNT_NUMBER, it->number);
|
||||
|
||||
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_SHARED, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(curLine, ACCOUNT_SHARED, new wxGridCellBoolEditor ());
|
||||
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(curLine, ACCOUNT_DEFAULT, new wxGridCellBoolEditor ());
|
||||
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_DELETE, new wxGridCellBoolRenderer ());
|
||||
_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"));
|
||||
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_SHARED, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(curLine, ACCOUNT_SHARED, new wxGridCellBoolEditor ());
|
||||
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(curLine, ACCOUNT_DEFAULT, new wxGridCellBoolEditor ());
|
||||
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_DELETE, new wxGridCellBoolRenderer ());
|
||||
_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"));
|
||||
|
||||
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_SHARED, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_SHARED, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
}
|
||||
|
||||
_accountsGrid->AutoSizeColumns(true);
|
||||
_accountsGrid->AppendRows();
|
||||
_accountsGrid->AutoSizeColumns(true);
|
||||
_accountsGrid->AppendRows();
|
||||
|
||||
_accountsGrid->SetReadOnly(curLine, ACCOUNT_SHARED, true);
|
||||
_accountsGrid->SetReadOnly(curLine, ACCOUNT_DEFAULT, true);
|
||||
_accountsGrid->SetReadOnly(curLine, ACCOUNT_DELETE, true);
|
||||
_accountsGrid->SetReadOnly(curLine, ACCOUNT_SHARED, true);
|
||||
_accountsGrid->SetReadOnly(curLine, ACCOUNT_DEFAULT, true);
|
||||
_accountsGrid->SetReadOnly(curLine, ACCOUNT_DELETE, true);
|
||||
}
|
||||
|
||||
#define SET_ROW_COLOR(row, color) for(int i=0; i<NUMBER_COLS_CATEGORY; i++) \
|
||||
{ \
|
||||
_categoriesGrid->SetCellBackgroundColour(row, i, color); \
|
||||
_categoriesGrid->SetCellBackgroundColour(row, i, color); \
|
||||
}
|
||||
|
||||
void PreferencesPanel::InitCategories(User* user)
|
||||
{
|
||||
std::vector<Category>::iterator it;
|
||||
int curLine = 0;
|
||||
DEFAULT_FONT(font);
|
||||
std::vector<Category>::iterator it;
|
||||
int curLine = 0;
|
||||
DEFAULT_FONT(font);
|
||||
|
||||
_categoriesGrid->CreateGrid(0, NUMBER_COLS_CATEGORY);
|
||||
_categoriesGrid->SetRowLabelSize(0);
|
||||
_categoriesGrid->SetDefaultCellFont(font);
|
||||
_categoriesGrid->CreateGrid(0, NUMBER_COLS_CATEGORY);
|
||||
_categoriesGrid->SetRowLabelSize(0);
|
||||
_categoriesGrid->SetDefaultCellFont(font);
|
||||
|
||||
_categoriesGrid->SetColLabelValue(CATEGORY_NAME, _("Name"));
|
||||
_categoriesGrid->SetColLabelValue(CATEGORY_COLOR, _("Color"));
|
||||
_categoriesGrid->SetColLabelValue(CATEGORY_FONT, _("Font"));
|
||||
_categoriesGrid->SetColLabelValue(CATEGORY_DELETE, _("Delete"));
|
||||
_categoriesGrid->SetColLabelValue(CATEGORY_NAME, _("Name"));
|
||||
_categoriesGrid->SetColLabelValue(CATEGORY_COLOR, _("Color"));
|
||||
_categoriesGrid->SetColLabelValue(CATEGORY_FONT, _("Font"));
|
||||
_categoriesGrid->SetColLabelValue(CATEGORY_DELETE, _("Delete"));
|
||||
|
||||
for (it=user->_categories.begin(); it!=user->_categories.end(); it++, curLine++)
|
||||
for (it=user->_categories.begin(); it!=user->_categories.end(); it++, curLine++)
|
||||
{
|
||||
_categoriesGrid->AppendRows();
|
||||
_categoriesGrid->AppendRows();
|
||||
|
||||
_categoriesGrid->SetCellValue(curLine, CATEGORY_NAME, it->name);
|
||||
SET_ROW_COLOR(curLine, it->color);
|
||||
if (curLine)
|
||||
_categoriesGrid->SetCellValue(curLine, CATEGORY_NAME, it->name);
|
||||
SET_ROW_COLOR(curLine, it->color);
|
||||
if (curLine)
|
||||
{
|
||||
_categoriesGrid->SetCellRenderer(curLine, CATEGORY_DELETE, new wxGridCellBoolRenderer ());
|
||||
_categoriesGrid->SetCellEditor(curLine, CATEGORY_DELETE, new wxGridCellBoolEditor ());
|
||||
_categoriesGrid->SetCellRenderer(curLine, CATEGORY_DELETE, new wxGridCellBoolRenderer ());
|
||||
_categoriesGrid->SetCellEditor(curLine, CATEGORY_DELETE, new wxGridCellBoolEditor ());
|
||||
}
|
||||
|
||||
_categoriesGrid->SetCellAlignment(curLine, CATEGORY_COLOR, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(curLine, CATEGORY_FONT, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(curLine, CATEGORY_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(curLine, CATEGORY_COLOR, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(curLine, CATEGORY_FONT, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(curLine, CATEGORY_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
}
|
||||
|
||||
_categoriesGrid->SetReadOnly(0, CATEGORY_NAME, true);
|
||||
_categoriesGrid->SetReadOnly(0, CATEGORY_DELETE, true);
|
||||
_categoriesGrid->AutoSizeColumns(true);
|
||||
_categoriesGrid->SetReadOnly(0, CATEGORY_NAME, true);
|
||||
_categoriesGrid->SetReadOnly(0, CATEGORY_DELETE, true);
|
||||
_categoriesGrid->AutoSizeColumns(true);
|
||||
|
||||
_categoriesGrid->AppendRows();
|
||||
_categoriesGrid->SetReadOnly(curLine, CATEGORY_COLOR, true);
|
||||
_categoriesGrid->SetReadOnly(curLine, CATEGORY_FONT, true);
|
||||
_categoriesGrid->SetReadOnly(curLine, CATEGORY_DELETE, true);
|
||||
SET_ROW_COLOR(curLine, OWN_GREEN);
|
||||
_categoriesGrid->AppendRows();
|
||||
_categoriesGrid->SetReadOnly(curLine, CATEGORY_COLOR, true);
|
||||
_categoriesGrid->SetReadOnly(curLine, CATEGORY_FONT, true);
|
||||
_categoriesGrid->SetReadOnly(curLine, CATEGORY_DELETE, true);
|
||||
SET_ROW_COLOR(curLine, OWN_GREEN);
|
||||
}
|
||||
|
||||
void PreferencesPanel::InitLanguage(User* user)
|
||||
{
|
||||
int i, select=0;
|
||||
int i, select=0;
|
||||
|
||||
for (i=0; i<NB_SUPPORTED_LANGUAGES; i++)
|
||||
for (i=0; i<NB_SUPPORTED_LANGUAGES; i++)
|
||||
{
|
||||
_language->Append(languages[i].name, wxBitmap(languages[i].icon));
|
||||
if (languages[i].language == _wxUI->_language)
|
||||
select = i;
|
||||
_language->Append(languages[i].name, wxBitmap(languages[i].icon));
|
||||
if (languages[i].language == _wxUI->_language)
|
||||
select = i;
|
||||
}
|
||||
|
||||
_language->Select(select);
|
||||
_language->Select(select);
|
||||
}
|
||||
|
||||
void PreferencesPanel::InitOperationOrder(User* user)
|
||||
{
|
||||
_operationOrder->Append(_("Ascending"));
|
||||
_operationOrder->Append(_("Descending"));
|
||||
_operationOrder->Append(_("Ascending"));
|
||||
_operationOrder->Append(_("Descending"));
|
||||
|
||||
if (user->_preferences[wxT("operation_order")] == wxT("ASC"))
|
||||
_operationOrder->Select(0);
|
||||
else
|
||||
_operationOrder->Select(1);
|
||||
if (user->_preferences[wxT("operation_order")] == wxT("ASC"))
|
||||
_operationOrder->Select(0);
|
||||
else
|
||||
_operationOrder->Select(1);
|
||||
}
|
||||
|
||||
void PreferencesPanel::OnAccountModified(wxGridEvent& event)
|
||||
{
|
||||
int op_complete = 2;
|
||||
wxString value ;
|
||||
Account new_account, account;
|
||||
User* user = _kiss->GetUser();
|
||||
int row = event.GetRow();
|
||||
int col = event.GetCol();
|
||||
static bool inModification = false ;
|
||||
int i;
|
||||
int op_complete = 2;
|
||||
wxString value ;
|
||||
Account new_account, account;
|
||||
User* user = _kiss->GetUser();
|
||||
int row = event.GetRow();
|
||||
int col = event.GetCol();
|
||||
static bool inModification = false ;
|
||||
int i;
|
||||
|
||||
if (inModification) return;
|
||||
if (inModification) return;
|
||||
|
||||
inModification = true;
|
||||
inModification = true;
|
||||
|
||||
value = _accountsGrid->GetCellValue(row, ACCOUNT_NAME);
|
||||
if (value.Length())
|
||||
value = _accountsGrid->GetCellValue(row, ACCOUNT_NAME);
|
||||
if (value.Length())
|
||||
{
|
||||
new_account.name = value;
|
||||
op_complete--;
|
||||
new_account.name = value;
|
||||
op_complete--;
|
||||
}
|
||||
|
||||
value = _accountsGrid->GetCellValue(row, ACCOUNT_NUMBER);
|
||||
if (value.Length())
|
||||
value = _accountsGrid->GetCellValue(row, ACCOUNT_NUMBER);
|
||||
if (value.Length())
|
||||
{
|
||||
new_account.number = value;
|
||||
op_complete--;
|
||||
new_account.number = value;
|
||||
op_complete--;
|
||||
}
|
||||
|
||||
value = _accountsGrid->GetCellValue(row, ACCOUNT_SHARED);
|
||||
if (value.Length() && value != wxT("0"))
|
||||
new_account.shared = true;
|
||||
else
|
||||
new_account.shared = false;
|
||||
value = _accountsGrid->GetCellValue(row, ACCOUNT_SHARED);
|
||||
if (value.Length() && value != wxT("0"))
|
||||
new_account.shared = true;
|
||||
else
|
||||
new_account.shared = false;
|
||||
|
||||
value = _accountsGrid->GetCellValue(row, ACCOUNT_DEFAULT);
|
||||
if (value.Length() && value != wxT("0"))
|
||||
new_account._default = true;
|
||||
else
|
||||
new_account._default = false;
|
||||
value = _accountsGrid->GetCellValue(row, ACCOUNT_DEFAULT);
|
||||
if (value.Length() && value != wxT("0"))
|
||||
new_account._default = true;
|
||||
else
|
||||
new_account._default = false;
|
||||
|
||||
if (col == ACCOUNT_DEFAULT)
|
||||
if (col == ACCOUNT_DEFAULT)
|
||||
{
|
||||
new_account.id = user->_accounts[row].id;
|
||||
new_account.id = user->_accounts[row].id;
|
||||
|
||||
for (i=0; i<user->GetAccountsNumber(); i++)
|
||||
for (i=0; i<user->GetAccountsNumber(); i++)
|
||||
{
|
||||
if (i != row)
|
||||
if (i != row)
|
||||
{
|
||||
account = user->_accounts[i];
|
||||
if (account._default)
|
||||
account = user->_accounts[i];
|
||||
if (account._default)
|
||||
{
|
||||
account._default = false;
|
||||
_kiss->UpdateAccount(account);
|
||||
_accountsGrid->SetCellValue(i, ACCOUNT_DEFAULT, wxT(""));
|
||||
break;
|
||||
account._default = false;
|
||||
_kiss->UpdateAccount(account);
|
||||
_accountsGrid->SetCellValue(i, ACCOUNT_DEFAULT, wxT(""));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_kiss->UpdateAccount(new_account);
|
||||
_kiss->UpdateAccount(new_account);
|
||||
}
|
||||
}
|
||||
|
||||
// Account modification
|
||||
if (user->GetAccountsNumber() && row < user->GetAccountsNumber())
|
||||
// Account modification
|
||||
if (user->GetAccountsNumber() && row < user->GetAccountsNumber())
|
||||
{
|
||||
new_account.id = user->_accounts[row].id;
|
||||
new_account.id = user->_accounts[row].id;
|
||||
|
||||
if (col == ACCOUNT_DELETE)
|
||||
if (col == ACCOUNT_DELETE)
|
||||
{
|
||||
if (user->_accounts.size() == 1)
|
||||
if (user->_accounts.size() == 1)
|
||||
{
|
||||
wxMessageBox(_("It must be at least one account !"), _("Error"), wxICON_ERROR | wxOK);
|
||||
_accountsGrid->SetCellValue(row, col, wxT("0"));
|
||||
return;
|
||||
wxMessageBox(_("It must be at least one account !"), _("Error"), wxICON_ERROR | wxOK);
|
||||
_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)
|
||||
wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+new_account.name, wxT("KissCount"), wxYES_NO);
|
||||
if (dialog.ShowModal() == wxID_NO)
|
||||
{
|
||||
_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);
|
||||
_kiss->DeleteAccount(new_account);
|
||||
}
|
||||
|
||||
_wxUI->Layout();
|
||||
inModification = false;
|
||||
_wxUI->NeedReload();
|
||||
return;
|
||||
_wxUI->Layout();
|
||||
inModification = false;
|
||||
_wxUI->NeedReload();
|
||||
return;
|
||||
}
|
||||
|
||||
if (user->GetAccountId(new_account.name) != new_account.id)
|
||||
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 ;
|
||||
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);
|
||||
_kiss->UpdateAccount(new_account);
|
||||
}
|
||||
// New account
|
||||
else
|
||||
// New account
|
||||
else
|
||||
{
|
||||
if (op_complete)
|
||||
if (op_complete)
|
||||
{
|
||||
inModification = false;
|
||||
return ;
|
||||
inModification = false;
|
||||
return ;
|
||||
}
|
||||
|
||||
if (user->GetAccountId(new_account.name) != wxT("0"))
|
||||
if (user->GetAccountId(new_account.name) != wxT("0"))
|
||||
{
|
||||
wxMessageBox(_("Account ")+new_account.name+_(" already exists"), _("Error"), wxICON_ERROR | wxOK );
|
||||
inModification = false;
|
||||
return ;
|
||||
wxMessageBox(_("Account ")+new_account.name+_(" already exists"), _("Error"), wxICON_ERROR | wxOK );
|
||||
inModification = false;
|
||||
return ;
|
||||
}
|
||||
|
||||
_accountsGrid->SetCellRenderer(row, ACCOUNT_SHARED, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(row, ACCOUNT_SHARED, new wxGridCellBoolEditor ());
|
||||
_accountsGrid->SetCellRenderer(row, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(row, ACCOUNT_DEFAULT, new wxGridCellBoolEditor ());
|
||||
_accountsGrid->SetCellRenderer(row, ACCOUNT_DELETE, new wxGridCellBoolRenderer ());
|
||||
_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);
|
||||
_accountsGrid->SetCellRenderer(row, ACCOUNT_SHARED, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(row, ACCOUNT_SHARED, new wxGridCellBoolEditor ());
|
||||
_accountsGrid->SetCellRenderer(row, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ());
|
||||
_accountsGrid->SetCellEditor(row, ACCOUNT_DEFAULT, new wxGridCellBoolEditor ());
|
||||
_accountsGrid->SetCellRenderer(row, ACCOUNT_DELETE, new wxGridCellBoolRenderer ());
|
||||
_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);
|
||||
|
||||
_accountsGrid->SetReadOnly(row, ACCOUNT_SHARED, false);
|
||||
_accountsGrid->SetReadOnly(row, ACCOUNT_DEFAULT, false);
|
||||
_accountsGrid->SetReadOnly(row, ACCOUNT_DELETE, false);
|
||||
_accountsGrid->SetReadOnly(row, ACCOUNT_SHARED, false);
|
||||
_accountsGrid->SetReadOnly(row, ACCOUNT_DEFAULT, false);
|
||||
_accountsGrid->SetReadOnly(row, ACCOUNT_DELETE, false);
|
||||
|
||||
if (!user->GetAccountsNumber())
|
||||
if (!user->GetAccountsNumber())
|
||||
{
|
||||
new_account._default = true;
|
||||
_accountsGrid->SetCellValue(row, ACCOUNT_DEFAULT, wxT("1"));
|
||||
new_account._default = true;
|
||||
_accountsGrid->SetCellValue(row, ACCOUNT_DEFAULT, wxT("1"));
|
||||
}
|
||||
|
||||
_accountsGrid->AutoSizeColumns(true);
|
||||
_accountsGrid->AppendRows();
|
||||
_accountsGrid->AutoSizeColumns(true);
|
||||
_accountsGrid->AppendRows();
|
||||
|
||||
_accountsGrid->SetReadOnly(row+1, ACCOUNT_SHARED, true);
|
||||
_accountsGrid->SetReadOnly(row+1, ACCOUNT_DEFAULT, true);
|
||||
_accountsGrid->SetReadOnly(row+1, ACCOUNT_DELETE, true);
|
||||
_accountsGrid->SetReadOnly(row+1, ACCOUNT_SHARED, true);
|
||||
_accountsGrid->SetReadOnly(row+1, ACCOUNT_DEFAULT, true);
|
||||
_accountsGrid->SetReadOnly(row+1, ACCOUNT_DELETE, true);
|
||||
|
||||
_kiss->AddAccount(new_account);
|
||||
_kiss->AddAccount(new_account);
|
||||
}
|
||||
|
||||
_wxUI->Layout();
|
||||
_wxUI->NeedReload();
|
||||
inModification = false;
|
||||
_wxUI->Layout();
|
||||
_wxUI->NeedReload();
|
||||
inModification = false;
|
||||
}
|
||||
|
||||
void PreferencesPanel::OnCategoryModified(wxGridEvent& event)
|
||||
{
|
||||
int op_complete = 1;
|
||||
wxString value;
|
||||
User* user = _kiss->GetUser();
|
||||
int row = event.GetRow();
|
||||
int col = event.GetCol();
|
||||
static bool inModification = false ;
|
||||
Category new_cat;
|
||||
int op_complete = 1;
|
||||
wxString value;
|
||||
User* user = _kiss->GetUser();
|
||||
int row = event.GetRow();
|
||||
int col = event.GetCol();
|
||||
static bool inModification = false ;
|
||||
Category new_cat;
|
||||
|
||||
if (inModification) return;
|
||||
if (inModification) return;
|
||||
|
||||
inModification = true;
|
||||
inModification = true;
|
||||
|
||||
value = _categoriesGrid->GetCellValue(row, CATEGORY_NAME);
|
||||
if (value.Length())
|
||||
value = _categoriesGrid->GetCellValue(row, CATEGORY_NAME);
|
||||
if (value.Length())
|
||||
{
|
||||
new_cat.name = value;
|
||||
op_complete--;
|
||||
new_cat.name = value;
|
||||
op_complete--;
|
||||
}
|
||||
|
||||
new_cat.color = _categoriesGrid->GetCellBackgroundColour(row, col);
|
||||
new_cat.font = wxT("");
|
||||
new_cat.parent = wxT("0");
|
||||
new_cat.color = _categoriesGrid->GetCellBackgroundColour(row, col);
|
||||
new_cat.font = wxT("");
|
||||
new_cat.parent = wxT("0");
|
||||
|
||||
// Categories modification
|
||||
if (user->GetCategoriesNumber() && row < user->GetCategoriesNumber())
|
||||
// Categories modification
|
||||
if (user->GetCategoriesNumber() && row < user->GetCategoriesNumber())
|
||||
{
|
||||
new_cat.id = user->_categories[row].id;
|
||||
if (col == CATEGORY_DELETE)
|
||||
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)
|
||||
wxMessageDialog dialog(_wxUI, _("Are you sure want to delete : \n")+new_cat.name, wxT("KissCount"), wxYES_NO);
|
||||
if (dialog.ShowModal() == wxID_NO)
|
||||
{
|
||||
_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);
|
||||
_kiss->DeleteCategory(user->_categories[row]);
|
||||
}
|
||||
|
||||
_wxUI->Layout();
|
||||
_wxUI->NeedReload();
|
||||
inModification = false;
|
||||
return;
|
||||
_wxUI->Layout();
|
||||
_wxUI->NeedReload();
|
||||
inModification = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (user->GetCategoryId(new_cat.name) != new_cat.id)
|
||||
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 ;
|
||||
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);
|
||||
_kiss->UpdateCategory(new_cat);
|
||||
}
|
||||
// New category
|
||||
else
|
||||
// New category
|
||||
else
|
||||
{
|
||||
if (op_complete)
|
||||
if (op_complete)
|
||||
{
|
||||
inModification = false;
|
||||
return ;
|
||||
inModification = false;
|
||||
return ;
|
||||
}
|
||||
|
||||
if (user->GetCategoryId(new_cat.name) != wxT("0"))
|
||||
if (user->GetCategoryId(new_cat.name) != wxT("0"))
|
||||
{
|
||||
wxMessageBox(_("Category ")+new_cat.name+_(" already exists"), _("Error"), wxICON_ERROR | wxOK );
|
||||
inModification = false;
|
||||
return ;
|
||||
wxMessageBox(_("Category ")+new_cat.name+_(" already exists"), _("Error"), wxICON_ERROR | wxOK );
|
||||
inModification = false;
|
||||
return ;
|
||||
}
|
||||
|
||||
_kiss->AddCategory(new_cat);
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_COLOR, false);
|
||||
_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 wxGridCellBoolEditor ());
|
||||
_kiss->AddCategory(new_cat);
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_COLOR, false);
|
||||
_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 wxGridCellBoolEditor ());
|
||||
|
||||
_categoriesGrid->SetCellAlignment(row, CATEGORY_COLOR, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(row, CATEGORY_FONT, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(row, CATEGORY_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(row, CATEGORY_COLOR, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(row, CATEGORY_FONT, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
_categoriesGrid->SetCellAlignment(row, CATEGORY_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||
|
||||
row++;
|
||||
_categoriesGrid->AppendRows();
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_COLOR, true);
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_FONT, true);
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_DELETE, true);
|
||||
SET_ROW_COLOR(row, OWN_GREEN);
|
||||
row++;
|
||||
_categoriesGrid->AppendRows();
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_COLOR, true);
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_FONT, true);
|
||||
_categoriesGrid->SetReadOnly(row, CATEGORY_DELETE, true);
|
||||
SET_ROW_COLOR(row, OWN_GREEN);
|
||||
}
|
||||
|
||||
_wxUI->Layout();
|
||||
_wxUI->NeedReload();
|
||||
return;
|
||||
_wxUI->Layout();
|
||||
_wxUI->NeedReload();
|
||||
return;
|
||||
}
|
||||
|
||||
void PreferencesPanel::OnChangeName(wxCommandEvent& event)
|
||||
{
|
||||
User* user = _kiss->GetUser();
|
||||
wxString name = _name->GetLineText(0);
|
||||
User* user = _kiss->GetUser();
|
||||
wxString name = _name->GetLineText(0);
|
||||
|
||||
if (name == user->_name)
|
||||
return;
|
||||
if (name == user->_name)
|
||||
return;
|
||||
|
||||
if (!name.size())
|
||||
if (!name.size())
|
||||
{
|
||||
wxMessageBox(_("Invalid name"), _("Error"), wxICON_ERROR | wxOK);
|
||||
return;
|
||||
wxMessageBox(_("Invalid name"), _("Error"), wxICON_ERROR | wxOK);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_kiss->UserExists(name))
|
||||
if (_kiss->UserExists(name))
|
||||
{
|
||||
wxMessageBox(_("User ") + name + _(" already exists"), _("Error"), wxICON_ERROR | wxOK);
|
||||
return;
|
||||
wxMessageBox(_("User ") + name + _(" already exists"), _("Error"), wxICON_ERROR | wxOK);
|
||||
return;
|
||||
}
|
||||
|
||||
_kiss->ChangeName(name);
|
||||
_kiss->ChangeName(name);
|
||||
|
||||
wxMessageBox(_("Name changed"), wxT("KissCount"), wxICON_INFORMATION | wxOK);
|
||||
_wxUI->NeedReload();
|
||||
_wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") +_("Preferences"));
|
||||
wxMessageBox(_("Name changed"), wxT("KissCount"), wxICON_INFORMATION | wxOK);
|
||||
_wxUI->NeedReload();
|
||||
_wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") +_("Preferences"));
|
||||
}
|
||||
|
||||
void PreferencesPanel::OnChangePassword(wxCommandEvent& event)
|
||||
{
|
||||
PasswordDialog p(_kiss, _wxUI);
|
||||
p.ShowModal();
|
||||
PasswordDialog p(_kiss, _wxUI);
|
||||
p.ShowModal();
|
||||
}
|
||||
|
||||
void PreferencesPanel::OnOperationOrderChange(wxCommandEvent& event)
|
||||
{
|
||||
if (_operationOrder->GetCurrentSelection() == 0)
|
||||
_kiss->SetOperationOrder(wxT("ASC"));
|
||||
else
|
||||
_kiss->SetOperationOrder(wxT("DESC"));
|
||||
if (_operationOrder->GetCurrentSelection() == 0)
|
||||
_kiss->SetOperationOrder(wxT("ASC"));
|
||||
else
|
||||
_kiss->SetOperationOrder(wxT("DESC"));
|
||||
|
||||
_wxUI->NeedReload();
|
||||
_wxUI->NeedReload();
|
||||
}
|
||||
|
||||
void PreferencesPanel::OnLanguageChange(wxCommandEvent& event)
|
||||
{
|
||||
wxLanguage language = languages[_language->GetSelection()].language;
|
||||
if (_wxUI->SetLanguage(language) || language == wxLANGUAGE_ENGLISH)
|
||||
wxLanguage language = languages[_language->GetSelection()].language;
|
||||
if (_wxUI->SetLanguage(language) || language == wxLANGUAGE_ENGLISH)
|
||||
{
|
||||
_wxUI->NeedReload();
|
||||
_kiss->SetLanguage(language);
|
||||
wxMessageBox(_("Language successfully changed, please go to another panel"), _("KissCount"), wxICON_INFORMATION | wxOK);
|
||||
_wxUI->NeedReload();
|
||||
_kiss->SetLanguage(language);
|
||||
wxMessageBox(_("Language successfully changed, please go to another panel"), _("KissCount"), wxICON_INFORMATION | wxOK);
|
||||
}
|
||||
else
|
||||
wxMessageBox(_("Language not changed"), _("KissCount"), wxICON_ERROR | wxOK);
|
||||
else
|
||||
wxMessageBox(_("Language not changed"), _("KissCount"), wxICON_ERROR | wxOK);
|
||||
}
|
||||
|
||||
void PreferencesPanel::OnShow(wxShowEvent& event)
|
||||
{
|
||||
_wxUI->SetTitle(_kiss->GetUser()->_name + _(" - ") + _("Preferences"));
|
||||
_wxUI->SetTitle(_kiss->GetUser()->_name + _(" - ") + _("Preferences"));
|
||||
}
|
||||
|
||||
void PreferencesPanel::OnKillMe(wxCommandEvent& event)
|
||||
{
|
||||
User* user = _kiss->GetUser();
|
||||
User* user = _kiss->GetUser();
|
||||
|
||||
wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+user->_name+_(" profil ?"), wxT("KissCount"), wxYES_NO);
|
||||
if (dialog.ShowModal() == wxID_NO)
|
||||
wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+user->_name+_(" profil ?"), wxT("KissCount"), wxYES_NO);
|
||||
if (dialog.ShowModal() == wxID_NO)
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
_kiss->KillMe();
|
||||
_kiss->KillMe();
|
||||
}
|
||||
|
Reference in New Issue
Block a user