EncryptionStatusPanel.cs
author Dean Looyengoed
Tue, 29 Dec 2015 01:25:30 +0100
changeset 159 15d0050bc11a
parent 156 dcb5ac2a9cd4
child 161 2b6b485152c5
permissions -rw-r--r--
Initial refactoring of the encryption status panel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
     1
´╗┐using pEpCOMServerAdapterLib;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
     2
using System;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
     3
using System.Collections.Generic;
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
     4
using System.Diagnostics;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
     5
using System.Linq;
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
     6
using System.Runtime.InteropServices;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
     7
using System.Windows.Forms;
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
     8
using Color = System.Drawing.Color;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
     9
using Outlook = Microsoft.Office.Interop.Outlook;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    10
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    11
namespace pEp
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    12
{
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    13
    /// <summary>
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    14
    /// Partial class for the encryption status panel that is displayed below every outlook message.
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    15
    /// </summary>
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    16
    partial class EncryptionStatusPanel
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    17
    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    18
        #region Form Region Factory
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    19
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    20
        [Microsoft.Office.Tools.Outlook.FormRegionMessageClass(Microsoft.Office.Tools.Outlook.FormRegionMessageClassAttribute.Note)]
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    21
        [Microsoft.Office.Tools.Outlook.FormRegionName("pEp.FormRegion1")]
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    22
        public partial class FormRegion1Factory
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    23
        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    24
            // Occurs before the form region is initialized.
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    25
            // To prevent the form region from appearing, set e.Cancel to true.
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    26
            // Use e.OutlookItem to get a reference to the current Outlook item.
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    27
            private void FormRegion1Factory_FormRegionInitializing(object sender, Microsoft.Office.Tools.Outlook.FormRegionInitializingEventArgs e)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    28
            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    29
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    30
        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    31
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    32
        #endregion
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    33
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    34
        private struct EncStatusData
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    35
        {
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    36
            public string title;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    37
            public string explanation;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    38
            public string suggestion;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    39
            public Color background;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    40
            public Color foreground;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    41
            public string button_text;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    42
            public ContextMenuStrip strip;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    43
        };
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    44
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    45
        /* Notes:
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    46
         * Use this.OutlookItem to get a reference to the current Outlook item.
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    47
         * Use this.OutlookFormRegion to get a reference to the form region.
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    48
         */
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    49
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    50
        private CryptableMailItem _mailItem = null;
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    51
        private bool in_reset = false;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    52
        private EncStatusData enc_status_data;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    53
        private _pEp_color _enc_status;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    54
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    55
        /**************************************************************
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    56
         * 
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    57
         * Property Accessors
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    58
         * 
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
    59
         *************************************************************/
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    60
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    61
        CryptableMailItem mailItem
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    62
        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    63
            get
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    64
            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    65
                try
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    66
                {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    67
                    if (this.OutlookItem == null)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    68
                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    69
                        _mailItem = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    70
                        return null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    71
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    72
                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    73
                catch (COMException)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    74
                {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    75
                    return null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    76
                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    77
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    78
                Outlook.MailItem omi = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    79
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    80
                try
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    81
                {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    82
                    omi = (Outlook.MailItem)this.OutlookItem;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    83
                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    84
                catch
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    85
                {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    86
                    _mailItem = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    87
                    return null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    88
                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    89
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    90
                Outlook.MAPIFolder folder = omi.Parent;
136
34e41293d3b0 fun with b0rken IMAP
Volker Birk <vb@pep-project.org>
parents: 133
diff changeset
    91
                Outlook.MAPIFolder deleted = folder.Store.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDeletedItems);
34e41293d3b0 fun with b0rken IMAP
Volker Birk <vb@pep-project.org>
parents: 133
diff changeset
    92
                if (deleted != null && folder.EntryID == deleted.EntryID)
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    93
                {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    94
                    _mailItem = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    95
                    return null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    96
                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    97
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    98
                if (_mailItem == null) {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
    99
                    _mailItem = new CryptableMailItem(omi);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   100
                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   101
                else
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   102
                {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   103
                    if (_mailItem.EntryID != omi.EntryID)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   104
                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   105
                        _mailItem = new CryptableMailItem(omi);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   106
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   107
                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   108
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   109
                return _mailItem;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   110
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   111
        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   112
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   113
        public _pEp_color enc_status {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   114
            get
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   115
            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   116
                return _enc_status;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   117
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   118
            set
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   119
            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   120
                if (value != _enc_status)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   121
                {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   122
                    _enc_status = value;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   123
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   124
                    switch (value)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   125
                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   126
                        case _pEp_color.pEp_rating_trusted:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   127
                        case _pEp_color.pEp_rating_trusted_and_anonymized:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   128
                            enc_status_data.explanation = pEp.Properties.Resources.RatingTrustedExplanation;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   129
                            enc_status_data.suggestion = pEp.Properties.Resources.RatingTrustedSuggestion;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   130
                            enc_status_data.title = pEp.Properties.Resources.RatingTrustedTitle;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   131
                            enc_status_data.background = Color.Green;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   132
                            enc_status_data.foreground = Color.White;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   133
                            enc_status_data.button_text = pEp.Properties.Resources.RatingTrustedButtontext;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   134
                            enc_status_data.strip = new ContextMenuStrip();
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   135
                            enc_status_data.strip.Items.Add("");
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   136
                            enc_status_data.strip.Opening += secure_strip_Opening;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   137
                            break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   138
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   139
                        case _pEp_color.pEp_rating_reliable:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   140
                            enc_status_data.explanation = pEp.Properties.Resources.RatingReliableExplaination;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   141
                            enc_status_data.suggestion = pEp.Properties.Resources.RatingReliableSuggestion;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   142
                            enc_status_data.title = pEp.Properties.Resources.RatingReliableTitle;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   143
                            enc_status_data.background = Color.Gold;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   144
                            enc_status_data.foreground = Color.Black;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   145
                            enc_status_data.button_text = pEp.Properties.Resources.RatingReliableButtontext;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   146
                            enc_status_data.strip = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   147
                            break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   148
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   149
                        case _pEp_color.pEp_rating_unreliable:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   150
                            enc_status_data.explanation = pEp.Properties.Resources.RatingUnreliableExplanation;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   151
                            enc_status_data.suggestion = pEp.Properties.Resources.RatingUnreliableSuggestion;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   152
                            enc_status_data.title = pEp.Properties.Resources.RatingUnreliableTitle;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   153
                            enc_status_data.background = Color.Gainsboro;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   154
                            enc_status_data.foreground = Color.Black;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   155
                            enc_status_data.button_text = pEp.Properties.Resources.RatingUnreliableButtontext;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   156
                            enc_status_data.strip = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   157
                            break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   158
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   159
                        case _pEp_color.pEp_rating_unencrypted:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   160
                            enc_status_data.explanation = pEp.Properties.Resources.RatingUnencryptedExplanation;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   161
                            enc_status_data.suggestion = pEp.Properties.Resources.RatingUnencryptedSuggestion;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   162
                            enc_status_data.title = pEp.Properties.Resources.RatingUnencryptedTitle;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   163
                            enc_status_data.background = Color.Gainsboro;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   164
                            enc_status_data.foreground = Color.Black;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   165
                            enc_status_data.button_text = pEp.Properties.Resources.RatingUnencryptedButtontext;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   166
                            enc_status_data.strip = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   167
                            break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   168
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   169
                        case _pEp_color.pEp_rating_under_attack:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   170
                            enc_status_data.explanation = pEp.Properties.Resources.RatingUnderattackExplanation;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   171
                            enc_status_data.suggestion = pEp.Properties.Resources.RatingUnderattackSuggestion;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   172
                            enc_status_data.title = pEp.Properties.Resources.RatingUnderattackTitle;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   173
                            enc_status_data.background = Color.Red;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   174
                            enc_status_data.foreground = Color.White;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   175
                            enc_status_data.button_text = pEp.Properties.Resources.RatingUnderattackButtontext;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   176
                            enc_status_data.strip = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   177
                            break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   178
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   179
                        case _pEp_color.pEp_rating_undefined:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   180
                            // will not happen
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   181
                            enc_status_data.explanation = pEp.Properties.Resources.RatingUndefinedExplanation;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   182
                            enc_status_data.suggestion = pEp.Properties.Resources.RatingUndefinedSuggestion;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   183
                            enc_status_data.title = pEp.Properties.Resources.RatingUndefinedTitle;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   184
                            enc_status_data.background = Color.Gainsboro;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   185
                            enc_status_data.foreground = Color.Black;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   186
                            enc_status_data.button_text = pEp.Properties.Resources.RatingUndefinedButtontext;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   187
                            enc_status_data.strip = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   188
                            break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   189
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   190
                        case _pEp_color.pEp_rating_cannot_decrypt:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   191
                        case _pEp_color.pEp_rating_have_no_key:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   192
                            enc_status_data.explanation = pEp.Properties.Resources.RatingHavenokeyExplanation;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   193
                            enc_status_data.suggestion = pEp.Properties.Resources.RatingHavenokeySuggestion;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   194
                            enc_status_data.title = pEp.Properties.Resources.RatingHavenokeyTitle;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   195
                            enc_status_data.background = Color.Gainsboro;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   196
                            enc_status_data.foreground = Color.Black;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   197
                            enc_status_data.button_text = pEp.Properties.Resources.RatingHavenokeyButtontext;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   198
                            enc_status_data.strip = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   199
                            break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   200
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   201
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   202
                    linkExplanation.Text = enc_status_data.title;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   203
                    EncryptionStatus.BackColor = enc_status_data.background;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   204
                    EncryptionStatus.ForeColor = enc_status_data.foreground;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   205
                    EncryptionStatus.Text = enc_status_data.button_text;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   206
                    EncryptionStatus.ContextMenuStrip = enc_status_data.strip;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   207
                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   208
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   209
        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   210
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   211
        /**************************************************************
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   212
         * 
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   213
         * Methods
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   214
         * 
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   215
         *************************************************************/
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   216
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   217
        static void StopHere(string reason)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   218
        {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   219
#if DEBUG
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   220
            MessageBox.Show(reason);
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   221
#else
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   222
            try
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   223
            {
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   224
                ThisAddIn.pEp.log("internal error", "pEp for Outlook", reason, "in EncryptionStatusPanel.cs");
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   225
            }
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   226
            catch (COMException) { }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   227
            catch (Exception) { }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   228
#endif
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   229
        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   230
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   231
        private void doHandshake(pEp_identity_s identityPartner)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   232
        {
155
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   233
            string ownShort;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   234
            string ownLong;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   235
            string ownFpr;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   236
            string partnerShort;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   237
            string partnerLong;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   238
            string partnerFpr;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   239
            string[] lines;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   240
            pEp_identity_s me;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   241
            FormHandshake handshakeDialog;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   242
            FormHandshake.State state = new FormHandshake.State();
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   243
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   244
            Debug.Assert(mailItem.ColorRating == _pEp_color.pEp_rating_yellow);
132
f0c74e2c6dfb review of mailItem handling
Volker Birk <vb@pep-project.org>
parents: 131
diff changeset
   245
139
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   246
            ThisAddIn.verbose("doHandshake");
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   247
            ThisAddIn.verbose(identityPartner.address);
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   248
132
f0c74e2c6dfb review of mailItem handling
Volker Birk <vb@pep-project.org>
parents: 131
diff changeset
   249
            if (identityPartner.username == "")
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   250
                identityPartner.username = identityPartner.address;
139
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   251
            ThisAddIn.verbose(identityPartner.username);
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   252
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   253
            identityPartner.user_id = CryptableMailItem.GetUserIDFromAddress(identityPartner.address, identityPartner.username);
139
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   254
            ThisAddIn.verbose(identityPartner.user_id);
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   255
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   256
            if (mailItem.IsIncoming)
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   257
            {
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   258
                string entryID = mailItem.ReceivedByEntryID;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   259
                string address = "";
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   260
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   261
                foreach (Outlook.Account a in ThisAddIn.addIn.Application.Session.Accounts){
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   262
                    if (a.CurrentUser.EntryID == entryID) {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   263
                        address = a.SmtpAddress;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   264
                        break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   265
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   266
                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   267
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   268
                if (address == "")
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   269
                    address = ThisAddIn.addIn.Application.Session.Accounts[1].SmtpAddress;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   270
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   271
                me = ThisAddIn.addIn.mySelf(address);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   272
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   273
            else // outgoing
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   274
            {
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   275
                ThisAddIn.verbose("mailItem.from_address: " + mailItem.FromAddress);
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   276
                me = ThisAddIn.addIn.mySelf(mailItem.FromAddress);
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   277
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   278
139
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   279
            ThisAddIn.verbose(me.fpr);
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   280
155
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   281
            ownShort = ThisAddIn.pEp.trustwords(me.fpr, max_words: 5).ToLower();
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   282
            ownLong  = ThisAddIn.pEp.trustwords(me.fpr).ToLower();
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   283
            ownFpr   = quadruple(me.fpr);
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   284
139
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   285
            ThisAddIn.verbose(identityPartner.fpr);
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   286
155
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   287
            partnerShort = ThisAddIn.pEp.trustwords(identityPartner.fpr, max_words: 5).ToLower();
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   288
            partnerLong  = ThisAddIn.pEp.trustwords(identityPartner.fpr).ToLower();
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   289
            partnerFpr   = quadruple(identityPartner.fpr);
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   290
155
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   291
            if (ownFpr.CompareTo(partnerFpr) > 0)
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   292
            {
155
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   293
                state.TrustwordsShort = partnerShort + ownShort;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   294
                state.TrustwordsFull  = partnerLong  + ownLong;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   295
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   296
                lines = new string[3];
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   297
                lines[0] = pEp.Properties.Resources.TrustwordsPartnershortPartner + partnerFpr;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   298
                lines[2] = pEp.Properties.Resources.TrustwordsPartnershortMyself + ownFpr;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   299
                state.Fingerprint = lines;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   300
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   301
            else
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   302
            {
155
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   303
                state.TrustwordsShort = ownShort + " " + partnerShort;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   304
                state.TrustwordsFull  = ownLong  + " " + partnerLong;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   305
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   306
                lines = new string[3];
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   307
                lines[0] = pEp.Properties.Resources.TrustwordsOwnshortMyself + ownFpr;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   308
                lines[2] = pEp.Properties.Resources.TrustwordsOwnshortPartner + partnerFpr;
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   309
                state.Fingerprint = lines;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   310
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   311
139
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   312
            ThisAddIn.verbose("try to show dialog");
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   313
155
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   314
            // Create and show handshake dialog
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   315
            handshakeDialog = new FormHandshake(state);
cda43d18bcd3 Add state to handshake form and decouple it from the encryption status panel
Dean Looyengoed
parents: 154
diff changeset
   316
132
f0c74e2c6dfb review of mailItem handling
Volker Birk <vb@pep-project.org>
parents: 131
diff changeset
   317
            DialogResult result = handshakeDialog.ShowDialog(this);
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   318
            ThisAddIn.verbose("handshakeDialog.ShowDialog(this) => " + result.ToString());
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   319
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   320
            switch (result)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   321
            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   322
                case DialogResult.Yes:
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   323
                    mailItem.ColorRating = _pEp_color.pEp_rating_trusted;
132
f0c74e2c6dfb review of mailItem handling
Volker Birk <vb@pep-project.org>
parents: 131
diff changeset
   324
                    identityPartner = ThisAddIn.pEp.trust_personal_key(identityPartner);
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   325
                    reset_enc_status(); 
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   326
                    break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   327
                case DialogResult.No:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   328
                    ThisAddIn.pEp.key_compromized(identityPartner);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   329
                    identityPartner.comm_type = _pEp_comm_type.pEp_ct_compromized;
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   330
                    mailItem.ColorRating = _pEp_color.pEp_rating_red;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   331
                    reset_enc_status(); 
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   332
                    break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   333
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   334
        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   335
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   336
        private void undoHandshake(pEp_identity_s identityPartner)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   337
        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   338
            ThisAddIn.pEp.update_identity(identityPartner);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   339
//            Debug.Assert((identityPartner.comm_type & _pEp_comm_type.pEp_ct_confirmed) != _pEp_comm_type.pEp_ct_unknown);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   340
            identityPartner.comm_type ^= _pEp_comm_type.pEp_ct_confirmed;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   341
            ThisAddIn.pEp.update_identity(identityPartner);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   342
            reset_enc_status();
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   343
        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   344
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   345
        private string quadruple(string text)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   346
        {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   347
            List<string> result = new List<string>();
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   348
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   349
            for (int i = 0; i < text.Length; i+=4)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   350
            {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   351
                try
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   352
                {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   353
                    result.Add(text.Substring(i, 4));
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   354
                }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   355
                catch (ArgumentOutOfRangeException)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   356
                {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   357
                    result.Add(text.Substring(i));
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   358
                    break;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   359
                }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   360
            }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   361
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   362
            return String.Join(" ", result);
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   363
        }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   364
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   365
        protected void makePreview()
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   366
        {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   367
            WindowFormRegionCollection formRegions;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   368
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   369
            if (Globals.ThisAddIn.Application.ActiveInspector() != null)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   370
                return;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   371
            else if (Globals.ThisAddIn.Application.ActiveExplorer() != null)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   372
                formRegions = Globals.FormRegions[Globals.ThisAddIn.Application.ActiveExplorer()];
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   373
            else
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   374
                return;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   375
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   376
            try
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   377
            {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   378
                if (formRegions.PreviewUnencrypted.Visible)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   379
                {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   380
                    byte[] rtf = mailItem.MirrorGetRTFBody();
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   381
                    formRegions.PreviewUnencrypted.textPreview.Rtf = System.Text.Encoding.ASCII.GetString(rtf, 0, rtf.Length);
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   382
                    formRegions.PreviewUnencrypted.textSubject.Text = mailItem.MirrorGetSubject();
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   383
                    formRegions.PreviewUnencrypted.textFrom.Text = mailItem.FromUsername + " <" + mailItem.FromAddress + ">";
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   384
                }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   385
            }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   386
            catch { }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   387
        }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   388
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   389
        protected void reset_enc_status()
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   390
        {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   391
            if (in_reset)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   392
                return;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   393
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   394
            in_reset = true;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   395
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   396
            if (mailItem != null)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   397
            {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   398
                if (_mailItem.DownloadState == Outlook.OlDownloadState.olFullItem)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   399
                {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   400
                    if (_mailItem.SendUnencrypted == CheckState.Checked)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   401
                    {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   402
                        enc_status = _pEp_color.pEp_rating_unencrypted;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   403
                    }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   404
                    else
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   405
                    {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   406
                        ThisAddIn.verbose("get_color in reset_enc_status");
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   407
                        enc_status = _mailItem.ColorRating;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   408
                    }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   409
                }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   410
                else
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   411
                {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   412
                    _mailItem.MarkForDownload = Outlook.OlRemoteStatus.olMarkedForDownload;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   413
                    timerRefresh.Interval = 500;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   414
                    timerRefresh.Enabled = true;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   415
                }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   416
            }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   417
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   418
            in_reset = false;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   419
        }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   420
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   421
        /**************************************************************
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   422
         * 
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   423
         * Event Handling
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   424
         * 
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   425
         *************************************************************/
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   426
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   427
        /// <summary>
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   428
        /// Event handler that is called before the form region is displayed.
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   429
        /// </summary>
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   430
        private void FormRegion1_FormRegionShowing(object sender, System.EventArgs e)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   431
        {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   432
            if (this.OutlookItem == null)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   433
            {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   434
                enc_status = _pEp_color.pEp_rating_undefined;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   435
            }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   436
            else
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   437
            {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   438
                Outlook.MailItem omi = (Outlook.MailItem)this.OutlookItem;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   439
                try
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   440
                {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   441
                    omi.PropertyChange += mailItem_PropertyChange;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   442
                    if (CryptableMailItem.IsEncryptedStore(omi))
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   443
                    {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   444
                        if (PreviewUnencrypted.isPGPEncrypted(omi) && omi.Sender != null)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   445
                        {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   446
                            omi.Open += omi_Open;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   447
                        }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   448
                    }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   449
                }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   450
                catch { }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   451
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   452
                if (ThisAddIn.addIn.enabled)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   453
                {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   454
                    reset_enc_status();
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   455
                }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   456
                else
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   457
                {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   458
                    timerRefresh.Enabled = true;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   459
                }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   460
            }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   461
        }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   462
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   463
        /// <summary>
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   464
        /// Event handler for when the form region is closed.
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   465
        /// </summary>
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   466
        private void FormRegion1_FormRegionClosed(object sender, System.EventArgs e)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   467
        {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   468
            return;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   469
        }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   470
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   471
        private void omi_Open(ref bool Cancel)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   472
        {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   473
            if (mailItem != null && _mailItem.MirrorDisplay())
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   474
                Cancel = true;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   475
        }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   476
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   477
        private void mailItem_PropertyChange(string Name)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   478
        {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   479
            switch (Name)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   480
            {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   481
                case "To":
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   482
                    timerRefresh.Enabled = true;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   483
                    break;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   484
                // Outlook bug: there are always both events, so one is enough
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   485
                //case "CC":
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   486
                //    reset_enc_status();
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   487
                //    break;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   488
            }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   489
        }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   490
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   491
        private void secure_strip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   492
        {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   493
            enc_status_data.strip.Items.Clear();
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   494
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   495
            if (mailItem.IsIncoming)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   496
            {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   497
                pEp_identity_s ident = new pEp_identity_s();
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   498
                ident.address = mailItem.FromAddress;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   499
                ident.username = mailItem.FromUsername;
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   500
                ident.user_id = CryptableMailItem.GetUserIDFromAddress(ident.address, ident.username);
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   501
                ident = ThisAddIn.pEp.update_identity(ident);
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   502
                string text = pEp.Properties.Resources.IdentityTrustText + ident.username + " <" + ident.address + ">";
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   503
                enc_status_data.strip.Items.Add(text, null, (x, y) => { undoHandshake(ident); });
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   504
            }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   505
            else
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   506
            {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   507
                foreach (pEp_identity_s ident in mailItem.Addresses)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   508
                {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   509
                    pEp_identity_s identityPartner = ThisAddIn.pEp.update_identity(ident);
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   510
                    if (identityPartner.comm_type >= _pEp_comm_type.pEp_ct_confirmed_encryption)
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   511
                    {
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   512
                        string text = pEp.Properties.Resources.IdentityTrustText + ident.username + " <" + ident.address + ">";
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   513
                        enc_status_data.strip.Items.Add(text, null, (x, y) => { undoHandshake(ident); });
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   514
                    }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   515
                }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   516
            }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   517
        }
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   518
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   519
        private void EncryptionStatus_Click(object sender, EventArgs e)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   520
        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   521
            switch (enc_status)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   522
            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   523
                case _pEp_color.pEp_rating_green:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   524
                    try
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   525
                    {
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   526
                        string[] key_list = mailItem.Keylist;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   527
                        if (key_list.Length > 0)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   528
                        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   529
                            string msg;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   530
                            if (key_list.Length > 1)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   531
                                msg = String.Format(pEp.Properties.Resources.EncryptionStatusClickMessageMultiple + " {0}.", String.Join(", ", key_list));
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   532
                            else
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   533
                                msg = String.Format(pEp.Properties.Resources.EncryptionStatusClickMessageSingle + " {0}.", key_list[0]);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   534
                            MessageBox.Show(msg, pEp.Properties.Resources.EncryptionStatusClickMessageBox, MessageBoxButtons.OK, MessageBoxIcon.Information);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   535
                        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   536
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   537
                    catch (Exception ex)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   538
                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   539
                        StopHere(ex.ToString());
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   540
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   541
                    break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   542
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   543
                case _pEp_color.pEp_rating_yellow:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   544
                    try
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   545
                    {
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   546
                        if (mailItem.IsIncoming)
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   547
                        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   548
                            pEp_identity_s identityPartner = new pEp_identity_s();
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   549
                            identityPartner.address = mailItem.FromAddress;
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   550
                            identityPartner.username = mailItem.FromUsername;
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   551
                            identityPartner.user_id = CryptableMailItem.GetUserIDFromAddress(identityPartner.address, identityPartner.username);
139
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   552
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   553
                            try
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   554
                            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   555
                                identityPartner = ThisAddIn.pEp.update_identity(identityPartner);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   556
                            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   557
                            catch
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   558
                            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   559
                                enc_status = _pEp_color.pEp_rating_undefined;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   560
                                return;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   561
                            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   562
                            doHandshake(identityPartner);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   563
                        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   564
                        else // outgoing
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   565
                        {
139
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   566
                            ThisAddIn.verbose("yellow, handshake initiated");
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   567
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   568
                            List<pEp_identity_s> partnersToCheck = new List<pEp_identity_s>();
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   569
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   570
                            foreach (pEp_identity_s identity in mailItem.Addresses)
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   571
                            {
139
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   572
                                ThisAddIn.verbose("adding " + identity.username + " <" + identity.address + ">");
5fba0600b7a2 user_id everywhere
Volker Birk <vb@pep-project.org>
parents: 137
diff changeset
   573
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   574
                                try
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   575
                                {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   576
                                    pEp_identity_s identityPartner = ThisAddIn.pEp.update_identity(identity);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   577
                                    if (identityPartner.comm_type >= _pEp_comm_type.pEp_ct_unconfirmed_encryption
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   578
                                        && identityPartner.comm_type < _pEp_comm_type.pEp_ct_confirmed_encryption)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   579
                                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   580
                                        partnersToCheck.Add(identityPartner);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   581
                                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   582
                                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   583
                                catch
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   584
                                {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   585
                                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   586
                            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   587
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   588
                            if (partnersToCheck.Count == 0)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   589
                            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   590
                                enc_status = _pEp_color.pEp_rating_undefined;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   591
                                return;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   592
                            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   593
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   594
                            pEp_identity_s[] addresses = mailItem.Addresses;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   595
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   596
                            if (addresses.Length == 1)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   597
                            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   598
                                doHandshake(partnersToCheck[0]);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   599
                            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   600
                            else if (addresses.Length > 1)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   601
                            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   602
                                contextMenuHandshake.Items.Clear();
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   603
                                foreach (pEp_identity_s identity in partnersToCheck) {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   604
                                    string text = identity.username + " <" + identity.address + ">";
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   605
                                    contextMenuHandshake.Items.Add(text, null, (x, y) => { doHandshake(identity); });
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   606
                                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   607
                                contextMenuHandshake.Show(EncryptionStatus, 10, 10);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   608
                            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   609
                        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   610
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   611
                    catch (COMException ex)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   612
                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   613
                        StopHere(ex.ToString());
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   614
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   615
                    catch (Exception ex)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   616
                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   617
                        StopHere(ex.ToString());
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   618
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   619
                    break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   620
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   621
                case _pEp_color.pEp_rating_unencrypted:
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   622
                    if (mailItem.IsIncoming)
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   623
                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   624
                        MessageBox.Show(pEp.Properties.Resources.RatingUnencryptedMessageboxReasonBody, pEp.Properties.Resources.RatingUnencryptedMessageboxReasonTitle);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   625
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   626
                    else
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   627
                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   628
                        try
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   629
                        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   630
                            string reason = "";
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   631
                            foreach (pEp_identity_s identity in mailItem.Addresses)
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   632
                            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   633
                                if (identity.comm_type < _pEp_comm_type.pEp_ct_security_by_obscurity)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   634
                                {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   635
                                    if (reason != "")
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   636
                                        reason += "\n";
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   637
                                    // BUG: reason string in English language only and trivial
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   638
                                    string ct = identity.comm_type.ToString();
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   639
                                    ct = new string(ct.Skip(7).ToArray());
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   640
                                    ct = ct.Replace("_", " ");
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   641
                                    reason += identity.username + " <" + identity.address + ">: " + ct;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   642
                                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   643
                            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   644
                            if (reason != "")
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   645
                                MessageBox.Show(reason, pEp.Properties.Resources.RatingUnencryptedMessageboxReasonTitle);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   646
                        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   647
                        catch (COMException ex)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   648
                        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   649
                            StopHere(ex.ToString());
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   650
                        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   651
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   652
                    break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   653
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   654
                case _pEp_color.pEp_rating_cannot_decrypt:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   655
                case _pEp_color.pEp_rating_have_no_key:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   656
                    try
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   657
                    {
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   658
                        string[] keys = mailItem.Keylist;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   659
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   660
                        if (keys.Length > 1)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   661
                        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   662
                            string reason;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   663
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   664
                            if (keys.Length == 2)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   665
                                reason = pEp.Properties.Resources.RatingHavenokeyMessageboxReasonBodyNokey;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   666
                            else
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   667
                                reason = string.Format(pEp.Properties.Resources.RatingHavenokeyMessageboxReasonBodySomekey, keys.Length - 1);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   668
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   669
                            string keyinfo = "";
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   670
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   671
                            foreach (string key in keys)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   672
                            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   673
                                if (key.Length >= 8)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   674
                                    keyinfo += "\n" + key;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   675
                            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   676
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   677
                            reason += keyinfo;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   678
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   679
                            MessageBox.Show(reason, pEp.Properties.Resources.RatingHavenokeyTitle);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   680
                        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   681
                        else if (keys.Length == 1)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   682
                        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   683
                            MessageBox.Show(pEp.Properties.Resources.RatingHavenokeyMessageboxReasonError + keys[0], pEp.Properties.Resources.RatingHavenokeyTitle);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   684
                        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   685
                        else
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   686
                        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   687
                            MessageBox.Show(pEp.Properties.Resources.RatingHavenokeyMessageboxReasonUnknownformat, pEp.Properties.Resources.RatingHavenokeyTitle);
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   688
                        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   689
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   690
                    catch (COMException ex)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   691
                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   692
                        StopHere(ex.ToString());
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   693
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   694
                    break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   695
                    
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   696
                case _pEp_color.pEp_rating_undefined:
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   697
                    if (mailItem != null)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   698
                    {
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   699
                        enc_status = mailItem.ColorRating;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   700
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   701
                    break;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   702
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   703
        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   704
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   705
        private void linkExplanation_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   706
        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   707
            if (enc_status == _pEp_color.pEp_rating_undefined)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   708
            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   709
                enc_status_data.explanation = pEp.Properties.Resources.RatingUndefinedExplanation;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   710
                enc_status_data.suggestion = pEp.Properties.Resources.RatingUndefinedSuggestion;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   711
                enc_status_data.title = pEp.Properties.Resources.RatingUndefinedTitle;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   712
                enc_status_data.background = Color.Gainsboro;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   713
                enc_status_data.foreground = Color.Black;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   714
                enc_status_data.button_text = pEp.Properties.Resources.RatingUndefinedButtontext;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   715
                enc_status_data.strip = null;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   716
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   717
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   718
            var result = MessageBox.Show(
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   719
                            enc_status_data.explanation + "\n\n" + enc_status_data.suggestion,
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   720
                            enc_status_data.title,
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   721
                            MessageBoxButtons.OK,
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   722
                            enc_status == _pEp_color.pEp_rating_under_attack
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   723
                                ? MessageBoxIcon.Stop
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   724
                                : MessageBoxIcon.Information
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   725
                        );
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   726
        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   727
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   728
        private void timerRefresh_Tick(object sender, EventArgs e)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   729
        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   730
            timerRefresh.Interval = 100;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   731
            timerRefresh.Enabled = false; // only once
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   732
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   733
            if (!ThisAddIn.addIn.enabled)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   734
                ThisAddIn.addIn.enable();
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   735
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   736
            makePreview();
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   737
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   738
            reset_enc_status();
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   739
        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   740
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   741
        private void EncryptionStatus_MouseUp(object sender, MouseEventArgs e)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   742
        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   743
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   744
            {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   745
                CryptableMailItem cmi = mailItem;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   746
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   747
                if (cmi != null && !cmi.IsIncoming && !cmi.IsInSentFolder && cmi.OutgoingColor > _pEp_color.pEp_rating_unencrypted)
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   748
                {
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   749
                    if (cmi.SendUnencrypted == CheckState.Indeterminate)
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   750
                    {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   751
                        sendUnencryptedToolStripMenuItem.CheckState = CheckState.Unchecked;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   752
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   753
                    else {
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   754
                        sendUnencryptedToolStripMenuItem.CheckState = cmi.SendUnencrypted;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   755
                    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   756
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   757
                    Control _sender = (Control)sender;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   758
                    contextMenuEdit.Show(_sender.PointToScreen(e.Location));
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   759
                }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   760
            }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   761
        }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   762
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   763
        private void sendUnencryptedToolStripMenuItem_Click(object sender, EventArgs e)
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   764
        {
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   765
            sendUnencryptedToolStripMenuItem.Checked = !sendUnencryptedToolStripMenuItem.Checked;
144
146c2602df72 Refactor, organize and comment CryptableMailItem
Dean Looyengoed <dean@pep-project.org>
parents: 143
diff changeset
   766
            mailItem.SendUnencrypted = sendUnencryptedToolStripMenuItem.CheckState;
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   767
            timerRefresh.Enabled = true;
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   768
        }
151
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   769
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   770
        /// <summary>
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   771
        /// Event handler for when the options picture box is clicked.
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   772
        /// This will open the options form for user editing.
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   773
        /// </summary>
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   774
        private void PictureBoxOptions_Click(object sender, EventArgs e)
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   775
        {
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   776
            DialogResult result;
152
3028c2790e3d First step at integrated options form. This allows removal of ribbon UI and sets stage for next changes.
Dean Looyengoed
parents: 151
diff changeset
   777
            FormOptions frm = new FormOptions();
154
8b05adf8a371 Complete refactoring and add state to options form. Also make registry save/load much more robust.
Dean Looyengoed
parents: 152
diff changeset
   778
            frm.StartPosition = FormStartPosition.CenterScreen;
159
15d0050bc11a Initial refactoring of the encryption status panel
Dean Looyengoed
parents: 156
diff changeset
   779
            result = frm.ShowDialog(this.ParentForm); // Must show as dialog to block code
151
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   780
154
8b05adf8a371 Complete refactoring and add state to options form. Also make registry save/load much more robust.
Dean Looyengoed
parents: 152
diff changeset
   781
            if (ThisAddIn.addIn.use_keyserver)
8b05adf8a371 Complete refactoring and add state to options form. Also make registry save/load much more robust.
Dean Looyengoed
parents: 152
diff changeset
   782
                ThisAddIn.pEp.start_keyserver_lookup();
8b05adf8a371 Complete refactoring and add state to options form. Also make registry save/load much more robust.
Dean Looyengoed
parents: 152
diff changeset
   783
            else
8b05adf8a371 Complete refactoring and add state to options form. Also make registry save/load much more robust.
Dean Looyengoed
parents: 152
diff changeset
   784
                ThisAddIn.pEp.stop_keyserver_lookup();
151
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   785
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   786
            return;
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   787
        }
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   788
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   789
        /// <summary>
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   790
        /// Event handler for when the mouse hovers over the options picture box.
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   791
        /// This is a work-around to show a tool tip.
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   792
        /// </summary>
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   793
        private void PictureBoxOptions_MouseHover(object sender, EventArgs e)
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   794
        {
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   795
            ToolTip toolTip = new ToolTip();
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   796
            toolTip.SetToolTip(this.PictureBoxOptions, "Click to open options");
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   797
            return;
8b0b69c6f71b Create initial gear icon for options and add the options button to the encryption status panel
Dean Looyengoed
parents: 144
diff changeset
   798
        }
133
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   799
    }
214f4dc9e2c8 coloring new
Volker Birk <vb@pep-project.org>
parents: 132
diff changeset
   800
}