1 // frmInvalidSSLCertificate.cpp - frmInvalidSSLCertificate form functions
3 // (c) 2016-2017 Xestia Software Development.
5 // This file is part of Xestia Calendar.
7 // Xestia Calendar is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Calendar is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include "frmInvalidSSLCertificate.h"
21 frmInvalidSSLCertificate::frmInvalidSSLCertificate( wxWindow* parent )
23 frmInvalidSSLCertificateADT( parent )
28 void frmInvalidSSLCertificate::Accept( wxCommandEvent& event )
30 // TODO: Implement Accept
33 void frmInvalidSSLCertificate::Reject( wxCommandEvent& event )
35 // TODO: Implement Reject
38 void frmInvalidSSLCertificate::ViewCertificates( wxCommandEvent& event )
40 // Button 'View Certificates' was pressed.
42 /*frmSSLCertificate *frameSSLCert = new frmSSLCertificate ( this );
43 frameSSLCert->StartCertFrom(0);
44 frameSSLCert->SetupCertsString(CertDataString);
45 frameSSLCert->ShowModal();
48 frameSSLCert = NULL;*/
51 void frmInvalidSSLCertificate::LoadData(SSLCertCollection CertDataInc,
52 wxString AccountNameInc)
55 // Load the invalid SSL certificate dialog.
57 AccountName = AccountNameInc;
58 CertData = CertDataInc;
60 wxString SSLTextLabel;
62 SSLTextLabel.Append(wxString::Format(_("An invalid SSL certificate was received from the server for the '%s' account.\n\n"), AccountName));
63 SSLTextLabel.Append(_("Click on one of the following buttons:\n\n"));
64 SSLTextLabel.Append(_("- Accept to accept the SSL certificate for this session and future sessions until the certificate changes.\n"));
65 SSLTextLabel.Append(_("- Reject to not use this certificate and disconnect (you will be asked again on subsequent reconnections to the server).\n"));
66 SSLTextLabel.Append(_("- View Certificates to review the certificates that were received."));
68 lblSSLText->SetLabel(SSLTextLabel);
72 void frmInvalidSSLCertificate::LoadData(SSLCertCollectionString CertDataInc,
73 wxString AccountNameInc)
76 // Load the invalid SSL certificate dialog.
78 AccountName = AccountNameInc;
79 CertDataString = CertDataInc;
81 wxString SSLTextLabel;
83 SSLTextLabel.Append(wxString::Format(_("An invalid SSL certificate was received from the server for the '%s' account.\n\n"), AccountName));
84 SSLTextLabel.Append(_("Click on one of the following buttons:\n\n"));
85 SSLTextLabel.Append(_("- Accept to accept the SSL certificate for this session and future sessions until the certificate changes.\n"));
86 SSLTextLabel.Append(_("- Reject to not use this certificate and disconnect (you will be asked again on subsequent reconnections to the server).\n"));
87 SSLTextLabel.Append(_("- View Certificates to review the certificates that were received."));
89 lblSSLText->SetLabel(SSLTextLabel);
93 void frmInvalidSSLCertificate::LoadDataNew(SSLCertCollection CertDataInc,
94 wxString DomainNameInc)
97 // Load the invalid SSL certificate dialog for a new account.
99 AccountName = DomainNameInc;
100 CertData = CertDataInc;
102 wxString SSLTextLabel;
104 SSLTextLabel.Append(wxString::Format(_("An invalid SSL certificate was received from the server for the '%s' account.\n\n"), AccountName));
105 SSLTextLabel.Append(_("Click on one of the following buttons:\n\n"));
106 SSLTextLabel.Append(_("- Accept to accept the SSL certificate for this session and future sessions until the certificate changes.\n"));
107 SSLTextLabel.Append(_("- Reject to not use this certificate and disconnect.\n"));
108 SSLTextLabel.Append(_("- View Certificates to review the certificates that were received."));
110 lblSSLText->SetLabel(SSLTextLabel);
114 void frmInvalidSSLCertificate::LoadDataNew(SSLCertCollectionString CertDataInc,
115 std::string DomainNameInc)
118 // Load the invalid SSL certificate dialog for a new account.
120 AccountName = DomainNameInc;
121 CertDataString = CertDataInc;
123 wxString SSLTextLabel;
125 SSLTextLabel.Append(wxString::Format(_("An invalid SSL certificate was received from the server for the '%s' account.\n\n"), AccountName));
126 SSLTextLabel.Append(_("Click on one of the following buttons:\n\n"));
127 SSLTextLabel.Append(_("- Accept to accept the SSL certificate for this session and future sessions until the certificate changes.\n"));
128 SSLTextLabel.Append(_("- Reject to not use this certificate and disconnect.\n"));
129 SSLTextLabel.Append(_("- View Certificates to review the certificates that were received."));
131 lblSSLText->SetLabel(SSLTextLabel);
135 int frmInvalidSSLCertificate::GetResult()
138 // Get the result of which button was pressed in the dialog.