mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* keydb.h, pkclist.c (select_algo_from_prefs): Allow passing a suggested
algorithm which will be used if available. * encode.c (encode_crypt, encrypt_filter), sign.c (sign_file): Use new select_algo_from_prefs feature to check if forcing an algorithm would violate the recipient preferences. * photoid.c (get_default_photo_command, show_photos): Use different default viewers on different platforms. Currently we have Win 9x, Win NT (2k, xp), Mac OSX, RISC OS, and "everybody else". These are #ifdefs as much as possible to avoid clutter. * g10.c (strusage, build_list), keyedit.c (show_prefs), main.h, misc.c (compress_algo_to_string, check_compress_algo), pkclist.c (algo_available), keygen.c (keygen_set_std_prefs): New algo_to_string and check functions for compress algorithms.
This commit is contained in:
parent
e2b8455014
commit
0f1c325c1c
11 changed files with 181 additions and 73 deletions
|
@ -22,7 +22,9 @@
|
|||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "packet.h"
|
||||
#include "status.h"
|
||||
#include "exec.h"
|
||||
|
@ -35,12 +37,6 @@
|
|||
#include "main.h"
|
||||
#include "photoid.h"
|
||||
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#define DEFAULT_PHOTO_COMMAND "start /w %i"
|
||||
#else
|
||||
#define DEFAULT_PHOTO_COMMAND "xloadimage -fork -quiet -title 'KeyID 0x%k' stdin"
|
||||
#endif
|
||||
|
||||
/* Generate a new photo id packet, or return NULL if canceled */
|
||||
PKT_user_id *generate_photo_id(PKT_public_key *pk)
|
||||
{
|
||||
|
@ -219,6 +215,29 @@ char *image_type_to_string(byte type,int style)
|
|||
return string;
|
||||
}
|
||||
|
||||
static const char *get_default_photo_command(void)
|
||||
{
|
||||
#if defined(HAVE_DOSISH_SYSTEM)
|
||||
OSVERSIONINFO osvi;
|
||||
|
||||
memset(&osvi,0,sizeof(osvi));
|
||||
osvi.dwOSVersionInfoSize=sizeof(osvi);
|
||||
GetVersionEx(&osvi);
|
||||
|
||||
if(osvi.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)
|
||||
return "start /w %i";
|
||||
else
|
||||
return "cmd /c start /w %i";
|
||||
#elif defined(__APPLE__)
|
||||
/* OS X. This really needs more than just __APPLE__. */
|
||||
return "open %I";
|
||||
#elif defined(__riscos__)
|
||||
return "Filer_Run %I";
|
||||
#else
|
||||
return "xloadimage -fork -quiet -title 'KeyID 0x%k' stdin";
|
||||
#endif
|
||||
}
|
||||
|
||||
void show_photos(const struct user_attribute *attrs,
|
||||
int count,PKT_public_key *pk,PKT_secret_key *sk)
|
||||
{
|
||||
|
@ -244,9 +263,11 @@ void show_photos(const struct user_attribute *attrs,
|
|||
struct exec_info *spawn;
|
||||
int offset=attrs[i].len-len;
|
||||
|
||||
if(!opt.photo_viewer)
|
||||
opt.photo_viewer=get_default_photo_command();
|
||||
|
||||
/* make command grow */
|
||||
command=pct_expando(opt.photo_viewer?
|
||||
opt.photo_viewer:DEFAULT_PHOTO_COMMAND,&args);
|
||||
command=pct_expando(opt.photo_viewer,&args);
|
||||
if(!command)
|
||||
goto fail;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue