From 7463b9071a5aa395e59737cbdfd3445832ff016c Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 11 Apr 2016 21:45:03 +0100 Subject: [PATCH] Added OS X specific functions to frmMain --- source/frmMain.mm | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 source/frmMain.mm diff --git a/source/frmMain.mm b/source/frmMain.mm new file mode 100644 index 0000000..bb8d614 --- /dev/null +++ b/source/frmMain.mm @@ -0,0 +1,69 @@ +// frmMain.mm - OS X specific functions for frmMain +// +// (c) 2012-2015 Xestia Software Development. +// +// This file is part of Xestia Address Book. +// +// Xestia Address Book 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, version 3 of the license. +// +// Xestia Address Book 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 Xestia Address Book. If not, see + +#import +#import + +#include "frmMain.h" + +void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, SecTrustRef SecurityTrustObject){ + + // Delete existing data. + + AccountTrustData.erase(AccountID); + AccountSSLResult.erase(AccountID); + + // Insert new data. + + AccountTrustData.insert(std::make_pair(AccountID, SecurityTrustObject)); + AccountSSLResult.insert(std::make_pair(AccountID, SSLStatus)); + +} + +void frmMain::DisplayCertificate(SecTrustRef SecurityTrustObject){ + + SFCertificatePanel *SecCertPanel = [[SFCertificatePanel alloc] init]; + + [SecCertPanel setParentWindow:(NSWindow*)this->GetHandle()]; + [SecCertPanel setDefaultButtonTitle:@"Close"]; + + [SecCertPanel runModalForTrust:SecurityTrustObject showGroup:YES]; + +} + +void frmMain::DisplayTrustPanel( wxCommandEvent &event ){ + + SSLInvalidTrustNotifObj *SSLITNObj = (SSLInvalidTrustNotifObj*)event.GetClientData(); + + NSInteger ResultValue; + + SFCertificateTrustPanel *secpanel = [SFCertificateTrustPanel sharedCertificateTrustPanel]; + + [secpanel setDefaultButtonTitle:@"Accept"]; + [secpanel setAlternateButtonTitle:@"Cancel"]; + [secpanel setInformativeText: @"This certificate is not trusted. Someone could be trying to eavesdrop on your connection. Do you want to accept this certificate anyway?\n\nAccept and trusting the certificate will fetch and process information as required.\nCancel will close the connection."]; + [secpanel setShowsHelp:YES]; + + [secpanel setParentWindow:(NSWindow*)this->GetHandle()]; + + ResultValue = [secpanel runModalForTrust:SSLITNObj->SecurityTrustObject message:@"Certificate not trusted"]; + + *SSLITNObj->ResultValue = (int)ResultValue; + *SSLITNObj->PausePtr = FALSE; + +} \ No newline at end of file -- 2.39.5