[File Explorer] Fix restart as admin notification (#14004)

This commit is contained in:
Jaime Bernardo 2021-10-27 09:05:09 +01:00
parent 2a07c46500
commit 61b1a4b382

View file

@ -180,11 +180,7 @@ void PowerPreviewModule::apply_settings(const PowerToysSettings::PowerToyValues&
{
const bool isElevated = is_process_elevated(false);
bool notifyShell = false;
if (!isElevated)
{
show_update_warning_message();
return;
}
bool updatesNeeded = false;
for (auto& fileExplorerModule : m_fileExplorerModules)
{
@ -195,6 +191,11 @@ void PowerPreviewModule::apply_settings(const PowerToysSettings::PowerToyValues&
{
continue;
}
else
{
// Mark that updates were to the registry were needed
updatesNeeded = true;
}
// (Un)Apply registry changes depending on the new setting value
const bool updated = *toggle ? fileExplorerModule.registryChanges.apply() : fileExplorerModule.registryChanges.unApply();
@ -209,6 +210,10 @@ void PowerPreviewModule::apply_settings(const PowerToysSettings::PowerToyValues&
Trace::PowerPreviewSettingsUpdateFailed(fileExplorerModule.settingName.c_str(), !*toggle, *toggle, true);
}
}
if (!isElevated && updatesNeeded)
{
show_update_warning_message();
}
if (notifyShell)
{
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);