Commit ac85d8803e660e34cae26fcc8c3e112382ac6df5
1 parent
aa26136d
Exists in
master
and in
5 other branches
Ajustes para empacotamento windows.
Showing
4 changed files
with
88 additions
and
1 deletions
Show diff stats
src/java/plugin.cc
| ... | ... | @@ -340,7 +340,10 @@ |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | int file_transfer(LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl = 0, int blksize = 0, int primspace = 0, int secspace = 0, int dft = 4096) { |
| 343 | + /* | |
| 343 | 344 | return v3270_transfer_file(v3270_get_default_widget(),options,local,remote,lrecl,blksize,primspace,secspace,dft); |
| 345 | + */ | |
| 346 | + return EINVAL; | |
| 344 | 347 | } |
| 345 | 348 | |
| 346 | 349 | void set_unlock_delay(unsigned short ms) | ... | ... |
src/plugins/hllapi/pluginmain.c
| ... | ... | @@ -185,6 +185,7 @@ |
| 185 | 185 | |
| 186 | 186 | static int do_file_transfer(struct hllapi_packet_file_transfer * source) |
| 187 | 187 | { |
| 188 | + /* | |
| 188 | 189 | const gchar * local = (const char *) source->text; |
| 189 | 190 | const gchar * remote = (const char *) (local+strlen(local)+1); |
| 190 | 191 | |
| ... | ... | @@ -197,6 +198,7 @@ |
| 197 | 198 | source->primspace, |
| 198 | 199 | source->secspace, |
| 199 | 200 | source->dft ); |
| 201 | + */ | |
| 200 | 202 | } |
| 201 | 203 | |
| 202 | 204 | static void process_input(pipe_source *source, DWORD cbRead) | ... | ... |
src/plugins/rx3270/pluginmain.cc
| ... | ... | @@ -836,7 +836,10 @@ const char * plugin::ebc2asc(unsigned char *str, int sz) |
| 836 | 836 | |
| 837 | 837 | int plugin::file_transfer(LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl, int blksize, int primspace, int secspace, int dft) |
| 838 | 838 | { |
| 839 | + /* | |
| 839 | 840 | return v3270_transfer_file(v3270_get_default_widget(),options,local,remote,lrecl,blksize,primspace,secspace,dft); |
| 841 | + */ | |
| 842 | + return EINVAL; | |
| 840 | 843 | } |
| 841 | 844 | |
| 842 | 845 | void plugin::set_unlock_delay(unsigned short ms) | ... | ... |
src/pw3270/v3270ft/select.c
| ... | ... | @@ -30,8 +30,47 @@ |
| 30 | 30 | |
| 31 | 31 | #include "private.h" |
| 32 | 32 | |
| 33 | +#ifdef WIN32 | |
| 34 | + #include <gdk/gdkwin32.h> | |
| 35 | +#endif // WIN32 | |
| 36 | + | |
| 33 | 37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 34 | 38 | |
| 39 | +#if defined(_WIN32) | |
| 40 | + | |
| 41 | +struct file { | |
| 42 | + OPENFILENAME ofn; | |
| 43 | + gboolean enabled; | |
| 44 | + char szName[260]; // buffer for file name | |
| 45 | + GtkFileChooserAction action; | |
| 46 | + BOOL ok; | |
| 47 | +}; | |
| 48 | + | |
| 49 | +static gpointer select_file(struct file *fl) { | |
| 50 | + | |
| 51 | + | |
| 52 | + switch(fl->action) { | |
| 53 | + case GTK_FILE_CHOOSER_ACTION_SAVE: // Receber arquivo | |
| 54 | + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646839(v=vs.85).aspx | |
| 55 | + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646829(v=vs.85).aspx#open_file | |
| 56 | + fl->ofn.Flags = OFN_OVERWRITEPROMPT; | |
| 57 | + fl->ok = GetSaveFileName(&fl->ofn); | |
| 58 | + break; | |
| 59 | + | |
| 60 | + case GTK_FILE_CHOOSER_ACTION_OPEN: // Enviar arquivo | |
| 61 | + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646928(v=vs.85).aspx | |
| 62 | + fl->ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; | |
| 63 | + fl->ok = GetOpenFileName(&fl->ofn); | |
| 64 | + break; | |
| 65 | + } | |
| 66 | + | |
| 67 | + fl->enabled = FALSE; | |
| 68 | + | |
| 69 | + return 0; | |
| 70 | +} | |
| 71 | + | |
| 72 | +#endif // _WIN32 | |
| 73 | + | |
| 35 | 74 | gchar * v3270ft_select_file(v3270ft *dialog, const gchar *title, const gchar *button, GtkFileChooserAction action, const gchar *filename) { |
| 36 | 75 | |
| 37 | 76 | gchar *rc = NULL; |
| ... | ... | @@ -56,7 +95,47 @@ gchar * v3270ft_select_file(v3270ft *dialog, const gchar *title, const gchar *bu |
| 56 | 95 | |
| 57 | 96 | #elif defined(_WIN32) |
| 58 | 97 | |
| 59 | - #error Usar diálogo nativo windows | |
| 98 | + GThread * thd; | |
| 99 | + struct file fl; | |
| 100 | + GdkWindow * win = gtk_widget_get_window(GTK_WIDGET(dialog)); | |
| 101 | + | |
| 102 | + gtk_widget_set_sensitive(GTK_WIDGET(dialog),FALSE); | |
| 103 | + | |
| 104 | + memset(&fl,0,sizeof(fl)); | |
| 105 | + fl.ofn.lStructSize = sizeof(fl.ofn); | |
| 106 | + fl.ofn.hwndOwner = GDK_WINDOW_HWND(win); | |
| 107 | + fl.ofn.lpstrFile = fl.szName; | |
| 108 | + | |
| 109 | + // Set lpstrFile[0] to '\0' so that GetOpenFileName does not | |
| 110 | + // use the contents of szFile to initialize itself. | |
| 111 | + fl.ofn.lpstrFile[0] = '\0'; | |
| 112 | + | |
| 113 | + fl.ofn.nMaxFile = sizeof(fl.szName); | |
| 114 | + fl.ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0"; | |
| 115 | + fl.ofn.nFilterIndex = 1; | |
| 116 | + fl.ofn.nMaxFileTitle = 0; | |
| 117 | + fl.ofn.lpstrInitialDir = NULL; | |
| 118 | + | |
| 119 | + // Guarda o valor atual | |
| 120 | + strncpy(fl.szName,filename,fl.ofn.nMaxFile); | |
| 121 | + | |
| 122 | + fl.action = action; | |
| 123 | + | |
| 124 | + thd = g_thread_new("GetFileName",(GThreadFunc) select_file, &fl); | |
| 125 | + | |
| 126 | + fl.enabled = TRUE; | |
| 127 | + while(fl.enabled) { | |
| 128 | + g_main_context_iteration(NULL,TRUE); | |
| 129 | + } | |
| 130 | + | |
| 131 | + g_thread_unref(thd); | |
| 132 | + | |
| 133 | + if(fl.ok) { | |
| 134 | + rc = g_strdup(fl.szName); | |
| 135 | + } | |
| 136 | + | |
| 137 | + gtk_widget_set_sensitive(GTK_WIDGET(dialog),TRUE); | |
| 138 | + | |
| 60 | 139 | |
| 61 | 140 | #else |
| 62 | 141 | ... | ... |