diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 26e3b849..28afdf9c 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -493,6 +493,7 @@ Delete DRAG & DROP FOLDER SUPPORTED. CUSTOM GROUPING SUPPORTED. Edit + Open All Repositories Open Repository Open Terminal Search Repositories... diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 4b8932ee..b1658c34 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -495,6 +495,7 @@ 删除 支持拖放目录添加。支持自定义分组。 编辑 + 打开所有包含仓库 打开本地仓库 打开终端 快速查找仓库... diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 1c4ec518..7a8bd837 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -495,6 +495,7 @@ 刪除 支援拖放目錄新增。支援自定義分組。 編輯 + 打開所有包含倉庫 開啟本地倉庫 開啟終端 快速查詢倉庫... diff --git a/src/ViewModels/Welcome.cs b/src/ViewModels/Welcome.cs index d077bfb7..415c56ee 100644 --- a/src/ViewModels/Welcome.cs +++ b/src/ViewModels/Welcome.cs @@ -92,6 +92,26 @@ namespace SourceGit.ViewModels var menu = new ContextMenu(); var hasRepo = Preference.FindRepository(node.Id) != null; + if (!node.IsRepository && node.SubNodes.Count > 0) + { + var openAll = new MenuItem(); + openAll.Header = App.Text("Welcome.OpenAllInNode"); + openAll.Icon = App.CreateMenuIcon("Icons.Folder.Open"); + openAll.Click += (_, e) => + { + if (App.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + var launcher = desktop.MainWindow.DataContext as Launcher; + OpenAllInNode(launcher, node); + } + + e.Handled = true; + }; + + menu.Items.Add(openAll); + menu.Items.Add(new MenuItem() { Header = "-" }); + } + var edit = new MenuItem(); edit.Header = App.Text("Welcome.Edit"); edit.Icon = App.CreateMenuIcon("Icons.Edit"); @@ -201,6 +221,17 @@ namespace SourceGit.ViewModels } } + private void OpenAllInNode(Launcher launcher, RepositoryNode node) + { + foreach (var subNode in node.SubNodes) + { + if (subNode.IsRepository) + launcher.OpenRepositoryInTab(subNode, null); + else if (subNode.SubNodes.Count > 0) + OpenAllInNode(launcher, subNode); + } + } + private static Welcome _instance = new Welcome(); private string _searchFilter = string.Empty; }