mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[FileLocksmith]Add Windows11 (tier1) context menu (#31388)
* Add project
* Cleanup project file and add resource file
* Move common logic to FileLocksmithLib
* Cleanup interop vcxproj
* Implement handler, add assets and appx manifest
* Revert "Cleanup interop vcxproj"
This reverts commit 97bf991f2e.
* Remove package on uninstall
Install package on enable
Fix launching app
Cleanup
* Revert non-related change
* Spellcheck
* Update src/modules/FileLocksmith/FileLocksmithContextMenu/Resources.resx
* Wire Show in extended context menu setting
This commit is contained in:
56
src/modules/FileLocksmith/FileLocksmithLib/Settings.h
Normal file
56
src/modules/FileLocksmith/FileLocksmithLib/Settings.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
#include <common/utils/gpo.h>
|
||||
|
||||
class FileLocksmithSettings
|
||||
{
|
||||
public:
|
||||
FileLocksmithSettings();
|
||||
|
||||
inline bool GetEnabled()
|
||||
{
|
||||
auto gpoSetting = powertoys_gpo::getConfiguredFileLocksmithEnabledValue();
|
||||
if (gpoSetting == powertoys_gpo::gpo_rule_configured_enabled)
|
||||
return true;
|
||||
if (gpoSetting == powertoys_gpo::gpo_rule_configured_disabled)
|
||||
return false;
|
||||
Reload();
|
||||
return settings.enabled;
|
||||
}
|
||||
|
||||
inline void SetEnabled(bool enabled)
|
||||
{
|
||||
settings.enabled = enabled;
|
||||
Save();
|
||||
}
|
||||
|
||||
inline bool GetShowInExtendedContextMenu() const
|
||||
{
|
||||
return settings.showInExtendedContextMenu;
|
||||
}
|
||||
|
||||
inline void SetExtendedContextMenuOnly(bool extendedOnly)
|
||||
{
|
||||
settings.showInExtendedContextMenu = extendedOnly;
|
||||
}
|
||||
|
||||
void Save();
|
||||
void Load();
|
||||
|
||||
private:
|
||||
struct Settings
|
||||
{
|
||||
bool enabled{ true };
|
||||
bool showInExtendedContextMenu{ false };
|
||||
};
|
||||
|
||||
void Reload();
|
||||
void ParseJson();
|
||||
|
||||
Settings settings;
|
||||
std::wstring jsonFilePath;
|
||||
FILETIME lastLoadedTime;
|
||||
};
|
||||
|
||||
FileLocksmithSettings& FileLocksmithSettingsInstance();
|
||||
Reference in New Issue
Block a user