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

Contents of /trunk/Include/wptFileManager.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 271 - (show annotations)
Sun Nov 5 08:57:45 2006 UTC (18 years, 3 months ago) by twoaday
File MIME type: text/plain
File size: 5187 byte(s)


1 /* wptFileManager.h - File manager routines
2 * Copyright (C) 2001-2006 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 * You should have received a copy of the GNU General Public License
17 * along with WinPT; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #ifndef WPT_FILE_MANAGER_H
22 #define WPT_FILE_MANAGER_H
23
24 /* File manager commands. */
25 enum fm_cmd_t {
26 FM_NONE = 0,
27 FM_ENCRYPT = 1,
28 FM_SYMENC = 2,
29 FM_DECRYPT = 3,
30 FM_SIGN = 4,
31 FM_SIGNENCRYPT = 5,
32 FM_VERIFY = 6,
33 FM_IMPORT = 7,
34 FM_LIST = 8,
35 FM_WIPE = 9,
36 FM_ENCRYPT_DIR = 10,
37 FM_ENCRYPT_ZIP = 11
38 };
39
40
41 /* Symbolic column IDs. */
42 enum {
43 FM_COL_STAT = 0,
44 FM_COL_NAME = 1,
45 FM_COL_OP = 2
46 };
47
48
49 /* File Manager model to represent the list view. */
50 struct fm_model_s {
51 struct fm_model_s *next;
52 char *status;
53 char *name;
54 char *op;
55 };
56 typedef fm_model_s *fm_model_t;
57
58
59 /* File Manager dialog handle. */
60 struct fm_info_s {
61 HWND statbar;
62 HMENU menu;
63 listview_ctrl_t lv;
64 fm_model_t model;
65 };
66 typedef struct fm_info_s *fm_info_t;
67
68 /* File manager handle. */
69 struct fm_state_s {
70 gpgme_ctx_t ctx; /* currently used gpgme context. */
71 gpgme_key_t *recp; /* selected recipients. */
72 size_t n_recp; /* number of recipients. */
73 char *output; /* output file name. */
74 char *opaque;
75 int cancel; /* 1=if user cancelled operation. */
76 HWND dlg; /* handle to the calling dialog. */
77 struct passphrase_cb_s pass_cb;
78 struct progress_filter_s *prog_cb;
79 int init_cb;
80 int cache_cb;
81 gpgme_sig_mode_t sigmode; /* used signature mode. */
82 struct {
83 unsigned int is_clip:1; /* 1=if clipboard operation. */
84 unsigned int revcert:1;
85 unsigned int has_seckey:1;
86 } import;
87 unsigned int wipe:1; /* 1=if original file should be wiped. */
88 unsigned int req_signer:1; /* 1=if user wants to select a signer. */
89 };
90 typedef struct fm_state_s *fm_state_t;
91
92
93 /* Signature verification context for a file. */
94 struct file_sig_ctx_s {
95 char *file; /* plaintext file name */
96 gpgme_signature_t sig; /* the actual signature */
97 unsigned use_uid:1; /* 1=if the user id from context should be used. */
98 const char *user_id;
99 };
100 typedef struct file_sig_ctx_s *file_sig_ctx_t;
101
102
103 enum file_data_flag_t {
104 F_DATA_WRITE = 0,
105 F_DATA_READ = 1,
106 F_DATA_NOMAP = 2
107 };
108
109 /* Gpg file handle. */
110 struct file_data_s {
111 struct gpgme_data_cbs cbs;
112 HANDLE handle;
113 int error;
114 gpgme_data_t dat;
115 unsigned long size;
116 unsigned long off;
117 void *cb_value;
118 char *name;
119 };
120 typedef struct file_data_s *file_data_t;
121
122 /*-- wptFileCBS.cpp --*/
123 gpgme_error_t gpg_file_data_new (const char *fname, int flags,
124 file_data_t *r_cb);
125 void gpg_file_data_rewind (file_data_t cb);
126 void gpg_file_data_release (file_data_t cb);
127 void gpg_file_data_set_cb (file_data_t ctx,
128 struct progress_filter_s *pfx);
129
130 /*-- wptFileManager.cpp --*/
131 char * fm_quote_file (const char * name);
132 int fm_parse_command_line (char * cmdl);
133 int fm_parse_files (listview_ctrl_t lv, HWND dlg, int cmd);
134 int fm_state_new (fm_state_t *ctx);
135 void fm_state_release (fm_state_t ctx);
136 void fm_reset (fm_info_t fm);
137 void fm_build (fm_info_t *r_fm, HWND ctrl);
138 void fm_delete (fm_info_t fm);
139 int fm_add_dropped_files (fm_info_t fm, HDROP dd_files);
140 int fm_add_opened_files (fm_info_t fm, HWND dlg);
141 void fm_remove_crit_file_attrs (const char *fname, int force);
142 int fm_get_current_pos (listview_ctrl_t lv);
143 int fm_sort (listview_ctrl_t lv, int sortby);
144 void fm_print_md (listview_ctrl_t lv, HWND dlg, int mdalgo);
145 int fm_assume_onepass_sig (const char * fname);
146 int fm_check_file_type (listview_ctrl_t lv, int pos, int fm_cmd);
147 int fm_send_file (listview_ctrl_t lv);
148
149 /*-- wptFileVerifyDlg.cpp --*/
150 void file_verify_add_state (file_sig_ctx_t c);
151 void file_verify_wait (void);
152
153 /*-- ccommands --*/
154 int fm_encrypt_into_zip (fm_state_t ctx, listview_ctrl_t lv);
155 int fm_encrypt (fm_state_t c, const char * name, int sign);
156 int fm_sym_encrypt (fm_state_t c, const char * name);
157 int fm_decrypt (fm_state_t c, const char * name);
158 int fm_sign (fm_state_t c, const char * name);
159 int fm_verify (fm_state_t c, int detached, const char * name);
160 int fm_import(fm_state_t c, const char *name);
161 int fm_wipe (const char * name);
162 int fm_list (const char * name, HWND dlg);
163 int fm_encrypt_directory (fm_state_t c, const char * name);
164 int fm_verify_pasted_detsig (listview_ctrl_t lv, HWND dlg);
165 int fm_assume_onepass_sig (const char * fname);
166
167 #endif /* WPT_FILE_MANAGER_H */

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26