mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-20 11:07:21 +01:00
Compare commits
2 Commits
dev/migrie
...
shawn/fixC
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec52676864 | ||
|
|
8258f2ab6f |
@@ -1,47 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using ManagedCommon;
|
||||
using Microsoft.CmdPal.Ext.Apps.Properties;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.Apps.Commands;
|
||||
|
||||
internal sealed partial class CopyPathCommand : InvokableCommand
|
||||
{
|
||||
private readonly string _target;
|
||||
|
||||
public CopyPathCommand(string target)
|
||||
{
|
||||
Name = Resources.copy_path;
|
||||
Icon = Icons.CopyIcon;
|
||||
|
||||
_target = target;
|
||||
}
|
||||
|
||||
private static readonly CompositeFormat CopyFailedFormat = CompositeFormat.Parse(Resources.copy_failed);
|
||||
|
||||
public override CommandResult Invoke()
|
||||
{
|
||||
try
|
||||
{
|
||||
ClipboardHelper.SetText(_target);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Copy failed: " + ex.Message);
|
||||
return CommandResult.ShowToast(
|
||||
new ToastArgs
|
||||
{
|
||||
Message = string.Format(CultureInfo.CurrentCulture, CopyFailedFormat, ex.Message),
|
||||
Result = CommandResult.KeepOpen(),
|
||||
});
|
||||
}
|
||||
|
||||
return CommandResult.ShowToast(Resources.copied_to_clipboard);
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class UWPApplication : IUWPApplication
|
||||
|
||||
commands.Add(
|
||||
new CommandContextItem(
|
||||
new Commands.CopyPathCommand(Location))
|
||||
new CopyTextCommand(Location) { Name = Resources.copy_path })
|
||||
{
|
||||
RequestedShortcut = KeyChordHelpers.FromModifiers(ctrl: true, shift: true, vkey: VirtualKey.C),
|
||||
});
|
||||
|
||||
@@ -202,7 +202,7 @@ public class Win32Program : IProgram
|
||||
}
|
||||
|
||||
commands.Add(new CommandContextItem(
|
||||
new Commands.CopyPathCommand(FullPath))
|
||||
new CopyTextCommand(FullPath) { Name = Resources.copy_path })
|
||||
{
|
||||
RequestedShortcut = KeyChordHelpers.FromModifiers(ctrl: true, shift: true, vkey: VirtualKey.C),
|
||||
});
|
||||
|
||||
@@ -78,24 +78,6 @@ namespace Microsoft.CmdPal.Ext.Apps.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copied to clipboard!.
|
||||
/// </summary>
|
||||
internal static string copied_to_clipboard {
|
||||
get {
|
||||
return ResourceManager.GetString("copied_to_clipboard", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy failed ({0}). Please try again..
|
||||
/// </summary>
|
||||
internal static string copy_failed {
|
||||
get {
|
||||
return ResourceManager.GetString("copy_failed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy path.
|
||||
/// </summary>
|
||||
|
||||
@@ -172,13 +172,6 @@
|
||||
<data name="run_as_different_user" xml:space="preserve">
|
||||
<value>Run as different user</value>
|
||||
</data>
|
||||
<data name="copy_failed" xml:space="preserve">
|
||||
<value>Copy failed ({0}). Please try again.</value>
|
||||
<comment>{0} is the error message</comment>
|
||||
</data>
|
||||
<data name="copied_to_clipboard" xml:space="preserve">
|
||||
<value>Copied to clipboard!</value>
|
||||
</data>
|
||||
<data name="enable_start_menu_source" xml:space="preserve">
|
||||
<value>Include apps found in the Start Menu</value>
|
||||
</data>
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Resources;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.CmdPal.Ext.WindowsSettings.Classes;
|
||||
using Microsoft.CmdPal.Ext.WindowsSettings.Properties;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
using Windows.ApplicationModel.DataTransfer;
|
||||
using Windows.Networking.NetworkOperators;
|
||||
using Windows.UI;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.WindowsSettings.Commands;
|
||||
|
||||
internal sealed partial class CopySettingCommand : InvokableCommand
|
||||
{
|
||||
private readonly WindowsSetting _entry;
|
||||
|
||||
internal CopySettingCommand(WindowsSetting entry)
|
||||
{
|
||||
Name = Resources.CopyCommand;
|
||||
Icon = Icons.CopyIcon;
|
||||
_entry = entry;
|
||||
}
|
||||
|
||||
public override CommandResult Invoke()
|
||||
{
|
||||
ClipboardHelper.SetText(_entry.Command);
|
||||
|
||||
return CommandResult.Dismiss();
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ internal static class ContextMenuHelper
|
||||
{
|
||||
var list = new List<CommandContextItem>(1)
|
||||
{
|
||||
new(new CopySettingCommand(entry)),
|
||||
new(new CopyTextCommand(entry.Command) { Name = Resources.CopyCommand }),
|
||||
};
|
||||
|
||||
return list;
|
||||
|
||||
@@ -548,18 +548,14 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
}
|
||||
}
|
||||
|
||||
if (conflictingModules.Count > 0)
|
||||
var moduleNames = conflictingModules.ToArray();
|
||||
if (string.Equals(moduleNames[0], "System", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var moduleNames = conflictingModules.ToArray();
|
||||
var conflictMessage = moduleNames.Length == 1
|
||||
? $"Conflict detected with {moduleNames[0]}"
|
||||
: $"Conflicts detected with: {string.Join(", ", moduleNames)}";
|
||||
|
||||
c.ConflictMessage = conflictMessage;
|
||||
c.ConflictMessage = ResourceLoaderInstance.ResourceLoader.GetString("SysHotkeyConflictTooltipText");
|
||||
}
|
||||
else
|
||||
{
|
||||
c.ConflictMessage = "Conflict detected with unknown module";
|
||||
c.ConflictMessage = ResourceLoaderInstance.ResourceLoader.GetString("InAppHotkeyConflictTooltipText");
|
||||
}
|
||||
|
||||
c.HasConflict = true;
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
IsTabStop="{Binding ElementName=ShortcutContentControl, Path=IsWarningAltGr, Mode=OneWay}"
|
||||
Severity="Warning" />
|
||||
<InfoBar
|
||||
Title="Hotkey Conflict"
|
||||
x:Uid="WarningShortcutConflict"
|
||||
IsClosable="False"
|
||||
IsOpen="{Binding ElementName=ShortcutContentControl, Path=HasConflict, Mode=OneWay}"
|
||||
IsTabStop="{Binding ElementName=ShortcutContentControl, Path=HasConflict, Mode=OneWay}"
|
||||
|
||||
@@ -2691,6 +2691,12 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<value>Shortcuts with **Ctrl** and **Alt** may remove functionality from some international keyboards, because **Ctrl** + **Alt** = **Alt Gr** in those keyboards.</value>
|
||||
<comment>The ** sequences are used for text formatting of the key names. Don't remove them on translation.</comment>
|
||||
</data>
|
||||
<data name="WarningShortcutConflict.Title" xml:space="preserve">
|
||||
<value>Shortcut conflict</value>
|
||||
</data>
|
||||
<data name="WarningShortcutConflict.ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>A conflict has been detected for this shortcut.</value>
|
||||
</data>
|
||||
<data name="FancyZones_SpanZonesAcrossMonitors.Description" xml:space="preserve">
|
||||
<value>All monitors must have the same DPI scaling and will be treated as one large combined rectangle which contains all monitors</value>
|
||||
</data>
|
||||
|
||||
@@ -145,6 +145,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
// Get current hotkey settings (fresh from file) using the accessor's getter
|
||||
module.HotkeySettings = hotkeyAccessor.Value;
|
||||
module.HotkeySettings.ConflictDescription = isSystemConflict
|
||||
? ResourceLoaderInstance.ResourceLoader.GetString("SysHotkeyConflictTooltipText")
|
||||
: ResourceLoaderInstance.ResourceLoader.GetString("InAppHotkeyConflictTooltipText");
|
||||
|
||||
// Set header using localization key
|
||||
module.Header = GetHotkeyLocalizationHeader(module.ModuleName, module.HotkeyID, hotkeyAccessor.LocalizationHeaderKey);
|
||||
|
||||
Reference in New Issue
Block a user