Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
CardDAV2: Fixed issue with displaying SSL certificate
[xestiaab/.git] / source / frmMain.cpp
index 99784a6..3d54720 100644 (file)
@@ -54,7 +54,6 @@
 #include "common/events.h"
 #include "common/dirs.h"
 #include "vcard/vcard.h"
-#include "carddav/carddav.h"
 #include "contacteditor/frmContactEditor.h"
 #include "import/import.h"
 #include "export/export.h"
@@ -85,6 +84,7 @@ DEFINE_EVENT_TYPE(WINDOW_EDIT);
 DEFINE_EVENT_TYPE(WINDOW_CLOSE);
 DEFINE_EVENT_TYPE(CONNSTAT_UPDATE);
 DEFINE_EVENT_TYPE(INVALIDSSLCERT);
+DEFINE_EVENT_TYPE(INVALIDSSLCERTSTRING);
 DEFINE_EVENT_TYPE(GETSELECTEDLIST);
 DEFINE_EVENT_TYPE(SYNCACCOUNT);
 DEFINE_EVENT_TYPE(IMPORT_RESULTSSHOW);
@@ -117,6 +117,7 @@ EVT_COMMAND(wxID_ANY, WINDOW_EDIT, frmMain::WindowEdit)
 EVT_COMMAND(wxID_ANY, WINDOW_CLOSE, frmMain::WindowDelete)
 EVT_COMMAND(wxID_ANY, CONNSTAT_UPDATE, frmMain::UpdateConnectionStatus)
 EVT_COMMAND(wxID_ANY, INVALIDSSLCERT, frmMain::InvalidSSLCertificate)
+EVT_COMMAND(wxID_ANY, INVALIDSSLCERTSTRING, frmMain::InvalidSSLCertificateString)
 EVT_COMMAND(wxID_ANY, GETSELECTEDLIST, frmMain::GetSelectedList)
 EVT_COMMAND(wxID_ANY, SYNCACCOUNT, frmMain::SyncAccount)
 EVT_COMMAND(wxID_ANY, IMPORT_RESULTSSHOW, frmMain::ShowImportResults)
@@ -189,7 +190,40 @@ frmMainADT( parent )
     
        wxImage icons_nossl_png(nosslstream, wxBITMAP_TYPE_PNG);
        imgNoSSL = new wxBitmap(icons_nossl_png, -1);
-    
+       // Toolbar icons.
+
+       wxMemoryInputStream addaddressbook(toolbar_addaddressbook_png, sizeof(toolbar_addaddressbook_png));
+       wxMemoryInputStream preferences(toolbar_preferences_png, sizeof(toolbar_preferences_png));
+       wxMemoryInputStream searchcontacts(toolbar_searchcontacts_png, sizeof(toolbar_searchcontacts_png));
+       wxMemoryInputStream addcontact(toolbar_addcontact_png, sizeof(toolbar_addcontact_png));
+       wxMemoryInputStream editcontact(toolbar_editcontact_png, sizeof(toolbar_editcontact_png));
+       wxMemoryInputStream deletecontact(toolbar_deletecontact_png, sizeof(toolbar_deletecontact_png));
+
+       wxImage toolbar_addaddressbook_png(addaddressbook, wxBITMAP_TYPE_PNG);
+       imgAddAddressBook = new wxBitmap (toolbar_addaddressbook_png, -1);
+       tblMain->SetToolNormalBitmap(tbtNewAccount->GetId(), *imgAddAddressBook);
+
+       wxImage toolbar_preferences_png(preferences, wxBITMAP_TYPE_PNG);
+       imgPreferences = new wxBitmap (toolbar_preferences_png, -1);
+       tblMain->SetToolNormalBitmap(tbtPreferences->GetId(), *imgPreferences);
+
+       wxImage toolbar_searchcontacts_png(searchcontacts, wxBITMAP_TYPE_PNG);
+       imgSearchContacts = new wxBitmap (toolbar_searchcontacts_png, -1);
+       tblMain->SetToolNormalBitmap(tbtSearch->GetId(), *imgSearchContacts);
+
+       wxImage toolbar_addcontact_png(addcontact, wxBITMAP_TYPE_PNG);
+       imgAddContact = new wxBitmap (toolbar_addcontact_png, -1);
+       tblMain->SetToolNormalBitmap(tbtAddContact->GetId(), *imgAddContact);
+       
+       wxImage toolbar_editcontact_png(editcontact, wxBITMAP_TYPE_PNG);
+       imgEditContact = new wxBitmap (toolbar_editcontact_png, -1);
+       tblMain->SetToolNormalBitmap(tbtEditContact->GetId(), *imgEditContact);
+       
+       wxImage toolbar_deletecontact_png(deletecontact, wxBITMAP_TYPE_PNG);
+       imgDeleteContact = new wxBitmap (toolbar_deletecontact_png, -1);
+       tblMain->SetToolNormalBitmap(tbtDeleteContact->GetId(), *imgDeleteContact);
+
        // Activity Icon.
     
        wxMemoryInputStream act1(icons_act1_png, sizeof(icons_act1_png));
@@ -252,7 +286,7 @@ frmMainADT( parent )
     
 #elif defined(__WIN32__)
     
-       int stbBottomData [4] = { -1, 16, 16, 16 };
+       int stbBottomData [4] = { -1, 8, 8, 8 };
     
 #else
     
@@ -271,10 +305,8 @@ frmMainADT( parent )
        stbBottom->GetFieldRect(3, rectActivity);
     
        SSLToolTip = new wxToolTip(wxT(""));
-
-#if defined(__WIN32__)
-
-       imgConnStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint(rectOnline.GetX(),rectOnline.GetY()), wxDefaultSize, 0 );
+    
+       imgConnStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectOnline.GetX()),(rectOnline.GetY())), wxDefaultSize, 0 );
        imgConnStatus->SetBitmap(*imgOnline);
        imgConnStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ToggleConnectionStatus ), NULL, this );
     
@@ -287,23 +319,6 @@ frmMainADT( parent )
        imgActivityStatus->SetBitmap(*imgActIconSleep);
        imgActivityStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ShowActivityWindow ), NULL, this );
     
-#else
-
-       imgConnStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectOnline.GetX()), (rectOnline.GetY())), wxDefaultSize, 0);
-       imgConnStatus->SetBitmap(*imgOnline);
-       imgConnStatus->Connect(wxEVT_LEFT_DCLICK, wxCommandEventHandler(frmMain::ToggleConnectionStatus), NULL, this);
-
-       imgSSLStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectSSL.GetX()), (rectSSL.GetY())), wxDefaultSize, 0);
-       imgSSLStatus->SetBitmap(*imgNoSSL);
-       imgSSLStatus->SetToolTip(SSLToolTip);
-       imgSSLStatus->Connect(wxEVT_LEFT_DCLICK, wxCommandEventHandler(frmMain::ShowSSLCertificates), NULL, this);
-
-       imgActivityStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectActivity.GetX()), (rectActivity.GetY())), wxDefaultSize, 0);
-       imgActivityStatus->SetBitmap(*imgActIconSleep);
-       imgActivityStatus->Connect(wxEVT_LEFT_DCLICK, wxCommandEventHandler(frmMain::ShowActivityWindow), NULL, this);
-
-#endif
-
        // Setup the window menu.
     
        // By default should be:
@@ -2122,13 +2137,14 @@ void frmMain::DeleteContact(wxCommandEvent& event){
                        if (nextChild == selectedChild){
                        
                                wxSDataURL = prefaccounts.GetAccountDirPrefix(i) + wxT("/") + wxSplitFilename;
+                               break;
 
                        }
             
                }
         
                // Add task to the activity monitor to delete the contact.
-        
+               
                frameActMgr->AddTask(2, wxSContactName, ActiveAccount, wxSDataURL, wxSplitFilename, ContactsFileIndex[intContactSeekNum], wxT(""));
         
        }
@@ -2642,7 +2658,7 @@ void frmMain::ShowSSLCertificates( wxCommandEvent &event ){
 
                        // Setup and display the form.
 
-                       if (SSLCertificateIter == AccountCertificateData.end() || SSLCertificateIter->second->pCertInfo == NULL){
+                       if (SSLCertificateIter->second->pCertInfo == NULL){
 
                                wxMessageBox("No certificate information is available due to invalid connection details, connection being in progress or invalid certificate data received.");
 
@@ -2669,7 +2685,7 @@ void frmMain::ShowSSLCertificates( wxCommandEvent &event ){
 
 #else
     
-       std::map<int, SSLCertCollection>::iterator SSLColIter;
+       std::map<int, SSLCertCollectionString>::iterator SSLColIter;
         
        for (int i = 0; i < prefaccounts.GetCount(); i++){
         
@@ -2696,11 +2712,11 @@ void frmMain::ShowSSLCertificates( wxCommandEvent &event ){
             
                        SSLColIter = AccountSSLData.find(i);
             
-                       SSLCertCollection SSLCertInfo = SSLColIter->second;
-            
+                       SSLCertCollectionString SSLCertInfo = SSLColIter->second;
+                       
                        frmSSLCertificate *frameSSLCert = new frmSSLCertificate ( this );
                        frameSSLCert->StartCertFrom(0);
-                       frameSSLCert->SetupCerts(SSLCertInfo);
+                       frameSSLCert->SetupCertsString(SSLCertInfo);
                        frameSSLCert->ShowModal();
             
                        delete frameSSLCert;
@@ -2769,6 +2785,31 @@ void frmMain::InvalidSSLCertificate( wxCommandEvent &event ){
         
 }
 
+void frmMain::InvalidSSLCertificateString( wxCommandEvent &event ){
+    
+       // Display the form for showing an invalid SSL certificate.
+    
+       frmInvalidSSLCertificate *frameISC = new frmInvalidSSLCertificate ( this );
+       SSLInvalidCertNotifObjString *SSLICNObj = (SSLInvalidCertNotifObjString*)event.GetClientData();
+       SSLCertCollectionString SSLCCData = SSLICNObj->CertCollection;
+       wxString AccountName = SSLICNObj->AccountName;
+       frameISC->LoadData(SSLCCData, AccountName);
+       frameISC->ShowModal();
+    
+       int FinalConflictResult = frameISC->GetResult();
+    
+       wxCommandEvent event2(ACTMGR_RESUMEPROC);
+       event2.SetClientData(SSLICNObj->QRNotifData);
+       event2.SetInt(FinalConflictResult);
+    
+       delete frameISC;
+       frameISC = NULL;
+    
+       frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);  
+       wxPostEvent(frameActMgr, event2);
+        
+}
+
 void frmMain::PauseAllTimers(){
     
        // Pause all the account timers.
@@ -2821,7 +2862,7 @@ void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, PCCERT_CONTEX
 
 #else
 
-void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollection SSLCertInc){
+void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollectionString SSLCertInc){
     
        // Delete existing data.
     
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