summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-12 16:50:32 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-12 16:50:32 +0300
commit6f519be8984e1c57d0bec611cd4cfacf85679d4b (patch)
treee091de1efb05cd6f5c2d619f4a6a9ffc0c1f5968 /src
parente5e7844eb8306f84bb9de0024216d22a855a1816 (diff)
option to leave downloaded cloud files untouched when the history event with this file is removed
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/res/resource.rc16
-rw-r--r--src/mir_app/src/file.cpp23
-rw-r--r--src/mir_app/src/file.h2
-rw-r--r--src/mir_app/src/fileopts.cpp4
-rw-r--r--src/mir_app/src/resource.h3
5 files changed, 34 insertions, 14 deletions
diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc
index 69f5a92395..3a4e9b506f 100644
--- a/src/mir_app/res/resource.rc
+++ b/src/mir_app/res/resource.rc
@@ -1144,13 +1144,15 @@ BEGIN
LTEXT "You will always be asked about files from people not on your contact list",IDC_STATIC,13,117,296,10
LTEXT "If incoming files already exist",IDC_STATIC,14,102,172,8
COMBOBOX IDC_FILEEXISTS,193,100,100,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
- GROUPBOX "Cloud files",IDC_STATIC,5,134,302,43
+ GROUPBOX "Cloud files",IDC_STATIC,5,134,302,58
CONTROL "Download cloud files automatically",IDC_OFFLINE_AUTO,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,148,288,10
RTEXT "Only if their size is less than",IDC_STATIC,12,162,143,8
EDITTEXT IDC_OFFLINE_AUTOSIZE,159,160,40,12,ES_AUTOHSCROLL
CONTROL "",IDC_OFFLINE_AUTOSIZE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,188,159,11,14
LTEXT "KBytes (0 - always)",IDC_STATIC,202,162,101,8
+ CONTROL "Remove cached files when an event is deleted",IDC_OFFLINE_DELETE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,176,288,10
END
IDD_OPT_FILESECURITY DIALOGEX 0, 0, 313, 243
@@ -1765,10 +1767,22 @@ BEGIN
END
END
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AFX_DIALOG_LAYOUT
+//
+
+IDD_OPT_FILEGENERAL AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
+
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/mir_app/src/file.cpp b/src/mir_app/src/file.cpp
index 7410ac05f4..9547d0eb2d 100644
--- a/src/mir_app/src/file.cpp
+++ b/src/mir_app/src/file.cpp
@@ -33,6 +33,7 @@ CMOption<bool> File::bAutoClear(SRFILEMODULE, "AutoClear", true);
CMOption<bool> File::bAutoClose(SRFILEMODULE, "AutoClose", false);
CMOption<bool> File::bAutoAccept(SRFILEMODULE, "AutoAccept", false);
CMOption<bool> File::bOfflineAuto(SRFILEMODULE, "OfflineAuto", true);
+CMOption<bool> File::bOfflineDelete(SRFILEMODULE, "OfflineDelete", true);
CMOption<bool> File::bReverseOrder(SRFILEMODULE, "ReverseOrder", false);
CMOption<bool> File::bWarnBeforeOpening(SRFILEMODULE, "WarnBeforeOpening", true);
@@ -171,16 +172,18 @@ static int SRFilePreShutdown(WPARAM, LPARAM)
static int SRFileEventDeleted(WPARAM hContact, LPARAM hDbEvent)
{
- DB::EventInfo dbei(hDbEvent);
- if (dbei && dbei.eventType == EVENTTYPE_FILE) {
- DB::FILE_BLOB blob(dbei);
- if (auto *pwszName = blob.getLocalName()) {
- wchar_t wszReceiveFolder[MAX_PATH];
- GetContactSentFilesDir(hContact, wszReceiveFolder, _countof(wszReceiveFolder));
-
- // we don't remove sent files, located outside Miranda's folder for sent offline files
- if ((dbei.flags & DBEF_SENT) == 0 || !wcsnicmp(pwszName, wszReceiveFolder, wcslen(wszReceiveFolder)))
- DeleteFileW(pwszName);
+ if (File::bOfflineAuto) {
+ DB::EventInfo dbei(hDbEvent);
+ if (dbei && dbei.eventType == EVENTTYPE_FILE) {
+ DB::FILE_BLOB blob(dbei);
+ if (auto *pwszName = blob.getLocalName()) {
+ wchar_t wszReceiveFolder[MAX_PATH];
+ GetContactSentFilesDir(hContact, wszReceiveFolder, _countof(wszReceiveFolder));
+
+ // we don't remove sent files, located outside Miranda's folder for sent offline files
+ if ((dbei.flags & DBEF_SENT) == 0 || !wcsnicmp(pwszName, wszReceiveFolder, wcslen(wszReceiveFolder)))
+ DeleteFileW(pwszName);
+ }
}
}
diff --git a/src/mir_app/src/file.h b/src/mir_app/src/file.h
index 28ce186397..01b7b47fab 100644
--- a/src/mir_app/src/file.h
+++ b/src/mir_app/src/file.h
@@ -112,7 +112,7 @@ extern MWindowList g_hFileWindows;
namespace File
{
extern CMOption<bool> bAutoMin, bAutoClear, bAutoClose, bAutoAccept, bReverseOrder;
- extern CMOption<bool> bWarnBeforeOpening, bOfflineAuto;
+ extern CMOption<bool> bWarnBeforeOpening, bOfflineAuto, bOfflineDelete;
extern CMOption<uint8_t> iIfExists, iUseScanner;
extern CMOption<uint32_t> iOfflineSize;
extern CMOption<wchar_t*> wszSaveDir, wszScanCmdLine;
diff --git a/src/mir_app/src/fileopts.cpp b/src/mir_app/src/fileopts.cpp
index 51fcc797e6..9d550c9f67 100644
--- a/src/mir_app/src/fileopts.cpp
+++ b/src/mir_app/src/fileopts.cpp
@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
class CFileGeneralOptsDlg : public CDlgBase
{
CCtrlSpin spinSize;
- CCtrlCheck chkAutoMin, chkAutoClear, chkAutoClose, chkAutoAccept, chkReverseOrder, chkOfflineAuto;
+ CCtrlCheck chkAutoMin, chkAutoClear, chkAutoClose, chkAutoAccept, chkReverseOrder, chkOfflineAuto, chkOfflineDelete;
CCtrlCombo cmbFileExists;
CCtrlButton btnFileDir;
@@ -44,6 +44,7 @@ public:
chkAutoClose(this, IDC_AUTOCLOSE),
chkAutoAccept(this, IDC_AUTOACCEPT),
chkOfflineAuto(this, IDC_OFFLINE_AUTO),
+ chkOfflineDelete(this, IDC_OFFLINE_DELETE),
cmbFileExists(this, IDC_FILEEXISTS),
chkReverseOrder(this, IDC_REVERSE_ORDER),
spinSize(this, IDC_OFFLINE_AUTOSIZE_SPIN, 10000)
@@ -54,6 +55,7 @@ public:
CreateLink(chkAutoClose, File::bAutoClose);
CreateLink(chkAutoAccept, File::bAutoAccept);
CreateLink(chkOfflineAuto, File::bOfflineAuto);
+ CreateLink(chkOfflineDelete, File::bOfflineDelete);
CreateLink(chkReverseOrder, File::bReverseOrder);
btnFileDir.OnClick = Callback(this, &CFileGeneralOptsDlg::onClick_FileDir);
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h
index 9787221267..e6bf49bc6d 100644
--- a/src/mir_app/src/resource.h
+++ b/src/mir_app/src/resource.h
@@ -598,6 +598,7 @@
#define IDC_OFFLINE_AUTO 1756
#define IDC_OFFLINE_AUTOSIZE 1757
#define IDC_OFFLINE_AUTOSIZE_SPIN 1758
+#define IDC_OFFLINE_DELETE 1759
#define IDC_SHOWPASSWORD 1760
#define IDC_EFFECT_COLOUR_TEXT1 1853
#define IDC_EFFECT_COLOUR_SPIN1 1854
@@ -691,7 +692,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 339
+#define _APS_NEXT_RESOURCE_VALUE 340
#define _APS_NEXT_COMMAND_VALUE 40018
#define _APS_NEXT_CONTROL_VALUE 1761
#define _APS_NEXT_SYMED_VALUE 101