1 // frmImportResults.h - frmImportResults form.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
21 #include <wx/clipbrd.h>
22 #include <wx/dataobj.h>
24 #include "frmImportResults.h"
26 frmImportResults::frmImportResults( wxWindow* parent )
28 frmImportResultsADT( parent )
33 void frmImportResults::CopyClipboard( wxCommandEvent& event )
36 // Copy the results to the clipboard.
38 if (wxTheClipboard->Open()){
40 wxTextDataObject ResultData;
42 ResultData.SetText(txtResults->GetValue());
44 wxTheClipboard->Clear();
45 wxTheClipboard->AddData(&ResultData);
46 wxTheClipboard->Close();
47 wxTheClipboard->Flush();
49 wxMessageBox(_("The results have been copied to the clipboard."), _("Results copied to clipboard"));
53 wxMessageBox(_("The results have not been copied to the clipboard due to an error."), _("Results not copied to clipboard"));
59 void frmImportResults::CloseWindow( wxCommandEvent& event )
68 void frmImportResults::LoadData(std::map<int,wxString> *ResultDataInc, int ImportCount, int ImportErrorCount)
71 // Load and process the data from the ResultDataInc pointer.
73 wxString ResultDataText;
75 for (std::map<int,wxString>::iterator iter = ResultDataInc->begin();
76 iter != ResultDataInc->end(); iter++){
78 ResultDataText.Append(iter->second + wxT("\n"));
82 // Display the results in the form.
84 txtResults->SetValue(ResultDataText);
85 lblText->SetLabel(wxString::Format(_("%i contacts imported. %i contacts had errors and could not be imported."), ImportCount, ImportErrorCount));