Skip to content

Conversation

@yaira2
Copy link
Member

@yaira2 yaira2 commented Apr 9, 2025

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Confirmed toolbar buttons have the correct icon state

Comments

The issue only occurs for files with additional actions in the toolbar. I discovered that changing from x:Load to Visibility resolves the issue. However, this introduces a different issue where the overflow button sometimes displays when there were no overflow items. Toggling IsDynamicOverflowEnabled seems to workaround this issue.

@yaira2 yaira2 added the ready for review Pull requests that are ready for review label Apr 9, 2025
Comment on lines +79 to +96
public bool HasAdditionalAction =>
InstanceViewModel.IsPageTypeRecycleBin ||
Commands.RunWithPowershell.IsExecutable ||
CanExtract ||
Commands.DecompressArchive.IsExecutable ||
Commands.DecompressArchiveHere.IsExecutable ||
Commands.DecompressArchiveHereSmart.IsExecutable ||
Commands.DecompressArchiveToChildFolder.IsExecutable ||
Commands.EditInNotepad.IsExecutable ||
Commands.RotateLeft.IsExecutable ||
Commands.RotateRight.IsExecutable ||
Commands.SetAsAppBackground.IsExecutable ||
Commands.SetAsWallpaperBackground.IsExecutable ||
Commands.SetAsLockscreenBackground.IsExecutable ||
Commands.SetAsSlideshowBackground.IsExecutable ||
Commands.InstallFont.IsExecutable ||
Commands.InstallInfDriver.IsExecutable ||
Commands.InstallCertificate.IsExecutable;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public bool HasAdditionalAction =>
InstanceViewModel.IsPageTypeRecycleBin ||
Commands.RunWithPowershell.IsExecutable ||
CanExtract ||
Commands.DecompressArchive.IsExecutable ||
Commands.DecompressArchiveHere.IsExecutable ||
Commands.DecompressArchiveHereSmart.IsExecutable ||
Commands.DecompressArchiveToChildFolder.IsExecutable ||
Commands.EditInNotepad.IsExecutable ||
Commands.RotateLeft.IsExecutable ||
Commands.RotateRight.IsExecutable ||
Commands.SetAsAppBackground.IsExecutable ||
Commands.SetAsWallpaperBackground.IsExecutable ||
Commands.SetAsLockscreenBackground.IsExecutable ||
Commands.SetAsSlideshowBackground.IsExecutable ||
Commands.InstallFont.IsExecutable ||
Commands.InstallInfDriver.IsExecutable ||
Commands.InstallCertificate.IsExecutable;
public bool HasAdditionalAction =>
InstanceViewModel.IsPageTypeRecycleBin ||
Commands.RunWithPowershell.IsExecutable ||
CanExtract ||
Commands.DecompressArchive.IsExecutable ||
Commands.DecompressArchiveHere.IsExecutable ||
Commands.DecompressArchiveHereSmart.IsExecutable ||
Commands.DecompressArchiveToChildFolder.IsExecutable ||
Commands.EditInNotepad.IsExecutable ||
Commands.RotateLeft.IsExecutable ||
Commands.RotateRight.IsExecutable ||
Commands.SetAsAppBackground.IsExecutable ||
Commands.SetAsWallpaperBackground.IsExecutable ||
Commands.SetAsLockscreenBackground.IsExecutable ||
Commands.SetAsSlideshowBackground.IsExecutable ||
Commands.InstallFont.IsExecutable ||
Commands.InstallInfDriver.IsExecutable ||
Commands.InstallCertificate.IsExecutable;

This might look prettier, since the above is similar to other large statements in the codebase.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather stick with the current formatting.

Comment on lines +26 to +29
context.PageType != ContentPageTypes.RecycleBin &&
context.PageType != ContentPageTypes.ZipFolder &&
context.PageType != ContentPageTypes.ReleaseNotes &&
context.PageType != ContentPageTypes.Settings &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're interested, you can use is, and, or:

Suggested change
context.PageType != ContentPageTypes.RecycleBin &&
context.PageType != ContentPageTypes.ZipFolder &&
context.PageType != ContentPageTypes.ReleaseNotes &&
context.PageType != ContentPageTypes.Settings &&
context.PageType is not ContentPageTypes.RecycleBin and
not ContentPageTypes.ZipFolder and
not ContentPageTypes.ReleaseNotes and
not ContentPageTypes.Settings &&

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They have the same results here so I would just leave it as is.

Comment on lines -57 to -62
if (context.ShellPage is not null && context.ShellPage.SlimContentPage is not null)
{
var viewModel = context.ShellPage.SlimContentPage.SelectedItemsPropertiesViewModel;
var extensions = context.SelectedItems.Select(selectedItem => selectedItem.FileExtension).Distinct().ToList();

viewModel.CheckAllFileExtensions(extensions);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this deleted?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic was moved to IsExecutable.

@yaira2 yaira2 requested a review from 0x5bfa April 9, 2025 15:14
@yaira2 yaira2 force-pushed the ya/FixIconState branch from 557c738 to becf46d Compare April 9, 2025 15:28
Copy link
Member

@0x5bfa 0x5bfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The primary buttons are working well on my end when selecting an image which is when the additional actions like setting it as wallpaper exist.

@yaira2
Copy link
Member Author

yaira2 commented Apr 9, 2025

@jpozo20 thank you for helping fix this issue!

@yaira2 yaira2 merged commit c842f2e into main Apr 9, 2025
8 checks passed
@yaira2 yaira2 deleted the ya/FixIconState branch April 9, 2025 15:47
@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed ready for review Pull requests that are ready for review labels Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Pull requests that are approved and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Delete icon appears disabled for image files

4 participants