Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added copyright and license header to the C++ files and headers in the top source...
[xestiaab/.git] / source / frmActivityMgr.cpp
index 5638c70..f26e00f 100644 (file)
@@ -1,3 +1,21 @@
+// frmActivityMgr.cpp - Activity Manager form.
+//
+// (c) 2012-2015 Xestia Software Development.
+//
+// This file is part of Xestia Address Book.
+//
+// Xestia Address Book is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Address Book is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
+
 #include "frmActivityMgr.h"
 #include <wx/mstream.h>
 #include <wx/file.h>
@@ -30,6 +48,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 +57,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 )
@@ -286,7 +306,7 @@ int frmActivityMgr::AddTask(int TaskType, wxString TaskDetail, wxString TaskAcco
                lstActivity->SetItem(itemindex, 1, AccountName);
                lstActivity->SetItem(itemindex, 2, _("Queued"));
                
-               // TODO: Pass the ETagDB for the account to the connection.
+               ETagDB *ETagDBPtr = ETagTmrPtr->GetPointer(AccountDir);
                
                ActivityList.insert(std::make_pair(ActivityTaskID, 0));
                ActivityListType.insert(std::make_pair(ActivityTaskID, 2));
@@ -454,6 +474,12 @@ void frmActivityMgr::CloseWindow( wxCommandEvent& event )
        this->Hide();
 }
 
+void frmActivityMgr::CloseWindow( wxCloseEvent& event )
+{
+       WindowOpen = FALSE;
+       this->Hide();
+}
+
 void frmActivityMgr::ProcessTasksThread()
 {
        
@@ -636,7 +662,6 @@ void frmActivityMgr::ProcessTasksThread()
                                                
                                                        ConvertedV4Data.WriteFile(FullFilename);
                                                
-                                               
                                                        iter->second = 4;
                                        
                                                }
@@ -879,6 +904,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<wxString,FileSyncData>.
                                
@@ -911,7 +937,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 +1352,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){
                                
@@ -1690,6 +1721,14 @@ void frmActivityMgr::ProcessTasksThread()
                                }
                                
                                // Mark as completed.
+                       
+                               wxString AccountNameFinal;
+                               AccountNameFinal = PrefData.accounts.GetAccountDirectory(AccountID);
+                               AccountNameFinal.Append(wxT(".carddav"));
+                               
+                               wxCommandEvent reloadevent(RELOADCONTACTLIST);
+                               reloadevent.SetString(AccountNameFinal);
+                               wxPostEvent(this->GetParent(), reloadevent);
                                
                                iter->second = 4;
                                continue;
@@ -1699,6 +1738,8 @@ void frmActivityMgr::ProcessTasksThread()
                                // Update the data to the server.
                                        
                                CardDAVIter->second.ProcessData();
+                               iter->second = 4;
+                               continue;
                        
                        }
 
@@ -1876,4 +1917,23 @@ void frmActivityMgr::StopProcessTimer(wxCommandEvent& event){
 
 }
 
+void frmActivityMgr::UpdateStatusLabel(wxCommandEvent& event){
+
+       ActivityMgrLabelUpdate *actmgrudata = (ActivityMgrLabelUpdate*)event.GetClientData();
+       
+       if (actmgrudata != NULL){
+       
+               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
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