From: Steve Brokenshire Date: Sun, 4 Oct 2015 15:18:57 +0000 (+0100) Subject: Improved importing support. X-Git-Tag: release-0.05~43 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=324a79e0dfa2d7911efc44f79e9d82abd60d0c2b;p=xestiaab%2F.git Improved importing support. --- 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);