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 "PasswordDialog.h"
|
||||
@@ -28,64 +28,64 @@ END_EVENT_TABLE()
|
||||
|
||||
PasswordDialog::PasswordDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), wxID_ANY, _("Change password")), _kiss(kiss), _wxUI(parent)
|
||||
{
|
||||
wxGridBagSizer *gridBagSizer;
|
||||
wxStaticText* label;
|
||||
wxGridBagSizer *gridBagSizer;
|
||||
wxStaticText* label;
|
||||
|
||||
gridBagSizer = new wxGridBagSizer(5, 3);
|
||||
gridBagSizer = new wxGridBagSizer(5, 3);
|
||||
|
||||
label = new wxStaticText(this, wxID_ANY, _("Old password "));
|
||||
gridBagSizer->Add(label, wxGBPosition(0, 0));
|
||||
_oldPassword = new wxTextCtrl(this, OLD_PASSWORD_ID);
|
||||
gridBagSizer->Add(_oldPassword, wxGBPosition(0, 1));
|
||||
label = new wxStaticText(this, wxID_ANY, _("Old password "));
|
||||
gridBagSizer->Add(label, wxGBPosition(0, 0));
|
||||
_oldPassword = new wxTextCtrl(this, OLD_PASSWORD_ID);
|
||||
gridBagSizer->Add(_oldPassword, wxGBPosition(0, 1));
|
||||
|
||||
label = new wxStaticText(this, wxID_ANY, _("New password "));
|
||||
gridBagSizer->Add(label, wxGBPosition(1, 0));
|
||||
_newPassword = new wxTextCtrl(this, NEW_PASSWORD_ID);
|
||||
gridBagSizer->Add(_newPassword, wxGBPosition(1, 1));
|
||||
label = new wxStaticText(this, wxID_ANY, _("New password "));
|
||||
gridBagSizer->Add(label, wxGBPosition(1, 0));
|
||||
_newPassword = new wxTextCtrl(this, NEW_PASSWORD_ID);
|
||||
gridBagSizer->Add(_newPassword, wxGBPosition(1, 1));
|
||||
|
||||
label = new wxStaticText(this, wxID_ANY, _("Confirm password "));
|
||||
gridBagSizer->Add(label, wxGBPosition(2, 0));
|
||||
_confirmPassword = new wxTextCtrl(this, CONFIRM_PASSWORD_ID);
|
||||
gridBagSizer->Add(_confirmPassword, wxGBPosition(2, 1));
|
||||
label = new wxStaticText(this, wxID_ANY, _("Confirm password "));
|
||||
gridBagSizer->Add(label, wxGBPosition(2, 0));
|
||||
_confirmPassword = new wxTextCtrl(this, CONFIRM_PASSWORD_ID);
|
||||
gridBagSizer->Add(_confirmPassword, wxGBPosition(2, 1));
|
||||
|
||||
_oldPassword->SetWindowStyle(wxTE_PASSWORD);
|
||||
_newPassword->SetWindowStyle(wxTE_PASSWORD);
|
||||
_confirmPassword->SetWindowStyle(wxTE_PASSWORD);
|
||||
_oldPassword->SetWindowStyle(wxTE_PASSWORD);
|
||||
_newPassword->SetWindowStyle(wxTE_PASSWORD);
|
||||
_confirmPassword->SetWindowStyle(wxTE_PASSWORD);
|
||||
|
||||
wxButton* ok = new wxButton(this, BUTTON_OK_ID, _("OK"));
|
||||
wxButton* cancel = new wxButton(this, BUTTON_CANCEL_ID, _("Cancel"));
|
||||
gridBagSizer->Add(ok, wxGBPosition(4, 1));
|
||||
gridBagSizer->Add(cancel, wxGBPosition(4, 2));
|
||||
wxButton* ok = new wxButton(this, BUTTON_OK_ID, _("OK"));
|
||||
wxButton* cancel = new wxButton(this, BUTTON_CANCEL_ID, _("Cancel"));
|
||||
gridBagSizer->Add(ok, wxGBPosition(4, 1));
|
||||
gridBagSizer->Add(cancel, wxGBPosition(4, 2));
|
||||
|
||||
SetSizer(gridBagSizer);
|
||||
SetSizer(gridBagSizer);
|
||||
|
||||
Layout();
|
||||
Center();
|
||||
Layout();
|
||||
Center();
|
||||
}
|
||||
|
||||
void PasswordDialog::OnOK(wxCommandEvent& event)
|
||||
{
|
||||
User* user = _kiss->GetUser();
|
||||
User* user = _kiss->GetUser();
|
||||
|
||||
if (!_kiss->IsValidUser(user->_name, _oldPassword->GetLineText(0)))
|
||||
if (!_kiss->IsValidUser(user->_name, _oldPassword->GetLineText(0)))
|
||||
{
|
||||
wxMessageBox(_("Invalid old password"), _("Error"), wxICON_ERROR | wxOK);
|
||||
return;
|
||||
wxMessageBox(_("Invalid old password"), _("Error"), wxICON_ERROR | wxOK);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_newPassword->GetLineText(0) != _confirmPassword->GetLineText(0))
|
||||
if (_newPassword->GetLineText(0) != _confirmPassword->GetLineText(0))
|
||||
{
|
||||
wxMessageBox(_("Please retype new password"), _("Error"), wxICON_ERROR | wxOK);
|
||||
return;
|
||||
wxMessageBox(_("Please retype new password"), _("Error"), wxICON_ERROR | wxOK);
|
||||
return;
|
||||
}
|
||||
|
||||
_kiss->ChangePassword(_newPassword->GetLineText(0));
|
||||
_kiss->ChangePassword(_newPassword->GetLineText(0));
|
||||
|
||||
wxMessageBox(_("Password changed"), wxT("KissCount"), wxICON_INFORMATION | wxOK);
|
||||
Close();
|
||||
wxMessageBox(_("Password changed"), wxT("KissCount"), wxICON_INFORMATION | wxOK);
|
||||
Close();
|
||||
}
|
||||
|
||||
void PasswordDialog::OnCancel(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
Close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user