Commit 02b1c4d491466f55c644eb834916a724707e6cdd
1 parent
06af5ba5
Exists in
master
and in
5 other branches
Atualizando string de licença para remover warning gerado pelo rpmlint
Showing
8 changed files
with
35 additions
and
57 deletions
Show diff stats
android/res/values/strings.xml
android/res/xml/preferences.xml
android/src/br/com/bb/pw3270/PW3270Activity.java
| ... | ... | @@ -2,6 +2,7 @@ package br.com.bb.pw3270; |
| 2 | 2 | |
| 3 | 3 | import android.app.Activity; |
| 4 | 4 | import android.os.Bundle; |
| 5 | +import android.preference.PreferenceManager; | |
| 5 | 6 | import android.util.Log; |
| 6 | 7 | import android.content.Intent; |
| 7 | 8 | import android.content.SharedPreferences; |
| ... | ... | @@ -33,17 +34,9 @@ public class PW3270Activity extends Activity |
| 33 | 34 | private class terminal extends lib3270 |
| 34 | 35 | { |
| 35 | 36 | |
| 36 | - terminal() | |
| 37 | + terminal(SharedPreferences settings) | |
| 37 | 38 | { |
| 38 | - SharedPreferences settings = getSharedPreferences(TAG, 0); | |
| 39 | - hostname = settings.getString("hostname",hostname); | |
| 40 | - port = settings.getInt("port",port); | |
| 41 | - ssl = settings.getBoolean("ssl",ssl); | |
| 42 | - | |
| 43 | - setToggle("dstrace",settings.getBoolean("dstrace",true)); | |
| 44 | - setToggle("screentrace",settings.getBoolean("screentrace",true)); | |
| 45 | - setToggle("eventtrace",settings.getBoolean("eventtrace",true)); | |
| 46 | - | |
| 39 | + super(settings); | |
| 47 | 40 | } |
| 48 | 41 | |
| 49 | 42 | public void hideProgressDialog() |
| ... | ... | @@ -60,7 +53,6 @@ public class PW3270Activity extends Activity |
| 60 | 53 | |
| 61 | 54 | protected void updateScreen() |
| 62 | 55 | { |
| 63 | - // showProgressDialog("Aguarde..."); | |
| 64 | 56 | view.reload(); |
| 65 | 57 | } |
| 66 | 58 | |
| ... | ... | @@ -125,6 +117,8 @@ public class PW3270Activity extends Activity |
| 125 | 117 | @Override |
| 126 | 118 | public void onCreate(Bundle savedInstanceState) |
| 127 | 119 | { |
| 120 | + SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); | |
| 121 | + | |
| 128 | 122 | super.onCreate(savedInstanceState); |
| 129 | 123 | |
| 130 | 124 | res = getResources(); |
| ... | ... | @@ -138,7 +132,7 @@ public class PW3270Activity extends Activity |
| 138 | 132 | // http://developer.android.com/reference/android/webkit/WebView.html |
| 139 | 133 | view = new WebView(this); |
| 140 | 134 | |
| 141 | - host = new terminal(); | |
| 135 | + host = new terminal(settings); | |
| 142 | 136 | view.addJavascriptInterface(host, "pw3270"); |
| 143 | 137 | |
| 144 | 138 | view.setWebChromeClient(new WebChromeClient()); |
| ... | ... | @@ -183,7 +177,8 @@ public class PW3270Activity extends Activity |
| 183 | 177 | setContentView(view); |
| 184 | 178 | view.loadUrl("file:index.html"); |
| 185 | 179 | |
| 186 | - host.connect(); | |
| 180 | + if(settings.getString("hostname","") != "") | |
| 181 | + host.connect(); | |
| 187 | 182 | |
| 188 | 183 | } |
| 189 | 184 | ... | ... |
android/src/br/com/bb/pw3270/lib3270.java
| ... | ... | @@ -29,6 +29,8 @@ |
| 29 | 29 | package br.com.bb.pw3270; |
| 30 | 30 | |
| 31 | 31 | import java.lang.Thread; |
| 32 | + | |
| 33 | +import android.content.SharedPreferences; | |
| 32 | 34 | import android.os.Handler; |
| 33 | 35 | import android.os.Message; |
| 34 | 36 | import android.os.CountDownTimer; |
| ... | ... | @@ -55,9 +57,7 @@ public class lib3270 |
| 55 | 57 | DataOutputStream outData = null; |
| 56 | 58 | DataInputStream inData = null; |
| 57 | 59 | |
| 58 | - protected String hostname = "3270.df.bb"; | |
| 59 | - protected int port = 8023; | |
| 60 | - protected boolean ssl = false; | |
| 60 | + protected SharedPreferences settings; | |
| 61 | 61 | |
| 62 | 62 | // Define the Handler that receives messages from the thread |
| 63 | 63 | final Handler mHandler = new Handler() |
| ... | ... | @@ -125,10 +125,17 @@ public class lib3270 |
| 125 | 125 | System.loadLibrary("3270"); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - lib3270() | |
| 128 | + lib3270(SharedPreferences settings) | |
| 129 | 129 | { |
| 130 | - screenState = 0; | |
| 131 | - mainloop = null; | |
| 130 | + String toggle[] = { "dstrace", "screentrace", "eventtrace", "reconnect" }; | |
| 131 | + | |
| 132 | + this.settings = settings; | |
| 133 | + this.screenState = 0; | |
| 134 | + this.mainloop = null; | |
| 135 | + | |
| 136 | + for(int f = 0; f < toggle.length; f++) | |
| 137 | + setToggle(toggle[f],settings.getBoolean(toggle[f],false)); | |
| 138 | + | |
| 132 | 139 | } |
| 133 | 140 | |
| 134 | 141 | private class timer extends CountDownTimer |
| ... | ... | @@ -174,30 +181,6 @@ public class lib3270 |
| 174 | 181 | } |
| 175 | 182 | } |
| 176 | 183 | |
| 177 | - /* | |
| 178 | - private class byteMessage | |
| 179 | - { | |
| 180 | - byte[] msg; | |
| 181 | - int sz; | |
| 182 | - | |
| 183 | - byteMessage(byte[] contents, int len) | |
| 184 | - { | |
| 185 | - msg = contents; | |
| 186 | - sz = len; | |
| 187 | - } | |
| 188 | - | |
| 189 | - byte[] getMessage() | |
| 190 | - { | |
| 191 | - return msg; | |
| 192 | - } | |
| 193 | - | |
| 194 | - int getLength() | |
| 195 | - { | |
| 196 | - return sz; | |
| 197 | - } | |
| 198 | - } | |
| 199 | - */ | |
| 200 | - | |
| 201 | 184 | protected int send_data(byte[] data, int len) |
| 202 | 185 | { |
| 203 | 186 | Log.i(TAG, "Bytes a enviar: " + len); |
| ... | ... | @@ -234,14 +217,16 @@ public class lib3270 |
| 234 | 217 | private boolean connect() |
| 235 | 218 | { |
| 236 | 219 | // Connecta no host |
| 237 | - SocketFactory socketFactory; | |
| 238 | - | |
| 239 | - if (hostname == "") | |
| 220 | + SocketFactory socketFactory; | |
| 221 | + String hostname = settings.getString("hostname",""); | |
| 222 | + Integer port = new Integer(settings.getString("port","23")); | |
| 223 | + | |
| 224 | + if (hostname == "" || port == 0) | |
| 240 | 225 | return false; |
| 241 | 226 | |
| 242 | 227 | postMessage(1, 14, 0); |
| 243 | 228 | |
| 244 | - if (ssl) | |
| 229 | + if(settings.getBoolean("ssl",false)) | |
| 245 | 230 | { |
| 246 | 231 | // Host é SSL |
| 247 | 232 | socketFactory = SSLSocketFactory.getDefault(); |
| ... | ... | @@ -255,7 +240,7 @@ public class lib3270 |
| 255 | 240 | |
| 256 | 241 | try |
| 257 | 242 | { |
| 258 | - Log.v(TAG,"Getting socket for " + hostname + ":" + Integer.toString(port)); | |
| 243 | + Log.v(TAG,"Getting socket for " + hostname + ":" + port.toString()); | |
| 259 | 244 | sock = socketFactory.createSocket(hostname, port); |
| 260 | 245 | outData = new DataOutputStream(sock.getOutputStream()); |
| 261 | 246 | inData = new DataInputStream(sock.getInputStream()); |
| ... | ... | @@ -317,10 +302,6 @@ public class lib3270 |
| 317 | 302 | { |
| 318 | 303 | Log.i(TAG, Integer.toString(sz) + " bytes recebidos"); |
| 319 | 304 | procRecvdata(in,sz); |
| 320 | - // Message msg = mHandler.obtainMessage(); | |
| 321 | - // msg.what = 6; | |
| 322 | - // msg.obj = new byteMessage(in, sz); | |
| 323 | - // mHandler.sendMessage(msg); | |
| 324 | 305 | } catch (Exception e) |
| 325 | 306 | { |
| 326 | 307 | Log.i(TAG, "Erro ao processar dados recebidos: " + e.getLocalizedMessage()); | ... | ... |
pw3270.spec.in
| ... | ... | @@ -62,7 +62,7 @@ |
| 62 | 62 | #---[ Packaging ]----------------------------------------------------------------------------------------------------- |
| 63 | 63 | |
| 64 | 64 | Name: @PACKAGE@ |
| 65 | -License: LGPL | |
| 65 | +License: GPL-2.0 | |
| 66 | 66 | Group: System/X11/Terminals |
| 67 | 67 | Version: @PACKAGE_VERSION@ |
| 68 | 68 | Release: %_release | ... | ... |
src/lib3270/session.c
src/lib3270/util.c
src/pw3270/print.c
| ... | ... | @@ -360,6 +360,8 @@ static gchar * enum_to_string(GType type, guint enum_value) |
| 360 | 360 | |
| 361 | 361 | // Show and return |
| 362 | 362 | gtk_widget_show_all(container); |
| 363 | + | |
| 364 | + trace("%s ends",__FUNCTION__); | |
| 363 | 365 | return G_OBJECT(container); |
| 364 | 366 | } |
| 365 | 367 | |
| ... | ... | @@ -483,6 +485,7 @@ static gchar * enum_to_string(GType type, guint enum_value) |
| 483 | 485 | gtk_print_operation_set_print_settings(print,settings); |
| 484 | 486 | gtk_print_operation_set_default_page_setup(print,setup); |
| 485 | 487 | |
| 488 | + trace("%s ends",__FUNCTION__); | |
| 486 | 489 | return print; |
| 487 | 490 | } |
| 488 | 491 | ... | ... |