| 1395 | } |
| 1396 | |
| 1397 | void PluginList::removePlugins(HWND hMessageBoxParent, ProgressDialog* progressDialog, PluginListView* pluginListView, CancelToken& cancelToken) |
| 1398 | { |
| 1399 | g_options.moduleInfo.setHParent(hMessageBoxParent); |
| 1400 | |
| 1401 | tstring configDir = _variableHandler->getVariable(_T("CONFIGDIR")); |
| 1402 | |
| 1403 | tstring gpupFile(configDir); |
| 1404 | gpupFile.append(_T("\\PluginManagerGpup.xml")); |
| 1405 | |
| 1406 | TiXmlDocument* forGpupDoc = getGpupDocument(gpupFile.c_str()); |
| 1407 | TiXmlElement* installElement = forGpupDoc->FirstChildElement(_T("install")); |
| 1408 | |
| 1409 | std::shared_ptr< list<Plugin*> > selectedPlugins = pluginListView->getSelectedPlugins(); |
| 1410 | |
| 1411 | |
| 1412 | if (selectedPlugins.get() == NULL) |
| 1413 | { |
| 1414 | delete forGpupDoc; |
| 1415 | progressDialog->close(); |
| 1416 | return; |
| 1417 | } |
| 1418 | |
| 1419 | size_t removeSteps = 0; |
| 1420 | list<Plugin*>::iterator pluginIter = selectedPlugins->begin(); |
| 1421 | |
| 1422 | while(pluginIter != selectedPlugins->end()) |
| 1423 | { |
| 1424 | removeSteps += (*pluginIter)->getRemoveStepCount(); |
| 1425 | ++pluginIter; |
| 1426 | } |
| 1427 | |
| 1428 | progressDialog->setStepCount(removeSteps); |
| 1429 | |
| 1430 | tstring pluginDir = _variableHandler->getVariable(_T("PLUGINDIR")); |
| 1431 | tstring removeBasePath; |
| 1432 | |
| 1433 | pluginIter = selectedPlugins->begin(); |
| 1434 | bool needAdmin = false; |
| 1435 | while(pluginIter != selectedPlugins->end()) |
| 1436 | { |
| 1437 | if ((*pluginIter)->getInstalledForAllUsers()) |
| 1438 | { |
| 1439 | needAdmin = true; |
| 1440 | } |
| 1441 | |
| 1442 | (*pluginIter)->remove(removeBasePath, installElement, |
| 1443 | std::bind(&ProgressDialog::setCurrentStatus, progressDialog, _1), |
| 1444 | std::bind(&ProgressDialog::setStepProgress, progressDialog, _1), |
| 1445 | std::bind(&ProgressDialog::stepComplete, progressDialog), |
| 1446 | &g_options.moduleInfo, |
| 1447 | _variableHandler, |
| 1448 | cancelToken); |
| 1449 | ++pluginIter; |
| 1450 | } |
| 1451 | |
| 1452 | |
| 1453 | |
| 1454 |
no test coverage detected