Skip to content

Commit 7e7c20a

Browse files
author
Yair Aichenbaum
committed
Added a setting to disable OneDrive
1 parent 9faffc0 commit 7e7c20a

File tree

5 files changed

+71
-38
lines changed

5 files changed

+71
-38
lines changed

Files/Filesystem/DriveItem.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class DriveItem
2121
public string spaceText { get; set; }
2222
public Visibility cloudGlyphVisibility { get; set; } = Visibility.Collapsed;
2323
public Visibility driveGlyphVisibility { get; set; } = Visibility.Visible;
24+
public Visibility itemVisibility { get; set; } = Visibility.Visible;
2425
public DriveType Type { get; set; }
2526

2627
private StorageFolder _root;
@@ -89,8 +90,6 @@ public DriveItem(StorageFolder root, Visibility progressBarVisibility, DriveType
8990
throw new ArgumentOutOfRangeException(nameof(type), type, null);
9091
}
9192
}
92-
93-
9493
}
9594

9695
public enum DriveType

Files/Filesystem/Drives.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ private void GetVirtualDrivesList(IList<DriveItem> list)
181181
cloudGlyphVisibility = Visibility.Visible,
182182
driveGlyphVisibility = Visibility.Collapsed,
183183
Type = DriveType.VirtualDrive
184+
//itemVisibility = App.AppSettings.PinOneDriveToSideBar
184185
};
185186

186187
list.Add(oneDriveItem);

Files/ProHome.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@
524524
<muxc:NavigationView Style="{StaticResource NavigationViewStyle_Fixed}" PaneTitle="Drives" OpenPaneLength="225" Padding="0" IsTitleBarAutoPaddingEnabled="False" PaneDisplayMode="Left" ItemInvoked="DrivesList_ItemInvoked" x:FieldModifier="public" IsPaneOpen="True" IsSettingsVisible="False" IsPaneToggleButtonVisible="False" IsBackButtonVisible="Collapsed" MenuItemsSource="{x:Bind local:App.AppSettings.DrivesManager.Drives}" SelectionChanged="DrivesList_SelectionChanged" x:Name="DrivesList">
525525
<muxc:NavigationView.MenuItemTemplate>
526526
<DataTemplate x:DataType="local2:DriveItem">
527-
<muxc:NavigationViewItem Padding="0" Tag="{x:Bind tag}">
527+
<muxc:NavigationViewItem Padding="0" Tag="{x:Bind tag}" Visibility="{x:Bind itemVisibility}">
528528
<muxc:NavigationViewItem.Content>
529529
<StackPanel
530530
Margin="-4,0,0,0"

Files/SettingsPages/Preferences.xaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,39 @@
2626

2727
<TextBlock FontSize="22" Text="Preferences" />
2828

29+
<Grid HorizontalAlignment="Stretch">
30+
<Grid.ColumnDefinitions>
31+
<ColumnDefinition Width="260" />
32+
<ColumnDefinition Width="*" MaxWidth="470" />
33+
</Grid.ColumnDefinitions>
34+
<Grid.ChildrenTransitions>
35+
<TransitionCollection>
36+
<RepositionThemeTransition />
37+
</TransitionCollection>
38+
</Grid.ChildrenTransitions>
39+
40+
<TextBlock
41+
Grid.Column="0"
42+
VerticalAlignment="Center"
43+
FontSize="16"
44+
Text="Pin OneDrive to the sidebar" />
45+
46+
<ToggleSwitch
47+
Grid.Column="2"
48+
Width="40"
49+
HorizontalAlignment="Right"
50+
OffContent=""
51+
OnContent=""
52+
IsOn="{x:Bind local2:App.AppSettings.PinOneDriveToSideBar, Mode=TwoWay}"/>
53+
</Grid>
54+
2955
<StackPanel>
3056
<StackPanel.ChildrenTransitions>
3157
<TransitionCollection>
3258
<RepositionThemeTransition />
3359
</TransitionCollection>
3460
</StackPanel.ChildrenTransitions>
35-
61+
3662
<Grid HorizontalAlignment="Stretch">
3763
<Grid.ColumnDefinitions>
3864
<ColumnDefinition Width="260" />

Files/View Models/SettingsViewModel.cs

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
namespace Files.View_Models
2121
{
22-
public class SettingsViewModel : ViewModelBase
22+
public class SettingsViewModel : ViewModelBase
2323
{
2424
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
2525

@@ -68,7 +68,7 @@ private void DetectDateTimeFormat()
6868
}
6969
else
7070
{
71-
localSettings.Values[LocalSettings.DateTimeFormat] = "Application";
71+
localSettings.Values[LocalSettings.DateTimeFormat] = "Application";
7272
}
7373
}
7474

@@ -105,34 +105,34 @@ private async void DetectCustomLocations()
105105

106106
private void DetectApplicationTheme()
107107
{
108-
if (localSettings.Values["theme"] != null)
109-
{
110-
if (localSettings.Values["theme"].ToString() == "Light")
111-
{
112-
ThemeValue = ThemeStyle.Light;
113-
App.Current.RequestedTheme = ApplicationTheme.Light;
114-
return;
115-
}
116-
else if (localSettings.Values["theme"].ToString() == "Dark")
117-
{
118-
ThemeValue = ThemeStyle.Dark;
119-
App.Current.RequestedTheme = ApplicationTheme.Dark;
120-
return;
121-
}
122-
}
123-
124-
var uiSettings = new UISettings();
125-
var color = uiSettings.GetColorValue(UIColorType.Background);
126-
if (color == Colors.White)
127-
{
128-
ThemeValue = ThemeStyle.System;
129-
App.Current.RequestedTheme = ApplicationTheme.Light;
130-
}
131-
else
132-
{
133-
ThemeValue = ThemeStyle.System;
134-
App.Current.RequestedTheme = ApplicationTheme.Dark;
135-
}
108+
if (localSettings.Values["theme"] != null)
109+
{
110+
if (localSettings.Values["theme"].ToString() == "Light")
111+
{
112+
ThemeValue = ThemeStyle.Light;
113+
App.Current.RequestedTheme = ApplicationTheme.Light;
114+
return;
115+
}
116+
else if (localSettings.Values["theme"].ToString() == "Dark")
117+
{
118+
ThemeValue = ThemeStyle.Dark;
119+
App.Current.RequestedTheme = ApplicationTheme.Dark;
120+
return;
121+
}
122+
}
123+
124+
var uiSettings = new UISettings();
125+
var color = uiSettings.GetColorValue(UIColorType.Background);
126+
if (color == Colors.White)
127+
{
128+
ThemeValue = ThemeStyle.System;
129+
App.Current.RequestedTheme = ApplicationTheme.Light;
130+
}
131+
else
132+
{
133+
ThemeValue = ThemeStyle.System;
134+
App.Current.RequestedTheme = ApplicationTheme.Dark;
135+
}
136136
}
137137

138138
private async void LoadTerminalApps()
@@ -162,6 +162,7 @@ private async void LoadTerminalApps()
162162
private FormFactorMode _FormFactor = FormFactorMode.Regular;
163163
private ThemeStyle _ThemeValue;
164164
private bool _AreLinuxFilesSupported = false;
165+
private bool _PinOneDriveToSideBar = true;
165166
private bool _ShowRibbonContent = true;
166167
private string _DesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
167168
private string _DocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
@@ -189,7 +190,7 @@ public FormFactorMode FormFactor
189190
public ThemeStyle ThemeValue
190191
{
191192
get => _ThemeValue;
192-
set
193+
set
193194
{
194195
Set(ref _ThemeValue, value);
195196
if (value.Equals(ThemeStyle.System))
@@ -213,6 +214,12 @@ public bool AreLinuxFilesSupported
213214
set => Set(ref _AreLinuxFilesSupported, value);
214215
}
215216

217+
public bool PinOneDriveToSideBar
218+
{
219+
get => _PinOneDriveToSideBar;
220+
set => Set(ref _PinOneDriveToSideBar, value);
221+
}
222+
216223
public string DesktopPath
217224
{
218225
get => _DesktopPath;
@@ -264,7 +271,7 @@ public bool ShowRibbonContent
264271
public SidebarOpacity SidebarThemeMode
265272
{
266273
get => _SidebarThemeMode;
267-
set
274+
set
268275
{
269276
Set(ref _SidebarThemeMode, value);
270277
if (value.Equals(SidebarOpacity.Opaque))
@@ -281,7 +288,7 @@ public SidebarOpacity SidebarThemeMode
281288
public TimeStyle DisplayedTimeStyle
282289
{
283290
get => _DisplayedTimeStyle;
284-
set
291+
set
285292
{
286293
Set(ref _DisplayedTimeStyle, value);
287294
if (value.Equals(TimeStyle.Application))
@@ -303,4 +310,4 @@ public void Dispose()
303310
DrivesManager.Dispose();
304311
}
305312
}
306-
}
313+
}

0 commit comments

Comments
 (0)