Index: src/plugin/PluginSettings.cpp |
=================================================================== |
--- a/src/plugin/PluginSettings.cpp |
+++ b/src/plugin/PluginSettings.cpp |
@@ -20,9 +20,9 @@ |
namespace |
{ |
- std::wstring CreateDomainWhitelistingFilter(const CString domain) |
+ std::wstring CreateDomainWhitelistingFilter(const std::wstring domain) |
{ |
- return std::wstring(L"@@||") + domain.GetString() + std::wstring(L"^$document"); |
+ return L"@@||" + domain + L"^$document"; |
} |
} |
@@ -37,7 +37,7 @@ |
class CPluginSettingsLock : public CPluginMutex |
{ |
public: |
- CPluginSettingsLock() : CPluginMutex("SettingsFile", PLUGIN_ERROR_MUTEX_SETTINGS_FILE) {} |
+ CPluginSettingsLock() : CPluginMutex( L"SettingsFile", PLUGIN_ERROR_MUTEX_SETTINGS_FILE ) {} |
~CPluginSettingsLock() {} |
}; |
@@ -46,7 +46,7 @@ |
class CPluginSettingsTabLock : public CPluginMutex |
{ |
public: |
- CPluginSettingsTabLock() : CPluginMutex("SettingsFileTab", PLUGIN_ERROR_MUTEX_SETTINGS_FILE_TAB) {} |
+ CPluginSettingsTabLock() : CPluginMutex( L"SettingsFileTab", PLUGIN_ERROR_MUTEX_SETTINGS_FILE_TAB ) {} |
~CPluginSettingsTabLock() {} |
}; |
@@ -55,7 +55,7 @@ |
class CPluginSettingsWhitelistLock : public CPluginMutex |
{ |
public: |
- CPluginSettingsWhitelistLock() : CPluginMutex("SettingsFileWhitelist", PLUGIN_ERROR_MUTEX_SETTINGS_FILE_WHITELIST) {} |
+ CPluginSettingsWhitelistLock() : CPluginMutex( L"SettingsFileWhitelist", PLUGIN_ERROR_MUTEX_SETTINGS_FILE_WHITELIST ) {} |
~CPluginSettingsWhitelistLock() {} |
}; |
@@ -116,34 +116,25 @@ |
return hasInstance; |
} |
- |
- |
-CString CPluginSettings::GetDataPath(const CString& filename) |
+std::wstring CPluginSettings::GetDataPath(const std::wstring & filename) |
{ |
- std::wstring path = ::GetAppDataPath() + L"\\" + static_cast<LPCWSTR>(filename); |
- return CString(path.c_str()); |
+ return ::GetAppDataPath() + L"\\" + filename; |
} |
-CString CPluginSettings::GetSystemLanguage() |
+std::wstring CPluginSettings::GetSystemLanguage() |
{ |
- CString language; |
- CString country; |
+ DWORD bufSize = 256; |
+ std::unique_ptr< wchar_t > buffer( new wchar_t[ bufSize ] ); |
+ int ccBuf = GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SISO639LANGNAME, buffer.get(), bufSize); |
+ std::wstring language( buffer.get() ); |
+ ccBuf = GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SISO3166CTRYNAME, buffer.get(), bufSize); |
+ std::wstring country( buffer.get() ); |
- DWORD bufSize = 256; |
- int ccBuf = GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SISO639LANGNAME, language.GetBufferSetLength(bufSize), bufSize); |
- ccBuf = GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SISO3166CTRYNAME, country.GetBufferSetLength(bufSize), bufSize); |
- |
- if ((country.IsEmpty()) || (language.IsEmpty())) |
+ if ((country.empty()) || (language.empty())) |
{ |
- return CString(); |
+ return L""; |
} |
- CString lang; |
- lang.Append(language); |
- lang.Append(L"-"); |
- lang.Append(country); |
- |
- return lang; |
- |
+ return language + L"-" + country; |
} |
@@ -153,15 +144,15 @@ |
} |
-std::map<CString, CString> CPluginSettings::GetFilterLanguageTitleList() const |
+std::map< std::wstring, std::wstring > CPluginSettings::GetFilterLanguageTitleList() const |
{ |
std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstance()->FetchAvailableSubscriptions(); |
- std::map<CString, CString> filterList; |
+ std::map< std::wstring, std::wstring > filterList; |
for (size_t i = 0; i < subscriptions.size(); i ++) |
{ |
SubscriptionDescription it = subscriptions[i]; |
- filterList.insert(std::make_pair(CString(it.url.c_str()), CString(it.title.c_str()))); |
+ filterList.insert(std::make_pair(it.url, it.title)); |
} |
return filterList; |
} |
@@ -195,9 +186,9 @@ |
} |
-void CPluginSettings::AddError(const CString& error, const CString& errorCode) |
+void CPluginSettings::AddError(const std::wstring & error, const std::wstring & errorCode) |
{ |
- DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCode) |
+ DEBUG_SETTINGS( L"SettingsTab::AddError error:" + error + L" code:" + errorCode ) |
} |
@@ -225,7 +216,7 @@ |
if (isDebug) |
{ |
- DEBUG_GENERAL("*** Loading whitelist settings"); |
+ DEBUG_GENERAL(L"*** Loading whitelist settings"); |
} |
CPluginSettingsWhitelistLock lock; |
@@ -246,13 +237,13 @@ |
} |
-void CPluginSettings::AddWhiteListedDomain(const CString& domain) |
+void CPluginSettings::AddWhiteListedDomain(const std::wstring & domain) |
{ |
DEBUG_SETTINGS("SettingsWhitelist::AddWhiteListedDomain domain:" + domain) |
CPluginClient::GetInstance()->AddFilter(CreateDomainWhitelistingFilter(domain)); |
} |
-void CPluginSettings::RemoveWhiteListedDomain(const CString& domain) |
+void CPluginSettings::RemoveWhiteListedDomain(const std::wstring & domain) |
{ |
DEBUG_SETTINGS("SettingsWhitelist::RemoveWhiteListedDomain domain:" + domain) |
CPluginClient::GetInstance()->RemoveFilter(CreateDomainWhitelistingFilter(domain)); |
@@ -316,23 +307,23 @@ |
RefreshWhitelist(); |
} |
-CString CPluginSettings::GetSubscription() |
+std::wstring CPluginSettings::GetSubscription() |
{ |
std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstance()->GetListedSubscriptions(); |
if (subscriptions.size() > 0) |
- return CString(subscriptions.front().url.c_str()); |
+ return subscriptions.front().url; |
else |
- return CString(L""); |
+ return L""; |
} |
-CString CPluginSettings::GetAppLocale() |
+std::wstring CPluginSettings::GetAppLocale() |
{ |
return CPluginSystem::GetInstance()->GetBrowserLanguage(); |
} |
-CString CPluginSettings::GetDocumentationLink() |
+std::wstring CPluginSettings::GetDocumentationLink() |
{ |
- return CString(CPluginClient::GetInstance()->GetDocumentationLink().c_str()); |
+ return CPluginClient::GetInstance()->GetDocumentationLink(); |
} |