Remembered lists are global; add Clear buttons in Preferences

Remembered peers were already machine-wide for the main app; remembered apps are
now global too (a shared address book across all profiles), so it doesn't confuse
the user with a different list per profile.

- RemSoundSettingsStore.Load/SaveRememberedApplications (global, NOT written into
  profile files) mirrors remembered peers. Removed the per-profile
  Profile.RememberedSendApplications. Ticking an app in any profile adds it to the
  global list (RememberCheckedApps); the per-profile SelectedSendApplications
  (the active/ticked subset) is unchanged.
- Preferences -> General now has two buttons at the end, under a 'Remembered
  lists (shared across all profiles)' header: 'Clear remembered peers list...'
  and 'Clear remembered applications list...', each with a Yes/No confirmation.
  Clearing peers refreshes the main window; clearing apps empties the global list.
- Self-test 'Remembered applications list is global + clearable' (round-trip,
  case-insensitive dedupe, clear); the dialog accessibility audit covers the two
  new buttons (names + mnemonics, no clash). Gate 37/37.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-07-15 22:54:55 +01:00
co-authored by Claude Opus 4.8
parent 1e5030b08f
commit e95fc36926
5 changed files with 113 additions and 9 deletions
+28
View File
@@ -2912,6 +2912,18 @@ public sealed class MainForm : Form
checkForUpdatesNow: () => CheckForUpdatesManually(),
onUpdateFrequencyChanged: ApplyUpdateCheckTimer,
onAutoSaveIntervalChanged: ApplyAutoSaveTimer,
onClearRememberedPeers: () =>
{
settings.SaveRememberedPeers(Array.Empty<string>());
rememberedPeerInstanceIds.Clear();
RefreshKnownPeers();
logFile.Event("remembered peers list cleared (Preferences)");
},
onClearRememberedApplications: () =>
{
settings.SaveRememberedApplications(Array.Empty<string>());
logFile.Event("remembered applications list cleared (Preferences)");
},
applyUpnpEnabled: enabled =>
{
// The persist already happened in the dialog; this callback only flips the
@@ -3612,6 +3624,7 @@ public sealed class MainForm : Form
if (suppressSendAppEvents) return;
MarkProfileDirty();
ApplySendSources();
RememberCheckedApps();
});
};
@@ -3802,6 +3815,21 @@ public sealed class MainForm : Form
ApplySendModeVisibility();
if (sendModeList.SelectedIndex == SendModeApplicationsIndex) ReconcileSendAppsList();
RememberCheckedApps();
}
/// <summary>Add the currently-ticked app names to the GLOBAL remembered-applications list (the shared
/// "apps I send" address book) — so a tick in any profile remembers the app for all of them, mirroring
/// how remembered peers work. Cleared from Preferences → General.</summary>
private void RememberCheckedApps()
{
var names = CheckedSendApplicationNames();
if (names.Count == 0) return;
var remembered = settings.LoadRememberedApplications().ToList();
var added = false;
foreach (var n in names)
if (!remembered.Any(e => string.Equals(e, n, StringComparison.OrdinalIgnoreCase))) { remembered.Add(n); added = true; }
if (added) settings.SaveRememberedApplications(remembered);
}
/// <summary>The process names the user has ticked in the app list (lower-case, no extension).</summary>