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

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

Issue 5081266177179648: Issue 1104 - Cannot uncheck Disable on website option in tool bar (Closed)
Patch Set: Created Feb. 23, 2015, 12:40 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 if (FAILED(hr)) 1254 if (FAILED(hr))
1255 { 1255 {
1256 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed") 1256 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed")
1257 } 1257 }
1258 } 1258 }
1259 } 1259 }
1260 break; 1260 break;
1261 } 1261 }
1262 case ID_MENU_DISABLE_ON_SITE: 1262 case ID_MENU_DISABLE_ON_SITE:
1263 { 1263 {
1264 CPluginSettings* settings = CPluginSettings::GetInstance(); 1264 client->ToggleWhitelisting(GetTab()->GetDocumentUrl());
1265 std::wstring urlString = GetTab()->GetDocumentUrl();
1266 if (client->IsWhitelistedUrl(urlString))
1267 {
1268 settings->RemoveWhiteListedDomain(ToCString(client->GetHostFromUrl(urlSt ring)));
1269 }
1270 else
1271 {
1272 settings->AddWhiteListedDomain(ToCString(client->GetHostFromUrl(urlStrin g)));
1273 }
1274 GetBrowser()->Refresh(); 1265 GetBrowser()->Refresh();
1275 } 1266 }
1276 default: 1267 default:
1277 break; 1268 break;
1278 } 1269 }
1279 1270
1280 // Invalidate and redraw the control 1271 // Invalidate and redraw the control
1281 UpdateStatusBar(); 1272 UpdateStatusBar();
1282 } 1273 }
1283 1274
(...skipping 11 matching lines...) Expand all
1295 MENUITEMINFOW miiSep = {}; 1286 MENUITEMINFOW miiSep = {};
1296 miiSep.cbSize = sizeof(miiSep); 1287 miiSep.cbSize = sizeof(miiSep);
1297 miiSep.fMask = MIIM_TYPE | MIIM_FTYPE; 1288 miiSep.fMask = MIIM_TYPE | MIIM_FTYPE;
1298 miiSep.fType = MFT_SEPARATOR; 1289 miiSep.fType = MFT_SEPARATOR;
1299 1290
1300 CPluginClient* client = CPluginClient::GetInstance(); 1291 CPluginClient* client = CPluginClient::GetInstance();
1301 CPluginSettings* settings = CPluginSettings::GetInstance(); 1292 CPluginSettings* settings = CPluginSettings::GetInstance();
1302 { 1293 {
1303 ctext = dictionary->Lookup("menu", "menu-disable-on-site"); 1294 ctext = dictionary->Lookup("menu", "menu-disable-on-site");
1304 // Is domain in white list? 1295 // Is domain in white list?
1305 ReplaceString(ctext, L"?1?", client->GetHostFromUrl(url)); 1296 ReplaceString<std::wstring>(ctext, L"?1?", client->GetHostFromUrl(url));
Eric 2015/02/26 16:14:10 Explicit type in template function
Eric 2015/02/26 18:16:01 We need to display the same name in the popup menu
1306 if (client->IsWhitelistedUrl(GetTab()->GetDocumentUrl())) 1297 if (client->IsWhitelistedUrl(GetTab()->GetDocumentUrl()))
1307 { 1298 {
1308 fmii.fState = MFS_CHECKED | MFS_ENABLED; 1299 fmii.fState = MFS_CHECKED | MFS_ENABLED;
1309 } 1300 }
1310 else 1301 else
1311 { 1302 {
1312 fmii.fState = MFS_UNCHECKED | MFS_ENABLED; 1303 fmii.fState = MFS_UNCHECKED | MFS_ENABLED;
1313 } 1304 }
1314 fmii.fMask = MIIM_STRING | MIIM_STATE; 1305 fmii.fMask = MIIM_STRING | MIIM_STATE;
1315 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); 1306 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 } 1861 }
1871 } 1862 }
1872 } 1863 }
1873 1864
1874 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1865 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1875 } 1866 }
1876 1867
1877 return hTabWnd; 1868 return hTabWnd;
1878 1869
1879 } 1870 }
OLDNEW

Powered by Google App Engine
This is Rietveld