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

svn author wk cvs at cvs.gnupg.org
Mon Mar 31 18:29:56 CEST 2008


Author: wk
Date: 2008-03-31 18:29:54 +0200 (Mon, 31 Mar 2008)
New Revision: 241

Modified:
   trunk/TODO
   trunk/po/de.po
   trunk/po/sv.po
   trunk/src/ChangeLog
   trunk/src/config-dialog.c
   trunk/src/dialogs.h
   trunk/src/dialogs.rc
   trunk/src/ext-commands.cpp
   trunk/src/ext-commands.h
   trunk/src/message.cpp
   trunk/src/olflange-dlgs.cpp
   trunk/src/olflange.cpp
Log:
Visual cleanups.


[The diff below has been truncated]

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-03-26 16:14:14 UTC (rev 240)
+++ trunk/src/ChangeLog	2008-03-31 16:29:54 UTC (rev 241)
@@ -1,3 +1,28 @@
+2008-03-31  Werner Koch  <wk at g10code.com>
+
+	* ext-commands.h (class GpgolExtCommands): Add m_nCmdCryptoState.
+	* ext-commands.cpp (InstallCommands): Add a toolbar crypto state
+	button.
+	(DoCommand): Show a message when trying to select the disabled
+	S/MIME protocol.
+
+	* message.cpp (message_sign, message_verify, message_decrypt) 
+	(sign_encrypt): Display message boxes only in debug mode.
+
+	* olflange-dlgs.cpp: Remove G-Data 2001 copyright because all that
+	old code has gone.
+
+	* dialogs.rc (IDD_EXT_OPTIONS): Remove option to select the key
+	manager.
+	(IDD_GPG_OPTIONS): Remove caching time, reorder options, add group
+	boxes.
+	* olflange-dlgs.cpp (GPGOptionsDlgProc): Clean up accordingly.
+	* config-dialog.c (config_dlg_proc): Ditto.
+	(get_open_file_name, does_file_exist, error_box): Remove.
+
+	* ext-commands.cpp: Rename nCmdShowInfo to nCmdDebug0 and enable
+	it only in debug mode.
+
 2008-03-26  Werner Koch  <wk at g10code.com>
 
 	* engine-gpgme.c (cleanup): Implement.

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2008-03-26 16:14:14 UTC (rev 240)
+++ trunk/TODO	2008-03-31 16:29:54 UTC (rev 241)
@@ -1,7 +1,3 @@
-* Show more details in case of some errors.
-  For example 'No Secret Key' should contain the key-ID
-  and if possible the primary user-ID.
-
 * Find out why sometimes the new body cannot set to a MAPI object. In
   this case the body is empty but the W32 API said it was correctly set.
   This might be due to the length of the object.  HrGetOneProp has
@@ -9,11 +5,6 @@
   same holds true for HrSetOneProp.  We might want to use OpenProperty
   for longer texts.
 
-* Hook into OnDelivery and rename attachments named like the
-  Attestation attachment we generate locally.  We might also want to
-  detect whether this is an encrypted message and change the
-  MessageClass accordingly.
-
 * Allow for symmetric encryption.
 
 * Please consider adding a few more options like key signing rules

Modified: trunk/po/de.po  [not shown]
Modified: trunk/po/sv.po  [not shown]
Modified: trunk/src/config-dialog.c
===================================================================
--- trunk/src/config-dialog.c	2008-03-26 16:14:14 UTC (rev 240)
+++ trunk/src/config-dialog.c	2008-03-31 16:29:54 UTC (rev 241)
@@ -1,5 +1,5 @@
 /* config-dialog.c
- *	Copyright (C) 2005 g10 Code GmbH
+ *	Copyright (C) 2005, 2008 g10 Code GmbH
  *	Copyright (C) 2003 Timo Schulz
  *
  * This file is part of GpgOL.
@@ -37,69 +37,8 @@
 /* Registry path to store plugin settings */
 #define GPGOL_REGPATH "Software\\GNU\\GpgOL"
 
-static char*
-get_open_file_name (const char *dir, const char *title)
-{
-  static char fname[MAX_PATH+1];
-  OPENFILENAME ofn;
 
-  memset (&ofn, 0, sizeof (ofn));
-  memset (fname, 0, sizeof (fname));
-  ofn.hwndOwner = GetDesktopWindow ();
-  ofn.hInstance = glob_hinst;
-  ofn.Flags = OFN_FILEMUSTEXIST;
-  ofn.lpstrTitle = title;
-  ofn.lStructSize = sizeof (ofn);
-  ofn.lpstrInitialDir = dir;
-  ofn.lpstrFilter = "EXE-Files (*.EXE)\0*.EXE\0\0";
-  ofn.lpstrFile = fname;
-  ofn.nMaxFile = sizeof (fname)-1;
-  if (GetOpenFileName (&ofn) == FALSE)
-    return NULL;
-  return fname;
-}
-
-
-#if 0
-static void 
-SHFree (void *p) 
-{         
-    IMalloc *pm;         
-    SHGetMalloc (&pm);
-    if (pm) {
-	pm->lpVtbl->Free(pm,p);
-	pm->lpVtbl->Release(pm);         
-    } 
-} 
-#endif
-
-#if 0
-/* Open the common dialog to select a folder. Caller has to free the string. */
 static char*
-get_folder (const char *title)
-{
-  char fname[MAX_PATH+1];
-  BROWSEINFO bi;
-  ITEMIDLIST * il;
-  char *path = NULL;
-
-  memset (&bi, 0, sizeof (bi));
-  memset (fname, 0, sizeof (fname));
-  bi.hwndOwner = GetDesktopWindow ();
-  bi.lpszTitle = title;
-  il = SHBrowseForFolder (&bi);
-  if (il != NULL)
-    {
-      SHGetPathFromIDList (il, fname);
-      path = xstrdup (fname);
-      SHFree (il);
-    }
-  return path;
-}
-#endif
-
-
-static char*
 expand_path (const char *path)
 {
     DWORD len;
@@ -188,78 +127,6 @@
 }
 
 
-#if 0
-static int
-does_folder_exist (const char *path)
-{
-    int attrs = GetFileAttributes (path);
-    int err = 0;
-
-    if (attrs == 0xFFFFFFFF)
-	err = -1;
-    else if (!(attrs & FILE_ATTRIBUTE_DIRECTORY))
-	err = -1;
-    if (err != 0) {
-	const char *fmt = "\"%s\" either does not exist or is not a directory";
-	char *p = xmalloc (strlen (fmt) + strlen (path) + 2 + 2);
-	sprintf (p, fmt, path);
-	MessageBox (NULL, p, "Config Error", MB_ICONERROR|MB_OK);
-	xfree (p);
-    }
-    return err;
-}
-#endif
-
-static int
-does_file_exist (const char *name, int is_file)
-{
-    struct stat st;
-    const char *s;
-    char *p, *name2;
-    int err = 0;
-
-    /* check WinPT specific flags */
-    if ((p=strstr (name, "--keymanager"))) {
-	name2 = xcalloc (1, (p-name)+2);
-	strncpy (name2, name, (p-name)-1);
-    }
-    else
-	name2 = xstrdup (name);
-
-    if (stat (name2, &st) == -1) {
-	s = "\"%s\" does not exist.";
-	p = xmalloc (strlen (s) + strlen (name2) + 2);
-	sprintf (p, s, name2);
-	MessageBox (NULL, p, "Config Error", MB_ICONERROR|MB_OK);
-	err = -1;
-    }
-    else if (is_file && !(st.st_mode & _S_IFREG)) {
-	s = "\"%s\" is not a regular file.";
-	p = xmalloc (strlen (s) + strlen (name2) + 2);
-	sprintf (p, s, name2);
-	MessageBox (NULL, p, "Config Error", MB_ICONERROR|MB_OK);
-	err = -1;
-    }
-    xfree (name2);
-    xfree (p);
-    return err;
-}
-
-
-static void
-error_box (const char *title)
-{	
-  TCHAR buf[256];
-  DWORD last_err;
-
-  last_err = GetLastError ();
-  FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, last_err, 
-                 MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), 
-                 buf, sizeof (buf)-1, NULL);
-  MessageBox (NULL, buf, title, MB_OK);
-}
-
-
 /* To avoid writing a dialog template for each language we use gettext
    for the labels and hope that there is enough space in the dialog to
    fit teh longest translation.  */
@@ -267,7 +134,6 @@
 config_dlg_set_labels (HWND dlg)
 {
   static struct { int itemid; const char *label; } labels[] = {
-    { IDC_T_OPT_KEYMAN_PATH,    N_("Path to certificate manager binary")},
     { IDC_T_DEBUG_LOGFILE,  N_("Debug output (for analysing problems)")},
     { 0, NULL}
   };
@@ -275,58 +141,38 @@
 
   for (i=0; labels[i].itemid; i++)
     SetDlgItemText (dlg, labels[i].itemid, _(labels[i].label));
-
+  
 }  
 
 static BOOL CALLBACK
 config_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {
-    char *buf = NULL;
-    char name[MAX_PATH+1];
-    int n;
-    const char *s;
-
-    switch (msg) {
+  char name[MAX_PATH+1];
+  int n;
+  const char *s;
+  
+  switch (msg) 
+    {
     case WM_INITDIALOG:
-	center_window (dlg, 0);
-	if (!load_config_value (NULL, REGPATH, "keyManager", &buf)) {
-	    SetDlgItemText (dlg, IDC_OPT_KEYMAN_PATH, buf);
-	    xfree (buf);
-	    buf=NULL;
-	}
-        else
-	    SetDlgItemText (dlg, IDC_OPT_KEYMAN_PATH, "");
-        s = get_log_file ();
-        SetDlgItemText (dlg, IDC_DEBUG_LOGFILE, s? s:"");
-        config_dlg_set_labels (dlg);
-	break;
-
+      center_window (dlg, 0);
+      s = get_log_file ();
+      SetDlgItemText (dlg, IDC_DEBUG_LOGFILE, s? s:"");
+      config_dlg_set_labels (dlg);
+      break;
+      
     case WM_COMMAND:
-	switch (LOWORD (wparam)) {
-	case IDC_OPT_SEL_KEYMAN_PATH:
-	    buf = get_open_file_name (NULL, _("Select Certificate Manager"));
-	    if (buf && *buf)
-		SetDlgItemText (dlg, IDC_OPT_KEYMAN_PATH, buf);
-	    break;
-
+      switch (LOWORD (wparam)) 
+        {
 	case IDOK:
-	    n = GetDlgItemText (dlg, IDC_OPT_KEYMAN_PATH, name, MAX_PATH-1);
-	    if (n > 0) {
-		if (does_file_exist (name, 1))
-		    return FALSE;
-		if (store_config_value (NULL, REGPATH, "keyManager", name))
-		    error_box ("GPG Config");
-	    }
-	    n = GetDlgItemText (dlg, IDC_DEBUG_LOGFILE, name, MAX_PATH-1);
-            set_log_file (n>0?name:NULL);
-
-	    EndDialog (dlg, TRUE);
-	    break;
+          n = GetDlgItemText (dlg, IDC_DEBUG_LOGFILE, name, MAX_PATH-1);
+          set_log_file (n>0?name:NULL);
+          EndDialog (dlg, TRUE);
+          break;
 	}
-	break;
+      break;
     }
-
-    return FALSE;
+  
+  return FALSE;
 }
 
 

Modified: trunk/src/dialogs.h
===================================================================
--- trunk/src/dialogs.h	2008-03-26 16:14:14 UTC (rev 240)
+++ trunk/src/dialogs.h	2008-03-31 16:29:54 UTC (rev 241)
@@ -17,8 +17,9 @@
 #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*/
 
-
 /* Ids used for the main config dialog.  */
 #define IDD_GPG_OPTIONS                 4001
 #define IDC_TIME_PHRASES                4010
@@ -34,17 +35,13 @@
 #define IDC_ENABLE_SMIME                4020
 #define IDC_PREVIEW_DECRYPT             4021
 #define IDC_PREFER_HTML                 4022
-#define IDC_G_OPTIONS                   4023
-#define IDC_G_PASSPHRASE                4024
-#define IDC_T_PASSPHRASE_TTL            4025
-#define IDC_T_PASSPHRASE_MIN            4026
+#define IDC_G_GENERAL                   4023
+#define IDC_G_SEND                      4024
+#define IDC_G_RECV                      4025
 
 
 /* Ids for the extended options dialog.  */
 #define IDD_EXT_OPTIONS                 4101
-#define IDC_T_OPT_KEYMAN_PATH           4110
-#define IDC_OPT_KEYMAN_PATH             4111
-#define IDC_OPT_SEL_KEYMAN_PATH         4112
 #define IDC_T_DEBUG_LOGFILE             4113
 #define IDC_DEBUG_LOGFILE               4114
 

Modified: trunk/src/dialogs.rc
===================================================================
--- trunk/src/dialogs.rc	2008-03-26 16:14:14 UTC (rev 240)
+++ trunk/src/dialogs.rc	2008-03-31 16:29:54 UTC (rev 241)
@@ -35,98 +35,76 @@
 CAPTION "GpgOL"
 FONT 8, "MS Sans Serif"
 BEGIN
-    /* Options box.  */
-    GROUPBOX        "options", IDC_G_OPTIONS,
-                    9, 9, 242, 124
+    /* General options box.  */
+    GROUPBOX        "general-options", IDC_G_GENERAL,
+                    9, 9, 250, 25
 
-    CONTROL         "encrypt-by-default", IDC_ENCRYPT_DEFAULT,
+    CONTROL         "enable-smime", IDC_ENABLE_SMIME,
                     "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
                     24, 19, 215, 10
 
+    /* Send options box.  */
+    GROUPBOX        "send-options", IDC_G_SEND,
+                    9, 40, 250, 58
+
+    CONTROL         "encrypt-by-default", IDC_ENCRYPT_DEFAULT,
+                    "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+                    24, 50, 215, 10
+
     CONTROL         "sign-by-default", IDC_SIGN_DEFAULT, 
                     "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
-                    24, 30, 215, 10
+                    24, 61, 215, 10
 
     CONTROL         "openpgp-by-default", IDC_OPENPGP_DEFAULT,
                     "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
-                    24, 42, 215, 10
+                    24, 72, 215, 10
 
     CONTROL         "smime-by-default", IDC_SMIME_DEFAULT,
                     "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
-                    24, 54, 215, 10
+                    24, 83, 215, 10
 
-    CONTROL         "enable-smime", IDC_ENABLE_SMIME,
-                    "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
-                    24, 66, 215, 10
+    /* Receive options box.  */
+    GROUPBOX        "recv-options", IDC_G_RECV,
+                    9, 104, 250, 36
 
-  /* Note: We epp the spae for now in case we need to add other config
-     options. */
-/*     CONTROL         "encrypt-to", IDC_ENCRYPT_WITH_STANDARD_KEY, */
-/*                     "Button", BS_AUTOCHECKBOX | WS_TABSTOP, */
-/*                     24, 79, 215, 10 */
-
-/*     EDITTEXT        IDC_ENCRYPT_TO,  */
-/*                     36, 91, 133, 12, ES_AUTOHSCROLL */
-
     CONTROL         "preview-decrypt", IDC_PREVIEW_DECRYPT,
                     "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
-                    24, 107, 215, 10
+                    24, 114, 215, 10
 
     CONTROL         "prefer-html", IDC_PREFER_HTML,
                     "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
-                    24, 119, 215, 10
+                    24, 125, 215, 10
  
-    /* Passphrase option box.  */
-    GROUPBOX        "Passphrase", IDC_G_PASSPHRASE,
-                    9, 136, 242, 31
-
-    LTEXT           "passphrase-ttl", IDC_T_PASSPHRASE_TTL,
-                     24, 148, 80, 8
-
-    EDITTEXT        IDC_TIME_PHRASES,
-                    107, 147, 39, 14, ES_AUTOHSCROLL
-
-    LTEXT           "minutes", IDC_T_PASSPHRASE_MIN,
-                    151, 149, 50, 8
-
     /* Stuff below the group boxes.  */
-    PUSHBUTTON      "advanced", IDC_GPG_OPTIONS,
-                    202, 178, 50, 14
-
     LTEXT           "GpgOL by g10 Code GmbH", IDC_STATIC, 
                       8, 197, 100, 8
     LTEXT           "Version x ", IDC_VERSION_INFO,
-                    150, 197, 109, 9
+                    130, 197, 129, 9
 
     CONTROL         IDB_BANNER, IDC_BITMAP,
                     "Static", SS_BITMAP | SS_REALSIZEIMAGE,
                       8, 212, 150, 64
+
+    PUSHBUTTON      "advanced", IDC_GPG_OPTIONS,
+                    209, 240, 50, 14
+
 END
 
 
 
-IDD_EXT_OPTIONS DIALOG DISCARDABLE  0, 0, 167, 119
+IDD_EXT_OPTIONS DIALOG DISCARDABLE  0, 0, 155, 70
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
-CAPTION "GpgOL - Extended Options (debug only!)"
+CAPTION "GpgOL - Debug Options"
 FONT 8, "MS Sans Serif"
 BEGIN
-    LTEXT           "keyman", IDC_T_OPT_KEYMAN_PATH,
-                    2,20, 122,8
-
-    EDITTEXT        IDC_OPT_KEYMAN_PATH,
-                    2, 34, 144, 12, ES_AUTOHSCROLL
-
-    PUSHBUTTON      "...", IDC_OPT_SEL_KEYMAN_PATH,
-                    148, 34, 11, 14
-
     LTEXT           "debug-logfile", IDC_T_DEBUG_LOGFILE,
-                    2, 50, 122,8
+                    8, 10, 122, 8
 
     EDITTEXT        IDC_DEBUG_LOGFILE,
-                    2, 60, 144, 12, ES_AUTOHSCROLL
+                    8, 20, 138, 12, ES_AUTOHSCROLL
 
     DEFPUSHBUTTON   "&OK", IDOK,
-                    112, 101, 50, 14
+                    90, 50, 50, 14
 END
 
 

Modified: trunk/src/ext-commands.cpp
===================================================================
--- trunk/src/ext-commands.cpp	2008-03-26 16:14:14 UTC (rev 240)
+++ trunk/src/ext-commands.cpp	2008-03-31 16:29:54 UTC (rev 241)
@@ -104,9 +104,10 @@
   m_nCmdEncrypt = 0;  
   m_nCmdDecrypt = 0;  
   m_nCmdSign = 0; 
-  m_nCmdShowInfo = 0;  
   m_nCmdCheckSig = 0;
   m_nCmdKeyManager = 0;
+  m_nCmdCryptoState = 0;
+  m_nCmdDebug0 = 0;
   m_nCmdDebug1 = 0;
   m_nCmdDebug2 = 0;
   m_toolbar_info = NULL; 
@@ -444,11 +445,23 @@
         "@", NULL,
         need_dvm? _("&Decrypt and verify message"):"", &m_nCmdDecrypt,
         _("&Verify signature"), &m_nCmdCheckSig,
-        _("&Display crypto information"), &m_nCmdShowInfo,
-                "@", NULL,
-        opt.enable_debug? "Debug-1 (open_inspector)":"", &m_nCmdDebug1,
-        opt.enable_debug? "Debug-2 (change msg class)":"", &m_nCmdDebug2,
+        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);
+
+
+      add_toolbar (pTBEArray, nTBECnt, 
+                   need_dvm
+                   ? _("This is an encrypted message.\n"
+                       "Click for more information. ")
+                   : _("This is a signed message.\n"
+                       "Click for more information. "),
+                   IDB_CRYPTO_STATE, m_nCmdCryptoState,
+                   NULL, 0, 0);
+
+
     }
   else if (m_lContext == EECONTEXT_SENDNOTEMESSAGE) 
     {
@@ -625,18 +638,6 @@
       ul_release (message, __func__, __LINE__);
       ul_release (mdb, __func__, __LINE__);
     }
-  else if (nCommandID == m_nCmdShowInfo
-           && m_lContext == EECONTEXT_READNOTEMESSAGE)
-    {
-      log_debug ("%s:%s: command ShowInfo called\n", SRCNAME, __func__);




More information about the Gnupg-commits mailing list