| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
| 2 | 2 |
| 3 #include <Wbemidl.h> | 3 #include <Wbemidl.h> |
| 4 #include <time.h> | 4 #include <time.h> |
| 5 #include "PluginIniFileW.h" | |
| 6 #include "PluginIniFile.h" | |
| 7 #include "PluginSettings.h" | 5 #include "PluginSettings.h" |
| 8 #include "PluginClient.h" | 6 #include "PluginClient.h" |
| 9 #include "PluginChecksum.h" | |
| 10 #include "PluginSystem.h" | 7 #include "PluginSystem.h" |
| 11 #ifdef SUPPORT_FILTER | 8 #ifdef SUPPORT_FILTER |
| 12 #include "PluginFilter.h" | 9 #include "PluginFilter.h" |
| 13 #endif | 10 #endif |
| 14 #include "PluginMutex.h" | 11 #include "PluginMutex.h" |
| 15 #include "PluginHttpRequest.h" | |
| 16 #include "../shared/Utils.h" | 12 #include "../shared/Utils.h" |
| 17 #include <memory> | 13 #include <memory> |
| 18 | 14 |
| 19 | 15 |
| 20 // IE functions | 16 // IE functions |
| 21 #pragma comment(lib, "iepmapi.lib") | 17 #pragma comment(lib, "iepmapi.lib") |
| 22 | 18 |
| 23 #include <knownfolders.h> | 19 #include <knownfolders.h> |
| 24 | 20 |
| 25 namespace | 21 namespace |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 class CPluginSettingsWhitelistLock : public CPluginMutex | 55 class CPluginSettingsWhitelistLock : public CPluginMutex |
| 60 { | 56 { |
| 61 public: | 57 public: |
| 62 CPluginSettingsWhitelistLock() : CPluginMutex("SettingsFileWhitelist", PLUGIN_ ERROR_MUTEX_SETTINGS_FILE_WHITELIST) {} | 58 CPluginSettingsWhitelistLock() : CPluginMutex("SettingsFileWhitelist", PLUGIN_ ERROR_MUTEX_SETTINGS_FILE_WHITELIST) {} |
| 63 ~CPluginSettingsWhitelistLock() {} | 59 ~CPluginSettingsWhitelistLock() {} |
| 64 }; | 60 }; |
| 65 | 61 |
| 66 #endif | 62 #endif |
| 67 | 63 |
| 68 CPluginSettings* CPluginSettings::s_instance = NULL; | 64 CPluginSettings* CPluginSettings::s_instance = NULL; |
| 69 bool CPluginSettings::s_isLightOnly = false; | |
| 70 | 65 |
| 71 CComAutoCriticalSection CPluginSettings::s_criticalSectionLocal; | 66 CComAutoCriticalSection CPluginSettings::s_criticalSectionLocal; |
| 72 #ifdef SUPPORT_WHITELIST | 67 #ifdef SUPPORT_WHITELIST |
| 73 CComAutoCriticalSection CPluginSettings::s_criticalSectionDomainHistory; | 68 CComAutoCriticalSection CPluginSettings::s_criticalSectionDomainHistory; |
| 74 #endif | 69 #endif |
| 75 | 70 |
| 76 | 71 |
| 77 CPluginSettings::CPluginSettings() : | 72 CPluginSettings::CPluginSettings() : |
| 78 m_settingsVersion("1"), m_isDirty(false), m_isFirstRun(false), m_isFirstRunUpd ate(false), m_dwMainProcessId(0), m_dwMainThreadId(0), m_dwWorkingThreadId(0), | 73 m_settingsVersion("1"), m_isDirty(false), m_isFirstRun(false), m_isFirstRunUpd ate(false), m_dwMainProcessId(0), m_dwMainThreadId(0), m_dwWorkingThreadId(0), |
| 79 m_isDirtyTab(false), m_isPluginEnabledTab(true), m_tabNumber("1") | 74 m_isPluginEnabledTab(true), m_tabNumber("1") |
| 80 { | 75 { |
| 81 | 76 |
| 82 CPluginSettings *lightInstance = s_instance; | 77 CPluginSettings *lightInstance = s_instance; |
| 83 s_instance = NULL; | 78 s_instance = NULL; |
| 84 | 79 |
| 85 m_settingsFile = std::auto_ptr<CPluginIniFileW>(new CPluginIniFileW(GetDataPat h(SETTINGS_INI_FILE), false)); | |
| 86 m_settingsFileTab = std::auto_ptr<CPluginIniFileW>(new CPluginIniFileW(GetData Path(SETTINGS_INI_FILE_TAB), true)); | |
| 87 | |
| 88 m_WindowsBuildNumber = 0; | 80 m_WindowsBuildNumber = 0; |
| 89 | 81 |
| 90 Clear(); | |
| 91 ClearTab(); | |
| 92 #ifdef SUPPORT_WHITELIST | 82 #ifdef SUPPORT_WHITELIST |
| 93 ClearWhitelist(); | 83 ClearWhitelist(); |
| 94 #endif | 84 #endif |
| 95 | |
| 96 // Check existence of settings file | |
| 97 bool isFileExisting = false; | |
| 98 { | |
| 99 CPluginSettingsLock lock; | |
| 100 if (lock.IsLocked()) | |
| 101 { | |
| 102 std::ifstream is; | |
| 103 is.open(GetDataPath(SETTINGS_INI_FILE), std::ios_base::in); | |
| 104 if (!is.is_open()) | |
| 105 { | |
| 106 TCHAR pf[MAX_PATH]; | |
| 107 SHGetSpecialFolderPath( | |
| 108 0, | |
| 109 pf, | |
| 110 CSIDL_PROGRAM_FILESX86, | |
| 111 FALSE ); | |
| 112 is.open(GetDataPath(SETTINGS_INI_FILE), std::ios_base::in); | |
| 113 if (!is.is_open()) | |
| 114 { | |
| 115 m_isDirty = true; | |
| 116 } | |
| 117 else | |
| 118 { | |
| 119 is.close(); | |
| 120 isFileExisting = true; | |
| 121 | |
| 122 } | |
| 123 | |
| 124 } | |
| 125 else | |
| 126 { | |
| 127 is.close(); | |
| 128 | |
| 129 isFileExisting = true; | |
| 130 } | |
| 131 } | |
| 132 } | |
| 133 | |
| 134 // Read or convert file | |
| 135 if (isFileExisting) | |
| 136 { | |
| 137 Read(false); | |
| 138 } | |
| 139 else | |
| 140 { | |
| 141 m_isDirty = true; | |
| 142 } | |
| 143 | |
| 144 if (s_isLightOnly) | |
| 145 { | |
| 146 this->SetMainProcessId(lightInstance->m_dwMainProcessId); | |
| 147 this->SetMainThreadId(lightInstance->m_dwMainThreadId); | |
| 148 this->SetMainUiThreadId(lightInstance->m_dwMainUiThreadId); | |
| 149 this->SetWorkingThreadId(lightInstance->m_dwWorkingThreadId); | |
| 150 } | |
| 151 Write(); | |
| 152 } | 85 } |
| 153 | 86 |
| 154 | 87 |
| 155 CPluginSettings::~CPluginSettings() | 88 CPluginSettings::~CPluginSettings() |
| 156 { | 89 { |
| 157 s_instance = NULL; | 90 s_instance = NULL; |
| 158 } | 91 } |
| 159 | 92 |
| 160 | 93 |
| 161 CPluginSettings* CPluginSettings::GetInstance() | 94 CPluginSettings* CPluginSettings::GetInstance() |
| 162 { | 95 { |
| 163 CPluginSettings* instance = NULL; | 96 CPluginSettings* instance = NULL; |
| 164 | 97 |
| 165 s_criticalSectionLocal.Lock(); | 98 s_criticalSectionLocal.Lock(); |
| 166 { | 99 { |
| 167 if ((!s_instance) || (s_isLightOnly)) | 100 if (!s_instance) |
| 168 { | 101 { |
| 169 s_instance = new CPluginSettings(); | 102 s_instance = new CPluginSettings(); |
| 170 #ifdef USE_CONSOLE | 103 #ifdef USE_CONSOLE |
| 171 CONSOLE("Fetching Available Subscription\n"); | 104 CONSOLE("Fetching Available Subscription\n"); |
| 172 #endif | 105 #endif |
| 173 CPluginSettings::GetInstance()->m_subscriptions = CPluginClient::GetInstan ce()->FetchAvailableSubscriptions(); | 106 CPluginSettings::GetInstance()->m_subscriptions = CPluginClient::GetInstan ce()->FetchAvailableSubscriptions(); |
| 174 s_isLightOnly = false; | |
| 175 } | 107 } |
| 176 | 108 |
| 177 instance = s_instance; | 109 instance = s_instance; |
| 178 } | 110 } |
| 179 s_criticalSectionLocal.Unlock(); | 111 s_criticalSectionLocal.Unlock(); |
| 180 | 112 |
| 181 return instance; | 113 return instance; |
| 182 } | 114 } |
| 183 | 115 |
| 184 | 116 |
| 185 bool CPluginSettings::HasInstance() | 117 bool CPluginSettings::HasInstance() |
| 186 { | 118 { |
| 187 bool hasInstance = true; | 119 bool hasInstance = true; |
| 188 | 120 |
| 189 s_criticalSectionLocal.Lock(); | 121 s_criticalSectionLocal.Lock(); |
| 190 { | 122 { |
| 191 hasInstance = s_instance != NULL; | 123 hasInstance = s_instance != NULL; |
| 192 } | 124 } |
| 193 s_criticalSectionLocal.Unlock(); | 125 s_criticalSectionLocal.Unlock(); |
| 194 | 126 |
| 195 return hasInstance; | 127 return hasInstance; |
| 196 } | 128 } |
| 197 | 129 |
| 198 | 130 |
| 199 bool CPluginSettings::Read(bool bDebug) | |
| 200 { | |
| 201 bool isRead = true; | |
| 202 | |
| 203 DEBUG_SETTINGS(L"Settings::Read") | |
| 204 { | |
| 205 if (bDebug) | |
| 206 { | |
| 207 DEBUG_GENERAL(L"*** Loading settings:" + m_settingsFile->GetFilePath()); | |
| 208 } | |
| 209 | |
| 210 CPluginSettingsLock lock; | |
| 211 if (lock.IsLocked()) | |
| 212 { | |
| 213 isRead = m_settingsFile->Read(); | |
| 214 if (isRead) | |
| 215 { | |
| 216 if (m_settingsFile->IsValidChecksum()) | |
| 217 { | |
| 218 m_properties = m_settingsFile->GetSectionData("Settings"); | |
| 219 } | |
| 220 else | |
| 221 { | |
| 222 DEBUG_SETTINGS("Settings:Invalid checksum - Deleting file") | |
| 223 | |
| 224 Clear(); | |
| 225 | |
| 226 DEBUG_ERROR_LOG(m_settingsFile->GetLastError(), PLUGIN_ERROR_SETTINGS, PLUGIN_ERROR_SETTINGS_FILE_READ_CHECKSUM, "Settings::Read - Checksum") | |
| 227 isRead = false; | |
| 228 m_isDirty = true; | |
| 229 } | |
| 230 } | |
| 231 else if (m_settingsFile->GetLastError() == ERROR_FILE_NOT_FOUND) | |
| 232 { | |
| 233 DEBUG_ERROR_LOG(m_settingsFile->GetLastError(), PLUGIN_ERROR_SETTINGS, P LUGIN_ERROR_SETTINGS_FILE_READ, "Settings::Read") | |
| 234 m_isDirty = true; | |
| 235 } | |
| 236 else | |
| 237 { | |
| 238 DEBUG_ERROR_LOG(m_settingsFile->GetLastError(), PLUGIN_ERROR_SETTINGS, P LUGIN_ERROR_SETTINGS_FILE_READ, "Settings::Read") | |
| 239 } | |
| 240 } | |
| 241 else | |
| 242 { | |
| 243 isRead = false; | |
| 244 } | |
| 245 } | |
| 246 | |
| 247 // Write file in case it is dirty | |
| 248 if (isRead) | |
| 249 { | |
| 250 isRead = Write(); | |
| 251 } | |
| 252 | |
| 253 return isRead; | |
| 254 } | |
| 255 | |
| 256 | |
| 257 void CPluginSettings::Clear() | |
| 258 { | |
| 259 // Default settings | |
| 260 s_criticalSectionLocal.Lock(); | |
| 261 { | |
| 262 m_properties.clear(); | |
| 263 | |
| 264 m_properties[SETTING_PLUGIN_VERSION] = IEPLUGIN_VERSION; | |
| 265 m_properties[SETTING_LANGUAGE] = "en"; | |
| 266 } | |
| 267 s_criticalSectionLocal.Unlock(); | |
| 268 } | |
| 269 | 131 |
| 270 CString CPluginSettings::GetDataPath(const CString& filename) | 132 CString CPluginSettings::GetDataPath(const CString& filename) |
| 271 { | 133 { |
| 272 std::wstring path = ::GetAppDataPath() + L"\\" + static_cast<LPCWSTR>(filename ); | 134 std::wstring path = ::GetAppDataPath() + L"\\" + static_cast<LPCWSTR>(filename ); |
| 273 return CString(path.c_str()); | 135 return CString(path.c_str()); |
| 274 } | 136 } |
| 275 | 137 |
| 276 CString CPluginSettings::GetSystemLanguage() | 138 CString CPluginSettings::GetSystemLanguage() |
| 277 { | 139 { |
| 278 CString language; | 140 CString language; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 { | 216 { |
| 355 tempPath = tempPath.Left(pos+1) + extension; | 217 tempPath = tempPath.Left(pos+1) + extension; |
| 356 } | 218 } |
| 357 } | 219 } |
| 358 } | 220 } |
| 359 | 221 |
| 360 return tempPath; | 222 return tempPath; |
| 361 } | 223 } |
| 362 | 224 |
| 363 | 225 |
| 364 bool CPluginSettings::Has(const CString& key) const | |
| 365 { | |
| 366 bool hasKey; | |
| 367 | |
| 368 s_criticalSectionLocal.Lock(); | |
| 369 { | |
| 370 hasKey = m_properties.find(key) != m_properties.end(); | |
| 371 } | |
| 372 s_criticalSectionLocal.Unlock(); | |
| 373 | |
| 374 return hasKey; | |
| 375 } | |
| 376 | |
| 377 | |
| 378 void CPluginSettings::Remove(const CString& key) | |
| 379 { | |
| 380 s_criticalSectionLocal.Lock(); | |
| 381 { | |
| 382 TProperties::iterator it = m_properties.find(key); | |
| 383 if (it != m_properties.end()) | |
| 384 { | |
| 385 m_properties.erase(it); | |
| 386 m_isDirty = true; | |
| 387 } | |
| 388 } | |
| 389 s_criticalSectionLocal.Unlock(); | |
| 390 } | |
| 391 | |
| 392 | |
| 393 CString CPluginSettings::GetString(const CString& key, const CString& defaultVal ue) const | |
| 394 { | |
| 395 CString val = defaultValue; | |
| 396 | |
| 397 s_criticalSectionLocal.Lock(); | |
| 398 { | |
| 399 TProperties::const_iterator it = m_properties.find(key); | |
| 400 if (it != m_properties.end()) | |
| 401 { | |
| 402 val = it->second; | |
| 403 } | |
| 404 } | |
| 405 s_criticalSectionLocal.Unlock(); | |
| 406 | |
| 407 DEBUG_SETTINGS("Settings::GetString key:" + key + " value:" + val) | |
| 408 | |
| 409 return val; | |
| 410 } | |
| 411 | |
| 412 | |
| 413 void CPluginSettings::SetString(const CString& key, const CString& value) | |
| 414 { | |
| 415 if (value.IsEmpty()) return; | |
| 416 | |
| 417 DEBUG_SETTINGS("Settings::SetString key:" + key + " value:" + value) | |
| 418 | |
| 419 s_criticalSectionLocal.Lock(); | |
| 420 { | |
| 421 TProperties::iterator it = m_properties.find(key); | |
| 422 if (it != m_properties.end() && it->second != value) | |
| 423 { | |
| 424 it->second = value; | |
| 425 m_isDirty = true; | |
| 426 } | |
| 427 else if (it == m_properties.end()) | |
| 428 { | |
| 429 m_properties[key] = value; | |
| 430 m_isDirty = true; | |
| 431 } | |
| 432 } | |
| 433 s_criticalSectionLocal.Unlock(); | |
| 434 } | |
| 435 | |
| 436 | |
| 437 int CPluginSettings::GetValue(const CString& key, int defaultValue) const | |
| 438 { | |
| 439 int val = defaultValue; | |
| 440 | |
| 441 CString sValue; | |
| 442 sValue.Format(L"%d", defaultValue); | |
| 443 | |
| 444 s_criticalSectionLocal.Lock(); | |
| 445 { | |
| 446 TProperties::const_iterator it = m_properties.find(key); | |
| 447 if (it != m_properties.end()) | |
| 448 { | |
| 449 sValue = it->second; | |
| 450 val = _wtoi(it->second); | |
| 451 } | |
| 452 } | |
| 453 s_criticalSectionLocal.Unlock(); | |
| 454 | |
| 455 DEBUG_SETTINGS("Settings::GetValue key:" + key + " value:" + sValue) | |
| 456 | |
| 457 return val; | |
| 458 } | |
| 459 | |
| 460 | |
| 461 void CPluginSettings::SetValue(const CString& key, int value) | |
| 462 { | |
| 463 CString sValue; | |
| 464 sValue.Format(L"%d", value); | |
| 465 | |
| 466 DEBUG_SETTINGS("Settings::SetValue key:" + key + " value:" + sValue) | |
| 467 | |
| 468 s_criticalSectionLocal.Lock(); | |
| 469 { | |
| 470 TProperties::iterator it = m_properties.find(key); | |
| 471 if (it != m_properties.end() && it->second != sValue) | |
| 472 { | |
| 473 it->second = sValue; | |
| 474 m_isDirty = true; | |
| 475 } | |
| 476 else if (it == m_properties.end()) | |
| 477 { | |
| 478 m_properties[key] = sValue; | |
| 479 m_isDirty = true; | |
| 480 } | |
| 481 } | |
| 482 s_criticalSectionLocal.Unlock(); | |
| 483 } | |
| 484 | |
| 485 | |
| 486 bool CPluginSettings::GetBool(const CString& key, bool defaultValue) const | |
| 487 { | |
| 488 bool value = defaultValue; | |
| 489 | |
| 490 s_criticalSectionLocal.Lock(); | |
| 491 { | |
| 492 TProperties::const_iterator it = m_properties.find(key); | |
| 493 if (it != m_properties.end()) | |
| 494 { | |
| 495 if (it->second == "true") value = true; | |
| 496 if (it->second == "false") value = false; | |
| 497 } | |
| 498 } | |
| 499 s_criticalSectionLocal.Unlock(); | |
| 500 | |
| 501 DEBUG_SETTINGS("Settings::GetBool key:" + key + " value:" + (value ? "true":"f alse")) | |
| 502 | |
| 503 return value; | |
| 504 } | |
| 505 | |
| 506 | |
| 507 void CPluginSettings::SetBool(const CString& key, bool value) | |
| 508 { | |
| 509 SetString(key, value ? "true":"false"); | |
| 510 } | |
| 511 | |
| 512 | |
| 513 bool CPluginSettings::IsPluginEnabled() const | 226 bool CPluginSettings::IsPluginEnabled() const |
| 514 { | 227 { |
| 515 return m_isPluginEnabledTab; | 228 return m_isPluginEnabledTab; |
| 516 } | 229 } |
| 517 | 230 |
| 518 | 231 |
| 519 std::map<CString, CString> CPluginSettings::GetFilterLanguageTitleList() const | 232 std::map<CString, CString> CPluginSettings::GetFilterLanguageTitleList() const |
| 520 { | 233 { |
| 521 std::map<CString, CString> filterList; | 234 std::map<CString, CString> filterList; |
| 522 for (size_t i = 0; i < m_subscriptions.size(); i ++) | 235 for (size_t i = 0; i < m_subscriptions.size(); i ++) |
| 523 { | 236 { |
| 524 SubscriptionDescription it = m_subscriptions[i]; | 237 SubscriptionDescription it = m_subscriptions[i]; |
| 525 filterList.insert(std::make_pair(CString(it.url.c_str()), CString(it.title.c _str()))); | 238 filterList.insert(std::make_pair(CString(it.url.c_str()), CString(it.title.c _str()))); |
| 526 } | 239 } |
| 527 return filterList; | 240 return filterList; |
| 528 } | 241 } |
| 529 | 242 |
| 530 | |
| 531 bool CPluginSettings::Write(bool isDebug) | |
| 532 { | |
| 533 bool isWritten = true; | |
| 534 | |
| 535 if (!m_isDirty) | |
| 536 { | |
| 537 return isWritten; | |
| 538 } | |
| 539 | |
| 540 if (isDebug) | |
| 541 { | |
| 542 DEBUG_GENERAL(L"*** Writing changed settings") | |
| 543 } | |
| 544 | |
| 545 CPluginSettingsLock lock; | |
| 546 if (lock.IsLocked()) | |
| 547 { | |
| 548 m_settingsFile->Clear(); | |
| 549 | |
| 550 // Properties | |
| 551 CPluginIniFileW::TSectionData settings; | |
| 552 | |
| 553 s_criticalSectionLocal.Lock(); | |
| 554 { | |
| 555 for (TProperties::iterator it = m_properties.begin(); it != m_properties.e nd(); ++it) | |
| 556 { | |
| 557 settings[it->first] = it->second; | |
| 558 } | |
| 559 } | |
| 560 s_criticalSectionLocal.Unlock(); | |
| 561 | |
| 562 m_settingsFile->UpdateSection("Settings", settings); | |
| 563 | |
| 564 // Write file | |
| 565 isWritten = m_settingsFile->Write(); | |
| 566 if (!isWritten) | |
| 567 { | |
| 568 DEBUG_ERROR_LOG(m_settingsFile->GetLastError(), PLUGIN_ERROR_SETTINGS, PLU GIN_ERROR_SETTINGS_FILE_WRITE, "Settings::Write") | |
| 569 } | |
| 570 | |
| 571 m_isDirty = false; | |
| 572 | |
| 573 IncrementTabVersion(SETTING_TAB_SETTINGS_VERSION); | |
| 574 } | |
| 575 else | |
| 576 { | |
| 577 isWritten = false; | |
| 578 } | |
| 579 | |
| 580 return isWritten; | |
| 581 } | |
| 582 | |
| 583 | |
| 584 bool CPluginSettings::IsMainProcess(DWORD dwProcessId) const | 243 bool CPluginSettings::IsMainProcess(DWORD dwProcessId) const |
| 585 { | 244 { |
| 586 if (dwProcessId == 0) | 245 if (dwProcessId == 0) |
| 587 { | 246 { |
| 588 dwProcessId = ::GetCurrentProcessId(); | 247 dwProcessId = ::GetCurrentProcessId(); |
| 589 } | 248 } |
| 590 return m_dwMainProcessId == dwProcessId; | 249 return m_dwMainProcessId == dwProcessId; |
| 591 } | 250 } |
| 592 | 251 |
| 593 void CPluginSettings::SetMainProcessId() | 252 void CPluginSettings::SetMainProcessId() |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 bool CPluginSettings::IsFirstRunUpdate() const | 334 bool CPluginSettings::IsFirstRunUpdate() const |
| 676 { | 335 { |
| 677 return m_isFirstRunUpdate; | 336 return m_isFirstRunUpdate; |
| 678 } | 337 } |
| 679 | 338 |
| 680 bool CPluginSettings::IsFirstRunAny() const | 339 bool CPluginSettings::IsFirstRunAny() const |
| 681 { | 340 { |
| 682 return m_isFirstRun || m_isFirstRunUpdate; | 341 return m_isFirstRun || m_isFirstRunUpdate; |
| 683 } | 342 } |
| 684 | 343 |
| 685 // ============================================================================ | |
| 686 // Tab settings | |
| 687 // ============================================================================ | |
| 688 | |
| 689 void CPluginSettings::ClearTab() | |
| 690 { | |
| 691 s_criticalSectionLocal.Lock(); | |
| 692 { | |
| 693 m_isPluginEnabledTab = true; | |
| 694 | |
| 695 m_errorsTab.clear(); | |
| 696 | |
| 697 m_propertiesTab.clear(); | |
| 698 | |
| 699 m_propertiesTab[SETTING_TAB_PLUGIN_ENABLED] = "true"; | |
| 700 } | |
| 701 s_criticalSectionLocal.Unlock(); | |
| 702 } | |
| 703 | |
| 704 | |
| 705 bool CPluginSettings::ReadTab(bool bDebug) | |
| 706 { | |
| 707 bool isRead = true; | |
| 708 | |
| 709 DEBUG_SETTINGS(L"SettingsTab::Read tab") | |
| 710 | |
| 711 if (bDebug) | |
| 712 { | |
| 713 DEBUG_GENERAL(L"*** Loading tab settings:" + m_settingsFileTab->GetFilePat h()); | |
| 714 } | |
| 715 | |
| 716 isRead = m_settingsFileTab->Read(); | |
| 717 if (isRead) | |
| 718 { | |
| 719 ClearTab(); | |
| 720 | |
| 721 if (m_settingsFileTab->IsValidChecksum()) | |
| 722 { | |
| 723 s_criticalSectionLocal.Lock(); | |
| 724 { | |
| 725 m_propertiesTab = m_settingsFileTab->GetSectionData("Settings"); | |
| 726 | |
| 727 m_errorsTab = m_settingsFileTab->GetSectionData("Errors"); | |
| 728 | |
| 729 TProperties::iterator it = m_propertiesTab.find(SETTING_TAB_PLUGIN_ENA BLED); | |
| 730 if (it != m_propertiesTab.end()) | |
| 731 { | |
| 732 m_isPluginEnabledTab = it->second != "false"; | |
| 733 } | |
| 734 } | |
| 735 s_criticalSectionLocal.Unlock(); | |
| 736 } | |
| 737 else | |
| 738 { | |
| 739 DEBUG_SETTINGS("SettingsTab:Invalid checksum - Deleting file") | |
| 740 | |
| 741 DEBUG_ERROR_LOG(m_settingsFileTab->GetLastError(), PLUGIN_ERROR_SETTIN GS_TAB, PLUGIN_ERROR_SETTINGS_FILE_READ_CHECKSUM, "SettingsTab::Read - Checksum" ) | |
| 742 isRead = false; | |
| 743 m_isDirtyTab = true; | |
| 744 } | |
| 745 } | |
| 746 else if (m_settingsFileTab->GetLastError() == ERROR_FILE_NOT_FOUND) | |
| 747 { | |
| 748 m_isDirtyTab = true; | |
| 749 } | |
| 750 else | |
| 751 { | |
| 752 DEBUG_ERROR_LOG(m_settingsFileTab->GetLastError(), PLUGIN_ERROR_SETTINGS_T AB, PLUGIN_ERROR_SETTINGS_FILE_READ, "SettingsTab::Read") | |
| 753 } | |
| 754 | |
| 755 | |
| 756 // Write file in case it is dirty or does not exist | |
| 757 WriteTab(); | |
| 758 | |
| 759 return isRead; | |
| 760 } | |
| 761 | |
| 762 bool CPluginSettings::WriteTab(bool isDebug) | |
| 763 { | |
| 764 bool isWritten = true; | |
| 765 | |
| 766 if (!m_isDirtyTab) | |
| 767 { | |
| 768 return isWritten; | |
| 769 } | |
| 770 | |
| 771 if (isDebug) | |
| 772 { | |
| 773 DEBUG_GENERAL(L"*** Writing changed tab settings") | |
| 774 } | |
| 775 | |
| 776 m_settingsFileTab->Clear(); | |
| 777 | |
| 778 // Properties & errors | |
| 779 CPluginIniFileW::TSectionData settings; | |
| 780 CPluginIniFileW::TSectionData errors; | |
| 781 | |
| 782 s_criticalSectionLocal.Lock(); | |
| 783 { | |
| 784 for (TProperties::iterator it = m_propertiesTab.begin(); it != m_propertiesT ab.end(); ++it) | |
| 785 { | |
| 786 settings[it->first] = it->second; | |
| 787 } | |
| 788 | |
| 789 for (TProperties::iterator it = m_errorsTab.begin(); it != m_errorsTab.end() ; ++it) | |
| 790 { | |
| 791 errors[it->first] = it->second; | |
| 792 } | |
| 793 } | |
| 794 s_criticalSectionLocal.Unlock(); | |
| 795 | |
| 796 m_settingsFileTab->UpdateSection("Settings", settings); | |
| 797 m_settingsFileTab->UpdateSection("Errors", errors); | |
| 798 | |
| 799 // Write file | |
| 800 isWritten = m_settingsFileTab->Write(); | |
| 801 if (!isWritten) | |
| 802 { | |
| 803 DEBUG_ERROR_LOG(m_settingsFileTab->GetLastError(), PLUGIN_ERROR_SETTINGS_TAB , PLUGIN_ERROR_SETTINGS_FILE_WRITE, "SettingsTab::Write") | |
| 804 } | |
| 805 | |
| 806 m_isDirtyTab = !isWritten; | |
| 807 | |
| 808 return isWritten; | |
| 809 } | |
| 810 | |
| 811 | |
| 812 void CPluginSettings::EraseTab() | |
| 813 { | |
| 814 ClearTab(); | |
| 815 | |
| 816 m_isDirtyTab = true; | |
| 817 | |
| 818 WriteTab(); | |
| 819 } | |
| 820 | |
| 821 | 344 |
| 822 bool CPluginSettings::IncrementTabCount() | 345 bool CPluginSettings::IncrementTabCount() |
| 823 { | 346 { |
|
Oleksandr
2013/07/05 03:33:55
Instead of storing current tab count in settings_t
| |
| 824 int tabCount = 1; | 347 int tabCount = 1; |
| 825 | 348 |
| 826 | |
| 827 if (s_isLightOnly) | |
| 828 { | |
| 829 return false; | |
| 830 } | |
| 831 | |
| 832 CPluginSettingsTabLock lock; | 349 CPluginSettingsTabLock lock; |
| 833 if (lock.IsLocked()) | 350 if (lock.IsLocked()) |
| 834 { | 351 { |
| 835 SYSTEMTIME systemTime; | 352 SYSTEMTIME systemTime; |
| 836 ::GetSystemTime(&systemTime); | 353 ::GetSystemTime(&systemTime); |
| 837 | 354 |
| 838 CString today; | 355 CString today; |
| 839 today.Format(L"%d-%d-%d", systemTime.wYear, systemTime.wMonth, systemTime.wD ay); | 356 today.Format(L"%d-%d-%d", systemTime.wYear, systemTime.wMonth, systemTime.wD ay); |
| 840 | 357 |
| 841 ReadTab(false); | |
| 842 | |
| 843 s_criticalSectionLocal.Lock(); | 358 s_criticalSectionLocal.Lock(); |
| 844 { | 359 { |
| 845 TProperties::iterator it = m_propertiesTab.find(SETTING_TAB_COUNT); | 360 //TODO: Increment tab count in the AdblockPlusEngine |
| 846 if (it != m_propertiesTab.end()) | |
| 847 { | |
| 848 tabCount = _wtoi(it->second) + 1; | |
| 849 } | |
| 850 | 361 |
| 851 it = m_propertiesTab.find(SETTING_TAB_START_TIME); | |
| 852 | |
| 853 //Is this a first IE instance? | |
| 854 HWND ieWnd = FindWindow(L"IEFrame", NULL); | |
| 855 if (ieWnd != NULL) | |
| 856 { | |
| 857 ieWnd = FindWindowEx(NULL, ieWnd, L"IEFrame", NULL); | |
| 858 | |
| 859 } | |
| 860 if ((it != m_propertiesTab.end() && it->second != today)) | |
| 861 { | |
| 862 tabCount = 1; | |
| 863 } | |
| 864 m_tabNumber.Format(L"%d", tabCount); | 362 m_tabNumber.Format(L"%d", tabCount); |
| 865 | |
| 866 m_propertiesTab[SETTING_TAB_COUNT] = m_tabNumber; | |
| 867 m_propertiesTab[SETTING_TAB_START_TIME] = today; | |
| 868 | |
| 869 // Main tab? | |
| 870 if (tabCount == 1) | |
| 871 { | |
| 872 m_propertiesTab[SETTING_TAB_DICTIONARY_VERSION] = "1"; | |
| 873 m_propertiesTab[SETTING_TAB_SETTINGS_VERSION] = "1"; | |
| 874 #ifdef SUPPORT_WHITELIST | |
| 875 m_propertiesTab[SETTING_TAB_WHITELIST_VERSION] = "1"; | |
| 876 #endif | |
| 877 #ifdef SUPPORT_FILTER | |
| 878 m_propertiesTab[SETTING_TAB_FILTER_VERSION] = "1"; | |
| 879 #endif | |
| 880 #ifdef SUPPORT_CONFIG | |
| 881 m_propertiesTab[SETTING_TAB_CONFIG_VERSION] = "1"; | |
| 882 #endif | |
| 883 } | |
| 884 } | 363 } |
| 885 s_criticalSectionLocal.Unlock(); | 364 s_criticalSectionLocal.Unlock(); |
| 886 | |
| 887 m_isDirtyTab = true; | |
| 888 | |
| 889 WriteTab(false); | |
| 890 } | 365 } |
| 891 | 366 |
| 892 return tabCount == 1; | 367 return tabCount == 1; |
| 893 } | 368 } |
| 894 | 369 |
| 895 | 370 |
| 896 CString CPluginSettings::GetTabNumber() const | 371 CString CPluginSettings::GetTabNumber() const |
| 897 { | 372 { |
| 898 CString tabNumber; | 373 CString tabNumber; |
| 899 | 374 |
| 900 s_criticalSectionLocal.Lock(); | 375 s_criticalSectionLocal.Lock(); |
| 901 { | 376 { |
| 902 tabNumber = m_tabNumber; | 377 tabNumber = m_tabNumber; |
| 903 } | 378 } |
| 904 s_criticalSectionLocal.Unlock(); | 379 s_criticalSectionLocal.Unlock(); |
| 905 | 380 |
| 906 return tabNumber; | 381 return tabNumber; |
| 907 } | 382 } |
| 908 | 383 |
| 909 | 384 |
| 910 bool CPluginSettings::DecrementTabCount() | 385 bool CPluginSettings::DecrementTabCount() |
| 911 { | 386 { |
| 912 int tabCount = 0; | 387 int tabCount = 0; |
| 913 | 388 |
| 914 CPluginSettingsTabLock lock; | 389 CPluginSettingsTabLock lock; |
| 915 if (lock.IsLocked()) | 390 if (lock.IsLocked()) |
| 916 { | 391 { |
| 917 ReadTab(false); | |
| 918 | 392 |
| 919 s_criticalSectionLocal.Lock(); | 393 s_criticalSectionLocal.Lock(); |
| 920 { | 394 { |
| 921 TProperties::iterator it = m_propertiesTab.find(SETTING_TAB_COUNT); | 395 //TODO: Retrieve tab count from the AdblockPlusEngine |
| 922 if (it != m_propertiesTab.end()) | 396 m_tabNumber.Format(L"%d", tabCount); |
| 923 { | |
| 924 tabCount = max(_wtoi(it->second) - 1, 0); | |
| 925 | |
| 926 if (tabCount > 0) | |
| 927 { | |
| 928 m_tabNumber.Format(L"%d", tabCount); | |
| 929 | |
| 930 m_propertiesTab[SETTING_TAB_COUNT] = m_tabNumber; | |
| 931 } | |
| 932 else | |
| 933 { | |
| 934 it = m_propertiesTab.find(SETTING_TAB_START_TIME); | |
| 935 if (it != m_propertiesTab.end()) | |
| 936 { | |
| 937 m_propertiesTab.erase(it); | |
| 938 } | |
| 939 | |
| 940 it = m_propertiesTab.find(SETTING_TAB_COUNT); | |
| 941 if (it != m_propertiesTab.end()) | |
| 942 { | |
| 943 m_propertiesTab.erase(it); | |
| 944 } | |
| 945 } | |
| 946 | |
| 947 m_isDirtyTab = true; | |
| 948 } | |
| 949 } | 397 } |
| 950 s_criticalSectionLocal.Unlock(); | 398 s_criticalSectionLocal.Unlock(); |
| 951 | |
| 952 WriteTab(false); | |
| 953 } | 399 } |
| 954 | 400 |
| 955 return tabCount == 0; | 401 return tabCount == 0; |
| 956 } | 402 } |
| 957 | 403 |
| 958 | 404 |
| 959 void CPluginSettings::TogglePluginEnabled() | 405 void CPluginSettings::TogglePluginEnabled() |
| 960 { | 406 { |
| 961 CPluginSettingsTabLock lock; | 407 CPluginSettingsTabLock lock; |
| 962 if (lock.IsLocked()) | 408 if (lock.IsLocked()) |
| 963 { | 409 { |
| 964 ReadTab(false); | |
| 965 | |
| 966 s_criticalSectionLocal.Lock(); | 410 s_criticalSectionLocal.Lock(); |
| 967 { | 411 { |
| 412 //TODO: Query if plugin is enabled from the AdblockPlusEngine | |
| 968 m_isPluginEnabledTab = m_isPluginEnabledTab ? false : true; | 413 m_isPluginEnabledTab = m_isPluginEnabledTab ? false : true; |
| 969 m_propertiesTab[SETTING_TAB_PLUGIN_ENABLED] = m_isPluginEnabledTab ? "true " : "false"; | 414 //TODO: Set plugin enabled/disabled in AdblockPlusEngine |
| 970 m_isDirtyTab = true; | |
| 971 } | 415 } |
| 972 s_criticalSectionLocal.Unlock(); | 416 s_criticalSectionLocal.Unlock(); |
| 973 | |
| 974 WriteTab(false); | |
| 975 } | 417 } |
| 976 } | 418 } |
| 977 void CPluginSettings::SetPluginDisabled() | 419 void CPluginSettings::SetPluginDisabled() |
| 978 { | 420 { |
| 979 CPluginSettingsTabLock lock; | 421 CPluginSettingsTabLock lock; |
| 980 if (lock.IsLocked()) | 422 if (lock.IsLocked()) |
| 981 { | 423 { |
| 982 ReadTab(false); | |
| 983 | |
| 984 s_criticalSectionLocal.Lock(); | 424 s_criticalSectionLocal.Lock(); |
| 985 { | 425 { |
| 986 m_isPluginEnabledTab = false; | 426 m_isPluginEnabledTab = false; |
| 987 m_propertiesTab[SETTING_TAB_PLUGIN_ENABLED] = "false"; | 427 //TODO: Set plugin disabled in AdblockPlusEngine |
| 988 m_isDirtyTab = true; | |
| 989 } | 428 } |
| 990 s_criticalSectionLocal.Unlock(); | 429 s_criticalSectionLocal.Unlock(); |
| 991 | |
| 992 WriteTab(false); | |
| 993 } | 430 } |
| 994 } | 431 } |
| 995 void CPluginSettings::SetPluginEnabled() | 432 void CPluginSettings::SetPluginEnabled() |
| 996 { | 433 { |
| 997 CPluginSettingsTabLock lock; | 434 CPluginSettingsTabLock lock; |
| 998 if (lock.IsLocked()) | 435 if (lock.IsLocked()) |
| 999 { | 436 { |
| 1000 ReadTab(false); | |
| 1001 | |
| 1002 s_criticalSectionLocal.Lock(); | 437 s_criticalSectionLocal.Lock(); |
| 1003 { | 438 { |
| 1004 m_isPluginEnabledTab = true; | 439 m_isPluginEnabledTab = true; |
| 1005 m_propertiesTab[SETTING_TAB_PLUGIN_ENABLED] = "true"; | 440 //TODO: Set plugin enabled in AdblockPlusEngine |
| 1006 m_isDirtyTab = true; | |
| 1007 } | 441 } |
| 1008 s_criticalSectionLocal.Unlock(); | 442 s_criticalSectionLocal.Unlock(); |
| 1009 | |
| 1010 WriteTab(false); | |
| 1011 } | 443 } |
| 1012 } | 444 } |
| 1013 bool CPluginSettings::GetPluginEnabled() const | 445 bool CPluginSettings::GetPluginEnabled() const |
| 1014 { | 446 { |
| 447 //TODO: Query AdblockPlusEngine | |
| 1015 return m_isPluginEnabledTab; | 448 return m_isPluginEnabledTab; |
| 1016 } | 449 } |
| 1017 | 450 |
| 451 bool CPluginSettings::GetStatusBarAsked() | |
| 452 { | |
| 453 //TOTO: Get value from the registry; | |
|
Wladimir Palant
2013/07/05 09:26:45
TOTO => TODO and please fix indentation
| |
| 454 return false; | |
| 455 } | |
| 456 | |
| 457 void CPluginSettings::SetStatusBarAsked(bool asked) | |
|
Wladimir Palant
2013/07/05 09:26:45
The parameter can probably be removed here - we wo
| |
| 458 { | |
| 459 //TODO: Set value in the registry | |
| 460 } | |
| 461 | |
| 1018 | 462 |
| 1019 void CPluginSettings::AddError(const CString& error, const CString& errorCode) | 463 void CPluginSettings::AddError(const CString& error, const CString& errorCode) |
| 1020 { | 464 { |
| 1021 DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCode) | 465 DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCode) |
| 1022 | |
| 1023 CPluginSettingsTabLock lock; | |
| 1024 if (lock.IsLocked()) | |
| 1025 { | |
| 1026 ReadTab(false); | |
| 1027 | |
| 1028 s_criticalSectionLocal.Lock(); | |
| 1029 { | |
| 1030 if (m_errorsTab.find(error) == m_errorsTab.end()) | |
| 1031 { | |
| 1032 m_errorsTab[error] = errorCode; | |
| 1033 m_isDirtyTab = true; | |
| 1034 } | |
| 1035 } | |
| 1036 s_criticalSectionLocal.Unlock(); | |
| 1037 | |
| 1038 WriteTab(false); | |
| 1039 } | |
| 1040 } | 466 } |
| 1041 | 467 |
| 1042 | 468 |
| 1043 CString CPluginSettings::GetErrorList() const | |
| 1044 { | |
| 1045 CString errors; | |
| 1046 | |
| 1047 s_criticalSectionLocal.Lock(); | |
| 1048 { | |
| 1049 for (TProperties::const_iterator it = m_errorsTab.begin(); it != m_errorsTab .end(); ++it) | |
| 1050 { | |
| 1051 if (!errors.IsEmpty()) | |
| 1052 { | |
| 1053 errors += ','; | |
| 1054 } | |
| 1055 | |
| 1056 errors += it->first + '.' + it->second; | |
| 1057 } | |
| 1058 } | |
| 1059 s_criticalSectionLocal.Unlock(); | |
| 1060 | |
| 1061 return errors; | |
| 1062 } | |
| 1063 | |
| 1064 | |
| 1065 void CPluginSettings::RemoveErrors() | |
| 1066 { | |
| 1067 CPluginSettingsTabLock lock; | |
| 1068 if (lock.IsLocked()) | |
| 1069 { | |
| 1070 ReadTab(false); | |
| 1071 | |
| 1072 s_criticalSectionLocal.Lock(); | |
| 1073 { | |
| 1074 if (m_errorsTab.size() > 0) | |
| 1075 { | |
| 1076 m_isDirtyTab = true; | |
| 1077 } | |
| 1078 m_errorsTab.clear(); | |
| 1079 } | |
| 1080 s_criticalSectionLocal.Unlock(); | |
| 1081 | |
| 1082 WriteTab(false); | |
| 1083 } | |
| 1084 } | |
| 1085 | |
| 1086 | |
| 1087 bool CPluginSettings::GetForceConfigurationUpdateOnStart() const | |
| 1088 { | |
| 1089 bool isUpdating = false; | |
| 1090 | |
| 1091 CPluginSettingsTabLock lock; | |
| 1092 if (lock.IsLocked()) | |
| 1093 { | |
| 1094 s_criticalSectionLocal.Lock(); | |
| 1095 { | |
| 1096 isUpdating = m_propertiesTab.find(SETTING_TAB_UPDATE_ON_START) != m_proper tiesTab.end(); | |
| 1097 } | |
| 1098 s_criticalSectionLocal.Unlock(); | |
| 1099 } | |
| 1100 | |
| 1101 return isUpdating; | |
| 1102 } | |
| 1103 | |
| 1104 | |
| 1105 void CPluginSettings::ForceConfigurationUpdateOnStart(bool isUpdating) | |
| 1106 { | |
| 1107 CPluginSettingsTabLock lock; | |
| 1108 if (lock.IsLocked()) | |
| 1109 { | |
| 1110 ReadTab(false); | |
| 1111 | |
| 1112 s_criticalSectionLocal.Lock(); | |
| 1113 { | |
| 1114 TProperties::iterator it = m_propertiesTab.find(SETTING_TAB_UPDATE_ON_STAR T); | |
| 1115 | |
| 1116 if (isUpdating && it == m_propertiesTab.end()) | |
| 1117 { | |
| 1118 m_propertiesTab[SETTING_TAB_UPDATE_ON_START] = "true"; | |
| 1119 m_propertiesTab[SETTING_TAB_UPDATE_ON_START_REMOVE] = "false"; | |
| 1120 | |
| 1121 m_isDirtyTab = true; | |
| 1122 } | |
| 1123 else if (!isUpdating) | |
| 1124 { | |
| 1125 // OK to remove? | |
| 1126 TProperties::iterator itRemove = m_propertiesTab.find(SETTING_TAB_UPDATE _ON_START_REMOVE); | |
| 1127 | |
| 1128 if (itRemove == m_propertiesTab.end() || itRemove->second == "true") | |
| 1129 { | |
| 1130 if (it != m_propertiesTab.end()) | |
| 1131 { | |
| 1132 m_propertiesTab.erase(it); | |
| 1133 } | |
| 1134 | |
| 1135 if (itRemove != m_propertiesTab.end()) | |
| 1136 { | |
| 1137 m_propertiesTab.erase(itRemove); | |
| 1138 } | |
| 1139 | |
| 1140 m_isDirtyTab = true; | |
| 1141 } | |
| 1142 } | |
| 1143 } | |
| 1144 s_criticalSectionLocal.Unlock(); | |
| 1145 | |
| 1146 WriteTab(false); | |
| 1147 } | |
| 1148 } | |
| 1149 | |
| 1150 void CPluginSettings::RemoveForceConfigurationUpdateOnStart() | |
| 1151 { | |
| 1152 CPluginSettingsTabLock lock; | |
| 1153 if (lock.IsLocked()) | |
| 1154 { | |
| 1155 ReadTab(false); | |
| 1156 | |
| 1157 s_criticalSectionLocal.Lock(); | |
| 1158 { | |
| 1159 // OK to remove? | |
| 1160 TProperties::iterator itRemove = m_propertiesTab.find(SETTING_TAB_UPDATE_O N_START_REMOVE); | |
| 1161 | |
| 1162 if (itRemove != m_propertiesTab.end()) | |
| 1163 { | |
| 1164 m_propertiesTab.erase(itRemove); | |
| 1165 m_isDirtyTab = true; | |
| 1166 } | |
| 1167 } | |
| 1168 s_criticalSectionLocal.Unlock(); | |
| 1169 | |
| 1170 WriteTab(false); | |
| 1171 } | |
| 1172 } | |
| 1173 | |
| 1174 void CPluginSettings::RefreshTab() | |
| 1175 { | |
| 1176 CPluginSettingsTabLock lock; | |
| 1177 if (lock.IsLocked()) | |
| 1178 { | |
| 1179 ReadTab(); | |
| 1180 } | |
| 1181 } | |
| 1182 | |
| 1183 | |
| 1184 int CPluginSettings::GetTabVersion(const CString& key) const | |
| 1185 { | |
| 1186 int version = 0; | |
| 1187 | |
| 1188 s_criticalSectionLocal.Lock(); | |
| 1189 { | |
| 1190 TProperties::const_iterator it = m_propertiesTab.find(key); | |
| 1191 if (it != m_propertiesTab.end()) | |
| 1192 { | |
| 1193 version = _wtoi(it->second); | |
| 1194 } | |
| 1195 } | |
| 1196 s_criticalSectionLocal.Unlock(); | |
| 1197 | |
| 1198 return version; | |
| 1199 } | |
| 1200 | |
| 1201 void CPluginSettings::IncrementTabVersion(const CString& key) | |
| 1202 { | |
| 1203 CPluginSettingsTabLock lock; | |
| 1204 if (lock.IsLocked()) | |
| 1205 { | |
| 1206 ReadTab(false); | |
| 1207 | |
| 1208 s_criticalSectionLocal.Lock(); | |
| 1209 { | |
| 1210 int version = 1; | |
| 1211 | |
| 1212 TProperties::iterator it = m_propertiesTab.find(key); | |
| 1213 if (it != m_propertiesTab.end()) | |
| 1214 { | |
| 1215 version = _wtoi(it->second) + 1; | |
| 1216 } | |
| 1217 | |
| 1218 CString versionString; | |
| 1219 versionString.Format(L"%d", version); | |
| 1220 | |
| 1221 m_propertiesTab[key] = versionString; | |
| 1222 } | |
| 1223 s_criticalSectionLocal.Unlock(); | |
| 1224 | |
| 1225 m_isDirtyTab = true; | |
| 1226 | |
| 1227 WriteTab(false); | |
| 1228 } | |
| 1229 } | |
| 1230 | |
| 1231 | |
| 1232 // ============================================================================ | 469 // ============================================================================ |
| 1233 // Whitelist settings | 470 // Whitelist settings |
| 1234 // ============================================================================ | 471 // ============================================================================ |
| 1235 | 472 |
| 1236 #ifdef SUPPORT_WHITELIST | 473 #ifdef SUPPORT_WHITELIST |
| 1237 | 474 |
| 1238 void CPluginSettings::ClearWhitelist() | 475 void CPluginSettings::ClearWhitelist() |
| 1239 { | 476 { |
| 1240 s_criticalSectionLocal.Lock(); | 477 s_criticalSectionLocal.Lock(); |
| 1241 { | 478 { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1354 return CString(L""); | 591 return CString(L""); |
| 1355 } | 592 } |
| 1356 | 593 |
| 1357 | 594 |
| 1358 void CPluginSettings::RefreshFilterlist() | 595 void CPluginSettings::RefreshFilterlist() |
| 1359 { | 596 { |
| 1360 CPluginClient::GetInstance()->UpdateAllSubscriptions(); | 597 CPluginClient::GetInstance()->UpdateAllSubscriptions(); |
| 1361 } | 598 } |
| 1362 | 599 |
| 1363 #endif // SUPPORT_WHITELIST | 600 #endif // SUPPORT_WHITELIST |
| OLD | NEW |