Commit a6f48ae72b0c7a8d3f05b3e331607fafd2d5fa32
1 parent
60d5647c
Exists in
master
Incluindo opção para usar mapeamento de teclas PF específico para AS400
Showing
5 changed files
with
51 additions
and
13 deletions
Show diff stats
bootstrap.sh
src/gtk2/action_calls.c
| ... | ... | @@ -54,10 +54,11 @@ |
| 54 | 54 | char *ptr; |
| 55 | 55 | gboolean again = TRUE; |
| 56 | 56 | char buffer[1024]; |
| 57 | - GtkTable *table = GTK_TABLE(gtk_table_new(2,4,FALSE)); | |
| 57 | + GtkTable *table = GTK_TABLE(gtk_table_new(2,6,FALSE)); | |
| 58 | 58 | GtkEntry *host = GTK_ENTRY(gtk_entry_new()); |
| 59 | 59 | GtkEntry *port = GTK_ENTRY(gtk_entry_new()); |
| 60 | - GtkToggleButton *checkbox = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_label( _( "Secure connection" ) )); | |
| 60 | + GtkToggleButton *secure = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_label( _( "Secure connection" ) )); | |
| 61 | + GtkToggleButton *as400 = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_label( _( "Host is AS400" ) )); | |
| 61 | 62 | GtkWidget *dialog = gtk_dialog_new_with_buttons( _( "Select hostname" ), |
| 62 | 63 | GTK_WINDOW(topwindow), |
| 63 | 64 | GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, |
| ... | ... | @@ -73,12 +74,13 @@ |
| 73 | 74 | gtk_entry_set_width_chars(port,7); |
| 74 | 75 | |
| 75 | 76 | gtk_table_attach(table,gtk_label_new( _( "Hostname:" ) ), 0,1,0,1,0,0,5,0); |
| 76 | - gtk_table_attach(table,GTK_WIDGET(host), 1,2,0,1,GTK_EXPAND|GTK_FILL,0,0,0); | |
| 77 | + gtk_table_attach(table,GTK_WIDGET(host), 1,4,0,1,GTK_EXPAND|GTK_FILL,0,0,0); | |
| 77 | 78 | |
| 78 | - gtk_table_attach(table,gtk_label_new( _( "Port:" ) ), 2,3,0,1,0,0,5,0); | |
| 79 | - gtk_table_attach(table,GTK_WIDGET(port), 3,4,0,1,GTK_FILL,0,0,0); | |
| 79 | + gtk_table_attach(table,gtk_label_new( _( "Port:" ) ), 4,5,0,1,0,0,5,0); | |
| 80 | + gtk_table_attach(table,GTK_WIDGET(port), 5,6,0,1,GTK_EXPAND|GTK_FILL,0,0,0); | |
| 80 | 81 | |
| 81 | - gtk_table_attach(table,GTK_WIDGET(checkbox), 1,2,1,2,GTK_EXPAND|GTK_FILL,0,0,0); | |
| 82 | + gtk_table_attach(table,GTK_WIDGET(secure), 1,2,1,2,GTK_FILL,0,0,0); | |
| 83 | + gtk_table_attach(table,GTK_WIDGET(as400), 2,3,1,2,GTK_EXPAND|GTK_FILL,0,20,0); | |
| 82 | 84 | |
| 83 | 85 | gtk_container_set_border_width(GTK_CONTAINER(table),5); |
| 84 | 86 | |
| ... | ... | @@ -89,16 +91,23 @@ |
| 89 | 91 | #ifdef HAVE_LIBSSL |
| 90 | 92 | if(!strncmp(hostname,"L:",2)) |
| 91 | 93 | { |
| 92 | - gtk_toggle_button_set_active(checkbox,TRUE); | |
| 94 | + gtk_toggle_button_set_active(secure,TRUE); | |
| 93 | 95 | hostname += 2; |
| 94 | 96 | } |
| 95 | 97 | #else |
| 96 | - gtk_toggle_button_set_active(checkbox,FALSE); | |
| 97 | - gtk_widget_set_sensitive(GTK_WIDGET(checkbox),FALSE); | |
| 98 | + gtk_toggle_button_set_active(secure,FALSE); | |
| 99 | + gtk_widget_set_sensitive(GTK_WIDGET(secure),FALSE); | |
| 98 | 100 | if(!strncmp(hostname,"L:",2)) |
| 99 | 101 | hostname += 2; |
| 100 | 102 | #endif |
| 101 | 103 | |
| 104 | + ptr = strchr(hostname,','); | |
| 105 | + if(ptr) | |
| 106 | + { | |
| 107 | + *(ptr++) = 0; | |
| 108 | + gtk_toggle_button_set_active(as400,strcmp(ptr,"as400") == 0); | |
| 109 | + } | |
| 110 | + | |
| 102 | 111 | ptr = strchr(hostname,':'); |
| 103 | 112 | if(ptr) |
| 104 | 113 | { |
| ... | ... | @@ -123,7 +132,7 @@ |
| 123 | 132 | |
| 124 | 133 | gtk_widget_set_sensitive(dialog,FALSE); |
| 125 | 134 | |
| 126 | - if(gtk_toggle_button_get_active(checkbox)) | |
| 135 | + if(gtk_toggle_button_get_active(secure)) | |
| 127 | 136 | strcpy(buffer,"L:"); |
| 128 | 137 | else |
| 129 | 138 | *buffer = 0; |
| ... | ... | @@ -132,6 +141,9 @@ |
| 132 | 141 | strncat(buffer,":",1023); |
| 133 | 142 | strncat(buffer,gtk_entry_get_text(port),1023); |
| 134 | 143 | |
| 144 | + if(gtk_toggle_button_get_active(as400)) | |
| 145 | + strncat(buffer,",as400",1023); | |
| 146 | + | |
| 135 | 147 | if(!host_connect(buffer,1)) |
| 136 | 148 | { |
| 137 | 149 | // Connection OK | ... | ... |
src/include/lib3270/api.h
src/lib/host.c
| ... | ... | @@ -620,6 +620,9 @@ static int do_connect(H3270 *hSession, const char *n) |
| 620 | 620 | |
| 621 | 621 | int lib3270_connect(H3270 *h, const char *n, int wait) |
| 622 | 622 | { |
| 623 | + char * hostname; | |
| 624 | + char * options; | |
| 625 | + | |
| 623 | 626 | if(!h) |
| 624 | 627 | h = &h3270; |
| 625 | 628 | |
| ... | ... | @@ -631,8 +634,20 @@ int lib3270_connect(H3270 *h, const char *n, int wait) |
| 631 | 634 | if(PCONNECTED) |
| 632 | 635 | return EBUSY; |
| 633 | 636 | |
| 634 | - if(do_connect(h,n)) | |
| 637 | + hostname = strdup(n); | |
| 638 | + | |
| 639 | + options = strchr(hostname,','); | |
| 640 | + if(options) | |
| 641 | + { | |
| 642 | + *(options++) = 0; | |
| 643 | + h->as400 = strcasecmp(options,"as400") == 0 ? 1 : 0; | |
| 644 | + } | |
| 645 | + | |
| 646 | + if(do_connect(h,hostname)) | |
| 647 | + { | |
| 648 | + free(hostname); | |
| 635 | 649 | return -1; |
| 650 | + } | |
| 636 | 651 | |
| 637 | 652 | if(wait) |
| 638 | 653 | { |
| ... | ... | @@ -647,6 +662,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) |
| 647 | 662 | } |
| 648 | 663 | } |
| 649 | 664 | |
| 665 | + free(hostname); | |
| 650 | 666 | return 0; |
| 651 | 667 | } |
| 652 | 668 | ... | ... |
src/lib/kybd.c
| ... | ... | @@ -546,10 +546,19 @@ LIB3270_FKEY_ACTION( pfkey ) |
| 546 | 546 | |
| 547 | 547 | if (kybdlock & KL_OIA_MINUS) |
| 548 | 548 | return -1; |
| 549 | - else if (kybdlock) | |
| 549 | + | |
| 550 | + if (kybdlock) | |
| 551 | + { | |
| 552 | + if(h3270.as400) | |
| 553 | + enq_key(pa_xlate,0); | |
| 550 | 554 | enq_key(pf_xlate,key-1); |
| 555 | + } | |
| 551 | 556 | else |
| 557 | + { | |
| 558 | + if(h3270.as400) | |
| 559 | + key_AID(pa_xlate[0]); | |
| 552 | 560 | key_AID(pf_xlate[key-1]); |
| 561 | + } | |
| 553 | 562 | |
| 554 | 563 | return 0; |
| 555 | 564 | } | ... | ... |