* trustdb.h, trustdb.c (uid_trust_string_fixed): New. Return a fixed-size

translatable string similar to trust_value_to_string. This allows for
easier lining up of displays.

* keyedit.c (show_key_with_all_names), keylist.c (list_keyblock_print):
Use it here to print validity strings.

* gpgv.c: Stub.
This commit is contained in:
David Shaw 2004-11-24 05:25:03 +00:00
parent 44289a4e68
commit 04b715e4da
6 changed files with 58 additions and 29 deletions

View File

@ -1,3 +1,14 @@
2004-11-24 David Shaw <dshaw@jabberwocky.com>
* trustdb.h, trustdb.c (uid_trust_string_fixed): New. Return a
fixed-size translatable string similar to trust_value_to_string.
This allows for easier lining up of displays.
* keyedit.c (show_key_with_all_names), keylist.c
(list_keyblock_print): Use it here to print validity strings.
* gpgv.c: Stub.
2004-11-18 Werner Koch <wk@g10code.com>
* g10.c (S_IRGRP) [HAVE_DOSISH_SYSTEM]: Define to 0.

View File

@ -251,7 +251,12 @@ trust_value_to_string (unsigned int value)
return "err";
}
/* Stub: */
const char *
uid_trust_string_fixed(PKT_public_key *key,PKT_user_id *uid)
{
return "err";
}
int
get_ownertrust_info (PKT_public_key *pk)
{

View File

@ -892,7 +892,7 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
while(class==0)
{
answer = cpr_get("sign_uid.class",_("Your selection? "
"(enter '?' for more information): "));
"(enter `?' for more information): "));
if(answer[0]=='\0')
class=0x10+opt.def_cert_level; /* Default */
else if(ascii_strcasecmp(answer,"0")==0)
@ -2360,16 +2360,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
if( !only_marked || (only_marked && (node->flag & NODFLG_MARK_A)))
{
if(!only_marked)
{
if(uid->is_revoked)
tty_printf(_("[%8.8s] "),_("revoked"));
else if(uid->is_expired)
tty_printf(_("[%8.8s] "),_("expired"));
else if(primary)
tty_printf(_("[%8.8s] "),
trust_value_to_string(get_validity(primary,
uid)));
}
tty_printf("%s ",uid_trust_string_fixed(primary,uid));
if( only_marked )
tty_printf(" ");
@ -2403,16 +2394,16 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
show_prefs (uid, selfsig, with_prefs == 2);
}
else
tty_printf(_("There are no preferences on a "
"PGP 2.x-style user ID.\n"));
tty_printf(_("There are no preferences on a"
" PGP 2.x-style user ID.\n"));
}
}
}
}
if (do_warn)
tty_printf (_("Please note that the shown key validity "
"is not necessarily correct\n"
tty_printf (_("Please note that the shown key validity"
" is not necessarily correct\n"
"unless you restart the program.\n"));
}

View File

@ -778,19 +778,13 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
const char *validity;
int indent;
if(uid->is_revoked)
validity=_("revoked");
else if(uid->is_expired)
validity=_("expired");
else
validity=trust_value_to_string(get_validity(pk,uid));
validity=uid_trust_string_fixed(pk,uid);
indent=(keystrlen()+9)-atoi(uid_trust_string_fixed(NULL,NULL));
indent=(keystrlen()+7)-strlen(validity);
if(indent<0)
if(indent<0 || indent>40)
indent=0;
printf("uid%*s[%s] ",indent,"",validity);
printf("uid%*s%s ",indent,"",validity);
}
else
printf("uid%*s",keystrlen()+10,"");

View File

@ -489,6 +489,34 @@ trust_letter (unsigned int value)
}
}
/* NOTE TO TRANSLATOR: these strings are similar to those in
trust_value_to_string(), but are a fixed length. This is needed to
make attractive information listings where columns line up
properly. The value "10" should be the length of the strings you
choose to translate to. This is the length in printable
columns. */
const char *
uid_trust_string_fixed(PKT_public_key *key,PKT_user_id *uid)
{
if(!key && !uid)
return _("10");
else if(uid->is_revoked)
return _("[ revoked]");
else if(uid->is_expired)
return _("[ expired]");
else if(key)
switch(get_validity(key,uid)&TRUST_MASK)
{
case TRUST_UNKNOWN: return _("[ unknown]");
case TRUST_UNDEFINED: return _("[ undef ]");
case TRUST_MARGINAL: return _("[marginal]");
case TRUST_FULLY: return _("[ full ]");
case TRUST_ULTIMATE: return _("[ultimate]");
}
return "err";
}
/* The strings here are similar to those in
pkclist.c:do_edit_ownertrust() */
const char *

View File

@ -1,6 +1,6 @@
/* trustdb.h - Trust database
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
* Free Software Foundation, Inc.
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
* 2004 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@ -22,7 +22,6 @@
#ifndef G10_TRUSTDB_H
#define G10_TRUSTDB_H
/* Trust values must be sorted in ascending order */
#define TRUST_MASK 15
#define TRUST_UNKNOWN 0 /* o: not yet calculated/assigned */
@ -48,6 +47,7 @@ void init_trustdb( void );
void check_trustdb_stale(void);
void sync_trustdb( void );
const char *uid_trust_string_fixed(PKT_public_key *key,PKT_user_id *uid);
const char *trust_value_to_string (unsigned int value);
int string_to_trust_value (const char *str);