X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2Fcommon%2Ftimers.cpp;h=6e49cab03045b9c3b5e91bf148de9c9c893836b5;hp=739c29f71878e8117a78fe45ef1cc407ed7363d6;hb=f69e09d827e06435ea94bb73aa71ab5f9d5c035b;hpb=1f74616ec5652b64bc15845c27ba8e6f3eced23c diff --git a/source/common/timers.cpp b/source/common/timers.cpp index 739c29f..6e49cab 100644 --- a/source/common/timers.cpp +++ b/source/common/timers.cpp @@ -16,22 +16,12 @@ // You should have received a copy of the GNU General Public License along // with Xestia Address Book. If not, see -#include "../actmgr/frmActivityMgr.h" -#include "../frmContact.h" -#include "../frmMain.h" -#include -#include -#include -#include -#include -#include "../bitmaps.h" -#include "../enums.h" -#include "../common/preferences.h" -#include "../common/etag.h" -#include "../common/dirs.h" +#include "timers.h" void wxActTimer::Notify(){ + // Notify function for wxActTimer. + frmMain *frmMainPtrProc = static_cast(frmMainPtr); wxCommandEvent shuffleevent(ACTMGR_SHUFFLE); @@ -153,6 +143,8 @@ void wxActTimer::Notify(){ void wxActTimer::SetBitmap(wxStaticBitmap *bitmap) { + // Set the bitmap for wxActTimer. + bmpActivity = bitmap; } @@ -160,6 +152,8 @@ void wxActTimer::SetBitmap(wxStaticBitmap *bitmap) void wxActTimer::SetSleepBitmap(wxBitmap *SleepBitmap) { + // Set the sleep bitmap for wxActTimer. + SleepBitmapPtr = SleepBitmap; } @@ -194,6 +188,8 @@ void wxActTimer::StartAnimation() void wxActTimer::ResetBitmap() { + // Reset the bitmap for wxActTimer. + intActivityProgress = 0; } @@ -201,6 +197,8 @@ void wxActTimer::ResetBitmap() void wxActTimer::SetupPointer(void *frmMainPtrIn) { + // Setup the pointer for wxActTimer. + frmMainPtr = frmMainPtrIn; } @@ -208,6 +206,8 @@ void wxActTimer::SetupPointer(void *frmMainPtrIn) void wxActProcessTimer::Notify() { + // Notify function for wxActProcessTimer. + // Pause the timer whilst processing to avoid problems. this->Stop(); @@ -221,12 +221,16 @@ void wxActProcessTimer::Notify() void wxActProcessTimer::SetupPointers(void *ActMgr){ + // Setup pointers for the wxActProcessTimer. + ActMgrPtr = ActMgr; } void wxActListProcTimer::Notify(){ + // Notify function for wxActListProcTimer. + // Setup Label and get task data (update SetupPointers subroutine). this->Stop(); @@ -281,7 +285,7 @@ void wxActListProcTimer::Notify(){ ueventdata->ItemLabel = _("Stopped"); wxPostEvent(static_cast(ActMgrPtr), uevent); - iter->second = 5; + iter->second = 6; } else if (iter->second == 4){ @@ -293,19 +297,24 @@ void wxActListProcTimer::Notify(){ } + // Delete the connection object if finished. + + if (iter->second > 4){ + + std::map::iterator ConnObjectIter = ActListConnObjectsPtr->find(iter->first); + + delete ConnObjectIter->second; + ConnObjectIter->second = nullptr; + + } + // Insert a finish date. wxDateTime adt; adt = adt.Now(); ActListFinDTPtr->insert(std::make_pair(iter->first, adt)); - - // Delete the connection object. - - std::map::iterator ConnObject = ActListConnPtr->find(iter->first); - delete ConnObject->second; - ConnObject->second = NULL; - + } if (ClearupProcessed == TRUE){ @@ -335,7 +344,9 @@ void wxActListProcTimer::SetupPointers(std::map *ActList, std::map *ActListDetail, bool *TasksActive, wxListCtrl *lstActivity, wxStaticText *lblDetails, wxGauge *GauProgress, void *ActMgr, wxActTimer *ActTimer, wxActProcessTimer *ActProcessTimer, - std::map *ActListFinDT, std::map *ActListConn){ + std::map *ActListFinDT, std::map *ActListConnObjects){ + + // Setup the pointers for wxActListProcTimer. ActListPtr = ActList; ActListUIPtr = ActListUI; @@ -348,18 +359,22 @@ void wxActListProcTimer::SetupPointers(std::map *ActList, std::map::iterator ETagIter; @@ -375,7 +390,6 @@ void wxETagProcessTimer::Notify(){ } - } void wxETagProcessTimer::ReloadAccounts(){ @@ -407,13 +421,13 @@ void wxETagProcessTimer::ReloadAccounts(){ AccountDir = PrefData.accounts.GetAccountDirectory(i); AccountType = PrefData.accounts.GetAccountType(i); - + if (AccountDir.IsEmpty()){ continue; } - if (AccountType == wxT("Local") || AccountType == wxT("local")){ - continue; + if (AccountType != wxT("CardDAV") && AccountType != wxT("carddav")){ + continue; } AccountDir.Trim(); @@ -435,6 +449,8 @@ void wxETagProcessTimer::ReloadAccounts(){ ETagDB* wxETagProcessTimer::GetPointer(wxString AccountName){ + // Get the pointer of the ETag Database. + ETagDB *ETagDBPtr = NULL; std::map::iterator ETagIter; @@ -453,6 +469,8 @@ ETagDB* wxETagProcessTimer::GetPointer(wxString AccountName){ void wxContactFileMonitorTimer::Notify(){ + // Notify function for wxContactFileMonitorTimer. + if (Filename.IsEmpty()){ return; @@ -478,6 +496,8 @@ void wxContactFileMonitorTimer::Notify(){ void wxContactFileMonitorTimer::SetFilename(wxString FilenameInc){ + // Set the filename for the wxContactFileMonitorTimer object. + Filename = FilenameInc; wxFileName FileCheck(Filename); @@ -487,12 +507,16 @@ void wxContactFileMonitorTimer::SetFilename(wxString FilenameInc){ void wxContactFileMonitorTimer::SetupPointers(frmContactEditor *frmCEPtrInc){ + // Setup the pointers for the wxContactFileMonitorTimer object. + frmCEPtr = frmCEPtrInc; } void wxContactFileMonitorTimer::UpdateTimestamp(){ + // Update the timestamp for the wxContactFileMonitorTimer object. + wxFileName FileCheck(Filename); FileDateTime = FileCheck.GetModificationTime(); @@ -500,16 +524,22 @@ void wxContactFileMonitorTimer::UpdateTimestamp(){ void wxContactWindowMonitor::Notify(){ + // Notify function for the wxContactWindowMonitor object. + } void wxContactWindowMonitor::SetupPointers(std::map *ContactWindowListPtrInc){ + // Setup pointers for the wxContactWindowMonitor. + ContactWindowListPtr = ContactWindowListPtrInc; } void wxAccountSyncTimer::Notify(){ + // Notify function for the wxAccountSyncTimer. + frmActivityMgr *ActMgrPtrProc = static_cast(frmActMgrPtr); // Disable the timer. (Don't go updating unless needed). @@ -539,6 +569,8 @@ void wxAccountSyncTimer::Notify(){ void wxAccountSyncTimer::SetupData(wxString AccNameInc, wxString AccNameFullInc){ + // Setup the data for the wxAccountSyncTimer object. + // Set the account name. AccName = AccNameInc; @@ -549,7 +581,7 @@ void wxAccountSyncTimer::SetupData(wxString AccNameInc, void wxAccountSyncTimer::SetupPointers(void *frmMainPtrInc, void *frmActMgrPtrInc, ETagDB *ETagDBPtrInc){ - // Set the pointers. + // Setup the pointers for the wxAccountSyncTimer object. frmMainPtr = frmMainPtrInc; frmActMgrPtr = frmActMgrPtrInc; @@ -559,6 +591,8 @@ void wxAccountSyncTimer::SetupPointers(void *frmMainPtrInc, void SleepFor(unsigned long longSleepNanoSecs){ + // Sleep for specified nano seconds. + #ifdef __WIN32__ ::Sleep((longSleepNanoSecs / 1000000)); #elif __HAIKU__