From 44ef29ca39f3c22e7ebcbe02d0da102b90af0bd3 Mon Sep 17 00:00:00 2001 From: Ben Constable Date: Thu, 19 Aug 2021 15:32:03 +0100 Subject: [PATCH] Add documentation links (#12598) * Add documentation links * Update src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update src/runner/Resources.resx Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Swap order of repo and documentation * Fix potential security issue * Add seperator * Fix failing test and build Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> --- src/runner/Resources.resx | 3 +++ src/runner/resource.base.h | 3 ++- src/runner/runner.base.rc | 2 ++ src/runner/tray_icon.cpp | 12 ++++++++++++ .../Strings/en-us/Resources.resw | 5 ++++- .../Views/GeneralPage.xaml | 1 + 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/runner/Resources.resx b/src/runner/Resources.resx index 8656bfff1..f961182c0 100644 --- a/src/runner/Resources.resx +++ b/src/runner/Resources.resx @@ -109,6 +109,9 @@ Settings + + Open documentation + Exit Exit as a verb, as in Exit the application diff --git a/src/runner/resource.base.h b/src/runner/resource.base.h index 786b11cba..71eaf1e1a 100644 --- a/src/runner/resource.base.h +++ b/src/runner/resource.base.h @@ -18,4 +18,5 @@ #define ID_EXIT_MENU_COMMAND 40001 #define ID_SETTINGS_MENU_COMMAND 40002 #define ID_ABOUT_MENU_COMMAND 40003 -#define ID_REPORT_BUG_COMMAND 40004 \ No newline at end of file +#define ID_REPORT_BUG_COMMAND 40004 +#define ID_DOCUMENTATION_MENU_COMMAND 40005 \ No newline at end of file diff --git a/src/runner/runner.base.rc b/src/runner/runner.base.rc index a71be4b77..10a4555db 100644 --- a/src/runner/runner.base.rc +++ b/src/runner/runner.base.rc @@ -10,6 +10,8 @@ BEGIN MENUITEM "Settings", ID_SETTINGS_MENU_COMMAND //MENUITEM "About", ID_ABOUT_MENU_COMMAND + MENUITEM SEPARATOR + MENUITEM "Documentation" ID_DOCUMENTATION_MENU_COMMAND MENUITEM "Report Bug" ID_REPORT_BUG_COMMAND MENUITEM SEPARATOR MENUITEM "Exit", ID_EXIT_MENU_COMMAND diff --git a/src/runner/tray_icon.cpp b/src/runner/tray_icon.cpp index 97fa1952a..7e94fb6a1 100644 --- a/src/runner/tray_icon.cpp +++ b/src/runner/tray_icon.cpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace { @@ -84,6 +85,7 @@ void handle_tray_command(HWND window, const WPARAM command_id) } break; case ID_REPORT_BUG_COMMAND: + { std::wstring bug_report_path = get_module_folderpath(); bug_report_path += L"\\Tools\\BugReportTool.exe"; SHELLEXECUTEINFOW sei{ sizeof(sei) }; @@ -100,6 +102,14 @@ void handle_tray_command(HWND window, const WPARAM command_id) break; } + + case ID_DOCUMENTATION_MENU_COMMAND: + { + RunNonElevatedEx(L"https://aka.ms/PowerToysOverview", L""); + break; + } + + } } LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) @@ -171,10 +181,12 @@ LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam static std::wstring settings_menuitem_label = GET_RESOURCE_STRING(IDS_SETTINGS_MENU_TEXT); static std::wstring exit_menuitem_label = GET_RESOURCE_STRING(IDS_EXIT_MENU_TEXT); static std::wstring submit_bug_menuitem_label = GET_RESOURCE_STRING(IDS_SUBMIT_BUG_TEXT); + static std::wstring documentation_menuitem_label = GET_RESOURCE_STRING(IDS_DOCUMENTATION_MENU_TEXT); change_menu_item_text(ID_SETTINGS_MENU_COMMAND, settings_menuitem_label.data()); change_menu_item_text(ID_EXIT_MENU_COMMAND, exit_menuitem_label.data()); change_menu_item_text(ID_REPORT_BUG_COMMAND, submit_bug_menuitem_label.data()); + change_menu_item_text(ID_DOCUMENTATION_MENU_COMMAND, documentation_menuitem_label.data()); } if (!h_sub_menu) { diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw index beaba96b9..3a57b66d3 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw @@ -1394,7 +1394,10 @@ From there, simply click on a Markdown file or SVG icon in the File Explorer and Show format in editor + + Open documentation + Search this list - \ No newline at end of file + diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml index 8f7c9fb65..f1501fb0b 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml @@ -222,6 +222,7 @@ +