forked from files-community/Files
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Added an action to close all tabs (files-community#16418)
- Loading branch information
Showing
7 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2024 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
namespace Files.App.Actions | ||
{ | ||
internal sealed class CloseAllTabsAction : CloseTabBaseAction | ||
{ | ||
public override string Label | ||
=> Strings.CloseAllTabs.GetLocalizedResource(); | ||
|
||
public override string Description | ||
=> Strings.CloseAllTabsDescription.GetLocalizedResource(); | ||
|
||
public override HotKey HotKey | ||
=> new(Keys.W, KeyModifiers.CtrlShift); | ||
|
||
public CloseAllTabsAction() | ||
{ | ||
} | ||
|
||
protected override bool GetIsExecutable() | ||
{ | ||
return | ||
context.Control is not null && | ||
context.TabCount > 0 && | ||
context.CurrentTabItem is not null; | ||
} | ||
|
||
public override Task ExecuteAsync(object? parameter = null) | ||
{ | ||
if (context.Control is not null) | ||
MultitaskingTabsHelpers.CloseAllTabs(context.Control); | ||
|
||
return Task.CompletedTask; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters