Not Logged In
|
Login
|
Register
Home
|
News
|
Projects
|
Releases
Bugs
|
RFE
|
Repositories
|
Help
projects
/
xestiaab
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mnuSleepMode in frmActivityMgr caused an assertion using wxNullBitmap which it should...
[xestiaab/.git]
/
source
/
import
/
import.cpp
diff --git
a/source/import/import.cpp
b/source/import/import.cpp
index
416a39f
..
b85c4f6
100644
(file)
--- a/
source/import/import.cpp
+++ b/
source/import/import.cpp
@@
-19,10
+19,6
@@
void ImportRun(frmMain *frmMainPtrInc){
// Bring up a dialog selecting one or multiple
// files for processing based on type.
// Bring up a dialog selecting one or multiple
// files for processing based on type.
- struct ImportResultData{
-
- };
-
frmMainPtrInc->PauseAllTimers();
wxString FileTypes;
frmMainPtrInc->PauseAllTimers();
wxString FileTypes;
@@
-35,9
+31,10
@@
void ImportRun(frmMain *frmMainPtrInc){
wxArrayString SelectedFileList;
wxString SelectedFileDirectory;
wxString AccountName;
wxArrayString SelectedFileList;
wxString SelectedFileDirectory;
wxString AccountName;
+ wxString AccountType;
int ImportErrorCount = 0;
int ImportErrorCount = 0;
- std::map<int,wxString>
ResultData
;
+ std::map<int,wxString>
*ResultData = new std::map<int,wxString>
;
FileTypes.Append(wxT("vCard 4.0 Contact(s) (*.vcf)"));
FileTypes.Append(wxT("|*.vcf|"));
FileTypes.Append(wxT("vCard 4.0 Contact(s) (*.vcf)"));
FileTypes.Append(wxT("|*.vcf|"));
@@
-105,6
+102,22
@@
void ImportRun(frmMain *frmMainPtrInc){
frmIC->ShowModal();
frmIC->GetResults(&ContactData);
AccountName = frmIC->GetAccount();
frmIC->ShowModal();
frmIC->GetResults(&ContactData);
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;
// Import the contacts into the selected account.
// Import the contacts into the selected account.
@@
-139,7
+152,7
@@
void ImportRun(frmMain *frmMainPtrInc){
if (iter->second.ContactSelected == TRUE){
if (iter->second.ContactSelected == TRUE){
- // Workout the file name.
+ // Workout the file name.
void CloseWindow( wxCommandEvent& event );
// Get the UID value and check if it is empty.
// If it isn't empty, check it can be used for a valid
// filename other wise generate a file name for the purposes
// Get the UID value and check if it is empty.
// If it isn't empty, check it can be used for a valid
// filename other wise generate a file name for the purposes
@@
-223,7
+236,7
@@
void ImportRun(frmMain *frmMainPtrInc){
// File already exists so mark as an error.
// File already exists so mark as an error.
- ResultData
.insert(std::make_pair(ImportSeek, wxString::Format(_("Unable to import '%s'(%s): "), iter->second.FriendlyName, UIDToken
)));
+ ResultData
->insert(std::make_pair(ImportSeek, wxString::Format(_("Unable to import '%s'(%s): %s"), iter->second.FriendlyName, UIDToken, _("Contact already exists.")
)));
ImportErrorCount++;
ImportSeek++;
GeneratedFilename.Clear();
ImportErrorCount++;
ImportSeek++;
GeneratedFilename.Clear();
@@
-240,16
+253,19
@@
void ImportRun(frmMain *frmMainPtrInc){
wxFFile OutputFile;
#if wxABI_VERSION < 20900
wxFFile OutputFile;
#if wxABI_VERSION < 20900
- OutputFile.Open(OutputFilename, wxT("w"));
+ if(!OutputFile.Open(OutputFilename, wxT("w"))){
#else
#else
- OutputFile.Open(OutputFilename, wxT("w"));
+ if(!OutputFile.Open(OutputFilename, wxT("w"))){
#endif
#endif
+ ResultData->insert(std::make_pair(ImportSeek, wxString::Format(_("Unable to import '%s'(%s): %s"), iter->second.FriendlyName, UIDToken, _("Error occured whilst trying to create this contact. Please check permissions and storage device."))));
+
+ }
OutputFile.Write(iter->second.ContactData, wxConvAuto());
OutputFile.Close();
OutputFile.Write(iter->second.ContactData, wxConvAuto());
OutputFile.Close();
- ResultData
.insert(std::make_pair(ImportSeek, wxString::Format(_("Contact '%s'(%s) was successfully imported.")
)));
+ ResultData
->insert(std::make_pair(ImportSeek, wxString::Format(_("Contact '%s'(%s) was successfully imported."), iter->second.FriendlyName, UIDToken
)));
}
}
@@
-274,24
+290,29
@@
void ImportRun(frmMain *frmMainPtrInc){
// Check if the import error count is more than 0. If it is, then
// display the results dialog.
// Check if the import error count is more than 0. If it is, then
// display the results dialog.
- frmImportResults *frmIR = new frmImportResults(frmMainPtrInc);
- frmIR->LoadData(&ResultData);
- frmIR->ShowModal();
+ wxCommandEvent imprres(IMPORT_RESULTSSHOW);
+ imprres.SetClientData(ResultData);
+ imprres.SetInt(ImportCount);
+ imprres.SetExtraLong(ImportErrorCount);
+ wxPostEvent(frmMainPtrInc, imprres);
- delete frmIR;
- frmIR = NULL;
-
- delete frmIC;
- frmIC = NULL;
-
// Syncronise the account which the contacts got imported to.
// Syncronise the account which the contacts got imported to.
+ // (If the account is not a local account).
+
+ if (AccountType != wxT("Local") && AccountType != wxT("local")){
+
+ wxString AccNamePostEvent;
- wxString *AccNamePostEventPtr = new wxString;
+ AccNamePostEvent.Clear();
+ AccNamePostEvent.Append(AccountName);
+ AccNamePostEvent.Trim();
- wxCommandEvent accevent(SYNCACCOUNT);
-
accevent.SetClientData(AccNamePostEventPtr
);
+
wxCommandEvent accevent(SYNCACCOUNT);
+
accevent.SetString(AccNamePostEvent
);
- wxPostEvent(frmMainPtrInc, accevent);
+ wxPostEvent(frmMainPtrInc, accevent);
+
+ }
//wxPostEvent
//wxPostEvent
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software
Xestia Address Book
Xestia Calendar
Development
Xestia Gelforn
Everything else
About
News
Privacy Policy