mirror of
https://github.com/microsoft/PowerToys
synced 2025-09-04 08:25:11 +00:00
[Settings] 'Check for updates' button behavior changed (#4385)
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "common/windows_colors.h"
|
||||
#include "common/common.h"
|
||||
#include "restart_elevated.h"
|
||||
#include "update_utils.h"
|
||||
|
||||
#include <common/json.h>
|
||||
#include <common\settings_helpers.cpp>
|
||||
@@ -56,15 +57,32 @@ void dispatch_json_action_to_module(const json::JsonObject& powertoys_configs)
|
||||
// so it has to be the "restart as (non-)elevated" button.
|
||||
if (name == L"general")
|
||||
{
|
||||
if (is_process_elevated())
|
||||
try
|
||||
{
|
||||
schedule_restart_as_non_elevated();
|
||||
PostQuitMessage(0);
|
||||
const auto value = powertoy_element.Value().GetObjectW();
|
||||
const auto action = value.GetNamedString(L"action_name");
|
||||
if (action == L"restart_elevation")
|
||||
{
|
||||
if (is_process_elevated())
|
||||
{
|
||||
schedule_restart_as_non_elevated();
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
schedule_restart_as_elevated();
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
}
|
||||
else if (action == L"check_for_updates")
|
||||
{
|
||||
std::thread{ [] {
|
||||
check_for_updates();
|
||||
} }.detach();
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (...)
|
||||
{
|
||||
schedule_restart_as_elevated();
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
}
|
||||
else if (modules().find(name) != modules().end())
|
||||
|
Reference in New Issue
Block a user