Commit bb3d4e4d0719685f45aa992657bbcd940a497703
1 parent
01079aa3
Exists in
master
and in
3 other branches
Implementando novos diálogos de transferência de arquivo
Showing
2 changed files
with
37 additions
and
16 deletions
Show diff stats
| ... | ... | @@ -126,9 +126,8 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); |
| 126 | 126 | return 0; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - static void def_complete(H3270FT *ft,unsigned long length,double kbytes_sec,const char *mode) | |
| 129 | + static void def_complete(H3270FT *ft,unsigned long length,double kbytes_sec) | |
| 130 | 130 | { |
| 131 | - | |
| 132 | 131 | } |
| 133 | 132 | |
| 134 | 133 | static void def_message(H3270FT *ft, const char *errmsg) |
| ... | ... | @@ -157,7 +156,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); |
| 157 | 156 | } |
| 158 | 157 | |
| 159 | 158 | |
| 160 | - LIB3270_EXPORT H3270FT * lib3270_ft_new(H3270 *session, LIB3270_FT_OPTION flags, const char *local, const char *remote, int lrecl, int blksize, int primspace, int secspace, int dft, const char **msg) | |
| 159 | + LIB3270_EXPORT H3270FT * lib3270_ft_new(H3270 *session, LIB3270_FT_OPTION flags, const char *local, const char *remote, int lrecl, int blksize, int primspace, int secspace, int dft) | |
| 161 | 160 | { |
| 162 | 161 | H3270FT * ftHandle = (H3270FT *) session->ft; |
| 163 | 162 | FILE * ft_local_file = NULL; |
| ... | ... | @@ -166,14 +165,25 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); |
| 166 | 165 | // trace("%s(%s)",__FUNCTION__,local); |
| 167 | 166 | if(!lib3270_connected(session)) |
| 168 | 167 | { |
| 169 | - *msg = N_( "Disconnected from host" ); | |
| 170 | - errno = EINVAL; | |
| 168 | + lib3270_popup_dialog( session, | |
| 169 | + LIB3270_NOTIFY_ERROR, | |
| 170 | + _( "Request failed" ), | |
| 171 | + _( "Can't start file transfer." ), | |
| 172 | + "%s", | |
| 173 | + _( "Disconnected from host." )); | |
| 174 | + errno = ENOTCONN; | |
| 171 | 175 | return NULL; |
| 172 | 176 | } |
| 173 | 177 | |
| 174 | 178 | if(ftHandle) |
| 175 | 179 | { |
| 176 | - *msg = N_( "File transfer is already active in this session" ); | |
| 180 | + lib3270_popup_dialog( session, | |
| 181 | + LIB3270_NOTIFY_ERROR, | |
| 182 | + _( "Request failed" ), | |
| 183 | + _( "Can't start file transfer." ), | |
| 184 | + "%s", | |
| 185 | + _( "File transfer is already active in this session." )); | |
| 186 | + | |
| 177 | 187 | errno = EBUSY; |
| 178 | 188 | return NULL; |
| 179 | 189 | } |
| ... | ... | @@ -181,7 +191,12 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); |
| 181 | 191 | // Check remote file |
| 182 | 192 | if(!*remote) |
| 183 | 193 | { |
| 184 | - *msg = N_( "The remote file name is invalid" ); | |
| 194 | + lib3270_popup_dialog( session, | |
| 195 | + LIB3270_NOTIFY_ERROR, | |
| 196 | + _( "Request failed" ), | |
| 197 | + _( "Can't start file transfer." ), | |
| 198 | + "%s", | |
| 199 | + _( "The remote file name is invalid." )); | |
| 185 | 200 | errno = EINVAL; |
| 186 | 201 | return NULL; |
| 187 | 202 | } |
| ... | ... | @@ -195,7 +210,12 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); |
| 195 | 210 | |
| 196 | 211 | if(!ft_local_file) |
| 197 | 212 | { |
| 198 | - *msg = N_( "Can't open local file" ); | |
| 213 | + lib3270_popup_dialog( session, | |
| 214 | + LIB3270_NOTIFY_ERROR, | |
| 215 | + _( "Request failed" ), | |
| 216 | + _( "Can't open local file." ), | |
| 217 | + "%s", | |
| 218 | + strerror(errno)); | |
| 199 | 219 | return NULL; |
| 200 | 220 | } |
| 201 | 221 | |
| ... | ... | @@ -241,8 +261,6 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); |
| 241 | 261 | |
| 242 | 262 | session->ft = ftHandle; |
| 243 | 263 | |
| 244 | - | |
| 245 | - | |
| 246 | 264 | return ftHandle; |
| 247 | 265 | } |
| 248 | 266 | |
| ... | ... | @@ -426,8 +444,10 @@ void ft_complete(H3270FT *ft, const char *errmsg) |
| 426 | 444 | |
| 427 | 445 | ft_update_length(ft); |
| 428 | 446 | |
| 429 | - ft->message(ft,errmsg); | |
| 430 | - ft->complete(ft,ft->ft_length,kbytes_sec,ft->ft_is_cut ? "CUT" : "DFT"); | |
| 447 | + if(errmsg) | |
| 448 | + ft->message(ft,errmsg); | |
| 449 | + | |
| 450 | + ft->complete(ft,ft->ft_length,kbytes_sec); | |
| 431 | 451 | |
| 432 | 452 | } |
| 433 | 453 | |
| ... | ... | @@ -500,10 +520,11 @@ void ft_running(H3270FT *ft, Boolean is_cut) |
| 500 | 520 | void ft_aborting(H3270FT *h) |
| 501 | 521 | { |
| 502 | 522 | if (h->state == FT_RUNNING || h->state == FT_ABORT_WAIT) |
| 523 | + { | |
| 503 | 524 | set_ft_state(h,FT_ABORT_SENT); |
| 504 | - | |
| 505 | - h->aborting(h); | |
| 506 | - | |
| 525 | + h->message(h,N_("Aborting...")); | |
| 526 | + h->aborting(h); | |
| 527 | + } | |
| 507 | 528 | } |
| 508 | 529 | |
| 509 | 530 | /* Process a disconnect abort. */ | ... | ... |
ft_cut.c
| ... | ... | @@ -331,7 +331,7 @@ static void cut_control_code(H3270 *hSession) |
| 331 | 331 | trace_ds(hSession,"XFER_COMPLETE\n"); |
| 332 | 332 | cut_ack(hSession); |
| 333 | 333 | hSession->cut_xfer_in_progress = 0; |
| 334 | - ft_complete(ft,N_( "Complete" ) ); | |
| 334 | + ft_complete(ft,N_( "Transfer complete" ) ); | |
| 335 | 335 | break; |
| 336 | 336 | |
| 337 | 337 | case SC_ABORT_FILE: | ... | ... |