Merge with sync OUT-445
authorThomas
Mon, 02 Dec 2019 07:53:36 +0100
branchOUT-445
changeset 289188f32070118f
parent 2871 3f9df2a701d7
parent 2890 522cd8a6baca
child 2892 a5b3ec530ca3
Merge with sync
Properties/Resources.Designer.cs
Properties/Resources.de.resx
Properties/Resources.es.resx
Properties/Resources.resx
UI/FormControlOptions.xaml
UI/FormControlOptions.xaml.cs
     1.1 --- a/AdapterCallbacks.cs	Tue Nov 19 10:00:19 2019 +0100
     1.2 +++ b/AdapterCallbacks.cs	Mon Dec 02 07:53:36 2019 +0100
     1.3 @@ -54,7 +54,7 @@
     1.4                          ThisAddIn.SyncQueue.Stop();
     1.5  
     1.6                          // Syncronize engine with settings just in case (should already be synced)
     1.7 -                        Globals.ThisAddIn.SyncWithSettings(true);
     1.8 +                        Globals.ThisAddIn.SyncSettingsToEngine(true);
     1.9  
    1.10                          // If sync is disabled, cancel
    1.11                          if (own.Flags.HasFlag(pEpIdentityFlags.pEpIdfNotForSync))
    1.12 @@ -126,22 +126,23 @@
    1.13              }
    1.14  
    1.15              // Try to log the message
    1.16 -            try
    1.17 +            if (newMessage.IsSecure)
    1.18              {
    1.19 -                if (newMessage.IsSecure)
    1.20 +                try
    1.21                  {
    1.22                      new MsgProcessor().Decrypt(newMessage, out PEPMessage decryptedMessage);
    1.23                      string xml = ThisAddIn.PEPEngine.PERToXERSyncMessage(decryptedMessage.ToCOMType());
    1.24                      Log.Verbose("MessageToSend: Starting to send message from " + msg.From.Address + ": " + Environment.NewLine + Environment.NewLine + xml);
    1.25                  }
    1.26 -                else
    1.27 +                catch (Exception ex)
    1.28                  {
    1.29 -                    Log.Verbose("MessageToSend: Sending beacon from " + msg.From.Address);
    1.30 +                    Log.Error("MessageToSend: Error logging message content. " + ex.ToString());
    1.31                  }
    1.32              }
    1.33 -            catch (Exception ex)
    1.34 +            else
    1.35              {
    1.36 -                Log.Error("MessageToSend: Error logging message content. " + ex.ToString());
    1.37 +                // Do not call the engine during sending of a beacon, as this might result in a deadlock during startup of Sync
    1.38 +                Log.Verbose("MessageToSend: Starting to send beacon from " + newMessage?.From?.Address ?? "<null address>");
    1.39              }
    1.40  
    1.41              // Now send the message
     2.1 --- a/AdapterExtensions.cs	Tue Nov 19 10:00:19 2019 +0100
     2.2 +++ b/AdapterExtensions.cs	Mon Dec 02 07:53:36 2019 +0100
     2.3 @@ -19,6 +19,27 @@
     2.4           *************************************************************/
     2.5  
     2.6          /// <summary>
     2.7 +        /// Gets whether Sync is enabled in the adapter.
     2.8 +        /// </summary>
     2.9 +        /// <returns>True if sync is enabled. Otherwise false.</returns>
    2.10 +        public static bool GetIsSyncEnabled()
    2.11 +        {
    2.12 +            bool enabled = false;
    2.13 +
    2.14 +            try
    2.15 +            {
    2.16 +                enabled = ThisAddIn.PEPEngine.GetIsSyncRunning();
    2.17 +            }
    2.18 +            catch (Exception ex)
    2.19 +            {
    2.20 +                enabled = false;
    2.21 +                Log.Error("GetIsSyncEnabled: Error occured. " + ex.ToString());
    2.22 +            }
    2.23 +
    2.24 +            return enabled;
    2.25 +        }
    2.26 +
    2.27 +        /// <summary>
    2.28          /// Gets the Trustwords for the two given identities.
    2.29          /// This will never return null.
    2.30          /// </summary>
    2.31 @@ -48,7 +69,7 @@
    2.32              catch (COMException ex)
    2.33              {
    2.34                  trustwords = string.Empty;
    2.35 -                Log.Error("GetTrustwords: Failure occured with account: id1 - " + id1?.Address+ ", id2 - " + id2?.Address + ". " + ex.ToString());
    2.36 +                Log.Error("GetTrustwords: Failure occured with account: id1 - " + id1?.Address + ", id2 - " + id2?.Address + ". " + ex.ToString());
    2.37              }
    2.38              catch (Exception ex)
    2.39              {
     3.1 --- a/CryptableMailItem.cs	Tue Nov 19 10:00:19 2019 +0100
     3.2 +++ b/CryptableMailItem.cs	Mon Dec 02 07:53:36 2019 +0100
     3.3 @@ -1272,20 +1272,7 @@
     3.4                              {
     3.5                                  // Check for sync messages
     3.6                                  if (string.IsNullOrEmpty(processedMessage.AutoConsume) == false)
     3.7 -                                {
     3.8 -                                    // Print the xml content of the sync message
     3.9 -                                    string syncXml = null;
    3.10 -                                    try
    3.11 -                                    {
    3.12 -                                        syncXml = ThisAddIn.PEPEngine.PERToXERSyncMessage(processedMessage.ToCOMType());
    3.13 -                                    }
    3.14 -                                    catch (Exception ex)
    3.15 -                                    {
    3.16 -                                        syncXml = null;
    3.17 -                                        Log.Error("ProcessAndGetRating: Error parsing XER. " + ex.ToString());
    3.18 -                                    }
    3.19 -                                    Log.Verbose("ProcessAndGetRating: Received message: " + (string.IsNullOrEmpty(syncXml) ? "<null>" : (Environment.NewLine + Environment.NewLine + syncXml)));
    3.20 -
    3.21 +                                {                                    
    3.22                                      // Set the auto consume property if needed
    3.23                                      if (this.internalMailItem.GetIsAutoConsume() == false)
    3.24                                      {
     4.1 --- a/Extensions/AccountExtensions.cs	Tue Nov 19 10:00:19 2019 +0100
     4.2 +++ b/Extensions/AccountExtensions.cs	Mon Dec 02 07:53:36 2019 +0100
     4.3 @@ -62,7 +62,7 @@
     4.4                  else
     4.5                  {
     4.6                      // Use global sync setting as default
     4.7 -                    acctSettings.IsSyncEnabled = Globals.ThisAddIn.Settings.IsSyncEnabledForAllAccounts;
     4.8 +                    acctSettings.IsSyncEnabled = Globals.ThisAddIn.Settings.IsSyncEnabled;
     4.9                  }
    4.10  
    4.11                  // Signal sync settings to engine
     5.1 --- a/MsgProcessor.cs	Tue Nov 19 10:00:19 2019 +0100
     5.2 +++ b/MsgProcessor.cs	Mon Dec 02 07:53:36 2019 +0100
     5.3 @@ -11,11 +11,6 @@
     5.4      /// </summary>
     5.5      internal class MsgProcessor
     5.6      {
     5.7 -        /// <summary>
     5.8 -        /// Event handler for when a sync message is being detected during decryption.
     5.9 -        /// </summary>
    5.10 -        public delegate void SyncMessageReceivedHandler(object sender, MsgProcessor.SyncMessageEventArgs e);
    5.11 -        public static event SyncMessageReceivedHandler SyncMessageReceived;
    5.12  
    5.13          /**************************************************************
    5.14           * 
    5.15 @@ -506,11 +501,27 @@
    5.16                      keyList = dstKeyList;
    5.17                  }
    5.18  
    5.19 -                // If message is unreliable, process again
    5.20 -                if ((rating == pEpRating.pEpRatingUnreliable) &&
    5.21 -                    (string.IsNullOrEmpty(destMessage.AutoConsume) == false))
    5.22 +                // Special handling for sync messages
    5.23 +                if (destMessage?.IsAutoConsume == true)
    5.24                  {
    5.25 -                    ThisAddIn.SyncQueue.Add(sourceMessage);
    5.26 +                    // Print the xml content of the sync message
    5.27 +                    string syncXml = null;
    5.28 +                    try
    5.29 +                    {
    5.30 +                        syncXml = ThisAddIn.PEPEngine.PERToXERSyncMessage(dst);
    5.31 +                    }
    5.32 +                    catch (Exception ex)
    5.33 +                    {
    5.34 +                        syncXml = null;
    5.35 +                        Log.Error("ProcessAndGetRating: Error parsing XER. " + ex.ToString());
    5.36 +                    }
    5.37 +                    Log.Verbose("ProcessAndGetRating: Received sync message from {0}: {1}", destMessage.From?.Address ?? "<null address>", (string.IsNullOrEmpty(syncXml) ? "<null>" : (Environment.NewLine + Environment.NewLine + syncXml)));
    5.38 +
    5.39 +                    // If message is unreliable, process again
    5.40 +                    if (rating == pEpRating.pEpRatingUnreliable)
    5.41 +                    {
    5.42 +                        ThisAddIn.SyncQueue.Add(sourceMessage);
    5.43 +                    }
    5.44                  }
    5.45  
    5.46                  /* If the source message's attachments count changes during decryption and it's not because
     6.1 --- a/PEPIdentity.cs	Tue Nov 19 10:00:19 2019 +0100
     6.2 +++ b/PEPIdentity.cs	Mon Dec 02 07:53:36 2019 +0100
     6.3 @@ -58,7 +58,8 @@
     6.4          {
     6.5              this.internalIdentity = new pEpIdentity
     6.6              {
     6.7 -                Address = address
     6.8 +                Address = address,
     6.9 +                Me = Convert.ToInt16(PEPIdentity.GetIsOwnIdentity(address))
    6.10              };
    6.11              this._IsForceUnencrypted = null;
    6.12              this._IsSmartAddressEnabled = true;
    6.13 @@ -175,17 +176,6 @@
    6.14                  this.RaisePropertyChangedEvent(nameof(this.IsList));
    6.15              }
    6.16          }
    6.17 -
    6.18 -        /// <summary>
    6.19 -        /// Gets whether an identity is an own identity.
    6.20 -        /// </summary>
    6.21 -        public bool IsOwnIdentity
    6.22 -        {
    6.23 -            get
    6.24 -            {
    6.25 -                return Convert.ToBoolean(this.internalIdentity.Me);
    6.26 -            }
    6.27 -        }
    6.28              
    6.29  
    6.30          /// <summary>
    6.31 @@ -224,6 +214,19 @@
    6.32          }
    6.33  
    6.34          /// <summary>
    6.35 +        /// Gets whether an identity is an own identity.
    6.36 +        /// </summary>
    6.37 +        public bool Me
    6.38 +        {
    6.39 +            get { return Convert.ToBoolean(this.internalIdentity.Me); }
    6.40 +            set
    6.41 +            {
    6.42 +                this.internalIdentity.Me = Convert.ToInt16(value);
    6.43 +                this.RaisePropertyChangedEvent(nameof(this.Me));
    6.44 +            }
    6.45 +        }
    6.46 +
    6.47 +        /// <summary>
    6.48          /// Gets or sets a unique user ID for the identity.
    6.49          /// </summary>
    6.50          public string UserId
    6.51 @@ -512,6 +515,7 @@
    6.52                  fpr = this.internalIdentity.fpr,
    6.53                  Flags = this.internalIdentity.Flags,
    6.54                  lang = this.internalIdentity.lang,
    6.55 +                Me = this.internalIdentity.Me,
    6.56                  UserId = this.internalIdentity.UserId,
    6.57                  UserName = this.internalIdentity.UserName
    6.58              };
    6.59 @@ -558,6 +562,7 @@
    6.60                  Comparisons.Equals(this.CommunicationType, obj.CommunicationType) &&
    6.61                  Comparisons.Equals(this.Fingerprint, obj.Fingerprint) &&
    6.62                  Comparisons.Equals(this.Language, obj.Language) &&
    6.63 +                Comparisons.Equals(this.Me, obj.Me) &&
    6.64                  Comparisons.Equals(this.UserId, obj.UserId) &&
    6.65                  Comparisons.Equals(this.UserName, obj.UserName) &&
    6.66                  Comparisons.Equals(this.IsForceUnencrypted, obj.IsForceUnencrypted) &&
    6.67 @@ -586,6 +591,7 @@
    6.68                  IsList = this.internalIdentity.GetIsList(),
    6.69                  IsSyncEnabled = this.internalIdentity.GetIsSyncEnabled(),
    6.70                  Language = (this.internalIdentity.lang == null ? null : string.Copy(this.internalIdentity.lang)),
    6.71 +                Me = Convert.ToBoolean(this.internalIdentity.Me),
    6.72                  UserId = (this.internalIdentity.UserId == null ? null : string.Copy(this.internalIdentity.UserId)),
    6.73                  UserName = (this.internalIdentity.UserName == null ? null : string.Copy(this.internalIdentity.UserName))
    6.74              };
    6.75 @@ -944,7 +950,8 @@
    6.76                      {
    6.77                          Address = settings.SmtpAddress,
    6.78                          UserName = settings.UserName,
    6.79 -                        UserId = PEPSettings.PEP_OWN_USER_ID
    6.80 +                        UserId = PEPSettings.PEP_OWN_USER_ID,
    6.81 +                        Me = true,
    6.82                      };
    6.83  
    6.84                      if (updateOwnIdentity)
     7.1 --- a/PEPMessage.cs	Tue Nov 19 10:00:19 2019 +0100
     7.2 +++ b/PEPMessage.cs	Mon Dec 02 07:53:36 2019 +0100
     7.3 @@ -336,6 +336,14 @@
     7.4          }
     7.5  
     7.6          /// <summary>
     7.7 +        /// Convenience method to get whether this message is auto consumable.
     7.8 +        /// </summary>
     7.9 +        public bool IsAutoConsume
    7.10 +        {
    7.11 +            get { return (string.IsNullOrEmpty(this._AutoConsume) == false); }
    7.12 +        }
    7.13 +
    7.14 +        /// <summary>
    7.15          /// Gets whether this message is considered secure.
    7.16          /// This will forward the call to the static method of the same purpose.
    7.17          /// </summary>
     8.1 --- a/PEPSettings.cs	Tue Nov 19 10:00:19 2019 +0100
     8.2 +++ b/PEPSettings.cs	Mon Dec 02 07:53:36 2019 +0100
     8.3 @@ -72,7 +72,7 @@
     8.4          public const string REG_NAME_IS_READER_SPLASH_ENABLED                   = "IsReaderSplashEnabled";
     8.5          public const string REG_NAME_IS_SECURITY_LOSS_WARNING_ENABLED           = "IsSecurityLossWarningEnabled";
     8.6          public const string REG_NAME_IS_SENSITIVE_DATA_LOGGING_ENABLED          = "IsSensitiveDataLoggingEnabled";
     8.7 -        public const string REG_NAME_IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS           = "IsSyncEnabledForAllAccounts";
     8.8 +        public const string REG_NAME_IS_SYNC_ENABLED                            = "IsSyncEnabled";
     8.9          public const string REG_NAME_IS_TNEF_DISABLED                           = "DisableTNEF"; // Name defined by Microsoft
    8.10          public const string REG_NAME_IS_UNENCRYPTED_SUBJECT_ENABLED             = "IsUnencryptedSubjectEnabled";
    8.11          public const string REG_NAME_IS_UX_IMPROVEMENT_ENABLED                  = "IsUXImprovementEnabled";
    8.12 @@ -112,7 +112,7 @@
    8.13          public const bool                  IS_SECURITY_LOSS_WARNING_ENABLED_DEFAULT           = false;
    8.14  #endif
    8.15          public const bool                  IS_SENSITIVE_DATA_LOGGING_ENABLED_DEFAULT          = false;
    8.16 -        public const bool                  IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS_DEFAULT           = true;
    8.17 +        public const bool                  IS_SYNC_ENABLED_DEFAULT                            = true;
    8.18          public const bool                  IS_TNEF_DISABLED_DEFAULT                           = false;
    8.19          public const bool                  IS_UNENCRYPTED_SUBJECT_ENABLED_DEFAULT             = false;
    8.20          public const bool                  IS_UX_IMPROVEMENT_ENABLED_DEFAULT                  = true;
    8.21 @@ -137,7 +137,7 @@
    8.22          private bool                                     _IsReaderSplashEnabled;
    8.23          private bool                                     _IsSecurityLossWarningEnabled;
    8.24          private bool                                     _IsSensitiveDataLoggingEnabled;
    8.25 -        private bool                                     _IsSyncEnabledForAllAccounts;
    8.26 +        private bool                                     _IsSyncEnabled;
    8.27          private bool                                     _IsTNEFDisabled;
    8.28          private bool                                     _IsUnencryptedSubjectEnabled;
    8.29          private bool                                     _IsUXImprovementEnabled;
    8.30 @@ -440,19 +440,17 @@
    8.31          }
    8.32  
    8.33          /// <summary>
    8.34 -        /// Gets or sets whether key sync is enabled for all accounts.
    8.35 +        /// Gets or sets whether key sync is enabled.
    8.36          /// </summary>
    8.37 -        public bool IsSyncEnabledForAllAccounts
    8.38 +        public bool IsSyncEnabled
    8.39          {
    8.40 -            get { return (this._IsSyncEnabledForAllAccounts); }
    8.41 +            get { return (this._IsSyncEnabled); }
    8.42              set
    8.43              {
    8.44 -                if (object.Equals(this._IsSyncEnabledForAllAccounts, value) == false)
    8.45 +                if (object.Equals(this._IsSyncEnabled, value) == false)
    8.46                  {
    8.47 -                    this._IsSyncEnabledForAllAccounts = value;
    8.48 -                    this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabledForAllAccounts));
    8.49 -
    8.50 -                    Globals.ThisAddIn.SyncWithSettings();
    8.51 +                    this._IsSyncEnabled = value;
    8.52 +                    this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabled));
    8.53                  }
    8.54              }
    8.55          }
    8.56 @@ -587,7 +585,7 @@
    8.57              this._IsReaderSplashEnabled = PEPSettings.IS_READER_SPLASH_ENABLED_DEFAULT;
    8.58              this._IsSecurityLossWarningEnabled = PEPSettings.IS_SECURITY_LOSS_WARNING_ENABLED_DEFAULT;
    8.59              this._IsSensitiveDataLoggingEnabled = PEPSettings.IS_SENSITIVE_DATA_LOGGING_ENABLED_DEFAULT;
    8.60 -            this._IsSyncEnabledForAllAccounts = PEPSettings.IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS_DEFAULT;
    8.61 +            this._IsSyncEnabled = PEPSettings.IS_SYNC_ENABLED_DEFAULT;
    8.62              this._IsTNEFDisabled = PEPSettings.IS_TNEF_DISABLED_DEFAULT;
    8.63              this._IsUnencryptedSubjectEnabled = PEPSettings.IS_UNENCRYPTED_SUBJECT_ENABLED_DEFAULT;
    8.64              this._IsUXImprovementEnabled = PEPSettings.IS_UX_IMPROVEMENT_ENABLED_DEFAULT;
    8.65 @@ -618,15 +616,13 @@
    8.66              this.RaisePropertyChangedEvent(nameof(this.IsReaderSplashEnabled));
    8.67              this.RaisePropertyChangedEvent(nameof(this.IsSecurityLossWarningEnabled));
    8.68              this.RaisePropertyChangedEvent(nameof(this.IsSensitiveDataLoggingEnabled));
    8.69 -            this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabledForAllAccounts));
    8.70 +            this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabled));
    8.71              this.RaisePropertyChangedEvent(nameof(this.IsTNEFDisabled));
    8.72              this.RaisePropertyChangedEvent(nameof(this.IsUnencryptedSubjectEnabled));
    8.73              this.RaisePropertyChangedEvent(nameof(this.IsUXImprovementEnabled));
    8.74              this.RaisePropertyChangedEvent(nameof(this.IsVerboseLoggingEnabled));
    8.75              this.RaisePropertyChangedEvent(nameof(this.PEPStoreDirectory));
    8.76              this.RaisePropertyChangedEvent(nameof(this.TrustwordsCulture));
    8.77 -
    8.78 -            return;
    8.79          }
    8.80  
    8.81          /// <summary>
    8.82 @@ -748,7 +744,7 @@
    8.83                  Comparisons.Equals(this.IsReaderSplashEnabled, obj.IsReaderSplashEnabled) &&
    8.84                  Comparisons.Equals(this.IsSecurityLossWarningEnabled, obj.IsSecurityLossWarningEnabled) &&
    8.85                  Comparisons.Equals(this.IsSensitiveDataLoggingEnabled, obj.IsSensitiveDataLoggingEnabled) &&
    8.86 -                Comparisons.Equals(this.IsSyncEnabledForAllAccounts, obj.IsSyncEnabledForAllAccounts) &&
    8.87 +                Comparisons.Equals(this.IsSyncEnabled, obj.IsSyncEnabled) &&
    8.88                  Comparisons.Equals(this.IsTNEFDisabled, obj.IsTNEFDisabled) &&
    8.89                  Comparisons.Equals(this.IsUnencryptedSubjectEnabled, obj.IsUnencryptedSubjectEnabled) &&
    8.90                  Comparisons.Equals(this.IsUXImprovementEnabled, obj.IsUXImprovementEnabled) &&
    8.91 @@ -908,7 +904,7 @@
    8.92                          pEpKey.SetValue(PEPSettings.REG_NAME_IS_PRIVACY_STATUS_BAR_ENABLED, this._IsPrivacyStatusBarEnabled.ToString(), RegistryValueKind.String);
    8.93                          pEpKey.SetValue(PEPSettings.REG_NAME_IS_READER_SPLASH_ENABLED, this._IsReaderSplashEnabled.ToString(), RegistryValueKind.String);
    8.94                          pEpKey.SetValue(PEPSettings.REG_NAME_IS_SECURITY_LOSS_WARNING_ENABLED, this._IsSecurityLossWarningEnabled.ToString(), RegistryValueKind.String);
    8.95 -                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS, this._IsSyncEnabledForAllAccounts.ToString(), RegistryValueKind.String);
    8.96 +                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_SYNC_ENABLED, this._IsSyncEnabled.ToString(), RegistryValueKind.String);
    8.97                          pEpKey.SetValue(PEPSettings.REG_NAME_IS_UNENCRYPTED_SUBJECT_ENABLED, this._IsUnencryptedSubjectEnabled.ToString(), RegistryValueKind.String);
    8.98                          pEpKey.SetValue(PEPSettings.REG_NAME_IS_VERBOSE_LOGGING_ENABLED, this._IsVerboseLoggingEnabled.ToString(), RegistryValueKind.String);
    8.99                          pEpKey.SetValue(PEPSettings.REG_NAME_TRUSTWORDS_CULTURE, (this._TrustwordsCulture?.TwoLetterISOLanguageName ?? string.Empty), RegistryValueKind.String);
   8.100 @@ -1776,31 +1772,29 @@
   8.101                              this.RaisePropertyChangedEvent(nameof(this.IsSensitiveDataLoggingEnabled));
   8.102                          }
   8.103  
   8.104 -                        // Attempt to get IsSyncEnabledForAllAccounts value
   8.105 +                        // Attempt to get the IsSyncEnabled value.
   8.106                          isPropertySet = false;
   8.107                          try
   8.108                          {
   8.109 -                            keyValue = pEpKey.GetValue(PEPSettings.REG_NAME_IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS, PEPSettings.IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS_DEFAULT).ToString();
   8.110 -                            isSuccessful = bool.TryParse(keyValue, out parsedBoolValue);
   8.111 -
   8.112 -                            if (isSuccessful)
   8.113 +                            if ((pEpKey.GetValue(PEPSettings.REG_NAME_IS_SYNC_ENABLED) is string stringValue) &&
   8.114 +                                (bool.TryParse(stringValue, out bool boolValue)))
   8.115                              {
   8.116 -                                this._IsSyncEnabledForAllAccounts = parsedBoolValue;
   8.117 +                                this._IsSyncEnabled = boolValue;
   8.118                                  isPropertySet = true;
   8.119                              }
   8.120                          }
   8.121                          catch
   8.122                          {
   8.123 -                            Log.Warning("LoadFromRegistry: Unable to read IsSyncEnabledForAllAccounts");
   8.124 +                            Log.Warning("LoadFromRegistry: Unable to read IsSyncEnabled");
   8.125                          }
   8.126                          finally
   8.127                          {
   8.128                              if (isPropertySet == false)
   8.129                              {
   8.130 -                                this._IsSyncEnabledForAllAccounts = PEPSettings.IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS_DEFAULT;
   8.131 +                                this._IsSyncEnabled = PEPSettings.IS_SYNC_ENABLED_DEFAULT;
   8.132                              }
   8.133  
   8.134 -                            this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabledForAllAccounts));
   8.135 +                            this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabled));
   8.136                          }
   8.137  
   8.138                          // Attempt to get IsUnencryptedSubjectEnabled value
   8.139 @@ -2149,7 +2143,6 @@
   8.140                      if (object.Equals(this._IsSyncEnabled, value) == false)
   8.141                      {
   8.142                          this._IsSyncEnabled = value;
   8.143 -                        this.SignalSyncSettingsToEngine();
   8.144                          this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabled));
   8.145                      }
   8.146                  }
   8.147 @@ -2362,23 +2355,26 @@
   8.148  
   8.149                      try
   8.150                      {
   8.151 -                        if (this.IsSyncEnabled)
   8.152 +                        if ((this.IsSyncEnabled) &&
   8.153 +                            (Globals.ThisAddIn.Settings.IsSyncEnabled))
   8.154                          {
   8.155                              ThisAddIn.PEPEngine.EnableIdentityForSync(own);
   8.156 +                            Log.Verbose("SignalSyncSettingsToEngine: Enabled sync for " + this.SmtpAddress);
   8.157                          }
   8.158                          else
   8.159                          {
   8.160                              ThisAddIn.PEPEngine.DisableIdentityForSync(own);
   8.161 +                            Log.Verbose("SignalSyncSettingsToEngine: Disabled sync for " + this.SmtpAddress);
   8.162                          }
   8.163                      }
   8.164                      catch (Exception ex)
   8.165                      {
   8.166 -                        Log.Error("ToggleSyncEnabledSetting: Error enabling/disabling Sync for '{0}'. {1}", this.SmtpAddress, ex.ToString());
   8.167 +                        Log.Error("SignalSyncSettingsToEngine: Error enabling/disabling Sync for '{0}'. {1}", this.SmtpAddress, ex.ToString());
   8.168                      }
   8.169                  }
   8.170                  else
   8.171                  {
   8.172 -                    Log.Error("ToggleSyncEnabledSetting: Error getting own identity for " + this.SmtpAddress ?? "<null>");
   8.173 +                    Log.Error("SignalSyncSettingsToEngine: Error getting own identity for " + this.SmtpAddress ?? "<null>");
   8.174                  }
   8.175              }
   8.176          }
     9.1 --- a/Properties/Resources.Designer.cs	Tue Nov 19 10:00:19 2019 +0100
     9.2 +++ b/Properties/Resources.Designer.cs	Mon Dec 02 07:53:36 2019 +0100
     9.3 @@ -1903,6 +1903,15 @@
     9.4          }
     9.5          
     9.6          /// <summary>
     9.7 +        ///   Looks up a localized string similar to Enable p≡p Sync.
     9.8 +        /// </summary>
     9.9 +        public static string Options_IsSyncEnabled {
    9.10 +            get {
    9.11 +                return ResourceManager.GetString("Options_IsSyncEnabled", resourceCulture);
    9.12 +            }
    9.13 +        }
    9.14 +        
    9.15 +        /// <summary>
    9.16          ///   Looks up a localized string similar to Enable p≡p sync for all accounts.
    9.17          /// </summary>
    9.18          public static string Options_IsSyncEnabledForAllAccountsText {
    10.1 --- a/Properties/Resources.de.resx	Tue Nov 19 10:00:19 2019 +0100
    10.2 +++ b/Properties/Resources.de.resx	Mon Dec 02 07:53:36 2019 +0100
    10.3 @@ -941,6 +941,9 @@
    10.4    <data name="SyncWizard_RejectButton" xml:space="preserve">
    10.5      <value>Ablehnen</value>
    10.6    </data>
    10.7 +  <data name="Options_IsSyncEnabled" xml:space="preserve">
    10.8 +    <value>p≡p Sync aktivieren</value>
    10.9 +  </data>
   10.10    <data name="Options_CheckForUpdate" xml:space="preserve">
   10.11      <value>Nach Update suchen</value>
   10.12    </data>
    11.1 --- a/Properties/Resources.es.resx	Tue Nov 19 10:00:19 2019 +0100
    11.2 +++ b/Properties/Resources.es.resx	Mon Dec 02 07:53:36 2019 +0100
    11.3 @@ -941,6 +941,9 @@
    11.4    <data name="SyncWizard_RejectButton" xml:space="preserve">
    11.5      <value>Rechazar</value>
    11.6    </data>
    11.7 +  <data name="Options_IsSyncEnabled" xml:space="preserve">
    11.8 +    <value>Activate p≡p Sync</value>
    11.9 +  </data>
   11.10    <data name="Options_CheckForUpdate" xml:space="preserve">
   11.11      <value>Buscar actualizaciones</value>
   11.12    </data>
    12.1 --- a/Properties/Resources.resx	Tue Nov 19 10:00:19 2019 +0100
    12.2 +++ b/Properties/Resources.resx	Mon Dec 02 07:53:36 2019 +0100
    12.3 @@ -1071,6 +1071,9 @@
    12.4    <data name="SyncWizard_RejectButton" xml:space="preserve">
    12.5      <value>Decline</value>
    12.6    </data>
    12.7 +  <data name="Options_IsSyncEnabled" xml:space="preserve">
    12.8 +    <value>Enable p≡p Sync</value>
    12.9 +  </data>
   12.10    <data name="Options_CheckForUpdate" xml:space="preserve">
   12.11      <value>Check for update</value>
   12.12    </data>
    13.1 --- a/Resources/Dictionary.xaml	Tue Nov 19 10:00:19 2019 +0100
    13.2 +++ b/Resources/Dictionary.xaml	Mon Dec 02 07:53:36 2019 +0100
    13.3 @@ -106,8 +106,8 @@
    13.4       * 
    13.5       ***********************************************************-->
    13.6  
    13.7 -    <!-- Style for the handshake 'Trust' button -->
    13.8 -    <Style x:Key="StyleTrustButton"
    13.9 +    <!-- Style for a yellow button -->
   13.10 +    <Style x:Key="StyleButtonYellow"
   13.11             TargetType="Button"
   13.12             BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
   13.13          <Setter Property="Background"
   13.14 @@ -177,8 +177,8 @@
   13.15          </Setter>
   13.16      </Style>
   13.17  
   13.18 -    <!-- Style for the handshake 'Cancel' button -->
   13.19 -    <Style x:Key="StyleButtonCancel"
   13.20 +    <!-- Style for a gray button -->
   13.21 +    <Style x:Key="StyleButtonGray"
   13.22             TargetType="Button"
   13.23             BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
   13.24          <Setter Property="BorderBrush"
   13.25 @@ -235,8 +235,8 @@
   13.26          </Setter>
   13.27      </Style>
   13.28  
   13.29 -    <!-- Style for the handshake 'Confirm trustwords' button -->
   13.30 -    <Style x:Key="StyleButtonConfirm"
   13.31 +    <!-- Style for a green button -->
   13.32 +    <Style x:Key="StyleButtonGreen"
   13.33             TargetType="Button"
   13.34             BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
   13.35          <Setter Property="Background"
   13.36 @@ -293,8 +293,8 @@
   13.37          </Setter>
   13.38      </Style>
   13.39  
   13.40 -    <!-- Style for the handshake 'Wrong trustwords' button -->
   13.41 -    <Style x:Key="StyleButtonWrong"
   13.42 +    <!-- Style for a red button -->
   13.43 +    <Style x:Key="StyleButtonRed"
   13.44             TargetType="Button"
   13.45             BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
   13.46          <Setter Property="Background"
    14.1 --- a/ThisAddIn.cs	Tue Nov 19 10:00:19 2019 +0100
    14.2 +++ b/ThisAddIn.cs	Mon Dec 02 07:53:36 2019 +0100
    14.3 @@ -9,6 +9,7 @@
    14.4  using System.ComponentModel;
    14.5  using System.Globalization;
    14.6  using System.IO;
    14.7 +using System.Linq;
    14.8  using System.Runtime.InteropServices;
    14.9  using System.Threading.Tasks;
   14.10  using System.Windows.Forms;
   14.11 @@ -544,7 +545,7 @@
   14.12          /// Warning: This code should be kept synchronized with the Settings_PropertyChanged event.
   14.13          /// <param name="syncAccountsList">Whether to also update the accounts list in pEp settings. 
   14.14          /// </summary>
   14.15 -        internal void SyncWithSettings(bool syncAccountsList = false)
   14.16 +        internal void SyncSettingsToEngine(bool syncAccountsList = false)
   14.17          {
   14.18              bool exists;
   14.19              string dialogMessage = string.Empty;
   14.20 @@ -554,12 +555,38 @@
   14.21              {
   14.22                  if (this._Settings != null)
   14.23                  {
   14.24 -                    // Update the Outlook accounts list with the one maintained in pEp settings if needed.
   14.25 +                    // Update the Outlook accounts list with the one maintained in pEp settings if needed
   14.26                      if (syncAccountsList)
   14.27                      {
   14.28                          this.SyncAccountsList();
   14.29                      }
   14.30  
   14.31 +                    // Sync sync settings with engine
   14.32 +                    this._Settings.AccountSettingsList?.ToList()?.ForEach(accountSettings =>
   14.33 +                    {
   14.34 +                        accountSettings?.SignalSyncSettingsToEngine();
   14.35 +                    });
   14.36 +
   14.37 +                    // Enable/disable Sync if needed
   14.38 +                    bool isSyncRunning =  AdapterExtensions.GetIsSyncEnabled();
   14.39 +                    if ((this._Settings.IsSyncEnabled) &&
   14.40 +                        (isSyncRunning == false))
   14.41 +                    {
   14.42 +                        ThisAddIn.PEPEngine.Startup();
   14.43 +                    }
   14.44 +                    else if ((this.Settings.IsSyncEnabled == false) &&
   14.45 +                            (isSyncRunning))
   14.46 +                    {
   14.47 +                        if (this.Settings.IsGrouped)
   14.48 +                        {
   14.49 +                            ThisAddIn.PEPEngine.LeaveDeviceGroup();
   14.50 +                        }
   14.51 +                        else
   14.52 +                        {
   14.53 +                            ThisAddIn.PEPEngine.ShutDownSync();
   14.54 +                        }
   14.55 +                    }
   14.56 +
   14.57                      // Sync IsPassiveModeEnabled with engine
   14.58                      ThisAddIn.PEPEngine.PassiveMode(this._Settings.IsPassiveModeEnabled);
   14.59  
   14.60 @@ -717,7 +744,7 @@
   14.61                  };
   14.62  
   14.63                  // Set not for sync flag if necessary
   14.64 -                if ((Globals.ThisAddIn.Settings.IsSyncEnabledForAllAccounts == false) &&
   14.65 +                if ((this._Settings.IsSyncEnabled == false) ||
   14.66                       (acctSettings.IsSyncEnabled == false))
   14.67                  {
   14.68                      ownIdentity.Flags = pEpIdentityFlags.pEpIdfNotForSync;
   14.69 @@ -1211,6 +1238,8 @@
   14.70                          acctSettings.IsPEPEnabled = entry.IsPEPEnabled;
   14.71                          acctSettings.IsSecureStorageEnabled = entry.IsSecureStorageEnabled;
   14.72                          acctSettings.IsSyncEnabled = entry.IsSyncEnabled;
   14.73 +
   14.74 +                        acctSettings.SignalSyncSettingsToEngine();
   14.75                      }
   14.76                      else
   14.77                      {
   14.78 @@ -1225,25 +1254,6 @@
   14.79                  }
   14.80                  this._Settings.HideInternalMessages = state.HideInternalMessages;
   14.81  
   14.82 -                // If the user disables sync for all accounts, leave device group, if necessary
   14.83 -                if ((state.IsGrouped) &&
   14.84 -                    (state.IsSyncEnabledForAllAccounts == false) &&
   14.85 -                    (this._Settings.IsSyncEnabledForAllAccounts))
   14.86 -                {
   14.87 -                    try
   14.88 -                    {
   14.89 -                        ThisAddIn.PEPEngine.LeaveDeviceGroup();
   14.90 -                    }
   14.91 -                    catch (Exception ex)
   14.92 -                    {
   14.93 -                        Log.Error("SetOptionsState: Error occured while trying to leave device group. " + ex.ToString());
   14.94 -                    }
   14.95 -                }
   14.96 -                else // else just sync the setting
   14.97 -                {
   14.98 -                    this._Settings.IsSyncEnabledForAllAccounts = state.IsSyncEnabledForAllAccounts;
   14.99 -                }
  14.100 -
  14.101                  this._Settings.IsAutoUpdateEnabled = state.IsAutoUpdateEnabled;
  14.102                  this._Settings.IsEncryptAllAccountsEnabled = state.IsEncryptAllAccountsEnabled;
  14.103                  this._Settings.IsNeverUnsecureOptionVisible = state.IsNeverUnsecureOptionVisible;
  14.104 @@ -1251,6 +1261,7 @@
  14.105                  this._Settings.IsPEPFolderVisible = state.IsPEPFolderVisible;
  14.106                  this._Settings.IsPrivacyStatusBarEnabled = state.IsPrivacyStatusBarEnabled;
  14.107                  this._Settings.IsSecurityLossWarningEnabled = state.IsSecurityLossWarningEnabled;
  14.108 +                this._Settings.IsSyncEnabled = state.IsSyncEnabled;
  14.109                  this._Settings.IsUnencryptedSubjectEnabled = state.IsUnencryptedSubjectEnabled;
  14.110                  this._Settings.IsVerboseLoggingEnabled = state.IsVerboseLoggingEnabled;
  14.111                  this._Settings.TrustwordsCulture = ((state.TrustwordsCulture != null) ? new CultureInfo(state.TrustwordsCulture.LCID) : null);
  14.112 @@ -1260,6 +1271,9 @@
  14.113  
  14.114                  // Update registry (in case of unforseen app shutdown)
  14.115                  this._Settings.SaveToRegistry();
  14.116 +
  14.117 +                // Sync with engine
  14.118 +                this.SyncSettingsToEngine();
  14.119              }
  14.120          }
  14.121  
  14.122 @@ -1425,7 +1439,7 @@
  14.123              state.IsPEPFolderVisible = (isDefaultStore ? true : this._Settings.IsPEPFolderVisible);
  14.124              state.IsPrivacyStatusBarEnabled = this._Settings.IsPrivacyStatusBarEnabled;
  14.125              state.IsSecurityLossWarningEnabled = this._Settings.IsSecurityLossWarningEnabled;
  14.126 -            state.IsSyncEnabledForAllAccounts = this._Settings.IsSyncEnabledForAllAccounts;
  14.127 +            state.IsSyncEnabled = this._Settings.IsSyncEnabled;
  14.128              state.IsTNEFDisabled = this._Settings.IsTNEFDisabled;
  14.129              state.IsUnencryptedSubjectEnabled = this._Settings.IsUnencryptedSubjectEnabled;
  14.130              state.IsVerboseLoggingEnabled = this._Settings.IsVerboseLoggingEnabled;
  14.131 @@ -2694,7 +2708,7 @@
  14.132              this.adapterCallbacks = new AdapterCallbacks();
  14.133              ThisAddIn.PEPEngine.RegisterCallbacks(this.adapterCallbacks);
  14.134  #endif
  14.135 -            // Import GPG keys if necessary
  14.136 +            // Import GPG keys if necessary 
  14.137              this.ImportGPGKeys();
  14.138  
  14.139              // Set Cipher Suite
  14.140 @@ -2713,7 +2727,7 @@
  14.141              Log.Info("ThisAddIn_Startup: Sync settings");
  14.142              this.DetectChangesFromLastSettings(this._Settings);
  14.143              this._Settings.SaveUpdaterConfigToRegistry();
  14.144 -            this.SyncWithSettings();
  14.145 +            this.SyncSettingsToEngine();
  14.146              this._Settings.PropertyChanged += Settings_PropertyChanged;
  14.147  
  14.148              // Create UI thread dispatcher to open dialog windows
  14.149 @@ -2742,22 +2756,21 @@
  14.150                      this.ConnectWatchedInspectors(true);
  14.151  
  14.152                      // Connect application events
  14.153 -                    Log.Info("ThisAddIn_Startup: Connect Application Events");
  14.154 +                    Log.Info("ThisAddIn_Startup: Connect Application Events.");
  14.155                      this.ConnectApplicationEvents(true);
  14.156  
  14.157                      // Initialize inbox cleaning timer
  14.158 +                    Log.Info("ThisAddIn_Startup: Initializing inbox cleaner.");
  14.159                      this.ToggleInboxCleaning(true);
  14.160  
  14.161                      // Create the 'pEp Internal' and 'pEp Processing' categories
  14.162 +                    Log.Info("ThisAddIn_Startup: Creating PEP categories.");
  14.163                      this.CreatePEPCategories();
  14.164  
  14.165                      // Initialization complete
  14.166                      Log.Info("ThisAddIn_Startup: Main program started.");
  14.167                      this.initialized = true;
  14.168                  }
  14.169 -
  14.170 -                // Startup active parts of engine
  14.171 -                ThisAddIn.PEPEngine.Startup();
  14.172              }
  14.173              catch (Exception ex)
  14.174              {
    15.1 --- a/UI/FormControlOptions.xaml	Tue Nov 19 10:00:19 2019 +0100
    15.2 +++ b/UI/FormControlOptions.xaml	Mon Dec 02 07:53:36 2019 +0100
    15.3 @@ -18,7 +18,6 @@
    15.4              <local:InvertBoolConverter x:Key="InvertBool" />
    15.5              <local:MultiBooleanToVisibilityConverter x:Key="MultiBooleanToVisibility" />
    15.6              <local:ValueConverterGroup x:Key="IsSyncEnabledToColor">
    15.7 -                <local:InvertBoolConverter />
    15.8                  <local:IsEnabledToColorConverter />
    15.9              </local:ValueConverterGroup>
   15.10              <local:ValueConverterGroup x:Key="InvertBoolToVisibility">
   15.11 @@ -203,7 +202,7 @@
   15.12                          <CheckBox Grid.Row="2"
   15.13                                    VerticalContentAlignment="Top"
   15.14                                    IsThreeState="False"
   15.15 -                                  IsChecked="{Binding Path=IsSyncEnabledForAllAccounts, Mode=TwoWay}"
   15.16 +                                  IsChecked="{Binding Path=IsSyncEnabled, Mode=TwoWay}"
   15.17                                    Visibility="{Binding Path=IsAdvancedEnabled, Mode=OneWay, Converter={StaticResource BoolToVisibility}}">
   15.18                              <CheckBox.Margin>
   15.19                                  <Thickness Bottom="0"
   15.20 @@ -211,7 +210,7 @@
   15.21                                             Right="0"
   15.22                                             Top="{StaticResource PageSubSectionSpacing}" />
   15.23                              </CheckBox.Margin>
   15.24 -                            <TextBlock Text="{x:Static p:Resources.Options_IsSyncEnabledForAllAccountsText}"
   15.25 +                            <TextBlock Text="{x:Static p:Resources.Options_IsSyncEnabled}"
   15.26                                         TextWrapping="Wrap"
   15.27                                         Margin="{StaticResource CheckBoxContentMarginWhenTop}" />
   15.28                          </CheckBox>
   15.29 @@ -345,7 +344,7 @@
   15.30                                              <TextBlock Text="{x:Static p:Resources.Options_AccountIsSyncEnabledText}"
   15.31                                                         IsEnabled="{Binding Path=IsSyncEnabledOptionEnabled, Mode=OneWay}"
   15.32                                                         Margin="3,2,0,0"
   15.33 -                                                       Foreground="{Binding Path='DataContext.IsSyncEnabledForAllAccounts', RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Mode=OneWay, Converter={StaticResource IsSyncEnabledToColor}}"/>
   15.34 +                                                       Foreground="{Binding Path='DataContext.IsSyncEnabled', RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Mode=OneWay, Converter={StaticResource IsSyncEnabledToColor}}"/>
   15.35                                          </StackPanel>
   15.36                                          <StackPanel Grid.Column="1"
   15.37                                                      Grid.Row="3"
   15.38 @@ -531,19 +530,12 @@
   15.39                                        Margin="5">
   15.40                              </ComboBox>
   15.41                          </StackPanel>
   15.42 -                        <StackPanel Grid.Row="7"
   15.43 -                                    Orientation="Horizontal">
   15.44 -                            <Button Style="{StaticResource StyleButtonCancel}"
   15.45 -                                    Margin="0,0,10,0"
   15.46 -                                    HorizontalAlignment="Left"
   15.47 -                                    Content="{x:Static p:Resources.Options_LeaveDeviceGroupText}"
   15.48 -                                    Click="ButtonLeaveDeviceGroup_Click"
   15.49 -                                    Visibility="{Binding IsGrouped, Converter={StaticResource BoolToVisibility}}" />
   15.50 -                            <Button Style="{StaticResource StyleButtonCancel}"
   15.51 -                                    HorizontalAlignment="Left"
   15.52 -                                    Content="{x:Static p:Resources.Options_ResetAllOwnKeys}"
   15.53 -                                    Click="ButtonResetAllOwnKeys_Click" />
   15.54 -                        </StackPanel>
   15.55 +                        <Button Grid.Row="7"
   15.56 +                                Style="{StaticResource StyleButtonGray}"
   15.57 +                                Margin="0,0,10,0"
   15.58 +                                HorizontalAlignment="Left"
   15.59 +                                Content="{x:Static p:Resources.Options_ResetAllOwnKeys}"
   15.60 +                                Click="ButtonResetAllOwnKeys_Click" />
   15.61                      </Grid>
   15.62  
   15.63                  </Grid>
   15.64 @@ -571,7 +563,7 @@
   15.65  
   15.66                      <!--Import key button-->
   15.67                      <Button Grid.Row="2"
   15.68 -                            Style="{StaticResource StyleButtonConfirm}"
   15.69 +                            Style="{StaticResource StyleButtonGray}"
   15.70                              Content="{x:Static p:Resources.StoreContextMenu_OpenPGPKeyImportWizard}" 
   15.71                              HorizontalAlignment="Left"
   15.72                              Margin="10"
    16.1 --- a/UI/FormControlOptions.xaml.cs	Tue Nov 19 10:00:19 2019 +0100
    16.2 +++ b/UI/FormControlOptions.xaml.cs	Mon Dec 02 07:53:36 2019 +0100
    16.3 @@ -258,30 +258,6 @@
    16.4          }
    16.5  
    16.6          /// <summary>
    16.7 -        /// Event handler for when the Leave Device Group button is clicked.
    16.8 -        /// </summary>
    16.9 -        private void ButtonLeaveDeviceGroup_Click(object sender, RoutedEventArgs e)
   16.10 -        {
   16.11 -            try
   16.12 -            {
   16.13 -                // Leave the device group
   16.14 -                ThisAddIn.PEPEngine.LeaveDeviceGroup();
   16.15 -
   16.16 -                // Calling LeaveDeviceGroup will shutdown sync, so we have to persist
   16.17 -                // this setting in the app to not start sync again.
   16.18 -                this.DisplayState.IsGrouped = false;
   16.19 -                this.DisplayState.IsSyncEnabledForAllAccounts = false;
   16.20 -
   16.21 -                // Show a success notification
   16.22 -                Notification.Show(Properties.Resources.KeySync_DeviceGroup, Properties.Resources.Notifications_DeviceGroupLeftText);
   16.23 -            }
   16.24 -            catch (Exception ex)
   16.25 -            {
   16.26 -                Log.Error("ButtonLeaveDeviceGroup_Click: Error leaving device group. " + ex.ToString());
   16.27 -            }
   16.28 -        }
   16.29 -
   16.30 -        /// <summary>
   16.31          /// Event handler for when the Reset All Own Keys button is clicked.
   16.32          /// </summary>
   16.33          private void ButtonResetAllOwnKeys_Click(object sender, RoutedEventArgs e)
   16.34 @@ -354,7 +330,7 @@
   16.35              private bool                                            _IsPEPFolderVisible;
   16.36              private bool                                            _IsPrivacyStatusBarEnabled;
   16.37              private bool                                            _IsSecurityLossWarningEnabled;
   16.38 -            private bool                                            _IsSyncEnabledForAllAccounts;
   16.39 +            private bool                                            _IsSyncEnabled;
   16.40              private bool                                            _IsTNEFDisabled;
   16.41              private bool                                            _IsUnencryptedSubjectEnabled;
   16.42              private bool                                            _IsVerboseLoggingEnabled;
   16.43 @@ -713,15 +689,15 @@
   16.44              }
   16.45  
   16.46              /// <summary>
   16.47 -            /// Gets or sets whether to disable key sync for all accounts.
   16.48 +            /// Gets or sets whether sync is enabled or not.
   16.49              /// </summary>
   16.50 -            public bool IsSyncEnabledForAllAccounts
   16.51 +            public bool IsSyncEnabled
   16.52              {
   16.53 -                get { return (this._IsSyncEnabledForAllAccounts); }
   16.54 +                get { return (this._IsSyncEnabled); }
   16.55                  set
   16.56                  {
   16.57 -                    this._IsSyncEnabledForAllAccounts = value;
   16.58 -                    this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabledForAllAccounts));
   16.59 +                    this._IsSyncEnabled = value;
   16.60 +                    this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabled));
   16.61  
   16.62                      this.CalcDependentProperties();
   16.63                  }
   16.64 @@ -1052,7 +1028,7 @@
   16.65              private void ExportKeys()
   16.66              {
   16.67                  /* Read the keys.db and export all keys as binary files to 
   16.68 -                 * PEP_USER_FOLDER\keys\{fpr}.asc. If             
   16.69 +                 * PEP_USER_FOLDER\keys\{fpr}.asc.
   16.70                   */
   16.71                  try
   16.72                  {
   16.73 @@ -1211,7 +1187,7 @@
   16.74                  copy.IsPEPFolderVisible = this._IsPEPFolderVisible;
   16.75                  copy.IsPrivacyStatusBarEnabled = this._IsPrivacyStatusBarEnabled;
   16.76                  copy.IsSecurityLossWarningEnabled = this._IsSecurityLossWarningEnabled;
   16.77 -                copy.IsSyncEnabledForAllAccounts = this._IsSyncEnabledForAllAccounts;
   16.78 +                copy.IsSyncEnabled = this._IsSyncEnabled;
   16.79                  copy.IsTNEFDisabled = this._IsTNEFDisabled;
   16.80                  copy.IsUnencryptedSubjectEnabled = this._IsUnencryptedSubjectEnabled;
   16.81                  copy.IsVerboseLoggingEnabled = this._IsVerboseLoggingEnabled;
   16.82 @@ -1266,7 +1242,7 @@
   16.83                  this._IsPEPFolderVisible = PEPSettings.IS_PEP_FOLDER_VISIBLE_DEFAULT;
   16.84                  this._IsPrivacyStatusBarEnabled = PEPSettings.IS_PRIVACY_STATUS_BAR_ENABLED_DEFAULT;
   16.85                  this._IsSecurityLossWarningEnabled = PEPSettings.IS_SECURITY_LOSS_WARNING_ENABLED_DEFAULT;
   16.86 -                this._IsSyncEnabledForAllAccounts = PEPSettings.IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS_DEFAULT;
   16.87 +                this._IsSyncEnabled = PEPSettings.IS_SYNC_ENABLED_DEFAULT;
   16.88                  this._IsTNEFDisabled = PEPSettings.IS_TNEF_DISABLED_DEFAULT;
   16.89                  this._IsUnencryptedSubjectEnabled = PEPSettings.IS_UNENCRYPTED_SUBJECT_ENABLED_DEFAULT;
   16.90                  this._IsVerboseLoggingEnabled = PEPSettings.IS_VERBOSE_LOGGING_ENABLED_DEFAULT;
   16.91 @@ -1303,7 +1279,7 @@
   16.92                  this.RaisePropertyChangedEvent(nameof(this.IsPEPFolderVisible));
   16.93                  this.RaisePropertyChangedEvent(nameof(this.IsPrivacyStatusBarEnabled));
   16.94                  this.RaisePropertyChangedEvent(nameof(this.IsSecurityLossWarningEnabled));
   16.95 -                this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabledForAllAccounts));
   16.96 +                this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabled));
   16.97                  this.RaisePropertyChangedEvent(nameof(this.IsTNEFDisabled));
   16.98                  this.RaisePropertyChangedEvent(nameof(this.IsUnencryptedSubjectEnabled));
   16.99                  this.RaisePropertyChangedEvent(nameof(this.IsVerboseLoggingEnabled));
  16.100 @@ -1439,11 +1415,11 @@
  16.101                                  entry.IsSyncEnabledOptionVisible = true;
  16.102                                  entry.IsSyncEnabledOverridden = true;
  16.103                              }
  16.104 -                            else if (this._IsSyncEnabledForAllAccounts)
  16.105 +                            else if (this._IsSyncEnabled == false)
  16.106                              {
  16.107 -                                /* If 'Disable pEp sync for all accounts' is checked, show sync disabled for each account. 
  16.108 +                                /* If Sync is disabled, show sync disabled for each account. 
  16.109                                   * This will still preserve whatever the past user setting was for the account.
  16.110 -                                 * This can be done because processing will use the 'IsSyncDisabledForAllAccounts' as an override.
  16.111 +                                 * This can be done because processing will use the 'IsSyncEnabled' as an override.
  16.112                                   * 
  16.113                                   * Do not modify the stored real value for IsSyncEnabled
  16.114                                   */
    17.1 --- a/UI/InputMessageBox.xaml	Tue Nov 19 10:00:19 2019 +0100
    17.2 +++ b/UI/InputMessageBox.xaml	Mon Dec 02 07:53:36 2019 +0100
    17.3 @@ -36,12 +36,12 @@
    17.4          <StackPanel Orientation="Horizontal"
    17.5                      HorizontalAlignment="Right">
    17.6  
    17.7 -            <Button Style="{StaticResource StyleButtonConfirm}"
    17.8 +            <Button Style="{StaticResource StyleButtonGray}"
    17.9                      HorizontalAlignment="Center"
   17.10                      Margin="5,5,0,5"
   17.11                      Content="{x:Static p:Resources.KeySyncWizard_Next}"
   17.12                      Command="{Binding CommandButtonConfirm}"/>
   17.13 -            <Button Style="{StaticResource StyleButtonCancel}"
   17.14 +            <Button Style="{StaticResource StyleButtonGray}"
   17.15                      HorizontalAlignment="Center"
   17.16                      Margin="5,5,0,5"
   17.17                      Content="{x:Static p:Resources.Options_CancelText}"
    18.1 --- a/UI/ViewModels/HandshakeViewModel.cs	Tue Nov 19 10:00:19 2019 +0100
    18.2 +++ b/UI/ViewModels/HandshakeViewModel.cs	Mon Dec 02 07:53:36 2019 +0100
    18.3 @@ -459,7 +459,7 @@
    18.4              this.SetExplanationText();
    18.5  
    18.6              // Define visibility of Reset button
    18.7 -            this.IsResetButtonVisible = (this.Parent.Dialog.DialogType == Dialog.Type.Handshake) && (this.Partner.IsOwnIdentity == false);
    18.8 +            this.IsResetButtonVisible = (this.Parent.Dialog.DialogType == Dialog.Type.Handshake) && (this.Partner.Me == false);
    18.9          }
   18.10  
   18.11          /// <summary>
    19.1 --- a/UI/ViewModels/WizardPageViewModelBase.cs	Tue Nov 19 10:00:19 2019 +0100
    19.2 +++ b/UI/ViewModels/WizardPageViewModelBase.cs	Mon Dec 02 07:53:36 2019 +0100
    19.3 @@ -19,9 +19,9 @@
    19.4          private bool                _IsButtonRejectHandshakeVisible     = false;
    19.5  
    19.6          // Button styles
    19.7 -        public static Style        GreenButtonStyle                    = (Application.LoadComponent(new Uri("/pEp;component/Resources/Dictionary.xaml", UriKind.Relative)) as ResourceDictionary)["StyleButtonConfirm"] as Style;
    19.8 -        public static Style        GreyButtonStyle                     = (Application.LoadComponent(new Uri("/pEp;component/Resources/Dictionary.xaml", UriKind.Relative)) as ResourceDictionary)["StyleButtonCancel"] as Style;
    19.9 -        public static Style        RedButtonStyle                      = (Application.LoadComponent(new Uri("/pEp;component/Resources/Dictionary.xaml", UriKind.Relative)) as ResourceDictionary)["StyleButtonWrong"] as Style;
   19.10 +        public static Style        GreenButtonStyle                    = (Application.LoadComponent(new Uri("/pEp;component/Resources/Dictionary.xaml", UriKind.Relative)) as ResourceDictionary)["StyleButtonGreen"] as Style;
   19.11 +        public static Style        GreyButtonStyle                     = (Application.LoadComponent(new Uri("/pEp;component/Resources/Dictionary.xaml", UriKind.Relative)) as ResourceDictionary)["StyleButtonGray"] as Style;
   19.12 +        public static Style        RedButtonStyle                      = (Application.LoadComponent(new Uri("/pEp;component/Resources/Dictionary.xaml", UriKind.Relative)) as ResourceDictionary)["StyleButtonRed"] as Style;
   19.13  
   19.14  
   19.15          /// <summary>
    20.1 --- a/UI/Views/HandshakeDialogView.xaml	Tue Nov 19 10:00:19 2019 +0100
    20.2 +++ b/UI/Views/HandshakeDialogView.xaml	Mon Dec 02 07:53:36 2019 +0100
    20.3 @@ -63,7 +63,7 @@
    20.4          <Button HorizontalAlignment="Right"
    20.5                      Command="{Binding CommandButtonClose}"
    20.6                      Content="{x:Static p:Resources.ManagePrivacyStatus_CloseText}"
    20.7 -                    Style="{StaticResource StyleButtonCancel}" />
    20.8 +                    Style="{StaticResource StyleButtonGray}" />
    20.9  
   20.10      </StackPanel>
   20.11  </UserControl>
    21.1 --- a/UI/Views/HandshakeView.xaml	Tue Nov 19 10:00:19 2019 +0100
    21.2 +++ b/UI/Views/HandshakeView.xaml	Mon Dec 02 07:53:36 2019 +0100
    21.3 @@ -218,13 +218,13 @@
    21.4                          HorizontalAlignment="Right"
    21.5                          Margin="0,5,0,0"
    21.6                          Visibility="{Binding Parent.Dialog.DialogType, Converter={StaticResource IsNotWizardModeToVisibility}}">
    21.7 -                    <Button Style="{StaticResource StyleButtonConfirm}"
    21.8 +                    <Button Style="{StaticResource StyleButtonGreen}"
    21.9                          HorizontalAlignment="Center"
   21.10                          Margin="0,5,5,5"
   21.11                          Content="{Binding Path=ButtonConfirmText, FallbackValue=Confirm}"
   21.12                          Command="{Binding ButtonConfirmOnClick}"
   21.13                          IsDefault="True"/>
   21.14 -                    <Button Style="{StaticResource StyleButtonWrong}"
   21.15 +                    <Button Style="{StaticResource StyleButtonRed}"
   21.16                          HorizontalAlignment="Center"
   21.17                          Margin="5,5,0,5"
   21.18                          Content="{Binding Path=ButtonWrongText, FallbackValue=Wrong}"
   21.19 @@ -241,7 +241,7 @@
   21.20                  <TextBlock Text="{x:Static p:Resources.DialogWindow_ResetCommunicationPartner}" 
   21.21                             VerticalAlignment="Center"
   21.22                             Margin="5"/>
   21.23 -                <Button Style="{StaticResource StyleButtonCancel}"
   21.24 +                <Button Style="{StaticResource StyleButtonGray}"
   21.25                          HorizontalAlignment="Center"
   21.26                          Margin="5,5,0,5"
   21.27                          Content="{x:Static p:Resources.Options_Reset}"