Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
macOS: Implemented support for adding, editing and deleting a CalDAV account
[xestiacalendar/.git] / source / forms / newaccount / frmNewAccount.cpp
index 854dc70..c50cf84 100644 (file)
 
 #include "frmNewAccount.h"
 
+#if defined(__WIN32__)
+#include "../common/win32ssl.h"
+#endif
+
 DEFINE_EVENT_TYPE(UPDATERESULTS);
 DEFINE_EVENT_TYPE(RUNCALDAVTEST);
 
@@ -227,7 +231,7 @@ void frmNewAccount::Navigate( wxCommandEvent& event )
             
                        // Create the account directory.
             
-                       if (wxMkdir(xestiaCALDirectory + wxT("\\accounts\\") + directoryName + wxT(".local"), 0740) == true){
+                       if (wxMkdir(xestiaCALDirectory + wxT("\\accounts\\") + directoryName + wxT(".Local"), 0740) == true){
                 
                                WriteAccountDetails(cfgFile, wxT("Local"), directoryName);
                 
@@ -242,7 +246,7 @@ void frmNewAccount::Navigate( wxCommandEvent& event )
                                                
                        // Create the account directory.
             
-                       if (wxMkdir(xestiaCALDirectory + wxT("\\accounts\\") + directoryName + wxT(".caldav"), 0740) == true){
+                       if (wxMkdir(xestiaCALDirectory + wxT("\\accounts\\") + directoryName + wxT(".CalDAV"), 0740) == true){
                 
                                WriteAccountDetails(cfgFile, wxT("CalDAV"), directoryName);
                 
@@ -316,7 +320,7 @@ void frmNewAccount::Navigate( wxCommandEvent& event )
             
                        wxString directoryName = txtAccountName->GetValue().Mid(0, 30) + randomNumberSuffix;
             
-                       if (wxMkdir(xestiaCALDirectory + wxT("/accounts/") + directoryName + wxT(".caldav"), 0740) == true){
+                       if (wxMkdir(xestiaCALDirectory + wxT("/accounts/") + directoryName + wxT(".CalDAV"), 0740) == true){
                 
                                WriteAccountDetails(cfgFile, wxT("CalDAV"), directoryName);
                        
@@ -500,14 +504,14 @@ void frmNewAccount::RunCalDAVTest( wxCommandEvent &event )
        
        if (testConnection.SSLVerify() == COSSL_UNABLETOVERIFY){
 #if defined(__APPLE__)
-               
+        
                testConnection.BypassSSLVerification(true);
                
-               CalDAVServerResult testConnection = testConnection.Connect(false);
+               CalDAVServerResult testConnectionResult = testConnection.Connect(false);
                
                testConnection.BypassSSLVerification(false);
                
-               int SSLResult = DisplayTrustPanel(&TestConnection);
+               int SSLResult = DisplayTrustPanel(&testConnection);
                
                if (SSLResult != NSOKButton){
                        
@@ -515,7 +519,7 @@ void frmNewAccount::RunCalDAVTest( wxCommandEvent &event )
                        lblServerResponse->SetLabel(_("Not applicable"));
                        lblServerSSLResult->SetLabel(_("Used"));
                        lblServerSSLValid->SetLabel(_("No"));
-                       lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + TestConnection.GetErrorMessage());
+                       lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + testConnection.GetErrorMessage());
                        btnPrevious->Enable(true);
                        return;
                        
@@ -528,7 +532,8 @@ void frmNewAccount::RunCalDAVTest( wxCommandEvent &event )
                        switch(evalResult){
                                case kSecTrustResultProceed:
                                        lblServerSSLValid->SetLabel(_("Verified"));
-                                       break;
+                    break;
+                case kSecTrustResultUnspecified:
                                case kSecTrustResultConfirm:
                                        lblServerSSLValid->SetLabel(_("Verified (user)"));
                                        break;
@@ -536,10 +541,14 @@ void frmNewAccount::RunCalDAVTest( wxCommandEvent &event )
                                        lblServerSSLValid->SetLabel(_("Unable to verify"));
                        }
                        
+            lblServerConnResult->SetLabel(_("Connected"));
                        lblServerResponse->SetLabel(_("Not applicable"));
                        lblServerSSLResult->SetLabel(_("Used"));
                        
-                       if (evalResult != kSecTrustResultProceed){
+            btnPrevious->Enable(true);
+            
+                       if (evalResult != kSecTrustResultProceed && evalResult != kSecTrustResultUnspecified){
+                lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + testConnection.GetErrorMessage());
                                return;
                        }
                        
@@ -553,7 +562,7 @@ void frmNewAccount::RunCalDAVTest( wxCommandEvent &event )
 
                testConnection.BypassSSLVerification(false);
 
-               bool modifiedCertificateData = false;
+               BOOL modifiedCertificateData = false;
 
                CRYPTUI_VIEWCERTIFICATE_STRUCTW certificateDialogData = BuildCertificateData(&testConnection, (HWND)this->GetHandle());
 
@@ -674,4 +683,4 @@ void frmNewAccount::RunCalDAVTest( wxCommandEvent &event )
        wxCommandEvent resultsEvent(UPDATERESULTS);
        resultsEvent.SetClientData(resultData);
        wxPostEvent(this, resultsEvent);
-}
\ No newline at end of file
+}
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy