KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_git_identity.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
21
22#include <confirm.h>
24
25
26DIALOG_GIT_IDENTITY::DIALOG_GIT_IDENTITY( wxWindow* aParent, const wxString& aTitle, const wxString& aName,
27 const wxString& aEmail ) :
28 DIALOG_GIT_IDENTITY_BASE( aParent, wxID_ANY, aTitle )
29{
30 OptOut( this );
31
32 m_nameCtrl->SetValue( aName );
33 m_emailCtrl->SetValue( aEmail );
34
37}
38
39
41{
42 m_name = m_nameCtrl->GetValue();
43 m_name.Trim( true ).Trim( false );
44 m_email = m_emailCtrl->GetValue();
45 m_email.Trim( true ).Trim( false );
46
47 wxString reason;
48
49 if( !KIGIT::ValidateIdentity( m_name, m_email, reason ) )
50 {
51 DisplayInfoMessage( this, reason );
52
53 if( m_name.IsEmpty() )
54 m_nameCtrl->SetFocus();
55 else
56 m_emailCtrl->SetFocus();
57
58 return false;
59 }
60
61 return true;
62}
DIALOG_GIT_IDENTITY_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Introduce Yourself"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE)
bool TransferDataFromWindow() override
DIALOG_GIT_IDENTITY(wxWindow *aParent, const wxString &aTitle, const wxString &aName, const wxString &aEmail)
void OptOut(wxWindow *aWindow)
Opt out of control state saving.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition confirm.cpp:245
This file is part of the common library.
bool ValidateIdentity(const wxString &aName, const wxString &aEmail, wxString &aError)
Check a name and email for recording commits. False leaves the reason in aError.