Commit 63b4fa6029920ca47b4316c4b2322940e7c1c0f1

Authored by perry.werneck@gmail.com
1 parent 0b58195c

Implementando conversao de strings de controle no plugin HLLAPI

@@ -5,7 +5,7 @@ msgid "" @@ -5,7 +5,7 @@ msgid ""
5 msgstr "" 5 msgstr ""
6 "Project-Id-Version: pw3270 5.0\n" 6 "Project-Id-Version: pw3270 5.0\n"
7 "Report-Msgid-Bugs-To: \n" 7 "Report-Msgid-Bugs-To: \n"
8 -"POT-Creation-Date: 2012-09-20 17:26-0300\n" 8 +"POT-Creation-Date: 2012-09-20 18:39-0300\n"
9 "PO-Revision-Date: 2012-09-20 17:33-0300\n" 9 "PO-Revision-Date: 2012-09-20 17:33-0300\n"
10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 "Language-Team: Português <perry.werneck@gmail.com>\n" 11 "Language-Team: Português <perry.werneck@gmail.com>\n"
src/lib3270/kybd.c
@@ -2628,11 +2628,11 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len @@ -2628,11 +2628,11 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len
2628 break; 2628 break;
2629 2629
2630 case '[': /* APL left bracket */ 2630 case '[': /* APL left bracket */
2631 - key_ACharacter(hSession,(unsigned char) c, KT_STD, ia, &skipped); 2631 + key_ACharacter(hSession,(unsigned char) c, KT_STD, ia, &skipped);
2632 break; 2632 break;
2633 2633
2634 case ']': /* APL right bracket */ 2634 case ']': /* APL right bracket */
2635 - key_ACharacter(hSession,(unsigned char) c, KT_STD, ia, &skipped); 2635 + key_ACharacter(hSession,(unsigned char) c, KT_STD, ia, &skipped);
2636 break; 2636 break;
2637 2637
2638 default: 2638 default:
src/plugins/remotectl/remotectl.c
@@ -35,11 +35,16 @@ @@ -35,11 +35,16 @@
35 #include <pw3270.h> 35 #include <pw3270.h>
36 #include <pw3270/plugin.h> 36 #include <pw3270/plugin.h>
37 #include <pw3270/v3270.h> 37 #include <pw3270/v3270.h>
  38 + #include <lib3270/actions.h>
38 #include <errno.h> 39 #include <errno.h>
39 #include <string.h> 40 #include <string.h>
40 41
41 /*--[ Implement ]------------------------------------------------------------------------------------*/ 42 /*--[ Implement ]------------------------------------------------------------------------------------*/
42 43
  44 + static const gchar control_char = '@';
  45 +
  46 +/*--[ Implement ]------------------------------------------------------------------------------------*/
  47 +
43 #ifdef WIN32 48 #ifdef WIN32
44 49
45 void popup_lasterror(const gchar *fmt, ...) 50 void popup_lasterror(const gchar *fmt, ...)
@@ -176,11 +181,85 @@ @@ -176,11 +181,85 @@
176 181
177 g_get_charset(&charset); 182 g_get_charset(&charset);
178 183
179 - text = g_convert(buffer,-1,lib3270_get_charset(hSession),charset,&bytes_read,&bytes_written,&error); 184 + text = g_convert(buffer,length,lib3270_get_charset(hSession),charset,&bytes_read,&bytes_written,&error);
180 if(text) 185 if(text)
181 { 186 {
182 - #warning Converter "@" em "\\"  
183 - lib3270_emulate_input(hSession,text,strlen(text),0); 187 + if(strchr(text,control_char))
  188 + {
  189 + // Convert control char
  190 + gchar * buffer = text;
  191 + char * ptr;
  192 +
  193 + for(ptr = strchr(text,control_char);ptr;ptr = strchr(buffer,control_char))
  194 + {
  195 + *(ptr++) = 0;
  196 +
  197 + lib3270_emulate_input(hSession,buffer,-1,0);
  198 +
  199 + switch(*(ptr++))
  200 + {
  201 + case 'E': // Enter
  202 + lib3270_enter(hSession);
  203 + break;
  204 +
  205 + case '1': // PF1
  206 + lib3270_pfkey(hSession,1);
  207 + break;
  208 +
  209 + case '2': // PF2
  210 + lib3270_pfkey(hSession,2);
  211 + break;
  212 +
  213 + case '3': // PF3
  214 + lib3270_pfkey(hSession,3);
  215 + break;
  216 +
  217 + case '4': // PF4
  218 + lib3270_pfkey(hSession,4);
  219 + break;
  220 +
  221 + case '5': // PF5
  222 + lib3270_pfkey(hSession,5);
  223 + break;
  224 +
  225 + case '6': // PF6
  226 + lib3270_pfkey(hSession,6);
  227 + break;
  228 +
  229 + case '7': // PF7
  230 + lib3270_pfkey(hSession,7);
  231 + break;
  232 +
  233 + case '8': // PF8
  234 + lib3270_pfkey(hSession,8);
  235 + break;
  236 +
  237 + case '9': // PF9
  238 + lib3270_pfkey(hSession,9);
  239 + break;
  240 +
  241 + case 'a': // PF10
  242 + lib3270_pfkey(hSession,10);
  243 + break;
  244 +
  245 + case 'b': // PF11
  246 + lib3270_pfkey(hSession,11);
  247 + break;
  248 +
  249 + case 'c': // PF12
  250 + lib3270_pfkey(hSession,12);
  251 + break;
  252 + }
  253 +
  254 + }
  255 +
  256 + lib3270_emulate_input(hSession,buffer,-1,0);
  257 +
  258 + }
  259 + else
  260 + {
  261 + lib3270_emulate_input(hSession,text,strlen(text),0);
  262 + }
184 g_free(text); 263 g_free(text);
185 rc = 0; 264 rc = 0;
186 } 265 }