Skip to content

Feature: Treat cloud drives as root in the column view #12337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/Files.App/ViewModels/SidebarViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.WinUI;
using Files.App.Data.Items;
using Files.App.UserControls;
using Files.Shared.EventArguments;
using Microsoft.UI.Dispatching;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Imaging;
using System.Collections.Specialized;
using System.IO;
using static Files.App.Constants.Widgets;

namespace Files.App.ViewModels
{
Expand Down Expand Up @@ -90,7 +86,7 @@ public void UpdateSidebarSelectedItemFromArgs(string arg)

item = sidebarItems.FirstOrDefault(x => x.Path.Equals(value, StringComparison.OrdinalIgnoreCase));
item ??= sidebarItems.FirstOrDefault(x => x.Path.Equals(value + "\\", StringComparison.OrdinalIgnoreCase));
item ??= sidebarItems.FirstOrDefault(x => value.StartsWith(x.Path, StringComparison.OrdinalIgnoreCase));
item ??= sidebarItems.Where(x => value.StartsWith(x.Path, StringComparison.OrdinalIgnoreCase)).MaxBy(x => x.Path.Length);
item ??= sidebarItems.FirstOrDefault(x => x.Path.Equals(Path.GetPathRoot(value), StringComparison.OrdinalIgnoreCase));

if (item is null && value == "Home")
Expand Down
3 changes: 2 additions & 1 deletion src/Files.App/Views/LayoutModes/ColumnViewBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)

if (path is not null)
{
var rootPathList = App.QuickAccessManager.Model.FavoriteItems.Select(x => NormalizePath(x)).ToList();
var rootPathList = App.QuickAccessManager.Model.FavoriteItems.Select(NormalizePath)
.Concat(App.CloudDrivesManager.Drives.Select(x => NormalizePath(x.Path))).ToList();
rootPathList.Add(NormalizePath(GetPathRoot(path)));

while (!rootPathList.Contains(NormalizePath(path)))
Expand Down