Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginUserSettings.cpp

Issue 6248869830590464: Issue 1196 - Fix dealing with boolean VARIANT (Closed)
Patch Set: Created Aug. 12, 2014, 11:10 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "../shared/Dictionary.h" 6 #include "../shared/Dictionary.h"
7 7
8 static const CString s_GetMessage = L"GetMessage"; 8 static const CString s_GetMessage = L"GetMessage";
9 static const CString s_GetLanguageCount = L"GetLanguageCount"; 9 static const CString s_GetLanguageCount = L"GetLanguageCount";
10 static const CString s_GetLanguageByIndex = L"GetLanguageByIndex"; 10 static const CString s_GetLanguageByIndex = L"GetLanguageByIndex";
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 pVarResult->vt = VT_BSTR; 325 pVarResult->vt = VT_BSTR;
326 pVarResult->bstrVal = SysAllocString(settings->GetDocumentationLink()); 326 pVarResult->bstrVal = SysAllocString(settings->GetDocumentationLink());
327 } 327 }
328 else if (s_IsAcceptableAdsEnabled == method) 328 else if (s_IsAcceptableAdsEnabled == method)
329 { 329 {
330 if (0 != pDispparams->cArgs) 330 if (0 != pDispparams->cArgs)
331 return DISP_E_BADPARAMCOUNT; 331 return DISP_E_BADPARAMCOUNT;
332 332
333 pVarResult->vt = VT_BOOL; 333 pVarResult->vt = VT_BOOL;
334 pVarResult->boolVal = CPluginClient::GetInstance()->IsAcceptableAdsEnabled() ; 334 pVarResult->boolVal = CPluginClient::GetInstance()->IsAcceptableAdsEnabled() ? VARIANT_TRUE : VARIANT_FALSE;
335 } 335 }
336 else if (s_SetAcceptableAdsEnabled == method) 336 else if (s_SetAcceptableAdsEnabled == method)
337 { 337 {
338 if (1 != pDispparams->cArgs) 338 if (1 != pDispparams->cArgs)
339 return DISP_E_BADPARAMCOUNT; 339 return DISP_E_BADPARAMCOUNT;
340 340
341 if (VT_BOOL != pDispparams->rgvarg[0].vt) 341 if (VT_BOOL != pDispparams->rgvarg[0].vt)
342 return DISP_E_TYPEMISMATCH; 342 return DISP_E_TYPEMISMATCH;
343 343
344 bool enable = pDispparams->rgvarg[0].boolVal; 344 bool enable = VARIANT_FALSE != pDispparams->rgvarg[0].boolVal;
345 345
346 if (enable) 346 if (enable)
347 { 347 {
348 CPluginClient* client = CPluginClient::GetInstance(); 348 CPluginClient* client = CPluginClient::GetInstance();
349 client->AddSubscription(client->GetPref(L"subscriptions_exceptionsurl", L" ")); 349 client->AddSubscription(client->GetPref(L"subscriptions_exceptionsurl", L" "));
350 } 350 }
351 else 351 else
352 { 352 {
353 CPluginClient* client = CPluginClient::GetInstance(); 353 CPluginClient* client = CPluginClient::GetInstance();
354 client->RemoveSubscription(client->GetPref(L"subscriptions_exceptionsurl", L"")); 354 client->RemoveSubscription(client->GetPref(L"subscriptions_exceptionsurl", L""));
355 } 355 }
356 } 356 }
357 else if (s_IsUpdate == method) 357 else if (s_IsUpdate == method)
358 { 358 {
359 if (0 != pDispparams->cArgs) 359 if (0 != pDispparams->cArgs)
360 return DISP_E_BADPARAMCOUNT; 360 return DISP_E_BADPARAMCOUNT;
361 361
362 pVarResult->vt = VT_BOOL; 362 pVarResult->vt = VT_BOOL;
363 pVarResult->boolVal = CPluginClient::GetInstance()->GetPref(L"displayUpdateP age", false); 363 pVarResult->boolVal = CPluginClient::GetInstance()->GetPref(L"displayUpdateP age", false);
364 } 364 }
365 else 365 else
366 return DISP_E_MEMBERNOTFOUND; 366 return DISP_E_MEMBERNOTFOUND;
367 367
368 return S_OK; 368 return S_OK;
369 } 369 }
370 370
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld