diff options
author | Sergey Tatarinov <tatarinov.sergey@gmail.com> | 2014-03-18 15:17:48 +0000 |
---|---|---|
committer | Sergey Tatarinov <tatarinov.sergey@gmail.com> | 2014-03-18 15:17:48 +0000 |
commit | 806c7235a85177c0582a6b3c0f7ce395ffbaec20 (patch) | |
tree | 242391f39c0718f2e10f08e1a7a126c378198b5c /plugins | |
parent | 6b3e9ea9d6481717040ad7a257f14bb83f83eb9d (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')
-rw-r--r-- | plugins/Db_autobackups/res/db_autobackups.rc | 14 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/backup.cpp | 9 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/headers.h | 2 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/main.cpp | 34 |
4 files changed, 45 insertions, 14 deletions
diff --git a/plugins/Db_autobackups/res/db_autobackups.rc b/plugins/Db_autobackups/res/db_autobackups.rc index 5b8954f194..41301d340f 100644 --- a/plugins/Db_autobackups/res/db_autobackups.rc +++ b/plugins/Db_autobackups/res/db_autobackups.rc @@ -38,7 +38,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- GROUPBOX "Automatic backups",IDC_STATIC,6,4,258,209,WS_GROUP
+ GROUPBOX "Automatic backups",IDC_STATIC,6,4,258,205,WS_GROUP
PUSHBUTTON "Backup NOW",IDC_BUT_NOW,173,19,75,14
CONTROL "Disabled",IDC_RAD_DISABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,19,128,10
CONTROL "When Miranda starts",IDC_RAD_START,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,35,156,10
@@ -51,13 +51,13 @@ BEGIN EDITTEXT IDC_ED_NUMBACKUPS,164,90,30,12,ES_NUMBER,WS_EX_RIGHT
CONTROL "",SPIN_NUMBACKUPS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,182,90,10,12
LTEXT "Backup to folder:",IDC_STATIC,18,120,124,11
- EDITTEXT IDC_ED_FOLDER,26,133,168,13,ES_AUTOHSCROLL
+ EDITTEXT IDC_ED_FOLDER,17,133,177,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUT_BROWSE,199,132,49,14
CONTROL "Go to the ""Customize -> Folders"" to change settings",IDC_LNK_FOLDERS,
- "Hyperlink",NOT WS_VISIBLE | WS_TABSTOP,18,129,231,21
- CONTROL "Compress backup to zip-archive",IDC_CHK_USEZIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,156,231,11
- CONTROL "Disable progress bar",IDC_CHK_NOPROG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,174,231,11
- CONTROL "Disable popups",IDC_CHK_NOPOPUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,192,231,11
+ "Hyperlink",NOT WS_VISIBLE | WS_TABSTOP,18,135,231,17
+ CONTROL "Compress backup to zip-archive",IDC_CHK_USEZIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,156,231,10
+ CONTROL "Disable progress bar",IDC_CHK_NOPROG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,172,231,10
+ CONTROL "Disable popups",IDC_CHK_NOPOPUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,188,231,11
END
@@ -85,7 +85,7 @@ BEGIN VERTGUIDE, 193
VERTGUIDE, 248
TOPMARGIN, 38
- BOTTOMMARGIN, 213
+ BOTTOMMARGIN, 209
END
END
#endif // APSTUDIO_INVOKED
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);
|