1 #include <wx/filedlg.h>
5 #include "../frmMain.h"
6 #include "export-vcard3.h"
7 #include "export-vcard4.h"
9 void ExportRun(frmMain *frmMainPtrInc, wxArrayString *FileListInc){
11 frmMainPtrInc->PauseAllTimers();
16 long ContactsExported = 0;
17 long ContactsCollected = 0;
20 wxString FinalFilename;
22 FileTypes.Append(wxT("vCard 4.0 (directory, one contact per file) (*.vcf)"));
23 FileTypes.Append(wxT("|*.vcf|"));
24 FileTypes.Append(wxT("vCard 4.0 (file, all contacts in one file) (*.vcf)"));
25 FileTypes.Append(wxT("|*.vcf|"));
26 FileTypes.Append(wxT("vCard 3.0 (directory, one contact per file) (*.vcf)"));
27 FileTypes.Append(wxT("|*.vcf|"));
28 FileTypes.Append(wxT("vCard 3.0 (file, all contacts in one file) (*.vcf)"));
29 FileTypes.Append(wxT("|*.vcf"));
31 // Open up the dialog to export file data.
33 wxFileDialog ExportDlg(frmMainPtrInc, wxT("Export Contacts"), wxT(""), wxT(""),
34 FileTypes, wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
36 if (ExportDlg.ShowModal() == wxID_CANCEL){
38 frmMainPtrInc->ResumeAllTimers();
43 // Find which data type is being used.
45 ExportType = ExportDlg.GetFilterIndex();
47 if (ExportType == 0 || ExportType == 2){
51 // Process the filename based on data type.
53 if (DirMode == FALSE){
55 // All contacts exported into one file. Setup the filename.
57 FinalFilename = ExportDlg.GetPath();
61 // One contact per filename. Setup the directory name.
63 FinalFilename = ExportDlg.GetDirectory();
67 if (ExportType == 0 || ExportType == 1){
69 ExportVCard4(DirMode, FinalFilename, FileListInc, &ExportCount);
75 if (ExportType == 2 || ExportType == 3){
77 ExportVCard3(DirMode, FinalFilename, FileListInc, &ExportCount);
81 // Notify the user of how many contacts
84 wxMessageBox(wxString::Format(_("%i contacts exported."), ExportCount), _("Contacts exported"));
86 frmMainPtrInc->ResumeAllTimers();