/[winpt]/trunk/Include/wptFileManager.h
ViewVC logotype

Contents of /trunk/Include/wptFileManager.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 335 - (show annotations)
Sun Nov 27 12:20:21 2011 UTC (13 years, 3 months ago) by twoaday
File MIME type: text/plain
File size: 4696 byte(s)


1 /* wptFileManager.h - File manager routines
2 * Copyright (C) 2001-2006, 2008-2009 Timo Schulz
3 *
4 * This file is part of WinPT.
5 *
6 * WinPT is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * WinPT is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 */
16
17 #ifndef WPT_FILE_MANAGER_H
18 #define WPT_FILE_MANAGER_H
19
20 /* File manager commands. */
21 enum fm_cmd_t {
22 FM_NONE = 0,
23 FM_ENCRYPT = 1,
24 FM_SYMENC = 2,
25 FM_DECRYPT = 3,
26 FM_SIGN = 4,
27 FM_SIGNENCRYPT = 5,
28 FM_VERIFY = 6,
29 FM_IMPORT = 7,
30 FM_LIST = 8,
31 };
32
33
34 /* Symbolic column IDs. */
35 enum {
36 FM_COL_STAT = 0,
37 FM_COL_NAME = 1,
38 FM_COL_OP = 2
39 };
40
41
42 /* File Manager model to represent the list view. */
43 struct fm_model_s {
44 struct fm_model_s *next;
45 char *status;
46 char *name;
47 char *op;
48 };
49 typedef fm_model_s *fm_model_t;
50
51
52 /* File Manager dialog handle. */
53 struct fm_info_s {
54 HWND statbar;
55 HMENU menu;
56 listview_ctrl_t lv;
57 fm_model_t model;
58 };
59 typedef struct fm_info_s *fm_info_t;
60
61 /* File manager handle. */
62 struct fm_state_s {
63 gpgme_ctx_t ctx; /* currently used gpgme context. */
64 gpgme_key_t *recp; /* selected recipients. */
65 size_t n_recp; /* number of recipients. */
66 char *output; /* output file name. */
67 char *opaque;
68 int cancel; /* 1=if user cancelled operation. */
69 HWND dlg; /* handle to the calling dialog. */
70 struct passphrase_cb_s pass_cb;
71 struct progress_filter_s *prog_cb;
72 int init_cb;
73 int cache_cb;
74 gpgme_sig_mode_t sigmode; /* used signature mode. */
75 struct {
76 unsigned int is_clip:1; /* 1=if clipboard operation. */
77 unsigned int revcert:1;
78 unsigned int has_seckey:1;
79 } import;
80 unsigned int req_signer:1; /* 1=if user wants to select a signer. */
81 };
82 typedef struct fm_state_s *fm_state_t;
83
84
85 /* Signature verification context for a file. */
86 struct file_sig_ctx_s {
87 char *file; /* plaintext file name */
88 gpgme_signature_t sig; /* the actual signature */
89 unsigned use_uid:1; /* 1=if the user id from context should be used. */
90 const char *user_id;
91 };
92 typedef struct file_sig_ctx_s *file_sig_ctx_t;
93
94
95 /* Gpg file handle. */
96 enum file_data_flag_t {
97 F_DATA_WRITE = 0,
98 F_DATA_READ = 1,
99 F_DATA_NOMAP = 2
100 };
101
102 struct file_data_s {
103 struct gpgme_data_cbs cbs;
104 HANDLE handle;
105 int error;
106 gpgme_data_t dat;
107 unsigned long size;
108 unsigned long off;
109 void *cb_value;
110 char *name;
111 };
112 typedef struct file_data_s *file_data_t;
113
114 /*-- wptFileCBS.cpp --*/
115 gpgme_error_t gpg_file_data_new (const char *fname, int flags,
116 file_data_t *r_cb);
117 void gpg_file_data_rewind (file_data_t cb);
118 void gpg_file_data_release (file_data_t cb);
119 void gpg_file_data_set_cb (file_data_t ctx,
120 struct progress_filter_s *pfx);
121
122 /*-- wptFileManager.cpp --*/
123 char *fm_quote_file (const char *name);
124 int fm_parse_command_line (char *cmdl);
125 int fm_parse_files (listview_ctrl_t lv, HWND dlg, int cmd);
126 int fm_state_new (fm_state_t *ctx);
127 void fm_state_release (fm_state_t ctx);
128 void fm_reset (fm_info_t fm);
129 void fm_build (fm_info_t *r_fm, HWND ctrl);
130 void fm_delete (fm_info_t fm);
131 int fm_add_dropped_files (fm_info_t fm, HDROP dd_files);
132 int fm_add_opened_files (fm_info_t fm, HWND dlg);
133 void fm_remove_crit_file_attrs (const char *fname, int force);
134 int fm_get_current_pos (listview_ctrl_t lv);
135 int fm_sort (listview_ctrl_t lv, int sortby);
136 void fm_print_md (listview_ctrl_t lv, HWND dlg, int mdalgo);
137 int fm_assume_onepass_sig (const char * fname);
138 int fm_check_file_type (listview_ctrl_t lv, int pos, int fm_cmd);
139 int fm_send_file (listview_ctrl_t lv);
140
141 /*-- wptFileVerifyDlg.cpp --*/
142 void file_verify_add_state (file_sig_ctx_t c);
143 void file_verify_wait (void);
144
145 /*-- ccommands --*/
146 int fm_encrypt (fm_state_t c, const char * name, int sign);
147 int fm_sym_encrypt (fm_state_t c, const char * name);
148 int fm_decrypt (fm_state_t c, const char * name);
149 int fm_sign (fm_state_t c, const char * name);
150 int fm_verify (fm_state_t c, int detached, const char * name);
151 int fm_import(fm_state_t c, const char *name);
152 void fm_list (const char * name, HWND dlg);
153 int fm_verify_pasted_detsig (listview_ctrl_t lv, HWND dlg);
154 int fm_assume_onepass_sig (const char * fname);
155
156 #endif /* WPT_FILE_MANAGER_H */

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26