Add 'Copy as path' option to More menu
Some checks failed
MSBuild / build (push) Has been cancelled
MSBuild / publish (push) Has been cancelled

This commit is contained in:
ema
2025-09-08 03:53:16 +08:00
parent c748f6d7e4
commit a491ed9970
3 changed files with 32 additions and 2 deletions

View File

@@ -236,6 +236,8 @@
<InfoPanel_Files>{0} files</InfoPanel_Files>
<InfoPanel_FolderAndFile>({0} and {1})</InfoPanel_FolderAndFile>
<InfoPanel_CantPreventClosing>Cancellation of "Prevent Closing" is not supported</InfoPanel_CantPreventClosing>
<InfoPanelMoreItem_CopyAsPath>Copy as path</InfoPanelMoreItem_CopyAsPath>
<InfoPanelMoreItem_CopySucc>Copy successfully</InfoPanelMoreItem_CopySucc>
</en>
<es>
<UI_FontFamily>Segoe UI</UI_FontFamily>

View File

@@ -132,9 +132,17 @@
ToolTip="More">
<Button.ContextMenu>
<ContextMenu FontSize="12">
<MenuItem Command="{Binding OpenSettingsFileFolderCommand}" Header="SettingsFile">
<MenuItem x:Name="moreItemCopyAsPath">
<MenuItem.Icon>
<ui:FontIcon FontFamily="{DynamicResource SymbolThemeFontFamily}" Glyph="{x:Static ui:FontSymbols.OpenLocal}" />
<ui:FontIcon FontFamily="{DynamicResource SymbolThemeFontFamily}" Glyph="{x:Static ui:FontSymbols.Copy}" />
</MenuItem.Icon>
</MenuItem>
<Separator Visibility="Collapsed" />
<MenuItem x:Name="moreItemOpenSettings"
Header="Settings"
Visibility="Collapsed">
<MenuItem.Icon>
<ui:FontIcon FontFamily="{DynamicResource SymbolThemeFontFamily}" Glyph="{x:Static ui:FontSymbols.Settings}" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>

View File

@@ -20,6 +20,7 @@ using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin;
using QuickLook.Helpers;
using System;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Input;
@@ -110,6 +111,24 @@ public partial class ViewerWindow : Window
buttonReload.Visibility = SettingHelper.Get("ShowReload", false) ? Visibility.Visible : Visibility.Collapsed;
moreItemCopyAsPath.Click += (_, _) =>
{
try
{
Clipboard.SetText(_path);
Toast.Success(TranslationHelper.Get("InfoPanelMoreItem_CopySucc"));
}
catch (Exception e)
{
Debug.WriteLine(e);
}
};
moreItemOpenSettings.Click += (_, _) =>
{
Toast.Warning("Coming soon...");
};
// Set UI translations
buttonTop.ToolTip = TranslationHelper.Get("MW_StayTop");
buttonPin.ToolTip = TranslationHelper.Get("MW_PreventClosing");
@@ -117,6 +136,7 @@ public partial class ViewerWindow : Window
buttonShare.ToolTip = TranslationHelper.Get("MW_Share");
buttonReload.ToolTip = TranslationHelper.Get("MW_Reload", failsafe: "Reload");
buttonMore.ToolTip = TranslationHelper.Get("MW_More", failsafe: "More");
moreItemCopyAsPath.Header = TranslationHelper.Get("InfoPanelMoreItem_CopyAsPath");
}
public new void Close()