Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added OS X support for frmMain itself.
[xestiaab/.git] / source / frmMain.cpp
index 5c3695a..59c3770 100644 (file)
@@ -90,6 +90,9 @@ DEFINE_EVENT_TYPE(SYNCACCOUNT);
 DEFINE_EVENT_TYPE(IMPORT_RESULTSSHOW);
 DEFINE_EVENT_TYPE(RELOADCONTACTLIST);
 DEFINE_EVENT_TYPE(REFRESHADDRESSBOOK);
+#if defined(__APPLE__)
+DEFINE_EVENT_TYPE(INVALIDSSLTRUST);
+#endif
 
 // Setup the event table using the event types.
 
@@ -119,6 +122,9 @@ EVT_COMMAND(wxID_ANY, SYNCACCOUNT, frmMain::SyncAccount)
 EVT_COMMAND(wxID_ANY, IMPORT_RESULTSSHOW, frmMain::ShowImportResults)
 EVT_COMMAND(wxID_ANY, RELOADCONTACTLIST, frmMain::ReloadContactList)
 EVT_COMMAND(wxID_ANY, REFRESHADDRESSBOOK, frmMain::RefreshAddressBook)
+#if defined(__APPLE__)
+EVT_COMMAND(wxID_ANY, INVALIDSSLTRUST, frmMain::DisplayTrustPanel)
+#endif
 END_EVENT_TABLE()
 
 frmMain::frmMain( wxWindow* parent )
@@ -477,7 +483,7 @@ void frmMain::OpenNewABDialog( wxCommandEvent& event)
                // the application.
         
                this->LoadPreferences();
-           
+
        }
     
 }
@@ -1395,7 +1401,7 @@ void frmMain::LoadPreferences(){
        }
     
        AccountSyncTimers.clear();
-    
+        
        wxString AccDir;
        wxString AccDirFull;
        wxString AccDirFullSfx;
@@ -1408,6 +1414,10 @@ void frmMain::LoadPreferences(){
        wxTreeItemId AccountTreeId;
        wxTreeItemId GroupTreeId;
        int intGroupID = 0;
+        
+        // Relaod the accounts for the ETagProcTimer.
+        
+        ETagProcTimer.ReloadAccounts();
     
        for (int i = 0; i < preferences.accounts.GetCount(); i++){
         
@@ -2480,8 +2490,52 @@ void frmMain::ShowSSLCertificates( wxCommandEvent &event ){
        wxString AccTypeLower;
        wxString AccType;
        bool AccountSSL;
-       std::map<int, SSLCertCollection>::iterator SSLColIter;
     
+#if defined(__APPLE__)
+
+       std::map<int, SecTrustRef>::iterator SSLTrustIter;
+        
+        for (int i = 0; i < prefaccounts.GetCount(); i++){
+                
+                SeekAccount.Append(prefaccounts.GetAccountDirectory(i));
+                AccType.Append(prefaccounts.GetAccountType(i));
+                AccountSSL = prefaccounts.GetAccountSSL(i);
+                AccTypeLower = AccType.MakeLower();
+                SeekAccount.Append(wxT("."));
+                SeekAccount.Append(AccTypeLower);
+                
+                if (SeekAccount == ActiveAccount){
+                        
+                        if (AccTypeLower == wxT("local")){
+                                
+                                return;
+                                
+                        }
+                        
+                        if (AccountSSL == false){
+                                
+                                return;
+                                
+                        }
+                        
+                        SSLTrustIter = AccountTrustData.find(i);
+                        
+                        // Setup and display the form.
+                        
+                        DisplayCertificate(SSLTrustIter->second);
+                        
+                }
+                
+                SeekAccount.Clear();
+                AccTypeLower.Clear();
+                AccType.clear();
+                
+        }
+    
+#else
+    
+       std::map<int, SSLCertCollection>::iterator SSLColIter;
+        
        for (int i = 0; i < prefaccounts.GetCount(); i++){
         
                SeekAccount.Append(prefaccounts.GetAccountDirectory(i));
@@ -2524,6 +2578,8 @@ void frmMain::ShowSSLCertificates( wxCommandEvent &event ){
                AccType.clear();
         
        }
+
+#endif
     
 }
 
@@ -2553,61 +2609,6 @@ void frmMain::UpdateConnectionStatus( wxCommandEvent &event ){
     
 }
 
-void frmMain::SetupSSLStatus( int AccountID ){
-    
-       // Check if account ID given is
-       // the active account and if not, do nothing.
-    
-       wxString AccType;
-       wxString AccTypeLower;
-    
-       AccType = prefaccounts.GetAccountType(AccountID);
-       AccTypeLower = AccType.MakeLower();
-    
-       wxString AccountIDName = prefaccounts.GetAccountDirectory(AccountID) + wxT(".") +
-               AccTypeLower;
-    
-       if (AccountIDName != ActiveAccount){
-        
-               return;
-        
-       }
-    
-       // Check if the account has SSL enabled.
-    
-       bool SSLInUse = prefaccounts.GetAccountSSL(AccountID);
-    
-       if (SSLInUse == FALSE){
-        
-               SSLToolTip->SetTip(wxT("SSL is not enabled for this account"));
-               imgSSLStatus->SetBitmap(*imgNoSSL);
-        
-       } else {
-        
-               // Get the SSL Collection Data.
-        
-               std::map<int,int>::iterator SSLResultIter = AccountSSLResult.find(AccountID);
-        
-               if (SSLResultIter->second == 1){
-            
-                       imgSSLStatus->SetBitmap(*imgSSLWarning);
-                       SSLToolTip->SetTip(wxT("Invalid certificate(s) received for '") + 
-                               prefaccounts.GetAccountName(AccountID) +
-                       wxT("' (Connection denied by user)\n\nDouble click for more information."));
-            
-               } else if (SSLResultIter->second == 0){
-            
-                       imgSSLStatus->SetBitmap(*imgSSL);
-                       SSLToolTip->SetTip(wxT("Account '") + 
-                               prefaccounts.GetAccountName(AccountID) +
-                       wxT("' secured using SSL\n\nDouble click for more information."));
-            
-               }
-        
-       }
-    
-}
-
 void frmMain::InvalidSSLCertificate( wxCommandEvent &event ){
     
        // Display the form for showing an invalid SSL certificate.
@@ -2630,6 +2631,7 @@ void frmMain::InvalidSSLCertificate( wxCommandEvent &event ){
     
        frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);  
        wxPostEvent(frameActMgr, event2);
+        
 }
 
 void frmMain::PauseAllTimers(){
@@ -2658,6 +2660,10 @@ void frmMain::ResumeAllTimers(){
     
 }
 
+#if defined(__APPLE__)
+
+#else
+
 void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollection SSLCertInc){
     
        // Delete existing data.
@@ -2672,6 +2678,63 @@ void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollec
     
 }
 
+#endif
+
+void frmMain::SetupSSLStatus( int AccountID ){
+        
+        // Check if account ID given is
+        // the active account and if not, do nothing.
+        
+        wxString AccType;
+        wxString AccTypeLower;
+        
+        AccType = prefaccounts.GetAccountType(AccountID);
+        AccTypeLower = AccType.MakeLower();
+        
+        wxString AccountIDName = prefaccounts.GetAccountDirectory(AccountID) + wxT(".") +
+        AccTypeLower;
+        
+        if (AccountIDName != ActiveAccount){
+                
+                return;
+                
+        }
+        
+        // Check if the account has SSL enabled.
+        
+        bool SSLInUse = prefaccounts.GetAccountSSL(AccountID);
+        
+        if (SSLInUse == FALSE){
+                
+                SSLToolTip->SetTip(wxT("SSL is not enabled for this account"));
+                imgSSLStatus->SetBitmap(*imgNoSSL);
+                
+        } else {
+                
+                // Get the SSL Collection Data.
+                
+                std::map<int,int>::iterator SSLResultIter = AccountSSLResult.find(AccountID);
+                
+                if (SSLResultIter->second == 1){
+                        
+                        imgSSLStatus->SetBitmap(*imgSSLWarning);
+                        SSLToolTip->SetTip(wxT("Invalid certificate(s) received for '") +
+                                           prefaccounts.GetAccountName(AccountID) +
+                                           wxT("' (Connection denied by user)\n\nDouble click for more information."));
+                        
+                } else if (SSLResultIter->second == 0){
+                        
+                        imgSSLStatus->SetBitmap(*imgSSL);
+                        SSLToolTip->SetTip(wxT("Account '") +
+                                           prefaccounts.GetAccountName(AccountID) +
+                                           wxT("' secured using SSL\n\nDouble click for more information."));
+                        
+                }
+                
+        }
+        
+}
+
 void frmMain::CheckUpdates( wxCommandEvent& event ){
     
        // Check for updates to Xestia Address Book.
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