[svn] GpgOL - r246 - in trunk: po src

svn author wk cvs at cvs.gnupg.org
Tue Apr 15 17:32:20 CEST 2008


Author: wk
Date: 2008-04-15 17:32:15 +0200 (Tue, 15 Apr 2008)
New Revision: 246

Added:
   trunk/src/Outlook.gpl
   trunk/src/cryptostate.bmp
   trunk/src/kleopatra.bmp
   trunk/src/proto-auto.bmp
   trunk/src/proto-pgpmime.bmp
   trunk/src/proto-smime.bmp
Removed:
   trunk/src/gpgmsg.cpp
   trunk/src/gpgmsg.hh
Modified:
   trunk/po/de.po
   trunk/po/sv.po
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/dialogs.h
   trunk/src/dialogs.rc
   trunk/src/display.cpp
   trunk/src/display.h
   trunk/src/ext-commands.cpp
   trunk/src/ext-commands.h
   trunk/src/item-events.cpp
   trunk/src/main.c
   trunk/src/mapihelp.cpp
   trunk/src/mapihelp.h
   trunk/src/message-events.cpp
   trunk/src/message.cpp
   trunk/src/message.h
   trunk/src/mimemaker.c
   trunk/src/mimeparser.c
   trunk/src/ol-ext-callback.cpp
   trunk/src/ol-ext-callback.h
   trunk/src/olflange.cpp
   trunk/src/user-events.cpp
Log:
Created icons.
Various changes to try deleting the PR_BODY.


[The diff below has been truncated]

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-04-04 14:18:04 UTC (rev 245)
+++ trunk/src/ChangeLog	2008-04-15 15:32:15 UTC (rev 246)
@@ -1,3 +1,37 @@
+2008-04-15  Werner Koch  <wk at g10code.com>
+
+	* Outlook.gpl: New.
+
+2008-04-14  Werner Koch  <wk at g10code.com>
+
+	* display.cpp (is_inspector_display): New.
+	(find_message_window): Rewrote.
+
+	* message-events.cpp (OnRead): Use it.
+	* message.cpp (message_incoming_handler): Add arg FORCE.
+	* message-events.cpp (OnRead): Pass false for FORCE.
+	* item-events.cpp (OnOpen): Ditto.
+	* ext-commands.cpp (DoCommand): Let CmdCryptoState process and
+	display the current message again.
+	(GpgolExtCommands): Remove m_nCmdCheckSig and m_nCmdDecrypt.
+
+2008-04-10  Werner Koch  <wk at g10code.com>
+
+	* ol-ext-callback.cpp (is_preview_pane_visible)
+	(show_preview_pane): New.
+
+	* display.cpp (update_display): Add arg IS_SENSITIVE and do not
+	use the OOM method if this is set.
+
+	* mapihelp.h (mapi_save_changes): New. Use if everywhere.
+	(mapi_delete_body_props): Use it to delete body parts.
+	* mapihelp.cpp (mapi_do_save_changes): New.
+	* mimemaker.c (finalize_message): Do no delete body parts because
+	mapi_save_changes does this now.
+
+	* mimeparser.c (finish_message): Remove the body property in
+	protect mode.
+
 2008-04-04  Werner Koch  <wk at g10code.com>
 
 	* engine-assuan.c (worker_start_read, worker_check_read): Factor

Modified: trunk/po/de.po  [not shown]
Modified: trunk/po/sv.po  [not shown]
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2008-04-04 14:18:04 UTC (rev 245)
+++ trunk/src/Makefile.am	2008-04-15 15:32:15 UTC (rev 246)
@@ -14,8 +14,10 @@
 unused_sources = item-events.cpp 
 
 bin_PROGRAMS = gpgol 
-EXTRA_DIST = versioninfo.rc.in mapi32.def $(unused_sources) \
-	     logo.bmp decrypt.bmp encrypt.bmp sign.bmp key_mana.bmp 
+EXTRA_DIST = versioninfo.rc.in mapi32.def $(unused_sources) Outlook.gpl \
+	     logo.bmp decrypt.bmp encrypt.bmp sign.bmp key_mana.bmp \
+             proto-auto.bmp proto-pgpmime.bmp proto-smime.bmp \
+             cryptostate.bmp
 
 EXEEXT = .dll
 

Added: trunk/src/Outlook.gpl
===================================================================
--- trunk/src/Outlook.gpl	2008-04-04 14:18:04 UTC (rev 245)
+++ trunk/src/Outlook.gpl	2008-04-15 15:32:15 UTC (rev 246)
@@ -0,0 +1,20 @@
+GIMP Palette
+Name: Outlook
+Columns: 16
+#
+  0   0   0	Untitled
+128   0   0	Untitled
+  0 128   0	Untitled
+128 128   0	Untitled
+  0   0 128	Untitled
+128   0 128	Untitled
+  0 128 128	Untitled
+192 192 192	Untitled
+128 128 128	Untitled
+255   0   0	Untitled
+  0 255   0	Untitled
+255 255   0	Untitled
+  0   0 255	Untitled
+255   0 255	Untitled
+  0 255 255	Untitled
+255 255 255	Untitled

Added: trunk/src/cryptostate.bmp
===================================================================
(Binary files differ)


Property changes on: trunk/src/cryptostate.bmp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/dialogs.h
===================================================================
--- trunk/src/dialogs.h	2008-04-04 14:18:04 UTC (rev 245)
+++ trunk/src/dialogs.h	2008-04-15 15:32:15 UTC (rev 246)
@@ -8,18 +8,19 @@
 
 
 /* Ids used for bitmaps.  */
-#define IDB_DECRYPT                     3001
+#define IDB_DECRYPT                     3001  /* Not used.  */
 #define IDB_ENCRYPT                     3002
 #define IDB_SIGN                        3003
 #define IDB_ADD_KEYS                    3004
 #define IDB_KEY_MANAGER                 3005
-#define IDB_BANNER                      3006
-#define IDB_BANNER_HI                   3007
-#define IDB_SELECT_SMIME                3008
-#define IDB_KEY_MANAGER_PNG             3105
-#define IDB_CRYPTO_STATE                3005 /* We use the keymanager
-                                                icon for now*/
+#define IDB_BANNER                      3006  /* The g10 Code logo.  */
+#define IDB_BANNER_HI                   3007  /* Not used.  */
+#define IDB_CRYPTO_STATE                3008  
+#define IDB_PROTO_AUTO                  3009
+#define IDB_PROTO_PGPMIME               3010
+#define IDB_PROTO_SMIME                 3011
 
+
 /* Ids used for the main config dialog.  */
 #define IDD_GPG_OPTIONS                 4001
 #define IDC_TIME_PHRASES                4010

Modified: trunk/src/dialogs.rc
===================================================================
--- trunk/src/dialogs.rc	2008-04-04 14:18:04 UTC (rev 245)
+++ trunk/src/dialogs.rc	2008-04-15 15:32:15 UTC (rev 246)
@@ -22,12 +22,19 @@
 
 #include "afxres.h"
 
+/* To create these bitmaps, you need to use an Outlook specific
+   palette.  A palette file for The Gimp is included as
+   Outlook.gpl.  */
 
-IDB_DECRYPT             BITMAP  DISCARDABLE     "decrypt.bmp"
+/*IDB_DECRYPT             BITMAP  DISCARDABLE     "decrypt.bmp"*/
 IDB_ENCRYPT             BITMAP  DISCARDABLE     "encrypt.bmp"
 IDB_SIGN                BITMAP  DISCARDABLE     "sign.bmp"
 IDB_KEY_MANAGER         BITMAP  DISCARDABLE     "key_mana.bmp"
 IDB_BANNER              BITMAP  DISCARDABLE     "logo.bmp"
+IDB_CRYPTO_STATE        BITMAP  DISCARDABLE     "cryptostate.bmp"
+IDB_PROTO_AUTO          BITMAP  DISCARDABLE     "proto-auto.bmp"
+IDB_PROTO_PGPMIME       BITMAP  DISCARDABLE     "proto-pgpmime.bmp"
+IDB_PROTO_SMIME         BITMAP  DISCARDABLE     "proto-smime.bmp"
 
 
 IDD_GPG_OPTIONS  DIALOG DISCARDABLE  0, 0, 266, 274

Modified: trunk/src/display.cpp
===================================================================
--- trunk/src/display.cpp	2008-04-04 14:18:04 UTC (rev 245)
+++ trunk/src/display.cpp	2008-04-15 15:32:15 UTC (rev 246)
@@ -81,11 +81,20 @@
 }
 
 
+/* A helper object for find_message_window.  */
+struct find_message_window_state
+{
+  int level;
+  int seen_32770:1;
+  int seen_afxwndw:1;
+};
+
+
+
 /* We need this to find the mailer window because we directly change
-   the text of the window instead of the MAPI object itself.  To do
-   this we walk all windows to find a PGP signature.  */
+   the text of the window instead of the MAPI object itself.  */
 static HWND
-find_message_window (HWND parent, int level)
+find_message_window (HWND parent, struct  find_message_window_state *findstate)
 {
   HWND child;
 
@@ -98,7 +107,6 @@
       char buf[1024+1];
       HWND w;
       size_t len;
-      const char *s;
 
       /* OL 2003 SP1 German uses this class name for the main
          inspector window.  We hope that no other windows uses this
@@ -107,8 +115,11 @@
          decrypted messages. */
       len = GetClassName (child, buf, sizeof buf - 1);
 //       if (len)
-//         log_debug ("  %*sgot class `%s'", level*2, "", buf);
-      if (level && len >= 10 && !strncmp (buf, "MsoCommand", 10))
+//         log_debug ("  %*sgot class `%s'", 2 * findstate->level, "", buf);
+      if (!len)
+        ;
+      else if (findstate->level && len >= 10 
+               && !strncmp (buf, "MsoCommand", 10))
         {
           /* We won't find anything below MsoCommand windows.
              Ignoring them fixes a bug where we return a RichEdit20W
@@ -149,46 +160,70 @@
            */
           break; /* Not found at this level.  */
         }
-
-      if (len && !strcmp (buf, "RichEdit20W"))
+      else if (findstate->level == 2 && !strcmp (buf, "#32770"))
         {
-          log_debug ("found class `%s'", "RichEdit20W");
+          /* An inspector window has the #32770 class window at level
+             2 whereas the preview window has it at level 4.  (OL2003
+             SP2, German).  */
+          findstate->seen_32770 = 1;
+          findstate->seen_afxwndw = 0;
+        }
+      else if (findstate->seen_afxwndw && !strcmp (buf, "AfxWndW"))
+        {
+          findstate->seen_afxwndw = 1;
+        }
+      else if (findstate->seen_32770 && findstate->seen_afxwndw
+               && !strcmp (buf, "RichEdit20W"))
+        {
+          log_debug ("found window class `%s' at level %d", 
+                     "RichEdit20W", findstate->level);
           return child;
         }
       
-      memset (buf, 0, sizeof (buf));
-      GetWindowText (child, buf, sizeof (buf)-1);
-      len = strlen (buf);
-      if (len > 22
-          && (s = strstr (buf, "-----BEGIN PGP "))
-          &&  (!strncmp (s+15, "MESSAGE-----", 12)
-               || !strncmp (s+15, "SIGNED MESSAGE-----", 19)))
-        return child;
-      w = find_message_window (child, level+1);
+      findstate->level++;
+      w = find_message_window (child, findstate);
+      findstate->level--;
+      findstate->seen_32770 = 0;  /* Only interested in windows below.  */
+      findstate->seen_afxwndw = 0;
       if (w)
         return w;
-      child = GetNextWindow (child, GW_HWNDNEXT);	
+      child = GetNextWindow (child, GW_HWNDNEXT);
     }
 
   return NULL;
 }
 
 
+/* Returns true if the the current display (as described by HWND) is a
+   real inspector and not the preview window.  This is not 100%
+   reliable. */
+int
+is_inspector_display (HWND hwnd)
+{
+  struct find_message_window_state findstate;
+
+  memset (&findstate, 0, sizeof findstate);
+  return !!find_message_window (hwnd, &findstate);
+}
+
+
 /* Update the display with TEXT using the message MSG.  Return 0 on
    success. */
 int
-update_display (HWND hwnd, void *exchange_cb, 
+update_display (HWND hwnd, void *exchange_cb, int is_sensitive,
                 bool is_html, const char *text)
 {
   HWND window;
+  struct find_message_window_state findstate;
 
-  /*show_window_hierarchy (hwnd, 0);*/
-  window = find_message_window (hwnd, 0);
+  memset (&findstate, 0, sizeof findstate);
+  window = find_message_window (hwnd, &findstate);
   if (window && !is_html)
     {
       const char *s;
 
-      log_debug ("%s:%s: window handle %p\n", SRCNAME, __func__, window);
+      log_debug ("%s:%s: updating display using handle %p\n",
+                 SRCNAME, __func__, window);
       
       /* Decide whether we need to use the Unicode version. */
       for (s=text; *s && !(*s & 0x80); s++)
@@ -201,10 +236,18 @@
         }
       else
         SetWindowTextA (window, text);
-      log_debug ("%s:%s: window text is now `%s'",
-                 SRCNAME, __func__, text);
       return 0;
     }
+//   else if (exchange_cb && is_sensitive && !opt.compat.no_oom_write)
+//     {
+//       log_debug ("%s:%s: updating display using OOM (note)\n", 
+//                  SRCNAME, __func__);
+//       if (is_html)
+//         put_outlook_property (exchange_cb, "Body", "" );
+//       return put_outlook_property
+//         (exchange_cb, "Body",
+//          _("[Encrypted body not shown - please open the message]"));
+//     }
   else if (exchange_cb && !opt.compat.no_oom_write)
     {
       log_debug ("%s:%s: updating display using OOM\n", SRCNAME, __func__);
@@ -213,7 +256,7 @@
       if (is_html)
         put_outlook_property (exchange_cb, "Body", "" );
       return put_outlook_property (exchange_cb, is_html? "HTMLBody":"Body",
-                                   text);
+                                 text);
     }
   else
     {
@@ -224,58 +267,61 @@
 }
 
 
+
 /* Set the body of MESSAGE to STRING.  Returns 0 on success or an
    error code otherwise. */
-int
-set_message_body (LPMESSAGE message, const char *string, bool is_html)
-{
-  HRESULT hr;
-  SPropValue prop;
-  //SPropTagArray proparray;
-  const char *s;
+#if 0 /* Not anymore used.  */
+  int
+  set_message_body (LPMESSAGE message, const char *string, bool is_html)
+  {
+    HRESULT hr;
+    SPropValue prop;
+    //SPropTagArray proparray;
+    const char *s;
+    
+    assert (message);
   
-  assert (message);
-
-//   if (!is_html)
-//     {
-//       prop.ulPropTag = PR_BODY_HTML_A;
-//       prop.Value.lpszA = "";
-//       hr = HrSetOneProp (message, &prop);
-//     }
+  //   if (!is_html)
+  //     {
+  //       prop.ulPropTag = PR_BODY_HTML_A;
+  //       prop.Value.lpszA = "";
+  //       hr = HrSetOneProp (message, &prop);
+  //     }
+    
+    /* Decide whether we need to use the Unicode version. */
+    for (s=string; *s && !(*s & 0x80); s++)
+      ;
+    if (*s)
+      {
+        prop.ulPropTag = is_html? PR_BODY_HTML_W : PR_BODY_W;
+        prop.Value.lpszW = utf8_to_wchar (string);
+        hr = HrSetOneProp (message, &prop);
+        xfree (prop.Value.lpszW);
+      }
+    else /* Only plain ASCII. */
+      {
+        prop.ulPropTag = is_html? PR_BODY_HTML_A : PR_BODY_A;
+        prop.Value.lpszA = (CHAR*)string;
+        hr = HrSetOneProp (message, &prop);
+      }
+    if (hr != S_OK)
+      {
+        log_debug ("%s:%s: HrSetOneProp failed: hr=%#lx\n",
+                   SRCNAME, __func__, hr); 
+        return gpg_error (GPG_ERR_GENERAL);
+      }
   
-  /* Decide whether we need to use the Unicode version. */
-  for (s=string; *s && !(*s & 0x80); s++)
-    ;
-  if (*s)
-    {
-      prop.ulPropTag = is_html? PR_BODY_HTML_W : PR_BODY_W;
-      prop.Value.lpszW = utf8_to_wchar (string);
-      hr = HrSetOneProp (message, &prop);
-      xfree (prop.Value.lpszW);
-    }
-  else /* Only plain ASCII. */
-    {
-      prop.ulPropTag = is_html? PR_BODY_HTML_A : PR_BODY_A;
-      prop.Value.lpszA = (CHAR*)string;
-      hr = HrSetOneProp (message, &prop);
-    }
-  if (hr != S_OK)
-    {
-      log_debug ("%s:%s: HrSetOneProp failed: hr=%#lx\n",
-                 SRCNAME, __func__, hr); 
-      return gpg_error (GPG_ERR_GENERAL);
-    }
+    /* Note: we once tried to delete the RTF property here to avoid any
+       syncing mess and more important to make sure that no RTF rendered
+       plaintext is left over.  The side effect of this was that the
+       entire PR_BODY got deleted too. */
+  
+    return 0;
+  }
+#endif /* Not anymore used.  */
 
-  /* Note: we once tried to delete the RTF property here to avoid any
-     syncing mess and more important to make sure that no RTF rendered
-     plaintext is left over.  The side effect of this was that the
-     entire PR_BODY got deleted too. */
 
-  return 0;
-}
 
-
-
 int
 open_inspector (LPEXCHEXTCALLBACK peecb, LPMESSAGE message)
 {

Modified: trunk/src/display.h
===================================================================
--- trunk/src/display.h	2008-04-04 14:18:04 UTC (rev 245)
+++ trunk/src/display.h	2008-04-15 15:32:15 UTC (rev 246)
@@ -24,7 +24,8 @@
 
 char *add_html_line_endings (const char *body);
 
-int update_display (HWND hwnd, void *exchange_cb,
+int is_inspector_display (HWND hwnd);
+int update_display (HWND hwnd, void *exchange_cb, int is_sensitive,
                     bool is_html, const char *text);
 
 int set_message_body (LPMESSAGE message, const char *string, bool is_html);

Modified: trunk/src/ext-commands.cpp
===================================================================
--- trunk/src/ext-commands.cpp	2008-04-04 14:18:04 UTC (rev 245)
+++ trunk/src/ext-commands.cpp	2008-04-15 15:32:15 UTC (rev 246)
@@ -102,9 +102,7 @@
   m_nCmdProtoPgpmime = 0;
   m_nCmdProtoSmime = 0;
   m_nCmdEncrypt = 0;  
-  m_nCmdDecrypt = 0;  
   m_nCmdSign = 0; 
-  m_nCmdCheckSig = 0;
   m_nCmdKeyManager = 0;
   m_nCmdCryptoState = 0;
   m_nCmdDebug0 = 0;
@@ -212,7 +210,30 @@
                  MF_BYCOMMAND | (checked?MF_CHECKED:MF_UNCHECKED));
 }
 
+void
+GpgolExtCommands::update_protocol_menu (LPEXCHEXTCALLBACK eecb)
+{
+  switch (m_pExchExt->m_protoSelection)
+    {
+    case PROTOCOL_OPENPGP:
+      check_menu (eecb, m_nCmdProtoAuto, FALSE);
+      check_menu (eecb, m_nCmdProtoPgpmime, TRUE);
+      check_menu (eecb, m_nCmdProtoSmime, FALSE);
+      break;
+    case PROTOCOL_SMIME:
+      check_menu (eecb, m_nCmdProtoAuto, FALSE);
+      check_menu (eecb, m_nCmdProtoPgpmime, FALSE);
+      check_menu (eecb, m_nCmdProtoSmime, TRUE);
+      break;
+    default:
+      check_menu (eecb, m_nCmdProtoAuto, TRUE);
+      check_menu (eecb, m_nCmdProtoPgpmime, FALSE);
+      check_menu (eecb, m_nCmdProtoSmime, FALSE);
+      break;
+    }
+}
 
+
 void
 GpgolExtCommands::add_toolbar (LPTBENTRY tbearr, UINT n_tbearr, ...)
 {
@@ -379,7 +400,6 @@
               && (body = msgcache_get (key, keylen, &refhandle)) 
               && (pDisp = find_outlook_property (eecb, "Body", &dispid)))
             {
-#if 1
               dispparams.cNamedArgs = 1;
               dispparams.rgdispidNamedArgs = &dispid_put;
               dispparams.cArgs = 1;
@@ -392,10 +412,7 @@
               xfree (dispparams.rgvarg[0].bstrVal);
               log_debug ("%s:%s: PROPERTYPUT(body) result -> %#lx\n",
                          SRCNAME, __func__, hr);
-#else
-              log_window_hierarchy (hWnd, "%s:%s:%d: Windows hierarchy:",
-                                    SRCNAME, __func__, __LINE__);
-#endif
+
               pDisp->Release();
               pDisp = NULL;
               
@@ -416,7 +433,7 @@
   /* Now install menu and toolbar items.  */
   if (m_lContext == EECONTEXT_READNOTEMESSAGE)
     {
-      int need_dvm = 0;
+      int is_encrypted = 0;
       LPMDB mdb = NULL;
       LPMESSAGE message = NULL;
 
@@ -430,7 +447,7 @@
             case MSGTYPE_GPGOL_MULTIPART_ENCRYPTED:
             case MSGTYPE_GPGOL_OPAQUE_ENCRYPTED:
             case MSGTYPE_GPGOL_PGP_MESSAGE:
-              need_dvm = 1;
+              is_encrypted = 1;
               break;
             default:
               break;
@@ -443,17 +460,15 @@
          an already decrypted message. */
       add_menu (eecb, pnCommandIDBase,
         "@", NULL,
-        need_dvm? _("&Decrypt and verify message"):"", &m_nCmdDecrypt,
-        _("&Verify signature"), &m_nCmdCheckSig,
+        _("GpgOL Decrypt/Verify"), &m_nCmdCryptoState,
         opt.enable_debug? "GpgOL Debug-0 (display crypto info)":"", 
                 &m_nCmdDebug0,
         opt.enable_debug? "GpgOL Debug-1 (open_inspector)":"", &m_nCmdDebug1,
         opt.enable_debug? "GpgOL Debug-2 (change msg class)":"", &m_nCmdDebug2,
         NULL);




More information about the Gnupg-commits mailing list