OUT-386: Add icon to signal grouped accounts sync
authorThomas
Wed, 31 Jul 2019 15:13:24 +0200
branchsync
changeset 26897cd444e4eaa0
parent 2688 580069604044
child 2690 bbb6238d7b32
OUT-386: Add icon to signal grouped accounts
PEPSettings.cs
ThisAddIn.cs
UI/FormControlOptions.xaml
UI/FormControlOptions.xaml.cs
     1.1 --- a/PEPSettings.cs	Tue Jul 30 15:11:56 2019 +0200
     1.2 +++ b/PEPSettings.cs	Wed Jul 31 15:13:24 2019 +0200
     1.3 @@ -2297,6 +2297,30 @@
     1.4  
     1.5                  return (areEqual);
     1.6              }
     1.7 +
     1.8 +            /// <summary>
     1.9 +            /// Determines whether an account's identity is grouped or not.
    1.10 +            /// </summary>
    1.11 +            /// <returns>True if grouped, otherwise false.</returns>
    1.12 +            public bool GetIsGrouped()
    1.13 +            {
    1.14 +                // Check if identity is grouped
    1.15 +                bool grouped = false;
    1.16 +                try
    1.17 +                {
    1.18 +                    pEpIdentity identity = new PEPIdentity(this.SmtpAddress).ToCOMType();
    1.19 +                    identity.UserId = PEPSettings.PEP_OWN_USER_ID;
    1.20 +                    pEpIdentity updatedIdentity = ThisAddIn.PEPEngine.Myself(identity);
    1.21 +                    grouped = updatedIdentity.Flags.HasFlag(pEpIdentityFlags.pEpIdfDevicegroup);
    1.22 +                }
    1.23 +                catch (Exception ex)
    1.24 +                {
    1.25 +                    grouped = false;
    1.26 +                    Log.Error("GetOptionsState: Error getting grouped state. " + ex.ToString());
    1.27 +                }
    1.28 +
    1.29 +                return grouped;
    1.30 +            }
    1.31          }
    1.32      }
    1.33  }
    1.34 \ No newline at end of file
     2.1 --- a/ThisAddIn.cs	Tue Jul 30 15:11:56 2019 +0200
     2.2 +++ b/ThisAddIn.cs	Wed Jul 31 15:13:24 2019 +0200
     2.3 @@ -1421,7 +1421,7 @@
     2.4              {
     2.5                  newAcctSettings = this._Settings.AccountSettingsList[i].Copy();
     2.6  
     2.7 -                /* pEp internally uses account types as defined by microsoft.
     2.8 +                /* pEp internally uses account types as defined by Microsoft.
     2.9                   * This means they have 'ol' before the type (Example: 'olImap').
    2.10                   * This isn't always user friendly so for the options UI the 'ol' is removed.
    2.11                   */
     3.1 --- a/UI/FormControlOptions.xaml	Tue Jul 30 15:11:56 2019 +0200
     3.2 +++ b/UI/FormControlOptions.xaml	Wed Jul 31 15:13:24 2019 +0200
     3.3 @@ -244,19 +244,43 @@
     3.4                                          <Grid.ColumnDefinitions>
     3.5                                              <ColumnDefinition Width="6" />
     3.6                                              <ColumnDefinition Width="*" />
     3.7 +                                            <ColumnDefinition Width="Auto" />
     3.8                                          </Grid.ColumnDefinitions>
     3.9  
    3.10                                          <!-- Account identifier -->
    3.11 -                                        <TextBlock Grid.Column="0"
    3.12 -                                                   Grid.ColumnSpan="2"
    3.13 +                                        <Grid Grid.Column="0"
    3.14 +                                                Grid.ColumnSpan="3"
    3.15 +                                                Grid.Row="0">
    3.16 +                                            <Grid.ColumnDefinitions>
    3.17 +                                                <ColumnDefinition Width="Auto" />
    3.18 +                                                <ColumnDefinition Width="Auto" />
    3.19 +                                                <ColumnDefinition Width="*" />
    3.20 +                                            </Grid.ColumnDefinitions>
    3.21 +                                            <Grid.RowDefinitions>
    3.22 +                                                <RowDefinition Height="Auto" />
    3.23 +                                            </Grid.RowDefinitions>
    3.24 +                                            <TextBlock Grid.Column="0"
    3.25 +                                                       Grid.Row="0"
    3.26 +                                                       HorizontalAlignment="Left"
    3.27 +                                                       VerticalAlignment="Center"
    3.28 +                                                       Text="{Binding Path=SmtpAddress, Mode=OneWay}" />
    3.29 +                                            <Image Source="pack://application:,,,/pEp;component/Resources/ImageIconDeviceGroup.png"
    3.30 +                                                   Grid.Column="1"
    3.31                                                     Grid.Row="0"
    3.32 +                                                   RenderOptions.BitmapScalingMode="Fant"
    3.33 +                                                   Height="20"
    3.34 +                                                   Width="20"
    3.35 +                                                   Margin="10,0,0,0"
    3.36                                                     HorizontalAlignment="Left"
    3.37 -                                                   Text="{Binding Path=SmtpAddress, Mode=OneWay}" />
    3.38 -                                        <TextBlock Grid.Column="0"
    3.39 -                                                   Grid.ColumnSpan="2"
    3.40 -                                                   Grid.Row="0"
    3.41 -                                                   HorizontalAlignment="Right"
    3.42 -                                                   Text="{Binding Path=Type, Mode=OneWay}" />
    3.43 +                                                   VerticalAlignment="Center"                                                    
    3.44 +                                                   Stretch="Fill"
    3.45 +                                                   Visibility="{Binding IsGrouped, Converter={StaticResource BoolToVisibility}}" />
    3.46 +                                            <TextBlock Grid.Column="2"
    3.47 +                                                       Grid.Row="0"
    3.48 +                                                       HorizontalAlignment="Right"
    3.49 +                                                       VerticalAlignment="Center"
    3.50 +                                                       Text="{Binding Path=Type, Mode=OneWay}" />
    3.51 +                                        </Grid>
    3.52  
    3.53                                          <!-- Properties (done in stackpanels to minimize checkbox click target) -->
    3.54                                          <StackPanel Grid.Column="1"
    3.55 @@ -670,7 +694,7 @@
    3.56                                       VerticalContentAlignment="Center"
    3.57                                       Text="{Binding Path=BlacklistEnteredFingerprint, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
    3.58                                       Tag="{x:Static p:Resources.Options_BlacklistEnteredFingerprintText}" >
    3.59 -                            <TextBox.Template>
    3.60 +                                <TextBox.Template>
    3.61                                      <ControlTemplate TargetType="{x:Type TextBox}">
    3.62                                          <Grid>
    3.63                                              <TextBox x:Name="TextBoxSource"
     4.1 --- a/UI/FormControlOptions.xaml.cs	Tue Jul 30 15:11:56 2019 +0200
     4.2 +++ b/UI/FormControlOptions.xaml.cs	Wed Jul 31 15:13:24 2019 +0200
     4.3 @@ -1226,6 +1226,9 @@
     4.4                                  entry.IsSyncEnabledOptionVisible = true;
     4.5                                  entry.IsSyncEnabledOverridden = false;
     4.6                              }
     4.7 +
     4.8 +                            // Check if grouped
     4.9 +                            entry.IsGrouped = entry.GetIsGrouped();
    4.10                          }
    4.11  
    4.12                          /* Warning:
    4.13 @@ -1433,6 +1436,7 @@
    4.14                                      Interfaces.IReset
    4.15          {
    4.16              private bool _IsDecryptAlwaysEnabledOptionVisible;
    4.17 +            private bool _IsGrouped;
    4.18              private bool _IsPEPEnabledOptionChecked;
    4.19              private bool _IsPEPEnabledOptionEnabled;
    4.20              private bool _IsPEPEnabledOptionVisible;
    4.21 @@ -1497,6 +1501,19 @@
    4.22              }
    4.23  
    4.24              /// <summary>
    4.25 +            /// Gets or sets whether this account is grouped.
    4.26 +            /// </summary>
    4.27 +            public bool IsGrouped
    4.28 +            {
    4.29 +                get { return (this._IsGrouped); }
    4.30 +                set
    4.31 +                {
    4.32 +                    this._IsGrouped = value;
    4.33 +                    base.RaisePropertyChangedEvent(nameof(this.IsGrouped));
    4.34 +                }
    4.35 +            }            
    4.36 +
    4.37 +            /// <summary>
    4.38              /// Gets or sets whether the option control representing pEp enabled status should be checked.
    4.39              /// This signifies that pEp is enabled but allows the UI to be independent of 'IsPEPEnabled'.
    4.40              /// </summary>
    4.41 @@ -1669,6 +1686,7 @@
    4.42                  base.Reset();
    4.43  
    4.44                  this._IsDecryptAlwaysEnabledOptionVisible = false;
    4.45 +                this._IsGrouped = false;
    4.46                  this._IsPEPEnabledOptionChecked = base._IsPEPEnabled;
    4.47                  this._IsPEPEnabledOptionEnabled = true;
    4.48                  this._IsPEPEnabledOptionVisible = true;
    4.49 @@ -1681,8 +1699,10 @@
    4.50                  this._IsSyncEnabledOptionEnabled = true;
    4.51                  this._IsSyncEnabledOptionVisible = true;
    4.52                  this._IsSyncEnabledOverridden = true;          // Must be True for init
    4.53 +                this._IsGrouped = false;
    4.54  
    4.55                  base.RaisePropertyChangedEvent(nameof(this.IsDecryptAlwaysEnabledOptionVisible));
    4.56 +                base.RaisePropertyChangedEvent(nameof(this.IsGrouped));
    4.57                  base.RaisePropertyChangedEvent(nameof(this.IsPEPEnabledOptionChecked));
    4.58                  base.RaisePropertyChangedEvent(nameof(this.IsPEPEnabledOptionEnabled));
    4.59                  base.RaisePropertyChangedEvent(nameof(this.IsPEPEnabledOptionVisible));
    4.60 @@ -1714,6 +1734,7 @@
    4.61                      Type = base._Type,
    4.62  
    4.63                      IsDecryptAlwaysEnabledOptionVisible = this._IsDecryptAlwaysEnabledOptionVisible,
    4.64 +                    IsGrouped = this._IsGrouped,
    4.65                      IsPEPEnabledOptionChecked = this._IsPEPEnabledOptionChecked,
    4.66                      IsPEPEnabledOptionEnabled = this._IsPEPEnabledOptionEnabled,
    4.67                      IsPEPEnabledOptionVisible = this._IsPEPEnabledOptionVisible,