From 5c4b80a068ed7b305e68071d39c99a6c98a9ed2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sat, 15 Jun 2013 21:04:25 +0000 Subject: PluginUpdater: Ignore char case for unchecked items git-svn-id: http://svn.miranda-ng.org/main/trunk@4965 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/Common.h | 2 ++ plugins/PluginUpdater/src/DlgUpdate.cpp | 6 +++--- plugins/PluginUpdater/src/Utils.cpp | 10 ++++++++++ plugins/PluginUpdater/src/unzipfile.cpp | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h index 1066fb126e..7bdcd8e871 100644 --- a/plugins/PluginUpdater/src/Common.h +++ b/plugins/PluginUpdater/src/Common.h @@ -205,3 +205,5 @@ int SafeCopyFile(const TCHAR *ptszSrc, const TCHAR *ptszDst); int SafeMoveFile(const TCHAR *ptszSrc, const TCHAR *ptszDst); int SafeDeleteFile(const TCHAR *ptszSrc); int SafeCreateFilePath(TCHAR *pFolder); + +char *StrToLower(char *str); diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 42d005a047..92594dfe11 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -28,7 +28,7 @@ static void SelectAll(HWND hDlg, bool bEnable) for (int i=0; i < todo.getCount(); i++) { ListView_SetCheckState(hwndList, i, bEnable); - db_set_b(NULL, MODNAME "Files", _T2A(todo[i].tszOldName), todo[i].bEnabled = bEnable); + db_set_b(NULL, MODNAME "Files", StrToLower(_T2A(todo[i].tszOldName)), todo[i].bEnabled = bEnable); } } @@ -213,7 +213,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM ListView_InsertItem(hwndList, &lvI); // remember whether the user has decided not to update this component with this particular new version - todo[i].bEnabled = db_get_b(NULL, MODNAME "Files", _T2A(todo[i].tszOldName), true); + todo[i].bEnabled = db_get_b(NULL, MODNAME "Files", StrToLower(_T2A(todo[i].tszOldName)), true); ListView_SetCheckState(hwndList, lvI.iItem, todo[i].bEnabled); if (todo[i].bEnabled) enableOk = true; @@ -246,7 +246,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM OBJLIST &todo = *(OBJLIST *)GetWindowLongPtr(hDlg, GWLP_USERDATA); if ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK) { todo[lvI.iItem].bEnabled = ListView_GetCheckState(hwndList, nmlv->iItem); - db_set_b(NULL, MODNAME "Files", _T2A(todo[lvI.iItem].tszOldName), todo[lvI.iItem].bEnabled); + db_set_b(NULL, MODNAME "Files", StrToLower(_T2A(todo[lvI.iItem].tszOldName)), todo[lvI.iItem].bEnabled); bool enableOk = false; for (int i=0; i < todo.getCount(); ++i) { diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index f98f990ce7..fb499aa860 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -685,3 +685,13 @@ int SafeCreateFilePath(TCHAR *pFolder) return TransactPipe(5, pFolder, NULL); } + +///////////////////////////////////////////////////////////////////////////////////////// + +char *StrToLower(char *str) +{ + for (int i = 0; str[i]; i++) { + str[i] = tolower(str[i]); + } + return str; +} \ No newline at end of file diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index a20fad318f..ece6a2866d 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -58,7 +58,7 @@ bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath) for (char *p = strchr(filename, '/'); p; p = strchr(p+1, '/')) *p = '\\'; - if (!db_get_b(NULL, MODNAME "Files", filename, true)) + if (!db_get_b(NULL, MODNAME "Files", StrToLower(ptrA(filename)), true)) return true; TCHAR tszDestFile[MAX_PATH], tszBackFile[MAX_PATH]; -- cgit v1.2.3