summaryrefslogtreecommitdiff
path: root/plugins/BasicHistory
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
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')
-rw-r--r--plugins/BasicHistory/docs/BasicHistory_readme.txt3
-rw-r--r--plugins/BasicHistory/src/ExportManager.cpp21
-rw-r--r--plugins/BasicHistory/src/ExportManager.h2
-rw-r--r--plugins/BasicHistory/src/HistoryWindow.cpp58
-rw-r--r--plugins/BasicHistory/src/version.h2
5 files changed, 71 insertions, 15 deletions
diff --git a/plugins/BasicHistory/docs/BasicHistory_readme.txt b/plugins/BasicHistory/docs/BasicHistory_readme.txt
index ba19327ba5..7b9163e497 100644
--- a/plugins/BasicHistory/docs/BasicHistory_readme.txt
+++ b/plugins/BasicHistory/docs/BasicHistory_readme.txt
@@ -24,6 +24,9 @@ Microsoft Visual C++ 2008 Redistributable Package for x86 version (included in M
Changelog
=========
+--- 1.0.1.9 ---
+* now importing history for different contact than selected is possible
+
--- 1.0.1.8 ---
* scrollbar position on bottom when opening history
diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp
index 897561ef26..83c4a2ba7e 100644
--- a/plugins/BasicHistory/src/ExportManager.cpp
+++ b/plugins/BasicHistory/src/ExportManager.cpp
@@ -249,7 +249,7 @@ int ExportManager::Import(IImport::ImportType type, const std::vector<HANDLE>& c
return t;
}
-bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::ExternalMessage>& eventList, std::wstring* err)
+bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::ExternalMessage>& eventList, std::wstring* err, bool* differentContact, std::vector<HANDLE>* contacts)
{
IImport* imp = NULL;
switch(type)
@@ -281,18 +281,33 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern
v.push_back(hContact);
bool ret = true;
int contInFile = imp->IsContactInFile(v);
- if(contInFile != 0 && contInFile != -3)
+ if(contInFile == -1)
{
ret = false;
if(err != NULL)
*err = TranslateT("File do not contain selected contact");
+ if(contacts != NULL && differentContact != NULL)
+ {
+ contInFile = imp->IsContactInFile(*contacts);
+ if(contInFile >= 0)
+ {
+ *differentContact = true;
+ hContact = (*contacts)[contInFile];
+ }
+ }
}
- else
+ else if(contInFile == 0 || contInFile == -3)
{
ret = imp->GetEventList(eventList);
if(!ret && err != NULL)
*err = TranslateT("File is corrupted");
}
+ else
+ {
+ ret = false;
+ if(err != NULL)
+ *err = TranslateT("File is corrupted");
+ }
stream->close();
delete stream;
delete imp;
diff --git a/plugins/BasicHistory/src/ExportManager.h b/plugins/BasicHistory/src/ExportManager.h
index d99ff077a6..17ed0bb8ef 100644
--- a/plugins/BasicHistory/src/ExportManager.h
+++ b/plugins/BasicHistory/src/ExportManager.h
@@ -53,7 +53,7 @@ public:
void SetDeleteWithoutExportEvents(int _deltaTime, DWORD _now);
void DeleteExportedEvents();
int Import(IImport::ImportType type, const std::vector<HANDLE>& contacts);
- bool Import(IImport::ImportType type, std::vector<IImport::ExternalMessage>& eventList, std::wstring* err = NULL);
+ bool Import(IImport::ImportType type, std::vector<IImport::ExternalMessage>& eventList, std::wstring* err = NULL, bool* differentContact = NULL, std::vector<HANDLE>* contacts = NULL);
static const TCHAR* GetExt(IImport::ImportType type);
};
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);
}
}
diff --git a/plugins/BasicHistory/src/version.h b/plugins/BasicHistory/src/version.h
index d2d290a8c5..d3520c5830 100644
--- a/plugins/BasicHistory/src/version.h
+++ b/plugins/BasicHistory/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 1
#define __MINOR_VERSION 0
#define __RELEASE_NUM 1
-#define __BUILD_NUM 8
+#define __BUILD_NUM 9
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM