diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 8fa1d0ed37..1a172f6cd0 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -87,8 +87,6 @@ appxmanifest APSTUDIO AQS arcosh -arsinh -artanh ARemapped argb argc @@ -100,6 +98,8 @@ arjunbalgovind ARPINSTALLLOCATION ARPPRODUCTICON ARRAYSIZE +arsinh +artanh Artboard asdf AShortcut @@ -119,7 +119,6 @@ atlfile atlstr attr Attribs -AUMID aumid AUTHN AUTOAPPEND @@ -195,6 +194,7 @@ BTNFACE Bto buf BUFSIZE +bugreport Buid buildcommand buildtools @@ -469,7 +469,6 @@ DISPIDAMBIENTDLCONTROL DISPINFO Displayandhidethedesktop DISPLAYCHANGE -DISPLAYNAME displayname divyan DLACTIVEXCTLS @@ -862,7 +861,6 @@ HLSL hmenu hmodule hmon -HMONITOR hmonitor HOLDENTER HOLDESC @@ -981,7 +979,6 @@ IJson IList ILogon IMAGEHLP -IMAGENAME imageresizer IMAGERESIZEREXT imageresizersettings @@ -1852,7 +1849,7 @@ RUNLEVEL runsettings runtimeclass runtimeconfig -Runtimes +runtimes rv rvalue rvm @@ -2492,7 +2489,6 @@ XOffset xpath XResource xsd -xsi XSmall XStr XToolset diff --git a/src/runner/Resources.resx b/src/runner/Resources.resx index aade6e258f..bc0c6d1130 100644 --- a/src/runner/Resources.resx +++ b/src/runner/Resources.resx @@ -161,6 +161,12 @@ Exit Exit as a verb, as in Exit the application + + Report Bug + + + Bug report .zip file has been created on your Desktop. + Updating from a local build is not supported. User cannot autoupdate from a locally-built PowerToys version diff --git a/src/runner/resource.base.h b/src/runner/resource.base.h index 18ecee3220..786b11cba9 100644 --- a/src/runner/resource.base.h +++ b/src/runner/resource.base.h @@ -17,4 +17,5 @@ #define ID_EXIT_MENU_COMMAND 40001 #define ID_SETTINGS_MENU_COMMAND 40002 -#define ID_ABOUT_MENU_COMMAND 40003 \ No newline at end of file +#define ID_ABOUT_MENU_COMMAND 40003 +#define ID_REPORT_BUG_COMMAND 40004 \ No newline at end of file diff --git a/src/runner/runner.base.rc b/src/runner/runner.base.rc index 93ca17b0dd..a71be4b779 100644 --- a/src/runner/runner.base.rc +++ b/src/runner/runner.base.rc @@ -10,6 +10,7 @@ BEGIN MENUITEM "Settings", ID_SETTINGS_MENU_COMMAND //MENUITEM "About", ID_ABOUT_MENU_COMMAND + MENUITEM "Report Bug" ID_REPORT_BUG_COMMAND MENUITEM SEPARATOR MENUITEM "Exit", ID_EXIT_MENU_COMMAND END diff --git a/src/runner/tray_icon.cpp b/src/runner/tray_icon.cpp index 7951d6c0c3..ac7aa35af0 100644 --- a/src/runner/tray_icon.cpp +++ b/src/runner/tray_icon.cpp @@ -4,6 +4,7 @@ #include "tray_icon.h" #include +#include #include #include @@ -57,6 +58,48 @@ void change_menu_item_text(const UINT item_id, wchar_t* new_text) SetMenuItemInfoW(h_menu, item_id, false, &menuitem); } +void handle_tray_command(HWND window, const WPARAM command_id) +{ + switch (command_id) + { + case ID_SETTINGS_MENU_COMMAND: + open_settings_window(); + break; + case ID_EXIT_MENU_COMMAND: + if (h_menu) + { + DestroyMenu(h_menu); + } + DestroyWindow(window); + break; + case ID_ABOUT_MENU_COMMAND: + if (!about_box_shown) + { + about_box_shown = true; + std::wstring about_msg = L"PowerToys\nVersion " + get_product_version() + L"\n\xa9 2019 Microsoft Corporation"; + MessageBoxW(nullptr, about_msg.c_str(), L"About PowerToys", MB_OK); + about_box_shown = false; + } + 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) }; + sei.fMask = { SEE_MASK_FLAG_NO_UI | SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE }; + sei.lpFile = bug_report_path.c_str(); + sei.nShow = SW_HIDE; + if (ShellExecuteExW(&sei)) + { + WaitForSingleObject(sei.hProcess, INFINITE); + CloseHandle(sei.hProcess); + static const std::wstring bugreport_success = GET_RESOURCE_STRING(IDS_BUGREPORT_SUCCESS); + MessageBoxW(nullptr, bugreport_success.c_str(), L"PowerToys", MB_OK); + } + + break; + } +} + LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) { switch (message) @@ -82,28 +125,7 @@ LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam DestroyWindow(window); break; case WM_COMMAND: - switch (wparam) - { - case ID_SETTINGS_MENU_COMMAND: - open_settings_window(); - break; - case ID_EXIT_MENU_COMMAND: - if (h_menu) - { - DestroyMenu(h_menu); - } - DestroyWindow(window); - break; - case ID_ABOUT_MENU_COMMAND: - if (!about_box_shown) - { - about_box_shown = true; - std::wstring about_msg = L"PowerToys\nVersion " + get_product_version() + L"\n\xa9 2019 Microsoft Corporation"; - MessageBox(nullptr, about_msg.c_str(), L"About PowerToys", MB_OK); - about_box_shown = false; - } - break; - } + handle_tray_command(window, wparam); break; // Shell_NotifyIcon can fail when we invoke it during the time explorer.exe isn't present/ready to handle it. // We'll also never receive wm_taskbar_restart message if the first call to Shell_NotifyIcon failed, so we use @@ -137,8 +159,11 @@ 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); + 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()); } if (!h_sub_menu) {