mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-05 20:54:31 +13:00
Merge pull request #1564 from stdray/keys-apps
Add support for context menu keyboard key to uploads listview
This commit is contained in:
commit
478eca9e58
2 changed files with 33 additions and 0 deletions
2
ShareX/Forms/MainForm.Designer.cs
generated
2
ShareX/Forms/MainForm.Designer.cs
generated
|
@ -907,6 +907,8 @@ private void InitializeComponent()
|
|||
this.tsmiImagePreview});
|
||||
this.cmsTaskInfo.Name = "cmsHistory";
|
||||
resources.ApplyResources(this.cmsTaskInfo, "cmsTaskInfo");
|
||||
this.cmsTaskInfo.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.cmsTaskInfo_Closing);
|
||||
this.cmsTaskInfo.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.cmsTaskInfo_PreviewKeyDown);
|
||||
//
|
||||
// tsmiShowErrors
|
||||
//
|
||||
|
|
|
@ -1319,11 +1319,42 @@ private void lvUploads_KeyDown(object sender, KeyEventArgs e)
|
|||
uim.DeleteFiles();
|
||||
RemoveSelectedItems();
|
||||
break;
|
||||
case Keys.Apps:
|
||||
if (lvUploads.SelectedItems.Count > 0)
|
||||
{
|
||||
UpdateContextMenu();
|
||||
cmsTaskInfo.Show(lvUploads, lvUploads.SelectedItems[0].Position);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
e.Handled = e.SuppressKeyPress = true;
|
||||
}
|
||||
|
||||
private void cmsTaskInfo_Closing(object sender, ToolStripDropDownClosingEventArgs e)
|
||||
{
|
||||
switch (e.CloseReason)
|
||||
{
|
||||
default:
|
||||
return;
|
||||
case ToolStripDropDownCloseReason.Keyboard:
|
||||
e.Cancel = !(NativeMethods.GetKeyState((int)Keys.Apps) < 0 || NativeMethods.GetKeyState((int)Keys.F10) < 0 || NativeMethods.GetKeyState((int)Keys.Escape) < 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void cmsTaskInfo_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
|
||||
{
|
||||
switch (e.KeyData)
|
||||
{
|
||||
default:
|
||||
return;
|
||||
case Keys.Apps:
|
||||
cmsTaskInfo.Close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void lvUploads_ItemDrag(object sender, ItemDragEventArgs e)
|
||||
{
|
||||
TaskInfo[] taskInfos = GetCurrentTasks().Select(x => x.Info).Where(x => x != null).ToArray();
|
||||
|
|
Loading…
Reference in a new issue