From 3d26dc75537137d829cc388abe0b9fe4b2df0d9d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 2 Mar 2013 13:38:53 +0000 Subject: unicode folders custom names (gotten from szName by default, as usual) git-svn-id: http://svn.miranda-ng.org/main/trunk@3835 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Folders/src/dlg_handlers.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'plugins/Folders/src/dlg_handlers.cpp') diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp index d36a68ebc3..8bd851f207 100644 --- a/plugins/Folders/src/dlg_handlers.cpp +++ b/plugins/Folders/src/dlg_handlers.cpp @@ -14,19 +14,11 @@ int GetCurrentSectionSelection(HWND hWnd) return SendDlgItemMessage(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_GETCURSEL, 0, 0); } -PFolderItem GetSelectedItem(HWND hWnd) -{ - char section[MAX_FOLDER_SIZE], item[MAX_FOLDER_SIZE]; - GetCurrentItemText(hWnd, item, MAX_FOLDER_SIZE); - GetCurrentSectionText(hWnd, section, MAX_FOLDER_SIZE); - return lstRegisteredFolders.GetTranslated(section, item); -} - -int GetCurrentItemText(HWND hWnd, char *buffer, int count) +int GetCurrentItemText(HWND hWnd, TCHAR *buffer, int count) { int index = GetCurrentItemSelection(hWnd); if (index != LB_ERR) { - SendDlgItemMessageA(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETTEXT, index, (LPARAM) buffer); + SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETTEXT, index, (LPARAM)buffer); return 1; } @@ -38,12 +30,21 @@ int GetCurrentSectionText(HWND hWnd, char *buffer, int count) { int index = GetCurrentSectionSelection(hWnd); if (index != LB_ERR) - SendDlgItemMessageA(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_GETTEXT, index, (LPARAM) buffer); + SendDlgItemMessageA(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_GETTEXT, index, (LPARAM)buffer); else buffer[0] = L'0'; return index; } +PFolderItem GetSelectedItem(HWND hWnd) +{ + char section[MAX_FOLDER_SIZE]; + TCHAR item[MAX_FOLDER_SIZE]; + GetCurrentItemText(hWnd, item, MAX_FOLDER_SIZE); + GetCurrentSectionText(hWnd, section, MAX_FOLDER_SIZE); + return lstRegisteredFolders.GetTranslated(section, item); +} + static void GetEditText(HWND hWnd, TCHAR *buffer, int size) { GetWindowText( GetDlgItem(hWnd, IDC_FOLDER_EDIT), buffer, size); @@ -87,10 +88,8 @@ void LoadRegisteredFolderItems(HWND hWnd) for (int i = 0; i < lstRegisteredFolders.Count(); i++) { PFolderItem item = lstRegisteredFolders.Get(i + 1); - if ( !strcmp(szSection, item->GetSection())) { - mir_ptr wide( mir_a2t( item->GetName())); - SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_ADDSTRING, 0, (LPARAM)TranslateTS(wide)); - } + if ( !strcmp(szSection, item->GetSection())) + SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_ADDSTRING, 0, (LPARAM)TranslateTS(item->GetUserName())); } SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_SETCURSEL, 0, 0); //select the first item PostMessage(hWnd, WM_COMMAND, MAKEWPARAM(IDC_FOLDERS_ITEMS_LIST, LBN_SELCHANGE), 0); //tell the dialog to refresh the preview -- cgit v1.2.3