Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added code so that OSX is now supported.
[xestiaab/.git] / source / common / timers.cpp
index 02bc920..d4ec0eb 100644 (file)
 #include "../common/dirs.h"
 
 void wxActTimer::Notify(){
-
-       frmMain *frmMainPtrProc = static_cast<frmMain*>(frmMainPtr);
-
-       wxCommandEvent shuffleevent(ACTMGR_SHUFFLE);
-
-       if (intActivityProgress == 0){
-
-               wxMemoryInputStream istream(misc_activity1_png, sizeof(misc_activity1_png));
-               wxImage misc_activity1_pngi(istream, wxBITMAP_TYPE_PNG);                
-               wxBitmap activityiconbmp(misc_activity1_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-                               
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 1){
-
-               wxMemoryInputStream istream(misc_activity2_png, sizeof(misc_activity2_png));
-               wxImage misc_activity2_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity2_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 2){
-
-               wxMemoryInputStream istream(misc_activity3_png, sizeof(misc_activity3_png));
-               wxImage misc_activity3_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity3_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 3){
-
-               wxMemoryInputStream istream(misc_activity4_png, sizeof(misc_activity4_png));
-               wxImage misc_activity4_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity4_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 4){
-
-               wxMemoryInputStream istream(misc_activity5_png, sizeof(misc_activity5_png));
-               wxImage misc_activity5_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity5_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 5){
-
-               wxMemoryInputStream istream(misc_activity6_png, sizeof(misc_activity6_png));
-               wxImage misc_activity6_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity6_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 6){
-
-               wxMemoryInputStream istream(misc_activity7_png, sizeof(misc_activity7_png));
-               wxImage misc_activity7_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity7_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 7){
-
-               wxMemoryInputStream istream(misc_activity8_png, sizeof(misc_activity8_png));
-               wxImage misc_activity8_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity8_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 8){
-       
-               wxMemoryInputStream istream(misc_activity9_png, sizeof(misc_activity9_png));
-               wxImage misc_activity9_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity9_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-       
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 9){
-
-               wxMemoryInputStream istream(misc_activity10_png, sizeof(misc_activity10_png));
-               wxImage misc_activity10_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity10_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-       
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 10){
-       
-               wxMemoryInputStream istream(misc_activity11_png, sizeof(misc_activity11_png));
-               wxImage misc_activity11_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity11_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-       
-               intActivityProgress++;
-       
-       } else if (intActivityProgress == 11){
-       
-               wxMemoryInputStream istream(misc_activity12_png, sizeof(misc_activity12_png));
-               wxImage misc_activity12_pngi(istream, wxBITMAP_TYPE_PNG);
-               wxBitmap activityiconbmp(misc_activity12_pngi, -1);
-               bmpActivity->SetBitmap(activityiconbmp);
-       
-               intActivityProgress = 0;
-       
-       }
-       
-       wxPostEvent(frmMainPtrProc, shuffleevent);
-
+    
+    frmMain *frmMainPtrProc = static_cast<frmMain*>(frmMainPtr);
+    
+    wxCommandEvent shuffleevent(ACTMGR_SHUFFLE);
+    
+    if (intActivityProgress == 0){
+        
+        wxMemoryInputStream istream(misc_activity1_png, sizeof(misc_activity1_png));
+        wxImage misc_activity1_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity1_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 1){
+        
+        wxMemoryInputStream istream(misc_activity2_png, sizeof(misc_activity2_png));
+        wxImage misc_activity2_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity2_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 2){
+        
+        wxMemoryInputStream istream(misc_activity3_png, sizeof(misc_activity3_png));
+        wxImage misc_activity3_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity3_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 3){
+        
+        wxMemoryInputStream istream(misc_activity4_png, sizeof(misc_activity4_png));
+        wxImage misc_activity4_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity4_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 4){
+        
+        wxMemoryInputStream istream(misc_activity5_png, sizeof(misc_activity5_png));
+        wxImage misc_activity5_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity5_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 5){
+        
+        wxMemoryInputStream istream(misc_activity6_png, sizeof(misc_activity6_png));
+        wxImage misc_activity6_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity6_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 6){
+        
+        wxMemoryInputStream istream(misc_activity7_png, sizeof(misc_activity7_png));
+        wxImage misc_activity7_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity7_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 7){
+        
+        wxMemoryInputStream istream(misc_activity8_png, sizeof(misc_activity8_png));
+        wxImage misc_activity8_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity8_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 8){
+        
+        wxMemoryInputStream istream(misc_activity9_png, sizeof(misc_activity9_png));
+        wxImage misc_activity9_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity9_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 9){
+        
+        wxMemoryInputStream istream(misc_activity10_png, sizeof(misc_activity10_png));
+        wxImage misc_activity10_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity10_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 10){
+        
+        wxMemoryInputStream istream(misc_activity11_png, sizeof(misc_activity11_png));
+        wxImage misc_activity11_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity11_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress++;
+        
+    } else if (intActivityProgress == 11){
+        
+        wxMemoryInputStream istream(misc_activity12_png, sizeof(misc_activity12_png));
+        wxImage misc_activity12_pngi(istream, wxBITMAP_TYPE_PNG);
+        wxBitmap activityiconbmp(misc_activity12_pngi, -1);
+        bmpActivity->SetBitmap(activityiconbmp);
+        
+        intActivityProgress = 0;
+        
+    }
+    
+    wxPostEvent(frmMainPtrProc, shuffleevent);
+    
 }
 
 void wxActTimer::SetBitmap(wxStaticBitmap *bitmap)
 {
-
-       bmpActivity = bitmap;
-
+    
+    bmpActivity = bitmap;
+    
 }
 
 void wxActTimer::SetSleepBitmap(wxBitmap *SleepBitmap)
 {
-
-       SleepBitmapPtr = SleepBitmap;
-
+    
+    SleepBitmapPtr = SleepBitmap;
+    
 }
 
 void wxActTimer::StopAnimation()
 {
-
-       // Stop the icon animation.
-
-       frmMain *frmMainPtrProc = static_cast<frmMain*>(frmMainPtr);
-       
-       wxCommandEvent actstop(ACTMGR_STOP);
-       wxPostEvent(frmMainPtrProc, actstop);
-       //frmMainPtrProc->ActivityIconStop();
-
-       this->Stop();
-       bmpActivity->SetBitmap(*SleepBitmapPtr);
+    
+    // Stop the icon animation.
+    
+    frmMain *frmMainPtrProc = static_cast<frmMain*>(frmMainPtr);
+    
+    wxCommandEvent actstop(ACTMGR_STOP);
+    wxPostEvent(frmMainPtrProc, actstop);
+    //frmMainPtrProc->ActivityIconStop();
+    
+    this->Stop();
+    bmpActivity->SetBitmap(*SleepBitmapPtr);
 }
 
 void wxActTimer::StartAnimation()
 {
-
-       frmMain *frmMainPtrProc = static_cast<frmMain*>(frmMainPtr);
-       wxCommandEvent actstart(ACTMGR_START);
-       wxPostEvent(frmMainPtrProc, actstart);
-       //frmMainPtrProc->ActivityIconStart();
-       
-       this->ResetBitmap();
-       this->Start(50, FALSE);
+    
+    frmMain *frmMainPtrProc = static_cast<frmMain*>(frmMainPtr);
+    wxCommandEvent actstart(ACTMGR_START);
+    wxPostEvent(frmMainPtrProc, actstart);
+    //frmMainPtrProc->ActivityIconStart();
+    
+    this->ResetBitmap();
+    this->Start(50, FALSE);
 }
 
 void wxActTimer::ResetBitmap()
 {
-
-       intActivityProgress = 0;
-
+    
+    intActivityProgress = 0;
+    
 }
 
 void wxActTimer::SetupPointer(void *frmMainPtrIn)
 {
-
-       frmMainPtr = frmMainPtrIn;
-
+    
+    frmMainPtr = frmMainPtrIn;
+    
 }
 
 void wxActProcessTimer::Notify()
 {
-
-       // Pause the timer whilst processing to avoid problems.
-
-       this->Stop();
-
-       // Process Tasks.
-       
-       frmActivityMgr *ActMgrPtrProc = static_cast<frmActivityMgr*>(ActMgrPtr);
-       ActMgrPtrProc->ProcessTasks();
-
+    
+    // Pause the timer whilst processing to avoid problems.
+    
+    this->Stop();
+    
+    // Process Tasks.
+    
+    frmActivityMgr *ActMgrPtrProc = static_cast<frmActivityMgr*>(ActMgrPtr);
+    ActMgrPtrProc->ProcessTasks();
+    
 }
 
 void wxActProcessTimer::SetupPointers(void *ActMgr){
-
-       ActMgrPtr = ActMgr;
-
+    
+    ActMgrPtr = ActMgr;
+    
 }
 
 void wxActListProcTimer::Notify(){
-
-       // Setup Label and get task data (update SetupPointers subroutine).
-
-       this->Stop();
-       
-       for (std::map<int,int>::iterator iter = ActListPtr->begin(); 
-        iter != ActListPtr->end(); ++iter){
-        
-               // Check for any queued tasks and start one.
-               
-               if (iter->second > 4){
-                       continue;
-               }
-               
-               
-               // 0 = Queued.
-               // 1 = Processing.
-               // 2 = Failed.
-               // 3 = Stopped.
-               // 4 = Completed.
-               // 5 = Failed (UI Updated).
-               // 6 = Stopped (UI Updated).
-               // 7 = (Reserved) (UI Updated).
-               // 8 = Completed. (UI Updated). 
-               
-               std::map<int,long>::iterator LongIter = ActListUIPtr->find(iter->first);
-               std::map<int,wxString>::iterator DetailIter = ActListDetailPtr->find(iter->first);
-               
-               if (iter->second == 1){
-                               
-                       lstActivityPtr->SetItem(LongIter->second, 2, _("Processing..."));
-                       if (ActListDetailPtr->find(iter->first) != ActListDetailPtr->end()){
-                               lblDetailsPtr->SetLabel(_("Adding Contact '") + DetailIter->second + _("'..."));
-                       }
-                       //CardDAVIter->second.
-                       
-               } else if (iter->second == 2){
-               
-                       lstActivityPtr->SetItem(LongIter->second, 2, _("Failed"));
-                       iter->second = 5;
-               
-               } else if (iter->second == 3){
-
-                       lstActivityPtr->SetItem(LongIter->second, 2, _("Stopped"));
-                       iter->second = 6;
-               
-               } else if (iter->second == 4){
-
-                       lstActivityPtr->SetItem(LongIter->second, 2, _("Completed"));
-                       iter->second = 8;
-               
-               }
-               
-               // Insert a finish date.
-               
-               wxDateTime adt;
-               adt = adt.Now();
-               
-               ActListFinDTPtr->insert(std::make_pair(iter->first, adt));
-
-       }
-       
-       if (ClearupProcessed == TRUE){
-       
-               // Clear up processed items.
-               
-               // Delete the processed items.
-               
-               ClearupProcessed = FALSE;
-       
-       }
-       
-       if (*TasksActivePtr == FALSE){
-       
-               ActTimerPtr->StopAnimation();
-               lblDetailsPtr->SetLabel(_("No activity."));
-       
-       } else {
-       
-               this->Start();
-       
-       }
-
+    
+    // Setup Label and get task data (update SetupPointers subroutine).
+    
+    this->Stop();
+    
+    for (std::map<int,int>::iterator iter = ActListPtr->begin();
+         iter != ActListPtr->end(); ++iter){
+        
+        // Check for any queued tasks and start one.
+        
+        if (iter->second > 4){
+            continue;
+        }
+        
+        
+        // 0 = Queued.
+        // 1 = Processing.
+        // 2 = Failed.
+        // 3 = Stopped.
+        // 4 = Completed.
+        // 5 = Failed (UI Updated).
+        // 6 = Stopped (UI Updated).
+        // 7 = (Reserved) (UI Updated).
+        // 8 = Completed. (UI Updated).
+        
+        std::map<int,long>::iterator LongIter = ActListUIPtr->find(iter->first);
+        std::map<int,wxString>::iterator DetailIter = ActListDetailPtr->find(iter->first);
+        
+        if (iter->second == 1){
+            
+            lstActivityPtr->SetItem(LongIter->second, 2, _("Processing..."));
+            if (ActListDetailPtr->find(iter->first) != ActListDetailPtr->end()){
+                lblDetailsPtr->SetLabel(_("Adding Contact '") + DetailIter->second + _("'..."));
+            }
+            //CardDAVIter->second.
+            
+        } else if (iter->second == 2){
+            
+            lstActivityPtr->SetItem(LongIter->second, 2, _("Failed"));
+            iter->second = 5;
+            
+        } else if (iter->second == 3){
+            
+            lstActivityPtr->SetItem(LongIter->second, 2, _("Stopped"));
+            iter->second = 6;
+            
+        } else if (iter->second == 4){
+            
+            lstActivityPtr->SetItem(LongIter->second, 2, _("Completed"));
+            iter->second = 8;
+            
+        }
+        
+        // Insert a finish date.
+        
+        wxDateTime adt;
+        adt = adt.Now();
+        
+        ActListFinDTPtr->insert(std::make_pair(iter->first, adt));
+        
+    }
+    
+    if (ClearupProcessed == TRUE){
+        
+        // Clear up processed items.
+        
+        // Delete the processed items.
+        
+        ClearupProcessed = FALSE;
+        
+    }
+    
+    if (*TasksActivePtr == FALSE){
+        
+        ActTimerPtr->StopAnimation();
+        lblDetailsPtr->SetLabel(_("No activity."));
+        
+    } else {
+        
+        this->Start();
+        
+    }
+    
 }
 
-void wxActListProcTimer::SetupPointers(std::map<int,int> *ActList, std::map<int,long> *ActListUI, 
-                       std::map<int,wxString> *ActListDetail, bool *TasksActive,
-                       wxListCtrl *lstActivity, wxStaticText *lblDetails, wxGauge *GauProgress,
-                       void *ActMgr, wxActTimer *ActTimer, wxActProcessTimer *ActProcessTimer,
-                       std::map<int,wxDateTime> *ActListFinDT){
-
-       ActListPtr = ActList;
-       ActListUIPtr = ActListUI;
-       ActListDetailPtr = ActListDetail;
-       TasksActivePtr = TasksActive;
-       lstActivityPtr = lstActivity;
-       lblDetailsPtr = lblDetails;
-       GauProgressPtr = GauProgress;
-       ActMgrPtr = ActMgr;
-       ActTimerPtr = ActTimer;
-       ActProcessTimerPtr = ActProcessTimer;
-       ActListFinDTPtr = ActListFinDT;
-
+void wxActListProcTimer::SetupPointers(std::map<int,int> *ActList, std::map<int,long> *ActListUI,
+                                       std::map<int,wxString> *ActListDetail, bool *TasksActive,
+                                       wxListCtrl *lstActivity, wxStaticText *lblDetails, wxGauge *GauProgress,
+                                       void *ActMgr, wxActTimer *ActTimer, wxActProcessTimer *ActProcessTimer,
+                                       std::map<int,wxDateTime> *ActListFinDT){
+    
+    ActListPtr = ActList;
+    ActListUIPtr = ActListUI;
+    ActListDetailPtr = ActListDetail;
+    TasksActivePtr = TasksActive;
+    lstActivityPtr = lstActivity;
+    lblDetailsPtr = lblDetails;
+    GauProgressPtr = GauProgress;
+    ActMgrPtr = ActMgr;
+    ActTimerPtr = ActTimer;
+    ActProcessTimerPtr = ActProcessTimer;
+    ActListFinDTPtr = ActListFinDT;
+    
 }
 
 void wxActListProcTimer::EnableClearup(){
-
-       ClearupProcessed = TRUE;
-
+    
+    ClearupProcessed = TRUE;
+    
 }
 
 void wxETagProcessTimer::Notify(){
-
-       // Check each ETagDB and see if writing to file is required.
-       
-       //ETagDB* ETagDBPtr;
-       //ETagDB ETagDBCopy;
-       
-       std::map<wxString,ETagDB>::iterator ETagIter;
-       
-       for (ETagIter = ETagDBList.begin(); 
-        ETagIter != ETagDBList.end(); ++ETagIter){
-       
-               if (ETagIter->second.GetWriteStatus() == TRUE){
-               
-                       ETagIter->second.WriteETagDB();
-               
-               }
-        
-       }
-       
-
+    
+    // Check each ETagDB and see if writing to file is required.
+    
+    //ETagDB* ETagDBPtr;
+    //ETagDB ETagDBCopy;
+    
+    std::map<wxString,ETagDB>::iterator ETagIter;
+    
+    for (ETagIter = ETagDBList.begin();
+         ETagIter != ETagDBList.end(); ++ETagIter){
+        
+        if (ETagIter->second.GetWriteStatus() == TRUE){
+            
+            ETagIter->second.WriteETagDB();
+            
+        }
+        
+    }
+    
+    
 }
 
 void wxETagProcessTimer::ReloadAccounts(){
-
-       // Get the account preferences file and setup each database accordingly.
-       
-       ReloadLock.lock();
-       
-       // Stop the timer.
-
-       this->Stop();
-       ETagDBList.clear();
-       
-       wxString PrefFilename = GetUserPrefDir();       
-       
-       XABPreferences PrefData(PrefFilename);
-
-       wxString AccountName;
-       wxString AccountDir;
-       wxString AccountAddress;
-       wxString AccountUsername;
-       wxString AccountPassword;
-       wxString AccountPrefix;
-       wxString AccountType;
-
-       // Look for the account and get the friendly name for the account.
-       
-       for (int i = 0; i < PrefData.accounts.GetCount(); i++){
-       
-               AccountDir = PrefData.accounts.GetAccountDirectory(i);
-               AccountType = PrefData.accounts.GetAccountType(i);
-
-               if (AccountType == wxT("Local") || AccountType == wxT("local")){
-                       continue;
-               }
-
-               AccountDir.Trim();
-               AccountDir.Append(wxT(".carddav"));
-                       
-               ETagDB AccountDB;
-               AccountDB.SetupDB(AccountDir);
-                               
-               ETagDBList.insert(std::make_pair(AccountDir, AccountDB));
-               
-               AccountDir.clear();
-       
-       }
-       
-       //raise(SIGABRT);
-       
-       /*for (int i = 0; i < PrefData.accounts.GetCount(); i++){
-       
-               AccountDir = PrefData.accounts.GetAccountDirectory(i);
-               
-               AccountDir.Trim();
-               AccountDir.Append(wxT(".carddav"));
-       
-               //AccountPrefix = PrefData.accounts.GetAccountDirPrefix(i);
-
-               //ETagDB NewETagDB (AccountDir);
-               
-               ETagDB AccountDB;
-               AccountDB.SetupDB(AccountDir);
-               
-               //ETagDBList.insert(std::make_pair(AccountDir, Moo));
-               
-               //std::pair<wxString,ETagDB> Moo2;
-               
-               //ETagDB2 Meep;
-               
-               //ETagDBListv3.insert(std::make_pair(0,Meep));
-               
-               //ETagDBListv2.insert(std::make_pair(0, Moo));
-               
-               //ETagDBList.insert(Moo2);
-               
-               ETagDBList.insert(std::make_pair(AccountDir, AccountDB));
-               
-               //Moo55.insert(std::make_pair(wxT("Meep"), wxT("Meep")));
-               
-               //ETagDBList[AccountDir] = new ETagDB (AccountDir);
-       
-       }*/
-       
-       //ETagDB Test (AccountDir);
-       
-       //ETagDBList.insert(std::make_pair(AccountDir, Test));
-       
-       ReloadLock.unlock();
-       this->Start(15000);
-
+    
+    // Get the account preferences file and setup each database accordingly.
+    
+    ReloadLock.lock();
+    
+    // Stop the timer.
+    
+    this->Stop();
+    ETagDBList.clear();
+    
+    wxString PrefFilename = GetUserPrefDir();
+    
+    XABPreferences PrefData(PrefFilename);
+    
+    wxString AccountName;
+    wxString AccountDir;
+    wxString AccountAddress;
+    wxString AccountUsername;
+    wxString AccountPassword;
+    wxString AccountPrefix;
+    wxString AccountType;
+    
+    // Look for the account and get the friendly name for the account.
+    
+    for (int i = 0; i < PrefData.accounts.GetCount(); i++){
+        
+        AccountDir = PrefData.accounts.GetAccountDirectory(i);
+        AccountType = PrefData.accounts.GetAccountType(i);
+        
+        if (AccountDir.IsEmpty()){
+            continue;
+        }
+        
+        if (AccountType == wxT("Local") || AccountType == wxT("local")){
+            continue;
+        }
+        
+        AccountDir.Trim();
+        AccountDir.Append(wxT(".carddav"));
+        
+        ETagDB AccountDB;
+        AccountDB.SetupDB(AccountDir);
+        
+        ETagDBList.insert(std::make_pair(AccountDir, AccountDB));
+        
+        AccountDir.clear();
+        
+    }
+    
+    //raise(SIGABRT);
+    
+    /*for (int i = 0; i < PrefData.accounts.GetCount(); i++){
+     
+     AccountDir = PrefData.accounts.GetAccountDirectory(i);
+     
+     AccountDir.Trim();
+     AccountDir.Append(wxT(".carddav"));
+     
+     //AccountPrefix = PrefData.accounts.GetAccountDirPrefix(i);
+     
+     //ETagDB NewETagDB (AccountDir);
+     
+     ETagDB AccountDB;
+     AccountDB.SetupDB(AccountDir);
+     
+     //ETagDBList.insert(std::make_pair(AccountDir, Moo));
+     
+     //std::pair<wxString,ETagDB> Moo2;
+     
+     //ETagDB2 Meep;
+     
+     //ETagDBListv3.insert(std::make_pair(0,Meep));
+     
+     //ETagDBListv2.insert(std::make_pair(0, Moo));
+     
+     //ETagDBList.insert(Moo2);
+     
+     ETagDBList.insert(std::make_pair(AccountDir, AccountDB));
+     
+     //Moo55.insert(std::make_pair(wxT("Meep"), wxT("Meep")));
+     
+     //ETagDBList[AccountDir] = new ETagDB (AccountDir);
+     
+     }*/
+    
+    //ETagDB Test (AccountDir);
+    
+    //ETagDBList.insert(std::make_pair(AccountDir, Test));
+    
+    ReloadLock.unlock();
+    this->Start(15000);
+    
 }
 
 ETagDB* wxETagProcessTimer::GetPointer(wxString AccountName){
-
-       ETagDB *ETagDBPtr = NULL;
-
-       std::map<wxString,ETagDB>::iterator ETagIter;
-
-       ETagIter = ETagDBList.find(AccountName);
-
-       if (ETagIter != ETagDBList.end()){
-       
-               ETagDBPtr = &ETagIter->second;
-       
-       }
-
-       return ETagDBPtr;
-
+    
+    ETagDB *ETagDBPtr = NULL;
+    
+    std::map<wxString,ETagDB>::iterator ETagIter;
+    
+    ETagIter = ETagDBList.find(AccountName);
+    
+    if (ETagIter != ETagDBList.end()){
+        
+        ETagDBPtr = &ETagIter->second;
+        
+    }
+    
+    return ETagDBPtr;
+    
 }
 
 void wxContactFileMonitorTimer::Notify(){
-
-       if (Filename.IsEmpty()){
-       
-               return;
-       
-       }
-
-       wxFileName FileCheck(Filename);
-       wxDateTime CurrentDateTime;
-       
-       CurrentDateTime = FileCheck.GetModificationTime();
-
-       if (FileDateTime != CurrentDateTime){
-       
-               // The dates & times of the file are different.
-               // Send an event to notify the user of this change.
-               
-               wxCommandEvent dateevent(wxEVT_COMMAND_BUTTON_CLICKED);
-               wxPostEvent(frmCEPtr, dateevent);
-       
-       }
-
+    
+    if (Filename.IsEmpty()){
+        
+        return;
+        
+    }
+    
+    wxFileName FileCheck(Filename);
+    wxDateTime CurrentDateTime;
+    
+    CurrentDateTime = FileCheck.GetModificationTime();
+    
+    if (FileDateTime != CurrentDateTime){
+        
+        // The dates & times of the file are different.
+        // Send an event to notify the user of this change.
+        
+        wxCommandEvent dateevent(wxEVT_COMMAND_BUTTON_CLICKED);
+        wxPostEvent(frmCEPtr, dateevent);
+        
+    }
+    
 }
 
 void wxContactFileMonitorTimer::SetFilename(wxString FilenameInc){
-
-       Filename = FilenameInc;
-       
-       wxFileName FileCheck(Filename);
-       FileDateTime = FileCheck.GetModificationTime();
-
+    
+    Filename = FilenameInc;
+    
+    wxFileName FileCheck(Filename);
+    FileDateTime = FileCheck.GetModificationTime();
+    
 }
 
 void wxContactFileMonitorTimer::SetupPointers(frmContactEditor *frmCEPtrInc){
-
-       frmCEPtr = frmCEPtrInc;
-
+    
+    frmCEPtr = frmCEPtrInc;
+    
 }
 
 void wxContactFileMonitorTimer::UpdateTimestamp(){
-
-       wxFileName FileCheck(Filename);
-       FileDateTime = FileCheck.GetModificationTime();
-
+    
+    wxFileName FileCheck(Filename);
+    FileDateTime = FileCheck.GetModificationTime();
+    
 }
 
 void wxContactWindowMonitor::Notify(){
-
-       // Look through the list of windows and see if any have
-       // closed. IF they have closed then delete and free the
-       // memory (also delete from the map).
-       
-       /*for(std::map<wxString, void*>::iterator iter = ContactWindowListPtr->begin();
-       iter != ContactWindowListPtr->end(); iter++){
-       
-               frmContact *ContactPtr = (frmContact*)iter->second;
-               
-               // Check if open.
-               
-               if (
-               
-               // Delete the form.
-               
-               // Delete the data from the map.
-       
-       }*/
-
+    
+    // Look through the list of windows and see if any have
+    // closed. IF they have closed then delete and free the
+    // memory (also delete from the map).
+    
+    /*for(std::map<wxString, void*>::iterator iter = ContactWindowListPtr->begin();
+     iter != ContactWindowListPtr->end(); iter++){
+     
+     frmContact *ContactPtr = (frmContact*)iter->second;
+     
+     // Check if open.
+     
+     if (
+     
+     // Delete the form.
+     
+     // Delete the data from the map.
+     
+     }*/
+    
 }
 
 void wxContactWindowMonitor::SetupPointers(std::map<wxString, void*> *ContactWindowListPtrInc){
-
-       ContactWindowListPtr = ContactWindowListPtrInc;
-
+    
+    ContactWindowListPtr = ContactWindowListPtrInc;
+    
 }
 
 void wxAccountSyncTimer::Notify(){
-
-       frmActivityMgr *ActMgrPtrProc = static_cast<frmActivityMgr*>(frmActMgrPtr);
-
-       // Disable the timer. (Don't go updating unless needed).
-       
-       this->Stop();
-       
-       if (ActMgrPtrProc->GetTaskStatus(intTaskID) < 2){
-       
-               this->Start();
-               return;
-       
-       }
-       
-       // Add task to the activity manager.
-       
-       intTaskID = ActMgrPtrProc->AddTask(3, wxT(""), AccName, 
-                       wxT(""), wxT(""), wxT(""), wxT(""));
-       
-       // Go to sleep and wait for the task to be completed.
-       
-       // Enable the timer as we are now finished syncronising.
-       
-       this->Start();
-       
+    
+    frmActivityMgr *ActMgrPtrProc = static_cast<frmActivityMgr*>(frmActMgrPtr);
+    
+    // Disable the timer. (Don't go updating unless needed).
+    
+    this->Stop();
+    
+    if (ActMgrPtrProc->GetTaskStatus(intTaskID) < 2){
+        
+        this->Start();
+        return;
+        
+    }
+    
+    // Add task to the activity manager.
+    
+    intTaskID = ActMgrPtrProc->AddTask(3, wxT(""), AccName, 
+                                       wxT(""), wxT(""), wxT(""), wxT(""));
+    
+    // Go to sleep and wait for the task to be completed.
+    
+    // Enable the timer as we are now finished syncronising.
+    
+    this->Start();
+    
 }
 
 void wxAccountSyncTimer::SetupData(wxString AccNameInc,
-       wxString AccNameFullInc){
-
-       // Set the account name.
-               
-       AccName = AccNameInc;
-       AccNameFull = AccNameFullInc;
-
+                                   wxString AccNameFullInc){
+    
+    // Set the account name.
+    
+    AccName = AccNameInc;
+    AccNameFull = AccNameFullInc;
+    
 }
 
 void wxAccountSyncTimer::SetupPointers(void *frmMainPtrInc, 
-       void *frmActMgrPtrInc, ETagDB *ETagDBPtrInc){
-
-       // Set the pointers.
-       
-       frmMainPtr = frmMainPtrInc;
-       frmActMgrPtr = frmActMgrPtrInc;
-       ETagDBPtr = ETagDBPtrInc;
-
+                                       void *frmActMgrPtrInc, ETagDB *ETagDBPtrInc){
+    
+    // Set the pointers.
+    
+    frmMainPtr = frmMainPtrInc;
+    frmActMgrPtr = frmActMgrPtrInc;
+    ETagDBPtr = ETagDBPtrInc;
+    
 }
 
 void SleepFor(unsigned long longSleepNanoSecs){
-
+    
 #ifdef __WIN32__
-       ::Sleep((longSleepNanoSecs / 1000000));
+    ::Sleep((longSleepNanoSecs / 1000000));
 #elif __HAIKU__
-
+    
 #else
-
-       timespec n1, n2;
-
-       n1.tv_sec = 0;
-       n1.tv_nsec = longSleepNanoSecs;
-
-       nanosleep(&n1, &n2);
-
+    
+    timespec n1, n2;
+    
+    n1.tv_sec = 0;
+    n1.tv_nsec = longSleepNanoSecs;
+    
+    nanosleep(&n1, &n2);
+    
 #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