summaryrefslogtreecommitdiff
path: root/plugins/Db_autobackups/src
diff options
context:
space:
mode:
authorSergey Tatarinov <tatarinov.sergey@gmail.com>2014-03-18 15:17:48 +0000
committerSergey Tatarinov <tatarinov.sergey@gmail.com>2014-03-18 15:17:48 +0000
commit806c7235a85177c0582a6b3c0f7ce395ffbaec20 (patch)
tree242391f39c0718f2e10f08e1a7a126c378198b5c /plugins/Db_autobackups/src
parent6b3e9ea9d6481717040ad7a257f14bb83f83eb9d (diff)
Db_autobackups:
- By clicking on the popup opens the folder with the backup - Minor cosmetics git-svn-id: http://svn.miranda-ng.org/main/trunk@8652 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db_autobackups/src')
-rw-r--r--plugins/Db_autobackups/src/backup.cpp9
-rw-r--r--plugins/Db_autobackups/src/headers.h2
-rw-r--r--plugins/Db_autobackups/src/main.cpp34
3 files changed, 38 insertions, 7 deletions
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp
index 394bf7c552..aa7499131e 100644
--- a/plugins/Db_autobackups/src/backup.cpp
+++ b/plugins/Db_autobackups/src/backup.cpp
@@ -237,7 +237,7 @@ int Backup(TCHAR* backup_filename)
bZip = true;
}
if (!options.disable_popups)
- ShowPopup(dbname, TranslateT("Backup in progress"));
+ ShowPopup(dbname, TranslateT("Backup in progress"), NULL);
if (!options.disable_progress)
progress_dialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcProgress);
@@ -274,7 +274,7 @@ int Backup(TCHAR* backup_filename)
{
int i;
puText = (TCHAR*)mir_alloc(sizeof(TCHAR) * (dest_file_len + 2));
- for(i = (int)dest_file_len - 1; dest_file[i] != _T('\\'); i--);
+ for (i = (int)dest_file_len - 1; dest_file[i] != _T('\\'); i--);
lstrcpyn(puText, dest_file, i + 2);
lstrcat(puText, _T("\n"));
@@ -283,7 +283,10 @@ int Backup(TCHAR* backup_filename)
else
puText = mir_tstrdup(dest_file);
- ShowPopup(puText, TranslateT("Database backed up"));
+ // Now we need to know, which folder we made a backup. Let's break unnecessary variables :)
+ while (dest_file[--dest_file_len] != L'\\');
+ dest_file[dest_file_len] = 0;
+ ShowPopup(puText, TranslateT("Database backed up"), dest_file);
mir_free(puText);
}
}
diff --git a/plugins/Db_autobackups/src/headers.h b/plugins/Db_autobackups/src/headers.h
index 447c2bd885..faec38492e 100644
--- a/plugins/Db_autobackups/src/headers.h
+++ b/plugins/Db_autobackups/src/headers.h
@@ -29,7 +29,7 @@
#define DIR L"%miranda_userdata%"
-void ShowPopup(TCHAR* text, TCHAR* header);
+void ShowPopup(TCHAR* ptszText, TCHAR* ptszHeader, TCHAR* ptszPath);
INT_PTR DBSaveAs(WPARAM wParam, LPARAM lParam);
INT_PTR ABService(WPARAM wParam, LPARAM lParam);
int Backup(TCHAR* backup_filename);
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp
index 4d0f54db90..a078599f50 100644
--- a/plugins/Db_autobackups/src/main.cpp
+++ b/plugins/Db_autobackups/src/main.cpp
@@ -120,12 +120,40 @@ extern "C" __declspec(dllexport) int Unload(void)
return 0;
}
-void ShowPopup(TCHAR* text, TCHAR* header)
+LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg)
+ {
+ case WM_COMMAND:
+ {
+ TCHAR* ptszPath = (TCHAR*)PUGetPluginData(hWnd);
+ if (ptszPath != 0)
+ ShellExecute(0, _T("open"), ptszPath, NULL, NULL, SW_SHOW);
+
+ PUDeletePopup(hWnd);
+ break;
+ }
+ case WM_CONTEXTMENU:
+ PUDeletePopup(hWnd);
+ break;
+
+ case UM_FREEPLUGINDATA:
+ TCHAR* ptszPath = (TCHAR*)PUGetPluginData(hWnd);
+ mir_free(ptszPath);
+ break;
+ }
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+}
+
+void ShowPopup(TCHAR* ptszText, TCHAR* ptszHeader, TCHAR* ptszPath)
{
POPUPDATAT ppd = {0};
- lstrcpy(ppd.lptzText, text);
- lstrcpy(ppd.lptzContactName, header);
+ lstrcpy(ppd.lptzText, ptszText);
+ lstrcpy(ppd.lptzContactName, ptszHeader);
+ if (ptszPath != NULL)
+ ppd.PluginData = (void*)mir_tstrdup(ptszPath);
+ ppd.PluginWindowProc = DlgProcPopup;
ppd.lchIcon = Skin_GetIconByHandle(iconList[0].hIcolib);
PUAddPopupT(&ppd);