| OLD | NEW |
| 1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
| 2 #include "PluginUserSettings.h" | 2 #include "PluginUserSettings.h" |
| 3 #include <algorithm> | 3 #include <algorithm> |
| 4 #include "PluginSettings.h" | 4 #include "PluginSettings.h" |
| 5 #include "PluginClient.h" | 5 #include "PluginClient.h" |
| 6 #include "PluginIniFileW.h" | 6 #include "PluginIniFileW.h" |
| 7 #include "PluginDictionary.h" | 7 #include "PluginDictionary.h" |
| 8 | 8 |
| 9 static const CString s_GetMessage = L"GetMessage"; | 9 static const CString s_GetMessage = L"GetMessage"; |
| 10 static const CString s_SetLanguage = L"SetLanguage"; | 10 static const CString s_SetLanguage = L"SetLanguage"; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return DISP_E_MEMBERNOTFOUND; | 83 return DISP_E_MEMBERNOTFOUND; |
| 84 | 84 |
| 85 *rgdispid = indxMethod; | 85 *rgdispid = indxMethod; |
| 86 | 86 |
| 87 return S_OK; | 87 return S_OK; |
| 88 } | 88 } |
| 89 | 89 |
| 90 | 90 |
| 91 static CString sGetLanguage() | 91 static CString sGetLanguage() |
| 92 { | 92 { |
| 93 CString lang; | 93 » CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 94 | 94 |
| 95 LANGID lcid = ::GetUserDefaultLangID(); | 95 » return settings->GetString(SETTING_LANGUAGE); |
| 96 | |
| 97 TCHAR language[128] = {0}; | |
| 98 » if (::GetLocaleInfo(lcid, LOCALE_SISO639LANGNAME, language, countof(lang
uage) - 1)) | |
| 99 { | |
| 100 lang = language; | |
| 101 } | |
| 102 | |
| 103 return lang; | |
| 104 } | 96 } |
| 105 | 97 |
| 106 | 98 |
| 107 static bool sReadSettingsPageFile(CPluginIniFileW& iniFile) | 99 static bool sReadSettingsPageFile(CPluginIniFileW& iniFile) |
| 108 { | 100 { |
| 109 return iniFile.HasSection(sGetLanguage()); | 101 return iniFile.HasSection(sGetLanguage()); |
| 110 } | 102 } |
| 111 | 103 |
| 112 | 104 |
| 113 static CPluginIniFileW& sReadSettingsPageFile(bool& readOK) | 105 static CPluginIniFileW& sReadSettingsPageFile(bool& readOK) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 { | 162 { |
| 171 if (1 != pDispparams->cArgs) | 163 if (1 != pDispparams->cArgs) |
| 172 return DISP_E_BADPARAMCOUNT; | 164 return DISP_E_BADPARAMCOUNT; |
| 173 | 165 |
| 174 if (VT_BSTR != pDispparams->rgvarg[0].vt) | 166 if (VT_BSTR != pDispparams->rgvarg[0].vt) |
| 175 return DISP_E_TYPEMISMATCH; | 167 return DISP_E_TYPEMISMATCH; |
| 176 | 168 |
| 177 CComBSTR language = pDispparams->rgvarg[0].bstrVal; | 169 CComBSTR language = pDispparams->rgvarg[0].bstrVal; |
| 178 | 170 |
| 179 settings->SetString(SETTING_LANGUAGE, (BSTR)language); | 171 settings->SetString(SETTING_LANGUAGE, (BSTR)language); |
| 172 CPluginDictionary* dict = CPluginDictionary::GetInstance(); |
| 173 dict->SetLanguage((BSTR)language); |
| 180 settings->Write(); | 174 settings->Write(); |
| 181 | 175 |
| 182 settings->CheckFilterAndDownload(); | 176 settings->CheckFilterAndDownload(); |
| 183 } | 177 } |
| 184 else if (s_GetLanguage == method) | 178 else if (s_GetLanguage == method) |
| 185 { | 179 { |
| 186 if (pDispparams->cArgs) | 180 if (pDispparams->cArgs) |
| 187 return DISP_E_BADPARAMCOUNT; | 181 return DISP_E_BADPARAMCOUNT; |
| 188 | 182 |
| 189 if (pVarResult) | 183 if (pVarResult) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 CPluginClient::GetInstance()->ClearWhiteListCache(); | 242 CPluginClient::GetInstance()->ClearWhiteListCache(); |
| 249 } | 243 } |
| 250 } | 244 } |
| 251 else | 245 else |
| 252 return DISP_E_MEMBERNOTFOUND; | 246 return DISP_E_MEMBERNOTFOUND; |
| 253 | 247 |
| 254 return S_OK; | 248 return S_OK; |
| 255 } | 249 } |
| 256 | 250 |
| 257 | 251 |
| OLD | NEW |