[svn] GpgOL - r247 - in trunk: . po src

svn author wk cvs at cvs.gnupg.org
Wed Apr 16 20:20:40 CEST 2008


Author: wk
Date: 2008-04-16 20:20:37 +0200 (Wed, 16 Apr 2008)
New Revision: 247

Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/configure.ac
   trunk/po/de.po
   trunk/po/sv.po
   trunk/src/ChangeLog
   trunk/src/ext-commands.cpp
   trunk/src/message-events.cpp
   trunk/src/message-events.h
   trunk/src/message.cpp
   trunk/src/message.h
Log:
Preparing a release


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-04-15 15:32:15 UTC (rev 246)
+++ trunk/ChangeLog	2008-04-16 18:20:37 UTC (rev 247)
@@ -1,3 +1,7 @@
+2008-04-16  Werner Koch  <wk at g10code.com>
+
+	* Release 0.10.12.
+
 2008-04-04  Werner Koch  <wk at g10code.com>
 
 	* Release 0.10.11.

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-04-15 15:32:15 UTC (rev 246)
+++ trunk/src/ChangeLog	2008-04-16 18:20:37 UTC (rev 247)
@@ -1,3 +1,11 @@
+2008-04-16  Werner Koch  <wk at g10code.com>
+
+	* message-events.h (class GpgolMessageEvents): Add M_GOTINSPECTOR.
+	* message.cpp (message_incoming_handler): Change return type.
+
+	* ext-commands.cpp (check_toolbar, check_menu_toolbar): New.
+	(update_protocol_menu): Explicitly update the toolbar.
+
 2008-04-15  Werner Koch  <wk at g10code.com>
 
 	* Outlook.gpl: New.

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2008-04-15 15:32:15 UTC (rev 246)
+++ trunk/NEWS	2008-04-16 18:20:37 UTC (rev 247)
@@ -1,7 +1,15 @@
+Noteworthy changes for version 0.10.12 (2008-04-16)
+===================================================
+
+ * Added icons. 
+
+ * Minor usuability changes.
+
+
 Noteworthy changes for version 0.10.11 (2008-04-04)
 ===================================================
 
- * Fixed a performavce problem with signed+encrypted.
+ * Fixed a performance problem with signed+encrypted.
 
 
 Noteworthy changes for version 0.10.10 (2008-04-02)

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2008-04-15 15:32:15 UTC (rev 246)
+++ trunk/configure.ac	2008-04-16 18:20:37 UTC (rev 247)
@@ -16,7 +16,7 @@
 # Remember to change the version number immediately *after* a release.
 # Set my_issvn to "yes" for non-released code.  Remember to run an
 # "svn up" and "autogen.sh" right before creating a distribution.
-m4_define([my_version], [0.10.11])
+m4_define([my_version], [0.10.12])
 m4_define([my_issvn], [no])
 
 m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \

Modified: trunk/po/de.po  [not shown]
Modified: trunk/po/sv.po  [not shown]
Modified: trunk/src/ext-commands.cpp
===================================================================
--- trunk/src/ext-commands.cpp	2008-04-15 15:32:15 UTC (rev 246)
+++ trunk/src/ext-commands.cpp	2008-04-16 18:20:37 UTC (rev 247)
@@ -21,6 +21,7 @@
 #include <config.h>
 #endif
 
+#define _WIN32_IE 0x400 /* Need TBIF_COMMAND et al.  */
 #include <windows.h>
 
 #include "mymapi.h"
@@ -55,6 +56,7 @@
   UINT cmd_id;   /* The ID of the command to send on a click.  */
   const char *desc;/* The description text.  */
   ULONG context; /* Context under which this entry will be used.  */ 
+  int did_qbi;   /* Has been processed by QueryButtonInfo.  */
 };
 
 
@@ -210,25 +212,85 @@
                  MF_BYCOMMAND | (checked?MF_CHECKED:MF_UNCHECKED));
 }
 
+
+static void
+check_toolbar (LPEXCHEXTCALLBACK eecb, struct toolbar_info_s *toolbar_info,
+               UINT cmd_id, int checked)
+{
+  HWND hwnd;
+  toolbar_info_t tb_info;
+  TBBUTTONINFOA tbb;
+
+  eecb->GetToolbar (EETBID_STANDARD, &hwnd);
+  if (debug_commands)
+    log_debug ("check_toolbar: eecb=%p cmd_id=%u checked=%d -> hwnd=%p\n", 
+               eecb, cmd_id, checked, hwnd);
+
+  for (tb_info = toolbar_info; tb_info; tb_info = tb_info->next )
+    if (tb_info->cmd_id == cmd_id)
+      break;
+  if (!tb_info)
+    {
+      log_error ("check_toolbar: no such toolbar button");
+      return;
+    }
+  if (!tb_info->did_qbi)
+    {
+      if(debug_commands)
+        log_debug ("check_toolbar: button(cmd_id=%d) not yet initialized",
+                   cmd_id);
+      return;
+    }
+
+  tbb.cbSize = sizeof (tbb);
+  tbb.dwMask = TBIF_COMMAND | TBIF_STATE | TBIF_STYLE;
+  if (!SendMessage (hwnd, TB_GETBUTTONINFO, cmd_id, (LPARAM)&tbb))
+    log_error_w32 (-1, "TB_GETBUTTONINFO failed");
+  else
+    {
+      tbb.cbSize = sizeof (tbb);
+      tbb.dwMask = TBIF_STATE;
+      if (checked)
+        tbb.fsState |= TBSTATE_CHECKED;
+      else
+        tbb.fsState &= ~TBSTATE_CHECKED;
+      if (!SendMessage (hwnd, TB_SETBUTTONINFO, cmd_id, (LPARAM)&tbb))
+        log_error_w32 (-1, "TB_SETBUTTONINFO failed");
+    }
+}
+
+
+static void
+check_menu_toolbar (LPEXCHEXTCALLBACK eecb,
+                    struct toolbar_info_s *toolbar_info,
+                    UINT cmd_id, int checked)
+{
+  check_menu (eecb, cmd_id, checked);
+  check_toolbar (eecb, toolbar_info, cmd_id, checked);
+}
+
+
 void
 GpgolExtCommands::update_protocol_menu (LPEXCHEXTCALLBACK eecb)
 {
+  if (debug_commands)
+    log_debug ("update_protocol_menu called\n");
   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);
+      check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoAuto, FALSE);
+      check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoPgpmime, TRUE);
+      check_menu_toolbar (eecb, m_toolbar_info, 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);
+      check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoAuto, FALSE);
+      check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoPgpmime, FALSE);
+      check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoSmime, TRUE);
       break;
     default:
-      check_menu (eecb, m_nCmdProtoAuto, TRUE);
-      check_menu (eecb, m_nCmdProtoPgpmime, FALSE);
-      check_menu (eecb, m_nCmdProtoSmime, FALSE);
+      check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoAuto, TRUE);
+      check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoPgpmime, FALSE);
+      check_menu_toolbar (eecb, m_toolbar_info, m_nCmdProtoSmime, FALSE);
       break;
     }
 }
@@ -267,6 +329,11 @@
 
       if (!*desc)
         ; /* Empty description - ignore this item.  */
+      else if (*desc == '|' && !desc[1])
+        {
+          /* Separator. Ignore BMAPID and CMDID.  */
+          /* Not yet implemented.  */
+        }
       else
 	{
           TBADDBITMAP tbab;
@@ -290,10 +357,10 @@
             log_debug ("%s:%s: ctx=%lx button_id=%d cmd_id=%d '%s'\n", 
                        SRCNAME, __func__, m_lContext,
                        tb_info->button_id, tb_info->cmd_id, tb_info->desc);
-          
         }
     }
   va_end (arg_ptr);
+
 }
 
 
@@ -690,9 +757,6 @@
     {
       log_debug ("%s:%s: command Debug0 (showInfo) called\n",
                  SRCNAME, __func__);
-//       log_window_hierarchy (GetDesktopWindow(),
-//                             "%s:%s:%d: Window hierarchy:",
-//                             SRCNAME, __func__, __LINE__);
       hr = eecb->GetObject (&mdb, (LPMAPIPROP *)&message);
       if (SUCCEEDED (hr))
         {
@@ -888,7 +952,7 @@
 
 /* Called by Exchange to get toolbar button infos.  TOOLBARID is the
    toolbar identifier.  BUTTONID is the toolbar button index.  PTBB is
-   a pointer to toolbar button structure.  DESCRIPTION is a pointer to
+   a pointer to the toolbar button structure.  DESCRIPTION is a pointer to
    buffer receiving the text for the button.  DESCRIPTION_SIZE is the
    maximum size of DESCRIPTION.  FLAGS are flags which might have the
    EXCHEXT_UNICODE bit set.
@@ -915,6 +979,9 @@
                " cmd_id=%d '%s'\n", 
                SRCNAME, __func__, m_lContext, toolbarid, buttonid,
                tb_info->button_id, tb_info->cmd_id, tb_info->desc);
+
+  /* Mark that this button has passed this function.  */
+  tb_info->did_qbi = 1;
   
   pTBB->iBitmap = tb_info->bitmap;
   pTBB->idCommand = tb_info->cmd_id;

Modified: trunk/src/message-events.cpp
===================================================================
--- trunk/src/message-events.cpp	2008-04-15 15:32:15 UTC (rev 246)
+++ trunk/src/message-events.cpp	2008-04-16 18:20:37 UTC (rev 247)
@@ -73,6 +73,7 @@
   m_want_html = false;
   m_processed = false;
   m_wasencrypted = false;
+  m_gotinspector = false;
 }
 
 
@@ -107,17 +108,15 @@
   HWND hwnd = NULL;
   LPMDB mdb = NULL;
   LPMESSAGE message = NULL;
-  int got_inspector = 0;
   
   m_wasencrypted = false;
   if (FAILED (eecb->GetWindow (&hwnd)))
     hwnd = NULL;
 
-  if (is_inspector_display (hwnd))
-    got_inspector = 1;
+  m_gotinspector = !!is_inspector_display (hwnd);
 
   log_debug ("%s:%s: received (hwnd=%p) %s\n", 
-             SRCNAME, __func__, hwnd, got_inspector? "got_inspector":"");
+             SRCNAME, __func__, hwnd, m_gotinspector? "got_inspector":"");
 
   /* Fixme: If preview decryption is not enabled and we have an
      encrypted message, we might want to show a greyed out preview
@@ -128,11 +127,22 @@
        shows a grey window with a notice that the message can't be 
        shown due to active content.  */  
 
-  if (got_inspector || opt.preview_decrypt)
+  if (m_gotinspector || opt.preview_decrypt)
     {
       eecb->GetObject (&mdb, (LPMAPIPROP *)&message);
-      if (message_incoming_handler (message, hwnd, false))
-        m_processed = true;
+      switch (message_incoming_handler (message, hwnd, false))
+        {
+        case 1: 
+          m_processed = true;
+          break;
+        case 2: 
+          m_processed = true;
+          m_wasencrypted = true;
+          break;
+        default:
+          ;
+        }
+      
       ul_release (message, __func__, __LINE__);
       ul_release (mdb, __func__, __LINE__);
     }
@@ -159,8 +169,7 @@
       if (FAILED (eecb->GetWindow (&hwnd)))
         hwnd = NULL;
       log_debug ("%s:%s: (hwnd=%p)\n", SRCNAME, __func__, hwnd);
-      if (message_display_handler (eecb, hwnd))
-        m_wasencrypted = true;
+      message_display_handler (eecb, hwnd);
     }
   
 

Modified: trunk/src/message-events.h
===================================================================
--- trunk/src/message-events.h	2008-04-15 15:32:15 UTC (rev 246)
+++ trunk/src/message-events.h	2008-04-16 18:20:37 UTC (rev 247)
@@ -42,6 +42,7 @@
   bool    m_want_html;       /* Encryption of HTML is desired. */
   bool    m_processed;       /* The message has been porcessed by us.  */
   bool    m_wasencrypted;    /* The original message was encrypted.  */
+  bool    m_gotinspector;    /* We are working on a real inspector.  */
   
  public:
   STDMETHODIMP QueryInterface (REFIID riid, LPVOID *ppvObj);

Modified: trunk/src/message.cpp
===================================================================
--- trunk/src/message.cpp	2008-04-15 15:32:15 UTC (rev 246)
+++ trunk/src/message.cpp	2008-04-16 18:20:37 UTC (rev 247)
@@ -54,12 +54,15 @@
 
 /* A helper function used by OnRead and OnOpen to dispatch the
    message.  If FORCE is true, the force flag is passed to the
-   verification or decryption.  Returns true if the message has been
-   processed.  */
-bool
+   verification or decryption.  Returns:
+     0 = Message has not been processed by us.
+     1 = Message has been processed and was not encrypted.
+     2 = Message has been processed by us and was possibly encrypted.
+*/
+int
 message_incoming_handler (LPMESSAGE message, HWND hwnd, bool force)
 {
-  bool retval = false;
+  int retval = 0;
   msgtype_t msgtype;
   int pass = 0;
 
@@ -101,36 +104,36 @@
     case MSGTYPE_GPGOL_MULTIPART_SIGNED:
       log_debug ("%s:%s: processing multipart signed message\n", 
                  SRCNAME, __func__);
-      retval = true;
+      retval = 1;
       message_verify (message, msgtype, force, hwnd);
       break;
     case MSGTYPE_GPGOL_MULTIPART_ENCRYPTED:
       log_debug ("%s:%s: processing multipart encrypted message\n",
                  SRCNAME, __func__);
-      retval = true;
+      retval = 2;
       message_decrypt (message, msgtype, force, hwnd);
       break;
     case MSGTYPE_GPGOL_OPAQUE_SIGNED:
       log_debug ("%s:%s: processing opaque signed message\n", 
                  SRCNAME, __func__);
-      retval = true;
+      retval = 1;
       message_verify (message, msgtype, force, hwnd);
       break;
     case MSGTYPE_GPGOL_CLEAR_SIGNED:
       log_debug ("%s:%s: processing clear signed pgp message\n", 
                  SRCNAME, __func__);
-      retval = true;
+      retval = 1;
       message_verify (message, msgtype, force, hwnd);
       break;
     case MSGTYPE_GPGOL_OPAQUE_ENCRYPTED:
       log_debug ("%s:%s: processing opaque encrypted message\n",
                  SRCNAME, __func__);
-      retval = true;
+      retval = 2;
       message_decrypt (message, msgtype, force, hwnd);
       break;
     case MSGTYPE_GPGOL_PGP_MESSAGE:
       log_debug ("%s:%s: processing pgp message\n", SRCNAME, __func__);
-      retval = true;
+      retval = 2;
       message_decrypt (message, msgtype, force, hwnd);
       break;
     }

Modified: trunk/src/message.h
===================================================================
--- trunk/src/message.h	2008-04-15 15:32:15 UTC (rev 246)
+++ trunk/src/message.h	2008-04-16 18:20:37 UTC (rev 247)
@@ -21,7 +21,7 @@
 #define MESSAGE_H
 
 
-bool message_incoming_handler (LPMESSAGE message, HWND hwnd, bool force);
+int message_incoming_handler (LPMESSAGE message, HWND hwnd, bool force);
 bool message_display_handler (LPEXCHEXTCALLBACK eecb, HWND hwnd);
 void message_wipe_body_cruft (LPEXCHEXTCALLBACK eecb);
 void message_show_info (LPMESSAGE message, HWND hwnd);




More information about the Gnupg-commits mailing list