From 324a79e0dfa2d7911efc44f79e9d82abd60d0c2b Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 4 Oct 2015 16:18:57 +0100 Subject: [PATCH] Improved importing support. --- source/import/frmImportContacts.cpp | 10 ++++++++++ source/import/frmImportContacts.h | 3 +++ source/import/import.cpp | 20 ++++++++++++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/source/import/frmImportContacts.cpp b/source/import/frmImportContacts.cpp index 0160598..e37e5cd 100644 --- a/source/import/frmImportContacts.cpp +++ b/source/import/frmImportContacts.cpp @@ -126,6 +126,8 @@ frmImportContactsADT( parent ) AccName.clear(); } + + DialogResult = FALSE; } @@ -153,11 +155,13 @@ void frmImportContacts::GetContacts() void frmImportContacts::CloseWindow( wxCommandEvent& event ) { + DialogResult = FALSE; this->Close(); } void frmImportContacts::ImportContacts( wxCommandEvent& event ) { + DialogResult = TRUE; this->Close(); } @@ -293,4 +297,10 @@ wxString frmImportContacts::GetAccountType() return AccountType; +} + +bool frmImportContacts::GetDialogResult(){ + + return DialogResult; + } \ No newline at end of file diff --git a/source/import/frmImportContacts.h b/source/import/frmImportContacts.h index 7862fb4..3f42e6e 100644 --- a/source/import/frmImportContacts.h +++ b/source/import/frmImportContacts.h @@ -29,6 +29,7 @@ class frmImportContacts : public frmImportContactsADT int AccountID; int AccountNetID; int AccountGrpID; + bool DialogResult; protected: // Handlers for frmImportContactsADT events. void CloseWindow( wxCommandEvent& event ); @@ -41,8 +42,10 @@ class frmImportContacts : public frmImportContactsADT ~frmImportContacts(); void SetupList(std::map* ContactDataInc); void GetResults(std::map* ContactDataInc); + bool GetDialogResult(); wxString GetAccount(); wxString GetAccountType(); + wxString GetAccountDirName(); //// end generated class members }; diff --git a/source/import/import.cpp b/source/import/import.cpp index 948f83f..b85c4f6 100644 --- a/source/import/import.cpp +++ b/source/import/import.cpp @@ -104,6 +104,18 @@ void ImportRun(frmMain *frmMainPtrInc){ AccountName = frmIC->GetAccount(); AccountType = frmIC->GetAccountType(); + if (frmIC->GetDialogResult() == FALSE){ + + // User decided not to import. Clean up the + // dialog. + + delete frmIC; + frmIC = NULL; + frmMainPtrInc->ResumeAllTimers(); + return; + + } + delete frmIC; frmIC = NULL; @@ -289,10 +301,14 @@ void ImportRun(frmMain *frmMainPtrInc){ if (AccountType != wxT("Local") && AccountType != wxT("local")){ - wxString *AccNamePostEventPtr = new wxString; + wxString AccNamePostEvent; + + AccNamePostEvent.Clear(); + AccNamePostEvent.Append(AccountName); + AccNamePostEvent.Trim(); wxCommandEvent accevent(SYNCACCOUNT); - accevent.SetClientData(AccNamePostEventPtr); + accevent.SetString(AccNamePostEvent); wxPostEvent(frmMainPtrInc, accevent); -- 2.39.5