From 65d3e911d0cefc5d788e4bf406b43a4784aa76ec Mon Sep 17 00:00:00 2001 From: duffyduck Date: Fri, 3 Apr 2026 18:23:47 +0200 Subject: [PATCH] Auto-reset mappings when address book is changed in profile editor When editing a profile and switching to a different Starface address book, the old contact mappings are invalid (different Starface IDs). Now automatically clears mappings and shows a notification. Custom address books are already listed as tags. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/StarfaceOutlookSync/UI/ProfileEditorForm.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/StarfaceOutlookSync/UI/ProfileEditorForm.cs b/src/StarfaceOutlookSync/UI/ProfileEditorForm.cs index fb598098..07c89136 100644 --- a/src/StarfaceOutlookSync/UI/ProfileEditorForm.cs +++ b/src/StarfaceOutlookSync/UI/ProfileEditorForm.cs @@ -333,9 +333,23 @@ namespace StarfaceOutlookSync.UI }; if (_isNew) + { _pm.AddProfile(profile); + } else + { + // Wenn Adressbuch gewechselt wurde, Mappings zuruecksetzen + if (_existingProfile.StarfaceAddressBook?.TagId != profile.StarfaceAddressBook?.TagId + || _existingProfile.StarfaceAddressBook?.Type != profile.StarfaceAddressBook?.Type) + { + _pm.SaveMappings(profile.Id, new List()); + profile.LastSync = ""; + MessageBox.Show( + "Adressbuch wurde geaendert.\nSync-Zuordnungen wurden automatisch zurueckgesetzt.", + "Adressbuch geaendert", MessageBoxButtons.OK, MessageBoxIcon.Information); + } _pm.UpdateProfile(profile); + } DialogResult = DialogResult.OK; Close();