Index: ap_Win32Dialog_New.cpp =================================================================== --- ap_Win32Dialog_New.cpp (revision 29473) +++ ap_Win32Dialog_New.cpp (working copy) @@ -110,59 +110,41 @@ long findtag; struct _finddata_t cfile; UT_String templateName, searchDir; - templateName = XAP_App::getApp()->getUserPrivateDirectory(); - searchDir = XAP_App::getApp()->getUserPrivateDirectory(); - searchDir += "\\templates\\*.awt"; - findtag = _findfirst( searchDir.c_str(), &cfile ); - if( findtag != -1 ) - { - do - { - templateName = XAP_App::getApp()->getUserPrivateDirectory(); - templateName += "\\templates\\"; - templateName += cfile.name; - if(!strstr(templateName.c_str(), "normal.awt-")) // don't truncate localized template names - templateName = templateName.substr ( 0, templateName.size () - 4 ) ; + UT_String dirName[2]; - UT_Win32LocaleString str; - str.fromASCII (templateName.c_str()); - char *uri = UT_go_filename_to_uri(str.utf8_str().utf8_str()); - UT_continue_if_fail(uri); + dirName[0] = XAP_App::getApp()->getUserPrivateDirectory(); + dirName[1] = XAP_App::getApp()->getAbiSuiteLibDir(); - UT_sint32 nIndex = SendMessageW( hControl, LB_ADDSTRING, 0, (LPARAM) UT_basename( uri ) ); - SendMessageW( hControl, LB_SETITEMDATA, (WPARAM) nIndex, (LPARAM) 0 ); + for (int i=0; i<2; i++) { + templateName = dirName[i]; + searchDir = templateName; + searchDir += "\\templates\\*.awt"; + findtag = _findfirst( searchDir.c_str(), &cfile ); + if( findtag != -1 ) + { + do + { + templateName = dirName[i]; + templateName += "\\templates\\"; + templateName += cfile.name; + if(!strstr(templateName.c_str(), "normal.awt-")) // don't truncate localized template names + templateName = templateName.substr ( 0, templateName.size () - 4 ) ; - g_free(uri); - } while( _findnext( findtag, &cfile ) == 0 ); - } - _findclose( findtag ); + UT_Win32LocaleString str; + str.fromASCII (templateName.c_str()); + char *uri = UT_go_filename_to_uri(str.utf8_str().utf8_str()); + UT_continue_if_fail(uri); - templateName = XAP_App::getApp()->getAbiSuiteLibDir(); - searchDir = XAP_App::getApp()->getAbiSuiteLibDir(); - searchDir += "\\templates\\*.awt"; - findtag = _findfirst( searchDir.c_str(), &cfile ); - if( findtag != -1 ) - { - do - { - templateName = XAP_App::getApp()->getAbiSuiteLibDir(); - templateName += "\\templates\\"; - templateName += cfile.name; - if(!strstr(templateName.c_str(), "normal.awt-")) // don't truncate localized template names - templateName = templateName.substr ( 0, templateName.size () - 4 ) ; + str.fromUTF8(UT_basename( uri )); - UT_Win32LocaleString str; - str.fromASCII (templateName.c_str()); - char *uri = UT_go_filename_to_uri(str.utf8_str().utf8_str()); - UT_continue_if_fail(uri); + UT_sint32 nIndex = SendMessageW( hControl, LB_ADDSTRING, 0, (LPARAM)str.c_str()); + SendMessageW( hControl, LB_SETITEMDATA, (WPARAM) nIndex, (LPARAM) i ); - UT_sint32 nIndex = SendMessageW( hControl, LB_ADDSTRING, 0, (LPARAM) UT_basename( uri ) ); - SendMessageW( hControl, LB_SETITEMDATA, (WPARAM) nIndex, (LPARAM) 1 ); - - g_free(uri); - } while( _findnext( findtag, &cfile ) == 0 ); + g_free(uri); + } while( _findnext( findtag, &cfile ) == 0 ); + } + _findclose( findtag ); } - _findclose( findtag ); XAP_Win32DialogHelper::s_centerDialog(hWnd); _updateControls(); @@ -289,8 +271,10 @@ if (szResultPathname && *szResultPathname) { // update the entry box + char *pFilename = UT_go_filename_from_uri(szResultPathname); _win32Dialog.setControlText( AP_RID_DIALOG_NEW_EBX_EXISTING, - szResultPathname); + pFilename); + FREEP(pFilename); setFileName (szResultPathname); } } @@ -329,8 +313,11 @@ HWND hControl = GetDlgItem(m_hThisDlg, AP_RID_DIALOG_NEW_LBX_TEMPLATE); if( nIndex != LB_ERR ) { - char buf[PATH_MAX]; - _win32Dialog.getListText( AP_RID_DIALOG_NEW_LBX_TEMPLATE, nIndex, buf ); + WCHAR buf[PATH_MAX]; + int l=SendMessageW(hControl,LB_GETTEXTLEN,nIndex,NULL); + UT_return_if_fail(l