diff options
author | Robert Pösel <robyer@seznam.cz> | 2017-02-06 02:45:32 +0100 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2017-02-06 02:45:32 +0100 |
commit | 6807cde64f65d5fa6617c8c29f7e2aa00cbc5b6d (patch) | |
tree | 8768fbb8905a3b60525f727d9616052806d00d82 /plugins/Msg_Export | |
parent | d980ff0b1d69136793e39f4b67c6db4164742326 (diff) |
Msg_Export: Fix progress dialog processing
Diffstat (limited to 'plugins/Msg_Export')
-rwxr-xr-x | plugins/Msg_Export/src/options.cpp | 45 | ||||
-rw-r--r-- | plugins/Msg_Export/src/version.h | 2 |
2 files changed, 22 insertions, 25 deletions
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 0f2c960192..575eed291c 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -142,38 +142,30 @@ INT_PTR CALLBACK __stdcall DialogProc( return FALSE;
}
+struct ExportDialogData {
+ list<MCONTACT> contacts;
+ HWND hDialog;
+};
+
void exportContactsMessages(void *p)
{
- list< MCONTACT > *contacts = (list< MCONTACT >*)p;
-
- HWND hParent = NULL;
- HWND hDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), hParent, DialogProc);
+ ExportDialogData *data = (ExportDialogData *)p;
+
+ HWND hDlg = data->hDialog;
HWND hProg = GetDlgItem(hDlg, IDC_EXPORT_PROGRESS);
HWND hStatus = GetDlgItem(hDlg, IDC_EXP_ALL_STATUS);
- SendMessage(hProg, PBM_SETRANGE, 0, MAKELPARAM(0, contacts->size() - 1));
-
+ ShowWindow(hDlg, SW_SHOWNORMAL);
+ SendMessage(hProg, PBM_SETRANGE, 0, MAKELPARAM(0, data->contacts.size() - 1));
SetWindowText(hStatus, TranslateT("Reading database information (Phase 1 of 2)"));
- // position and show proigrassbar dialog
- /*RECT rParrent, rDlg;
- if (GetWindowRect(hParent, &rParrent) && GetWindowRect(hDlg, &rDlg)) {
- int x = ((rParrent.right + rParrent.left) / 2) - ((rDlg.right - rDlg.left) / 2);
- int y = ((rParrent.bottom + rParrent.top) / 2) - ((rDlg.bottom - rDlg.top) / 2);
- SetWindowPos(hDlg, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
- }
- else*/ ShowWindow(hDlg, SW_SHOWNORMAL);
-
// map with list to stored all DB history before it is exported
map<tstring, list< CLDBEvent >, less<tstring> > AllEvents;
{
// reading from the database !!!
- LVITEM sItem = { 0 };
- sItem.mask = LVIF_PARAM;
-
int nCur = 0;
list< MCONTACT >::const_iterator iterator;
- for (iterator = contacts->begin(); iterator != contacts->end(); ++iterator) {
+ for (iterator = data->contacts.begin(); iterator != data->contacts.end(); ++iterator) {
MCONTACT hContact = (*iterator);
// Check if we should ignore this contact/protocol
@@ -194,8 +186,8 @@ void exportContactsMessages(void *p) nCur++;
}
// Free the list of contacts
- contacts->clear();
- delete contacts;
+ data->contacts.clear();
+ delete data;
}
// window text update
@@ -276,8 +268,9 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected) return 0;
}
+ ExportDialogData *data = new ExportDialogData();
+
// List all contacts to export
- list<MCONTACT> *contacts = new list<MCONTACT>();
{
LVITEM sItem = { 0 };
sItem.mask = LVIF_PARAM;
@@ -294,11 +287,15 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected) }
MCONTACT hContact = (MCONTACT)sItem.lParam;
- contacts->push_back(hContact);
+ data->contacts.push_back(hContact);
}
}
- mir_forkthread(&exportContactsMessages, contacts);
+ // Create progress dialog
+ HWND hDlg = data->hDialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), NULL, DialogProc);
+
+ // Process the export in other thread
+ mir_forkthread(&exportContactsMessages, data);
return 0;
}
diff --git a/plugins/Msg_Export/src/version.h b/plugins/Msg_Export/src/version.h index 98ef00069f..1fb8db0a3e 100644 --- a/plugins/Msg_Export/src/version.h +++ b/plugins/Msg_Export/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3 #define __MINOR_VERSION 1 #define __RELEASE_NUM 2 -#define __BUILD_NUM 0 +#define __BUILD_NUM 1 #include <stdver.h> |