From 93c51409cbc363fe72f7f98ecce8fa4382d598c8 Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Mon, 3 Jun 2024 23:13:19 +0900 Subject: [PATCH 1/8] Init --- src/Files.App/Data/Items/ListedItem.cs | 27 +++++++++++++++++++ .../Enumerators/Win32StorageEnumerator.cs | 22 ++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/Files.App/Data/Items/ListedItem.cs b/src/Files.App/Data/Items/ListedItem.cs index 136cece6e0ba..f158b5ea6ad3 100644 --- a/src/Files.App/Data/Items/ListedItem.cs +++ b/src/Files.App/Data/Items/ListedItem.cs @@ -45,6 +45,8 @@ public string ItemTooltipText tooltipBuilder.Append($"{"ToolTipDescriptionDate".GetLocalizedResource()} {ItemDateModified}"); if (!string.IsNullOrWhiteSpace(FileSize)) tooltipBuilder.Append($"{Environment.NewLine}{"SizeLabel".GetLocalizedResource()} {FileSize}"); + if (IsImage && ImageWidth > 0 && ImageHeight > 0) + tooltipBuilder.Append($"{Environment.NewLine}{"PropertyDimensions".GetLocalizedResource()}: {DimensionsDisplay}"); if (SyncStatusUI.LoadSyncStatus) tooltipBuilder.Append($"{Environment.NewLine}{"syncStatusColumn/Header".GetLocalizedResource()}: {syncStatusUI.SyncStatusString}"); @@ -326,6 +328,30 @@ public ObservableCollection ItemProperties set => SetProperty(ref itemProperties, value); } + private int imageWidth; + public int ImageWidth + { + get => imageWidth; + set + { + SetProperty(ref imageWidth, value); + OnPropertyChanged(nameof(DimensionsDisplay)); + } + } + + private int imageHeight; + public int ImageHeight + { + get => imageHeight; + set + { + SetProperty(ref imageHeight, value); + OnPropertyChanged(nameof(DimensionsDisplay)); + } + } + + public string DimensionsDisplay => IsImage ? $"{ImageWidth} \u00D7 {ImageHeight}" : string.Empty; + /// /// Initializes a new instance of the class. /// @@ -374,6 +400,7 @@ public override string ToString() public bool IsArchive => this is ZipItem; public bool IsAlternateStream => this is AlternateStreamItem; public bool IsGitItem => this is GitItem; + public virtual bool IsImage => FileExtensionHelpers.IsImageFile(ItemPath); public virtual bool IsExecutable => FileExtensionHelpers.IsExecutableFile(ItemPath); public virtual bool IsScriptFile => FileExtensionHelpers.IsScriptFile(ItemPath); public bool IsPinned => App.QuickAccessManager.Model.PinnedFolders.Contains(itemPath); diff --git a/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs b/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs index 610af9ab439b..2ab77afe49fe 100644 --- a/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs +++ b/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs @@ -1,6 +1,7 @@ // Copyright (c) 2024 Files Community // Licensed under the MIT License. See the LICENSE. +using System.Drawing; using Files.App.Services.SizeProvider; using Files.Shared.Helpers; using System.IO; @@ -260,6 +261,23 @@ CancellationToken cancellationToken itemType = itemFileExtension.Trim('.') + " " + itemType; } + int imageHeight = 0; + int imageWidth = 0; + if (FileExtensionHelpers.IsImageFile(itemFileExtension)) + { + try + { + await using FileStream fileStream = new(itemPath, FileMode.Open, FileAccess.Read, FileShare.Read); + using Image image = Image.FromStream(fileStream, false, false); + if (image is not null) + { + imageHeight = image.Height; + imageWidth = image.Width; + } + } + catch { } + } + bool itemThumbnailImgVis = false; bool itemEmptyImgVis = true; @@ -396,7 +414,9 @@ CancellationToken cancellationToken ItemType = itemType, ItemPath = itemPath, FileSize = itemSize, - FileSizeBytes = itemSizeBytes + FileSizeBytes = itemSizeBytes, + ImageHeight = imageHeight, + ImageWidth = imageWidth }; } } From 8ebb5c575f16afc104f06a789a83519d980899d4 Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Tue, 4 Jun 2024 19:45:18 +0900 Subject: [PATCH 2/8] =?UTF-8?q?ListedItem.cs=20=E3=82=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: hishitetsu <66369541+hishitetsu@users.noreply.github.com> --- src/Files.App/Data/Items/ListedItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Files.App/Data/Items/ListedItem.cs b/src/Files.App/Data/Items/ListedItem.cs index f158b5ea6ad3..18957f24027d 100644 --- a/src/Files.App/Data/Items/ListedItem.cs +++ b/src/Files.App/Data/Items/ListedItem.cs @@ -45,7 +45,7 @@ public string ItemTooltipText tooltipBuilder.Append($"{"ToolTipDescriptionDate".GetLocalizedResource()} {ItemDateModified}"); if (!string.IsNullOrWhiteSpace(FileSize)) tooltipBuilder.Append($"{Environment.NewLine}{"SizeLabel".GetLocalizedResource()} {FileSize}"); - if (IsImage && ImageWidth > 0 && ImageHeight > 0) + if (!string.IsNullOrWhiteSpace(DimensionsDisplay)) tooltipBuilder.Append($"{Environment.NewLine}{"PropertyDimensions".GetLocalizedResource()}: {DimensionsDisplay}"); if (SyncStatusUI.LoadSyncStatus) tooltipBuilder.Append($"{Environment.NewLine}{"syncStatusColumn/Header".GetLocalizedResource()}: {syncStatusUI.SyncStatusString}"); From 92c795eabf145b0ed0e2b1209ed96ffa60a8b5f2 Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Tue, 4 Jun 2024 19:45:22 +0900 Subject: [PATCH 3/8] =?UTF-8?q?ListedItem.cs=20=E3=82=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: hishitetsu <66369541+hishitetsu@users.noreply.github.com> --- src/Files.App/Data/Items/ListedItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Files.App/Data/Items/ListedItem.cs b/src/Files.App/Data/Items/ListedItem.cs index 18957f24027d..74be5f0e0c48 100644 --- a/src/Files.App/Data/Items/ListedItem.cs +++ b/src/Files.App/Data/Items/ListedItem.cs @@ -350,7 +350,7 @@ public int ImageHeight } } - public string DimensionsDisplay => IsImage ? $"{ImageWidth} \u00D7 {ImageHeight}" : string.Empty; + public string DimensionsDisplay => IsImage && ImageWidth > 0 && ImageHeight > 0 ? $"{ImageWidth} \u00D7 {ImageHeight}" : string.Empty; /// /// Initializes a new instance of the class. From 6b15c6809153206096a9737dfa114d38f54d583f Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Fri, 7 Jun 2024 21:53:40 +0900 Subject: [PATCH 4/8] Req --- .../Content/Background/BaseSetAsAction.cs | 2 +- .../ImageManipulation/BaseRotateAction.cs | 2 +- .../ContentPageContextFlyoutFactory.cs | 6 +-- src/Files.App/Data/Items/ListedItem.cs | 48 ++++++++++++------- .../SelectedItemsPropertiesViewModel.cs | 4 +- .../Enumerators/Win32StorageEnumerator.cs | 18 ------- .../Helpers/FileExtensionHelpers.cs | 12 ++++- 7 files changed, 48 insertions(+), 44 deletions(-) diff --git a/src/Files.App/Actions/Content/Background/BaseSetAsAction.cs b/src/Files.App/Actions/Content/Background/BaseSetAsAction.cs index a39a2d33fb05..ce84cc73961b 100644 --- a/src/Files.App/Actions/Content/Background/BaseSetAsAction.cs +++ b/src/Files.App/Actions/Content/Background/BaseSetAsAction.cs @@ -17,7 +17,7 @@ internal abstract class BaseSetAsAction : ObservableObject, IAction context.ShellPage is not null && context.PageType != ContentPageTypes.RecycleBin && context.PageType != ContentPageTypes.ZipFolder && - (context.ShellPage?.SlimContentPage?.SelectedItemsPropertiesViewModel?.IsSelectedItemImage ?? false); + (context.ShellPage?.SlimContentPage?.SelectedItemsPropertiesViewModel?.CanSelectedItemBeManipulated ?? false); public BaseSetAsAction() { diff --git a/src/Files.App/Actions/Content/ImageManipulation/BaseRotateAction.cs b/src/Files.App/Actions/Content/ImageManipulation/BaseRotateAction.cs index 0087b942f38b..08087e996fba 100644 --- a/src/Files.App/Actions/Content/ImageManipulation/BaseRotateAction.cs +++ b/src/Files.App/Actions/Content/ImageManipulation/BaseRotateAction.cs @@ -21,7 +21,7 @@ internal abstract class BaseRotateAction : ObservableObject, IAction public bool IsExecutable => IsContextPageTypeAdaptedToCommand() && - (context.ShellPage?.SlimContentPage?.SelectedItemsPropertiesViewModel?.IsSelectedItemImage ?? false); + (context.ShellPage?.SlimContentPage?.SelectedItemsPropertiesViewModel?.CanSelectedItemBeManipulated ?? false); public BaseRotateAction() { diff --git a/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs b/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs index fcbc75e0a82b..dd61edd65842 100644 --- a/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs +++ b/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs @@ -405,7 +405,7 @@ public static List GetBaseItemMenuItems( new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutItemContextFlyoutSetAs/Text".GetLocalizedResource(), - ShowItem = itemsSelected && (selectedItemsPropertiesViewModel?.IsSelectedItemImage ?? false), + ShowItem = itemsSelected && (selectedItemsPropertiesViewModel?.CanSelectedItemBeManipulated ?? false), ShowInSearchPage = true, Items = [ @@ -419,13 +419,13 @@ public static List GetBaseItemMenuItems( { IsVisible = !currentInstanceViewModel.IsPageTypeRecycleBin && !currentInstanceViewModel.IsPageTypeZipFolder - && (selectedItemsPropertiesViewModel?.IsSelectedItemImage ?? false) + && (selectedItemsPropertiesViewModel?.CanSelectedItemBeManipulated ?? false) }.Build(), new ContextMenuFlyoutItemViewModelBuilder(Commands.RotateRight) { IsVisible = !currentInstanceViewModel.IsPageTypeRecycleBin && !currentInstanceViewModel.IsPageTypeZipFolder - && (selectedItemsPropertiesViewModel?.IsSelectedItemImage ?? false) + && (selectedItemsPropertiesViewModel?.CanSelectedItemBeManipulated ?? false) }.Build(), new ContextMenuFlyoutItemViewModelBuilder(Commands.RunAsAdmin).Build(), new ContextMenuFlyoutItemViewModelBuilder(Commands.RunAsAnotherUser).Build(), diff --git a/src/Files.App/Data/Items/ListedItem.cs b/src/Files.App/Data/Items/ListedItem.cs index 74be5f0e0c48..8967c122dabe 100644 --- a/src/Files.App/Data/Items/ListedItem.cs +++ b/src/Files.App/Data/Items/ListedItem.cs @@ -6,6 +6,7 @@ using FluentFTP; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media.Imaging; +using System.Drawing; using System.IO; using System.Text; using Windows.Storage; @@ -328,30 +329,41 @@ public ObservableCollection ItemProperties set => SetProperty(ref itemProperties, value); } - private int imageWidth; - public int ImageWidth + public string DimensionsDisplay { - get => imageWidth; - set + get { - SetProperty(ref imageWidth, value); - OnPropertyChanged(nameof(DimensionsDisplay)); - } - } + int imageHeight = 0; + int imageWidth = 0; - private int imageHeight; - public int ImageHeight - { - get => imageHeight; - set - { - SetProperty(ref imageHeight, value); - OnPropertyChanged(nameof(DimensionsDisplay)); + var isImageFile = FileExtensionHelpers.IsImageFile(FileExtension); + if (isImageFile) + { + try + { + // TODO: Consider to use 'System.Kind' instead. + using FileStream fileStream = new(ItemPath, FileMode.Open, FileAccess.Read, FileShare.Read); + using Image image = Image.FromStream(fileStream, false, false); + + if (image is not null) + { + imageHeight = image.Height; + imageWidth = image.Width; + } + } + catch { } + } + + + return + isImageFile && + imageWidth > 0 && + imageHeight > 0 + ? $"{imageWidth} \uE711 {imageHeight}" + : string.Empty; } } - public string DimensionsDisplay => IsImage && ImageWidth > 0 && ImageHeight > 0 ? $"{ImageWidth} \u00D7 {ImageHeight}" : string.Empty; - /// /// Initializes a new instance of the class. /// diff --git a/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs b/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs index 8098777db929..df9e99313116 100644 --- a/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs +++ b/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs @@ -530,7 +530,7 @@ public SelectedItemsPropertiesViewModel() } private bool isSelectedItemImage = false; - public bool IsSelectedItemImage + public bool CanSelectedItemBeManipulated { get => isSelectedItemImage; set => SetProperty(ref isSelectedItemImage, value); @@ -546,7 +546,7 @@ public bool IsSelectedItemShortcut public void CheckAllFileExtensions(List itemExtensions) { // Checks if all the item extensions are image extensions of some kind. - IsSelectedItemImage = itemExtensions.TrueForAll(itemExtension => FileExtensionHelpers.IsImageFile(itemExtension)); + CanSelectedItemBeManipulated = itemExtensions.TrueForAll(FileExtensionHelpers.IsManipulateableImageFile); // Checks if there is only one selected item and if it's a shortcut. IsSelectedItemShortcut = (itemExtensions.Count == 1) && (itemExtensions.TrueForAll(itemExtension => FileExtensionHelpers.IsShortcutFile(itemExtension))); } diff --git a/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs b/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs index 2ab77afe49fe..7386ac865a4d 100644 --- a/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs +++ b/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs @@ -1,7 +1,6 @@ // Copyright (c) 2024 Files Community // Licensed under the MIT License. See the LICENSE. -using System.Drawing; using Files.App.Services.SizeProvider; using Files.Shared.Helpers; using System.IO; @@ -261,23 +260,6 @@ CancellationToken cancellationToken itemType = itemFileExtension.Trim('.') + " " + itemType; } - int imageHeight = 0; - int imageWidth = 0; - if (FileExtensionHelpers.IsImageFile(itemFileExtension)) - { - try - { - await using FileStream fileStream = new(itemPath, FileMode.Open, FileAccess.Read, FileShare.Read); - using Image image = Image.FromStream(fileStream, false, false); - if (image is not null) - { - imageHeight = image.Height; - imageWidth = image.Width; - } - } - catch { } - } - bool itemThumbnailImgVis = false; bool itemEmptyImgVis = true; diff --git a/src/Files.Shared/Helpers/FileExtensionHelpers.cs b/src/Files.Shared/Helpers/FileExtensionHelpers.cs index 75606f5fc261..85293e3ed3dd 100644 --- a/src/Files.Shared/Helpers/FileExtensionHelpers.cs +++ b/src/Files.Shared/Helpers/FileExtensionHelpers.cs @@ -31,10 +31,20 @@ public static bool HasExtension(string? filePathToCheck, params string[] extensi /// The file extension to check. /// true if the fileExtensionToCheck is an image; otherwise, false. public static bool IsImageFile(string? fileExtensionToCheck) + { + return HasExtension(fileExtensionToCheck, ".png", ".bmp", ".jpg", ".jpeg", ".jfif", ".gif", ".tiff", ".tif", ".webp"); + } + + /// + /// Checks if the file can be set as wallpaper. + /// + /// The file extension to check. + /// true if the fileExtensionToCheck is an image; otherwise, false. + public static bool IsManipulateableImageFile(string? fileExtensionToCheck) { return HasExtension(fileExtensionToCheck, ".png", ".bmp", ".jpg", ".jpeg", ".jfif", ".gif", ".tiff", ".tif"); } - + /// /// Check if the file extension is an audio file. /// From 97caec1bfc885ffed51b12888623c9df7b58175d Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Fri, 7 Jun 2024 22:12:47 +0900 Subject: [PATCH 5/8] Use U+00D7 --- src/Files.App/Data/Items/ListedItem.cs | 2 +- .../Utils/Storage/Enumerators/Win32StorageEnumerator.cs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Files.App/Data/Items/ListedItem.cs b/src/Files.App/Data/Items/ListedItem.cs index 8967c122dabe..e0cddf683a10 100644 --- a/src/Files.App/Data/Items/ListedItem.cs +++ b/src/Files.App/Data/Items/ListedItem.cs @@ -359,7 +359,7 @@ public string DimensionsDisplay isImageFile && imageWidth > 0 && imageHeight > 0 - ? $"{imageWidth} \uE711 {imageHeight}" + ? $"{imageWidth} \u00D7 {imageHeight}" : string.Empty; } } diff --git a/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs b/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs index 7386ac865a4d..0d70c78445d5 100644 --- a/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs +++ b/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs @@ -397,8 +397,6 @@ CancellationToken cancellationToken ItemPath = itemPath, FileSize = itemSize, FileSizeBytes = itemSizeBytes, - ImageHeight = imageHeight, - ImageWidth = imageWidth }; } } From b88878ef42ca35b929c13e6aee51dca6ff9e2320 Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Fri, 7 Jun 2024 22:14:50 +0900 Subject: [PATCH 6/8] Revert unnecessary changes --- src/Files.App/Data/Items/ListedItem.cs | 1 - .../Utils/Storage/Enumerators/Win32StorageEnumerator.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Files.App/Data/Items/ListedItem.cs b/src/Files.App/Data/Items/ListedItem.cs index e0cddf683a10..5486c5f904f6 100644 --- a/src/Files.App/Data/Items/ListedItem.cs +++ b/src/Files.App/Data/Items/ListedItem.cs @@ -412,7 +412,6 @@ public override string ToString() public bool IsArchive => this is ZipItem; public bool IsAlternateStream => this is AlternateStreamItem; public bool IsGitItem => this is GitItem; - public virtual bool IsImage => FileExtensionHelpers.IsImageFile(ItemPath); public virtual bool IsExecutable => FileExtensionHelpers.IsExecutableFile(ItemPath); public virtual bool IsScriptFile => FileExtensionHelpers.IsScriptFile(ItemPath); public bool IsPinned => App.QuickAccessManager.Model.PinnedFolders.Contains(itemPath); diff --git a/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs b/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs index 0d70c78445d5..610af9ab439b 100644 --- a/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs +++ b/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs @@ -396,7 +396,7 @@ CancellationToken cancellationToken ItemType = itemType, ItemPath = itemPath, FileSize = itemSize, - FileSizeBytes = itemSizeBytes, + FileSizeBytes = itemSizeBytes }; } } From 63f8ec6ee59d8c1c978a321e2924002fa8025a53 Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:38:23 +0900 Subject: [PATCH 7/8] Req --- src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs | 2 +- src/Files.Shared/Helpers/FileExtensionHelpers.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs b/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs index df9e99313116..3be28491a4aa 100644 --- a/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs +++ b/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs @@ -546,7 +546,7 @@ public bool IsSelectedItemShortcut public void CheckAllFileExtensions(List itemExtensions) { // Checks if all the item extensions are image extensions of some kind. - CanSelectedItemBeManipulated = itemExtensions.TrueForAll(FileExtensionHelpers.IsManipulateableImageFile); + CanSelectedItemBeManipulated = itemExtensions.TrueForAll(FileExtensionHelpers.IsCompatibleToSetAsWindowsWallpaper); // Checks if there is only one selected item and if it's a shortcut. IsSelectedItemShortcut = (itemExtensions.Count == 1) && (itemExtensions.TrueForAll(itemExtension => FileExtensionHelpers.IsShortcutFile(itemExtension))); } diff --git a/src/Files.Shared/Helpers/FileExtensionHelpers.cs b/src/Files.Shared/Helpers/FileExtensionHelpers.cs index 85293e3ed3dd..7aea2c521ab8 100644 --- a/src/Files.Shared/Helpers/FileExtensionHelpers.cs +++ b/src/Files.Shared/Helpers/FileExtensionHelpers.cs @@ -40,7 +40,7 @@ public static bool IsImageFile(string? fileExtensionToCheck) /// /// The file extension to check. /// true if the fileExtensionToCheck is an image; otherwise, false. - public static bool IsManipulateableImageFile(string? fileExtensionToCheck) + public static bool IsCompatibleToSetAsWindowsWallpaper(string? fileExtensionToCheck) { return HasExtension(fileExtensionToCheck, ".png", ".bmp", ".jpg", ".jpeg", ".jfif", ".gif", ".tiff", ".tif"); } From b144937b04c29cdb869f8601b74261a774be9eb1 Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Tue, 11 Jun 2024 03:26:11 +0900 Subject: [PATCH 8/8] Rename --- src/Files.App/Actions/Content/Background/BaseSetAsAction.cs | 2 +- .../Actions/Content/ImageManipulation/BaseRotateAction.cs | 2 +- .../Data/Factories/ContentPageContextFlyoutFactory.cs | 6 +++--- .../Data/Models/SelectedItemsPropertiesViewModel.cs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Files.App/Actions/Content/Background/BaseSetAsAction.cs b/src/Files.App/Actions/Content/Background/BaseSetAsAction.cs index ce84cc73961b..d4239457c320 100644 --- a/src/Files.App/Actions/Content/Background/BaseSetAsAction.cs +++ b/src/Files.App/Actions/Content/Background/BaseSetAsAction.cs @@ -17,7 +17,7 @@ internal abstract class BaseSetAsAction : ObservableObject, IAction context.ShellPage is not null && context.PageType != ContentPageTypes.RecycleBin && context.PageType != ContentPageTypes.ZipFolder && - (context.ShellPage?.SlimContentPage?.SelectedItemsPropertiesViewModel?.CanSelectedItemBeManipulated ?? false); + (context.ShellPage?.SlimContentPage?.SelectedItemsPropertiesViewModel?.IsCompatibleToSetAsWindowsWallpaper ?? false); public BaseSetAsAction() { diff --git a/src/Files.App/Actions/Content/ImageManipulation/BaseRotateAction.cs b/src/Files.App/Actions/Content/ImageManipulation/BaseRotateAction.cs index 08087e996fba..eead57e36a66 100644 --- a/src/Files.App/Actions/Content/ImageManipulation/BaseRotateAction.cs +++ b/src/Files.App/Actions/Content/ImageManipulation/BaseRotateAction.cs @@ -21,7 +21,7 @@ internal abstract class BaseRotateAction : ObservableObject, IAction public bool IsExecutable => IsContextPageTypeAdaptedToCommand() && - (context.ShellPage?.SlimContentPage?.SelectedItemsPropertiesViewModel?.CanSelectedItemBeManipulated ?? false); + (context.ShellPage?.SlimContentPage?.SelectedItemsPropertiesViewModel?.IsCompatibleToSetAsWindowsWallpaper ?? false); public BaseRotateAction() { diff --git a/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs b/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs index dd61edd65842..8f1861f451d7 100644 --- a/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs +++ b/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs @@ -405,7 +405,7 @@ public static List GetBaseItemMenuItems( new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutItemContextFlyoutSetAs/Text".GetLocalizedResource(), - ShowItem = itemsSelected && (selectedItemsPropertiesViewModel?.CanSelectedItemBeManipulated ?? false), + ShowItem = itemsSelected && (selectedItemsPropertiesViewModel?.IsCompatibleToSetAsWindowsWallpaper ?? false), ShowInSearchPage = true, Items = [ @@ -419,13 +419,13 @@ public static List GetBaseItemMenuItems( { IsVisible = !currentInstanceViewModel.IsPageTypeRecycleBin && !currentInstanceViewModel.IsPageTypeZipFolder - && (selectedItemsPropertiesViewModel?.CanSelectedItemBeManipulated ?? false) + && (selectedItemsPropertiesViewModel?.IsCompatibleToSetAsWindowsWallpaper ?? false) }.Build(), new ContextMenuFlyoutItemViewModelBuilder(Commands.RotateRight) { IsVisible = !currentInstanceViewModel.IsPageTypeRecycleBin && !currentInstanceViewModel.IsPageTypeZipFolder - && (selectedItemsPropertiesViewModel?.CanSelectedItemBeManipulated ?? false) + && (selectedItemsPropertiesViewModel?.IsCompatibleToSetAsWindowsWallpaper ?? false) }.Build(), new ContextMenuFlyoutItemViewModelBuilder(Commands.RunAsAdmin).Build(), new ContextMenuFlyoutItemViewModelBuilder(Commands.RunAsAnotherUser).Build(), diff --git a/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs b/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs index 3be28491a4aa..68850b5f5037 100644 --- a/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs +++ b/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs @@ -530,7 +530,7 @@ public SelectedItemsPropertiesViewModel() } private bool isSelectedItemImage = false; - public bool CanSelectedItemBeManipulated + public bool IsCompatibleToSetAsWindowsWallpaper { get => isSelectedItemImage; set => SetProperty(ref isSelectedItemImage, value); @@ -546,7 +546,7 @@ public bool IsSelectedItemShortcut public void CheckAllFileExtensions(List itemExtensions) { // Checks if all the item extensions are image extensions of some kind. - CanSelectedItemBeManipulated = itemExtensions.TrueForAll(FileExtensionHelpers.IsCompatibleToSetAsWindowsWallpaper); + IsCompatibleToSetAsWindowsWallpaper = itemExtensions.TrueForAll(FileExtensionHelpers.IsCompatibleToSetAsWindowsWallpaper); // Checks if there is only one selected item and if it's a shortcut. IsSelectedItemShortcut = (itemExtensions.Count == 1) && (itemExtensions.TrueForAll(itemExtension => FileExtensionHelpers.IsShortcutFile(itemExtension))); }