PEPSettings.cs
author Thomas
Mon, 25 Mar 2019 13:27:16 +0100
branchsync
changeset 2610 09fde2338362
parent 2513 e64e9b9a0e64
child 2634 18c5fdfe95b6
permissions -rw-r--r--
Merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
     1
using Microsoft.Win32;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
     2
using System;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
     3
using System.Collections.Generic;
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
     4
using System.Collections.ObjectModel;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
     5
using System.Collections.Specialized;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
     6
using System.ComponentModel;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
     7
using System.Globalization;
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
     8
using System.IO;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
     9
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    10
namespace pEp
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    11
{
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    12
    /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    13
    /// Class to store and maintain all configurations/settings for pEp for Outlook.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    14
    /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    15
    internal class PEPSettings : INotifyPropertyChanged,
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    16
                                 Interfaces.IReset
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    17
    {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    18
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    19
        /// Event raised when a property is changed on a component.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    20
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    21
        public event PropertyChangedEventHandler PropertyChanged;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    22
1988
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    23
        /// <summary>
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    24
        /// Defines whether to add a disclaimer to a message.
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    25
        /// </summary>
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    26
        public enum Disclaimer
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    27
        {
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    28
            None = 0,
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    29
            OnlyEncryptedMessages,
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    30
            AllMessages
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    31
        }
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    32
2004
fef678d01f1f Add creation of contacts if needed
Thomas
parents: 2003
diff changeset
    33
        public const string PEP_OWN_USER_ID                                     = "pEp_own_userId";
2003
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
    34
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    35
        public const string REG_KEY_SOFTWARE                                    = "Software";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    36
        public const string REG_KEY_PEP                                         = "pEp";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    37
        public const string REG_KEY_PEP_FOR_OUTLOOK                             = "Outlook";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    38
        public const string REG_KEY_PEP_UPDATER                                 = "Updater";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    39
        public const string REG_KEY_MICROSOFT_OFFICE                            = "Microsoft\\Office";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    40
        public const string REG_KEY_ENCRYPTED_ACCOUNTS_LIST                     = "EncryptedAccountsList";
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
    41
        public const string REG_KEY_ACCOUNT_SETTINGS_LIST                       = "AccountSettingsList";
1988
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    42
        public const string REG_NAME_ACCOUNT_SETTING_ADD_DISCLAIMER             = "AddDisclaimer";
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    43
        public const string REG_NAME_ACCOUNT_SETTING_DISCLAIMER_TEXT            = "DisclaimerText";
1784
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
    44
        public const string REG_NAME_ACCOUNT_SETTING_IS_DECRYPT_ALWAYS_ENABLED  = "IsDecryptAlwaysEnabled";
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
    45
        public const string REG_NAME_ACCOUNT_SETTING_IS_PEP_ENABLED             = "IsPEPEnabled";
1138
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
    46
        public const string REG_NAME_ACCOUNT_SETTING_IS_SECURE_STORAGE_ENABLED  = "IsSecureStorageEnabled";
1488
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
    47
        public const string REG_NAME_ACCOUNT_SETTING_IS_SYNC_ENABLED            = "IsSyncEnabled";
1348
c394606d6f6c Change to .net standard capitalization rules in several places.
Dean
parents: 1314
diff changeset
    48
        public const string REG_NAME_ACCOUNT_SETTING_SENT_FOLDER_ENTRYID        = "SentFolderEntryId";
c394606d6f6c Change to .net standard capitalization rules in several places.
Dean
parents: 1314
diff changeset
    49
        public const string REG_NAME_ACCOUNT_SETTING_SMTP_ADDRESS               = "SmtpAddress";
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
    50
        public const string REG_NAME_ACCOUNT_SETTING_TYPE                       = "Type";
2003
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
    51
        public const string REG_NAME_ACCOUNT_SETTING_USER_NAME                  = "UserName";
1138
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
    52
        public const string REG_NAME_ACCOUNT_WHITELIST                          = "AccountWhitelist";
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    53
        public const string REG_NAME_CRASH_REPORT_SEND_ADDRESS                  = "CrashReportSendAddress";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    54
        public const string REG_NAME_DEFAULT_CODEPAGE_OUT                       = "Default_CodePageOut"; // Name defined by Microsoft
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    55
        public const string REG_NAME_EXTRA_KEYS                                 = "ExtraKeys";
2432
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
    56
        public const string REG_NAME_HIDE_INTERNAL_MESSAGES                     = "HideInternalMessages";
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    57
        public const string REG_NAME_IS_AUTO_UPDATE_ENABLED                     = "IsAutoUpdateEnabled";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    58
        public const string REG_NAME_IS_CRASH_REPORT_VISIBLE                    = "IsCrashReportVisible";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    59
        public const string REG_NAME_IS_DEVELOPER_MODE_ENABLED                  = "IsDeveloperModeEnabled";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    60
        public const string REG_NAME_IS_DISABLE_PROTECTION_FOR_CONTACTS_ENABLED = "IsDisableProtectionForContactsEnabled";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    61
        public const string REG_NAME_IS_ENCRYPT_ALL_ACCOUNTS_ENABLED            = "IsEncryptAllAccountsEnabled";
1441
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
    62
        public const string REG_NAME_IS_FIRST_STARTUP_COMPLETE                  = "IsFirstStartupComplete";
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    63
        public const string REG_NAME_IS_KEY_SERVER_USED                         = "IsKeyServerUsed";
1314
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
    64
        public const string REG_NAME_IS_NEVER_UNSECURE_OPTION_VISIBLE           = "IsNeverUnsecureOptionVisible";
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    65
        public const string REG_NAME_IS_PASSIVE_MODE_ENABLED                    = "IsPassiveModeEnabled";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    66
        public const string REG_NAME_IS_PEP_FOLDER_VISIBLE                      = "IsPEPFolderVisible";
2410
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
    67
        public const string REG_NAME_IS_PRIVACY_STATUS_BAR_ENABLED              = "IsPrivacyStatusBarEnabled";
1137
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
    68
        public const string REG_NAME_IS_READER_SPLASH_ENABLED                   = "IsReaderSplashEnabled";
1170
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
    69
        public const string REG_NAME_IS_SECURITY_LOSS_WARNING_ENABLED           = "IsSecurityLossWarningEnabled";
1979
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
    70
        public const string REG_NAME_IS_SENSITIVE_DATA_LOGGING_ENABLED          = "IsSensitiveDataLoggingEnabled";
1577
e1fc661de901 OUT-209: Adjust design to new specs.
Thomas
parents: 1576
diff changeset
    71
        public const string REG_NAME_IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS           = "IsSyncEnabledForAllAccounts";
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    72
        public const string REG_NAME_IS_TNEF_DISABLED                           = "DisableTNEF"; // Name defined by Microsoft
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    73
        public const string REG_NAME_IS_UNENCRYPTED_SUBJECT_ENABLED             = "IsUnencryptedSubjectEnabled";
2509
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
    74
        public const string REG_NAME_IS_UX_IMPROVEMENT_ENABLED                  = "IsUXImprovementEnabled";
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    75
        public const string REG_NAME_IS_VERBOSE_LOGGING_ENABLED                 = "IsVerboseLoggingEnabled";
1241
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
    76
        public const string REG_NAME_TRUSTWORDS_CULTURE                         = "TrustwordsCulture";
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    77
1784
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
    78
        public const bool                  ACCOUNT_SETTING_IS_DECRYPT_ALWAYS_ENABLED_DEFAULT  = true;
1138
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
    79
        public const bool                  ACCOUNT_SETTING_IS_PEP_ENABLED_DEFAULT             = true;
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
    80
        public const bool                  ACCOUNT_SETTING_IS_SECURE_STORAGE_ENABLED_DEFAULT  = PEPSettings.ENCRYPT_ACCOUNTS_BY_DEFAULT;
1488
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
    81
        public const bool                  ACCOUNT_SETTING_IS_SYNC_ENABLED_DEFAULT            = true;
1138
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
    82
        public const string                ACCOUNT_SETTING_SENT_FOLDER_ENTRYID_DEFAULT        = null;
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
    83
        public const string                ACCOUNT_SETTING_SMTP_ADDRESS_DEFAULT               = null;
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
    84
        public const string                ACCOUNT_SETTING_TYPE_DEFAULT                       = null;
2003
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
    85
        public const string                ACCOUNT_SETTING_USER_NAME_DEFAULT                  = null;  
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    86
        public static readonly string[]    ACCOUNT_WHITELIST_DEFAULT                          = new string[] { };
1988
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    87
        public static Disclaimer           ADD_DISCLAIMER_DEFAULT                             = Disclaimer.None;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    88
        public const string                CRASH_REPORT_SEND_ADDRESS_DEFAULT                  = "crashreport@prettyeasyprivacy.com";
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    89
        public const string                CULTURE_CODE_DEFAULT                               = "en";
1988
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
    90
        public const string                DISCLAIMER_TEXT_DEFAULT                            = null;
2063
cf63da070820 Further implementation. Still some parts left.
Thomas
parents: 2058
diff changeset
    91
        public const bool                  ENCRYPT_ACCOUNTS_BY_DEFAULT                        = true;
2432
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
    92
        public const bool                  HIDE_INTERNAL_MESSAGES_DEFAULT                     = true;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    93
        public const bool                  IS_AUTO_UPDATE_ENABLED_DEFAULT                     = true;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    94
        public const bool                  IS_CRASH_REPORT_VISIBLE_DEFAULT                    = true;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    95
        public const bool                  IS_DEVELOPER_MODE_ENABLED_DEFAULT                  = false;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    96
        public const bool                  IS_DISABLE_PROTECTION_FOR_CONTACTS_ENABLED_DEFAULT = false;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    97
        public const bool                  IS_ENCRYPT_ALL_ACCOUNTS_ENABLED_DEFAULT            = false;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
    98
        public const bool                  IS_KEY_SERVER_USED_DEFAULT                         = false;
1314
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
    99
        public const bool                  IS_NEVER_UNSECURE_OPTION_VISIBLE_DEFAULT           = false;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   100
        public const bool                  IS_PASSIVE_MODE_ENABLED_DEFAULT                    = false;
1410
462c4d0b0006 Change default pEp folder visiblity to visible.
Dean
parents: 1351
diff changeset
   101
        public const bool                  IS_PEP_FOLDER_VISIBLE_DEFAULT                      = true;
2410
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   102
        public const bool                  IS_PRIVACY_STATUS_BAR_ENABLED_DEFAULT              = false;
1137
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   103
        public const bool                  IS_READER_SPLASH_ENABLED_DEFAULT                   = true;
1306
b750807857de By default show the security loss warning for the reader.
Dean
parents: 1292
diff changeset
   104
#if READER_RELEASE_MODE
b750807857de By default show the security loss warning for the reader.
Dean
parents: 1292
diff changeset
   105
        public const bool                  IS_SECURITY_LOSS_WARNING_ENABLED_DEFAULT           = true;
b750807857de By default show the security loss warning for the reader.
Dean
parents: 1292
diff changeset
   106
#else
1170
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   107
        public const bool                  IS_SECURITY_LOSS_WARNING_ENABLED_DEFAULT           = false;
1306
b750807857de By default show the security loss warning for the reader.
Dean
parents: 1292
diff changeset
   108
#endif
1979
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   109
        public const bool                  IS_SENSITIVE_DATA_LOGGING_ENABLED_DEFAULT          = false;
1577
e1fc661de901 OUT-209: Adjust design to new specs.
Thomas
parents: 1576
diff changeset
   110
        public const bool                  IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS_DEFAULT           = true;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   111
        public const bool                  IS_TNEF_DISABLED_DEFAULT                           = false;
1947
1a842ccf85d6 OUT-367: Disable subject protection by default
Thomas
parents: 1784
diff changeset
   112
        public const bool                  IS_UNENCRYPTED_SUBJECT_ENABLED_DEFAULT             = true;
2509
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   113
        public const bool                  IS_UX_IMPROVEMENT_ENABLED_DEFAULT                  = true;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   114
        public const bool                  IS_VERBOSE_LOGGING_ENABLED_DEFAULT                 = false;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   115
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   116
        private ObservableCollection<PEPAccountSettings> _AccountSettingsList;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   117
        private string[]                                 _AccountWhitelist;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   118
        private string                                   _CrashReportSendAddress;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   119
        private string[]                                 _ExtraKeys;
2432
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   120
        private bool                                     _HideInternalMessages;
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   121
        private bool                                     _IsAutoUpdateEnabled;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   122
        private bool                                     _IsCrashReportVisible;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   123
        private bool                                     _IsDeveloperModeEnabled;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   124
        private bool                                     _IsDisableProtectionForContactsEnabled;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   125
        private bool                                     _IsEncryptAllAccountsEnabled;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   126
        private bool                                     _IsFirstStartupComplete;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   127
        private bool                                     _IsKeyServerUsed;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   128
        private bool                                     _IsNeverUnsecureOptionVisible;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   129
        private bool                                     _IsPassiveModeEnabled;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   130
        private bool                                     _IsPEPFolderVisible;
2410
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   131
        private bool                                     _IsPrivacyStatusBarEnabled;
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   132
        private bool                                     _IsReaderSplashEnabled;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   133
        private bool                                     _IsSecurityLossWarningEnabled;
1979
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   134
        private bool                                     _IsSensitiveDataLoggingEnabled;
1577
e1fc661de901 OUT-209: Adjust design to new specs.
Thomas
parents: 1576
diff changeset
   135
        private bool                                     _IsSyncEnabledForAllAccounts;
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   136
        private bool                                     _IsTNEFDisabled;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   137
        private bool                                     _IsUnencryptedSubjectEnabled;
2509
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   138
        private bool                                     _IsUXImprovementEnabled;
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   139
        private bool                                     _IsVerboseLoggingEnabled;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   140
        private CultureInfo                              _TrustwordsCulture;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   141
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   142
        /**************************************************************
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   143
         * 
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   144
         * Constructors
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   145
         * 
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   146
         *************************************************************/
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   147
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   148
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   149
        /// Default constructor.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   150
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   151
        public PEPSettings()
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   152
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   153
            this.Reset();
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   154
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   155
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   156
        /**************************************************************
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   157
         * 
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   158
         * Property Accessors
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   159
         * 
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   160
         *************************************************************/
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   161
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   162
        /// <summary>
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   163
        /// Gets the list of accounts and their corresponding settings.
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   164
        /// This initially is only those accounts which already existed in the registry.
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   165
        /// An external function should validate this list with the current accounts list in Outlook.
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   166
        /// </summary>
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   167
        public ObservableCollection<PEPAccountSettings> AccountSettingsList
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   168
        {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   169
            get { return (this._AccountSettingsList); }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   170
        }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   171
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   172
        /// <summary>
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   173
        /// Gets the account whitelist as the combination of hardcoded and registry values.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   174
        /// Can only be set from the registry or hardcoded values.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   175
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   176
        public string[] AccountWhitelist
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   177
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   178
            get { return (this._AccountWhitelist); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   179
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   180
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   181
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   182
        /// Gets the email address to send any crash report to.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   183
        /// Can only be set from the registry.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   184
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   185
        public string CrashReportSendAddress
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   186
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   187
            get { return (this._CrashReportSendAddress); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   188
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   189
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   190
        /// <summary>
2058
ecee220c7d7d OUT-417: Detect new account during message creation.
Thomas
parents: 2004
diff changeset
   191
        /// Contains a list of smtp addresses that are to be excluded
ecee220c7d7d OUT-417: Detect new account during message creation.
Thomas
parents: 2004
diff changeset
   192
        /// during synchronization of the pEp and Outlook accounts lists.
ecee220c7d7d OUT-417: Detect new account during message creation.
Thomas
parents: 2004
diff changeset
   193
        /// Note: This property is only needed for newly added accounts 
ecee220c7d7d OUT-417: Detect new account during message creation.
Thomas
parents: 2004
diff changeset
   194
        /// without having Outlook restarted. As the Outlook.Accounts
ecee220c7d7d OUT-417: Detect new account during message creation.
Thomas
parents: 2004
diff changeset
   195
        /// collection does not get updated when an account is added 
ecee220c7d7d OUT-417: Detect new account during message creation.
Thomas
parents: 2004
diff changeset
   196
        /// while Outlook is running, we have to make sure to not delete
ecee220c7d7d OUT-417: Detect new account during message creation.
Thomas
parents: 2004
diff changeset
   197
        /// such account settings during shutdown or other sync tasks.
ecee220c7d7d OUT-417: Detect new account during message creation.
Thomas
parents: 2004
diff changeset
   198
        /// </summary>
2069
e7a29b63f826 Remove saving the StoreId again, as Outlook fails to return the delivery store anyhow when the account is set up while program is running.
Thomas
parents: 2063
diff changeset
   199
        public List<string> AccountsAddedWhileRunningList { get; set; } = new List<string>();
2058
ecee220c7d7d OUT-417: Detect new account during message creation.
Thomas
parents: 2004
diff changeset
   200
ecee220c7d7d OUT-417: Detect new account during message creation.
Thomas
parents: 2004
diff changeset
   201
        /// <summary>
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   202
        /// Gets any extra encryption keys that were loaded from the registry.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   203
        /// Can only be set from the registry.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   204
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   205
        public string[] ExtraKeys
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   206
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   207
            get { return (this._ExtraKeys); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   208
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   209
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   210
        /// <summary>
2432
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   211
        /// Gets or sets whether to hide pEp internal messages.
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   212
        /// </summary>
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   213
        public bool HideInternalMessages
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   214
        {
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   215
            get { return (this._HideInternalMessages); }
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   216
            set
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   217
            {
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   218
                if (object.Equals(this._HideInternalMessages, value) == false)
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   219
                {
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   220
                    this._HideInternalMessages = value;
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   221
                    this.RaisePropertyChangedEvent(nameof(this.HideInternalMessages));
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   222
                }
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   223
            }
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   224
        }
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   225
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   226
        /// <summary>
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   227
        /// Gets or sets whether auto update is enabled.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   228
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   229
        public bool IsAutoUpdateEnabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   230
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   231
            get { return (this._IsAutoUpdateEnabled); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   232
            set
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   233
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   234
                if (object.Equals(this._IsAutoUpdateEnabled, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   235
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   236
                    this._IsAutoUpdateEnabled = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   237
                    this.RaisePropertyChangedEvent(nameof(this.IsAutoUpdateEnabled));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   238
                }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   239
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   240
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   241
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   242
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   243
        /// Gets whether the crash report window is visible to the user.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   244
        /// Can only be set from the registry.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   245
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   246
        public bool IsCrashReportVisible
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   247
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   248
            get { return (this._IsCrashReportVisible); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   249
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   250
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   251
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   252
        /// Gets whether developer mode is enabled.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   253
        /// Can only be set from the registry.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   254
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   255
        public bool IsDeveloperModeEnabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   256
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   257
            get { return (this._IsDeveloperModeEnabled); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   258
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   259
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   260
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   261
        /// Gets whether disabling protection per contact is enabled.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   262
        /// Can only be set from the registry.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   263
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   264
        public bool IsDisableProtectionForContactsEnabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   265
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   266
            get { return (this._IsDisableProtectionForContactsEnabled); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   267
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   268
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   269
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   270
        /// Gets or sets whether data should be stored encrypted for all accounts.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   271
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   272
        public bool IsEncryptAllAccountsEnabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   273
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   274
            get { return (this._IsEncryptAllAccountsEnabled); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   275
            set
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   276
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   277
                if (object.Equals(this._IsEncryptAllAccountsEnabled, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   278
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   279
                    this._IsEncryptAllAccountsEnabled = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   280
                    this.RaisePropertyChangedEvent(nameof(this.IsEncryptAllAccountsEnabled));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   281
                }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   282
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   283
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   284
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   285
        /// <summary>
1441
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
   286
        /// Gets or sets whether first startup of the add-in has already been completed.
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
   287
        /// </summary>
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
   288
        public bool IsFirstStartupComplete
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
   289
        {
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
   290
            get { return (this._IsFirstStartupComplete); }
1493
e99a7ac685d9 OUT-169: Set IsFirstStartupComplete to false if a rule or filter was not set correctly and make Outlook try again at the next startup.
Thomas
parents: 1488
diff changeset
   291
            set
e99a7ac685d9 OUT-169: Set IsFirstStartupComplete to false if a rule or filter was not set correctly and make Outlook try again at the next startup.
Thomas
parents: 1488
diff changeset
   292
            {
1501
6348dde3709b Complete the merge manually.
Dean
parents: 1500
diff changeset
   293
                if (object.Equals(this._IsFirstStartupComplete, value) == false)
6348dde3709b Complete the merge manually.
Dean
parents: 1500
diff changeset
   294
                {
6348dde3709b Complete the merge manually.
Dean
parents: 1500
diff changeset
   295
                    this._IsFirstStartupComplete = value;
6348dde3709b Complete the merge manually.
Dean
parents: 1500
diff changeset
   296
                    this.RaisePropertyChangedEvent(nameof(this.IsFirstStartupComplete));
6348dde3709b Complete the merge manually.
Dean
parents: 1500
diff changeset
   297
                }
1493
e99a7ac685d9 OUT-169: Set IsFirstStartupComplete to false if a rule or filter was not set correctly and make Outlook try again at the next startup.
Thomas
parents: 1488
diff changeset
   298
            }
1441
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
   299
        }
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
   300
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
   301
        /// <summary>
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   302
        /// Gets or sets whether to use key servers.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   303
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   304
        public bool IsKeyServerUsed
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   305
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   306
            get { return (this._IsKeyServerUsed); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   307
            set
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   308
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   309
                if (object.Equals(this._IsKeyServerUsed, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   310
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   311
                    this._IsKeyServerUsed = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   312
                    this.RaisePropertyChangedEvent(nameof(this.IsKeyServerUsed));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   313
                }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   314
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   315
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   316
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   317
        /// <summary>
1314
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   318
        /// Gets or sets whether the never unsecure option/button is visible in the UI.
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   319
        /// </summary>
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   320
        public bool IsNeverUnsecureOptionVisible
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   321
        {
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   322
            get { return (this._IsNeverUnsecureOptionVisible); }
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   323
            set
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   324
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   325
                if (object.Equals(this._IsNeverUnsecureOptionVisible, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   326
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   327
                    this._IsNeverUnsecureOptionVisible = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   328
                    this.RaisePropertyChangedEvent(nameof(this.IsNeverUnsecureOptionVisible));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   329
                }
1314
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   330
            }
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   331
        }
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   332
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   333
        /// <summary>
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   334
        /// Gets or sets whether passive mode is enabled.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   335
        /// Passive mode will not attach keys unless keys are received.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   336
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   337
        public bool IsPassiveModeEnabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   338
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   339
            get { return (this._IsPassiveModeEnabled); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   340
            set
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   341
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   342
                if (object.Equals(this._IsPassiveModeEnabled, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   343
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   344
                    this._IsPassiveModeEnabled = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   345
                    this.RaisePropertyChangedEvent(nameof(this.IsPassiveModeEnabled));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   346
                }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   347
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   348
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   349
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   350
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   351
        /// Gets or sets whether the pEp folder (and its contents) are visible in the navigation pane.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   352
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   353
        public bool IsPEPFolderVisible
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   354
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   355
            get { return (this._IsPEPFolderVisible); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   356
            set
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   357
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   358
                if (object.Equals(this._IsPEPFolderVisible, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   359
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   360
                    this._IsPEPFolderVisible = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   361
                    this.RaisePropertyChangedEvent(nameof(this.IsPEPFolderVisible));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   362
                }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   363
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   364
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   365
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   366
        /// <summary>
2410
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   367
        /// Gets or sets whether privacy status bar is enabled or not.
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   368
        /// </summary>
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   369
        public bool IsPrivacyStatusBarEnabled
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   370
        {
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   371
            get { return (this._IsPrivacyStatusBarEnabled); }
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   372
            set
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   373
            {
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   374
                if (object.Equals(this._IsPrivacyStatusBarEnabled, value) == false)
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   375
                {
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   376
                    this._IsPrivacyStatusBarEnabled = value;
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   377
                    this.RaisePropertyChangedEvent(nameof(this.IsPrivacyStatusBarEnabled));
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   378
                }
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   379
            }
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   380
        }
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   381
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   382
        /// <summary>
1137
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   383
        /// Gets or sets whether the reader splash screen is enabled.
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   384
        /// When enabled, the splash will be shown at startup.
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   385
        /// This value is ignored if ReleaseMode != Reader.
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   386
        /// </summary>
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   387
        public bool IsReaderSplashEnabled
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   388
        {
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   389
            get { return (this._IsReaderSplashEnabled); }
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   390
            set
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   391
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   392
                if (object.Equals(this._IsReaderSplashEnabled, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   393
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   394
                    this._IsReaderSplashEnabled = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   395
                    this.RaisePropertyChangedEvent(nameof(this.IsReaderSplashEnabled));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   396
                }
1137
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   397
            }
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   398
        }
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   399
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   400
        /// <summary>
1170
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   401
        /// Gets or sets whether to display a warning when sending a message (forward/reply)
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   402
        /// unencrypted that was previously encrypted.
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   403
        /// </summary>
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   404
        public bool IsSecurityLossWarningEnabled
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   405
        {
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   406
            get { return (this._IsSecurityLossWarningEnabled); }
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   407
            set
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   408
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   409
                if (object.Equals(this._IsSecurityLossWarningEnabled, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   410
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   411
                    this._IsSecurityLossWarningEnabled = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   412
                    this.RaisePropertyChangedEvent(nameof(this.IsSecurityLossWarningEnabled));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   413
                }
1170
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   414
            }
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   415
        }
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   416
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   417
        /// <summary>
1979
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   418
        /// Gets or sets whether sensitive data logging is enabled.
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   419
        /// </summary>
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   420
        public bool IsSensitiveDataLoggingEnabled
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   421
        {
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   422
            get { return (this._IsSensitiveDataLoggingEnabled); }
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   423
            set
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   424
            {
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   425
                if (object.Equals(this._IsSensitiveDataLoggingEnabled, value) == false)
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   426
                {
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   427
                    this._IsSensitiveDataLoggingEnabled = value;
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   428
                    this.RaisePropertyChangedEvent(nameof(this.IsSensitiveDataLoggingEnabled));
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   429
                }
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   430
            }
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   431
        }
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   432
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   433
        /// <summary>
1576
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   434
        /// Gets or sets whether key sync is disabled for all accounts.
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   435
        /// </summary>
1577
e1fc661de901 OUT-209: Adjust design to new specs.
Thomas
parents: 1576
diff changeset
   436
        public bool IsSyncEnabledForAllAccounts
1576
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   437
        {
1577
e1fc661de901 OUT-209: Adjust design to new specs.
Thomas
parents: 1576
diff changeset
   438
            get { return (this._IsSyncEnabledForAllAccounts); }
1576
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   439
            set
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   440
            {
1577
e1fc661de901 OUT-209: Adjust design to new specs.
Thomas
parents: 1576
diff changeset
   441
                if (object.Equals(this._IsSyncEnabledForAllAccounts, value) == false)
1576
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   442
                {
1577
e1fc661de901 OUT-209: Adjust design to new specs.
Thomas
parents: 1576
diff changeset
   443
                    this._IsSyncEnabledForAllAccounts = value;
e1fc661de901 OUT-209: Adjust design to new specs.
Thomas
parents: 1576
diff changeset
   444
                    this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabledForAllAccounts));
1576
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   445
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   446
                    Globals.ThisAddIn.SyncWithSettings();
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   447
                }
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   448
            }
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   449
        }
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   450
e86332ff82fc OUT-209: Add disable key sync for all accounts option
Thomas
parents: 1570
diff changeset
   451
        /// <summary>
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   452
        /// Gets or sets whether TNEF/RTF format is forcefully disabled in the registry.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   453
        /// Can only be set from the registry.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   454
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   455
        public bool IsTNEFDisabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   456
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   457
            get { return (this._IsTNEFDisabled); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   458
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   459
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   460
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   461
        /// Gets or sets whether to enable encryption of message subjects.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   462
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   463
        public bool IsUnencryptedSubjectEnabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   464
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   465
            get { return (this._IsUnencryptedSubjectEnabled); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   466
            set
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   467
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   468
                if (object.Equals(this._IsUnencryptedSubjectEnabled, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   469
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   470
                    this._IsUnencryptedSubjectEnabled = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   471
                    this.RaisePropertyChangedEvent(nameof(this.IsUnencryptedSubjectEnabled));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   472
                }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   473
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   474
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   475
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   476
        /// <summary>
2509
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   477
        /// Gets or sets whether to enable the UX improvement.
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   478
        /// </summary>
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   479
        public bool IsUXImprovementEnabled
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   480
        {
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   481
            get { return (this._IsUXImprovementEnabled); }
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   482
            set
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   483
            {
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   484
                if (object.Equals(this._IsUXImprovementEnabled, value) == false)
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   485
                {
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   486
                    this._IsUXImprovementEnabled = value;
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   487
                    this.RaisePropertyChangedEvent(nameof(this.IsUXImprovementEnabled));
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   488
                }
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   489
            }
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   490
        }
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   491
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   492
        /// <summary>
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   493
        /// Gets or sets whether verbose logging is enabled.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   494
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   495
        public bool IsVerboseLoggingEnabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   496
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   497
            get { return (this._IsVerboseLoggingEnabled); }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   498
            set
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   499
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   500
                if (object.Equals(this._IsVerboseLoggingEnabled, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   501
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   502
                    this._IsVerboseLoggingEnabled = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   503
                    this.RaisePropertyChangedEvent(nameof(this.IsVerboseLoggingEnabled));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   504
                }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   505
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   506
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   507
1241
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   508
        /// <summary>
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   509
        /// Gets or sets the culture to display the trustwords in.
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   510
        /// </summary>
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   511
        public CultureInfo TrustwordsCulture
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   512
        {
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   513
            get { return (this._TrustwordsCulture); }
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   514
            set
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   515
            {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   516
                if (object.Equals(this._TrustwordsCulture, value) == false)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   517
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   518
                    this._TrustwordsCulture = value;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   519
                    this.RaisePropertyChangedEvent(nameof(this.TrustwordsCulture));
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   520
                }
1241
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   521
            }
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   522
        }
f7e497d5d19c Add trustwords culture setting (currently unused).
Dean
parents: 1206
diff changeset
   523
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   524
        /**************************************************************
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   525
         * 
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   526
         * Methods
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   527
         * 
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   528
         *************************************************************/
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   529
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   530
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   531
        /// Raises the property changed event, if possible, with the given arguments.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   532
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   533
        /// <param name="propertyName">The name of the property that changed.</param>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   534
        private void RaisePropertyChangedEvent(string propertyName)
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   535
        {
1244
1b295697fe5d Use the null-conditional operator when invoking events.
Dean
parents: 1242
diff changeset
   536
            this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   537
            return;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   538
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   539
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   540
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   541
        /// Resets the object to it's default state/values.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   542
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   543
        public void Reset()
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   544
        {
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   545
            // Disconnect events
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   546
            if (this._AccountSettingsList != null)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   547
            {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   548
                this._AccountSettingsList.CollectionChanged -= AccountSettingsList_CollectionChanged;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   549
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   550
                foreach (PEPAccountSettings acctSettings in this._AccountSettingsList)
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   551
                {
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   552
                    acctSettings.PropertyChanged -= PEPAccountSettings_PropertyChanged;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   553
                }
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   554
            }
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   555
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   556
            this._AccountSettingsList = new ObservableCollection<PEPAccountSettings>();
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   557
            this._AccountWhitelist = PEPSettings.ACCOUNT_WHITELIST_DEFAULT;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   558
            this._CrashReportSendAddress = PEPSettings.CRASH_REPORT_SEND_ADDRESS_DEFAULT;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   559
            this._ExtraKeys = null;
2432
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   560
            this._HideInternalMessages = PEPSettings.HIDE_INTERNAL_MESSAGES_DEFAULT;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   561
            this._IsAutoUpdateEnabled = PEPSettings.IS_AUTO_UPDATE_ENABLED_DEFAULT;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   562
            this._IsCrashReportVisible = PEPSettings.IS_CRASH_REPORT_VISIBLE_DEFAULT;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   563
            this._IsDeveloperModeEnabled = PEPSettings.IS_DEVELOPER_MODE_ENABLED_DEFAULT;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   564
            this._IsDisableProtectionForContactsEnabled = PEPSettings.IS_DISABLE_PROTECTION_FOR_CONTACTS_ENABLED_DEFAULT;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   565
            this._IsEncryptAllAccountsEnabled = PEPSettings.IS_ENCRYPT_ALL_ACCOUNTS_ENABLED_DEFAULT;
1441
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
   566
            this._IsFirstStartupComplete = false;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   567
            this._IsKeyServerUsed = PEPSettings.IS_KEY_SERVER_USED_DEFAULT;
1314
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   568
            this._IsNeverUnsecureOptionVisible = PEPSettings.IS_NEVER_UNSECURE_OPTION_VISIBLE_DEFAULT;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   569
            this._IsPassiveModeEnabled = PEPSettings.IS_PASSIVE_MODE_ENABLED_DEFAULT;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   570
            this._IsPEPFolderVisible = PEPSettings.IS_PEP_FOLDER_VISIBLE_DEFAULT;
2410
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   571
            this._IsPrivacyStatusBarEnabled = PEPSettings.IS_PRIVACY_STATUS_BAR_ENABLED_DEFAULT;
1137
0348799d1f79 Add IsReaderSplashEnabled setting.
Dean
parents: 1111
diff changeset
   572
            this._IsReaderSplashEnabled = PEPSettings.IS_READER_SPLASH_ENABLED_DEFAULT;
1170
e168e21549d4 OUT-18: Add setting to enable or disable security loss warning.
Dean
parents: 1155
diff changeset
   573
            this._IsSecurityLossWarningEnabled = PEPSettings.IS_SECURITY_LOSS_WARNING_ENABLED_DEFAULT;
1979
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   574
            this._IsSensitiveDataLoggingEnabled = PEPSettings.IS_SENSITIVE_DATA_LOGGING_ENABLED_DEFAULT;
1577
e1fc661de901 OUT-209: Adjust design to new specs.
Thomas
parents: 1576
diff changeset
   575
            this._IsSyncEnabledForAllAccounts = PEPSettings.IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS_DEFAULT;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   576
            this._IsTNEFDisabled = PEPSettings.IS_TNEF_DISABLED_DEFAULT;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   577
            this._IsUnencryptedSubjectEnabled = PEPSettings.IS_UNENCRYPTED_SUBJECT_ENABLED_DEFAULT;
2509
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   578
            this._IsUXImprovementEnabled = PEPSettings.IS_UX_IMPROVEMENT_ENABLED_DEFAULT;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   579
            this._IsVerboseLoggingEnabled = PEPSettings.IS_VERBOSE_LOGGING_ENABLED_DEFAULT;
1351
80e7cec5b7cc Select the default trustwords language as the UI language.
Dean
parents: 1348
diff changeset
   580
            this._TrustwordsCulture = null; // Allow application to decide since default is UI language
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   581
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   582
            // Connect events
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   583
            this._AccountSettingsList.CollectionChanged += AccountSettingsList_CollectionChanged;
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   584
1242
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   585
            this.RaisePropertyChangedEvent(nameof(this.AccountSettingsList));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   586
            this.RaisePropertyChangedEvent(nameof(this.AccountWhitelist));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   587
            this.RaisePropertyChangedEvent(nameof(this.CrashReportSendAddress));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   588
            this.RaisePropertyChangedEvent(nameof(this.ExtraKeys));
2432
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   589
            this.RaisePropertyChangedEvent(nameof(this.HideInternalMessages));
1242
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   590
            this.RaisePropertyChangedEvent(nameof(this.IsAutoUpdateEnabled));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   591
            this.RaisePropertyChangedEvent(nameof(this.IsCrashReportVisible));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   592
            this.RaisePropertyChangedEvent(nameof(this.IsDeveloperModeEnabled));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   593
            this.RaisePropertyChangedEvent(nameof(this.IsDisableProtectionForContactsEnabled));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   594
            this.RaisePropertyChangedEvent(nameof(this.IsEncryptAllAccountsEnabled));
1441
5d86ae076016 Add custom FirstStartup and NewAccount events to ThisAddIn.
Dean
parents: 1440
diff changeset
   595
            this.RaisePropertyChangedEvent(nameof(this.IsFirstStartupComplete));
1242
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   596
            this.RaisePropertyChangedEvent(nameof(this.IsKeyServerUsed));
1314
4b4f0b1943fb OUT-109: Implement option to show/hide the Store Protected button.
Dean
parents: 1306
diff changeset
   597
            this.RaisePropertyChangedEvent(nameof(this.IsNeverUnsecureOptionVisible));
1242
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   598
            this.RaisePropertyChangedEvent(nameof(this.IsPassiveModeEnabled));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   599
            this.RaisePropertyChangedEvent(nameof(this.IsPEPFolderVisible));
2410
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   600
            this.RaisePropertyChangedEvent(nameof(this.IsPrivacyStatusBarEnabled));
1242
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   601
            this.RaisePropertyChangedEvent(nameof(this.IsReaderSplashEnabled));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   602
            this.RaisePropertyChangedEvent(nameof(this.IsSecurityLossWarningEnabled));
1979
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   603
            this.RaisePropertyChangedEvent(nameof(this.IsSensitiveDataLoggingEnabled));
1577
e1fc661de901 OUT-209: Adjust design to new specs.
Thomas
parents: 1576
diff changeset
   604
            this.RaisePropertyChangedEvent(nameof(this.IsSyncEnabledForAllAccounts));
1242
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   605
            this.RaisePropertyChangedEvent(nameof(this.IsTNEFDisabled));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   606
            this.RaisePropertyChangedEvent(nameof(this.IsUnencryptedSubjectEnabled));
2509
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   607
            this.RaisePropertyChangedEvent(nameof(this.IsUXImprovementEnabled));
1242
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   608
            this.RaisePropertyChangedEvent(nameof(this.IsVerboseLoggingEnabled));
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   609
            this.RaisePropertyChangedEvent(nameof(this.TrustwordsCulture));
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   610
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   611
            return;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   612
        }
1460
0b65f50c102e OUT-162: OUT-164: OUT-176: Allow managing a separate display state for account options.
Dean
parents: 1441
diff changeset
   613
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   614
        /// <summary>
1522
cc9a14ce8514 OUT-170: Exlude identity. Also initial implementation of new NotifyHandshake with synchronization signal.
Thomas
parents: 1502
diff changeset
   615
        /// Gets the account settings object that corresponds with the given SMTP address.
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   616
        /// This will return the first match in the list if somehow more than one.
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   617
        /// </summary>
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   618
        /// <param name="smtpAddress">The SMTP address of the account settings to get.</param>
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   619
        /// <returns>The matching account settings, otherwise false.</returns>
1522
cc9a14ce8514 OUT-170: Exlude identity. Also initial implementation of new NotifyHandshake with synchronization signal.
Thomas
parents: 1502
diff changeset
   620
        public PEPAccountSettings GetAccountSettings(string smtpAddress)
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   621
        {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   622
            PEPAccountSettings result = null;
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   623
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   624
            if (string.IsNullOrEmpty(smtpAddress) == false)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   625
            {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   626
                foreach (PEPAccountSettings acctSettings in this._AccountSettingsList)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   627
                {
2513
e64e9b9a0e64 OUT-532: Add shared mailbox stores to pEp settings account list
Thomas
parents: 2509
diff changeset
   628
                    // Compare only by address
1522
cc9a14ce8514 OUT-170: Exlude identity. Also initial implementation of new NotifyHandshake with synchronization signal.
Thomas
parents: 1502
diff changeset
   629
                    if (acctSettings.EqualsByAddress(smtpAddress))
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   630
                    {
1522
cc9a14ce8514 OUT-170: Exlude identity. Also initial implementation of new NotifyHandshake with synchronization signal.
Thomas
parents: 1502
diff changeset
   631
                        result = acctSettings;
cc9a14ce8514 OUT-170: Exlude identity. Also initial implementation of new NotifyHandshake with synchronization signal.
Thomas
parents: 1502
diff changeset
   632
                        break;
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   633
                    }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   634
                }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   635
            }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   636
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   637
            return (result);
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   638
        }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   639
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   640
        /**************************************************************
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   641
         * 
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   642
         * Registry Methods
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   643
         * 
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   644
         *************************************************************/
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   645
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   646
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   647
        /// Writes/saves the updater config for Outlook to the registry.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   648
        /// This should only be called after the value of _IsAutoUpdateEnabled is stable.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   649
        /// This method is called automatically within WriteConfigToRegistry().
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   650
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   651
        public void SaveUpdaterConfigToRegistry()
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   652
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   653
            try
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   654
            {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   655
                // Check if key exists and update if necessary
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   656
                bool keyExists = false;
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   657
                string updateStr = string.Format(pEp.Properties.Settings.Default.UpdateURL, pEp.Properties.Settings.Default.Serial);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   658
                string pEpKey = Path.Combine(PEPSettings.REG_KEY_SOFTWARE, PEPSettings.REG_KEY_PEP);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   659
                string updaterKey = Path.Combine(pEpKey, PEPSettings.REG_KEY_PEP_UPDATER);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   660
2126
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   661
                Log.Verbose("SaveUpdaterConfigToRegistry: Key to check/update: " + updaterKey);
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   662
                Log.SensitiveData("SaveUpdaterConfigToRegistry: Value to check for: " + updateStr);
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   663
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   664
                using (RegistryKey key = Registry.CurrentUser.OpenSubKey(updaterKey))
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   665
                {
2126
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   666
                    var value = key?.GetValue(Globals.PEP_NAME_INSTALL);
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   667
                    Log.SensitiveData("SaveUpdaterConfigToRegistry: Value found in registry: " + value?.ToString());
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   668
                    keyExists = (value?.Equals(updateStr) == true);
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   669
                    Log.Verbose("SaveUpdaterConfigToRegistry: " + (keyExists ? "Same value found in registry." : "No value or different value found."));
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   670
                }              
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   671
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   672
                // If key exists and update is disabled, delete key
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   673
                if (keyExists &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   674
                    (this._IsAutoUpdateEnabled == false))
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   675
                {
2126
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   676
                    Log.Verbose("SaveUpdaterConfigToRegistry: Key exists and IsAutoUpdateEnabled is false. Deleting value.");
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   677
                    using (RegistryKey key = Registry.CurrentUser.OpenSubKey(pEpKey, true))
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   678
                    {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   679
                        key?.DeleteSubKeyTree(PEPSettings.REG_KEY_PEP_UPDATER, false); // Do not throw execption
2126
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   680
                        Log.Verbose("SaveUpdaterConfigToRegistry: Key deleted");
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   681
                    }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   682
                }
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   683
                // If key doesn't exist and update is enabled, create key
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   684
                else if ((keyExists == false) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   685
                         this._IsAutoUpdateEnabled)
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   686
                {
2126
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   687
                    Log.Verbose("SaveUpdaterConfigToRegistry: Key doesn't exist or is different and IsAutoUpdateEnabled is true. Trying to set value.");
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   688
                    using (RegistryKey key = Registry.CurrentUser.CreateSubKey(updaterKey))
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   689
                    {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   690
                        key?.SetValue(Globals.PEP_NAME_INSTALL, updateStr, RegistryValueKind.String);
2126
87415c86d813 OUT-433: Add intensive logging to SaveUpdateConfigToRegistry
Thomas
parents: 2069
diff changeset
   691
                        Log.Verbose("SaveUpdaterConfigToRegistry: Value set");
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   692
                    }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   693
                }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   694
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   695
            catch (Exception ex)
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   696
            {
1249
00cc05656f71 Completely switch to the Log class.
Dean
parents: 1244
diff changeset
   697
                Log.Error("SaveUpdaterConfigToRegistry: Failure occured, " + ex.ToString());
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   698
            }
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   699
        }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   700
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   701
        /// <summary>
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   702
        /// Compares the given PEPSettings and checks for equality.
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   703
        /// </summary>
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   704
        /// <param name="obj">The object to check equality with.</param>
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   705
        /// <returns>True if both objects are considered equal, otherwise false.</returns>
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   706
        public bool Equals(PEPSettings obj)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   707
        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   708
            if (obj == null)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   709
            {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   710
                return (false);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   711
            }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   712
1992
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   713
            // First, check general pEp settings
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   714
            if (Comparisons.Equals(this.AccountWhitelist, obj.AccountWhitelist) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   715
                Comparisons.Equals(this.CrashReportSendAddress, obj.CrashReportSendAddress) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   716
                Comparisons.Equals(this.ExtraKeys, obj.ExtraKeys) &&
2432
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   717
                Comparisons.Equals(this.HideInternalMessages, obj.HideInternalMessages) &&
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   718
                Comparisons.Equals(this.IsAutoUpdateEnabled, obj.IsAutoUpdateEnabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   719
                Comparisons.Equals(this.IsCrashReportVisible, obj.IsCrashReportVisible) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   720
                Comparisons.Equals(this.IsDeveloperModeEnabled, obj.IsDeveloperModeEnabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   721
                Comparisons.Equals(this.IsDisableProtectionForContactsEnabled, obj.IsDisableProtectionForContactsEnabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   722
                Comparisons.Equals(this.IsEncryptAllAccountsEnabled, obj.IsEncryptAllAccountsEnabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   723
                Comparisons.Equals(this.IsFirstStartupComplete, obj.IsFirstStartupComplete) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   724
                Comparisons.Equals(this.IsKeyServerUsed, obj.IsKeyServerUsed) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   725
                Comparisons.Equals(this.IsNeverUnsecureOptionVisible, obj.IsNeverUnsecureOptionVisible) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   726
                Comparisons.Equals(this.IsPassiveModeEnabled, obj.IsPassiveModeEnabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   727
                Comparisons.Equals(this.IsPEPFolderVisible, obj.IsPEPFolderVisible) &&
2410
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   728
                Comparisons.Equals(this.IsPrivacyStatusBarEnabled, obj.IsPrivacyStatusBarEnabled) &&
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   729
                Comparisons.Equals(this.IsReaderSplashEnabled, obj.IsReaderSplashEnabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   730
                Comparisons.Equals(this.IsSecurityLossWarningEnabled, obj.IsSecurityLossWarningEnabled) &&
1979
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   731
                Comparisons.Equals(this.IsSensitiveDataLoggingEnabled, obj.IsSensitiveDataLoggingEnabled) &&
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   732
                Comparisons.Equals(this.IsSyncEnabledForAllAccounts, obj.IsSyncEnabledForAllAccounts) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   733
                Comparisons.Equals(this.IsTNEFDisabled, obj.IsTNEFDisabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   734
                Comparisons.Equals(this.IsUnencryptedSubjectEnabled, obj.IsUnencryptedSubjectEnabled) &&
2509
24395aeaba47 OUT-507: Add IsUXImprovementEnabled setting and only hide messages if this setting is set to true
Thomas
parents: 2507
diff changeset
   735
                Comparisons.Equals(this.IsUXImprovementEnabled, obj.IsUXImprovementEnabled) &&
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   736
                Comparisons.Equals(this.IsVerboseLoggingEnabled, obj.IsVerboseLoggingEnabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   737
                Comparisons.Equals(this.TrustwordsCulture, obj.TrustwordsCulture))
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   738
            {
1992
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   739
                // Check if the number of accounts matches
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   740
                if (this.AccountSettingsList?.Count != obj.AccountSettingsList?.Count)
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   741
                {
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   742
                    return false;
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   743
                }
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   744
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   745
                // Check if the account settings are equal for each account
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   746
                for (int i = 0; i < this.AccountSettingsList?.Count; i++)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   747
                {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   748
                    var acctSettings1 = this.AccountSettingsList[i];
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   749
                    var acctSettings2 = obj.AccountSettingsList[i];
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   750
1991
278a7a9d31b9 Add account properties to settings comparison
Thomas
parents: 1988
diff changeset
   751
                    if ((Comparisons.Equals(acctSettings1.AddDisclaimer, acctSettings2.AddDisclaimer) &&
278a7a9d31b9 Add account properties to settings comparison
Thomas
parents: 1988
diff changeset
   752
                         Comparisons.Equals(acctSettings1.DisclaimerText, acctSettings2.DisclaimerText) &&
278a7a9d31b9 Add account properties to settings comparison
Thomas
parents: 1988
diff changeset
   753
                         Comparisons.Equals(acctSettings1.IsDecryptAlwaysEnabled, acctSettings2.IsDecryptAlwaysEnabled) &&
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   754
                         Comparisons.Equals(acctSettings1.IsPEPEnabled, acctSettings2.IsPEPEnabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   755
                         Comparisons.Equals(acctSettings1.IsSecureStorageEnabled, acctSettings2.IsSecureStorageEnabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   756
                         Comparisons.Equals(acctSettings1.IsSyncEnabled, acctSettings2.IsSyncEnabled) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   757
                         Comparisons.Equals(acctSettings1.SentFolderEntryId, acctSettings2.SentFolderEntryId) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   758
                         Comparisons.Equals(acctSettings1.SmtpAddress, acctSettings2.SmtpAddress) &&
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   759
                         Comparisons.Equals(acctSettings1.Type, acctSettings2.Type)) == false)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   760
                    {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   761
                        return false;
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   762
                    }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   763
                }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   764
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   765
                return true;
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   766
            }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   767
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   768
            return false;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   769
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   770
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   771
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   772
        /// Writes/saves any supported configuration/property values to the registry.
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   773
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   774
        public void SaveToRegistry()
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   775
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   776
            /* Note: 
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   777
             * Do not save the below properties which can only be modified from the registry
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   778
             *   • AccountWhitelist
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   779
             *   • CrashReportSendAddress
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   780
             *   • ExtraKeys
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   781
             *   • IsCrashReportVisible
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   782
             *   • IsDeveloperModeEnabled
1979
cf610012e16d Add sensitive data logging
Thomas
parents: 1957
diff changeset
   783
             *   • IsSensitiveDataLoggingEnabled
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   784
             *   • IsDisableProtectionForContactsEnabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   785
             *   • IsTNEFDisabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   786
             */
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   787
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   788
            string pEpForOutlookRegKey = Path.Combine(PEPSettings.REG_KEY_SOFTWARE, PEPSettings.REG_KEY_PEP, PEPSettings.REG_KEY_PEP_FOR_OUTLOOK);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   789
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   790
            try
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   791
            {
1992
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   792
                // Update the accounts list
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   793
                Globals.ThisAddIn.SyncAccountsList();
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   794
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   795
                // Get current state and only save if changes have been made
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   796
                PEPSettings currentStateInRegistry = new PEPSettings();
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   797
                currentStateInRegistry.LoadFromRegistry();
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   798
1992
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   799
                if (this?.Equals(currentStateInRegistry) != true)
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   800
                {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   801
                    using (RegistryKey pEpKey = Registry.CurrentUser.CreateSubKey(pEpForOutlookRegKey))
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   802
                    {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   803
                        // Set account settings
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   804
                        using (RegistryKey keyAcctSettingsList = pEpKey.CreateSubKey(PEPSettings.REG_KEY_ACCOUNT_SETTINGS_LIST))
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   805
                        {
1992
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   806
                            // Delete accounts that do not exist in Outlook (anymore)
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   807
                            if (currentStateInRegistry?.AccountSettingsList?.Count != this.AccountSettingsList?.Count)
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   808
                            {
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   809
                                foreach (PEPAccountSettings accountInRegistry in currentStateInRegistry.AccountSettingsList)
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   810
                                {
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   811
                                    if (this.GetAccountSettings(accountInRegistry?.SmtpAddress) == null)
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   812
                                    {
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   813
                                        try
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   814
                                        {
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   815
                                            keyAcctSettingsList.DeleteSubKeyTree(accountInRegistry.SmtpAddress);
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   816
                                        }
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   817
                                        catch (Exception ex)
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   818
                                        {
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   819
                                            Log.Error("SaveToRegistry: Error deleting account key. " + ex.ToString());
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   820
                                        }
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   821
                                    }
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   822
                                }
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   823
                            }
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   824
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   825
                            // Update all existing accounts if necessary
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   826
                            foreach (PEPAccountSettings acctSettings in this._AccountSettingsList)
1440
4ca5601f0dbc Changes in SaveToRegistry() and LoadFromRegistry() to remove unneeded entries.
Dean
parents: 1410
diff changeset
   827
                            {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   828
                                try
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   829
                                {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   830
                                    if (string.IsNullOrWhiteSpace(acctSettings.SmtpAddress) == false)
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   831
                                    {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   832
                                        using (RegistryKey keyAcctSettings = keyAcctSettingsList.CreateSubKey(acctSettings.SmtpAddress))
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   833
                                        {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   834
                                            keyAcctSettings.SetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_IS_DECRYPT_ALWAYS_ENABLED, acctSettings.IsDecryptAlwaysEnabled.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   835
                                            keyAcctSettings.SetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_IS_PEP_ENABLED, acctSettings.IsPEPEnabled.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   836
                                            keyAcctSettings.SetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_IS_SECURE_STORAGE_ENABLED, acctSettings.IsSecureStorageEnabled.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   837
                                            keyAcctSettings.SetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_IS_SYNC_ENABLED, acctSettings.IsSyncEnabled.ToString(), RegistryValueKind.String);
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   838
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   839
                                            if (acctSettings.SentFolderEntryId != null)
1992
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   840
                                            {
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   841
                                                keyAcctSettings.SetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_SENT_FOLDER_ENTRYID, acctSettings.SentFolderEntryId, RegistryValueKind.String);
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   842
                                            }
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   843
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   844
                                            if (acctSettings.SmtpAddress != null)
1992
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   845
                                            {
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   846
                                                keyAcctSettings.SetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_SMTP_ADDRESS, acctSettings.SmtpAddress, RegistryValueKind.String);
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   847
                                            }
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   848
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   849
                                            if (acctSettings.Type != null)
1992
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   850
                                            {
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   851
                                                keyAcctSettings.SetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_TYPE, acctSettings.Type, RegistryValueKind.String);
7d4917d04ccb Modify Registry deletion of unused accounts
Thomas
parents: 1991
diff changeset
   852
                                            }
2003
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
   853
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
   854
                                            if (acctSettings.UserName != null)
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
   855
                                            {
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
   856
                                                keyAcctSettings.SetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_USER_NAME, acctSettings.UserName, RegistryValueKind.String);
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
   857
                                            }
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   858
                                        }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   859
                                    }
1501
6348dde3709b Complete the merge manually.
Dean
parents: 1500
diff changeset
   860
                                }
6348dde3709b Complete the merge manually.
Dean
parents: 1500
diff changeset
   861
                                catch { }
6348dde3709b Complete the merge manually.
Dean
parents: 1500
diff changeset
   862
                            }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   863
                        }
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   864
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   865
                        // Delete any existing EncryptedAccountsList in the registry (a legacy value)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   866
                        try
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   867
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   868
                            pEpKey.DeleteSubKeyTree(PEPSettings.REG_KEY_ENCRYPTED_ACCOUNTS_LIST, false); // Do not throw exception
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   869
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   870
                        catch { }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   871
2432
22efd23b72f6 OUT-520: Add option to hide/show pEp internal messages
Thomas
parents: 2410
diff changeset
   872
                        pEpKey.SetValue(PEPSettings.REG_NAME_HIDE_INTERNAL_MESSAGES, this._HideInternalMessages.ToString(), RegistryValueKind.String);
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   873
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_AUTO_UPDATE_ENABLED, this._IsAutoUpdateEnabled.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   874
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_ENCRYPT_ALL_ACCOUNTS_ENABLED, this._IsEncryptAllAccountsEnabled.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   875
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_KEY_SERVER_USED, this._IsKeyServerUsed.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   876
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_NEVER_UNSECURE_OPTION_VISIBLE, this._IsNeverUnsecureOptionVisible.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   877
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_PEP_FOLDER_VISIBLE, this._IsPEPFolderVisible.ToString(), RegistryValueKind.String);
2410
80c01cc1dec1 Add option to enable/disable the additional Privacy Status bar
Thomas
parents: 2198
diff changeset
   878
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_PRIVACY_STATUS_BAR_ENABLED, this._IsPrivacyStatusBarEnabled.ToString(), RegistryValueKind.String);
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   879
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_READER_SPLASH_ENABLED, this._IsReaderSplashEnabled.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   880
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_SECURITY_LOSS_WARNING_ENABLED, this._IsSecurityLossWarningEnabled.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   881
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_SYNC_ENABLED_FOR_ALL_ACCOUNTS, this._IsSyncEnabledForAllAccounts.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   882
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_UNENCRYPTED_SUBJECT_ENABLED, this._IsUnencryptedSubjectEnabled.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   883
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_VERBOSE_LOGGING_ENABLED, this._IsVerboseLoggingEnabled.ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   884
                        pEpKey.SetValue(PEPSettings.REG_NAME_TRUSTWORDS_CULTURE, (this._TrustwordsCulture?.TwoLetterISOLanguageName ?? string.Empty), RegistryValueKind.String);
2148
a429d3cf7f7d OUT-436: Added saving IsPassiveModeEnabled to Registry and code comments.
nikolaj
parents: 2126
diff changeset
   885
                        pEpKey.SetValue(PEPSettings.REG_NAME_IS_PASSIVE_MODE_ENABLED, this._IsPassiveModeEnabled.ToString(), RegistryValueKind.String);
2150
5aae9c8dbebe Some reordering. Add German translation.
Thomas
parents: 2148
diff changeset
   886
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   887
                        // Set IsFirstStartupComplete
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   888
                        if (this._IsFirstStartupComplete)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   889
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   890
                            pEpKey.SetValue(PEPSettings.REG_NAME_IS_FIRST_STARTUP_COMPLETE, (true).ToString(), RegistryValueKind.String);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   891
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   892
                        else
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   893
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   894
                            // Remove the value entirely if startup is not completed
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   895
                            try
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   896
                            {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   897
                                pEpKey.DeleteValue(PEPSettings.REG_NAME_IS_FIRST_STARTUP_COMPLETE, false); // Do not throw exception
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   898
                            }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   899
                            catch { }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   900
                        }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   901
                    }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   902
                }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   903
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   904
                // Make sure to update the Updater registry values which can also be done separately
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   905
                this.SaveUpdaterConfigToRegistry();
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   906
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   907
            catch (Exception ex)
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   908
            {
1249
00cc05656f71 Completely switch to the Log class.
Dean
parents: 1244
diff changeset
   909
                Log.Error("SaveToRegistry: Failure occured, " + ex.ToString());
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   910
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   911
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   912
            return;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   913
        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   914
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   915
        /// <summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   916
        /// Reads/loads any configuration/property values from the registry.
1495
d6aa133706b7 Fully implement INotifyPropertyChanged in PEPSettings.
Dean
parents: 1488
diff changeset
   917
        /// Warning: This will raise all property changed events even if the values don't change.
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   918
        /// </summary>
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   919
        public void LoadFromRegistry()
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   920
        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   921
            bool isSuccessful;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   922
            bool isPropertySet;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   923
            int parsedIntValue;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   924
            bool parsedBoolValue;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   925
            string keyValue;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   926
            object value;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   927
            string[] registryWhitelist;
1292
dec0530df26e Trim ExtraKeys during import from registry.
Dean
parents: 1249
diff changeset
   928
            List<string> extraKeys;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   929
            List<string> whitelist;
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
   930
            PEPAccountSettings acctSettings;
1206
a433e5c708f7 Add backwards compatiblity with an existing EncryptedAccountsList.
Dean
parents: 1172
diff changeset
   931
            PEPAccountSettings existingAcctSettings;
1522
cc9a14ce8514 OUT-170: Exlude identity. Also initial implementation of new NotifyHandshake with synchronization signal.
Thomas
parents: 1502
diff changeset
   932
            Dictionary<string, bool> legacyEncryptedAccountsList = new Dictionary<string, bool>();
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   933
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   934
            ///////////////////////////////////////////////////////////
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   935
            // Read non-pEp values
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   936
            ///////////////////////////////////////////////////////////
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   937
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   938
            // Attempt to get IsTNEFDisabled
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   939
            isPropertySet = false;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   940
            try
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   941
            {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   942
                using (RegistryKey key1 = Registry.CurrentUser.OpenSubKey(PEPSettings.REG_KEY_SOFTWARE))
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   943
                {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   944
                    using (RegistryKey keyOffice = key1?.OpenSubKey(PEPSettings.REG_KEY_MICROSOFT_OFFICE))
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   945
                    {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   946
                        /* Outlook versions
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   947
                         *  "12" Outlook 2007
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   948
                         *  "14" Outlook 2010
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   949
                         *  "15" Outlook 2013
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   950
                         *  "16" Outlook 2016
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   951
                         */
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   952
                        using (RegistryKey keyPreferences = keyOffice?.OpenSubKey(Globals.ThisAddIn.Application.Version.Substring(0, 2) + ".0\\Outlook\\Preferences\\"))
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   953
                        {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   954
                            // Attempt to get IsTNEFDisabled
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   955
                            keyValue = keyPreferences?.GetValue(PEPSettings.REG_NAME_IS_TNEF_DISABLED, PEPSettings.IS_TNEF_DISABLED_DEFAULT).ToString();
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   956
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   957
                            // Try parsing as int
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   958
                            isSuccessful = int.TryParse(keyValue, out parsedIntValue);
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   959
                            if (isSuccessful)
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   960
                            {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   961
                                this._IsTNEFDisabled = (parsedIntValue > 0);
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   962
                                isPropertySet = true;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   963
                            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   964
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   965
                            // Try parsing as bool (this will handle the default value)
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   966
                            if (isSuccessful == false)
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   967
                            {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   968
                                isSuccessful = bool.TryParse(keyValue, out parsedBoolValue);
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   969
                                if (isSuccessful)
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   970
                                {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   971
                                    this._IsTNEFDisabled = parsedBoolValue;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   972
                                    isPropertySet = true;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   973
                                }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   974
                            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   975
                        }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   976
                    }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   977
                }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   978
            }
1172
3e11b5847863 Stop logging exception details when a failure occurs reading TNEF disabled status.
Dean
parents: 1170
diff changeset
   979
            catch
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   980
            {
1249
00cc05656f71 Completely switch to the Log class.
Dean
parents: 1244
diff changeset
   981
                Log.Warning("LoadFromRegistry: Failure occured reading TNEF disabled status");
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   982
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   983
            finally
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   984
            {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   985
                if (isPropertySet == false)
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   986
                {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   987
                    this._IsTNEFDisabled = PEPSettings.IS_TNEF_DISABLED_DEFAULT;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   988
                }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   989
1242
6bbdee36cac8 Use nameof() to clean-up raising property changed events.
Dean
parents: 1241
diff changeset
   990
                this.RaisePropertyChangedEvent(nameof(this.IsTNEFDisabled));
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   991
            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   992
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   993
            ///////////////////////////////////////////////////////////
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   994
            // Read pEp values
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   995
            ///////////////////////////////////////////////////////////
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   996
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
   997
            string pEpForOutlookKey = Path.Combine(PEPSettings.REG_KEY_SOFTWARE, PEPSettings.REG_KEY_PEP, REG_KEY_PEP_FOR_OUTLOOK);
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   998
            try
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
   999
            {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1000
                using (RegistryKey pEpKey = Registry.CurrentUser.OpenSubKey(pEpForOutlookKey))
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1001
                {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1002
                    if (pEpKey != null)
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1003
                    {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1004
                        // Attempt to get AccountSettingsList
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1005
                        isPropertySet = false;
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1006
                        try
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1007
                        {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1008
                            this._AccountSettingsList.Clear();
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1009
                            using (RegistryKey keyAcctSettingsList = pEpKey.OpenSubKey(PEPSettings.REG_KEY_ACCOUNT_SETTINGS_LIST))
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1010
                            {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1011
                                if (keyAcctSettingsList != null)
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1012
                                {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1013
                                    foreach (string smtpAddress in keyAcctSettingsList.GetSubKeyNames())
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1014
                                    {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1015
                                        try
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1016
                                        {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1017
                                            using (RegistryKey keyAcctSettings = keyAcctSettingsList.OpenSubKey(smtpAddress))
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1018
                                            {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1019
                                                acctSettings = new PEPAccountSettings(smtpAddress);
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1020
                                                this._AccountSettingsList.Add(acctSettings);
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1021
1988
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1022
                                                // AddDisclaimer
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1023
                                                value = keyAcctSettings.GetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_ADD_DISCLAIMER, null);
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1024
                                                if (value != null)
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1025
                                                {
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1026
                                                    if (int.TryParse(value as string, out parsedIntValue))
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1027
                                                    {
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1028
                                                        try
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1029
                                                        {
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1030
                                                            acctSettings.AddDisclaimer = (Disclaimer)parsedIntValue;
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1031
                                                            isPropertySet = true;
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1032
                                                        }
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1033
                                                        catch (Exception ex)
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1034
                                                        {
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1035
                                                            acctSettings.AddDisclaimer = PEPSettings.ADD_DISCLAIMER_DEFAULT;
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1036
                                                            Log.Error("LoadFromRegistry: Error getting AddDisclaimer value. " + ex.ToString());
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1037
                                                        }
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1038
                                                    }
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1039
                                                }
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1040
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1041
                                                // DisclaimerText
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1042
                                                value = keyAcctSettings.GetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_DISCLAIMER_TEXT, null);
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1043
                                                if (string.IsNullOrEmpty(value as string) == false)
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1044
                                                {
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1045
                                                    acctSettings.DisclaimerText = (value as string)?.Trim();
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1046
                                                    isPropertySet = true;
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1047
                                                }
44840dd6a15d OUT-364: Add disclaimer functionality
Thomas
parents: 1979
diff changeset
  1048
1784
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1049
                                                // IsDecryptAlwaysEnabled
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1050
                                                value = keyAcctSettings.GetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_IS_DECRYPT_ALWAYS_ENABLED, null);
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1051
                                                if (value != null)
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1052
                                                {
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1053
                                                    isSuccessful = bool.TryParse(value.ToString(), out parsedBoolValue);
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1054
                                                    if (isSuccessful)
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1055
                                                    {
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1056
                                                        acctSettings.IsDecryptAlwaysEnabled = parsedBoolValue;
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1057
                                                        isPropertySet = true;
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1058
                                                    }
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1059
                                                }
ed85d00f8f29 Add option to configure if user wants to decrypt items if pEp disabled
Thomas
parents: 1577
diff changeset
  1060
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1061
                                                // IsPEPEnabled
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1062
                                                value = keyAcctSettings.GetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_IS_PEP_ENABLED, null);
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1063
                                                if (value != null)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1064
                                                {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1065
                                                    isSuccessful = bool.TryParse(value.ToString(), out parsedBoolValue);
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1066
                                                    if (isSuccessful)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1067
                                                    {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1068
                                                        acctSettings.IsPEPEnabled = parsedBoolValue;
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1069
                                                        isPropertySet = true;
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1070
                                                    }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1071
                                                }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1072
1138
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1073
                                                // IsSecureStorageEnabled
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1074
                                                value = keyAcctSettings.GetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_IS_SECURE_STORAGE_ENABLED, null);
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1075
                                                if (value != null)
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1076
                                                {
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1077
                                                    isSuccessful = bool.TryParse(value.ToString(), out parsedBoolValue);
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1078
                                                    if (isSuccessful)
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1079
                                                    {
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1080
                                                        acctSettings.IsSecureStorageEnabled = parsedBoolValue;
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1081
                                                        isPropertySet = true;
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1082
                                                    }
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1083
                                                }
979b777a088b OUT-39: Implement the ability to disable pEp for certain accounts.
Dean
parents: 1137
diff changeset
  1084
1488
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1085
                                                // IsSyncEnabled
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1086
                                                value = keyAcctSettings.GetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_IS_SYNC_ENABLED, null);
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1087
                                                if (value != null)
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1088
                                                {
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1089
                                                    isSuccessful = bool.TryParse(value.ToString(), out parsedBoolValue);
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1090
                                                    if (isSuccessful)
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1091
                                                    {
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1092
                                                        acctSettings.IsSyncEnabled = parsedBoolValue;
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1093
                                                        isPropertySet = true;
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1094
                                                    }
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1095
                                                }
cc7028d7409a OUT-170: Add IsSyncEnabled in options and settings.
Dean
parents: 1460
diff changeset
  1096
1348
c394606d6f6c Change to .net standard capitalization rules in several places.
Dean
parents: 1314
diff changeset
  1097
                                                // SentFolderEntryId
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1098
                                                value = keyAcctSettings.GetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_SENT_FOLDER_ENTRYID, null);
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1099
                                                if (value != null)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1100
                                                {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1101
                                                    if (string.IsNullOrWhiteSpace((string)value) == false)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1102
                                                    {
1348
c394606d6f6c Change to .net standard capitalization rules in several places.
Dean
parents: 1314
diff changeset
  1103
                                                        acctSettings.SentFolderEntryId = ((string)value).Trim();
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1104
                                                        isPropertySet = true;
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1105
                                                    }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1106
                                                }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1107
1348
c394606d6f6c Change to .net standard capitalization rules in several places.
Dean
parents: 1314
diff changeset
  1108
                                                // SmtpAddress
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1109
                                                value = keyAcctSettings.GetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_SMTP_ADDRESS, null);
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1110
                                                if (value != null)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1111
                                                {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1112
                                                    if (string.IsNullOrWhiteSpace((string)value) == false)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1113
                                                    {
1348
c394606d6f6c Change to .net standard capitalization rules in several places.
Dean
parents: 1314
diff changeset
  1114
                                                        acctSettings.SmtpAddress = ((string)value).Trim();
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1115
                                                        isPropertySet = true;
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1116
                                                    }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1117
                                                }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1118
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1119
                                                // Type
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1120
                                                value = keyAcctSettings.GetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_TYPE, null);
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1121
                                                if (value != null)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1122
                                                {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1123
                                                    if (string.IsNullOrWhiteSpace((string)value) == false)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1124
                                                    {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1125
                                                        acctSettings.Type = ((string)value).Trim();
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1126
                                                        isPropertySet = true;
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1127
                                                    }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1128
                                                }
2003
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1129
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1130
                                                // UserName
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1131
                                                value = keyAcctSettings.GetValue(PEPSettings.REG_NAME_ACCOUNT_SETTING_USER_NAME, null);
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1132
                                                if (value != null)
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1133
                                                {
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1134
                                                    if (string.IsNullOrWhiteSpace((string)value) == false)
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1135
                                                    {
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1136
                                                        acctSettings.UserName = ((string)value).Trim();
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1137
                                                        isPropertySet = true;
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1138
                                                    }
c0dfc0f23c17 Use PEPSettings to check for own identities and always use a userId
Thomas
parents: 1992
diff changeset
  1139
                                                }
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1140
                                            }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1141
                                        }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1142
                                        catch { }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1143
                                    }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1144
                                }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1145
                            }
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1146
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1147
                        catch
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1148
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1149
                            Log.Warning("LoadFromRegistry: Unable to fully read AccountSettingsList");
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1150
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1151
                        finally
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1152
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1153
                            if (isPropertySet == false)
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1154
                            {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1155
                                this._AccountSettingsList.Clear();
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1156
                            }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1157
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1158
                            this.RaisePropertyChangedEvent(nameof(this.AccountSettingsList));
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1159
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1160
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1161
                        // For backwards compatibility, also read in the older encrypted accounts list (if it exists)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1162
                        try
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1163
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1164
                            legacyEncryptedAccountsList.Clear();
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1165
                            using (RegistryKey key3 = pEpKey.OpenSubKey(PEPSettings.REG_KEY_ENCRYPTED_ACCOUNTS_LIST))
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1166
                            {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1167
                                if (key3 != null)
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1168
                                {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1169
                                    foreach (string name in key3.GetValueNames())
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1170
                                    {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1171
                                        value = key3.GetValue(name, PEPSettings.ENCRYPT_ACCOUNTS_BY_DEFAULT);
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1172
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1173
                                        if (value != null)
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1174
                                        {
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1175
                                            isSuccessful = bool.TryParse(value.ToString(), out parsedBoolValue);
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1176
                                            if ((isSuccessful) &&
1522
cc9a14ce8514 OUT-170: Exlude identity. Also initial implementation of new NotifyHandshake with synchronization signal.
Thomas
parents: 1502
diff changeset
  1177
                                                (legacyEncryptedAccountsList.ContainsKey(name) == false))
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1178
                                            {
1522
cc9a14ce8514 OUT-170: Exlude identity. Also initial implementation of new NotifyHandshake with synchronization signal.
Thomas
parents: 1502
diff changeset
  1179
                                                legacyEncryptedAccountsList.Add(name, parsedBoolValue);
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1180
                                            }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1181
                                        }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1182
                                    }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1183
                                }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1184
                            }
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1185
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1186
                        catch { }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1187
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1188
                        /* Merge the new format of the accounts list with the old format.
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1189
                         * Whatever entries already in AccountSettingsList are considered valid.
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1190
                         * (the existing list takes priority over the legacy encrypted accounts list entries).
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1191
                         * This means only entries in the legacy encrypted accounts list whose address does not match
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1192
                         * with an existing entry in the AccountSettingsList will be added. Logic elsewhere must remove
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1193
                         * invalid entries (old accounts).
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1194
                         */
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1195
                        foreach (KeyValuePair<string, bool> entry in legacyEncryptedAccountsList)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1196
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1197
                            // Any match means it already exists, no need to handle multiple here
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1198
                            existingAcctSettings = this.GetAccountSettings(entry.Key);
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1199
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1200
                            if (existingAcctSettings == null)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1201
                            {
2507
69af585f9277 Cosmetic changes
Thomas
parents: 2499
diff changeset
  1202
                                acctSettings = new PEPAccountSettings
69af585f9277 Cosmetic changes
Thomas
parents: 2499
diff changeset
  1203
                                {
69af585f9277 Cosmetic changes
Thomas
parents: 2499
diff changeset
  1204
                                    SmtpAddress = entry.Key,
69af585f9277 Cosmetic changes
Thomas
parents: 2499
diff changeset
  1205
                                    IsSecureStorageEnabled = entry.Value
69af585f9277 Cosmetic changes
Thomas
parents: 2499
diff changeset
  1206
                                };
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1207
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1208
                                this._AccountSettingsList.Add(acctSettings);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1209
                            }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1210
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1211
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1212
                        // Attempt to get AccountWhitelist
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1213
                        isPropertySet = false;
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1214
                        try
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1215
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1216
                            value = pEpKey.GetValue(PEPSettings.REG_NAME_ACCOUNT_WHITELIST, null);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1217
                            if (value != null)
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1218
                            {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1219
                                whitelist = new List<string>();
1206
a433e5c708f7 Add backwards compatiblity with an existing EncryptedAccountsList.
Dean
parents: 1172
diff changeset
  1220
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1221
                                // Copy over hardcoded values
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1222
                                for (int i = 0; i < PEPSettings.ACCOUNT_WHITELIST_DEFAULT.Length; i++)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1223
                                {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1224
                                    whitelist.Add(PEPSettings.ACCOUNT_WHITELIST_DEFAULT[i].Trim());
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1225
                                }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1226
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1227
                                // Copy over registry values
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1228
                                registryWhitelist = value.ToString().Split(';');
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1229
                                for (int i = 0; i < registryWhitelist.Length; i++)
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1230
                                {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1231
                                    whitelist.Add(registryWhitelist[i].Trim());
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1232
                                }
1206
a433e5c708f7 Add backwards compatiblity with an existing EncryptedAccountsList.
Dean
parents: 1172
diff changeset
  1233
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1234
                                this._AccountWhitelist = whitelist.ToArray();
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1235
                                isPropertySet = true;
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1236
                            }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1237
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1238
                        catch
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1239
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1240
                            Log.Warning("LoadFromRegistry: Unable to read AccountWhitelist");
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1241
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1242
                        finally
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1243
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1244
                            if (isPropertySet == false)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1245
                            {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1246
                                whitelist = new List<string>();
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1247
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1248
                                // Copy over hardcoded values
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1249
                                for (int i = 0; i < PEPSettings.ACCOUNT_WHITELIST_DEFAULT.Length; i++)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1250
                                {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1251
                                    whitelist.Add(PEPSettings.ACCOUNT_WHITELIST_DEFAULT[i].Trim());
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1252
                                }
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1253
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1254
                                this._AccountWhitelist = whitelist.ToArray();
1107
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1255
                            }
26d3dc22c30f Add initial support for account settings within PEPSettings.
Dean
parents: 1090
diff changeset
  1256
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1257
                            this.RaisePropertyChangedEvent(nameof(this.AccountWhitelist));
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1258
                        }
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1259
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1260
                        // Attempt to get CrashReportSendAddress
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1261
                        isPropertySet = false;
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1262
                        try
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1263
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1264
                            keyValue = pEpKey.GetValue(PEPSettings.REG_NAME_CRASH_REPORT_SEND_ADDRESS, PEPSettings.CRASH_REPORT_SEND_ADDRESS_DEFAULT) as string;
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1265
                            if (keyValue != null)
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1266
                            {
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1267
                                this._CrashReportSendAddress = keyValue;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1268
                                isPropertySet = true;
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1269
                            }
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1270
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1271
                        catch
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1272
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1273
                            Log.Warning("LoadFromRegistry: Unable to read CrashReportSendAddress");
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1274
                        }
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1275
                        finally
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1276
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1277
                            if (isPropertySet == false)
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1278
                            {
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1279
                                this._CrashReportSendAddress = PEPSettings.CRASH_REPORT_SEND_ADDRESS_DEFAULT;
1090
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1280
                            }
6234a0b9c6a8 Add PEPSettings class and move all add-in configuration into it.
Dean
parents:
diff changeset
  1281
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1282
                            this.RaisePropertyChangedEvent(nameof(this.CrashReportSendAddress));
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1283
                        }
1292
dec0530df26e Trim ExtraKeys during import from registry.
Dean
parents: 1249
diff changeset
  1284
1957
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1285
                        // Attempt to get ExtraKeys value
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1286
                        isPropertySet = false;
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1287
                        try
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1288
                        {
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1289
                            value = pEpKey.GetValue(PEPSettings.REG_NAME_EXTRA_KEYS, null);
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used for W
Thomas
parents: 1947
diff changeset
  1290
                            if (value != null)
6c1ab17d24a9 OUT-188: Only open registry keys for RW when used