summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-06-05 18:22:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-06-05 18:22:50 +0300
commit831c2848c6e80af2ce0a11f9e82de371ae9da94a (patch)
treecf22b3446624314be4b1c904c182052987ed3ab4
parentae4f6357ef47d59cd13cf0da2ce8d730313ca6b7 (diff)
Plugin Updater: more code cleaning
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index a5fdbb2abf..eb47dd41d1 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -23,17 +23,6 @@ static bool bShowDetails;
static HWND hwndDialog;
static HANDLE hCheckThread, hTimer;
-static void SelectAll(HWND hDlg, bool bEnable)
-{
- OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES);
-
- for (auto &it : todo) {
- ListView_SetCheckState(hwndList, todo.indexOf(&it), bEnable);
- db_set_b(0, DB_MODULE_FILES, StrToLower(_T2A(it->tszOldName)), it->bEnabled = bEnable);
- }
-}
-
class CUpdateDLg : public CDlgBase
{
bool bThreadActive = false;
@@ -169,6 +158,16 @@ class CUpdateDLg : public CDlgBase
SetWindowPos(m_hwnd, nullptr, 0, 0, r.right, r.bottom, SWP_NOMOVE | SWP_NOZORDER);
}
+ void SelectAll(bool bEnable)
+ {
+ for (auto &it : *m_todo) {
+ m_list.SetCheckState(m_todo->indexOf(&it), bEnable);
+
+ CMStringA szSetting(it->tszOldName);
+ db_set_b(0, DB_MODULE_FILES, StrToLower(szSetting.GetBuffer()), it->bEnabled = bEnable);
+ }
+ }
+
public:
CUpdateDLg(OBJLIST<FILEINFO> *param) :
CDlgBase(g_plugin, IDD_UPDATE),
@@ -314,7 +313,8 @@ public:
m_list.GetItem(&lvI);
FILEINFO *p = (FILEINFO *)lvI.lParam;
- db_set_b(0, DB_MODULE_FILES, StrToLower(_T2A(p->tszOldName)), p->bEnabled = m_list.GetCheckState(nmlv->iItem));
+ CMStringA szSetting(p->tszOldName);
+ db_set_b(0, DB_MODULE_FILES, StrToLower(szSetting.GetBuffer()), p->bEnabled = m_list.GetCheckState(nmlv->iItem));
// Toggle the Download button
bool enableOk = false;
@@ -345,12 +345,12 @@ public:
void onClick_SelAll(CCtrlButton *)
{
- SelectAll(m_hwnd, true);
+ SelectAll(true);
}
void onClick_SelNone(CCtrlButton *)
{
- SelectAll(m_hwnd, false);
+ SelectAll(false);
}
void ShowError()
@@ -712,7 +712,8 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t
MyCRC = 0;
}
- int bEnabled = db_get_b(0, DB_MODULE_FILES, StrToLower(_T2A(tszBuf + cbBaseLen)), 1);
+ CMStringA szSetting(tszBuf + cbBaseLen);
+ int bEnabled = db_get_b(0, DB_MODULE_FILES, StrToLower(szSetting.GetBuffer()), 1);
if (bEnabled == 2) // hidden database setting to exclude a plugin from list
continue;
@@ -806,7 +807,6 @@ static void DoCheck(bool bSilent = true)
}
else {
g_plugin.bSilent = bSilent;
-
g_plugin.setDword(DB_SETTING_LAST_UPDATE, time(0));
hCheckThread = mir_forkthread(CheckUpdates);