rhodes 3.2.3 → 3.3.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +10 -0
- data/Rakefile +153 -46
- data/doc/build.txt +261 -102
- data/doc/configuration.txt +5 -2
- data/doc/device-caps.txt +134 -23
- data/doc/extensions.txt +922 -69
- data/doc/generator.txt +96 -39
- data/doc/install.txt +35 -19
- data/doc/jqt-jqm-transition.txt +17 -1
- data/doc/rhom.txt +23 -2
- data/doc/rhostudio-eclipse.txt +49 -0
- data/doc/rhostudio-test-plan.txt +440 -0
- data/doc/simulator.txt +1 -1
- data/doc/synchronization.txt +40 -1
- data/lib/build/jake.rb +108 -7
- data/lib/extensions/barcode/ext/barcode/platform/android/Rakefile +0 -35
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +8 -2
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.mm +195 -195
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.m +6 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +5 -0
- data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode_wrap.c +64 -20
- data/lib/extensions/debugger/CHANGELOG +3 -0
- data/lib/extensions/debugger/debugger.rb +26 -21
- data/lib/extensions/digest-md5/ext/Rakefile +5 -5
- data/lib/extensions/digest-md5/ext/build +10 -1
- data/lib/extensions/digest-md5/ext/defs.h +19 -0
- data/lib/extensions/digest-md5/ext/digest-md5.vcproj +317 -9
- data/lib/extensions/digest-md5/ext/iphone/Dmd5.xcodeproj/project.pbxproj +290 -0
- data/lib/extensions/digest-md5/ext/iphone/Dmd5_Prefix.pch +7 -0
- data/lib/extensions/digest-md5/ext/iphone/Rakefile +79 -0
- data/lib/extensions/digest-sha1/ext/Rakefile +5 -5
- data/lib/extensions/digest-sha1/ext/build +10 -1
- data/lib/extensions/digest-sha1/ext/defs.h +19 -0
- data/lib/extensions/digest-sha1/ext/digest-sha1.vcproj +317 -9
- data/lib/extensions/digest-sha1/ext/iphone/Dsha1.xcodeproj/project.pbxproj +278 -0
- data/lib/extensions/digest-sha1/ext/iphone/Dsha1_Prefix.pch +7 -0
- data/lib/extensions/digest-sha1/ext/iphone/Rakefile +79 -0
- data/lib/extensions/digest/ext/Rakefile +5 -5
- data/lib/extensions/digest/ext/build +10 -1
- data/lib/extensions/digest/ext/digest.vcproj +317 -9
- data/lib/extensions/digest/ext/iphone/Digest.xcodeproj/project.pbxproj +270 -0
- data/lib/extensions/digest/ext/iphone/Digest_Prefix.pch +7 -0
- data/lib/extensions/digest/ext/iphone/Rakefile +79 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/ESRI.xcodeproj/project.pbxproj +10 -2
- data/lib/extensions/esri/ext/esri/platform/iphone/Rakefile +6 -0
- data/lib/extensions/fcntl/ext/Rakefile +5 -5
- data/lib/extensions/fcntl/ext/build +9 -1
- data/lib/extensions/fcntl/ext/iphone/Fcntl.xcodeproj/project.pbxproj +262 -0
- data/lib/extensions/fcntl/ext/iphone/Fcntl_Prefix.pch +7 -0
- data/lib/extensions/fcntl/ext/iphone/Rakefile +79 -0
- data/lib/extensions/net-http/net/http.rb +9 -7
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +64 -20
- data/lib/extensions/rhoxml/rexml/document.rb +3 -2
- data/lib/extensions/rhoxml/rexml/instruction.rb +70 -0
- data/lib/framework/builtinME.rb +9 -0
- data/lib/framework/date/format.rb +1 -1
- data/lib/framework/dateME.rb +19 -2
- data/lib/framework/rho/rho.rb +15 -4
- data/lib/framework/rho/rhoapplication.rb +1 -0
- data/lib/framework/rho/rhocontact.rb +10 -27
- data/lib/framework/rho/rhoevent_c.rb +8 -2
- data/lib/framework/rho/rhosupport.rb +25 -0
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhoframework.rb +15 -0
- data/lib/framework/rholang/localization_simplified.rb +8 -10
- data/lib/framework/rhom/rhom_object_factory.rb +8 -2
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/jni/Application.mk +2 -1
- data/platform/android/Rhodes/jni/include/rhodes.h +9 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +31 -1
- data/platform/android/Rhodes/jni/src/event.cpp +75 -31
- data/platform/android/Rhodes/jni/src/nativeview.cpp +1 -1
- data/platform/android/Rhodes/jni/src/phonebook.cpp +73 -9
- data/platform/android/Rhodes/jni/src/rhodes.cpp +21 -0
- data/platform/android/Rhodes/jni/src/rhodesapp.cpp +16 -24
- data/platform/android/Rhodes/jni/src/signature.cpp +27 -1
- data/platform/android/Rhodes/{default.properties → project.properties} +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +14 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +14 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +38 -115
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +69 -52
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +9 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraNewService.java +21 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraOldService.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraSemiService.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraService.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +38 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/Event.java +212 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +82 -125
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +2 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +39 -19
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +106 -136
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +26 -25
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality.java +40 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality01.java +47 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality02.java +33 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality03.java +33 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality04.java +34 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality05.java +75 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality06.java +34 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality07.java +34 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality08.java +44 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality09.java +34 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality10.java +34 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionalityManager.java +73 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +57 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessor.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +322 -76
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +11 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +5 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +2 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +125 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsOld.java +2 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebView.java +16 -0
- data/platform/android/build/RhodesSRC_build.files +14 -0
- data/platform/android/build/android.rake +149 -147
- data/platform/android/build/android_tools.rb +58 -0
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/android/build/libruby_build.files +3 -0
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +11 -1
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +11 -5
- data/platform/bb/RubyVM/src/com/rho/db/DBAttrManager.java +3 -2
- data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +2 -0
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +20 -8
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +9 -6
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +45 -18
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +1 -2
- data/platform/bb/build/bb.rake +84 -70
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +106 -14
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +1 -1
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +108 -16
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +10 -5
- data/platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java +21 -4
- data/platform/bb/rhodes/src/rhomobile/mapview/Annotation.java +17 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/MapView.java +8 -5
- data/platform/bb/rhodes/src/rhomobile/mapview/MapViewScreen.java +3 -1
- data/platform/iphone/Classes/AppManager/AppManager.m +15 -3
- data/platform/iphone/Classes/Event/Event.m +45 -2
- data/platform/iphone/Classes/MapView/MapViewController.m +8 -4
- data/platform/iphone/Classes/Phonebook/phonebook.m +30 -7
- data/platform/iphone/Classes/Rhodes.h +11 -1
- data/platform/iphone/Classes/Rhodes.m +141 -9
- data/platform/iphone/Classes/Signature/SignatureDelegate.m +27 -1
- data/platform/iphone/Classes/SimpleMainView.h +1 -0
- data/platform/iphone/Classes/SimpleMainView.m +4 -0
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +31 -1
- data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +10 -0
- data/platform/iphone/rbuild/iphone.rake +33 -6
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +10 -2
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +22 -2
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +14 -0
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +10 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Info.plist +1 -1
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/MacOS/RhoSimulator +0 -0
- data/platform/osx/build/osx.rake +58 -7
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +427 -69
- data/platform/shared/RhoConnectClient/RhoConnectClient.h +21 -2
- data/platform/shared/common/Android.mk +2 -1
- data/platform/shared/common/AutoPointer.h +23 -0
- data/platform/shared/common/BundleManager.cpp +333 -0
- data/platform/shared/common/RhoFile.cpp +206 -23
- data/platform/shared/common/RhoFile.h +14 -4
- data/platform/shared/common/RhoFilePath.h +18 -0
- data/platform/shared/common/RhoStd.h +11 -1
- data/platform/shared/common/RhoThread.h +4 -1
- data/platform/shared/common/RhodesApp.cpp +31 -8
- data/platform/shared/common/RhodesApp.h +14 -0
- data/platform/shared/common/RhodesAppBase.cpp +6 -6
- data/platform/shared/common/RhodesAppBase.h +1 -1
- data/platform/shared/common/emml.h +34 -0
- data/platform/shared/common/iphone/RhoFileImpl.m +30 -2
- data/platform/shared/common/map/BaseMapEngine.cpp +3 -3
- data/platform/shared/common/map/GeocodingMapEngine.cpp +205 -14
- data/platform/shared/common/map/GeocodingMapEngine.h +25 -2
- data/platform/shared/common/map/MapEngine.cpp +24 -2
- data/platform/shared/common/map/MapEngine.h +23 -12
- data/platform/shared/common/phonebook/PhonebookParams.cpp +99 -0
- data/platform/shared/common/phonebook/PhonebookParams.h +52 -0
- data/platform/shared/common/rhoparams.cpp +14 -0
- data/platform/shared/common/rhoparams.h +1 -0
- data/platform/shared/db/DBAdapter.cpp +43 -24
- data/platform/shared/db/DBAdapter.h +6 -1
- data/platform/shared/db/DBAttrManager.cpp +50 -1
- data/platform/shared/logging/RhoLog.h +3 -0
- data/platform/shared/logging/RhoLogSink.cpp +5 -1
- data/platform/shared/net/CURLNetRequest.cpp +2 -0
- data/platform/shared/qt/rhodes/QtMainWindow.cpp +14 -1
- data/platform/shared/qt/rhodes/impl/PhonebookImpl.cpp +2 -2
- data/platform/shared/qt/rhodes/impl/RhoFileImpl.cpp +1 -1
- data/platform/shared/qt/rhodes/impl/SignatureImpl.cpp +14 -2
- data/platform/shared/qt/rhodes/impl/SystemImpl.cpp +16 -2
- data/platform/shared/qt/rhodes/main.cpp +28 -0
- data/platform/shared/qt/rhodes/rhodes.pro +3 -0
- data/platform/shared/qt/rholib/rholib.pro +2 -1
- data/platform/shared/qt/rubylib/rubylib.pro +2 -1
- data/platform/shared/ruby/Android.mk +3 -0
- data/platform/shared/ruby/class.c +7 -0
- data/platform/shared/ruby/compile.c +18 -10
- data/platform/shared/ruby/encdb.h +18 -8
- data/platform/shared/ruby/eval.c +108 -2
- data/platform/shared/ruby/ext/alert/alert_wrap.c +64 -20
- data/platform/shared/ruby/ext/asynchttp/asynchttp_wrap.c +64 -20
- data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +67 -23
- data/platform/shared/ruby/ext/calendar/calendar_wrap.c +64 -20
- data/platform/shared/ruby/ext/calendar/event_wrap.c +64 -20
- data/platform/shared/ruby/ext/camera/camera_wrap.c +64 -20
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +64 -20
- data/platform/shared/ruby/ext/geolocation/geolocation.i +16 -0
- data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +127 -26
- data/platform/shared/ruby/ext/mapview/mapview_wrap.c +64 -20
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +65 -21
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c +64 -20
- data/platform/shared/ruby/ext/navbar/navbar_wrap.c +64 -20
- data/platform/shared/ruby/ext/phonebook/phonebook.i +7 -7
- data/platform/shared/ruby/ext/phonebook/phonebook_wrap.c +95 -120
- data/platform/shared/ruby/ext/rho/rhoruby.c +4 -4
- data/platform/shared/ruby/ext/rho/rhoruby.h +2 -0
- data/platform/shared/ruby/ext/rho/rhosupport.c +39 -6
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +65 -21
- data/platform/shared/ruby/ext/ringtones/ringtones_wrap.c +64 -20
- data/platform/shared/ruby/ext/signature/signature.i +37 -5
- data/platform/shared/ruby/ext/signature/signature_wrap.c +274 -45
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +65 -21
- data/platform/shared/ruby/ext/system/system.i +14 -2
- data/platform/shared/ruby/ext/system/system_wrap.c +146 -25
- data/platform/shared/ruby/ext/webview/webview_wrap.c +65 -21
- data/platform/shared/ruby/include/ruby/ruby.h +15 -4
- data/platform/shared/ruby/inits.c +1 -0
- data/platform/shared/ruby/io.c +13 -3
- data/platform/shared/ruby/win32/win32.c +3 -3
- data/platform/shared/ruby/wince/io_wce.c +2 -2
- data/platform/shared/rubyext/System.cpp +9 -5
- data/platform/shared/sync/ClientRegister.cpp +18 -8
- data/platform/shared/sync/SyncEngine.cpp +25 -11
- data/platform/shared/sync/SyncEngine.h +2 -0
- data/platform/shared/sync/SyncSource.cpp +40 -15
- data/platform/shared/sync/SyncSource.h +3 -2
- data/platform/shared/sync/SyncThread.cpp +9 -4
- data/platform/shared/sync/SyncThread.h +3 -1
- data/platform/symbian/build/symbian.rake +14 -9
- data/platform/symbian/rhodes/rhodes.pro +11 -8
- data/platform/symbian/rhodes/src/phonebook/ruby_phonebook.cpp +2 -2
- data/platform/symbian/rubylib/rubylib.pro +3 -0
- data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
- data/platform/wm/RhoLib/RhoLib.vcproj +315 -2
- data/platform/wm/build/build_inf.js +235 -187
- data/platform/wm/build/wm.rake +388 -233
- data/platform/wm/rhodes.sln +56 -0
- data/platform/wm/rhodes/MainWindow.cpp +139 -77
- data/platform/wm/rhodes/MainWindow.h +27 -22
- data/platform/wm/rhodes/MapView/{Graphics.cpp → Bitmap.cpp} +15 -253
- data/platform/wm/rhodes/MapView/Bitmap.h +86 -0
- data/platform/wm/rhodes/MapView/MapViewManager.cpp +7 -2
- data/platform/wm/rhodes/MapView/MapViewManager.h +1 -1
- data/platform/wm/rhodes/MapView/Win32Graphics.cpp +263 -0
- data/platform/wm/rhodes/MapView/Win32Graphics.h +133 -0
- data/platform/wm/rhodes/MapView/WmGraphics.cpp +291 -0
- data/platform/wm/rhodes/MapView/{Graphics.h → WmGraphics.h} +14 -56
- data/platform/wm/rhodes/Rhodes.cpp +128 -32
- data/platform/wm/rhodes/Rhodes.rc +6 -2
- data/platform/wm/rhodes/camera/Camera.cpp +1 -0
- data/platform/wm/rhodes/phonebook/phonebook.cpp +2 -2
- data/platform/wm/rhodes/phonebook/phonebook.h +2 -2
- data/platform/wm/rhodes/resource.h +3 -2
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +6 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +4 -0
- data/platform/wm/rhodes/rho/rubyext/RhoSignature.cpp +675 -0
- data/platform/wm/rhodes/rho/rubyext/RhoSignature.h +123 -0
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +12 -2
- data/platform/wm/rhodes/rhodes.vcproj +2732 -1113
- data/platform/wm/rhodes/simulator/MainWindowQt.h +1 -1
- data/platform/wm/rhodes/stdafx.h +1 -0
- data/platform/wm/rhoelements.sln +118 -62
- data/platform/wm/rubylib/rubylib.vcproj +345 -16
- data/platform/wm/sqlite3/sqlite3.vcproj +305 -0
- data/platform/wm/syncengine/syncengine.vcproj +309 -0
- data/platform/wm/tools/detool/LogServer.cpp +19 -2
- data/platform/wm/tools/detool/detool.cpp +131 -6
- data/platform/wm/tools/detool/detool.vcproj +3 -1
- data/platform/wm/tools/detool/stdafx.h +1 -0
- data/platform/wp7/IronRuby/Languages/Ruby/Libraries/Builtins/RangeOps.cs +589 -0
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Builtins/RubyEncoding.cs +678 -0
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyExceptionData.cs +271 -0
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyUtils.cs +31 -1
- data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.Libraries.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.dll +0 -0
- data/platform/wp7/RhoRubyLib/common/RhoStd.cs +6 -0
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +16 -2
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +2 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +1 -2
- data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +13 -10
- data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +30 -8
- data/platform/wp7/build/wp.rake +5 -0
- data/rakefile.rb +153 -46
- data/res/build-tools/detool.exe +0 -0
- data/res/build-tools/swig_patch/Lib/ruby/rubyerrors.swg +155 -0
- data/res/build-tools/swig_patch/Lib/ruby/rubyhead.swg +158 -0
- data/res/build-tools/swig_patch/Lib/ruby/rubyiterators.swg +932 -0
- data/res/build-tools/swig_patch/Lib/ruby/rubyrun.swg +448 -0
- data/res/build-tools/swig_patch/Lib/ruby/rubystdfunctors.swg +162 -0
- data/res/build-tools/swig_patch/Lib/ruby/rubytracking.swg +159 -0
- data/res/build-tools/swig_patch/Lib/ruby/std_basic_string.i +97 -0
- data/res/build-tools/swig_patch/Lib/ruby/std_map.i +418 -0
- data/res/build-tools/swig_patch/Lib/ruby/std_multimap.i +227 -0
- data/res/build-tools/swig_patch/Lib/swiginit.swg +269 -0
- data/res/build-tools/swig_patch/README +7 -0
- data/res/generators/templates/application/app/Settings/controller.rb +42 -1
- data/res/generators/templates/application/app/Settings/wait.erb +1 -1
- data/res/generators/templates/application/app/application.rb +1 -1
- data/res/generators/templates/application/app/layout.erb +8 -8
- data/res/generators/templates/application/build.yml +0 -1
- data/res/generators/templates/application/public/css/android.css +6 -0
- data/res/generators/templates/application/public/css/blackberry.css +6 -0
- data/res/generators/templates/application/public/css/iphone.css +6 -0
- data/res/generators/templates/application/public/css/jqmobile-patch.css +14 -0
- data/res/generators/templates/application/public/jqmobile/images/ajax-loader.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0rc1.css → jquery.mobile-1.0.css} +452 -354
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0rc1.js → jquery.mobile-1.0.js} +629 -442
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.css +2 -0
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.js +172 -0
- data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.css +714 -0
- data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.min.css +2 -0
- data/res/generators/templates/application/public/js/jqmobile-patch.js +136 -7
- data/res/generators/templates/extension/app/MontanaTest/controller.rb +20 -20
- data/res/generators/templates/extension/app/MontanaTest/index.erb +17 -17
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana.xcodeproj/project.pbxproj +8 -2
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Rakefile +5 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana_wrap.c +64 -20
- data/rhomobile-debug.gemspec +1 -1
- data/spec/framework_spec/app/layout.erb +1 -1
- data/spec/framework_spec/app/spec/core/rational/Rational_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/stringio/shared/each_char.rb +6 -2
- data/spec/framework_spec/app/spec/shared/rational/{Rational.rb → rational_main.rb} +0 -0
- data/spec/framework_spec/build.yml +0 -3
- data/spec/perfomance_spec/app/Benchmark/controller.rb +1 -1
- data/spec/perfomance_spec/app/layout.erb +1 -1
- data/spec/phone_spec/app/BlobTest_s/blob_test_s.rb +13 -0
- data/spec/phone_spec/app/BlobTest_s/test.png +0 -0
- data/spec/phone_spec/app/BlobTest_s/test2.png +0 -0
- data/spec/phone_spec/app/spec/blobsync_spec.rb +27 -15
- data/spec/phone_spec/app/spec/date_spec.rb +27 -1
- data/spec/phone_spec/app/spec/rho_spec.rb +6 -0
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +64 -26
- data/spec/phone_spec/app/spec/syncengine_spec.rb +28 -7
- data/spec/phone_spec/app/spec/uri_spec.rb +4 -4
- data/spec/phone_spec/app/spec_runner.rb +4 -2
- data/spec/phone_spec/build.yml +7 -9
- data/spec/phone_spec/rhoconfig.txt +1 -0
- data/version +1 -1
- metadata +75 -22
- data/Manifest.txt +0 -7853
- data/platform/wm/rhodes/rhoelements/RhoWKBrowserEngine.cpp +0 -384
- data/platform/wm/rhodes/rhoelements/RhoWKBrowserEngine.h +0 -41
- data/platform/wm/rhodes/signature/Signature.cpp +0 -396
- data/platform/wm/rhodes/signature/Signature.h +0 -84
- data/platform/wm/rubylib/rubylib.vcproj.VLAD.Vladimir.user +0 -429
- data/platform/wm/sqlite3/sqlite3.vcproj.VLAD.Vladimir.user +0 -429
- data/platform/wm/syncengine/syncengine.vcproj.VLAD.Vladimir.user +0 -429
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.min.css +0 -12
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.min.js +0 -170
- data/rhomobile-debug-1.0.5.gem +0 -0
@@ -63,14 +63,20 @@ public:
|
|
63
63
|
|
64
64
|
static unsigned int getFileSize( const char* szFilePath );
|
65
65
|
static bool isFileExist( const char* szFilePath );
|
66
|
-
static
|
67
|
-
static
|
66
|
+
static unsigned int deleteFile( const char* szFilePath );
|
67
|
+
static unsigned int renameFile( const char* szOldFilePath, const char* szNewFilePath );
|
68
68
|
static void deleteFilesInFolder(const char* szFolderPath);
|
69
69
|
static void loadTextFile(const char* szFilePath, String& strFile);
|
70
|
-
static
|
70
|
+
static unsigned int createFolder(const char* szDirPath);
|
71
71
|
static void recursiveCreateDir(const char* szFolderPath, const char* szBasePath);
|
72
72
|
static void readStringFromFile( const char* szFilePath, String& strData );
|
73
73
|
static void writeStringToFile( const char* szFilePath, String& strData );
|
74
|
+
|
75
|
+
static unsigned int copyFile(const char* szSrcFile, const char* szDstFile);
|
76
|
+
static unsigned int deleteFolder(const char* szFolderPath);
|
77
|
+
static unsigned int copyFoldersContentToAnotherFolder(const char* szSrcFolderPath, const char* szDstFolderPath);
|
78
|
+
static unsigned int moveFoldersContentToAnotherFolder(const char* szSrcFolderPath, const char* szDstFolderPath);
|
79
|
+
|
74
80
|
private:
|
75
81
|
CRhoFile(const CRhoFile&);
|
76
82
|
void operator=(const CRhoFile&);
|
@@ -80,6 +86,10 @@ private:
|
|
80
86
|
}
|
81
87
|
}
|
82
88
|
|
83
|
-
extern "C" void
|
89
|
+
extern "C" void rho_file_impl_delete_files_in_folder(const char *szFolderPath);
|
90
|
+
|
91
|
+
extern "C" void rho_file_impl_delete_folder(const char* szFolderPath);
|
92
|
+
extern "C" void rho_file_impl_copy_folders_content_to_another_folder(const char* szSrcFolderPath, const char* szDstFolderPath);
|
93
|
+
extern "C" void rho_file_impl_move_folders_content_to_another_folder(const char* szSrcFolderPath, const char* szDstFolderPath);
|
84
94
|
|
85
95
|
#endif //_RHOFILE_H_
|
@@ -98,6 +98,24 @@ public:
|
|
98
98
|
|
99
99
|
return res;
|
100
100
|
}
|
101
|
+
#if defined(WINDOWS_PLATFORM)
|
102
|
+
static StringW join(const StringW& path1, const StringW& path2)
|
103
|
+
{
|
104
|
+
boolean bSlash1 = path1.length()>0 && (path1[path1.length()-1] == L'/' || path1[path1.length()-1] == L'\\');
|
105
|
+
boolean bSlash2 = path2.length()>0 && (path2[0] == L'/' || path2[0] == L'\\');
|
106
|
+
StringW res;
|
107
|
+
if (bSlash1 && bSlash2)
|
108
|
+
res = path1 + path2.substr(1);
|
109
|
+
else if ( bSlash1 || bSlash2 )
|
110
|
+
res = path1 + path2;
|
111
|
+
else
|
112
|
+
{
|
113
|
+
res = path1 + L"/" + path2;
|
114
|
+
}
|
115
|
+
|
116
|
+
return res;
|
117
|
+
}
|
118
|
+
#endif
|
101
119
|
|
102
120
|
static String normalizePath(const String& path1)
|
103
121
|
{
|
@@ -100,6 +100,16 @@ inline boolean String_startsWith(const String& str, const String& strPrefix)
|
|
100
100
|
return strncmp(str.c_str(), strPrefix.c_str(), strPrefix.length()) == 0;
|
101
101
|
}
|
102
102
|
|
103
|
+
template<typename StrType>
|
104
|
+
inline void String_replace(StrType& str, int from, int to)
|
105
|
+
{
|
106
|
+
for( int i = 0; i < str.length(); i++)
|
107
|
+
{
|
108
|
+
if ( str[i] == from )
|
109
|
+
str[i] = to;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
103
113
|
template<class Type>
|
104
114
|
class Vector : public std::vector<Type>{
|
105
115
|
public:
|
@@ -260,7 +270,7 @@ public:
|
|
260
270
|
|
261
271
|
boolean containsKey(const TKEY& key)
|
262
272
|
{
|
263
|
-
return std::map<TKEY,TVALUE>::find(key) != std::map<TKEY,TVALUE>::end();
|
273
|
+
return !std::map<TKEY,TVALUE>::empty() && std::map<TKEY,TVALUE>::find(key) != std::map<TKEY,TVALUE>::end();
|
264
274
|
}
|
265
275
|
};
|
266
276
|
|
@@ -29,6 +29,7 @@
|
|
29
29
|
#include "RhoStd.h"
|
30
30
|
#include "IRhoThreadImpl.h"
|
31
31
|
#include "AutoPointer.h"
|
32
|
+
#include "common/RhoSystem.h"
|
32
33
|
|
33
34
|
namespace rho {
|
34
35
|
namespace common {
|
@@ -42,6 +43,7 @@ class CRhoThread : public IRhoRunnable
|
|
42
43
|
static const int TS_RUNNING = 4;
|
43
44
|
|
44
45
|
int m_nState;
|
46
|
+
unsigned int m_nThreadID;
|
45
47
|
public:
|
46
48
|
|
47
49
|
CRhoThread();
|
@@ -55,6 +57,7 @@ public:
|
|
55
57
|
virtual void run() = 0;
|
56
58
|
virtual void runObject()
|
57
59
|
{
|
60
|
+
m_nThreadID = CSystem::getThreadID();
|
58
61
|
run();
|
59
62
|
m_nState = TS_NONE;
|
60
63
|
}
|
@@ -62,7 +65,7 @@ public:
|
|
62
65
|
boolean isStopping(){return (m_nState&TS_STOPPING) != 0;}
|
63
66
|
boolean isWaiting(){return (m_nState&TS_WAIT) != 0;}
|
64
67
|
boolean isAlive(){return (m_nState&TS_RUNNING) != 0;}
|
65
|
-
|
68
|
+
unsigned int getThreadID(){ return m_nThreadID; }
|
66
69
|
};
|
67
70
|
|
68
71
|
}
|
@@ -27,6 +27,7 @@
|
|
27
27
|
#include "RhodesApp.h"
|
28
28
|
#include "common/RhoMutexLock.h"
|
29
29
|
#include "common/IRhoClassFactory.h"
|
30
|
+
#include "common/RhoFile.h"
|
30
31
|
#include "common/RhoConf.h"
|
31
32
|
#include "common/RhoFilePath.h"
|
32
33
|
#include "common/RhoAppAdapter.h"
|
@@ -41,6 +42,7 @@
|
|
41
42
|
#include "rubyext/WebView.h"
|
42
43
|
#include "rubyext/GeoLocation.h"
|
43
44
|
#include "common/app_build_configs.h"
|
45
|
+
#include "unzip/unzip.h"
|
44
46
|
|
45
47
|
#include <algorithm>
|
46
48
|
|
@@ -59,7 +61,7 @@ void rho_db_init_attr_manager();
|
|
59
61
|
void rho_sys_app_exit();
|
60
62
|
void rho_sys_report_app_started();
|
61
63
|
}
|
62
|
-
|
64
|
+
|
63
65
|
namespace rho {
|
64
66
|
namespace common{
|
65
67
|
|
@@ -277,6 +279,9 @@ void CAppCallbacksQueue::processCommand(IQueueCommand* pCmd)
|
|
277
279
|
delete m_pInstance;
|
278
280
|
|
279
281
|
m_pInstance = 0;
|
282
|
+
|
283
|
+
|
284
|
+
|
280
285
|
}
|
281
286
|
|
282
287
|
CRhodesApp::CRhodesApp(const String& strRootPath)
|
@@ -314,7 +319,7 @@ void CRhodesApp::run()
|
|
314
319
|
RhoRubyStart();
|
315
320
|
rubyext::CGeoLocation::Create();
|
316
321
|
|
317
|
-
rho_db_init_attr_manager();
|
322
|
+
//rho_db_init_attr_manager();
|
318
323
|
|
319
324
|
LOG(INFO) + "Starting sync engine...";
|
320
325
|
sync::CSyncThread::Create();
|
@@ -496,6 +501,9 @@ void CRhodesApp::callUiCreatedCallback()
|
|
496
501
|
|
497
502
|
void CRhodesApp::callUiDestroyedCallback()
|
498
503
|
{
|
504
|
+
if ( m_bExit )
|
505
|
+
return;
|
506
|
+
|
499
507
|
String strUrl = m_strHomeUrl + "/system/uidestroyed";
|
500
508
|
NetResponse resp = getNetRequest().pullData( strUrl, null );
|
501
509
|
if ( !resp.isOK() )
|
@@ -571,7 +579,9 @@ void CRhodesApp::callBarcodeCallback(String strCallbackUrl, const String& strBar
|
|
571
579
|
strBody += "&status=fail";
|
572
580
|
}
|
573
581
|
|
574
|
-
|
582
|
+
strBody += "&rho_callback=1";
|
583
|
+
//getNetRequest().pushData( strCallbackUrl, strBody, null );
|
584
|
+
runCallbackInThread(strCallbackUrl, strBody);
|
575
585
|
}
|
576
586
|
|
577
587
|
void CRhodesApp::callCameraCallback(String strCallbackUrl, const String& strImagePath,
|
@@ -607,7 +617,8 @@ void CRhodesApp::callSignatureCallback(String strCallbackUrl, const String& strS
|
|
607
617
|
strBody = "status=ok&signature_uri=db%2Fdb-files%2F" + strSignaturePath;
|
608
618
|
|
609
619
|
strBody += "&rho_callback=1";
|
610
|
-
getNetRequest().pushData( strCallbackUrl, strBody, null );
|
620
|
+
//getNetRequest().pushData( strCallbackUrl, strBody, null );
|
621
|
+
runCallbackInThread(strCallbackUrl, strBody);
|
611
622
|
}
|
612
623
|
|
613
624
|
void CRhodesApp::callDateTimeCallback(String strCallbackUrl, long lDateTime, const char* szData, int bCancel )
|
@@ -961,11 +972,14 @@ String CRhodesApp::getAppName()
|
|
961
972
|
String strAppName;
|
962
973
|
#ifdef OS_WINCE
|
963
974
|
String path = rho_native_rhopath();
|
964
|
-
|
975
|
+
String_replace(path, '/', '\\');
|
976
|
+
|
977
|
+
int nEnd = path.find_last_of('\\');
|
978
|
+
nEnd = path.find_last_of('\\', nEnd-1)-1;
|
979
|
+
|
980
|
+
int nStart = path.find_last_of('\\', nEnd) +1;
|
981
|
+
strAppName = path.substr( nStart, nEnd-nStart+1);
|
965
982
|
|
966
|
-
last = path.find_last_of('\\');
|
967
|
-
pre_last = path.substr(0, last).find_last_of('\\');
|
968
|
-
strAppName = path.substr(pre_last + 1, last - pre_last - 1);
|
969
983
|
#else
|
970
984
|
strAppName = "Rhodes";
|
971
985
|
#endif
|
@@ -1597,3 +1611,12 @@ int rho_rhodesapp_canstartapp(const char* szCmdLine, const char* szSeparators)
|
|
1597
1611
|
}
|
1598
1612
|
|
1599
1613
|
} //extern "C"
|
1614
|
+
|
1615
|
+
|
1616
|
+
|
1617
|
+
|
1618
|
+
|
1619
|
+
|
1620
|
+
|
1621
|
+
|
1622
|
+
|
@@ -166,6 +166,16 @@ protected:
|
|
166
166
|
void initAppUrls();
|
167
167
|
};
|
168
168
|
|
169
|
+
#if defined(OS_WINDOWS) || defined(OS_WINCE)
|
170
|
+
extern "C" void rho_wm_impl_performOnUiThread(rho::common::IRhoRunnable* pTask);
|
171
|
+
|
172
|
+
template <typename FUNCTYPE, typename PARAMTYPE>
|
173
|
+
void rho_callInUIThread( FUNCTYPE pFunc, PARAMTYPE param )
|
174
|
+
{
|
175
|
+
rho_wm_impl_performOnUiThread( new rho::common::CStaticClassFunctor<FUNCTYPE,PARAMTYPE>(pFunc, param) );
|
176
|
+
}
|
177
|
+
#endif //defined(OS_WINDOWS) || defined(OS_WINCE)
|
178
|
+
|
169
179
|
}
|
170
180
|
}
|
171
181
|
|
@@ -234,6 +244,10 @@ int rho_rhodesapp_check_mode();
|
|
234
244
|
|
235
245
|
int rho_rhodesapp_canstartapp(const char* szCmdLine, const char* szSeparators);
|
236
246
|
|
247
|
+
|
248
|
+
// should be implemented in platforms code
|
249
|
+
void rho_platform_restart_application();
|
250
|
+
|
237
251
|
#ifdef __cplusplus
|
238
252
|
};
|
239
253
|
#endif //__cplusplus
|
@@ -127,23 +127,23 @@ boolean CRhodesAppBase::isBaseUrl(const String& strUrl)
|
|
127
127
|
|
128
128
|
extern "C" {
|
129
129
|
|
130
|
-
int
|
130
|
+
int rho_sys_unzip_file(const char* szZipPath, const char* psw)
|
131
131
|
{
|
132
132
|
rho::common::CFilePath oPath(szZipPath);
|
133
133
|
rho::String strBaseDir = oPath.getFolderName();
|
134
134
|
#if defined(UNICODE) && defined(WIN32)
|
135
135
|
rho::StringW strZipPathW;
|
136
136
|
rho::common::convertToStringW(szZipPath, strZipPathW);
|
137
|
-
HZIP hz = OpenZipFile(strZipPathW.c_str(),
|
137
|
+
HZIP hz = OpenZipFile(strZipPathW.c_str(), psw);
|
138
138
|
if ( !hz )
|
139
|
-
return
|
139
|
+
return -1;
|
140
140
|
|
141
141
|
// Set base for unziping
|
142
142
|
SetUnzipBaseDir(hz, rho::common::convertToStringW(strBaseDir).c_str());
|
143
143
|
#else
|
144
|
-
HZIP hz = OpenZipFile(szZipPath,
|
144
|
+
HZIP hz = OpenZipFile(szZipPath, psw);
|
145
145
|
if ( !hz )
|
146
|
-
return
|
146
|
+
return -1;
|
147
147
|
|
148
148
|
// Set base for unziping
|
149
149
|
SetUnzipBaseDir(hz,strBaseDir.c_str() );
|
@@ -167,7 +167,7 @@ int rho_unzip_file(const char* szZipPath)
|
|
167
167
|
|
168
168
|
CloseZip(hz);
|
169
169
|
|
170
|
-
return res
|
170
|
+
return res;
|
171
171
|
}
|
172
172
|
|
173
173
|
#ifdef RHODES_EMULATOR
|
@@ -91,7 +91,7 @@ const char* rho_rhodesapp_getplatform();
|
|
91
91
|
//const char* rho_rhodesapp_getrhodespath();
|
92
92
|
void rho_file_recursive_createdir(const char* szPath, const char* szBasePath);
|
93
93
|
|
94
|
-
int rho_unzip_file(const char* szZipPath);
|
94
|
+
int rho_unzip_file(const char* szZipPath, const char* psw);
|
95
95
|
|
96
96
|
void rho_free_callbackdata(void* pData);
|
97
97
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#include "ruby/ext/rho/rhoruby.h"
|
2
|
+
#include <AtlBase.h>
|
3
|
+
#include <AtlConv.h>
|
4
|
+
|
5
|
+
using namespace std;
|
6
|
+
|
7
|
+
namespace rho
|
8
|
+
{
|
9
|
+
namespace emml
|
10
|
+
{
|
11
|
+
wstring rubyValueToEMML(rho_param* p)
|
12
|
+
{
|
13
|
+
wstring emml;
|
14
|
+
|
15
|
+
if (p && p->type == RHO_PARAM_HASH) {
|
16
|
+
for (int i = 0; i < p->v.hash->size; i++) {
|
17
|
+
emml.append(CA2W(p->v.hash->name[i]));
|
18
|
+
emml.append(L":");
|
19
|
+
emml.append(CA2W(p->v.hash->value[i]->v.string));
|
20
|
+
if(i < p->v.hash->size - 1)
|
21
|
+
emml.append(L";");
|
22
|
+
}
|
23
|
+
}
|
24
|
+
rho_param_free(p);
|
25
|
+
return emml;
|
26
|
+
}
|
27
|
+
|
28
|
+
void addEMML(wstring& dest, wchar_t* src)
|
29
|
+
{
|
30
|
+
dest.append(L";");
|
31
|
+
dest.append(src);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
@@ -31,7 +31,7 @@
|
|
31
31
|
|
32
32
|
#define ZIP_STD 1
|
33
33
|
|
34
|
-
extern void
|
34
|
+
extern void rho_file_impl_delete_files_in_folder(const char *szFolderPath);
|
35
35
|
|
36
36
|
@interface RhoFileImpl : NSObject {
|
37
37
|
}
|
@@ -59,7 +59,35 @@ extern void delete_files_in_folder(const char *szFolderPath);
|
|
59
59
|
|
60
60
|
@end
|
61
61
|
|
62
|
-
void
|
62
|
+
void rho_file_impl_delete_files_in_folder(const char *szFolderPath)
|
63
63
|
{
|
64
64
|
[RhoFileImpl deleteFilesInFolder:[NSString stringWithUTF8String:szFolderPath]];
|
65
65
|
}
|
66
|
+
|
67
|
+
void rho_file_impl_delete_folder(const char* szFolderPath) {
|
68
|
+
NSFileManager *fileManager = [NSFileManager defaultManager];
|
69
|
+
NSError *err;
|
70
|
+
[fileManager removeItemAtPath:[NSString stringWithUTF8String:szFolderPath] error:&err];
|
71
|
+
}
|
72
|
+
|
73
|
+
void rho_file_impl_copy_folders_content_to_another_folder(const char* szSrcFolderPath, const char* szDstFolderPath) {
|
74
|
+
|
75
|
+
NSFileManager *fileManager = [NSFileManager defaultManager];
|
76
|
+
|
77
|
+
NSString* src_folder = [NSString stringWithUTF8String:szSrcFolderPath];
|
78
|
+
NSString* dst_folder = [NSString stringWithUTF8String:szDstFolderPath];
|
79
|
+
|
80
|
+
NSDirectoryEnumerator *enumerator = [fileManager enumeratorAtPath:src_folder];
|
81
|
+
if (enumerator == nil)
|
82
|
+
return;
|
83
|
+
|
84
|
+
NSError *err;
|
85
|
+
id path;
|
86
|
+
while ((path = [enumerator nextObject])) {
|
87
|
+
NSString *src_item = [NSString stringWithFormat:@"%@/%@", src_folder, [NSString stringWithFormat:@"%@", path]];
|
88
|
+
NSString *dst_item = [NSString stringWithFormat:@"%@/%@", dst_folder, [NSString stringWithFormat:@"%@", path]];
|
89
|
+
[fileManager copyItemAtPath:src_item toPath:dst_item error:&err];
|
90
|
+
}
|
91
|
+
|
92
|
+
}
|
93
|
+
|
@@ -608,7 +608,7 @@ public:
|
|
608
608
|
|
609
609
|
void onError(String const &) {}
|
610
610
|
|
611
|
-
void onSuccess(double latitude, double longitude)
|
611
|
+
void onSuccess(double latitude, double longitude, const char* adress)
|
612
612
|
{
|
613
613
|
RHO_MAP_TRACE2("CenterResolved: latitude=%lf, longitude=%lf", latitude, longitude);
|
614
614
|
m_mapview->moveTo(latitude, longitude);
|
@@ -627,10 +627,10 @@ public:
|
|
627
627
|
|
628
628
|
void onError(String const &) {}
|
629
629
|
|
630
|
-
void onSuccess(double latitude, double longitude)
|
630
|
+
void onSuccess(double latitude, double longitude, const char* adress)
|
631
631
|
{
|
632
632
|
RHO_MAP_TRACE2("AnnotationResolved: latitude=%lf, longitude=%lf", latitude, longitude);
|
633
|
-
Annotation ann(m_ann.title(), m_ann.subtitle(), latitude, longitude, m_ann.url());
|
633
|
+
Annotation ann(m_ann.title(), m_ann.subtitle(), latitude, longitude, m_ann.url(), m_ann.pass_location());
|
634
634
|
m_mapview->addAnnotation(ann);
|
635
635
|
}
|
636
636
|
|
@@ -36,6 +36,8 @@
|
|
36
36
|
#include "common/RhoFile.h"
|
37
37
|
#include "net/INetRequest.h"
|
38
38
|
|
39
|
+
#include "ruby/ext/rho/rhoruby.h"
|
40
|
+
|
39
41
|
|
40
42
|
#undef DEFAULT_LOGCATEGORY
|
41
43
|
#define DEFAULT_LOGCATEGORY "GeocodingMapEngine"
|
@@ -53,7 +55,8 @@ String GoogleGeoCoding::Command::toString()
|
|
53
55
|
{
|
54
56
|
return address;
|
55
57
|
}
|
56
|
-
|
58
|
+
|
59
|
+
|
57
60
|
IMPLEMENT_LOGCLASS(GoogleGeoCoding,"GGeoCoding");
|
58
61
|
GoogleGeoCoding::GoogleGeoCoding()
|
59
62
|
{
|
@@ -96,8 +99,12 @@ void GoogleGeoCoding::resolve(String const &address, GeoCodingCallback *cb)
|
|
96
99
|
RHO_MAP_TRACE1("GoogleGeoCoding: resolve address=%s", address.c_str());
|
97
100
|
addQueueCommand(new Command(address, cb));
|
98
101
|
}
|
102
|
+
|
103
|
+
void GoogleGeoCoding::resolve(float latitude, float longitude, GeoCodingCallback *cb) {
|
104
|
+
addQueueCommand(new Command(latitude, longitude, cb));
|
105
|
+
}
|
99
106
|
|
100
|
-
static bool parse_json(const char *data, double *plat, double *plon)
|
107
|
+
static bool parse_json(const char *data, double *plat, double *plon, String* adress, bool* coord_ok, bool* adress_ok)
|
101
108
|
{
|
102
109
|
RHO_MAP_TRACE1("parse_json: data=%s", data);
|
103
110
|
json::CJSONEntry json(data);
|
@@ -105,17 +112,43 @@ static bool parse_json(const char *data, double *plat, double *plon)
|
|
105
112
|
RHO_MAP_TRACE1("parse_json: status=%s", status);
|
106
113
|
if (strcasecmp(status, "OK") != 0)
|
107
114
|
return false;
|
115
|
+
bool params_founded = false;
|
116
|
+
if (adress_ok != NULL) {
|
117
|
+
*adress_ok = false;
|
118
|
+
}
|
119
|
+
if (coord_ok != NULL) {
|
120
|
+
*coord_ok = false;
|
121
|
+
}
|
108
122
|
for (json::CJSONArrayIterator results = json.getEntry("results"); !results.isEnd(); results.next())
|
109
123
|
{
|
110
124
|
json::CJSONEntry item = results.getCurItem();
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
125
|
+
|
126
|
+
|
127
|
+
if (item.hasName("formatted_address")) {
|
128
|
+
json::CJSONEntry formatted_address = item.getEntry("formatted_address");
|
129
|
+
if (adress != NULL) {
|
130
|
+
*adress = formatted_address.getString();
|
131
|
+
}
|
132
|
+
params_founded = true;
|
133
|
+
if (adress_ok != NULL) {
|
134
|
+
*adress_ok = true;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
if (item.hasName("geometry")) {
|
139
|
+
json::CJSONEntry geometry = item.getEntry("geometry");
|
140
|
+
json::CJSONEntry location = geometry.getEntry("location");
|
141
|
+
*plat = location.getDouble("lat");
|
142
|
+
*plon = location.getDouble("lng");
|
143
|
+
params_founded = true;
|
144
|
+
if (coord_ok != NULL) {
|
145
|
+
*coord_ok = true;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
if (params_founded) {
|
150
|
+
return true;
|
151
|
+
}
|
119
152
|
}
|
120
153
|
|
121
154
|
return false;
|
@@ -126,8 +159,19 @@ void GoogleGeoCoding::processCommand(IQueueCommand *pCmd)
|
|
126
159
|
Command *cmd = (Command*)pCmd;
|
127
160
|
GeoCodingCallback &cb = *(cmd->callback);
|
128
161
|
|
129
|
-
String url = "http://maps.googleapis.com/maps/api/geocode/json?
|
130
|
-
|
162
|
+
String url = "http://maps.googleapis.com/maps/api/geocode/json?";
|
163
|
+
|
164
|
+
if (cmd->is_inverse) {
|
165
|
+
char* buf = new char[2048];
|
166
|
+
url += "latlng=";
|
167
|
+
sprintf(buf, "%f,%f", (float)cmd->latitude, (float)cmd->longitude);
|
168
|
+
url += buf;
|
169
|
+
delete buf;
|
170
|
+
}
|
171
|
+
else {
|
172
|
+
url += "address=";
|
173
|
+
url += net::URI::urlEncode(cmd->address);
|
174
|
+
}
|
131
175
|
url += "&sensor=false";
|
132
176
|
|
133
177
|
RHO_MAP_TRACE1("GoogleGeoCoding: processCommand: url=%s", url.c_str());
|
@@ -143,10 +187,28 @@ void GoogleGeoCoding::processCommand(IQueueCommand *pCmd)
|
|
143
187
|
RHO_MAP_TRACE("GoogleGeoCoding: processCommand: Parse received json...");
|
144
188
|
|
145
189
|
double latitude, longitude;
|
146
|
-
|
190
|
+
String cadress;
|
191
|
+
bool adress_ok = false;
|
192
|
+
bool coordinates_ok = false;
|
193
|
+
|
194
|
+
if (parse_json((const char *)data, &latitude, &longitude, &cadress, &coordinates_ok, &adress_ok))
|
147
195
|
{
|
148
196
|
RHO_MAP_TRACE("GoogleGeoCoding: processCommand: json parsed successfully");
|
149
|
-
|
197
|
+
if (cmd->is_inverse && adress_ok) {
|
198
|
+
cb.onSuccess(latitude, longitude, cadress.c_str());
|
199
|
+
}
|
200
|
+
else if (coordinates_ok) {
|
201
|
+
if (adress_ok) {
|
202
|
+
cb.onSuccess(latitude, longitude, cadress.c_str());
|
203
|
+
}
|
204
|
+
else {
|
205
|
+
cb.onSuccess(latitude, longitude, NULL);
|
206
|
+
}
|
207
|
+
}
|
208
|
+
else {
|
209
|
+
RHO_MAP_TRACE("GoogleGeoCoding: processCommand: can't found response in json");
|
210
|
+
cb.onError("Can not found response in JSON");
|
211
|
+
}
|
150
212
|
}
|
151
213
|
else
|
152
214
|
{
|
@@ -198,3 +260,132 @@ void GoogleGeoCoding::processCommand(IQueueCommand *pCmd)
|
|
198
260
|
} // namespace common
|
199
261
|
} // namespace rho
|
200
262
|
|
263
|
+
|
264
|
+
static rho::common::map::GoogleGeoCoding* ourGeocode = NULL;
|
265
|
+
|
266
|
+
static rho::common::map::GoogleGeoCoding* getGeocodeSignletone() {
|
267
|
+
if (ourGeocode == NULL) {
|
268
|
+
ourGeocode = new rho::common::map::GoogleGeoCoding();
|
269
|
+
}
|
270
|
+
return ourGeocode;
|
271
|
+
}
|
272
|
+
|
273
|
+
class RhoGoogleGeocodeCallbackImpl : public rho::common::map::GeoCodingCallback {
|
274
|
+
public:
|
275
|
+
RhoGoogleGeocodeCallbackImpl(rho::String adress, rho::String callback, int tag) {
|
276
|
+
mAdress = adress;
|
277
|
+
mCallback = callback;
|
278
|
+
mTag = tag;
|
279
|
+
}
|
280
|
+
|
281
|
+
virtual ~RhoGoogleGeocodeCallbackImpl() {
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
virtual void onError(rho::String const &description) {
|
286
|
+
char* buf = new char[2048];
|
287
|
+
|
288
|
+
if (buf == NULL) {
|
289
|
+
RAWLOG_ERROR("can not allocate temporary char buffer in GeoLocation callback");
|
290
|
+
return;
|
291
|
+
}
|
292
|
+
|
293
|
+
sprintf(buf,"&rho_callback=1&status=error&description=%s", description.c_str());
|
294
|
+
|
295
|
+
char* norm_url = rho_http_normalizeurl(mCallback.c_str());
|
296
|
+
rho_net_request_with_data(norm_url, buf);
|
297
|
+
rho_http_free(norm_url);
|
298
|
+
|
299
|
+
delete buf;
|
300
|
+
//delete this;
|
301
|
+
}
|
302
|
+
|
303
|
+
virtual void onSuccess(double latitude, double longitude, const char* adress) {
|
304
|
+
char* buf = new char[2048];
|
305
|
+
|
306
|
+
if (buf == NULL) {
|
307
|
+
RAWLOG_ERROR("can not allocate temporary char buffer in GeoLocation callback");
|
308
|
+
return;
|
309
|
+
}
|
310
|
+
|
311
|
+
if (adress != NULL) {
|
312
|
+
rho::String coded_adr = adress;
|
313
|
+
coded_adr = rho::net::URI::urlEncode(coded_adr);
|
314
|
+
sprintf(buf,"&rho_callback=1&status=ok&tag=%d&latitude=%f&longitude=%f&adress=%s", mTag, (float)latitude, (float)longitude, coded_adr.c_str());
|
315
|
+
}
|
316
|
+
else {
|
317
|
+
sprintf(buf,"&rho_callback=1&status=ok&tag=%d&latitude=%f&longitude=%f", mTag, (float)latitude, (float)longitude);
|
318
|
+
}
|
319
|
+
|
320
|
+
|
321
|
+
char* norm_url = rho_http_normalizeurl(mCallback.c_str());
|
322
|
+
rho_net_request_with_data(norm_url, buf);
|
323
|
+
rho_http_free(norm_url);
|
324
|
+
|
325
|
+
delete buf;
|
326
|
+
//delete this;
|
327
|
+
}
|
328
|
+
|
329
|
+
|
330
|
+
private:
|
331
|
+
rho::String mAdress;
|
332
|
+
rho::String mCallback;
|
333
|
+
int mTag;
|
334
|
+
};
|
335
|
+
|
336
|
+
|
337
|
+
void rho_geoimpl_do_geocoding(rho_param* p, const char* callback, int callback_tag) {
|
338
|
+
|
339
|
+
const char* c_adress = NULL;
|
340
|
+
bool adress_setted = false;
|
341
|
+
|
342
|
+
float longitude = 0;
|
343
|
+
float latitude = 0;
|
344
|
+
bool longitude_setted = false;
|
345
|
+
bool latitude_setted = false;
|
346
|
+
|
347
|
+
switch (p->type) {
|
348
|
+
case RHO_PARAM_HASH: {
|
349
|
+
for (int i = 0, lim = p->v.hash->size; i < lim; ++i) {
|
350
|
+
const char *name = p->v.hash->name[i];
|
351
|
+
rho_param *value = p->v.hash->value[i];
|
352
|
+
|
353
|
+
if (strcasecmp(name, "adress") == 0) {
|
354
|
+
c_adress = value->v.string;
|
355
|
+
adress_setted = true;
|
356
|
+
}
|
357
|
+
if (strcasecmp(name, "latitude") == 0) {
|
358
|
+
latitude = strtod(value->v.string, NULL);
|
359
|
+
latitude_setted = true;
|
360
|
+
}
|
361
|
+
if (strcasecmp(name, "longitude") == 0) {
|
362
|
+
longitude_setted = true;
|
363
|
+
longitude = strtod(value->v.string, NULL);
|
364
|
+
}
|
365
|
+
}
|
366
|
+
}
|
367
|
+
break;
|
368
|
+
default: {
|
369
|
+
RAWLOG_ERROR("Unexpected parameter type for do_geocoding, should be Hash");
|
370
|
+
return;
|
371
|
+
}
|
372
|
+
}
|
373
|
+
if ((c_adress == NULL) && (!latitude_setted && !longitude_setted)) {
|
374
|
+
RAWLOG_ERROR("Unexpected parameter type for do_geocoding, should be Hash with 'adress' or 'latitude' + 'longitude' parameters");
|
375
|
+
return;
|
376
|
+
}
|
377
|
+
|
378
|
+
if (adress_setted) {
|
379
|
+
rho::String adress = c_adress;
|
380
|
+
|
381
|
+
getGeocodeSignletone()->resolve(adress, new RhoGoogleGeocodeCallbackImpl(adress, callback, callback_tag));\
|
382
|
+
}
|
383
|
+
else if (latitude_setted && longitude_setted) {
|
384
|
+
getGeocodeSignletone()->resolve(latitude, longitude, new RhoGoogleGeocodeCallbackImpl("", callback, callback_tag));
|
385
|
+
}
|
386
|
+
else {
|
387
|
+
RAWLOG_ERROR("Ivalid parameters type for do_geocoding, should be Hash with 'adress' or 'latitude' + 'longitude' parameters");
|
388
|
+
}
|
389
|
+
}
|
390
|
+
|
391
|
+
|