Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Moved includes in frmEditAccount.cpp to frmEditAccount.h
[xestiaab/.git] / source / frmEditAccount.cpp
index 5313dcd..e9e9def 100644 (file)
@@ -17,8 +17,6 @@
 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
 
 #include "frmEditAccount.h"
-#include "frmInvalidSSLCertificate.h"
-#include "carddav/carddav.h"
 
 frmEditAccount::frmEditAccount( wxWindow* parent )
 :
@@ -92,7 +90,7 @@ void frmEditAccount::DetectAddressBook( wxCommandEvent& event )
 
                if (sslcode == CURLE_OK){
                                
-
+                       // Certificate is okay. Do nothing.
 
                } else if (sslcode == CURLE_SSL_CACERT || sslcode == CURLE_SSL_CONNECT_ERROR){
 
@@ -104,6 +102,12 @@ void frmEditAccount::DetectAddressBook( wxCommandEvent& event )
 
                        int SSLResult;
                        
+#if defined(__APPLE__)
+       
+                       SSLResult = DisplayTrustPanel(&CDavObj);
+                       
+#else
+                       
                        frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this);
 
                        frmICPtr->LoadDataNew(CDavObj.GetSSLVerifyResults(), txtAddress->GetValue());
@@ -115,7 +119,9 @@ void frmEditAccount::DetectAddressBook( wxCommandEvent& event )
                                
                        delete frmICPtr;
                        frmICPtr = NULL;
-                                               
+                       
+#endif
+                       
                        // Process the response from the user.
                                                        
                        if (SSLResult == 1){
@@ -132,7 +138,6 @@ void frmEditAccount::DetectAddressBook( wxCommandEvent& event )
                                return;
                                                                
                        }
-                               
 
                } else {
 
@@ -156,22 +161,25 @@ void frmEditAccount::DetectAddressBook( wxCommandEvent& event )
 
 void frmEditAccount::LoadPointers( wxFileConfig* cfgin ){
 
+       // Setup the account configuration file pointer.
+       
        cfgfile = cfgin;
 
 }
 
 void frmEditAccount::LoadSettings( wxString AccNameIn ){
 
-       // Get the data from the accounts settings file.
+       // Get the data from the accounts settings file and
+       // fill in the account fields.
 
        AccName = AccNameIn;
        long itemindex = 0;
        bool ContinueAcc = TRUE;
        wxString AccountName;
        wxString AccountData;
-
+       
        ContinueAcc = cfgfile->GetFirstGroup(AccountName, itemindex);
-
+       
        while (ContinueAcc){
 
                if (AccountName == AccName){
@@ -218,6 +226,19 @@ void frmEditAccount::LoadSettings( wxString AccNameIn ){
 void frmEditAccount::UpdateSettings( wxCommandEvent& event )
 {
 
+       // Check if server address matches against the blacklist.
+       // Bring up warning message if it does.
+       
+       if (CheckBlacklist(txtAddress->GetValue())){
+               
+               int MessageBoxResult = wxMessageBox(_("The server with the address given does not support the CardDAV protocol properly and shouldn't be used.\n\nData loss is very likely.\n\nDo you still want to continue using this server?"), _("Server warning"), wxYES_NO, this);
+               
+               if (MessageBoxResult == wxNO){
+                       return;
+               }
+                       
+       }
+       
        // Update the settings for the account.
 
        long itemindex = 0;
@@ -267,32 +288,6 @@ void frmEditAccount::UpdateSettings( wxCommandEvent& event )
                        cfgfile->DeleteEntry(wxT("refresh"), FALSE);
                        cfgfile->Write(wxT("refresh"), txtRefresh->GetValue());
 
-                       /*cfgfile->Read("address", &AccountData);
-                       //txtAddress->SetValue(AccountData);
-
-                       cfgfile->Read("port", &AccountData);
-                       //txtPort->SetValue(AccountData);
-
-                       cfgfile->Read("username", &AccountData);
-                       //txtUsername->SetValue(AccountData);
-
-                       cfgfile->Read("password", &AccountData);
-                       //txtPassword->SetValue(AccountData);
-
-                       cfgfile->Read("prefix", &AccountData);
-                       //txtPrefix->SetValue(AccountData);
-
-                       cfgfile->Read("ssl", &AccountData);
-                       if (AccountData == wxT("true")){
-                       
-                               chkSSL->SetValue(TRUE);
-                       
-                       }
-                       
-                       cfgfile->Read("refresh", &AccountData);
-                       //txtRefresh->SetValue(AccountData);*/
-
-                       
                        break;
 
                }
@@ -302,6 +297,8 @@ void frmEditAccount::UpdateSettings( wxCommandEvent& event )
 
        }
 
+       // Set the dialog result to true and close the window.
+       
        DialogResult = true;    
        this->Close();  
 
@@ -309,11 +306,17 @@ void frmEditAccount::UpdateSettings( wxCommandEvent& event )
 
 void frmEditAccount::CloseWindow( wxCommandEvent& event )
 {
+       
+       // Set the dialog result to false and close the window.
+       
        DialogResult = false;
        this->Close();
+       
 }
 
 bool frmEditAccount::GetDialogResult(){
+
+       // Get the result of the dialog.
        
        return DialogResult;
        
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