rhodes 1.5.5 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Manifest.txt +214 -32
- data/Rakefile +33 -10
- data/bin/upgrade-rhodes-app +0 -1
- data/lib/build/compileERB/bb.rb +2 -2
- data/lib/build/compileERB/default.rb +7 -5
- data/lib/build/jake.rb +1 -1
- data/lib/extensions/digest-md5/ext.yml +1 -1
- data/lib/extensions/digest-md5/ext/Rakefile +35 -36
- data/lib/extensions/digest-md5/ext/build.bat +1 -0
- data/lib/extensions/digest-md5/ext/digest-md5.vcproj +203 -0
- data/lib/extensions/digest-sha1/ext.yml +1 -1
- data/lib/extensions/digest/ext.yml +1 -1
- data/lib/extensions/digest/ext/Rakefile +35 -39
- data/lib/extensions/digest/ext/build.bat +1 -2
- data/lib/extensions/digest/ext/digest.vcproj +203 -0
- data/lib/framework/rho/render.rb +79 -22
- data/lib/framework/rho/rho.rb +294 -56
- data/lib/framework/rho/rhoapplication.rb +10 -0
- data/lib/framework/rho/rhofsconnector.rb +2 -6
- data/lib/framework/rho/rhoutils.rb +56 -14
- data/lib/framework/rho/rhoviewhelpers.rb +2 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom.rb +42 -15
- data/lib/framework/rhom/rhom_db_adapter.rb +165 -159
- data/lib/framework/rhom/rhom_object.rb +0 -1
- data/lib/framework/rhom/rhom_object_factory.rb +343 -166
- data/lib/framework/rhom/rhom_source.rb +28 -15
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +39 -44
- data/platform/android/Rhodes/jni/include/JNIRhodes.h +1 -1
- data/platform/android/Rhodes/jni/include/details/rhojava.inc +23 -20
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_RhoMenu.h +61 -0
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_Rhodes.h +16 -0
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_alert_Alert.h +21 -0
- data/platform/android/Rhodes/jni/include/sslimpl.h +1 -1
- data/platform/android/Rhodes/jni/src/alert.cpp +32 -5
- data/platform/android/Rhodes/jni/src/callbacks.cpp +51 -21
- data/platform/android/Rhodes/jni/src/mapview.cpp +3 -8
- data/platform/android/Rhodes/jni/src/menu.cpp +70 -0
- data/platform/android/Rhodes/jni/src/navbar.cpp +16 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +37 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -3
- data/platform/android/Rhodes/jni/src/webview.cpp +21 -7
- data/platform/android/Rhodes/res/drawable/alert_alert.png +0 -0
- data/platform/android/Rhodes/res/drawable/alert_info.png +0 -0
- data/platform/android/Rhodes/res/drawable/alert_question.png +0 -0
- data/platform/android/Rhodes/res/drawable/camera.png +0 -0
- data/platform/android/Rhodes/res/layout/camera.xml +18 -3
- data/platform/android/Rhodes/res/menu/options.xml +0 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +5 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +12 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +105 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +157 -122
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +7 -58
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +16 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +220 -17
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +22 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +44 -25
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +3 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +10 -21
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +15 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +44 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +47 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +13 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/TelUriHandler.java +11 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java +1 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/VideoUriHandler.java +61 -0
- data/platform/android/build/RhodesSRC_build.files +3 -0
- data/platform/android/build/android.rake +173 -60
- data/platform/android/build/androidcommon.rb +1 -2
- data/platform/android/build/librhocommon_build.files +5 -0
- data/platform/android/build/librhodes_build.files +2 -0
- data/platform/android/build/libruby_build.files +2 -1
- data/platform/bb/Hsqldb/Hsqldb.jdp +0 -3
- data/platform/bb/Hsqldb/src/com/rho/db/FileUtilBB.java +1 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +16 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBRowResult.java +5 -0
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +25 -4
- data/platform/bb/Hsqldb/src/com/rho/db/Journal.java +1 -1
- data/platform/bb/Hsqldb/src/com/rho/file/FileAccessBB.java +0 -1
- data/platform/bb/Hsqldb/src/j2me/math/Number.java +6 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/CompiledStatementExecutor.java +2 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Result.java +2 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Select.java +12 -6
- data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +19 -12
- data/platform/bb/Hsqldb/src/org/hsqldb/Table.java +10 -4
- data/platform/bb/Hsqldb/src/org/hsqldb/Token.java +10 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +3 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/lib/java/JavaSystem.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/HsqlProperties.java +2 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/ScaledRAFile.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptReaderText.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptWriterBase.java +1 -1
- data/platform/bb/RubyVM/RubyVM.jdp +9 -10
- data/platform/bb/build/RubyVM_build.files +9 -7
- data/platform/bb/build/bb.rake +13 -3
- data/platform/bb/build/hsqldb_build.files +0 -2
- data/platform/bb/build/rhodes_build.files +5 -2
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +8 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +154 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhoMainScreen.java +8 -0
- data/platform/bb/rhodes/platform/common/com/rho/BrowserAdapter5.java +28 -0
- data/platform/bb/rhodes/rhodes.jdp +12 -7
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +331 -0
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +28 -0
- data/platform/bb/rhodes/src/com/rho/IBrowserAdapter.java +10 -0
- data/platform/bb/rhodes/src/com/rho/RhoMainScreen.java +4 -0
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +2 -4
- data/platform/bb/rhodes/src/com/rho/{Jsr75File.java → file/Jsr75File.java} +83 -36
- data/platform/bb/{Hsqldb → rhodes}/src/com/rho/file/Jsr75RAFileImpl.java +0 -1
- data/platform/bb/{Hsqldb → rhodes}/src/com/rho/file/PersistRAFileImpl.java +0 -2
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +8 -10
- data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +1 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +39 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +63 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +100 -0
- data/platform/bb/rhodes/src/rhomobile/LogScreen.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +13 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +138 -492
- data/platform/bb/rhodes/src/rhomobile/SecondaryResourceFetchThread.java +11 -2
- data/platform/bb/rhodes/src/rhomobile/Utilities.java +14 -10
- data/platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java +5 -14
- data/platform/bb/rhodes/src/rhomobile/camera/ImageBrowserScreen.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +2 -2
- data/platform/iphone/Classes/AppManager/AppManager.m +37 -14
- data/platform/iphone/Classes/Camera/PickImageDelegate.h +15 -4
- data/platform/iphone/Classes/Camera/PickImageDelegate.m +53 -50
- data/platform/iphone/Classes/DateTimePicker.h +17 -0
- data/platform/iphone/Classes/DateTimePicker.m +35 -0
- data/platform/iphone/Classes/GeoLocation/LocationController.m +2 -3
- data/platform/iphone/Classes/LogOptionsController.m +3 -2
- data/platform/iphone/Classes/LogViewController.m +4 -2
- data/platform/iphone/Classes/MapView/GoogleGeocoder.m +12 -20
- data/platform/iphone/Classes/MapView/MapAnnotation.h +9 -13
- data/platform/iphone/Classes/MapView/MapAnnotation.m +17 -65
- data/platform/iphone/Classes/MapView/MapViewController.h +1 -7
- data/platform/iphone/Classes/MapView/MapViewController.m +51 -25
- data/platform/iphone/Classes/NativeBar.h +0 -12
- data/platform/iphone/Classes/NativeBar.m +121 -2
- data/platform/iphone/Classes/NavBar.h +16 -0
- data/platform/iphone/Classes/NavBar.m +115 -0
- data/platform/iphone/Classes/RhoAlert.h +19 -0
- data/platform/iphone/Classes/RhoAlert.m +258 -0
- data/platform/iphone/Classes/RhoDelegate.m +1 -0
- data/platform/iphone/Classes/RhoMainView.h +33 -0
- data/platform/iphone/Classes/Rhodes.h +56 -0
- data/platform/iphone/Classes/Rhodes.m +533 -0
- data/platform/iphone/Classes/RingtoneManager.h +17 -0
- data/platform/iphone/Classes/RingtoneManager.m +73 -0
- data/platform/iphone/Classes/SimpleMainView.h +30 -0
- data/platform/iphone/Classes/SimpleMainView.m +380 -0
- data/platform/iphone/Classes/TabbedMainView.h +24 -0
- data/platform/iphone/Classes/TabbedMainView.m +202 -0
- data/platform/iphone/Classes/WebView.m +123 -0
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +2 -2
- data/platform/iphone/Classes/rho/net/sslimpl.cpp +13 -1
- data/platform/iphone/Classes/rho/net/sslimpl.h +1 -1
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +44 -0
- data/platform/iphone/main.m +1 -2
- data/platform/iphone/rbuild/iphone.rake +8 -16
- data/platform/iphone/rhoextlib/dosyscall.c +1 -1
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +6 -4
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +12 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +97 -62
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +12 -0
- data/platform/osx/Rhodes Launcher/launch.rb +14 -21
- data/platform/shared/common/AppMenu.cpp +122 -0
- data/platform/shared/common/AppMenu.h +46 -0
- data/platform/shared/common/PosixThreadImpl.cpp +1 -1
- data/platform/shared/common/RhoConf.cpp +27 -2
- data/platform/shared/common/RhoConf.h +5 -0
- data/platform/shared/common/RhoFilePath.h +21 -0
- data/platform/shared/common/RhoStd.h +44 -5
- data/platform/shared/common/RhoTime.h +20 -7
- data/platform/shared/common/RhodesApp.cpp +236 -177
- data/platform/shared/common/RhodesApp.h +36 -13
- data/platform/shared/common/SplashScreen.cpp +2 -2
- data/platform/shared/common/StringConverter.h +10 -11
- data/platform/shared/common/rhoparams.c +0 -6
- data/platform/shared/curl/lib/rhossl.c +3 -2
- data/platform/shared/curl/lib/url.c +0 -5
- data/platform/shared/db/DBAdapter.cpp +304 -81
- data/platform/shared/db/DBAdapter.h +24 -7
- data/platform/shared/db/DBAttrManager.cpp +83 -30
- data/platform/shared/db/DBAttrManager.h +6 -0
- data/platform/shared/db/DBResult.h +15 -4
- data/platform/shared/json/JSONIterator.cpp +100 -3
- data/platform/shared/json/JSONIterator.h +28 -3
- data/platform/shared/net/AsyncHttp.cpp +25 -22
- data/platform/shared/net/AsyncHttp.h +10 -6
- data/platform/shared/net/CURLNetRequest.cpp +115 -36
- data/platform/shared/net/CURLNetRequest.h +6 -0
- data/platform/shared/net/HttpServer.cpp +6 -4
- data/platform/shared/net/HttpServer.h +0 -1
- data/platform/shared/net/INetRequest.h +19 -3
- data/platform/shared/net/URI.cpp +2 -2
- data/platform/shared/net/ssl.cpp +2 -2
- data/platform/shared/net/ssl.h +2 -2
- data/platform/shared/ruby/ext/alert/alert.i +14 -2
- data/platform/shared/ruby/ext/alert/alert_wrap.c +40 -20
- data/platform/shared/ruby/ext/asynchttp/asynchttp.i +8 -8
- data/platform/shared/ruby/ext/asynchttp/asynchttp_wrap.c +112 -16
- data/platform/shared/ruby/ext/geolocation/geolocation.i +16 -12
- data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +481 -125
- data/platform/shared/ruby/ext/navbar/navbar.i +20 -0
- data/platform/shared/ruby/ext/navbar/navbar_wrap.c +1859 -0
- data/platform/shared/ruby/ext/rho/extensions.c +1 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +32 -2
- data/platform/shared/ruby/ext/rho/rhoruby.h +7 -2
- data/platform/shared/ruby/ext/rhoconf/rhoconf.i +4 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +31 -0
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +188 -3226
- data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -25
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +96 -104
- data/platform/shared/ruby/ext/system/system.i +12 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +101 -7
- data/platform/shared/ruby/ext/webview/webview.i +20 -15
- data/platform/shared/ruby/ext/webview/webview_wrap.c +42 -16
- data/platform/shared/ruby/thread_pthread.c +4 -4
- data/platform/shared/ruby/thread_win32.c +4 -4
- data/platform/shared/ruby/wince/io_wce.c +0 -1
- data/platform/shared/rubyJVM/src/com/rho/FilePath.java +18 -2
- data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/Properties.java +9 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoClassFactory.java +2 -3
- data/platform/shared/rubyJVM/src/com/rho/RhoConf.java +47 -8
- data/platform/shared/rubyJVM/src/com/rho/RhoLogConf.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoLogFileSink.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoRuby.java +43 -5
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +98 -3
- data/platform/shared/rubyJVM/src/com/rho/db/DBAdapter.java +460 -175
- data/platform/shared/rubyJVM/src/com/rho/db/DBAttrManager.java +81 -33
- data/platform/shared/rubyJVM/src/com/rho/db/IDBCallback.java +3 -5
- data/platform/shared/rubyJVM/src/com/rho/db/IDBResult.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/db/IDBStorage.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/{IFile.java → file/IFile.java} +1 -1
- data/platform/shared/rubyJVM/src/com/rho/{IFileAccess.java → file/IFileAccess.java} +1 -1
- data/platform/shared/rubyJVM/src/com/rho/{IRAFile.java → file/IRAFile.java} +1 -1
- data/platform/{bb/Hsqldb/src/com/rho/db → shared/rubyJVM/src/com/rho/file}/RandomAccessFile.java +1 -2
- data/platform/shared/rubyJVM/src/com/rho/{SimpleFile.java → file/SimpleFile.java} +5 -1
- data/platform/shared/rubyJVM/src/com/rho/net/AsyncHttp.java +23 -18
- data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +167 -250
- data/platform/shared/rubyJVM/src/com/rho/net/RhoConnection.java +100 -30
- data/platform/shared/rubyJVM/src/com/rho/net/URI.java +0 -1
- data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +30 -33
- data/platform/shared/rubyJVM/src/com/rho/sync/ISyncProtocol.java +20 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/JSONEntry.java +5 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/JSONStructIterator.java +74 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +486 -257
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncNotify.java +89 -58
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncProtocol_3.java +79 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +634 -495
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +74 -90
- data/platform/shared/rubyJVM/src/com/xruby/GeneratedMethods/RubySymbol_Methods.java +1 -0
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyThread.java +6 -0
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyRuntime.java +6 -2
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubySymbol.java +17 -1
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyValue.java +1 -0
- data/platform/shared/rubyJVM/src/org/json/me/JSONObject.java +3 -0
- data/platform/shared/rubyext/GeoLocation.cpp +23 -0
- data/platform/shared/rubyext/GeoLocation.h +2 -0
- data/platform/shared/rubyext/RhoRuby.cpp +31 -0
- data/platform/shared/rubyext/RhoRuby.h +32 -0
- data/platform/shared/rubyext/System.cpp +14 -3
- data/platform/shared/rubyext/WebView.h +21 -0
- data/platform/shared/sync/ClientRegister.cpp +23 -28
- data/platform/shared/sync/ClientRegister.h +6 -2
- data/platform/shared/sync/ISyncProtocol.h +29 -0
- data/platform/shared/sync/SyncEngine.cpp +450 -190
- data/platform/shared/sync/SyncEngine.h +28 -38
- data/platform/shared/sync/SyncNotify.cpp +43 -41
- data/platform/shared/sync/SyncNotify.h +7 -7
- data/platform/shared/sync/SyncProtocol_3.h +86 -0
- data/platform/shared/sync/SyncSource.cpp +535 -371
- data/platform/shared/sync/SyncSource.h +48 -55
- data/platform/shared/sync/SyncThread.cpp +59 -103
- data/platform/shared/sync/SyncThread.h +10 -23
- data/platform/shared/unzip/unzip.cpp +3 -2
- data/platform/shared/unzip/unzip.h +5 -1
- data/platform/shared/wtl80/include/atlapp.h +10 -10
- data/platform/wm/RhoLib/RhoLib.vcproj +32 -0
- data/platform/wm/build/build_inf.js +40 -3
- data/platform/wm/build/wm.rake +95 -9
- data/platform/wm/rhodes/Alert.cpp +4 -0
- data/platform/wm/rhodes/DateTimePicker.cpp +183 -0
- data/platform/wm/rhodes/DateTimePicker.h +100 -0
- data/platform/wm/rhodes/MainWindow.cpp +222 -209
- data/platform/wm/rhodes/MainWindow.h +28 -35
- data/platform/wm/rhodes/Rhodes.cpp +20 -60
- data/platform/wm/rhodes/Rhodes.rc +41 -7
- data/platform/wm/rhodes/Utils.cpp +65 -0
- data/platform/wm/rhodes/Utils.h +9 -0
- data/platform/wm/rhodes/camera/Camera.cpp +2 -2
- data/platform/wm/rhodes/menubar.cpp +2 -33
- data/platform/wm/rhodes/menubar.h +0 -14
- data/platform/wm/rhodes/resource.h +13 -11
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +16 -35
- data/platform/wm/rhodes/rho/net/NetRequest.h +8 -2
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +264 -46
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +14 -4
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +1 -1
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +77 -4
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +63 -0
- data/platform/wm/rhodes/rhodes.vcproj +20 -66
- data/platform/wm/rhodes/stdafx.h +22 -0
- data/platform/wm/rubylib/rubylib.vcproj +4 -0
- data/platform/wm/syncengine/syncengine.vcproj +8 -0
- data/platform/wm/tools/detool.sln +66 -0
- data/platform/wm/tools/detool/DEMComInterface.tlb +0 -0
- data/platform/wm/tools/detool/ReadMe.txt +33 -0
- data/platform/wm/tools/detool/detool.cpp +559 -0
- data/platform/wm/tools/detool/detool.h +5 -0
- data/platform/wm/tools/detool/detool.vcproj +233 -0
- data/platform/wm/tools/detool/stdafx.cpp +8 -0
- data/platform/wm/tools/detool/stdafx.h +15 -0
- data/platform/wm/tools/detool/targetver.h +24 -0
- data/platform/wm/tools/rhosetup/ReadMe.txt +41 -0
- data/platform/wm/tools/rhosetup/rhosetup.cpp +52 -0
- data/platform/wm/tools/rhosetup/rhosetup.vcproj +641 -0
- data/platform/wm/tools/rhosetup/stdafx.cpp +8 -0
- data/platform/wm/tools/rhosetup/stdafx.h +59 -0
- data/rakefile.rb +33 -10
- data/res/build-tools/db/syncdb.schema +25 -23
- data/res/build-tools/db/syncdb.triggers +1 -1
- data/res/build-tools/detool.exe +0 -0
- data/res/build-tools/rhosetup.dll +0 -0
- data/res/generators/rhogen.rb +27 -22
- data/res/generators/templates/application/app/Settings/controller.rb +3 -1
- data/res/generators/templates/application/app/Settings/home.bb.erb +17 -0
- data/res/generators/templates/application/app/Settings/home.erb +21 -12
- data/res/generators/templates/application/app/Settings/index.bb.erb +32 -0
- data/res/generators/templates/application/app/Settings/index.erb +44 -15
- data/res/generators/templates/application/app/Settings/login.bb.erb +35 -0
- data/res/generators/templates/application/app/Settings/login.erb +29 -30
- data/res/generators/templates/application/app/Settings/reset.bb.erb +15 -0
- data/res/generators/templates/application/app/Settings/reset.erb +16 -13
- data/res/generators/templates/application/app/Settings/wait.bb.erb +3 -0
- data/res/generators/templates/application/app/Settings/wait.erb +4 -4
- data/res/generators/templates/application/app/application.rb +8 -0
- data/res/generators/templates/application/app/helpers/browser_helper.rb +13 -0
- data/res/generators/templates/application/app/index.bb.erb +26 -0
- data/res/generators/templates/application/app/index.erb +21 -12
- data/res/generators/templates/application/app/layout.erb +9 -11
- data/res/generators/templates/application/public/css/android.css +285 -0
- data/res/generators/templates/application/public/css/blackberry.css +85 -78
- data/res/generators/templates/application/public/css/iphone.css +286 -296
- data/res/generators/templates/application/public/css/webkit.css +34 -0
- data/res/generators/templates/application/public/css/windows_mobile.css +208 -0
- data/res/generators/templates/application/public/icons/Read me first - license.txt +14 -0
- data/res/generators/templates/application/public/icons/about.png +0 -0
- data/res/generators/templates/application/public/icons/airplane.png +0 -0
- data/res/generators/templates/application/public/icons/baby.png +0 -0
- data/res/generators/templates/application/public/icons/badge.png +0 -0
- data/res/generators/templates/application/public/icons/bandaid.png +0 -0
- data/res/generators/templates/application/public/icons/bar-chart.png +0 -0
- data/res/generators/templates/application/public/icons/battery.png +0 -0
- data/res/generators/templates/application/public/icons/beaker.png +0 -0
- data/res/generators/templates/application/public/icons/beaker2.png +0 -0
- data/res/generators/templates/application/public/icons/beermug.png +0 -0
- data/res/generators/templates/application/public/icons/bird.png +0 -0
- data/res/generators/templates/application/public/icons/book.png +0 -0
- data/res/generators/templates/application/public/icons/bookmark.png +0 -0
- data/res/generators/templates/application/public/icons/brightness.png +0 -0
- data/res/generators/templates/application/public/icons/bug.png +0 -0
- data/res/generators/templates/application/public/icons/cabinet.png +0 -0
- data/res/generators/templates/application/public/icons/calendar.png +0 -0
- data/res/generators/templates/application/public/icons/camera.png +0 -0
- data/res/generators/templates/application/public/icons/changeName.rb +22 -0
- data/res/generators/templates/application/public/icons/chat2.png +0 -0
- data/res/generators/templates/application/public/icons/chicken.png +0 -0
- data/res/generators/templates/application/public/icons/clock.png +0 -0
- data/res/generators/templates/application/public/icons/cloud.png +0 -0
- data/res/generators/templates/application/public/icons/coffee.png +0 -0
- data/res/generators/templates/application/public/icons/compass.png +0 -0
- data/res/generators/templates/application/public/icons/contrast.png +0 -0
- data/res/generators/templates/application/public/icons/dashboard.png +0 -0
- data/res/generators/templates/application/public/icons/display.png +0 -0
- data/res/generators/templates/application/public/icons/dogpaw.png +0 -0
- data/res/generators/templates/application/public/icons/download.png +0 -0
- data/res/generators/templates/application/public/icons/dumbbell.png +0 -0
- data/res/generators/templates/application/public/icons/ekg.png +0 -0
- data/res/generators/templates/application/public/icons/envelope.png +0 -0
- data/res/generators/templates/application/public/icons/equalizer.png +0 -0
- data/res/generators/templates/application/public/icons/eye.png +0 -0
- data/res/generators/templates/application/public/icons/film-roll.png +0 -0
- data/res/generators/templates/application/public/icons/flag.png +0 -0
- data/res/generators/templates/application/public/icons/fork-and-knife.png +0 -0
- data/res/generators/templates/application/public/icons/fuel.png +0 -0
- data/res/generators/templates/application/public/icons/gameplan.png +0 -0
- data/res/generators/templates/application/public/icons/gear.png +0 -0
- data/res/generators/templates/application/public/icons/gear2.png +0 -0
- data/res/generators/templates/application/public/icons/gift.png +0 -0
- data/res/generators/templates/application/public/icons/heart.png +0 -0
- data/res/generators/templates/application/public/icons/house.png +0 -0
- data/res/generators/templates/application/public/icons/inbox.png +0 -0
- data/res/generators/templates/application/public/icons/index-cards.png +0 -0
- data/res/generators/templates/application/public/icons/iphone.png +0 -0
- data/res/generators/templates/application/public/icons/ipod.png +0 -0
- data/res/generators/templates/application/public/icons/key.png +0 -0
- data/res/generators/templates/application/public/icons/lifebuoy.png +0 -0
- data/res/generators/templates/application/public/icons/lightbulb.png +0 -0
- data/res/generators/templates/application/public/icons/line-chart.png +0 -0
- data/res/generators/templates/application/public/icons/location.png +0 -0
- data/res/generators/templates/application/public/icons/lock.png +0 -0
- data/res/generators/templates/application/public/icons/loopback.png +0 -0
- data/res/generators/templates/application/public/icons/magnifying-glass.png +0 -0
- data/res/generators/templates/application/public/icons/map-marker.png +0 -0
- data/res/generators/templates/application/public/icons/map.png +0 -0
- data/res/generators/templates/application/public/icons/medical-bag.png +0 -0
- data/res/generators/templates/application/public/icons/medical.png +0 -0
- data/res/generators/templates/application/public/icons/microphone.png +0 -0
- data/res/generators/templates/application/public/icons/movie1.png +0 -0
- data/res/generators/templates/application/public/icons/movie2.png +0 -0
- data/res/generators/templates/application/public/icons/network.png +0 -0
- data/res/generators/templates/application/public/icons/note.png +0 -0
- data/res/generators/templates/application/public/icons/outlet.png +0 -0
- data/res/generators/templates/application/public/icons/palette.png +0 -0
- data/res/generators/templates/application/public/icons/paperclip.png +0 -0
- data/res/generators/templates/application/public/icons/phone.png +0 -0
- data/res/generators/templates/application/public/icons/photos.png +0 -0
- data/res/generators/templates/application/public/icons/piano.png +0 -0
- data/res/generators/templates/application/public/icons/picture-frame.png +0 -0
- data/res/generators/templates/application/public/icons/pill.png +0 -0
- data/res/generators/templates/application/public/icons/pin.png +0 -0
- data/res/generators/templates/application/public/icons/pinetree.png +0 -0
- data/res/generators/templates/application/public/icons/planet.png +0 -0
- data/res/generators/templates/application/public/icons/puzzle.png +0 -0
- data/res/generators/templates/application/public/icons/radar.png +0 -0
- data/res/generators/templates/application/public/icons/redo.png +0 -0
- data/res/generators/templates/application/public/icons/refresh.png +0 -0
- data/res/generators/templates/application/public/icons/runner.png +0 -0
- data/res/generators/templates/application/public/icons/shoebox.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-bag.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-cart.png +0 -0
- data/res/generators/templates/application/public/icons/shuffle.png +0 -0
- data/res/generators/templates/application/public/icons/signpost.png +0 -0
- data/res/generators/templates/application/public/icons/skull-n-crossbones.png +0 -0
- data/res/generators/templates/application/public/icons/skull.png +0 -0
- data/res/generators/templates/application/public/icons/sliders.png +0 -0
- data/res/generators/templates/application/public/icons/spraycan.png +0 -0
- data/res/generators/templates/application/public/icons/squiggle.png +0 -0
- data/res/generators/templates/application/public/icons/star.png +0 -0
- data/res/generators/templates/application/public/icons/stopwatch.png +0 -0
- data/res/generators/templates/application/public/icons/suitcase.png +0 -0
- data/res/generators/templates/application/public/icons/tag.png +0 -0
- data/res/generators/templates/application/public/icons/tags.png +0 -0
- data/res/generators/templates/application/public/icons/target.png +0 -0
- data/res/generators/templates/application/public/icons/testtube.png +0 -0
- data/res/generators/templates/application/public/icons/thermometer.png +0 -0
- data/res/generators/templates/application/public/icons/toolbox.png +0 -0
- data/res/generators/templates/application/public/icons/trophy.png +0 -0
- data/res/generators/templates/application/public/icons/tshirt.png +0 -0
- data/res/generators/templates/application/public/icons/tv.png +0 -0
- data/res/generators/templates/application/public/icons/umbrella.png +0 -0
- data/res/generators/templates/application/public/icons/walk.png +0 -0
- data/res/generators/templates/application/public/icons/weather.png +0 -0
- data/res/generators/templates/application/public/icons/widescreen.png +0 -0
- data/res/generators/templates/application/public/icons/wineglass.png +0 -0
- data/res/generators/templates/application/public/icons/zap.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_check_off.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_check_on.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_radio_off.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_radio_on.png +0 -0
- data/res/generators/templates/application/public/images/android/ic_menu_more.png +0 -0
- data/res/generators/templates/application/public/images/iphone/disclosure.png +0 -0
- data/res/generators/templates/application/public/images/iphone/disclosure_detail.png +0 -0
- data/res/generators/templates/application/public/images/iphone/radiobutton.png +0 -0
- data/res/generators/templates/application/public/images/iphone/select.png +0 -0
- data/res/generators/templates/application/public/images/iphone/switch.png +0 -0
- data/res/generators/templates/application/public/images/listArrow.png +0 -0
- data/res/generators/templates/application/public/images/listArrowDown.png +0 -0
- data/res/generators/templates/model/controller.rb +2 -0
- data/res/generators/templates/model/edit.bb.erb +24 -0
- data/res/generators/templates/model/edit.erb +21 -25
- data/res/generators/templates/model/index.bb.erb +21 -0
- data/res/generators/templates/model/index.erb +28 -14
- data/res/generators/templates/model/new.bb.erb +24 -0
- data/res/generators/templates/model/new.erb +20 -20
- data/res/generators/templates/model/show.bb.erb +21 -0
- data/res/generators/templates/model/show.erb +15 -15
- data/rhobuild.yml +37 -0
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/Account/config.rb +57 -1
- data/spec/framework_spec/app/Case/config.rb +1 -1
- data/spec/framework_spec/app/Customer/config.rb +1 -1
- data/spec/framework_spec/app/Product/config.rb +15 -1
- data/spec/framework_spec/app/spec/fixtures/object_values.txt +90 -90
- data/spec/framework_spec/app/spec/pagination/fixtures/object_values.txt +91 -91
- data/spec/framework_spec/app/spec/rho_spec.rb +1 -1
- data/spec/framework_spec/app/spec/rhom_object_spec.rb +47 -28
- data/spec/framework_spec/app/spec/rhom_spec.rb +8 -8
- data/spec/framework_spec/app/spec/spec_helper.rb +13 -5
- data/spec/framework_spec/app/spec_runner.rb +5 -4
- data/spec/framework_spec/public/css/base.css +0 -1
- data/spec/framework_spec/public/css/iphone.css +0 -1
- data/spec/framework_spec/rhoconfig.txt +3 -1
- metadata +220 -37
- data/platform/bb/rhodes/src/rhomobile/WebView.java +0 -90
- data/platform/iphone/Classes/BarItem.h +0 -27
- data/platform/iphone/Classes/BarItem.m +0 -32
- data/platform/iphone/Classes/JSString.h +0 -12
- data/platform/iphone/Classes/JSString.m +0 -7
- data/platform/iphone/Classes/RhoRunnerAppDelegate.h +0 -48
- data/platform/iphone/Classes/RhoRunnerAppDelegate.m +0 -617
- data/platform/iphone/Classes/Server/ServerHost.h +0 -81
- data/platform/iphone/Classes/Server/ServerHost.m +0 -597
- data/platform/iphone/Classes/Server/WebViewUrl.h +0 -13
- data/platform/iphone/Classes/Server/WebViewUrl.m +0 -8
- data/platform/iphone/Classes/TabBarDelegate.h +0 -39
- data/platform/iphone/Classes/TabBarDelegate.m +0 -151
- data/platform/iphone/Classes/Utils/unzip.cpp +0 -4328
- data/platform/iphone/Classes/Utils/unzip.h +0 -234
- data/platform/iphone/Classes/WebViewController.h +0 -59
- data/platform/iphone/Classes/WebViewController.m +0 -472
- data/platform/wm/rhodes/GetURLDialog.cpp +0 -64
- data/platform/wm/rhodes/GetURLDialog.h +0 -39
- data/res/generators/templates/application/public/css/base.css +0 -39
- data/res/generators/templates/application/public/css/rho.css +0 -3
- data/res/generators/templates/application/public/css/xhtml.css +0 -114
- data/spec/framework_spec/app/Question/config.rb +0 -3
- data/spec/generator_spec/source_generator_spec.rb +0 -27
@@ -10,8 +10,6 @@ import java.util.Vector;
|
|
10
10
|
import javax.microedition.io.Connector;
|
11
11
|
import javax.microedition.io.file.ConnectionClosedException;
|
12
12
|
|
13
|
-
import com.rho.IRAFile;
|
14
|
-
|
15
13
|
import net.rim.device.api.system.PersistentObject;
|
16
14
|
import net.rim.device.api.system.PersistentStore;
|
17
15
|
import net.rim.device.api.util.Arrays;
|
@@ -205,34 +205,32 @@ public class NetworkAccess implements INetworkAccess {
|
|
205
205
|
String url = strUrl;
|
206
206
|
if (!ignoreSuffix)
|
207
207
|
url += URLsuffix;
|
208
|
-
|
209
|
-
if (url.startsWith("https"))
|
208
|
+
if (url.startsWith("https"))
|
210
209
|
url += ";EndToEndDesired;RdHTTPS";
|
211
|
-
|
210
|
+
|
212
211
|
LOG.INFO(url);
|
213
|
-
|
212
|
+
conn = Connector.open(url, Connector.READ_WRITE, true);
|
214
213
|
} catch (java.io.InterruptedIOException ioe) {
|
215
214
|
LOG.ERROR("Connector.open InterruptedIOException", ioe );
|
216
215
|
if (conn != null)
|
217
216
|
conn.close();
|
218
217
|
conn = null;
|
219
|
-
throw ioe;
|
218
|
+
throw ioe;
|
220
219
|
} catch (IOException ioe) {
|
221
|
-
|
220
|
+
String strMsg = ioe.getMessage();
|
222
221
|
|
223
222
|
boolean bTimeout = strMsg != null && (strMsg.indexOf("timed out") >= 0 || strMsg.indexOf("Timed out") >= 0);
|
224
223
|
|
225
|
-
if ( !bTimeout && URLsuffix.length() > 0 )
|
226
|
-
{
|
224
|
+
if ( !bTimeout && URLsuffix.length() > 0 ) {
|
227
225
|
LOG.ERROR("Connector.open exception", ioe );
|
228
226
|
|
229
227
|
try{
|
230
|
-
|
228
|
+
String url = strUrl;
|
231
229
|
if (url.startsWith("https"))
|
232
230
|
url += ";EndToEndDesired;RdHTTPS";
|
233
231
|
|
234
232
|
LOG.INFO(url);
|
235
|
-
conn = Connector.open(url, Connector.READ_WRITE, true);
|
233
|
+
conn = Connector.open(url, Connector.READ_WRITE, true);
|
236
234
|
} catch (IOException ioe2) {
|
237
235
|
LOG.ERROR("Connector.open exception", ioe2 );
|
238
236
|
if (conn != null)
|
@@ -12,7 +12,7 @@ import com.rho.RhoClassFactory;
|
|
12
12
|
import com.rho.RhoEmptyLogger;
|
13
13
|
import com.rho.RhoLogger;
|
14
14
|
import com.rho.RhodesApp;
|
15
|
-
import com.rho.SimpleFile;
|
15
|
+
import com.rho.file.SimpleFile;
|
16
16
|
import com.xruby.runtime.builtin.*;
|
17
17
|
import com.xruby.runtime.lang.*;
|
18
18
|
|
@@ -13,6 +13,7 @@ import com.xruby.runtime.builtin.ObjectFactory;
|
|
13
13
|
import com.xruby.runtime.builtin.RubyArray;
|
14
14
|
import com.rho.net.NetRequest;
|
15
15
|
import com.rho.RhoRuby;
|
16
|
+
import j2me.lang.MathEx;
|
16
17
|
|
17
18
|
public class GeoLocation extends RhoThread{
|
18
19
|
private static final RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
@@ -525,6 +526,44 @@ public class GeoLocation extends RhoThread{
|
|
525
526
|
return RubyConstant.QNIL;
|
526
527
|
}
|
527
528
|
});
|
529
|
+
klass.getSingletonClass().defineMethod("haversine_distance", new RubyVarArgMethod() {
|
530
|
+
protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block) {
|
531
|
+
|
532
|
+
if ( args.size() != 4 )
|
533
|
+
throw new RubyException(RubyRuntime.ArgumentErrorClass,
|
534
|
+
"in GeoLocation.haversine_distance: wrong number of arguments ( " + args.size() + " for " + 4 + " )");
|
535
|
+
|
536
|
+
try{
|
537
|
+
double lat1 = args.get(0).toFloat();
|
538
|
+
double lon1 = args.get(1).toFloat();
|
539
|
+
double lat2 = args.get(2).toFloat();
|
540
|
+
double lon2 = args.get(3).toFloat();
|
541
|
+
|
542
|
+
double RAD_PER_DEG = 0.017453293; //PI/180
|
543
|
+
int Rmiles = 3956; //radius of the great circle in miles
|
544
|
+
|
545
|
+
double dlon = lon2 - lon1;
|
546
|
+
double dlat = lat2 - lat1;
|
547
|
+
double dlon_rad = dlon * RAD_PER_DEG;
|
548
|
+
double dlat_rad = dlat * RAD_PER_DEG;
|
549
|
+
double lat1_rad = lat1 * RAD_PER_DEG;
|
550
|
+
//double lon1_rad = lon1 * RAD_PER_DEG;
|
551
|
+
double lat2_rad = lat2 * RAD_PER_DEG;
|
552
|
+
//double lon2_rad = lon2 * RAD_PER_DEG;
|
553
|
+
|
554
|
+
double a = MathEx.pow((Math.sin(dlat_rad/2)), 2) + Math.cos(lat1_rad) * Math.cos(lat2_rad) * MathEx.pow(Math.sin(dlon_rad/2), 2);
|
555
|
+
double c = 2 * MathEx.atan2(Math.sqrt(a), Math.sqrt(1-a));
|
556
|
+
double dMi = Rmiles * c; //delta between the two points in mile
|
557
|
+
|
558
|
+
return ObjectFactory.createFloat(dMi);
|
559
|
+
|
560
|
+
}catch(Exception e)
|
561
|
+
{
|
562
|
+
LOG.ERROR("haversine_distance failed", e);
|
563
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
564
|
+
}
|
565
|
+
}
|
566
|
+
});
|
528
567
|
}
|
529
568
|
|
530
569
|
}
|
@@ -8,6 +8,7 @@ import net.rim.device.api.system.Display;
|
|
8
8
|
import com.rho.BBVersionSpecific;
|
9
9
|
import com.rho.RhoEmptyLogger;
|
10
10
|
import com.rho.RhoLogger;
|
11
|
+
import com.rho.RhodesApp;
|
11
12
|
import com.xruby.runtime.builtin.ObjectFactory;
|
12
13
|
import com.xruby.runtime.lang.*;
|
13
14
|
import com.rho.RhoRubyHelper;
|
@@ -74,6 +75,44 @@ public class System {
|
|
74
75
|
}
|
75
76
|
}
|
76
77
|
});
|
78
|
+
klass.getSingletonClass().defineMethod( "set_push_notification", new RubyTwoArgMethod(){
|
79
|
+
protected RubyValue run(RubyValue receiver, RubyValue arg1, RubyValue arg2, RubyBlock block )
|
80
|
+
{
|
81
|
+
try {
|
82
|
+
String url = arg1 != RubyConstant.QNIL ? arg1.toStr() : "";
|
83
|
+
String params = arg2 != RubyConstant.QNIL ? arg2.toStr() : "";
|
84
|
+
|
85
|
+
RhodesApp.getInstance().setPushNotification(url, params);
|
86
|
+
|
87
|
+
return RubyConstant.QNIL;
|
88
|
+
} catch(Exception e) {
|
89
|
+
LOG.ERROR("set_push_notification failed", e);
|
90
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
91
|
+
}
|
92
|
+
}
|
93
|
+
});
|
94
|
+
klass.getSingletonClass().defineMethod( "set_screen_rotation_notification", new RubyTwoArgMethod(){
|
95
|
+
protected RubyValue run(RubyValue receiver, RubyValue arg1, RubyValue arg2, RubyBlock block )
|
96
|
+
{
|
97
|
+
try {
|
98
|
+
String url = arg1 != RubyConstant.QNIL ? arg1.toStr() : "";
|
99
|
+
String params = arg2 != RubyConstant.QNIL ? arg2.toStr() : "";
|
100
|
+
|
101
|
+
RhodesApp.getInstance().setScreenRotationNotification(url, params);
|
102
|
+
|
103
|
+
return RubyConstant.QNIL;
|
104
|
+
} catch(Exception e) {
|
105
|
+
LOG.ERROR("set_screen_rotation_notification failed", e);
|
106
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
107
|
+
}
|
108
|
+
}
|
109
|
+
});
|
110
|
+
klass.getSingletonClass().defineMethod("exit", new RubyNoArgMethod() {
|
111
|
+
protected RubyValue run(RubyValue receiver, RubyBlock block) {
|
112
|
+
RhodesApplication.getInstance().close();
|
113
|
+
return RubyConstant.QNIL;
|
114
|
+
}
|
115
|
+
});
|
77
116
|
}
|
78
117
|
|
79
118
|
//@RubyLevelMethod(name="get_property", module=true)
|
@@ -91,7 +130,11 @@ public class System {
|
|
91
130
|
if ( strPropName.equalsIgnoreCase("screen_width") )
|
92
131
|
return ObjectFactory.createInteger(getScreenWidth());
|
93
132
|
if ( strPropName.equalsIgnoreCase("screen_height") )
|
94
|
-
return ObjectFactory.createInteger(getScreenHeight());
|
133
|
+
return ObjectFactory.createInteger(getScreenHeight());
|
134
|
+
if ( strPropName.equalsIgnoreCase("ppi_x"))
|
135
|
+
return ObjectFactory.createFloat(getScreenPpiX());
|
136
|
+
if ( strPropName.equalsIgnoreCase("ppi_y"))
|
137
|
+
return ObjectFactory.createFloat(getScreenPpiY());
|
95
138
|
if ( strPropName.equalsIgnoreCase("has_camera") )
|
96
139
|
return ObjectFactory.createBoolean(hasCamera());
|
97
140
|
if ( strPropName.equalsIgnoreCase("phone_number") )
|
@@ -99,7 +142,11 @@ public class System {
|
|
99
142
|
if ( strPropName.equalsIgnoreCase("device_id") )
|
100
143
|
return ObjectFactory.createString(new Integer( DeviceInfo.getDeviceId() ).toString());
|
101
144
|
if ( strPropName.equalsIgnoreCase("full_browser") )
|
102
|
-
return ObjectFactory.createBoolean(rhomobile.RhodesApplication.isFullBrowser());
|
145
|
+
return ObjectFactory.createBoolean(rhomobile.RhodesApplication.isFullBrowser());
|
146
|
+
if ( strPropName.equalsIgnoreCase("device_name") )
|
147
|
+
return ObjectFactory.createString(DeviceInfo.getDeviceName());
|
148
|
+
if ( strPropName.equalsIgnoreCase("os_version") )
|
149
|
+
return ObjectFactory.createString(DeviceInfo.getSoftwareVersion());
|
103
150
|
|
104
151
|
return RubyConstant.QNIL;
|
105
152
|
}
|
@@ -145,5 +192,19 @@ public class System {
|
|
145
192
|
return Display.getWidth();
|
146
193
|
}
|
147
194
|
|
195
|
+
public static double getScreenPpiX() {
|
196
|
+
// Convert PPM (Pixels Per Meter) to PPI (Pixels Per Inch)
|
197
|
+
int ppm = Display.getHorizontalResolution();
|
198
|
+
double retval = (ppm*25.4)/1000;
|
199
|
+
return retval;
|
200
|
+
}
|
201
|
+
|
202
|
+
public static double getScreenPpiY() {
|
203
|
+
// Convert PPM (Pixels Per Meter) to PPI (Pixels Per Inch)
|
204
|
+
int ppm = Display.getVerticalResolution();
|
205
|
+
double retval = (ppm*25.4)/1000;
|
206
|
+
return retval;
|
207
|
+
}
|
208
|
+
|
148
209
|
|
149
210
|
}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
package com.rho.rubyext;
|
2
|
+
|
3
|
+
import com.rho.RhoEmptyLogger;
|
4
|
+
import com.rho.RhoLogger;
|
5
|
+
import com.xruby.runtime.builtin.*;
|
6
|
+
import com.xruby.runtime.lang.*;
|
7
|
+
import rhomobile.RhodesApplication;
|
8
|
+
|
9
|
+
public class WebView
|
10
|
+
{
|
11
|
+
private static final RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
12
|
+
new RhoLogger("WebView");
|
13
|
+
|
14
|
+
public static void navigate(String url)
|
15
|
+
{
|
16
|
+
RhodesApplication.getInstance().addToHistory(url, null);
|
17
|
+
RhodesApplication.getInstance().navigateUrl(url);
|
18
|
+
}
|
19
|
+
|
20
|
+
public static void initMethods(RubyClass klass) {
|
21
|
+
klass.getSingletonClass().defineMethod("refresh", new RubyNoArgMethod() {
|
22
|
+
protected RubyValue run(RubyValue receiver, RubyBlock block)
|
23
|
+
{
|
24
|
+
try {
|
25
|
+
RhodesApplication.getInstance().refreshCurrentPage();
|
26
|
+
return RubyConstant.QNIL;
|
27
|
+
} catch(Exception e) {
|
28
|
+
LOG.ERROR("refresh failed.", e);
|
29
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
30
|
+
}
|
31
|
+
}
|
32
|
+
});
|
33
|
+
klass.getSingletonClass().defineMethod("navigate", new RubyVarArgMethod() {
|
34
|
+
protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block )
|
35
|
+
{
|
36
|
+
try {
|
37
|
+
String url = args.get(0).toString();
|
38
|
+
navigate(url);
|
39
|
+
return RubyConstant.QNIL;
|
40
|
+
} catch(Exception e) {
|
41
|
+
LOG.ERROR("navigate failed.", e);
|
42
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
43
|
+
}
|
44
|
+
}
|
45
|
+
});
|
46
|
+
klass.getSingletonClass().defineMethod("current_location", new RubyNoArgMethod() {
|
47
|
+
protected RubyValue run(RubyValue receiver, RubyBlock block)
|
48
|
+
{
|
49
|
+
try {
|
50
|
+
String url = RhodesApplication.getInstance().getCurrentPageUrl();
|
51
|
+
return ObjectFactory.createString(url);
|
52
|
+
} catch(Exception e) {
|
53
|
+
LOG.ERROR("current_location failed.", e);
|
54
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
55
|
+
}
|
56
|
+
}
|
57
|
+
});
|
58
|
+
klass.getSingletonClass().defineMethod("set_menu_items", new RubyOneArgMethod() {
|
59
|
+
protected RubyValue run(RubyValue receiver, RubyValue arg0, RubyBlock block)
|
60
|
+
{
|
61
|
+
try {
|
62
|
+
RhodesApplication.getInstance().resetMenuItems();
|
63
|
+
RubyHash items = (RubyHash)arg0;
|
64
|
+
RubyArray keys = items.keys();
|
65
|
+
RubyArray values = items.values();
|
66
|
+
for( int i = 0; i < keys.size(); i++ ){
|
67
|
+
String label = keys.get(i).toString();
|
68
|
+
String value = values.get(i).toString();
|
69
|
+
RhodesApplication.getInstance().addMenuItem(label, value);
|
70
|
+
}
|
71
|
+
return RubyConstant.QTRUE;
|
72
|
+
} catch(Exception e) {
|
73
|
+
LOG.ERROR("set_menu_items failed.", e);
|
74
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
75
|
+
}
|
76
|
+
}
|
77
|
+
});
|
78
|
+
|
79
|
+
klass.getSingletonClass().defineMethod("execute_js", new RubyVarArgMethod() {
|
80
|
+
protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block)
|
81
|
+
{
|
82
|
+
try {
|
83
|
+
RhodesApplication.getInstance().executeJavascript(args.get(0).toStr());
|
84
|
+
//String url = "javascript:"+args.get(0).toStr();
|
85
|
+
//RhodesApplication.getInstance().navigateUrl(url);
|
86
|
+
return RubyConstant.QNIL;
|
87
|
+
} catch(Exception e) {
|
88
|
+
LOG.ERROR("execute_js failed.", e);
|
89
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
90
|
+
}
|
91
|
+
}
|
92
|
+
});
|
93
|
+
klass.getSingletonClass().defineMethod("active_tab", new RubyNoArgMethod() {
|
94
|
+
protected RubyValue run(RubyValue receiver, RubyBlock block) {
|
95
|
+
return ObjectFactory.createInteger(0);
|
96
|
+
}
|
97
|
+
});
|
98
|
+
}
|
99
|
+
|
100
|
+
}
|
@@ -47,7 +47,7 @@ public class LogScreen extends MainScreen {
|
|
47
47
|
};
|
48
48
|
private MenuItem copyLogItem = new MenuItem("Copy to sdcard", 100000, 10) {
|
49
49
|
public void run() {
|
50
|
-
com.rho.Jsr75File.copyRhoFileFromDeviceMemory(RhoLogger.LOGFILENAME);
|
50
|
+
com.rho.file.Jsr75File.copyRhoFileFromDeviceMemory(RhoLogger.LOGFILENAME);
|
51
51
|
}
|
52
52
|
};
|
53
53
|
|
@@ -7,6 +7,7 @@ import javax.microedition.io.*;
|
|
7
7
|
|
8
8
|
import com.rho.RhoEmptyLogger;
|
9
9
|
import com.rho.RhoLogger;
|
10
|
+
import com.rho.RhodesApp;
|
10
11
|
import com.rho.sync.SyncThread;
|
11
12
|
import com.rho.RhoConf;
|
12
13
|
|
@@ -54,7 +55,6 @@ public class PushListeningThread extends Thread {
|
|
54
55
|
{
|
55
56
|
try
|
56
57
|
{
|
57
|
-
|
58
58
|
// Synchronize here so that we don't end up creating a connection that is never closed.
|
59
59
|
synchronized(this)
|
60
60
|
{
|
@@ -227,6 +227,18 @@ public class PushListeningThread extends Thread {
|
|
227
227
|
String msg = new String(data, 0, nLen);
|
228
228
|
LOG.INFO("Triger sync on PUSH message [" + msg + " ]");
|
229
229
|
|
230
|
+
if ( RhodesApp.getInstance() != null )
|
231
|
+
{
|
232
|
+
try{
|
233
|
+
if ( RhodesApp.getInstance().callPushCallback(msg) )
|
234
|
+
return;
|
235
|
+
}catch(Exception exc)
|
236
|
+
{
|
237
|
+
LOG.ERROR("callPushCallback failed", exc);
|
238
|
+
return;
|
239
|
+
}
|
240
|
+
}
|
241
|
+
|
230
242
|
String[] op;
|
231
243
|
String[] ops = split(msg,"\n");
|
232
244
|
for (int loop = 0; loop < ops.length; loop++) {
|
@@ -10,18 +10,8 @@ import java.util.Vector;
|
|
10
10
|
|
11
11
|
import javax.microedition.io.HttpConnection;
|
12
12
|
|
13
|
-
import net.rim.device.api.browser.field.BrowserContent;
|
14
|
-
import net.rim.device.api.browser.field.Event;
|
15
|
-
import net.rim.device.api.browser.field.RedirectEvent;
|
16
|
-
import net.rim.device.api.browser.field.RenderingApplication;
|
17
|
-
import net.rim.device.api.browser.field.RenderingException;
|
18
13
|
import net.rim.device.api.browser.field.RenderingOptions;
|
19
|
-
import net.rim.device.api.browser.field.RenderingSession;
|
20
|
-
import net.rim.device.api.browser.field.RequestedResource;
|
21
|
-
import net.rim.device.api.browser.field.SetHttpCookieEvent;
|
22
|
-
import net.rim.device.api.browser.field.UrlRequestedEvent;
|
23
14
|
import net.rim.device.api.io.http.HttpHeaders;
|
24
|
-
import net.rim.device.api.system.Alert;
|
25
15
|
import net.rim.device.api.system.Application;
|
26
16
|
import net.rim.device.api.system.ApplicationManager;
|
27
17
|
import net.rim.device.api.system.Bitmap;
|
@@ -36,8 +26,6 @@ import net.rim.device.api.ui.*;
|
|
36
26
|
import net.rim.device.api.ui.component.BitmapField;
|
37
27
|
import net.rim.device.api.ui.component.Dialog;
|
38
28
|
import net.rim.device.api.ui.component.Menu;
|
39
|
-
import net.rim.device.api.ui.component.Status;
|
40
|
-
import net.rim.device.api.ui.container.FullScreen;
|
41
29
|
import net.rim.device.api.ui.container.PopupScreen;
|
42
30
|
import net.rim.device.api.ui.container.VerticalFieldManager;
|
43
31
|
//import net.rim.device.api.ui.container.HorizontalFieldManager;
|
@@ -46,7 +34,6 @@ import net.rim.device.api.ui.component.LabelField;
|
|
46
34
|
import net.rim.device.api.ui.Manager;
|
47
35
|
import net.rim.device.api.math.Fixed32;
|
48
36
|
|
49
|
-
import javax.microedition.media.*;
|
50
37
|
//import net.rim.device.api.system.EventInjector.KeyCodeEvent;
|
51
38
|
|
52
39
|
import com.rho.*;
|
@@ -54,20 +41,16 @@ import com.rho.*;
|
|
54
41
|
import com.rho.rubyext.GeoLocation;
|
55
42
|
import com.rho.net.NetResponse;
|
56
43
|
import com.rho.net.RhoConnection;
|
57
|
-
import com.rho.net.URI;
|
58
44
|
import com.rho.sync.SyncThread;
|
59
45
|
import com.rho.sync.ISyncStatusListener;
|
60
|
-
import com.rho.Jsr75File;
|
46
|
+
import com.rho.file.Jsr75File;
|
61
47
|
import com.rho.RhodesApp;
|
62
48
|
import com.xruby.runtime.lang.RubyProgram;
|
63
|
-
import com.rho.net.NetResponse;
|
64
|
-
|
65
|
-
import net.rim.device.api.xml.parsers.SAXParser;
|
66
49
|
|
67
50
|
/**
|
68
51
|
*
|
69
52
|
*/
|
70
|
-
final public class RhodesApplication extends UiApplication implements
|
53
|
+
final public class RhodesApplication extends UiApplication implements SystemListener, ISyncStatusListener//, FileSystemListener
|
71
54
|
{
|
72
55
|
// Menu Labels
|
73
56
|
public static final String LABEL_HOME = "Home";
|
@@ -83,23 +66,6 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
83
66
|
private static final RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
84
67
|
new RhoLogger("RhodesApplication");
|
85
68
|
|
86
|
-
private static final RhoProfiler PROF = RhoProfiler.RHO_STRIP_PROFILER ? new RhoEmptyProfiler() :
|
87
|
-
new RhoProfiler();
|
88
|
-
|
89
|
-
private static final String RHODES_AJAX_PROTOCOL = "RhodesAjaxCall=";
|
90
|
-
|
91
|
-
private Vector pendingResponses = new Vector();
|
92
|
-
|
93
|
-
/*boolean m_bSDCardAdded = false;
|
94
|
-
public void rootChanged(int arg0, String arg1)
|
95
|
-
{
|
96
|
-
LOG.INFO_OUT( "rootChanged. arg0 :" + arg0 + "arg1: " + arg1);
|
97
|
-
if ( arg0 == FileSystemListener.ROOT_ADDED && arg1 != null &&
|
98
|
-
arg1.equals("SDCard/") )
|
99
|
-
m_bSDCardAdded = true;
|
100
|
-
}*/
|
101
|
-
//boolean m_bSkipKeyPress = false;
|
102
|
-
|
103
69
|
class CKeyListener implements KeyListener{
|
104
70
|
|
105
71
|
public boolean keyChar(char key, int status, int time) {
|
@@ -136,64 +102,18 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
136
102
|
return true;
|
137
103
|
}
|
138
104
|
|
139
|
-
public boolean trackwheelRoll(int amount, int status, int time)
|
105
|
+
public boolean trackwheelRoll(int amount, int status, int time)
|
106
|
+
{
|
107
|
+
return false;
|
108
|
+
}
|
140
109
|
public boolean trackwheelUnclick(int status, int time) {return false;}
|
141
110
|
}
|
142
111
|
|
143
|
-
/*class SyncNotificationsImpl extends SyncNotifications{
|
144
|
-
public void performNotification(String url, String body){
|
145
|
-
|
146
|
-
HttpHeaders headers = new HttpHeaders();
|
147
|
-
headers.addProperty("Content-Type", "application/x-www-form-urlencoded");
|
148
|
-
postUrl(url, body, headers);
|
149
|
-
*/
|
150
|
-
/* String curUrl = (String)_history.lastElement();
|
151
|
-
curUrl.replace('\\', '/');
|
152
|
-
if ( curUrl.equalsIgnoreCase(url) )
|
153
|
-
navigateUrl(curUrl);*/
|
154
|
-
|
155
|
-
// }
|
156
|
-
|
157
|
-
//}
|
158
|
-
/*
|
159
|
-
private String processAjaxCall(String request) {
|
160
|
-
if (!request.startsWith(RHODES_AJAX_PROTOCOL))
|
161
|
-
return null;
|
162
|
-
String command = request.substring(RHODES_AJAX_PROTOCOL.length()).trim();
|
163
|
-
Hashtable params = new Hashtable();
|
164
|
-
for (; command.length() > 0;) {
|
165
|
-
int index = command.indexOf(';');
|
166
|
-
String name = index == -1 ? command : command.substring(0, index);
|
167
|
-
String value = "";
|
168
|
-
command = index == -1 ? "" : command.substring(index + 1);
|
169
|
-
|
170
|
-
index = name.indexOf('=');
|
171
|
-
if (index != -1) {
|
172
|
-
value = name.substring(index + 1);
|
173
|
-
name = name.substring(0, index);
|
174
|
-
}
|
175
|
-
params.put(name, value);
|
176
|
-
}
|
177
|
-
String method = (String)params.get("method");
|
178
|
-
if (method == null)
|
179
|
-
return null;
|
180
|
-
|
181
|
-
if (method.equals("GeoLocation"))
|
182
|
-
return GeoLocation.GetLocation();
|
183
|
-
|
184
|
-
if (method.equals("Log")) {
|
185
|
-
String message = (String)params.get("message");
|
186
|
-
if (message != null)
|
187
|
-
LOG.INFO(message);
|
188
|
-
return null;
|
189
|
-
}
|
190
|
-
|
191
|
-
return null;
|
192
|
-
}*/
|
193
|
-
|
194
112
|
boolean isExternalUrl(String strUrl)
|
195
113
|
{
|
196
|
-
return strUrl.startsWith("http://") || strUrl.startsWith("https://")
|
114
|
+
return strUrl.startsWith("http://") || strUrl.startsWith("https://") ||
|
115
|
+
strUrl.startsWith("javascript:") || strUrl.startsWith("mailto:")
|
116
|
+
|| strUrl.startsWith("tel:")|| strUrl.startsWith("wtai:");
|
197
117
|
}
|
198
118
|
|
199
119
|
String canonicalizeURL( String url ){
|
@@ -207,7 +127,7 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
207
127
|
return url;
|
208
128
|
}
|
209
129
|
|
210
|
-
void navigateUrl(String url){
|
130
|
+
public void navigateUrl(String url){
|
211
131
|
PrimaryResourceFetchThread thread = new PrimaryResourceFetchThread(
|
212
132
|
canonicalizeURL(url), null, null, null);
|
213
133
|
thread.start();
|
@@ -219,14 +139,14 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
219
139
|
return url;
|
220
140
|
}
|
221
141
|
|
222
|
-
void addMenuItem(String label, String value){
|
142
|
+
public void addMenuItem(String label, String value){
|
223
143
|
LOG.TRACE("Adding menu item: label: " + label + ", value: " + value);
|
224
144
|
_mainScreen.addCustomMenuItem(label, value);
|
225
145
|
}
|
226
146
|
|
227
147
|
private String m_strAppBackUrl ="";
|
228
148
|
|
229
|
-
void resetMenuItems() {
|
149
|
+
public void resetMenuItems() {
|
230
150
|
_mainScreen.setMenuItems(new Vector());
|
231
151
|
m_strAppBackUrl = "";
|
232
152
|
}
|
@@ -295,8 +215,7 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
295
215
|
return false;
|
296
216
|
}
|
297
217
|
|
298
|
-
void back()
|
299
|
-
{
|
218
|
+
void back(){
|
300
219
|
String url = m_strAppBackUrl;
|
301
220
|
if ( url.length() == 0)
|
302
221
|
{
|
@@ -304,20 +223,20 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
304
223
|
{
|
305
224
|
if ( RhoConf.getInstance().getBool("bb_disable_closebyback"))
|
306
225
|
return;
|
307
|
-
|
308
|
-
|
226
|
+
|
227
|
+
_mainScreen.close();
|
309
228
|
return;
|
310
|
-
|
311
|
-
|
229
|
+
}
|
312
230
|
int nPos = _history.size()-2;
|
313
231
|
url = (String)_history.elementAt(nPos);
|
314
232
|
_history.removeElementAt(nPos+1);
|
233
|
+
|
234
|
+
// this.m_oBrowserAdapter.goBack();
|
315
235
|
}else if ( url.equalsIgnoreCase("close"))
|
316
236
|
{
|
317
|
-
|
237
|
+
_mainScreen.close();
|
318
238
|
return;
|
319
|
-
}
|
320
|
-
else
|
239
|
+
}else
|
321
240
|
addToHistory(url,null);
|
322
241
|
|
323
242
|
saveCurrentLocation(url);
|
@@ -336,7 +255,7 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
336
255
|
return str;
|
337
256
|
}
|
338
257
|
|
339
|
-
void addToHistory(String strUrl, String refferer )
|
258
|
+
public void addToHistory(String strUrl, String refferer )
|
340
259
|
{
|
341
260
|
strUrl = removeSemicolon(strUrl);
|
342
261
|
refferer = removeSemicolon(refferer);
|
@@ -423,23 +342,20 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
423
342
|
return false;
|
424
343
|
}
|
425
344
|
|
426
|
-
private
|
427
|
-
|
428
|
-
private RenderingSession _renderingSession;
|
429
|
-
|
345
|
+
private IBrowserAdapter m_oBrowserAdapter;
|
430
346
|
private CMainScreen _mainScreen = null;
|
431
347
|
|
432
348
|
private SyncStatusPopup _syncStatusPopup = null;
|
433
349
|
|
434
350
|
private String _lastStatusMessage = null;
|
435
351
|
|
436
|
-
private HttpConnection _currentConnection;
|
352
|
+
//private HttpConnection _currentConnection;
|
437
353
|
|
438
354
|
private Vector _history;
|
439
355
|
|
440
356
|
private final String _httpRoot = "http://localhost:8080/";
|
441
357
|
|
442
|
-
private static boolean
|
358
|
+
private static boolean m_isFullBrowser = false;
|
443
359
|
|
444
360
|
private static PushListeningThread _pushListeningThread = null;
|
445
361
|
|
@@ -448,19 +364,17 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
448
364
|
public static RhodesApplication getInstance(){ return _instance; }
|
449
365
|
private static RhodesApp RHODESAPP(){ return RhodesApp.getInstance(); }
|
450
366
|
|
451
|
-
public static boolean isFullBrowser(){ return
|
367
|
+
public static boolean isFullBrowser(){ return m_isFullBrowser; }
|
452
368
|
|
369
|
+
void invalidateMainScreen()
|
370
|
+
{
|
371
|
+
_mainScreen.invalidate();
|
372
|
+
}
|
453
373
|
/***************************************************************************
|
454
374
|
* Main.
|
455
375
|
**************************************************************************/
|
456
376
|
public static void main(String[] args)
|
457
377
|
{
|
458
|
-
//RhoLogger.InitRhoLog();
|
459
|
-
//LOG.TRACE("Rhodes MAIN started ***--------------------------***");
|
460
|
-
|
461
|
-
//_pushListeningThread = new PushListeningThread();
|
462
|
-
//_pushListeningThread.start();
|
463
|
-
|
464
378
|
_instance = new RhodesApplication();
|
465
379
|
try{
|
466
380
|
_instance.enterEventDispatcher();
|
@@ -591,6 +505,7 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
591
505
|
try
|
592
506
|
{
|
593
507
|
RhoRuby.RhoRubyStart("");
|
508
|
+
com.rho.db.DBAdapter.initAttrManager();
|
594
509
|
|
595
510
|
SyncThread sync = null;
|
596
511
|
|
@@ -708,30 +623,42 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
708
623
|
}
|
709
624
|
}
|
710
625
|
}
|
711
|
-
/*
|
712
|
-
static class WaitStatusPopup extends PopupScreen {
|
713
|
-
public WaitStatusPopup(String status)
|
714
|
-
{
|
715
|
-
super( new VerticalFieldManager( Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR) );
|
716
|
-
|
717
|
-
add(new LabelField(status != null ? status : "Please wait...", Field.FIELD_HCENTER));
|
718
|
-
}
|
719
|
-
}
|
720
|
-
WaitStatusPopup m_waitPopup;
|
721
|
-
void showWaitPopup(String msg)
|
722
|
-
{
|
723
|
-
m_waitPopup = new WaitStatusPopup(msg);
|
724
|
-
pushScreen(m_waitPopup);
|
725
|
-
}
|
726
|
-
void hideWaitPopup()
|
727
|
-
{
|
728
|
-
this.popScreen(m_waitPopup);
|
729
|
-
m_waitPopup = null;
|
730
|
-
}*/
|
731
626
|
|
732
627
|
class CMainScreen extends RhoMainScreen{
|
733
628
|
|
734
|
-
protected boolean
|
629
|
+
protected boolean navigationMovement(int dx, int dy, int status, int time)
|
630
|
+
{
|
631
|
+
if (m_oBrowserAdapter.navigationMovement(dx, dy, status, time))
|
632
|
+
{
|
633
|
+
updateLayout();
|
634
|
+
return true;
|
635
|
+
}
|
636
|
+
return super.navigationMovement(dx, dy, status, time);
|
637
|
+
}
|
638
|
+
|
639
|
+
int m_nOrientation = -1;
|
640
|
+
protected void onChangeOrientation(int x, int y, int nOrientation)
|
641
|
+
{
|
642
|
+
if ( m_nOrientation == -1 )
|
643
|
+
{
|
644
|
+
m_nOrientation = nOrientation;
|
645
|
+
return;
|
646
|
+
}
|
647
|
+
|
648
|
+
if ( m_nOrientation != nOrientation )
|
649
|
+
{
|
650
|
+
try{
|
651
|
+
RhodesApp.getInstance().callScreenRotationCallback(x, y, m_nOrientation==1 ? 90 : -90);
|
652
|
+
}catch(Exception exc)
|
653
|
+
{
|
654
|
+
LOG.ERROR("Screen rotation callback failed.", exc);
|
655
|
+
}
|
656
|
+
}
|
657
|
+
|
658
|
+
m_nOrientation = nOrientation;
|
659
|
+
}
|
660
|
+
|
661
|
+
protected boolean navigationClick(int status, int time) {
|
735
662
|
//LOG.INFO("navigationClick: " + status);
|
736
663
|
return super.navigationClick(status, time);
|
737
664
|
}
|
@@ -798,36 +725,6 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
798
725
|
}
|
799
726
|
|
800
727
|
menu.deleteAll();
|
801
|
-
/*
|
802
|
-
// TODO: This is really a hack, we should replicate the "Get Link" functionality
|
803
|
-
// Also, for some reason the menu size becomes 0 when there is 1 item left (page view)
|
804
|
-
for(int i=0; i < menu.getSize(); i++) {
|
805
|
-
//System.out.println("Getting menu item: " + i);
|
806
|
-
MenuItem item = menu.getItem(i);
|
807
|
-
String label = item.toString();
|
808
|
-
// Save the get link menuitem
|
809
|
-
if(!label.equalsIgnoreCase("Get Link")) {
|
810
|
-
//savedGetLinkItem = item;
|
811
|
-
menu.deleteItem(i);
|
812
|
-
if ( i > 0 )
|
813
|
-
i = i - 1;
|
814
|
-
}
|
815
|
-
|
816
|
-
}
|
817
|
-
// Delete Page View
|
818
|
-
MenuItem pgview = null;
|
819
|
-
try {
|
820
|
-
// TODO: menu.getSize() above incorrectly reports size 0 when
|
821
|
-
// there is 1 item left! (Correct for BB 4.6 and less)
|
822
|
-
pgview = menu.getItem(0);
|
823
|
-
}
|
824
|
-
catch (Exception e) {
|
825
|
-
// This is ok. On BB 4.7 there is correct behavior so attempting to get
|
826
|
-
// item with index 0 cause exception - menu is actually empty!
|
827
|
-
}
|
828
|
-
if (pgview != null && pgview.getId() == 853)
|
829
|
-
menu.deleteItem(0);*/
|
830
|
-
|
831
728
|
// Don't draw menu if menuItems is null
|
832
729
|
if (menuItems == null)
|
833
730
|
return;
|
@@ -846,14 +743,6 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
846
743
|
contextMenu.addItem(logItem);
|
847
744
|
contextMenu.addItem(separatorItem);
|
848
745
|
contextMenu.addItem(closeItem);
|
849
|
-
/*
|
850
|
-
setDefaultItemToMenu(RhodesApplication.LABEL_HOME, homeItem, contextMenu);
|
851
|
-
setDefaultItemToMenu(RhodesApplication.LABEL_REFRESH, refreshItem, contextMenu);
|
852
|
-
setDefaultItemToMenu(RhodesApplication.LABEL_SYNC, syncItem, contextMenu);
|
853
|
-
setDefaultItemToMenu(RhodesApplication.LABEL_OPTIONS, optionsItem, contextMenu);
|
854
|
-
setDefaultItemToMenu(RhodesApplication.LABEL_LOG, logItem, contextMenu);
|
855
|
-
setDefaultItemToMenu(RhodesApplication.LABEL_SEPARATOR, separatorItem, contextMenu);
|
856
|
-
setDefaultItemToMenu(RhodesApplication.LABEL_CLOSE, closeItem, contextMenu);*/
|
857
746
|
}
|
858
747
|
|
859
748
|
// Draw menu from rhodes framework
|
@@ -863,8 +752,6 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
863
752
|
contextMenu.addItem(item);
|
864
753
|
}
|
865
754
|
|
866
|
-
//setDefaultItemToMenu(RhodesApplication.LABEL_SYNC, syncItem, contextMenu);
|
867
|
-
|
868
755
|
this.makeContextMenu(contextMenu);
|
869
756
|
menu.add(contextMenu);
|
870
757
|
}
|
@@ -923,11 +810,6 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
923
810
|
menuItems.addElement(item);
|
924
811
|
}
|
925
812
|
|
926
|
-
/*private void setDefaultItemToMenu(String label, MenuItem item, ContextMenu menu) {
|
927
|
-
item.setText(label);
|
928
|
-
menu.addItem(item);
|
929
|
-
}*/
|
930
|
-
|
931
813
|
public void close() {
|
932
814
|
LOG.TRACE("Calling Screen.close");
|
933
815
|
Application.getApplication().requestBackground();
|
@@ -1027,17 +909,6 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1027
909
|
//Push this screen to display it to the user.
|
1028
910
|
UiApplication.getUiApplication().pushScreen(screen);
|
1029
911
|
}
|
1030
|
-
/*
|
1031
|
-
boolean isWaitForSDCardAtStartup()
|
1032
|
-
{
|
1033
|
-
if ( Jsr75File.isRhoFolderExist() )
|
1034
|
-
return false;
|
1035
|
-
|
1036
|
-
if ( Jsr75File.isSDCardExist() )
|
1037
|
-
return false;
|
1038
|
-
|
1039
|
-
return !m_bActivated;
|
1040
|
-
}*/
|
1041
912
|
|
1042
913
|
private void doStartupWork()
|
1043
914
|
{
|
@@ -1072,50 +943,12 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1072
943
|
CTrackwheelListener wheel = new CTrackwheelListener();
|
1073
944
|
this._history = new Vector();
|
1074
945
|
|
1075
|
-
//SyncEngine.setNotificationImpl( new SyncNotificationsImpl() );
|
1076
|
-
|
1077
946
|
_mainScreen = new CMainScreen();
|
1078
947
|
_mainScreen.addKeyListener(list);
|
1079
948
|
_mainScreen.addTrackwheelListener(wheel);
|
1080
949
|
|
1081
950
|
pushScreen(_mainScreen);
|
1082
|
-
|
1083
|
-
// enable javascript
|
1084
|
-
_renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.JAVASCRIPT_ENABLED, true);
|
1085
|
-
_renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.JAVASCRIPT_LOCATION_ENABLED, true);
|
1086
|
-
_renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.ENABLE_CSS, true);
|
1087
|
-
_renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.DEFAULT_CHARSET_VALUE, "utf-8");
|
1088
|
-
_renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.OVERWRITE_CHARSET_MODE, true);
|
1089
|
-
_renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.ALLOW_POPUPS, true);
|
1090
|
-
_renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.USE_BACKGROUND_IMAGES, true);
|
1091
|
-
|
1092
|
-
// _renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.VALUE_THRESHOLD, 100000);
|
1093
|
-
|
1094
|
-
|
1095
|
-
// _renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.USE_BACKGROUND_IMAGES, true);
|
1096
|
-
// _renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.SHOW_IMAGE_PLACEHOLDERS, false);
|
1097
|
-
// _renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.ENABLE_WML, false);
|
1098
|
-
// _renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.ENABLE_EMBEDDED_RICH_CONTENT, false);
|
1099
|
-
// _renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.ENABLE_IMAGE_EDITING, false);
|
1100
|
-
// _renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.NO_SEARCH_MENU_MODE, true);
|
1101
|
-
|
1102
|
-
if ( RhoConf.getInstance().getString("use_bb_full_browser").equalsIgnoreCase("touch") )
|
1103
|
-
_isFullBrowser = _mainScreen.isTouchScreen();
|
1104
|
-
else if ( RhoConf.getInstance().getBool("use_bb_full_browser") )
|
1105
|
-
{
|
1106
|
-
Version.SoftVersion ver = Version.getSoftVersion();
|
1107
|
-
if ( ver.nMajor > 4 || ( ver.nMajor == 4 && ver.nMinor >= 6 ) )
|
1108
|
-
_isFullBrowser = true;
|
1109
|
-
}
|
1110
|
-
|
1111
|
-
if (_isFullBrowser)
|
1112
|
-
{
|
1113
|
-
//this is the undocumented option to tell the browser to use the 4.6 Rendering Engine
|
1114
|
-
_renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, 17000, true);
|
1115
|
-
}
|
1116
|
-
|
1117
|
-
// _pushListeningThread = new PushListeningThread();
|
1118
|
-
// _pushListeningThread.start();
|
951
|
+
createBrowserControl();
|
1119
952
|
|
1120
953
|
try {
|
1121
954
|
RhoClassFactory.getNetworkAccess().configure();
|
@@ -1123,8 +956,6 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1123
956
|
LOG.ERROR(exc.getMessage());
|
1124
957
|
}
|
1125
958
|
|
1126
|
-
//initRuby();
|
1127
|
-
|
1128
959
|
PrimaryResourceFetchThread.Create(this);
|
1129
960
|
LOG.INFO("RHODES STARTUP COMPLETED: ***----------------------------------*** " );
|
1130
961
|
}catch(Exception exc)
|
@@ -1133,6 +964,55 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1133
964
|
}
|
1134
965
|
}
|
1135
966
|
|
967
|
+
public void executeJavascript(String strJavascript)
|
968
|
+
{
|
969
|
+
final String url = strJavascript;
|
970
|
+
this.invokeLater( new Runnable() {
|
971
|
+
public void run()
|
972
|
+
{
|
973
|
+
m_oBrowserAdapter.executeJavascript(url);
|
974
|
+
}
|
975
|
+
} );
|
976
|
+
}
|
977
|
+
|
978
|
+
private void createBrowserControl()
|
979
|
+
{
|
980
|
+
//touch;5
|
981
|
+
String strFullBrowser = RhoConf.getInstance().getString("use_bb_full_browser");
|
982
|
+
boolean bTouch = strFullBrowser.indexOf("touch") >= 0;
|
983
|
+
boolean bBB5 = strFullBrowser.indexOf("5") >= 0;
|
984
|
+
|
985
|
+
if ( bTouch || bBB5 )
|
986
|
+
{
|
987
|
+
if ( bTouch )
|
988
|
+
m_isFullBrowser = _mainScreen.isTouchScreen();
|
989
|
+
|
990
|
+
if (!m_isFullBrowser && bBB5 )
|
991
|
+
{
|
992
|
+
Version.SoftVersion ver = Version.getSoftVersion();
|
993
|
+
m_isFullBrowser = ver.nMajor >= 5;
|
994
|
+
}
|
995
|
+
}else if ( RhoConf.getInstance().getBool("use_bb_full_browser") )
|
996
|
+
{
|
997
|
+
Version.SoftVersion ver = Version.getSoftVersion();
|
998
|
+
if ( ver.nMajor > 4 || ( ver.nMajor == 4 && ver.nMinor >= 6 ) )
|
999
|
+
m_isFullBrowser = true;
|
1000
|
+
}
|
1001
|
+
|
1002
|
+
if ( m_isFullBrowser )
|
1003
|
+
{
|
1004
|
+
Version.SoftVersion ver = Version.getSoftVersion();
|
1005
|
+
|
1006
|
+
if ( ver.nMajor >= 5 )
|
1007
|
+
m_oBrowserAdapter = new BrowserAdapter5(_mainScreen, this);
|
1008
|
+
else
|
1009
|
+
m_oBrowserAdapter = new BrowserAdapter(_mainScreen, this, RhoConf.getInstance().getBool("bb_loadimages_async") );
|
1010
|
+
|
1011
|
+
m_oBrowserAdapter.setFullBrowser();
|
1012
|
+
}else
|
1013
|
+
m_oBrowserAdapter = new BrowserAdapter(_mainScreen, this, RhoConf.getInstance().getBool("bb_loadimages_async"));
|
1014
|
+
}
|
1015
|
+
|
1136
1016
|
private void invokeStartupWork() {
|
1137
1017
|
// I think this can get called twice
|
1138
1018
|
// 1) Directly from startup, if the app starts while the BB is up - e.g. after download
|
@@ -1202,265 +1082,26 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1202
1082
|
_history.addElement(strStartPage);
|
1203
1083
|
navigateUrl(strStartPage);
|
1204
1084
|
}
|
1085
|
+
|
1086
|
+
public void close() {
|
1087
|
+
_mainScreen.close();
|
1088
|
+
}
|
1205
1089
|
|
1206
|
-
public void processConnection(HttpConnection connection,
|
1207
|
-
|
1090
|
+
public void processConnection(HttpConnection connection, Object e)
|
1091
|
+
{
|
1208
1092
|
// cancel previous request
|
1209
|
-
if (_currentConnection != null) {
|
1093
|
+
/*if (_currentConnection != null) {
|
1210
1094
|
try {
|
1211
1095
|
_currentConnection.close();
|
1212
1096
|
} catch (IOException e1) {
|
1213
1097
|
}
|
1214
1098
|
}
|
1215
1099
|
|
1216
|
-
_currentConnection = connection
|
1217
|
-
|
1218
|
-
BrowserContent browserContent = null;
|
1219
|
-
|
1220
|
-
try {
|
1221
|
-
browserContent = _renderingSession.getBrowserContent(connection, this, e);
|
1222
|
-
|
1223
|
-
if (browserContent != null) {
|
1224
|
-
browserContent.finishLoading();
|
1225
|
-
|
1226
|
-
Field field = browserContent.getDisplayableContent();
|
1227
|
-
if (field != null) {
|
1228
|
-
|
1229
|
-
RHODESAPP().getSplashScreen().hide();
|
1230
|
-
|
1231
|
-
synchronized (Application.getEventLock()) {
|
1232
|
-
_mainScreen.deleteAll();
|
1233
|
-
_mainScreen.add(field);
|
1234
|
-
/*
|
1235
|
-
_mainScreen.doPaint();
|
1236
|
-
if ( e == null )
|
1237
|
-
{//This should awake screen in case of long network response
|
1238
|
-
KeyCodeEvent inject1 = new KeyCodeEvent( KeyCodeEvent.KEY_DOWN, (char)Keypad.KEY_ESCAPE, 0);
|
1239
|
-
KeyCodeEvent inject2 = new KeyCodeEvent( KeyCodeEvent.KEY_UP, (char)Keypad.KEY_ESCAPE, 0);
|
1240
|
-
inject1.post();
|
1241
|
-
inject2.post();
|
1242
|
-
m_bSkipKeyPress = true;
|
1243
|
-
}*/
|
1244
|
-
}
|
1245
|
-
}
|
1246
|
-
}
|
1247
|
-
} catch (RenderingException re) {
|
1248
|
-
|
1249
|
-
} finally {
|
1250
|
-
SecondaryResourceFetchThread.doneAddingImages();
|
1251
|
-
}
|
1252
|
-
|
1253
|
-
}
|
1254
|
-
|
1255
|
-
/**
|
1256
|
-
* @see net.rim.device.api.browser.RenderingApplication#eventOccurred(net.rim.device.api.browser.Event)
|
1257
|
-
*/
|
1258
|
-
public Object eventOccurred(Event event) {
|
1259
|
-
|
1260
|
-
int eventId = event.getUID();
|
1261
|
-
|
1262
|
-
switch (eventId) {
|
1263
|
-
|
1264
|
-
case Event.EVENT_URL_REQUESTED : {
|
1265
|
-
|
1266
|
-
UrlRequestedEvent urlRequestedEvent = (UrlRequestedEvent) event;
|
1267
|
-
String absoluteUrl = urlRequestedEvent.getURL();
|
1268
|
-
//if ( !absoluteUrl.startsWith(_httpRoot) )
|
1269
|
-
// absoluteUrl = _httpRoot + absoluteUrl.substring(_httpRoot.length()-5);
|
1270
|
-
|
1271
|
-
if ( urlRequestedEvent.getPostData() == null ||
|
1272
|
-
urlRequestedEvent.getPostData().length == 0 )
|
1273
|
-
addToHistory(absoluteUrl, null );
|
1274
|
-
|
1275
|
-
PrimaryResourceFetchThread thread = new PrimaryResourceFetchThread(absoluteUrl,
|
1276
|
-
urlRequestedEvent.getHeaders(),
|
1277
|
-
urlRequestedEvent.getPostData(),
|
1278
|
-
event);
|
1279
|
-
thread.start();
|
1280
|
-
|
1281
|
-
break;
|
1282
|
-
|
1283
|
-
} case Event.EVENT_BROWSER_CONTENT_CHANGED: {
|
1284
|
-
|
1285
|
-
// browser field title might have changed update title
|
1286
|
-
/*BrowserContentChangedEvent browserContentChangedEvent = (BrowserContentChangedEvent) event;
|
1287
|
-
|
1288
|
-
if (browserContentChangedEvent.getSource() instanceof BrowserContent) {
|
1289
|
-
BrowserContent browserField = (BrowserContent) browserContentChangedEvent.getSource();
|
1290
|
-
String newTitle = browserField.getTitle();
|
1291
|
-
if (newTitle != null) {
|
1292
|
-
synchronized (getAppEventLock())
|
1293
|
-
//synchronized (Application.getEventLock())
|
1294
|
-
{
|
1295
|
-
_mainScreen.setTitle(newTitle);
|
1296
|
-
}
|
1297
|
-
}
|
1298
|
-
}*/
|
1299
|
-
|
1300
|
-
break;
|
1301
|
-
|
1302
|
-
} case Event.EVENT_REDIRECT : {
|
1303
|
-
|
1304
|
-
RedirectEvent e = (RedirectEvent) event;
|
1305
|
-
String referrer = e.getSourceURL();
|
1306
|
-
String absoluteUrl = e.getLocation();
|
1307
|
-
|
1308
|
-
switch (e.getType()) {
|
1309
|
-
|
1310
|
-
case RedirectEvent.TYPE_SINGLE_FRAME_REDIRECT :
|
1311
|
-
// show redirect message
|
1312
|
-
Application.getApplication().invokeAndWait(new Runnable() {
|
1313
|
-
public void run() {
|
1314
|
-
Status.show("You are being redirected to a different page...");
|
1315
|
-
}
|
1316
|
-
});
|
1317
|
-
|
1318
|
-
break;
|
1319
|
-
|
1320
|
-
case RedirectEvent.TYPE_JAVASCRIPT :
|
1321
|
-
break;
|
1322
|
-
case RedirectEvent.TYPE_META :
|
1323
|
-
// MSIE and Mozilla don't send a Referer for META Refresh.
|
1324
|
-
referrer = null;
|
1325
|
-
break;
|
1326
|
-
case RedirectEvent.TYPE_300_REDIRECT :
|
1327
|
-
// MSIE, Mozilla, and Opera all send the original
|
1328
|
-
// request's Referer as the Referer for the new
|
1329
|
-
// request.
|
1330
|
-
//if ( !absoluteUrl.startsWith(_httpRoot) )
|
1331
|
-
// absoluteUrl = _httpRoot + absoluteUrl.substring(_httpRoot.length()-5);
|
1332
|
-
|
1333
|
-
addToHistory(absoluteUrl,referrer);
|
1334
|
-
Object eventSource = e.getSource();
|
1335
|
-
if (eventSource instanceof HttpConnection) {
|
1336
|
-
referrer = ((HttpConnection)eventSource).getRequestProperty(REFERER);
|
1337
|
-
}
|
1338
|
-
break;
|
1339
|
-
|
1340
|
-
}
|
1341
|
-
|
1342
|
-
HttpHeaders requestHeaders = new HttpHeaders();
|
1343
|
-
requestHeaders.setProperty(REFERER, referrer);
|
1344
|
-
PrimaryResourceFetchThread thread = new PrimaryResourceFetchThread(absoluteUrl, requestHeaders,null, event);
|
1345
|
-
thread.start();
|
1346
|
-
break;
|
1347
|
-
|
1348
|
-
} case Event.EVENT_CLOSE :
|
1349
|
-
// TODO: close the application
|
1350
|
-
break;
|
1351
|
-
|
1352
|
-
case Event.EVENT_SET_HEADER :
|
1353
|
-
case Event.EVENT_SET_HTTP_COOKIE : {
|
1354
|
-
/*String cookie = ((SetHttpCookieEvent)event).getCookie();
|
1355
|
-
String response = processAjaxCall(cookie);
|
1356
|
-
if (response != null)
|
1357
|
-
synchronized (pendingResponses) {
|
1358
|
-
pendingResponses.addElement(response);
|
1359
|
-
}
|
1360
|
-
response = null;
|
1361
|
-
cookie = null;*/
|
1362
|
-
break;
|
1363
|
-
}
|
1364
|
-
case Event.EVENT_HISTORY : // no history support
|
1365
|
-
case Event.EVENT_EXECUTING_SCRIPT : // no progress bar is supported
|
1366
|
-
case Event.EVENT_FULL_WINDOW : // no full window support
|
1367
|
-
case Event.EVENT_STOP : // no stop loading support
|
1368
|
-
default :
|
1369
|
-
}
|
1370
|
-
|
1371
|
-
return null;
|
1372
|
-
}
|
1373
|
-
|
1374
|
-
/**
|
1375
|
-
* @see net.rim.device.api.browser.RenderingApplication#getAvailableHeight(net.rim.device.api.browser.BrowserContent)
|
1376
|
-
*/
|
1377
|
-
public int getAvailableHeight(BrowserContent browserField) {
|
1378
|
-
// field has full screen
|
1379
|
-
return Graphics.getScreenHeight();
|
1380
|
-
}
|
1381
|
-
|
1382
|
-
/**
|
1383
|
-
* @see net.rim.device.api.browser.RenderingApplication#getAvailableWidth(net.rim.device.api.browser.BrowserContent)
|
1384
|
-
*/
|
1385
|
-
public int getAvailableWidth(BrowserContent browserField) {
|
1386
|
-
// field has full screen
|
1387
|
-
return Graphics.getScreenWidth();
|
1388
|
-
}
|
1389
|
-
|
1390
|
-
/**
|
1391
|
-
* @see net.rim.device.api.browser.RenderingApplication#getHistoryPosition(net.rim.device.api.browser.BrowserContent)
|
1392
|
-
*/
|
1393
|
-
public int getHistoryPosition(BrowserContent browserField) {
|
1394
|
-
// no history support
|
1395
|
-
return 0;
|
1396
|
-
}
|
1397
|
-
|
1398
|
-
/**
|
1399
|
-
* @see net.rim.device.api.browser.RenderingApplication#getHTTPCookie(java.lang.String)
|
1400
|
-
*/
|
1401
|
-
public String getHTTPCookie(String url) {
|
1402
|
-
StringBuffer responseCode = new StringBuffer();
|
1403
|
-
synchronized (pendingResponses) {
|
1404
|
-
for (int index = 0; index < pendingResponses.size(); index++)
|
1405
|
-
responseCode.append(pendingResponses.elementAt(index));
|
1406
|
-
pendingResponses.removeAllElements();
|
1407
|
-
}
|
1408
|
-
return responseCode.toString();
|
1409
|
-
}
|
1410
|
-
|
1411
|
-
/**
|
1412
|
-
* @see net.rim.device.api.browser.RenderingApplication#getResource(net.rim.device.api.browser.RequestedResource,
|
1413
|
-
* net.rim.device.api.browser.BrowserContent)
|
1414
|
-
*/
|
1415
|
-
public HttpConnection getResource( RequestedResource resource, BrowserContent referrer) {
|
1416
|
-
|
1417
|
-
if (resource == null) {
|
1418
|
-
return null;
|
1419
|
-
}
|
1420
|
-
|
1421
|
-
// check if this is cache-only request
|
1422
|
-
if (resource.isCacheOnly()) {
|
1423
|
-
// no cache support
|
1424
|
-
return null;
|
1425
|
-
}
|
1426
|
-
|
1427
|
-
String url = resource.getUrl();
|
1428
|
-
|
1429
|
-
if (url == null) {
|
1430
|
-
return null;
|
1431
|
-
}
|
1432
|
-
|
1433
|
-
try{
|
1434
|
-
// if referrer is null we must return the connection
|
1435
|
-
if (referrer == null) {
|
1436
|
-
HttpConnection connection = Utilities.makeConnection(url, resource.getRequestHeaders(), null);
|
1437
|
-
return connection;
|
1438
|
-
|
1439
|
-
} else
|
1440
|
-
{
|
1441
|
-
if ( URI.isLocalHost(url) || URI.isLocalData(url))
|
1442
|
-
{
|
1443
|
-
HttpConnection connection = Utilities.makeConnection(url, resource.getRequestHeaders(), null);
|
1444
|
-
return connection;
|
1445
|
-
}else
|
1446
|
-
{
|
1447
|
-
// if referrer is provided we can set up the connection on a separate thread
|
1448
|
-
SecondaryResourceFetchThread.enqueue(resource, referrer);
|
1449
|
-
}
|
1450
|
-
}
|
1451
|
-
}catch(Exception exc)
|
1452
|
-
{
|
1453
|
-
LOG.ERROR("getResource failed.", exc);
|
1454
|
-
}
|
1100
|
+
_currentConnection = connection;*/
|
1455
1101
|
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
/**
|
1460
|
-
* @see net.rim.device.api.browser.RenderingApplication#invokeRunnable(java.lang.Runnable)
|
1461
|
-
*/
|
1462
|
-
public void invokeRunnable(Runnable runnable) {
|
1463
|
-
(new Thread(runnable)).start();
|
1102
|
+
RHODESAPP().getSplashScreen().hide();
|
1103
|
+
|
1104
|
+
m_oBrowserAdapter.processConnection(connection, e);
|
1464
1105
|
}
|
1465
1106
|
|
1466
1107
|
public static class PrimaryResourceFetchThread {//extends Thread {
|
@@ -1517,7 +1158,7 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1517
1158
|
LOG.ERROR("Process command failed.", e);
|
1518
1159
|
}catch(Throwable exc)
|
1519
1160
|
{
|
1520
|
-
LOG.ERROR("Process command
|
1161
|
+
LOG.ERROR("Process command crashed.", exc);
|
1521
1162
|
}
|
1522
1163
|
}
|
1523
1164
|
|
@@ -1544,7 +1185,7 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1544
1185
|
private static RhodesApplication _application;
|
1545
1186
|
private static Runnable _callback;
|
1546
1187
|
|
1547
|
-
private
|
1188
|
+
private Object _event;
|
1548
1189
|
|
1549
1190
|
private byte[] _postData;
|
1550
1191
|
|
@@ -1561,7 +1202,7 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1561
1202
|
}
|
1562
1203
|
|
1563
1204
|
public PrimaryResourceFetchThread(String url, HttpHeaders requestHeaders, byte[] postData,
|
1564
|
-
|
1205
|
+
Object event)
|
1565
1206
|
{
|
1566
1207
|
_url = url;
|
1567
1208
|
_requestHeaders = requestHeaders;
|
@@ -1571,7 +1212,7 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1571
1212
|
}
|
1572
1213
|
|
1573
1214
|
public PrimaryResourceFetchThread(String url, HttpHeaders requestHeaders, byte[] postData,
|
1574
|
-
|
1215
|
+
Object event, Runnable callback)
|
1575
1216
|
{
|
1576
1217
|
_url = url;
|
1577
1218
|
_requestHeaders = requestHeaders;
|
@@ -1608,7 +1249,7 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1608
1249
|
m_oFetchThread = null;
|
1609
1250
|
}
|
1610
1251
|
|
1611
|
-
void start()
|
1252
|
+
public void start()
|
1612
1253
|
{
|
1613
1254
|
m_oFetchThread.addCommand(this);
|
1614
1255
|
}
|
@@ -1621,7 +1262,7 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1621
1262
|
return;
|
1622
1263
|
}
|
1623
1264
|
|
1624
|
-
HttpConnection connection = Utilities.makeConnection(_url, _requestHeaders, _postData);
|
1265
|
+
HttpConnection connection = Utilities.makeConnection(_url, _requestHeaders, _postData, null);
|
1625
1266
|
|
1626
1267
|
if ( m_bInternalRequest )
|
1627
1268
|
{
|
@@ -1631,11 +1272,16 @@ final public class RhodesApplication extends UiApplication implements RenderingA
|
|
1631
1272
|
|
1632
1273
|
if ( m_netCallback != null )
|
1633
1274
|
{
|
1275
|
+
String strRespBody = "";
|
1634
1276
|
InputStream is = connection.openInputStream();
|
1635
|
-
byte[] buffer = new byte[is.available()];
|
1636
|
-
is.read(buffer);
|
1637
1277
|
|
1638
|
-
|
1278
|
+
if ( is != null )
|
1279
|
+
{
|
1280
|
+
byte[] buffer = new byte[is.available()];
|
1281
|
+
is.read(buffer);
|
1282
|
+
strRespBody = new String(buffer);
|
1283
|
+
}
|
1284
|
+
|
1639
1285
|
m_netCallback.setResponse( new NetResponse(strRespBody, nRespCode) );
|
1640
1286
|
}
|
1641
1287
|
}catch(IOException exc)
|