mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[runner] bug report could be created from tray (#9191)
This commit is contained in:
12
.github/actions/spell-check/expect.txt
vendored
12
.github/actions/spell-check/expect.txt
vendored
@@ -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
|
||||
|
||||
@@ -161,6 +161,12 @@
|
||||
<value>Exit</value>
|
||||
<comment>Exit as a verb, as in Exit the application</comment>
|
||||
</data>
|
||||
<data name="SUBMIT_BUG_TEXT" xml:space="preserve">
|
||||
<value>Report Bug</value>
|
||||
</data>
|
||||
<data name="BUGREPORT_SUCCESS" xml:space="preserve">
|
||||
<value>Bug report .zip file has been created on your Desktop.</value>
|
||||
</data>
|
||||
<data name="GITHUB_NEW_VERSION_USING_LOCAL_BUILD_ERROR" xml:space="preserve">
|
||||
<value>Updating from a local build is not supported.</value>
|
||||
<comment>User cannot autoupdate from a locally-built PowerToys version</comment>
|
||||
|
||||
@@ -18,3 +18,4 @@
|
||||
#define ID_EXIT_MENU_COMMAND 40001
|
||||
#define ID_SETTINGS_MENU_COMMAND 40002
|
||||
#define ID_ABOUT_MENU_COMMAND 40003
|
||||
#define ID_REPORT_BUG_COMMAND 40004
|
||||
Binary file not shown.
@@ -4,6 +4,7 @@
|
||||
#include "tray_icon.h"
|
||||
#include <Windows.h>
|
||||
|
||||
#include <common/utils/process_path.h>
|
||||
#include <common/utils/resources.h>
|
||||
#include <common/version/version.h>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user