#include #include #include #include "../frmMain.h" #include "export-vcard3.h" #include "export-vcard4.h" void ExportRun(frmMain *frmMainPtrInc, wxArrayString *FileListInc){ frmMainPtrInc->PauseAllTimers(); wxString FileTypes; bool DirMode = FALSE; long ContactsExported = 0; long ContactsCollected = 0; int ExportType = 0; int ExportCount = 0; wxString FinalFilename; FileTypes.Append(wxT("vCard 4.0 (directory, one contact per file) (*.vcf)")); FileTypes.Append(wxT("|*.vcf|")); FileTypes.Append(wxT("vCard 4.0 (file, all contacts in one file) (*.vcf)")); FileTypes.Append(wxT("|*.vcf|")); FileTypes.Append(wxT("vCard 3.0 (directory, one contact per file) (*.vcf)")); FileTypes.Append(wxT("|*.vcf|")); FileTypes.Append(wxT("vCard 3.0 (file, all contacts in one file) (*.vcf)")); FileTypes.Append(wxT("|*.vcf")); // Open up the dialog to export file data. wxFileDialog ExportDlg(frmMainPtrInc, wxT("Export Contacts"), wxT(""), wxT(""), FileTypes, wxFD_SAVE|wxFD_OVERWRITE_PROMPT); if (ExportDlg.ShowModal() == wxID_CANCEL){ frmMainPtrInc->ResumeAllTimers(); return; } // Find which data type is being used. ExportType = ExportDlg.GetFilterIndex(); if (ExportType == 0 || ExportType == 2){ DirMode = TRUE; } // Process the filename based on data type. if (DirMode == FALSE){ // All contacts exported into one file. Setup the filename. FinalFilename = ExportDlg.GetPath(); } else { // One contact per filename. Setup the directory name. FinalFilename = ExportDlg.GetDirectory(); } if (ExportType == 0 || ExportType == 1){ ExportVCard4(DirMode, FinalFilename, FileListInc, &ExportCount); } // vCard 3.0 export if (ExportType == 2 || ExportType == 3){ ExportVCard3(DirMode, FinalFilename, FileListInc, &ExportCount); } // Notify the user of how many contacts // were exported. wxMessageBox(wxString::Format(_("%i contacts exported."), ExportCount), _("Contacts exported")); //wxMessageBox(_("Selected contacts have been exported."), _("Contacts exported")); frmMainPtrInc->ResumeAllTimers(); }