From 62a29d4ecb787ce93d8c8375898351ab1c261d21 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 20 Sep 2015 13:25:06 +0100 Subject: [PATCH] Improved syncronisation (stop conflict resolution screen appearing everytime after editing a contact) --- source/frmActivityMgr.cpp | 41 +++++++++++++++++++++++++++++++++++++-- source/frmActivityMgr.h | 10 ++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/source/frmActivityMgr.cpp b/source/frmActivityMgr.cpp index 5638c70..f7b2f95 100644 --- a/source/frmActivityMgr.cpp +++ b/source/frmActivityMgr.cpp @@ -30,6 +30,7 @@ DEFINE_EVENT_TYPE(ACTMGR_STARTTIMER); DEFINE_EVENT_TYPE(ACTMGR_STOPTIMER); DEFINE_EVENT_TYPE(ACTMGR_STARTPROCESSTIMER); DEFINE_EVENT_TYPE(ACTMGR_STOPPROCESSTIMER); +DEFINE_EVENT_TYPE(ACTMGR_UPDATESTATUSLABEL); BEGIN_EVENT_TABLE(frmActivityMgr, wxWindow) EVT_COMMAND(wxID_ANY, ACTMGR_RESUMEPROC, frmActivityMgr::ResumeProcessing) @@ -38,6 +39,7 @@ BEGIN_EVENT_TABLE(frmActivityMgr, wxWindow) EVT_COMMAND(wxID_ANY, ACTMGR_STOPTIMER, frmActivityMgr::StopTimer) EVT_COMMAND(wxID_ANY, ACTMGR_STARTPROCESSTIMER, frmActivityMgr::StartProcessTimer) EVT_COMMAND(wxID_ANY, ACTMGR_STOPPROCESSTIMER, frmActivityMgr::StopProcessTimer) + EVT_COMMAND(wxID_ANY, ACTMGR_UPDATESTATUSLABEL, frmActivityMgr::UpdateStatusLabel) END_EVENT_TABLE() frmActivityMgr::frmActivityMgr( wxWindow* parent ) @@ -454,6 +456,12 @@ void frmActivityMgr::CloseWindow( wxCommandEvent& event ) this->Hide(); } +void frmActivityMgr::CloseWindow( wxCloseEvent& event ) +{ + WindowOpen = FALSE; + this->Hide(); +} + void frmActivityMgr::ProcessTasksThread() { @@ -879,6 +887,7 @@ void frmActivityMgr::ProcessTasksThread() //ServerContactList = CardDAVInstance.GetContactList(SyncTokenLoad.ToUTF8()); ServerContactList = CardDAVIter->second.GetContactList(SyncTokenLoad.ToUTF8()); + SSLCertCollection certcol = CardDAVIter->second.GetCertificateData(); // Create a pointer for the std::map. @@ -911,7 +920,7 @@ void frmActivityMgr::ProcessTasksThread() qrn.QResponse = &SSLResult; qrn.PausePtr = PauseMode; - SSLICNProcData.CertCollection = CardDAVIter->second.GetCertificateData(); + SSLICNProcData.CertCollection = certcol; SSLICNProcData.QRNotifData = &qrn; SSLICNProcData.AccountName = AccountNameFriendly; @@ -1326,14 +1335,19 @@ void frmActivityMgr::ProcessTasksThread() ETagDB *ETagDBPtr = ETagTmrPtr->GetPointer(AccountDir); ETag = ETagDBPtr->GetETag(vCardAdd[vi]); ETagOriginal = ETagDBPtr->GetETagOriginal(vCardAdd[vi]); + ContactFilename = vCardAdd[vi]; FullFilename = CreateFilenamePath(AccountDirFinal, vCardAdd[vi]); ContactFilename.Trim(); - if (ETag == ETagOriginal){ + if (ETag == ETagOriginal && ETagDBPtr->ETagExists(vCardAdd[vi])){ // Compare the ETag with the Server ETag. + + CardDAVIter->second.SetServerFilename(vCardAdd[vi]); + CardDAVIter->second.GetServerETagValueThread(); + ETagServer = CardDAVIter->second.ETagValueResult(); if (ETagOriginal != ETagServer){ @@ -1876,4 +1890,27 @@ void frmActivityMgr::StopProcessTimer(wxCommandEvent& event){ } +void frmActivityMgr::UpdateStatusLabel(wxCommandEvent& event){ + + ActivityMgrLabelUpdate *actmgrudata = (ActivityMgrLabelUpdate*)event.GetClientData(); + + if (actmgrudata != NULL){ + + wxPuts(wxT("ItemIndex:") + actmgrudata->ItemIndex); + wxPuts(wxT("ItemLabel:") + actmgrudata->ItemLabel); + wxPuts(wxT("ItemDes: ") + actmgrudata->ItemDes); + + lstActivity->SetItem(actmgrudata->ItemIndex, 2, actmgrudata->ItemLabel); + + /*if (!actmgrudata->ItemDes.IsEmpty()){ + lstActivity->SetItem(actmgrudata->ItemIndex, 0, actmgrudata->ItemDes); + }*/ + + delete actmgrudata; + actmgrudata = NULL; + + } + +} + #endif \ No newline at end of file diff --git a/source/frmActivityMgr.h b/source/frmActivityMgr.h index d434056..857eb32 100644 --- a/source/frmActivityMgr.h +++ b/source/frmActivityMgr.h @@ -10,6 +10,7 @@ Subclass of frmActivityMgrADT, which is generated by wxFormBuilder. #include "carddav/carddav.h" #include #include + #include "common/timers.h" #include "common/etag.h" @@ -21,12 +22,19 @@ DECLARE_EVENT_TYPE(ACTMGR_STARTTIMER, wxID_ANY) DECLARE_EVENT_TYPE(ACTMGR_STOPTIMER, wxID_ANY) DECLARE_EVENT_TYPE(ACTMGR_STARTPROCESSTIMER, wxID_ANY) DECLARE_EVENT_TYPE(ACTMGR_STOPPROCESSTIMER, wxID_ANY) +DECLARE_EVENT_TYPE(ACTMGR_UPDATESTATUSLABEL, wxID_ANY) struct vCardDownloadDataFileClass{ unsigned int DataType = 0; wxString FileData; }; +struct ActivityMgrLabelUpdate{ + long ItemIndex; + wxString ItemLabel; + wxString ItemDes; +}; + /** Implementing frmActivityMgrADT */ class frmActivityMgr : public frmActivityMgrADT { @@ -63,6 +71,7 @@ class frmActivityMgr : public frmActivityMgrADT protected: // Handlers for frmActivityMgrADT events. void CloseWindow( wxCommandEvent& event ); + void CloseWindow( wxCloseEvent& event ); void StopTask( wxCommandEvent& event ); void StopAllTasks( wxCommandEvent& event ); void RetryTask( wxCommandEvent& event ); @@ -75,6 +84,7 @@ class frmActivityMgr : public frmActivityMgrADT void ProcessTasksThread(); void ToggleConnectionStatus( wxCommandEvent& event ); void WriteServerCertificate(wxString AccountName, SSLCertCollection SSLCertInc); + void UpdateStatusLabel( wxCommandEvent& event ); public: /** Constructor */ frmActivityMgr( wxWindow* parent ); -- 2.39.5