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

Annotation of /trunk/Include/wptFileManager.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 466 - (hide annotations)
Tue Oct 9 09:32:35 2012 UTC (12 years, 4 months ago) by twoaday
File MIME type: text/plain
File size: 4718 byte(s)


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

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26