summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-12-27 22:28:26 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-12-27 22:28:26 +0300
commitfb71782e69b104fdba85957e22976c397c4845eb (patch)
treeb3364bbdc243be43668a348f44e64d3df49ec489
parenteae122c522acf00d2ee3d85988c811794a3b25fc (diff)
fixes #2659 (Не сохраняются изменения радиобатонов в настройках файлтрансферов)
-rw-r--r--src/core/stdfile/res/resource.rc2
-rw-r--r--src/core/stdfile/src/fileopts.cpp48
2 files changed, 26 insertions, 24 deletions
diff --git a/src/core/stdfile/res/resource.rc b/src/core/stdfile/res/resource.rc
index ea8c40fd57..d989716f8c 100644
--- a/src/core/stdfile/res/resource.rc
+++ b/src/core/stdfile/res/resource.rc
@@ -177,7 +177,7 @@ BEGIN
"Button",BS_AUTORADIOBUTTON,52,124,250,10
CONTROL "As each file finishes downloading",IDC_SCANDURINGDL,
"Button",BS_AUTORADIOBUTTON,52,136,250,10
- LTEXT "Command line:",IDC_ST_CMDLINE,7,161,62,8
+ LTEXT "Command line:",IDC_ST_CMDLINE,7,152,62,8
COMBOBOX IDC_SCANCMDLINE,70,151,213,71,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_SCANCMDLINEBROWSE,287,151,15,13
LTEXT "%f will be replaced by the file or folder name to be scanned",IDC_ST_CMDLINEHELP,70,165,232,8
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp
index 970899a4a0..cabbcdeba9 100644
--- a/src/core/stdfile/src/fileopts.cpp
+++ b/src/core/stdfile/src/fileopts.cpp
@@ -56,7 +56,8 @@ static virusScanners[] =
class CFileOptsDlg : public CDlgBase
{
CCtrlButton btnFileDir, btnScanCmdLine;
- CCtrlCheck chkAutoMin, chkAutoClear, chkAutoClose, chkAutoAccept, chkReverseOrder, chkNoScanner;
+ CCtrlCheck chkAutoMin, chkAutoClear, chkAutoClose, chkAutoAccept, chkReverseOrder;
+ CCtrlCheck chkNoScanner, chkScanDuringDl, chkScanAfterDl;
CCtrlCombo cmbScanCmdLine;
public:
@@ -67,9 +68,13 @@ public:
chkAutoMin(this, IDC_AUTOMIN),
chkAutoClear(this, IDC_AUTOCLEAR),
chkAutoClose(this, IDC_AUTOCLOSE),
- chkNoScanner(this, IDC_NOSCANNER),
chkAutoAccept(this, IDC_AUTOACCEPT),
chkReverseOrder(this, IDC_REVERSE_ORDER),
+
+ chkNoScanner(this, IDC_NOSCANNER),
+ chkScanAfterDl(this, IDC_SCANAFTERDL),
+ chkScanDuringDl(this, IDC_SCANDURINGDL),
+
cmbScanCmdLine(this, IDC_SCANCMDLINE)
{
CreateLink(chkAutoMin, g_plugin.bAutoMin);
@@ -95,31 +100,28 @@ public:
SetDlgItemText(m_hwnd, IDC_FILEDIR, str);
switch (g_plugin.getByte("UseScanner", VIRUSSCAN_DISABLE)) {
- case VIRUSSCAN_AFTERDL: CheckDlgButton(m_hwnd, IDC_SCANAFTERDL, BST_CHECKED); break;
- case VIRUSSCAN_DURINGDL: CheckDlgButton(m_hwnd, IDC_SCANDURINGDL, BST_CHECKED); break;
- default: CheckDlgButton(m_hwnd, IDC_NOSCANNER, BST_CHECKED); break;
+ case VIRUSSCAN_AFTERDL: chkScanAfterDl.SetState(true); break;
+ case VIRUSSCAN_DURINGDL: chkScanDuringDl.SetState(true); break;
+ default: chkNoScanner.SetState(true); break;
}
CheckDlgButton(m_hwnd, IDC_WARNBEFOREOPENING, g_plugin.getByte("WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED);
for (int i = 0; i < _countof(virusScanners); i++) {
wchar_t szScanExe[MAX_PATH];
- if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[i].szExeRegPath, virusScanners[i].szExeRegValue, szScanExe, _countof(szScanExe))) {
- int iItem = SendDlgItemMessage(m_hwnd, IDC_SCANCMDLINE, CB_ADDSTRING, 0, (LPARAM)virusScanners[i].szProductName);
- SendDlgItemMessage(m_hwnd, IDC_SCANCMDLINE, CB_SETITEMDATA, iItem, i);
- }
- }
- if (SendDlgItemMessageA(m_hwnd, IDC_SCANCMDLINE, CB_GETCOUNT, 0, 0) == 0) {
- int iItem = SendDlgItemMessage(m_hwnd, IDC_SCANCMDLINE, CB_ADDSTRING, 0, (LPARAM)L"");
- SendDlgItemMessage(m_hwnd, IDC_SCANCMDLINE, CB_SETITEMDATA, iItem, (LPARAM)-1);
+ if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[i].szExeRegPath, virusScanners[i].szExeRegValue, szScanExe, _countof(szScanExe)))
+ cmbScanCmdLine.AddString(virusScanners[i].szProductName, i);
}
+
+ if (!cmbScanCmdLine.GetCount())
+ cmbScanCmdLine.AddString(L"", -1);
DBVARIANT dbv;
if (g_plugin.getWString("ScanCmdLine", &dbv) == 0) {
- SetDlgItemText(m_hwnd, IDC_SCANCMDLINE, dbv.pwszVal);
+ cmbScanCmdLine.SetText(dbv.pwszVal);
db_free(&dbv);
}
- else if (SendDlgItemMessage(m_hwnd, IDC_SCANCMDLINE, CB_GETCOUNT, 0, 0)) {
- SendDlgItemMessage(m_hwnd, IDC_SCANCMDLINE, CB_SETCURSEL, 0, 0);
+ else if (cmbScanCmdLine.GetCount()) {
+ cmbScanCmdLine.SetCurSel(0);
onSelChanged_Combo(0);
}
@@ -142,10 +144,10 @@ public:
RemoveInvalidPathChars(str);
g_plugin.setWString("RecvFilesDirAdv", str);
- GetDlgItemText(m_hwnd, IDC_SCANCMDLINE, str, _countof(str));
+ cmbScanCmdLine.GetText(str, _countof(str));
g_plugin.setWString("ScanCmdLine", str);
- g_plugin.setByte("UseScanner", (BYTE)(IsDlgButtonChecked(m_hwnd, IDC_SCANAFTERDL) ? VIRUSSCAN_AFTERDL : (IsDlgButtonChecked(m_hwnd, IDC_SCANDURINGDL) ? VIRUSSCAN_DURINGDL : VIRUSSCAN_DISABLE)));
+ g_plugin.setByte("UseScanner", chkScanAfterDl.GetState() ? VIRUSSCAN_AFTERDL : (chkScanDuringDl.GetState() ? VIRUSSCAN_DURINGDL : VIRUSSCAN_DISABLE));
g_plugin.setByte("WarnBeforeOpening", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_WARNBEFOREOPENING));
g_plugin.setByte("IfExists", (BYTE)(IsDlgButtonChecked(m_hwnd, IDC_ASK) ? FILERESUME_ASK :
(IsDlgButtonChecked(m_hwnd, IDC_RESUME) ? FILERESUME_RESUMEALL :
@@ -162,14 +164,14 @@ public:
{
bool bEnabled = chkNoScanner.GetState();
btnScanCmdLine.Enable(bEnabled);
+ cmbScanCmdLine.Enable(bEnabled);
EnableWindow(GetDlgItem(m_hwnd, IDC_ST_CMDLINE), bEnabled);
- EnableWindow(GetDlgItem(m_hwnd, IDC_SCANCMDLINE), bEnabled);
EnableWindow(GetDlgItem(m_hwnd, IDC_ST_CMDLINEHELP), bEnabled);
}
void onSelChanged_Combo(CCtrlCombo*)
{
- int iScanner = SendDlgItemMessage(m_hwnd, IDC_SCANCMDLINE, CB_GETITEMDATA, SendDlgItemMessage(m_hwnd, IDC_SCANCMDLINE, CB_GETCURSEL, 0, 0), 0);
+ int iScanner = cmbScanCmdLine.GetItemData(cmbScanCmdLine.GetCurSel());
if (iScanner >= _countof(virusScanners) || iScanner < 0)
return;
@@ -178,7 +180,7 @@ public:
mir_snwprintf(str, virusScanners[iScanner].szCommandLine, szScanExe);
else
str[0] = 0;
- SetDlgItemText(m_hwnd, IDC_SCANCMDLINE, str);
+ cmbScanCmdLine.SetText(str);
}
void onClick_FileDir(CCtrlButton*)
@@ -192,7 +194,7 @@ public:
void onClick_ScanCmdLine(CCtrlButton*)
{
wchar_t str[MAX_PATH + 2];
- GetDlgItemText(m_hwnd, IDC_SCANCMDLINE, str, _countof(str));
+ cmbScanCmdLine.GetText(str, _countof(str));
CMStringW tszFilter;
tszFilter.AppendFormat(L"%s (*.exe)%c*.exe%c", TranslateT("Executable files"), 0, 0);
@@ -224,7 +226,7 @@ public:
str[0] = '"';
mir_wstrcat(str, L"\"");
}
- SetDlgItemText(m_hwnd, IDC_SCANCMDLINE, str);
+ cmbScanCmdLine.SetText(str);
}
};