[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:
Stefan Markovic
2024-02-20 12:16:55 +01:00
committed by GitHub
parent e607b26df6
commit e573b7a1b1
44 changed files with 906 additions and 195 deletions

View 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();