summaryrefslogtreecommitdiff
path: root/plugins/BasicHistory/src/HistoryWindow.cpp
diff options
context:
space:
mode:
authorAbdul <abdul@miranda-ng.org>2012-10-28 13:43:24 +0000
committerAbdul <abdul@miranda-ng.org>2012-10-28 13:43:24 +0000
commit0cabe46ea8b9b27ed28db69e3d03b0df19c0ad8e (patch)
tree4f24affb8237ddee1ddcb2086f87cbc18aa71af3 /plugins/BasicHistory/src/HistoryWindow.cpp
parent010e4df16c3fc963155cd1e398748d2b15974e3e (diff)
BasicHistory updated to 1.0.1.9
git-svn-id: http://svn.miranda-ng.org/main/trunk@2099 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BasicHistory/src/HistoryWindow.cpp')
-rw-r--r--plugins/BasicHistory/src/HistoryWindow.cpp58
1 files changed, 48 insertions, 10 deletions
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp
index a8dfcefd14..f7ef91a056 100644
--- a/plugins/BasicHistory/src/HistoryWindow.cpp
+++ b/plugins/BasicHistory/src/HistoryWindow.cpp
@@ -2195,23 +2195,61 @@ void HistoryWindow::DoImport(IImport::ImportType type)
ExportManager exp(hWnd, hContact, GetFilterNr());
std::vector<IImport::ExternalMessage> messages;
std::wstring err;
- if(exp.Import(type, messages, &err))
+ std::vector<HANDLE> contacts;
+ HANDLE _hContact = db_find_first();
+ while(_hContact)
{
- int act = MessageBox(hWnd, TranslateT("Do you want save imported messages to local profile?"), TranslateT("Import"), MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON2);
- if(act == IDYES)
+ contacts.push_back(_hContact);
+ _hContact = db_find_next(hContact);
+ }
+
+ bool changeContact = false;
+ HANDLE lastContact = hContact;
+ int i = 1;
+ do
+ {
+ bool differentContact = false;
+ if(exp.Import(type, messages, &err, &differentContact, &contacts))
+ {
+ int act = MessageBox(hWnd, TranslateT("Do you want save imported messages to local profile?"), TranslateT("Import"), MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON2);
+ if(act == IDYES)
+ {
+ MargeMessages(messages);
+ if(!changeContact)
+ {
+ HistoryWindow::RebuildEvents(hContact);
+ }
+ }
+ else if(act == IDNO)
+ {
+ EventList::AddImporter(hContact, type, exp.GetFileName());
+ if(!changeContact)
+ {
+ HistoryWindow::RebuildEvents(hContact);
+ }
+ }
+ }
+ else if(differentContact)
{
- MargeMessages(messages);
- HistoryWindow::RebuildEvents(hContact);
+ int act = MessageBox(hWnd, TranslateT("File contain history for different contact. Do you want to change contact and import?"), TranslateT("Error"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2);
+ if(act == IDYES)
+ {
+ changeContact = true;
+ hContact = exp.hContact;
+ }
}
- else if(act == IDNO)
+ else if(!err.empty())
{
- EventList::AddImporter(hContact, type, exp.GetFileName());
- HistoryWindow::RebuildEvents(hContact);
+ MessageBox(hWnd, err.c_str(), TranslateT("Error"), MB_ICONERROR);
}
}
- else if(!err.empty())
+ while(changeContact && i--);
+ if(changeContact)
{
- MessageBox(hWnd, err.c_str(), TranslateT("Error"), MB_ICONERROR);
+ hContact = lastContact;
+ ReloadContacts();
+ SelectContact(exp.hContact);
+ HistoryWindow::RebuildEvents(exp.hContact);
}
}