From 31227b632831b50417766926d5a953caf819e71d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 30 May 2019 21:38:21 +0300 Subject: SmileyAdd: fix for incorrectly adapted dialog procedure --- plugins/SmileyAdd/src/download.cpp | 3 +++ plugins/SmileyAdd/src/options.cpp | 9 ++++++++- plugins/SmileyAdd/src/services.cpp | 2 +- plugins/SmileyAdd/src/smileys.cpp | 21 +++++++++++++-------- 4 files changed, 25 insertions(+), 10 deletions(-) (limited to 'plugins/SmileyAdd/src') diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 5cbf42efc9..17a203bc68 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -221,6 +221,9 @@ int FolderChanged(WPARAM, LPARAM) { FoldersGetCustomPathT(hFolderCache, g_wszCachePath, MAX_PATH, L""); FoldersGetCustomPathT(hFolderPacks, g_plugin.wszDefaultPath, MAX_PATH, L"Smileys"); + size_t len = mir_wstrlen(g_plugin.wszDefaultPath); + if (len && g_plugin.wszDefaultPath[len - 1] != '\\') + mir_wstrcpy(g_plugin.wszDefaultPath + len, L"\\"); return 0; } diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 49a180b248..3a857a49bd 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -297,7 +297,6 @@ public: chkStdPack.OnChange = Callback(this, &COptionsDialog::onChange_StdPack); chkUsePhys.OnChange = Callback(this, &COptionsDialog::onChange_UsePhys); - edtFilename.OnChange = Callback(this, &COptionsDialog::onChange_Filename); categories.OnSelChanged = Callback(this, &COptionsDialog::onSelectChange_Tree); categories.OnItemChanged = Callback(this, &COptionsDialog::onChange_Filename); @@ -357,6 +356,14 @@ public: return true; } + INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override + { + if (uMsg == WM_COMMAND && LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) == EN_KILLFOCUS) + onChange_Filename(0); + + return CDlgBase::DlgProc(uMsg, wParam, lParam); + } + bool OnApply() override { ProcessAllInputAreas(true); diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index b7e7e3e066..65cea6dce4 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -440,4 +440,4 @@ int ReloadColour(WPARAM, LPARAM) { opt.SelWndBkgClr = db_get_dw(0, "SmileyAdd", "SelWndBkgClr", GetSysColor(COLOR_WINDOW)); return 0; -} \ No newline at end of file +} diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 118bf70fa6..62621fd297 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -352,15 +352,20 @@ bool SmileyPackType::LoadSmileyFile(const CMStringW &filename, const CMStringW & CMStringW modpath = VARSW(filename); if (_waccess(modpath, 4) != 0) { - if (!noerr) { - static const wchar_t errmsg[] = LPGENW("Smiley pack %s for category \"%s\" not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys."); - wchar_t msgtxt[1024]; - mir_snwprintf(msgtxt, TranslateW(errmsg), modpath.c_str(), packname.c_str()); - ReportError(msgtxt); - } + wchar_t wszTmp[MAX_PATH]; + PathToAbsoluteW(filename, wszTmp, g_plugin.wszDefaultPath); + if (_waccess(wszTmp, 4) != 0) { + if (!noerr) { + static const wchar_t errmsg[] = LPGENW("Smiley pack %s for category \"%s\" not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys."); + wchar_t msgtxt[1024]; + mir_snwprintf(msgtxt, TranslateW(errmsg), modpath.c_str(), packname.c_str()); + ReportError(msgtxt); + } - m_Name = L"Nothing loaded"; - return false; + m_Name = L"Nothing loaded"; + return false; + } + modpath = wszTmp; } m_Filename = filename; -- cgit v1.2.3