[git] GpgOL - branch, outlook14, updated. gpgol-1.1.3-27-g532d741

by Andre Heinecke cvs at cvs.gnupg.org
Fri Jul 12 15:52:10 CEST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, outlook14 has been updated
       via  532d7417713e4f3ac9ad4db011fbe117e0fa15de (commit)
      from  e343c1843b4103749e20796aea94e90035a61bf5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 532d7417713e4f3ac9ad4db011fbe117e0fa15de
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Jul 12 13:25:51 2013 +0000

    Handle fileextensions in save attachment dialog
    
        If the filename has an extension add it as the first filter
        entry.
    
        * src/common.c (get_save_filename): Add file extension as Filter.
        Generalize dialog title.
    
    --
        This is important because it is now used to save an encrypted
        attachment and call decrypt files on that file file afterwards.
        For SMIME the file extension is then important.

diff --git a/src/common.c b/src/common.c
index 549d768..ec8c370 100644
--- a/src/common.c
+++ b/src/common.c
@@ -197,14 +197,29 @@ get_system_check_bitmap (int checked)
 char *
 get_save_filename (HWND root, const char *srcname)
 {
-  char filter[] = "All Files (*.*)\0*.*\0\0";
+  char filter[21] = "All Files (*.*)\0*.*\0\0";
   char fname[MAX_PATH+1];
+  char filterBuf[32];
+  char* extSep;
   OPENFILENAME ofn;
 
   memset (fname, 0, sizeof (fname));
+  memset (filterBuf, 0, sizeof (filterBuf));
   strncpy (fname, srcname, MAX_PATH-1);
   fname[MAX_PATH] = 0;
 
+  if ((extSep = strrchr (srcname, '.')) && strlen (extSep) <= 4)
+    {
+      /* Windows removes the file extension by default so we
+         need to set the first filter to the file extension.
+      */
+      strcpy (filterBuf, extSep);
+      strcpy (filterBuf + strlen (filterBuf) + 1, extSep);
+      memcpy (filterBuf + strlen (extSep) * 2 + 2, filter, 21);
+    }
+  else
+    memcpy (filterBuf, filter, 21);
+
 
   memset (&ofn, 0, sizeof (ofn));
   ofn.lStructSize = sizeof (ofn);
@@ -214,8 +229,8 @@ get_save_filename (HWND root, const char *srcname)
   ofn.lpstrFileTitle = NULL;
   ofn.nMaxFileTitle = 0;
   ofn.Flags |= OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
-  ofn.lpstrTitle = _("GpgOL - Save decrypted attachment");
-  ofn.lpstrFilter = filter;
+  ofn.lpstrTitle = _("GpgOL - Save attachment");
+  ofn.lpstrFilter = filterBuf;
 
   if (GetSaveFileName (&ofn))
     return xstrdup (fname);

-----------------------------------------------------------------------

Summary of changes:
 src/common.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list