21 |
/* TODO: |
/* TODO: |
22 |
* check_armor_type: we should check the whole file and not only the first line! |
* check_armor_type: we should check the whole file and not only the first line! |
23 |
*/ |
*/ |
24 |
|
|
25 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
26 |
#include <config.h> |
#include <config.h> |
27 |
#endif |
#endif |
50 |
#include "wptRegistry.h" |
#include "wptRegistry.h" |
51 |
#include "wptImport.h" |
#include "wptImport.h" |
52 |
#include "wptCrypto.h" |
#include "wptCrypto.h" |
53 |
|
#include "wptKeyManager.h" |
54 |
#include "openpgp.h" |
#include "openpgp.h" |
55 |
|
|
56 |
#define op_begin() SetCursor (LoadCursor (NULL, IDC_WAIT)) |
#define op_begin() SetCursor (LoadCursor (NULL, IDC_WAIT)) |
1671 |
} |
} |
1672 |
|
|
1673 |
|
|
|
/* Generate a user friendly file name based on the key @k. */ |
|
|
static char* |
|
|
gen_key_outname (gpgme_key_t k) |
|
|
{ |
|
|
char *p; |
|
|
size_t i; |
|
|
|
|
|
p = new char[strlen (k->uids->name)+1+8]; |
|
|
if (!p) |
|
|
BUG (NULL); |
|
|
sprintf (p, "%s.asc", k->uids->name); |
|
|
for (i=0; i < strlen (p); i++) { |
|
|
if (p[i] == ' ') |
|
|
p[i] = '_'; |
|
|
} |
|
|
return p; |
|
|
} |
|
|
|
|
|
|
|
1674 |
/* Export the selected keys from the File Manager to a file. */ |
/* Export the selected keys from the File Manager to a file. */ |
1675 |
int |
int |
1676 |
fm_export (fm_state_t c) |
fm_export (fm_state_t c) |
1690 |
} |
} |
1691 |
|
|
1692 |
if (rset[1] == NULL) /* count == 1*/ |
if (rset[1] == NULL) /* count == 1*/ |
1693 |
p = gen_key_outname (rset[0]); |
p = km_gen_export_filename (rset[0]->subkeys->keyid+8, 0); |
1694 |
|
|
1695 |
name = get_filesave_dlg (c->dlg, _("Choose Name for Key File"), |
name = get_filesave_dlg (c->dlg, _("Choose Name for Key File"), |
1696 |
NULL, p? p : NULL); |
NULL, p? p : NULL); |