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
|
APSTUDIO
|
||||||
AQS
|
AQS
|
||||||
arcosh
|
arcosh
|
||||||
arsinh
|
|
||||||
artanh
|
|
||||||
ARemapped
|
ARemapped
|
||||||
argb
|
argb
|
||||||
argc
|
argc
|
||||||
@@ -100,6 +98,8 @@ arjunbalgovind
|
|||||||
ARPINSTALLLOCATION
|
ARPINSTALLLOCATION
|
||||||
ARPPRODUCTICON
|
ARPPRODUCTICON
|
||||||
ARRAYSIZE
|
ARRAYSIZE
|
||||||
|
arsinh
|
||||||
|
artanh
|
||||||
Artboard
|
Artboard
|
||||||
asdf
|
asdf
|
||||||
AShortcut
|
AShortcut
|
||||||
@@ -119,7 +119,6 @@ atlfile
|
|||||||
atlstr
|
atlstr
|
||||||
attr
|
attr
|
||||||
Attribs
|
Attribs
|
||||||
AUMID
|
|
||||||
aumid
|
aumid
|
||||||
AUTHN
|
AUTHN
|
||||||
AUTOAPPEND
|
AUTOAPPEND
|
||||||
@@ -195,6 +194,7 @@ BTNFACE
|
|||||||
Bto
|
Bto
|
||||||
buf
|
buf
|
||||||
BUFSIZE
|
BUFSIZE
|
||||||
|
bugreport
|
||||||
Buid
|
Buid
|
||||||
buildcommand
|
buildcommand
|
||||||
buildtools
|
buildtools
|
||||||
@@ -469,7 +469,6 @@ DISPIDAMBIENTDLCONTROL
|
|||||||
DISPINFO
|
DISPINFO
|
||||||
Displayandhidethedesktop
|
Displayandhidethedesktop
|
||||||
DISPLAYCHANGE
|
DISPLAYCHANGE
|
||||||
DISPLAYNAME
|
|
||||||
displayname
|
displayname
|
||||||
divyan
|
divyan
|
||||||
DLACTIVEXCTLS
|
DLACTIVEXCTLS
|
||||||
@@ -862,7 +861,6 @@ HLSL
|
|||||||
hmenu
|
hmenu
|
||||||
hmodule
|
hmodule
|
||||||
hmon
|
hmon
|
||||||
HMONITOR
|
|
||||||
hmonitor
|
hmonitor
|
||||||
HOLDENTER
|
HOLDENTER
|
||||||
HOLDESC
|
HOLDESC
|
||||||
@@ -981,7 +979,6 @@ IJson
|
|||||||
IList
|
IList
|
||||||
ILogon
|
ILogon
|
||||||
IMAGEHLP
|
IMAGEHLP
|
||||||
IMAGENAME
|
|
||||||
imageresizer
|
imageresizer
|
||||||
IMAGERESIZEREXT
|
IMAGERESIZEREXT
|
||||||
imageresizersettings
|
imageresizersettings
|
||||||
@@ -1852,7 +1849,7 @@ RUNLEVEL
|
|||||||
runsettings
|
runsettings
|
||||||
runtimeclass
|
runtimeclass
|
||||||
runtimeconfig
|
runtimeconfig
|
||||||
Runtimes
|
runtimes
|
||||||
rv
|
rv
|
||||||
rvalue
|
rvalue
|
||||||
rvm
|
rvm
|
||||||
@@ -2492,7 +2489,6 @@ XOffset
|
|||||||
xpath
|
xpath
|
||||||
XResource
|
XResource
|
||||||
xsd
|
xsd
|
||||||
xsi
|
|
||||||
XSmall
|
XSmall
|
||||||
XStr
|
XStr
|
||||||
XToolset
|
XToolset
|
||||||
|
|||||||
@@ -161,6 +161,12 @@
|
|||||||
<value>Exit</value>
|
<value>Exit</value>
|
||||||
<comment>Exit as a verb, as in Exit the application</comment>
|
<comment>Exit as a verb, as in Exit the application</comment>
|
||||||
</data>
|
</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">
|
<data name="GITHUB_NEW_VERSION_USING_LOCAL_BUILD_ERROR" xml:space="preserve">
|
||||||
<value>Updating from a local build is not supported.</value>
|
<value>Updating from a local build is not supported.</value>
|
||||||
<comment>User cannot autoupdate from a locally-built PowerToys version</comment>
|
<comment>User cannot autoupdate from a locally-built PowerToys version</comment>
|
||||||
|
|||||||
@@ -17,4 +17,5 @@
|
|||||||
|
|
||||||
#define ID_EXIT_MENU_COMMAND 40001
|
#define ID_EXIT_MENU_COMMAND 40001
|
||||||
#define ID_SETTINGS_MENU_COMMAND 40002
|
#define ID_SETTINGS_MENU_COMMAND 40002
|
||||||
#define ID_ABOUT_MENU_COMMAND 40003
|
#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 "tray_icon.h"
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
#include <common/utils/process_path.h>
|
||||||
#include <common/utils/resources.h>
|
#include <common/utils/resources.h>
|
||||||
#include <common/version/version.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);
|
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)
|
LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
@@ -82,28 +125,7 @@ LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam
|
|||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (wparam)
|
handle_tray_command(window, 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;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
// Shell_NotifyIcon can fail when we invoke it during the time explorer.exe isn't present/ready to handle it.
|
// 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
|
// 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 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 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_SETTINGS_MENU_COMMAND, settings_menuitem_label.data());
|
||||||
change_menu_item_text(ID_EXIT_MENU_COMMAND, exit_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)
|
if (!h_sub_menu)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user