Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Updated includes for frmActivityMgr.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 30 Nov 2015 11:52:00 +0000 (11:52 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 30 Nov 2015 11:52:00 +0000 (11:52 +0000)
source/Makefile.in
source/actmgr/frmActivityMgr.cpp
source/actmgr/frmActivityMgr.h
source/carddav/carddav.h
source/common/timers.cpp
source/common/timers.h
source/contacteditor/frmContactEditor.h
source/frmMain.cpp
source/main.cpp

index ea4e3b1..eaa76ad 100644 (file)
@@ -87,7 +87,7 @@ IMEXOBJS=import/import.o import/import-vcard3.o import/import-vcard4.o \
 SEARCHOBJS=search/XABSearchPanel.o search/frmSearchAccounts.o frmSearch.o\r
 VCARDOBJS=vcard/vcard.o vcard/vcard34conv.o vcard/vcard34conv-v3conv.o \\r
  vcard/vcard34conv-v4conv.o\r
-ACTMGROBJS=actmgr/frmActivityMgr.o\r
+ACTMGROBJS=actmgr/frmActivityMgr.o actmgr/frmActivityMgr-tasks.o\r
 FORMOBJS=AppXestiaAddrBk.o frmAbout.o frmMain.o \\r
  frmNewAccount.o frmPreferences.o frmContact.o frmConflictResolution.o \\r
  frmEditAccount.o frmInvalidSSLCertificate.o frmSSLCertificate.o \\r
@@ -95,8 +95,8 @@ FORMOBJS=AppXestiaAddrBk.o frmAbout.o frmMain.o \
 WIDGETOBJS=widgets/XABAccountView.o widgets/XABContactMenu.o\r
 BMCOOBJS=tools/bitmapcode.o\r
 \r
-xestiaab: bitmaphelper formobjs widgetobjs commonobjs vcardobjs carddavobjs \\r
-       ceobjs mainobjs searchobjs imexobjs \r
+xestiaab: bitmaphelper actmgrobjs formobjs widgetobjs commonobjs vcardobjs \\r
+       carddavobjs ceobjs mainobjs searchobjs imexobjs \r
        $(CPP) $(CPPFLAGS) $(ACTMGROBJS) $(FORMOBJS) $(WIDGETOBJS) $(COMMONOBJS) \\r
        $(VCARDOBJS) $(CEOBJS) $(CARDDAVOBJS) $(SEARCHOBJS) $(MAINOBJS) $(IMEXOBJS) -o $(XAB_OUT) \\r
        $(CPPLIBS)\r
@@ -104,6 +104,8 @@ ifeq ($(DEBUG), false)
        $(STRIP) -s $(XAB_OUT)\r
 endif\r
 \r
+actmgrobjs: $(ACTMGROBJS)\r
+\r
 carddavobjs: $(CARDDAVOBJS)\r
 \r
 mainobjs: $(MAINOBJS)\r
@@ -125,7 +127,7 @@ imexobjs: $(IMEXOBJS)
 clean:\r
        rm -f $(XAB_OUT) $(BMCO_HELP) tools/bitmapcode.o *.o \\r
        vcard/*.o common/*.o carddav/*.o contacteditor/*.o search/*.o \\r
-       widgets/*.o export/*.o import/*.o tests/$(XAB_OUT)_test\r
+       widgets/*.o export/*.o import/*.o actmgr/*.o tests/$(XAB_OUT)_test\r
 \r
 distclean: clean\r
        rm -f Makefile config.status config.log bitmapsdone \\r
index 69ae3c7..0ea4c67 100644 (file)
 #include <thread>
 #include <curl/curl.h>
 
-#include "bitmaps.h"
-#include "enums.h"
-#include "common/preferences.h"
-#include "frmConflictResolution.h"
-#include "frmInvalidSSLCertificate.h"
-#include "frmMain.h"
-#include "common/events.h"
-#include "common/filename.h"
-#include "common/dirs.h"
-#include "vcard/vcard34conv.h"
-#include "vcard/vcard.h"
-
+#include "../bitmaps.h"
+#include "../enums.h"
+#include "../common/preferences.h"
+#include "../frmConflictResolution.h"
+#include "../frmInvalidSSLCertificate.h"
+#include "../frmMain.h"
+#include "../common/events.h"
+#include "../common/filename.h"
+#include "../vcard/vcard34conv.h"
+#include "../vcard/vcard.h"
 
 #ifndef FRMACTIVITYMGR_H
 #define FRMACTIVITYMGR_H
@@ -172,297 +170,6 @@ frmActivityMgrADT( parent )
        //TestTimer.Start(50, FALSE);
 }
 
-int frmActivityMgr::AddTask(int TaskType, wxString TaskDetail, wxString TaskAccount, 
-       wxString TaskURL, wxString TaskFilename, wxString TaskFullFilename, 
-       wxString TaskData){
-
-       ActivityTaskID++;
-
-       wxListItem coldata;
-       long itemindex = -1;
-       CardDAV* CardDAVConn = new CardDAV;
-
-       coldata.SetId(ActivityTaskID);
-       coldata.SetData(ActivityTaskID);
-
-       AnimationTimer.StartAnimation();
-
-       // Get the preferences file.
-       
-       wxString PrefFilename = GetUserPrefDir();
-       
-       XABPreferences PrefData(PrefFilename);
-
-       wxString AccountName;
-       wxString AccountDir;
-       wxString AccountAddress;
-       int AccountPort = 0;
-       wxString AccountUsername;
-       wxString AccountPassword;
-       bool AccountSSL = FALSE;
-       wxString AccountPrefix;
-
-       // 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);
-               
-               AccountDir.Trim();
-               AccountDir.Append(wxT(".carddav"));
-       
-               if (AccountDir == TaskAccount){
-               
-                       AccountName = PrefData.accounts.GetAccountName(i);
-                       AccountAddress = PrefData.accounts.GetAccountAddress(i);
-                       AccountPort = PrefData.accounts.GetAccountPort(i);
-                       AccountUsername = PrefData.accounts.GetAccountUsername(i);
-                       AccountPassword = PrefData.accounts.GetAccountPassword(i);
-                       AccountPrefix = PrefData.accounts.GetAccountDirPrefix(i);
-                       AccountSSL = PrefData.accounts.GetAccountSSL(i);
-                       
-                       AccountName.Trim();
-                       AccountAddress.Trim();
-                       //AccountPort.Trim();
-                       AccountUsername.Trim();
-                       AccountPassword.Trim();
-                       AccountPrefix.Trim();
-                       break;
-               
-               }
-       
-       }
-       
-       CardDAVConn->SetupConnection(AccountAddress, AccountPort, AccountUsername, AccountPassword, AccountSSL, AccountPrefix, AccountDir);
-       CardDAVConn->SetupVariables(&ActivityList, ActivityTaskID);
-       CardDAVConn->SetupResultBools(&BlankBool, &BlankBool);          
-
-       // TaskType:
-       // 0 - Add a contact.
-       // 1 - Update a contact.
-       // 2 - Delete a contact.
-       // 3 - Account syncronisation.
-
-       if (TaskType == 0){             
-
-               coldata.SetText(_("Adding Contact '") + TaskDetail + _("'"));
-               itemindex = lstActivity->InsertItem(coldata);
-               
-               lstActivity->SetItem(itemindex, 1, AccountName);
-               lstActivity->SetItem(itemindex, 2, _("Queued"));
-               
-               CardDAVConn->SetUploadMode(TRUE);
-               CardDAVConn->SetupData(wxT("PUT"), TaskURL, TaskData);
-               
-               // Setup all of the task details.
-
-               ETagDB *ETagDBPtr = ETagTmrPtr->GetPointer(AccountDir);
-               
-               ActivityListType.insert(std::make_pair(ActivityTaskID, 0));
-               ActivityListData.insert(std::make_pair(ActivityTaskID, TaskData));
-               ActivityListConn.insert(std::make_pair(ActivityTaskID, CardDAVConn));
-               ActivityListIndex.insert(std::make_pair(ActivityTaskID, itemindex));
-               ActivityListTaskDetail.insert(std::make_pair(ActivityTaskID, TaskDetail));
-               ActivityListAccount.insert(std::make_pair(ActivityTaskID, TaskAccount));
-               ActivityListFilename.insert(std::make_pair(ActivityTaskID, TaskFilename));
-               ActivityListFullFilename.insert(std::make_pair(ActivityTaskID, TaskFullFilename));
-               
-               ActivityListETag.insert(std::make_pair(ActivityTaskID, ETagDBPtr->GetETag(TaskFilename)));
-               ActivityListETagOriginal.insert(std::make_pair(ActivityTaskID, ETagDBPtr->GetETagOriginal(TaskFilename)));
-               ActivityList.insert(std::make_pair(ActivityTaskID, 0));
-       
-       } else if (TaskType == 1){
-       
-               coldata.SetText(_("Updating Contact '") + TaskDetail + _("'"));
-               itemindex = lstActivity->InsertItem(coldata);           
-               
-               lstActivity->SetItem(itemindex, 1, AccountName);
-               lstActivity->SetItem(itemindex, 2, _("Queued"));
-               
-               CardDAVConn->SetUploadMode(TRUE);
-               CardDAVConn->SetupData(wxT("PUT"), TaskURL, TaskData);
-               CardDAVConn->SetEditMode(TRUE);
-               
-               ETagDB *ETagDBPtr = ETagTmrPtr->GetPointer(AccountDir);
-               
-               ActivityListType.insert(std::make_pair(ActivityTaskID, 1));
-               ActivityListData.insert(std::make_pair(ActivityTaskID, TaskData));
-               ActivityListConn.insert(std::make_pair(ActivityTaskID, CardDAVConn));
-               ActivityListIndex.insert(std::make_pair(ActivityTaskID, itemindex));
-               ActivityListTaskDetail.insert(std::make_pair(ActivityTaskID, TaskDetail));
-               ActivityListAccount.insert(std::make_pair(ActivityTaskID, TaskAccount));
-               ActivityListFilename.insert(std::make_pair(ActivityTaskID, TaskFilename));
-               ActivityListFullFilename.insert(std::make_pair(ActivityTaskID, TaskFullFilename));
-               
-               ActivityListETag.insert(std::make_pair(ActivityTaskID, ETagDBPtr->GetETag(TaskFilename)));
-               ActivityListETagOriginal.insert(std::make_pair(ActivityTaskID, ETagDBPtr->GetETagOriginal(TaskFilename)));
-               ActivityList.insert(std::make_pair(ActivityTaskID, 0));
-       
-       } else if (TaskType == 2){
-
-               coldata.SetText(_("Deleting Contact '") + TaskDetail + _("'"));
-               itemindex = lstActivity->InsertItem(coldata);
-               
-               lstActivity->SetItem(itemindex, 1, AccountName);
-               lstActivity->SetItem(itemindex, 2, _("Queued"));
-               
-               ETagDB *ETagDBPtr = ETagTmrPtr->GetPointer(AccountDir);
-               
-               ActivityList.insert(std::make_pair(ActivityTaskID, 0));
-               ActivityListType.insert(std::make_pair(ActivityTaskID, 2));
-               ActivityListData.insert(std::make_pair(ActivityTaskID, TaskData));
-               ActivityListAccount.insert(std::make_pair(ActivityTaskID, TaskAccount));
-               ActivityListConn.insert(std::make_pair(ActivityTaskID, CardDAVConn));
-               ActivityListFilename.insert(std::make_pair(ActivityTaskID, TaskFilename));
-               ActivityListIndex.insert(std::make_pair(ActivityTaskID, itemindex));
-       
-       } else if (TaskType == 3){
-
-               coldata.SetText(_("Syncronising All Contacts"));
-               itemindex = lstActivity->InsertItem(coldata);
-               
-               lstActivity->SetItem(itemindex, 1, AccountName);
-               lstActivity->SetItem(itemindex, 2, _("Queued"));
-               
-               ActivityList.insert(std::make_pair(ActivityTaskID, 0));
-               ActivityListType.insert(std::make_pair(ActivityTaskID, 3));
-               ActivityListData.insert(std::make_pair(ActivityTaskID, TaskData));
-               ActivityListConn.insert(std::make_pair(ActivityTaskID, CardDAVConn));
-               ActivityListTaskDetail.insert(std::make_pair(ActivityTaskID, AccountPrefix));
-               ActivityListAccount.insert(std::make_pair(ActivityTaskID, TaskAccount));
-               ActivityListIndex.insert(std::make_pair(ActivityTaskID, itemindex));
-       
-       }
-       
-       ProcessTasksData = TRUE;
-       
-       if (!ActProcessTimer.IsRunning()) {
-       
-               wxCommandEvent event(ACTMGR_STARTTIMER);
-               wxPostEvent(this, event);
-
-               wxCommandEvent eventp(ACTMGR_STARTPROCESSTIMER);
-               wxPostEvent(this, eventp);
-
-               //ActProcessTimer.Start(1000, FALSE);
-               //ActListProcTimer.Start(1000, FALSE);
-       
-       }
-       
-       // Update the recovery database.
-       
-       return ActivityTaskID;
-
-}
-
-void frmActivityMgr::RemoveTask(){
-
-       // Remove task from the recovery database.
-
-}
-
-void frmActivityMgr::StopTask( wxCommandEvent& event ){
-
-       // Check if activity has been completed already before stopping.
-
-       long longSelected = -1;
-       int intSelectedData = 0;
-               
-       longSelected = lstActivity->GetNextItem(longSelected, 
-               wxLIST_NEXT_ALL,
-               wxLIST_STATE_SELECTED);
-
-       intSelectedData = (int)lstActivity->GetItemData(longSelected);
-       
-       if (longSelected == -1){
-               return;
-       }
-       
-       std::map<int,CardDAV*>::iterator CDAVter;
-       
-       CDAVter = ActivityListConn.find(intSelectedData);
-       
-       CDAVter->second->Abort();
-       
-       lstActivity->SetItem(longSelected, 2, _("Stopped"));
-
-}
-
-void frmActivityMgr::StopAllTasks( wxCommandEvent& event ){
-
-       // Check if activity has been completed already before stopping.
-       
-       // TODO: Look through for '1' and stop the running task(s).
-       
-       long longSelected = -1;
-       int intSelectedData = 0;
-               
-       longSelected = lstActivity->GetNextItem(longSelected, 
-               wxLIST_NEXT_ALL,
-               wxLIST_STATE_SELECTED);
-
-       intSelectedData = (int)lstActivity->GetItemData(longSelected);
-       
-       if (longSelected == -1){
-               return;
-       }
-       
-       std::map<int,CardDAV*>::iterator CDAVter;
-       
-       CDAVter = ActivityListConn.find(intSelectedData);
-       
-       CDAVter->second->Abort();
-       
-       lstActivity->SetItem(longSelected, 2, _("Stopped"));
-       AnimationTimer.StopAnimation();
-       bmpActivity->SetBitmap(SleepBitmap);
-       lblDetails->SetLabel(_("No activity."));
-
-}
-
-void frmActivityMgr::RetryTask( wxCommandEvent& event ){
-
-       // Check if activity has been completed already before retrying.
-       
-       long longSelected = -1;
-       int intSelectedData = 0;
-               
-       longSelected = lstActivity->GetNextItem(longSelected, 
-               wxLIST_NEXT_ALL,
-               wxLIST_STATE_SELECTED);
-
-       intSelectedData = (int)lstActivity->GetItemData(longSelected);
-       
-       if (longSelected == -1){
-               return;
-       }
-       
-       std::map<int,CardDAV*>::iterator CDAVter;
-       
-       CDAVter = ActivityListConn.find(intSelectedData);
-       
-       // Restart the task.
-       
-       //CDAVter->second.Abort();
-       
-       std::map<int,int>::iterator Iter;
-       Iter = ActivityList.find(intSelectedData);
-       
-       Iter->second = 0;
-       
-       AnimationTimer.StartAnimation();
-       
-       if (!ActProcessTimer.IsRunning()) {
-       
-               ActProcessTimer.Start(150, FALSE);
-               ActListProcTimer.Start(150, FALSE);
-       
-       }
-       
-       //lstActivity->SetItem(longSelected, 2, _("Processing..."));
-
-}
-
 void frmActivityMgr::OpenWindow()
 {
        WindowOpen = TRUE;
@@ -1835,23 +1542,6 @@ void frmActivityMgr::ResumeProcessing(wxCommandEvent &event){
        
 }
 
-int frmActivityMgr::GetTaskStatus(int intTaskID){
-
-       int intResult = 2;
-       
-       if (ActivityList.find(intTaskID) == ActivityList.end()){
-       
-               return intResult;
-       
-       }
-       
-       std::map<int,int>::iterator taskiter = ActivityList.find(intTaskID);
-       intResult = taskiter->second;
-       
-       return intResult;
-
-}
-
 void frmActivityMgr::ToggleConnectionStatus( wxCommandEvent &event ){
 
        wxCommandEvent connevent(CONNSTAT_UPDATE);
index f11bf79..5ad6eba 100644 (file)
 Subclass of frmActivityMgrADT, which is generated by wxFormBuilder.
 */
 
-#include "AppXestiaAddrBk.h"
-#include "carddav/carddav.h"
 #include <map>
 #include <wx/timer.h>
 
-#include "common/timers.h"
-#include "common/etag.h"
+#include "../AppXestiaAddrBk.h"
+#include "../carddav/carddav.h"
+#include "../common/timers.h"
+#include "../common/etag.h"
+#include "../common/dirs.h"
 
 //// end generated include
 
index 6fed60d..c4deeb2 100644 (file)
@@ -23,7 +23,7 @@
 #include <libxml/tree.h>
 #include <curl/curl.h>
 #include "../vcard/vcard.h"
-#include "../frmActivityMgr.h"
+#include "../actmgr/frmActivityMgr.h"
 #include "../common/sslcertstructs.h"
 
 #ifndef CALDAV_CALDAV_H
index c3ed546..bf334bf 100644 (file)
@@ -16,7 +16,7 @@
 // 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 "../actmgr/frmActivityMgr.h"
 #include "../frmContact.h"
 #include "../frmMain.h"
 #include <wx/mstream.h>
index aa5bc8f..5952a57 100644 (file)
@@ -21,7 +21,7 @@
 #include <wx/wx.h>
 #include <mutex>
 #include <atomic>
-#include "../frmActivityMgr.h"
+#include "../actmgr/frmActivityMgr.h"
 #include "../contacteditor/frmContactEditor.h"
 #include "etag.h"
 
index f623ac3..bdd393c 100644 (file)
@@ -37,7 +37,7 @@ Subclass of frmContactEditorADT, which is generated by wxFormBuilder.
 #include "../common/etag.h"
 #include "../common/timers.h"
 
-#include "../frmActivityMgr.h"
+#include "../actmgr/frmActivityMgr.h"
 #include "../frmMain.h"
 
 #define CE_NICKNAME wxT("Nickname")
index 4614fd6..0500383 100644 (file)
@@ -39,7 +39,7 @@
 #include "frmAbout.h"
 #include "frmPreferences.h"
 #include "frmNewAccount.h"
-#include "frmActivityMgr.h"
+#include "actmgr/frmActivityMgr.h"
 #include "frmContact.h"
 #include "frmConflictResolution.h"
 #include "frmInvalidSSLCertificate.h"
index 9b998bc..51255f4 100644 (file)
@@ -30,7 +30,7 @@
 #include "frmMain.h"
 #include "bitmaps.h"
 #include "version.h"
-#include "frmActivityMgr.h"
+#include "actmgr/frmActivityMgr.h"
 #include "frmSearch.h"
 #include "common/timers.h"
 #include "common/defaults.h"
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