Commit 85193f92a396126214b300c442b1f017da3eed98

Authored by perry.werneck@gmail.com
1 parent 186a2cfa

Ajustes na transferência de arquivos

Showing 3 changed files with 37 additions and 13 deletions   Show diff stats
@@ -88,11 +88,34 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -88,11 +88,34 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
88 88
89 static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state) 89 static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state)
90 { 90 {
  91 + static const struct _msg
  92 + {
  93 + LIB3270_FT_STATE state;
  94 + const char * text;
  95 + } msg[] =
  96 + {
  97 + { LIB3270_FT_STATE_NONE, N_( "No transfer in progress" ) },
  98 + { LIB3270_FT_STATE_RUNNING, N_( "Ack received, data flowing" ) },
  99 + { LIB3270_FT_STATE_ABORT_WAIT, N_( "Awaiting chance to send an abort" ) },
  100 + { LIB3270_FT_STATE_ABORT_SENT, N_( "Abort sent; awaiting response" ) },
  101 + };
  102 +
  103 + int f;
  104 +
91 if(session->state == state) 105 if(session->state == state)
92 return; 106 return;
93 session->state = state; 107 session->state = state;
94 session->state_changed(session,state); 108 session->state_changed(session,state);
95 109
  110 + for(f = 0; f < sizeof(msg)/sizeof(msg[0]);f++)
  111 + {
  112 + if(msg[f].state == state)
  113 + {
  114 + ft_message(session,msg[f].text);
  115 + break;
  116 + }
  117 + }
  118 +
96 } 119 }
97 120
98 void ft_init(H3270 *hSession) 121 void ft_init(H3270 *hSession)
@@ -407,9 +430,9 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -407,9 +430,9 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
407 lib3270_emulate_input(ft->host, buffer, strlen(buffer), False); 430 lib3270_emulate_input(ft->host, buffer, strlen(buffer), False);
408 431
409 if(ft->flags & LIB3270_FT_OPTION_RECEIVE) 432 if(ft->flags & LIB3270_FT_OPTION_RECEIVE)
410 - ft->message(ft,N_( "Waiting for GET response" )); 433 + ft_message(ft,N_( "Waiting for GET response" ));
411 else 434 else
412 - ft->message(ft,N_( "Waiting for PUT response" )); 435 + ft_message(ft,N_( "Waiting for PUT response" ));
413 436
414 return 0; 437 return 0;
415 438
@@ -417,6 +440,11 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -417,6 +440,11 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
417 440
418 441
419 /* External entry points called by ft_dft and ft_cut. */ 442 /* External entry points called by ft_dft and ft_cut. */
  443 +void ft_message(H3270FT *ft, const char *msg)
  444 +{
  445 + lib3270_trace_event(ft->host,"%s\n",msg);
  446 + ft->message(ft,msg);
  447 +}
420 448
421 /** 449 /**
422 * Pop up a message, end the transfer, release resources. 450 * Pop up a message, end the transfer, release resources.
@@ -444,11 +472,11 @@ void ft_complete(H3270FT *ft, const char *errmsg) @@ -444,11 +472,11 @@ void ft_complete(H3270FT *ft, const char *errmsg)
444 472
445 ft_update_length(ft); 473 ft_update_length(ft);
446 474
447 - if(errmsg)  
448 - ft->message(ft,errmsg);  
449 -  
450 ft->complete(ft,ft->ft_length,kbytes_sec); 475 ft->complete(ft,ft->ft_length,kbytes_sec);
451 476
  477 + ft_message(ft,errmsg ? errmsg : N_("Transfer complete"));
  478 +
  479 +
452 } 480 }
453 481
454 LIB3270_EXPORT int lib3270_ft_destroy(H3270 *hSession) 482 LIB3270_EXPORT int lib3270_ft_destroy(H3270 *hSession)
@@ -28,17 +28,13 @@ @@ -28,17 +28,13 @@
28 LIB3270_INTERNAL Boolean cr_flag; 28 LIB3270_INTERNAL Boolean cr_flag;
29 LIB3270_INTERNAL unsigned long ft_length; 29 LIB3270_INTERNAL unsigned long ft_length;
30 30
31 -// LIB3270_INTERNAL H3270FT * ftsession;  
32 -  
33 -// LIB3270_INTERNAL Boolean ft_last_cr;  
34 -// LIB3270_INTERNAL Boolean remap_flag;  
35 -  
36 LIB3270_INTERNAL H3270FT * get_ft_handle(H3270 *hSession); 31 LIB3270_INTERNAL H3270FT * get_ft_handle(H3270 *hSession);
37 32
38 LIB3270_INTERNAL void ft_init(H3270 *hSession); 33 LIB3270_INTERNAL void ft_init(H3270 *hSession);
39 34
40 LIB3270_INTERNAL void ft_aborting(H3270FT *h); 35 LIB3270_INTERNAL void ft_aborting(H3270FT *h);
41 LIB3270_INTERNAL void ft_complete(H3270FT *h, const char *errmsg); 36 LIB3270_INTERNAL void ft_complete(H3270FT *h, const char *errmsg);
  37 + LIB3270_INTERNAL void ft_message(H3270FT *h, const char *msg);
42 LIB3270_INTERNAL void ft_running(H3270FT *h, Boolean is_cut); 38 LIB3270_INTERNAL void ft_running(H3270FT *h, Boolean is_cut);
43 LIB3270_INTERNAL void ft_update_length(H3270FT *h); 39 LIB3270_INTERNAL void ft_update_length(H3270FT *h);
44 40
@@ -88,9 +88,9 @@ struct ta; @@ -88,9 +88,9 @@ struct ta;
88 #include "api.h" 88 #include "api.h"
89 89
90 90
91 -#ifdef DEBUG  
92 - #define KYBDLOCK_TRACE  
93 -#endif // DEBUG 91 +//#ifdef DEBUG
  92 +// #define KYBDLOCK_TRACE
  93 +//#endif // DEBUG
94 94
95 /* Statics */ 95 /* Statics */
96 // static enum { NONE, COMPOSE, FIRST } composing = NONE; 96 // static enum { NONE, COMPOSE, FIRST } composing = NONE;