Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Let users turn off and clear the conversion history

KnifeLemon385c76b630c0
diff --git a/Directory.Build.props b/Directory.Build.props
index 298451d9..e87a2f74 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -14,7 +14,7 @@
parameters of a member is fine (CS1573). -->
<NoWarn>$(NoWarn);CS1591;CS1573</NoWarn>
- <Version>1.2.3</Version>
+ <Version>1.3.0</Version>
<Product>Filee</Product>
<Authors>Filee contributors</Authors>
<Copyright>Copyright (c) Filee contributors</Copyright>
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index f548e5a8..4e38f5ee 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -135,6 +135,11 @@
"general.modern_menu_failed": "Windows did not add the entry: {0}",
"general.modern_menu_remove_failed": "Windows did not remove the entry: {0}",
"general.check_updates": "Check for updates automatically",
+ "general.history": "Conversion history",
+ "general.no_history": "Don't keep a history of recent conversions",
+ "general.clear_history": "Clear history",
+ "general.history_count": "{0} conversion(s) in the history",
+ "general.history_cleared": "History cleared.",
"general.check_now": "Check now",
"general.update_available": "Version {0} is available",
"general.update_none": "You're up to date ({0})",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index 584a71fa..39c89cf3 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -135,6 +135,11 @@
"general.modern_menu_failed": "Windows가 항목을 추가하지 못했어요: {0}",
"general.modern_menu_remove_failed": "Windows가 항목을 제거하지 못했어요: {0}",
"general.check_updates": "자동으로 업데이트 확인",
+ "general.history": "변환 기록",
+ "general.no_history": "최근 변환 기록 남기지 않기",
+ "general.clear_history": "기록 지우기",
+ "general.history_count": "기록 {0}개",
+ "general.history_cleared": "기록을 지웠어요.",
"general.check_now": "지금 확인",
"general.update_available": "{0} 버전을 사용할 수 있어요",
"general.update_none": "최신 버전이에요 ({0})",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index 78438b45..ab4eae4c 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -135,6 +135,11 @@
"general.modern_menu_failed": "Windows 未能添加此项:{0}",
"general.modern_menu_remove_failed": "Windows 未能移除此项:{0}",
"general.check_updates": "自动检查更新",
+ "general.history": "转换记录",
+ "general.no_history": "不保留最近的转换记录",
+ "general.clear_history": "清除记录",
+ "general.history_count": "共 {0} 条记录",
+ "general.history_cleared": "记录已清除。",
"general.check_now": "立即检查",
"general.update_available": "有新版本 {0}",
"general.update_none": "已是最新版本({0})",
diff --git a/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs b/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs
index 445e6115..51e715e2 100644
--- a/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs
+++ b/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs
@@ -32,6 +32,8 @@ public sealed partial class GeneralPageViewModel : ObservableObject
_startWithSystem = store.Settings.StartWithSystem;
_contextMenu = store.Settings.ContextMenuEnabled;
_checkForUpdates = store.Settings.CheckForUpdates;
+ _noHistory = !store.Settings.KeepHistory;
+ _historyCount = store.History.Count;
ShowUpdateState(updates.LatestVersion);
RefreshModernMenu();
}
@@ -117,6 +119,32 @@ public sealed partial class GeneralPageViewModel : ObservableObject
}
partial void OnCheckForUpdatesChanged(bool value) => Save(s => s.CheckForUpdates = value);
+ // Conversion history (home page): don't record it, or clear what is there.
+ [ObservableProperty] private bool _noHistory;
+
+ [ObservableProperty]
+ [NotifyPropertyChangedFor(nameof(HistoryText))]
+ [NotifyCanExecuteChangedFor(nameof(ClearHistoryCommand))]
+ private int _historyCount;
+
+ [ObservableProperty] private bool _historyCleared;
+
+ public string HistoryText => HistoryCleared ? _loc["general.history_cleared"] : _loc.Format("general.history_count", HistoryCount);
+
+ partial void OnNoHistoryChanged(bool value) => Save(s => s.KeepHistory = !value);
+
+ partial void OnHistoryClearedChanged(bool value) => OnPropertyChanged(nameof(HistoryText));
+
+ private bool CanClearHistory() => HistoryCount > 0;
+
+ [RelayCommand(CanExecute = nameof(CanClearHistory))]
+ private void ClearHistory()
+ {
+ _store.ClearHistory();
+ HistoryCount = 0;
+ HistoryCleared = true;
+ }
+
private void Save(Action<AppSettings> change)
{
change(_store.Settings);
diff --git a/src/Filee.App/Views/Pages/GeneralPage.axaml b/src/Filee.App/Views/Pages/GeneralPage.axaml
index 97bb96f0..df72fe9a 100644
--- a/src/Filee.App/Views/Pages/GeneralPage.axaml
+++ b/src/Filee.App/Views/Pages/GeneralPage.axaml
@@ -41,6 +41,17 @@
</StackPanel>
</Border>
+ <Border Classes="card">
+ <StackPanel Spacing="12">
+ <TextBlock Classes="h2" Text="{DynamicResource general.history}" />
+ <ToggleSwitch Content="{DynamicResource general.no_history}" IsChecked="{Binding NoHistory}" />
+ <StackPanel Orientation="Horizontal" Spacing="10">
+ <Button Content="{DynamicResource general.clear_history}" Command="{Binding ClearHistoryCommand}" />
+ <TextBlock Classes="muted" VerticalAlignment="Center" Text="{Binding HistoryText}" />
+ </StackPanel>
+ </StackPanel>
+ </Border>
+
<Border Classes="card">
<StackPanel Spacing="12">
<TextBlock Classes="h2" Text="{DynamicResource general.library}" />
diff --git a/src/Filee.Core/Settings/AppSettings.cs b/src/Filee.Core/Settings/AppSettings.cs
index bd4d4a83..b69d51be 100644
--- a/src/Filee.Core/Settings/AppSettings.cs
+++ b/src/Filee.Core/Settings/AppSettings.cs
@@ -62,6 +62,9 @@ public sealed class AppSettings
public bool CheckForUpdates { get; set; } = true;
+ /// <summary>Record finished conversions in the history (home page). Off: nothing new is recorded.</summary>
+ public bool KeepHistory { get; set; } = true;
+
/// <summary>Newest version the user was already told about, so the update notice shows once per release.</summary>
public string? NotifiedUpdateVersion { get; set; }
diff --git a/src/Filee.Core/Settings/UserDataStore.cs b/src/Filee.Core/Settings/UserDataStore.cs
index a8648f76..1975d5f1 100644
--- a/src/Filee.Core/Settings/UserDataStore.cs
+++ b/src/Filee.Core/Settings/UserDataStore.cs
@@ -89,8 +89,11 @@ public sealed class UserDataStore
LibraryChanged?.Invoke(this, EventArgs.Empty);
}
+ /// <summary>Records a finished conversion, unless the user turned the history off (<see cref="AppSettings.KeepHistory"/>).</summary>
public void AddHistory(HistoryEntry entry)
{
+ if (!Settings.KeepHistory)
+ return;
lock (_saveLock)
{
History.Insert(0, entry);
diff --git a/tests/Filee.Core.Tests/UserDataStoreTests.cs b/tests/Filee.Core.Tests/UserDataStoreTests.cs
index cc5f9515..7c227112 100644
--- a/tests/Filee.Core.Tests/UserDataStoreTests.cs
+++ b/tests/Filee.Core.Tests/UserDataStoreTests.cs
@@ -30,6 +30,26 @@ public class UserDataStoreTests
Assert.Equal("mine", reloaded.Profiles[0].PresetIds[0]);
}
+ [Fact]
+ public void History_is_kept_until_turned_off_and_can_be_cleared()
+ {
+ using var dir = new TempDir();
+ var store = new UserDataStore(dir.Path);
+ store.Load();
+
+ store.AddHistory(new Filee.Core.History.HistoryEntry { JobId = "a" });
+ Assert.Single(store.History);
+
+ store.Settings.KeepHistory = false;
+ store.AddHistory(new Filee.Core.History.HistoryEntry { JobId = "b" });
+ Assert.Single(store.History); // not recorded
+
+ store.ClearHistory();
+ var reloaded = new UserDataStore(dir.Path);
+ reloaded.Load();
+ Assert.Empty(reloaded.History);
+ }
+
[Fact]
public void Version_1_settings_are_upgraded_to_the_current_engine_list()
{