Skip to content
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

Add option to export\import settings #1260 #6001

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 10 additions & 1 deletion Files/Dialogs/SettingsDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,17 @@
<FontIcon Glyph="&#xF1AD;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem
x:Uid="SettingsNavImportExport"
AccessKey="R"
Content="Import/Export"
Tag="8">
<muxc:NavigationViewItem.Icon>
<FontIcon FontSize="16" Glyph="&#xE946;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
</muxc:NavigationView.MenuItems>

<muxc:NavigationView.FooterMenuItems>
<muxc:NavigationViewItem
x:Uid="SettingsNavAbout"
Expand Down
1 change: 1 addition & 0 deletions Files/Dialogs/SettingsDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ private void SettingsPane_SelectionChanged(Microsoft.UI.Xaml.Controls.Navigation
5 => SettingsContentFrame.Navigate(typeof(FilesAndFolders)),
6 => SettingsContentFrame.Navigate(typeof(Experimental)),
7 => SettingsContentFrame.Navigate(typeof(About)),
8 => SettingsContentFrame.Navigate(typeof(ImportAndExport)),
_ => SettingsContentFrame.Navigate(typeof(Appearance))
};
}
Expand Down
8 changes: 8 additions & 0 deletions Files/Files.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@
<Compile Include="ViewModels\Previews\ArchivePreviewViewModel.cs" />
<Compile Include="ViewModels\Previews\CodePreviewViewModel.cs" />
<Compile Include="ViewModels\Properties\SecurityProperties.cs" />
<Compile Include="ViewModels\SettingsViewModels\ImportAndExportViewModel.cs" />
<Compile Include="ViewModels\SettingsViewModels\SidebarViewModel.cs" />
<Compile Include="ViewModels\SearchBoxViewModel.cs" />
<Compile Include="ViewModels\SidebarViewModel.cs" />
Expand Down Expand Up @@ -573,6 +574,9 @@
<Compile Include="Views\SettingsPages\About.xaml.cs">
<DependentUpon>About.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsPages\ImportAndExport.xaml.cs">
<DependentUpon>ImportAndExport.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsPages\OnStartup.xaml.cs">
<DependentUpon>OnStartup.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -1356,6 +1360,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SettingsPages\ImportAndExport.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\SettingsPages\OnStartup.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
25 changes: 21 additions & 4 deletions Files/Helpers/ExternalResourcesHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,27 @@ public bool RemoveTheme(AppTheme theme)

public class AppTheme
{
public string Name { get; set; }
public string Path { get; set; }
public string AbsolutePath { get; set; }
public bool IsFromOptionalPackage { get; set; }
private string name;
private string path;
private string absolutePath;
private bool isFromOptionalPackage;

public AppTheme()
{

}
public AppTheme(string name, string path, string absolutePath, bool isFromOptionalPackage)
{
this.name = name;
this.path = path;
this.absolutePath = absolutePath;
this.isFromOptionalPackage = isFromOptionalPackage;
}

public string Name { get { return name; } set { name = value; } }
public string Path { get { return path; } set { path = value; } }
public string AbsolutePath { get { return absolutePath; } set { absolutePath = value; } }
public bool IsFromOptionalPackage { get { return isFromOptionalPackage; } set { isFromOptionalPackage = value; } }
public string Key => $"{Name}-{IsFromOptionalPackage}";
}
}
25 changes: 25 additions & 0 deletions Files/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,31 @@ private async void StartAppCenter()
Analytics.TrackEvent($"{nameof(AreFileTagsEnabled)} {AreFileTagsEnabled}");
}

public async void ClearSettings()
{
SelectedTheme = new AppTheme(string.Empty, string.Empty, string.Empty, false);

AreFileTagsEnabled = AreHiddenItemsVisible = AreSystemItemsHidden = ShowFileExtensions = OpenItemsWithOneclick = ListAndSortDirectoriesAlongsideFiles = SearchUnindexedItems =
AreLayoutPreferencesPerFolder = IsVerticalTabFlyoutEnabled = IsDualPaneEnabled = AlwaysOpenDualPaneInNewTab = OpenNewTabPageOnStartup = ContinueLastSessionOnStartUp =
OpenASpecificPageOnStartup = AlwaysOpenANewInstance = IsSidebarOpen = PreviewPaneEnabled = ShowPreviewOnly = ShowConfirmDeleteDialog = PinRecycleBinToSideBar =
ShowDrivesWidget = ShowLibrarySection = ShowBundlesWidget = ShowDateColumn = ShowDateCreatedColumn = ShowTypeColumn = ShowSizeColumn = ShowFileTagColumn =
AdaptiveLayoutEnabled = ShowFolderWidgetWidget = ShowRecentFilesWidget = ShowFavoritesSection = ShowDrivesSection = ShowCloudDrivesSection = ShowNetworkDrivesSection =
ShowWslSection = OpenFoldersNewTab = ShowOngoingTasksTeachingTip = ResumeAfterRestart = HideConfirmElevateDialog = MoveOverflowMenuItemsToSubMenu = false;

MediaVolume = DefaultGridViewSize = 0;

SidebarWidth = new GridLength();
PreviewPaneSizeHorizontal = new GridLength();
PreviewPaneSizeVertical = new GridLength();
DisplayedTimeStyle = new TimeStyle();
DefaultDirectoryGroupOption = new GroupOption();
DefaultDirectorySortOption = new SortOption();
DefaultDirectorySortDirection = new SortDirection();

CurrentLanguage.ID = CurrentLanguage.Name = string.Empty;
OpenASpecificPageOnStartupPath = DesktopPath = DownloadsPath = TempPath = HomePath = RecycleBinPath = NetworkFolderPath = string.Empty;
}

public static async void OpenLogLocation()
{
await Launcher.LaunchFolderAsync(ApplicationData.Current.LocalFolder);
Expand Down
Loading