From: Steve Brokenshire Date: Mon, 30 Nov 2015 11:52:00 +0000 (+0000) Subject: Updated includes for frmActivityMgr. X-Git-Tag: release-0.06~15 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=a4deb4d72448721584279013bedb6f9c8ceb23ac;p=xestiaab%2F.git Updated includes for frmActivityMgr. --- diff --git a/source/Makefile.in b/source/Makefile.in index ea4e3b1..eaa76ad 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -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 VCARDOBJS=vcard/vcard.o vcard/vcard34conv.o vcard/vcard34conv-v3conv.o \ vcard/vcard34conv-v4conv.o -ACTMGROBJS=actmgr/frmActivityMgr.o +ACTMGROBJS=actmgr/frmActivityMgr.o actmgr/frmActivityMgr-tasks.o FORMOBJS=AppXestiaAddrBk.o frmAbout.o frmMain.o \ frmNewAccount.o frmPreferences.o frmContact.o frmConflictResolution.o \ frmEditAccount.o frmInvalidSSLCertificate.o frmSSLCertificate.o \ @@ -95,8 +95,8 @@ FORMOBJS=AppXestiaAddrBk.o frmAbout.o frmMain.o \ WIDGETOBJS=widgets/XABAccountView.o widgets/XABContactMenu.o BMCOOBJS=tools/bitmapcode.o -xestiaab: bitmaphelper formobjs widgetobjs commonobjs vcardobjs carddavobjs \ - ceobjs mainobjs searchobjs imexobjs +xestiaab: bitmaphelper actmgrobjs formobjs widgetobjs commonobjs vcardobjs \ + carddavobjs ceobjs mainobjs searchobjs imexobjs $(CPP) $(CPPFLAGS) $(ACTMGROBJS) $(FORMOBJS) $(WIDGETOBJS) $(COMMONOBJS) \ $(VCARDOBJS) $(CEOBJS) $(CARDDAVOBJS) $(SEARCHOBJS) $(MAINOBJS) $(IMEXOBJS) -o $(XAB_OUT) \ $(CPPLIBS) @@ -104,6 +104,8 @@ ifeq ($(DEBUG), false) $(STRIP) -s $(XAB_OUT) endif +actmgrobjs: $(ACTMGROBJS) + carddavobjs: $(CARDDAVOBJS) mainobjs: $(MAINOBJS) @@ -125,7 +127,7 @@ imexobjs: $(IMEXOBJS) clean: rm -f $(XAB_OUT) $(BMCO_HELP) tools/bitmapcode.o *.o \ vcard/*.o common/*.o carddav/*.o contacteditor/*.o search/*.o \ - widgets/*.o export/*.o import/*.o tests/$(XAB_OUT)_test + widgets/*.o export/*.o import/*.o actmgr/*.o tests/$(XAB_OUT)_test distclean: clean rm -f Makefile config.status config.log bitmapsdone \ diff --git a/source/actmgr/frmActivityMgr.cpp b/source/actmgr/frmActivityMgr.cpp index 69ae3c7..0ea4c67 100644 --- a/source/actmgr/frmActivityMgr.cpp +++ b/source/actmgr/frmActivityMgr.cpp @@ -26,18 +26,16 @@ #include #include -#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::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::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::iterator CDAVter; - - CDAVter = ActivityListConn.find(intSelectedData); - - // Restart the task. - - //CDAVter->second.Abort(); - - std::map::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::iterator taskiter = ActivityList.find(intTaskID); - intResult = taskiter->second; - - return intResult; - -} - void frmActivityMgr::ToggleConnectionStatus( wxCommandEvent &event ){ wxCommandEvent connevent(CONNSTAT_UPDATE); diff --git a/source/actmgr/frmActivityMgr.h b/source/actmgr/frmActivityMgr.h index f11bf79..5ad6eba 100644 --- a/source/actmgr/frmActivityMgr.h +++ b/source/actmgr/frmActivityMgr.h @@ -24,13 +24,14 @@ Subclass of frmActivityMgrADT, which is generated by wxFormBuilder. */ -#include "AppXestiaAddrBk.h" -#include "carddav/carddav.h" #include #include -#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 diff --git a/source/carddav/carddav.h b/source/carddav/carddav.h index 6fed60d..c4deeb2 100644 --- a/source/carddav/carddav.h +++ b/source/carddav/carddav.h @@ -23,7 +23,7 @@ #include #include #include "../vcard/vcard.h" -#include "../frmActivityMgr.h" +#include "../actmgr/frmActivityMgr.h" #include "../common/sslcertstructs.h" #ifndef CALDAV_CALDAV_H diff --git a/source/common/timers.cpp b/source/common/timers.cpp index c3ed546..bf334bf 100644 --- a/source/common/timers.cpp +++ b/source/common/timers.cpp @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with Xestia Address Book. If not, see -#include "../frmActivityMgr.h" +#include "../actmgr/frmActivityMgr.h" #include "../frmContact.h" #include "../frmMain.h" #include diff --git a/source/common/timers.h b/source/common/timers.h index aa5bc8f..5952a57 100644 --- a/source/common/timers.h +++ b/source/common/timers.h @@ -21,7 +21,7 @@ #include #include #include -#include "../frmActivityMgr.h" +#include "../actmgr/frmActivityMgr.h" #include "../contacteditor/frmContactEditor.h" #include "etag.h" diff --git a/source/contacteditor/frmContactEditor.h b/source/contacteditor/frmContactEditor.h index f623ac3..bdd393c 100644 --- a/source/contacteditor/frmContactEditor.h +++ b/source/contacteditor/frmContactEditor.h @@ -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") diff --git a/source/frmMain.cpp b/source/frmMain.cpp index 4614fd6..0500383 100644 --- a/source/frmMain.cpp +++ b/source/frmMain.cpp @@ -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" diff --git a/source/main.cpp b/source/main.cpp index 9b998bc..51255f4 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -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"