/[winpt]/trunk/Src/wptClipEditDlg.cpp
ViewVC logotype

Diff of /trunk/Src/wptClipEditDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 231 by twoaday, Tue Jun 20 09:18:44 2006 UTC revision 236 by twoaday, Wed Jun 28 06:59:30 2006 UTC
# Line 48  static DWORD help_arr[] = { Line 48  static DWORD help_arr[] = {
48  #endif  #endif
49    
50    
51    void verify_get_clip_info (gpgme_signature_t sig,
52                               char **r_header, char **r_footer);
53    
54    
55  /* Load the clipboard contents into the text field in @dlg.  /* Load the clipboard contents into the text field in @dlg.
56     Optinally @header and @footer can be used to set a header and footer.     Optinally @header and @footer can be used to set a header and footer.
57     Return value: 0 on success. */     Return value: 0 on success. */
# Line 136  load_clipboard_from_file (HWND dlg) Line 140  load_clipboard_from_file (HWND dlg)
140          if (!fp) {          if (!fp) {
141              msg_box (dlg, winpt_strerror (WPTERR_FILE_OPEN),              msg_box (dlg, winpt_strerror (WPTERR_FILE_OPEN),
142                       _("Clipboard"), MB_ERR);                       _("Clipboard"), MB_ERR);
143              return FALSE;              return -1;
144          }          }
145          p = new char[size+1];          p = new char[size+1];
146          if (!p)          if (!p)
# Line 166  save_clipboard_to_file (HWND dlg) Line 170  save_clipboard_to_file (HWND dlg)
170      save.lStructSize = sizeof (OPENFILENAME);            save.lStructSize = sizeof (OPENFILENAME);      
171      save.hInstance = glob_hinst;                  save.hInstance = glob_hinst;            
172      save.lpstrTitle = _("File Save");            save.lpstrTitle = _("File Save");      
173      save.lpstrFile = (char *)"All Files (*.*)\0*.*\0\0";      save.lpstrFile = "All Files (*.*)\0*.*\0\0";
174      save.hwndOwner = dlg;                        save.hwndOwner = dlg;
175      save.lpstrFile = file;                        save.lpstrFile = file;
176      save.nMaxFile = sizeof (file) - 1;      save.nMaxFile = sizeof (file) - 1;
177      save.Flags = OFN_OVERWRITEPROMPT;      save.Flags = OFN_OVERWRITEPROMPT;
178    
# Line 177  save_clipboard_to_file (HWND dlg) Line 181  save_clipboard_to_file (HWND dlg)
181              id = log_box (_("Clipboard"), MB_YESNO,              id = log_box (_("Clipboard"), MB_YESNO,
182                            _("\"%s\" already exists.\n"                            _("\"%s\" already exists.\n"
183                              "Replace existing file?"), file);                                    "Replace existing file?"), file);      
184              if( id == IDNO )                  if (id == IDNO)    
185                  return FALSE;                  return -1;
186          }          }
187          fp = fopen (file, "wb");          fp = fopen (file, "wb");
188          if (!fp) {          if (!fp) {
189              msg_box (dlg, winpt_strerror (WPTERR_FILE_CREAT),              msg_box (dlg, winpt_strerror (WPTERR_FILE_CREAT),
190                       _("Clipboard"), MB_ERR);                       _("Clipboard"), MB_ERR);
191              return FALSE;              return -1;
192          }          }
         /* XXX: there is a NUL-byte at the end. */  
193          nbytes = SendDlgItemMessage (dlg, IDC_CLIPEDIT_CLIPTEXT2,          nbytes = SendDlgItemMessage (dlg, IDC_CLIPEDIT_CLIPTEXT2,
194                                       WM_GETTEXTLENGTH, 0, 0);                                       WM_GETTEXTLENGTH, 0, 0);
195          if (nbytes > 0) {          if (nbytes > 0) {
# Line 204  save_clipboard_to_file (HWND dlg) Line 207  save_clipboard_to_file (HWND dlg)
207  }  }
208    
209    
 void verify_get_clip_info (gpgme_signature_t sig,  
                            char **r_header, char **r_footer);  
   
210  /* Dialog box procedure for the clipboard editor. */  /* Dialog box procedure for the clipboard editor. */
211  BOOL CALLBACK  BOOL CALLBACK
212  clip_edit_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  clip_edit_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
213  {  {
214      char *head=NULL, *foot=NULL;      char *head=NULL, *foot=NULL;
215        gpgme_data_t txt;
216    
217      switch (msg)  {      switch (msg)  {
218      case WM_INITDIALOG:      case WM_INITDIALOG:
# Line 221  clip_edit_dlg_proc (HWND dlg, UINT msg, Line 222  clip_edit_dlg_proc (HWND dlg, UINT msg,
222          SetDlgItemText (dlg, IDC_CLIPEDIT_CLEAR, _("Clea&r"));          SetDlgItemText (dlg, IDC_CLIPEDIT_CLEAR, _("Clea&r"));
223          SetDlgItemText (dlg, IDC_CLIPEDIT_LOAD, _("&Load"));              SetDlgItemText (dlg, IDC_CLIPEDIT_LOAD, _("&Load"));    
224          SetDlgItemText (dlg, IDC_CLIPEDIT_SAVE, _("&Save"));          SetDlgItemText (dlg, IDC_CLIPEDIT_SAVE, _("&Save"));
225          SetDlgItemText (dlg, IDC_CLIPEDIT_QUOTE, _("Add quotes"));          SetDlgItemText (dlg, IDC_CLIPEDIT_QUOTE, _("&Quote"));
226          SetDlgItemText (dlg, IDOK, _("&Close"));          SetDlgItemText (dlg, IDOK, _("&Close"));
227    
228          /* If there is a param, we expect a signature and initialize          /* If there is a param, we expect a signature and initialize
229             the header and footer variable accordingly. */             the header and footer variable accordingly. */
230          if (lparam)          if (lparam)
# Line 248  clip_edit_dlg_proc (HWND dlg, UINT msg, Line 250  clip_edit_dlg_proc (HWND dlg, UINT msg,
250              EndDialog (dlg, TRUE);              EndDialog (dlg, TRUE);
251              return TRUE;              return TRUE;
252                            
253          case IDC_CLIPEDIT_SEND:          case IDC_CLIPEDIT_QUOTE:
254              if (IsDlgButtonChecked (dlg, IDC_CLIPEDIT_QUOTE)) {              if (gpg_data_new_from_clipboard (&txt, 0))
                 gpgme_data_t txt;  
                 gpg_data_new_from_clipboard (&txt, 0);  
                 gpg_data_mail_quote (&txt);  
                 gpg_data_release_and_set_clipboard (txt, 0);  
                 SendMessage (dlg, WM_INITDIALOG, 0, 0);  
255                  return TRUE;                  return TRUE;
256              }              gpg_data_mail_quote (&txt);
257                gpg_data_release_and_set_clipboard (txt, 0);
258                load_clipboard (dlg, head, foot);
259                return TRUE;
260    
261            case IDC_CLIPEDIT_SEND:
262              SendDlgItemMessage (dlg, IDC_CLIPEDIT_CLIPTEXT2, EM_SETSEL, 0, -1);              SendDlgItemMessage (dlg, IDC_CLIPEDIT_CLIPTEXT2, EM_SETSEL, 0, -1);
263              SendDlgItemMessage (dlg, IDC_CLIPEDIT_CLIPTEXT2, WM_COPY, 0, 0);              SendDlgItemMessage (dlg, IDC_CLIPEDIT_CLIPTEXT2, WM_COPY, 0, 0);
264              return TRUE;              return TRUE;
# Line 276  clip_edit_dlg_proc (HWND dlg, UINT msg, Line 278  clip_edit_dlg_proc (HWND dlg, UINT msg,
278              return TRUE;              return TRUE;
279                            
280          case IDC_CLIPEDIT_LOAD:          case IDC_CLIPEDIT_LOAD:
281              if (!load_clipboard_from_file (dlg)) {              if (!load_clipboard_from_file (dlg))
                 CheckDlgButton (dlg, IDC_CLIPEDIT_QUOTE, BST_UNCHECKED);  
282                  PostMessage (dlg, WM_COMMAND, MAKEWPARAM (IDC_CLIPEDIT_SEND, 0), 0);                  PostMessage (dlg, WM_COMMAND, MAKEWPARAM (IDC_CLIPEDIT_SEND, 0), 0);
             }  
283              return TRUE;              return TRUE;
284                            
285          case IDC_CLIPEDIT_SAVE:          case IDC_CLIPEDIT_SAVE:

Legend:
Removed from v.231  
changed lines
  Added in v.236

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26