rhodes 2.2.4.beta.1 → 2.2.5.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 +119 -3
- data/lib/build/jake.rb +15 -1
- data/lib/framework/dateME.rb +6 -1
- data/lib/framework/rho/render.rb +18 -15
- data/lib/framework/rho/rho.rb +105 -43
- data/lib/framework/rho/rhoapplication.rb +1 -1
- data/lib/framework/rho/rhocontact.rb +41 -13
- data/lib/framework/rho/rhocontroller.rb +10 -1
- data/lib/framework/rho/rhoevent_c.rb +6 -1
- data/lib/framework/rho/rhosupport.rb +1 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rholang/rhomsg_de.rb +1 -1
- data/lib/framework/rholang/rhomsg_es.rb +1 -1
- data/lib/framework/rholang/rhomsg_it.rb +28 -0
- data/lib/framework/rhom/rhom.rb +6 -0
- data/lib/framework/rhom/rhom_model.rb +14 -7
- data/lib/framework/rhom/rhom_object_factory.rb +121 -56
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.full.xml +62 -0
- data/platform/android/Rhodes/AndroidManifest.xml +3 -34
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +17 -2
- data/platform/android/Rhodes/jni/src/alert.cpp +16 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +27 -3
- data/platform/android/Rhodes/jni/src/nativebar.cpp +3 -0
- data/platform/android/Rhodes/jni/src/nativeview.cpp +131 -1
- data/platform/android/Rhodes/jni/src/phonebook.cpp +102 -41
- data/platform/android/Rhodes/jni/src/rhodes.cpp +113 -32
- data/platform/android/Rhodes/jni/src/ringtones.cpp +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +9 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +184 -49
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +49 -25
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +104 -57
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +36 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +24 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +7 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +185 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +54 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +107 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +72 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +22 -21
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +91 -11
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +10 -0
- data/platform/android/build/android.rake +50 -9
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +3 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/SchemaManager.java +3 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +7 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +2 -2
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +22 -0
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +51 -4
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +21 -10
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +82 -33
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +59 -6
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyFloat_Methods.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +19 -7
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/ArrayPacker.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFloat.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +55 -11
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +18 -2
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +8 -5
- data/platform/bb/RubyVM/src/j2me/lang/CharacterMe.java +1 -1
- data/platform/bb/RubyVM/src/j2me/util/StringParser.java +2 -0
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +21 -2
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +3 -3
- data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +1 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -2
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +15 -16
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +4 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +58 -0
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +90 -4
- data/platform/iphone/Classes/AppManager/AppManager.m +43 -5
- data/platform/iphone/Classes/Event/Event.h +2 -0
- data/platform/iphone/Classes/Event/Event.m +12 -1
- data/platform/iphone/Classes/GeoLocation/LocationController.m +9 -3
- data/platform/iphone/Classes/MapView/MapViewController.m +20 -9
- data/platform/iphone/Classes/NativeBar.m +27 -0
- data/platform/iphone/Classes/Phonebook/phonebook.m +17 -0
- data/platform/iphone/Classes/RhoAlert.m +61 -1
- data/platform/iphone/Classes/RhoMainView.h +1 -0
- data/platform/iphone/Classes/Rhodes.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +108 -1
- data/platform/iphone/Classes/SimpleMainView.h +4 -0
- data/platform/iphone/Classes/SimpleMainView.m +30 -3
- data/platform/iphone/Classes/SplashViewController.m +3 -1
- data/platform/iphone/Classes/TabbedMainView.h +2 -0
- data/platform/iphone/Classes/TabbedMainView.m +63 -11
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +26 -0
- data/platform/iphone/Info.plist +12 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +8 -0
- data/platform/iphone/rbuild/iphone.rake +181 -25
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +5 -5
- data/platform/shared/common/IRhoThreadImpl.h +1 -1
- data/platform/shared/common/PosixThreadImpl.cpp +5 -3
- data/platform/shared/common/PosixThreadImpl.h +1 -1
- data/platform/shared/common/RhoFilePath.h +11 -0
- data/platform/shared/common/RhoNativeViewManager.h +17 -0
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhodesApp.cpp +29 -8
- data/platform/shared/common/ThreadQueue.cpp +5 -3
- data/platform/shared/common/ThreadQueue.h +2 -1
- data/platform/shared/common/app_build_configs.c +25 -0
- data/platform/shared/common/app_build_configs.h +11 -0
- data/platform/shared/net/AsyncHttp.cpp +5 -5
- data/platform/shared/net/CURLNetRequest.cpp +25 -7
- data/platform/shared/net/CURLNetRequest.h +2 -1
- data/platform/shared/net/HttpServer.cpp +28 -0
- data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +26 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +6 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
- data/platform/shared/ruby/ext/rho/rhosupport.c +15 -2
- data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -2
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +97 -2
- data/platform/shared/ruby/ext/system/system.i +13 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +104 -1
- data/platform/shared/rubyext/RhoAppAdapter.cpp +7 -0
- data/platform/shared/sync/SyncEngine.cpp +43 -3
- data/platform/shared/sync/SyncEngine.h +13 -0
- data/platform/shared/sync/SyncNotify.cpp +41 -23
- data/platform/shared/sync/SyncNotify.h +18 -4
- data/platform/shared/sync/SyncSource.cpp +52 -14
- data/platform/shared/sync/SyncSource.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +29 -9
- data/platform/shared/sync/SyncThread.h +4 -2
- data/platform/wm/RhoLib/RhoLib.vcproj +8 -0
- data/platform/wm/build/build_inf.js +15 -9
- data/platform/wm/build/wm.rake +10 -5
- data/platform/wm/rhodes/Alert.cpp +10 -0
- data/platform/wm/rhodes/Alert.h +3 -3
- data/platform/wm/rhodes/MainWindow.cpp +171 -26
- data/platform/wm/rhodes/MainWindow.h +23 -1
- data/platform/wm/rhodes/MetaHandler.cpp +192 -0
- data/platform/wm/rhodes/MetaHandler.h +31 -0
- data/platform/wm/rhodes/RhoNativeViewManager.cpp +126 -0
- data/platform/wm/rhodes/RhoNativeViewManagerWM.h +20 -0
- data/platform/wm/rhodes/Rhodes.cpp +91 -2
- data/platform/wm/rhodes/Rhodes.rc +15 -6
- data/platform/wm/rhodes/SyncStatusDlg.cpp +32 -0
- data/platform/wm/rhodes/SyncStatusDlg.h +29 -0
- data/platform/wm/rhodes/resource.h +5 -2
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +3 -1
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +146 -14
- data/platform/wm/rhodes/rhodes.vcproj +28 -0
- data/rakefile.rb +119 -3
- data/res/build-tools/iphonesim/README +58 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.h +43 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +224 -0
- data/res/build-tools/iphonesim/Source/main.m +52 -0
- data/res/build-tools/iphonesim/Source/nsprintf.h +3 -0
- data/res/build-tools/iphonesim/Source/nsprintf.m +42 -0
- data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
- data/res/build-tools/iphonesim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h +124 -0
- data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +261 -0
- data/res/build-tools/iphonesim/iphonesim_Prefix.pch +7 -0
- data/res/generators/rhogen.rb +5 -0
- data/res/generators/templates/application/app/layout.erb +7 -13
- data/res/generators/templates/application/app/loading.png +0 -0
- data/res/generators/templates/application/build.yml +3 -0
- data/res/generators/templates/application/icon/icon114.png +0 -0
- data/res/generators/templates/application/icon/icon57.png +0 -0
- data/res/generators/templates/application/icon/icon72.png +0 -0
- data/res/generators/templates/application/public/css/iphone.css +96 -0
- data/res/generators/templates/application/public/images/backButton.png +0 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +2 -1
- data/res/generators/templates/application/rhoconfig.txt +2 -0
- data/rhodes.gemspec +1 -1
- data/spec/phone_spec/app/spec/array_pack_spec.rb +108 -0
- data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
- data/spec/phone_spec/app/spec/date_spec.rb +27 -0
- data/spec/phone_spec/app/spec/fixtures/classes.rb +91 -0
- data/spec/phone_spec/app/spec/lstrip_spec.rb +57 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +50 -19
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +78 -0
- data/spec/phone_spec/app/spec/rstrip_spec.rb +51 -0
- data/spec/phone_spec/app/spec/strip_spec.rb +50 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +46 -3
- data/spec/phone_spec/app/spec_runner.rb +6 -0
- metadata +34 -4
@@ -311,7 +311,7 @@ public class SyncThread extends RhoThread
|
|
311
311
|
{
|
312
312
|
boolean bShowStatus = oSyncCmd.m_bShowStatus && !this.isNoThreadedMode();
|
313
313
|
m_oSyncEngine.getNotify().enableReporting(bShowStatus);
|
314
|
-
if (
|
314
|
+
if (m_oSyncEngine.getNotify().isReportingEnabled())
|
315
315
|
m_statusListener.createStatusPopup(RhoAppAdapter.getMessageText("syncronizing_data"));
|
316
316
|
}
|
317
317
|
|
@@ -365,8 +365,8 @@ public class SyncThread extends RhoThread
|
|
365
365
|
public void setPollInterval(int nInterval)
|
366
366
|
{
|
367
367
|
m_nPollInterval = nInterval;
|
368
|
-
if ( m_nPollInterval == 0 )
|
369
|
-
|
368
|
+
//if ( m_nPollInterval == 0 )
|
369
|
+
// m_oSyncEngine.stopSync();
|
370
370
|
|
371
371
|
addSyncCommand(new SyncCommand(scChangePollInterval, false));
|
372
372
|
}
|
@@ -391,6 +391,8 @@ public class SyncThread extends RhoThread
|
|
391
391
|
|
392
392
|
public static void stopSync()throws Exception
|
393
393
|
{
|
394
|
+
LOG.INFO("STOP sync");
|
395
|
+
|
394
396
|
if ( getSyncEngine().isSyncing() )
|
395
397
|
{
|
396
398
|
getSyncEngine().stopSyncByUser();
|
@@ -634,17 +636,33 @@ public class SyncThread extends RhoThread
|
|
634
636
|
new RubyOneArgMethod() {
|
635
637
|
protected RubyValue run(RubyValue receiver, RubyValue arg1, RubyBlock block) {
|
636
638
|
try{
|
639
|
+
int nOldInterval = getInstance().getPollInterval();
|
637
640
|
int nInterval = arg1.toInt();
|
638
641
|
getInstance().setPollInterval(nInterval);
|
642
|
+
|
643
|
+
|
644
|
+
return ObjectFactory.createInteger(nOldInterval);
|
639
645
|
}catch(Exception e)
|
640
646
|
{
|
641
647
|
LOG.ERROR("set_pollinterval failed", e);
|
642
648
|
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
643
649
|
}
|
644
|
-
|
645
|
-
return RubyConstant.QNIL;
|
646
650
|
}
|
647
651
|
});
|
652
|
+
klass.getSingletonClass().defineMethod("get_pollinterval",
|
653
|
+
new RubyNoArgMethod() {
|
654
|
+
protected RubyValue run(RubyValue receiver, RubyBlock block) {
|
655
|
+
try{
|
656
|
+
int nOldInterval = getInstance().getPollInterval();
|
657
|
+
return ObjectFactory.createInteger(nOldInterval);
|
658
|
+
}catch(Exception e)
|
659
|
+
{
|
660
|
+
LOG.ERROR("set_pollinterval failed", e);
|
661
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
662
|
+
}
|
663
|
+
}
|
664
|
+
});
|
665
|
+
|
648
666
|
klass.getSingletonClass().defineMethod("set_syncserver",
|
649
667
|
new RubyOneArgMethod() {
|
650
668
|
protected RubyValue run(RubyValue receiver, RubyValue arg1, RubyBlock block) {
|
@@ -810,13 +828,48 @@ public class SyncThread extends RhoThread
|
|
810
828
|
getSyncEngine().setNonThreadedMode(!bThreadMode);
|
811
829
|
}catch(Exception e)
|
812
830
|
{
|
813
|
-
LOG.ERROR("
|
831
|
+
LOG.ERROR("set_threaded_mode failed", e);
|
832
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
833
|
+
}
|
834
|
+
|
835
|
+
return RubyConstant.QNIL;
|
836
|
+
}
|
837
|
+
});
|
838
|
+
|
839
|
+
klass.getSingletonClass().defineMethod("enable_status_popup",
|
840
|
+
new RubyOneArgMethod() {
|
841
|
+
protected RubyValue run(RubyValue receiver, RubyValue arg1, RubyBlock block) {
|
842
|
+
try{
|
843
|
+
boolean bEnable = arg1 == RubyConstant.QTRUE;
|
844
|
+
getSyncEngine().getNotify().enableStatusPopup(bEnable);
|
845
|
+
}catch(Exception e)
|
846
|
+
{
|
847
|
+
LOG.ERROR("enable_status_popup failed", e);
|
814
848
|
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
815
849
|
}
|
816
850
|
|
817
851
|
return RubyConstant.QNIL;
|
818
852
|
}
|
819
853
|
});
|
854
|
+
|
855
|
+
klass.getSingletonClass().defineMethod("set_source_property",
|
856
|
+
new RubyVarArgMethod() {
|
857
|
+
protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block) {
|
858
|
+
try{
|
859
|
+
Integer nSrcID = new Integer(args.get(0).toInt());
|
860
|
+
String strPropName = args.get(1).toStr();
|
861
|
+
String strPropValue = args.get(2).toStr();
|
862
|
+
|
863
|
+
SyncEngine.getSourceOptions().setProperty(nSrcID, strPropName, strPropValue);
|
864
|
+
|
865
|
+
return RubyConstant.QNIL;
|
866
|
+
}catch(Exception e)
|
867
|
+
{
|
868
|
+
LOG.ERROR("set_source_property failed", e);
|
869
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
870
|
+
}
|
871
|
+
}
|
872
|
+
});
|
820
873
|
|
821
874
|
}
|
822
875
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
package com.xruby.GeneratedMethods;
|
2
2
|
import com.xruby.runtime.lang.*;
|
3
|
+
import com.xruby.runtime.builtin.RubyBignum;
|
3
4
|
import com.xruby.runtime.builtin.RubyFixnum;
|
4
5
|
import com.xruby.runtime.builtin.RubyFloat;
|
5
6
|
public class RubyFloat_Methods{
|
@@ -77,5 +78,9 @@ klass.defineMethod( "**", new RubyOneArgMethod(){
|
|
77
78
|
protected RubyValue run(RubyValue receiver, RubyValue arg, RubyBlock block ){
|
78
79
|
return ((RubyFloat)receiver).pow(arg);}
|
79
80
|
});
|
81
|
+
klass.defineMethod( "to_f", new RubyNoArgMethod(){
|
82
|
+
protected RubyValue run(RubyValue receiver, RubyBlock block ){
|
83
|
+
return ((RubyFloat)receiver).to_f();}
|
84
|
+
});
|
80
85
|
|
81
86
|
}}
|
@@ -76,10 +76,6 @@ klass.defineMethod( "capitalize", new RubyNoArgMethod(){
|
|
76
76
|
protected RubyValue run(RubyValue receiver, RubyBlock block ){
|
77
77
|
return ((RubyString)receiver).capitalize();}
|
78
78
|
});
|
79
|
-
klass.defineMethod( "strip", new RubyNoArgMethod(){
|
80
|
-
protected RubyValue run(RubyValue receiver, RubyBlock block ){
|
81
|
-
return ((RubyString)receiver).strip();}
|
82
|
-
});
|
83
79
|
klass.defineMethod( "upcase", new RubyNoArgMethod(){
|
84
80
|
protected RubyValue run(RubyValue receiver, RubyBlock block ){
|
85
81
|
return ((RubyString)receiver).upcase();}
|
@@ -218,18 +214,34 @@ klass.defineMethod( "concat", new RubyOneArgMethod(){
|
|
218
214
|
return ((RubyString)receiver).concat(arg);}
|
219
215
|
});
|
220
216
|
klass.aliasMethod("<<","concat");
|
217
|
+
klass.defineMethod( "squeeze!", new RubyVarArgMethod(){
|
218
|
+
protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block ){
|
219
|
+
return ((RubyString)receiver).squeeze_danger(args);}
|
220
|
+
});
|
221
221
|
klass.defineMethod( "strip!", new RubyNoArgMethod(){
|
222
222
|
protected RubyValue run(RubyValue receiver, RubyBlock block ){
|
223
223
|
return ((RubyString)receiver).stripBang();}
|
224
224
|
});
|
225
|
-
klass.defineMethod( "
|
226
|
-
protected RubyValue run(RubyValue receiver,
|
227
|
-
return ((RubyString)receiver).
|
225
|
+
klass.defineMethod( "strip", new RubyNoArgMethod(){
|
226
|
+
protected RubyValue run(RubyValue receiver, RubyBlock block ){
|
227
|
+
return ((RubyString)receiver).strip();}
|
228
228
|
});
|
229
229
|
klass.defineMethod( "lstrip!", new RubyNoArgMethod(){
|
230
230
|
protected RubyValue run(RubyValue receiver, RubyBlock block ){
|
231
231
|
return ((RubyString)receiver).lstripBang();}
|
232
232
|
});
|
233
|
+
klass.defineMethod( "lstrip", new RubyNoArgMethod(){
|
234
|
+
protected RubyValue run(RubyValue receiver, RubyBlock block ){
|
235
|
+
return ((RubyString)receiver).lstrip();}
|
236
|
+
});
|
237
|
+
klass.defineMethod( "rstrip!", new RubyNoArgMethod(){
|
238
|
+
protected RubyValue run(RubyValue receiver, RubyBlock block ){
|
239
|
+
return ((RubyString)receiver).rstripBang();}
|
240
|
+
});
|
241
|
+
klass.defineMethod( "rstrip", new RubyNoArgMethod(){
|
242
|
+
protected RubyValue run(RubyValue receiver, RubyBlock block ){
|
243
|
+
return ((RubyString)receiver).rstrip();}
|
244
|
+
});
|
233
245
|
klass.defineMethod( "chomp!", new RubyVarArgMethod(){
|
234
246
|
protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block ){
|
235
247
|
return ((RubyString)receiver).chomp_danger(args);}
|
@@ -91,6 +91,11 @@ public class RubyFloat extends RubyNumeric {
|
|
91
91
|
return ObjectFactory.createFixnum((long)this.value_);
|
92
92
|
}
|
93
93
|
|
94
|
+
////@RubyLevelMethod(name="to_f")
|
95
|
+
public RubyFloat to_f() {
|
96
|
+
return this;
|
97
|
+
}
|
98
|
+
|
94
99
|
//@RubyLevelMethod(name="coerce")
|
95
100
|
public RubyArray coerce(RubyValue v) {
|
96
101
|
return new RubyArray(v.toRubyFloat(), this);
|
@@ -448,6 +448,27 @@ public class RubyString extends RubyBasic {
|
|
448
448
|
return ObjectFactory.createString(sb_.toString().trim());
|
449
449
|
}
|
450
450
|
|
451
|
+
//@RubyLevelMethod(name="strip!")
|
452
|
+
public RubyValue stripBang() {
|
453
|
+
String str = this.sb_.toString();
|
454
|
+
int orgSize = str.length();
|
455
|
+
str = str.trim();
|
456
|
+
this.sb_ = new StringBuffer(str);
|
457
|
+
if (str.length() == orgSize) {
|
458
|
+
return RubyConstant.QNIL;
|
459
|
+
}
|
460
|
+
|
461
|
+
return this;
|
462
|
+
}
|
463
|
+
|
464
|
+
//@RubyLevelMethod(name="lstrip")
|
465
|
+
public RubyValue lstrip()
|
466
|
+
{
|
467
|
+
RubyString str = ObjectFactory.createString(sb_.toString());
|
468
|
+
str.lstripBang();
|
469
|
+
return str;
|
470
|
+
}
|
471
|
+
|
451
472
|
//@RubyLevelMethod(name="lstrip!")
|
452
473
|
public RubyValue lstripBang() {
|
453
474
|
int i = 0;
|
@@ -463,20 +484,31 @@ public class RubyString extends RubyBasic {
|
|
463
484
|
sb_.delete(0, i);
|
464
485
|
return this;
|
465
486
|
}
|
487
|
+
|
488
|
+
//@RubyLevelMethod(name="rstrip")
|
489
|
+
public RubyValue rstrip()
|
490
|
+
{
|
491
|
+
RubyString str = ObjectFactory.createString(sb_.toString());
|
492
|
+
str.rstripBang();
|
493
|
+
return str;
|
494
|
+
}
|
466
495
|
|
467
|
-
//@RubyLevelMethod(name="
|
468
|
-
public RubyValue
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
496
|
+
//@RubyLevelMethod(name="rstrip!")
|
497
|
+
public RubyValue rstripBang() {
|
498
|
+
int i = sb_.length()-1;
|
499
|
+
while (i >= 0 && CharacterMe.isWhitespace(sb_.charAt(i))) {
|
500
|
+
i--;
|
501
|
+
}
|
502
|
+
|
503
|
+
if (sb_.length()-1 == i) {
|
504
|
+
//No change
|
474
505
|
return RubyConstant.QNIL;
|
475
506
|
}
|
476
507
|
|
508
|
+
sb_.delete(i+1, sb_.length());
|
477
509
|
return this;
|
478
510
|
}
|
479
|
-
|
511
|
+
|
480
512
|
//@RubyLevelMethod(name="capitalize")
|
481
513
|
public RubyString capitalize() {
|
482
514
|
int length = this.sb_.length();
|
@@ -1109,13 +1141,25 @@ public class RubyString extends RubyBasic {
|
|
1109
1141
|
if ( !( bSkipFirstEmptyItem && 0 == i && (str == null || str.equals(""))) )
|
1110
1142
|
{
|
1111
1143
|
//To conform ruby's behavior, discard the first empty element
|
1112
|
-
if (str == null)
|
1113
|
-
|
1114
|
-
else
|
1144
|
+
//if (str == null)
|
1145
|
+
// a.add(RubyConstant.QNIL);
|
1146
|
+
//else
|
1115
1147
|
a.add(ObjectFactory.createString(str));
|
1116
1148
|
}
|
1117
1149
|
++i;
|
1118
1150
|
}
|
1151
|
+
|
1152
|
+
if ( nLimit == 0 )
|
1153
|
+
{
|
1154
|
+
for( i = a.size()-1; i >=0 ;i--)
|
1155
|
+
{
|
1156
|
+
if ( ((RubyString)a.get(i)).length()>0 )
|
1157
|
+
break;
|
1158
|
+
|
1159
|
+
a.delete_at(i);
|
1160
|
+
}
|
1161
|
+
}
|
1162
|
+
|
1119
1163
|
return a;
|
1120
1164
|
}
|
1121
1165
|
|
@@ -81,12 +81,28 @@ public class RubyTime extends RubyBasic {
|
|
81
81
|
return (long)((t1 - t2) * 1000000);
|
82
82
|
}
|
83
83
|
|
84
|
+
private String get2FixedDigit(int nDigit){
|
85
|
+
if ( nDigit > 9 )
|
86
|
+
return Integer.toString(nDigit);
|
87
|
+
|
88
|
+
return "0" + Integer.toString(nDigit);
|
89
|
+
}
|
90
|
+
|
84
91
|
public String toString() {
|
85
92
|
//SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US);
|
86
93
|
//sdf.setCalendar(date_);
|
87
94
|
//return sdf.format(date_.getTime()).replace("GMT", "UTC");
|
88
|
-
String strDate = date_.getTime().toString();
|
89
|
-
StringMe.replaceAll(strDate, "GMT", "UTC");
|
95
|
+
//String strDate = date_.getTime().toString();
|
96
|
+
//StringMe.replaceAll(strDate, "GMT", "UTC");
|
97
|
+
|
98
|
+
String strDate = date_.get(Calendar.YEAR) + "-" +
|
99
|
+
get2FixedDigit(date_.get(Calendar.MONTH)+1) + "-" +
|
100
|
+
get2FixedDigit(date_.get(Calendar.DATE)) + " " +
|
101
|
+
get2FixedDigit(date_.get(Calendar.HOUR_OF_DAY)) + ":" +
|
102
|
+
get2FixedDigit(date_.get(Calendar.MINUTE)) + ":" +
|
103
|
+
get2FixedDigit(date_.get(Calendar.SECOND)) + " " +
|
104
|
+
date_.getTimeZone().toString();
|
105
|
+
|
90
106
|
return strDate;
|
91
107
|
}
|
92
108
|
|
@@ -662,7 +662,7 @@ public class RubyKernelModule {
|
|
662
662
|
RubyClass klass = receiver.getRubyClass();
|
663
663
|
klass = (klass != null) ? klass.getRealClass() : null;
|
664
664
|
String msg = "undefined method '" + method_name.toString() + "' for " + klass.getName();
|
665
|
-
LOG.ERROR(msg);
|
665
|
+
//LOG.ERROR(msg);
|
666
666
|
throw new RubyException(RubyRuntime.NoMethodErrorClass,msg);
|
667
667
|
}
|
668
668
|
|
@@ -778,11 +778,14 @@ public class RubyKernelModule {
|
|
778
778
|
mode = val.toString();
|
779
779
|
}
|
780
780
|
|
781
|
-
|
782
|
-
io = ObjectFactory.createResourceFile(filename, mode);
|
783
|
-
}catch (java.lang.Error exc)
|
781
|
+
if ( mode.equalsIgnoreCase("r") )
|
784
782
|
{
|
785
|
-
|
783
|
+
try{
|
784
|
+
io = ObjectFactory.createResourceFile(filename, mode);
|
785
|
+
}catch (java.lang.Error exc)
|
786
|
+
{
|
787
|
+
LOG.TRACE("Cannot open file from jar: " + filename, exc);
|
788
|
+
}
|
786
789
|
}
|
787
790
|
|
788
791
|
if ( io == null )
|
@@ -42,6 +42,7 @@ platform/bb/RubyVM/src/com/rho/RhoParams.java
|
|
42
42
|
platform/bb/RubyVM/src/com/rho/RhoParamArray.java
|
43
43
|
platform/bb/RubyVM/src/com/rho/StringScanner.java
|
44
44
|
platform/bb/RubyVM/src/com/rho/Capabilities.java
|
45
|
+
platform/bb/RubyVM/src/com/rho/AppBuildConfig.java
|
45
46
|
platform/bb/RubyVM/src/com/rho/Extensions.java
|
46
47
|
platform/bb/RubyVM/src/com/rho/sync/JSONArrayIterator.java
|
47
48
|
platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
|
data/platform/bb/build/bb.rake
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require "fileutils"
|
3
3
|
|
4
4
|
def fixWin7SimBug (rhoconfig)
|
5
|
+
=begin
|
5
6
|
file = rhoconfig
|
6
7
|
tmpfile = file + ".tmp"
|
7
8
|
no_deviceside_postfix_isFound = 0
|
@@ -19,6 +20,7 @@ def fixWin7SimBug (rhoconfig)
|
|
19
20
|
end
|
20
21
|
end
|
21
22
|
FileUtils.move(tmpfile, file)
|
23
|
+
=end
|
22
24
|
end
|
23
25
|
|
24
26
|
|
@@ -149,7 +151,7 @@ namespace "config" do
|
|
149
151
|
#$rubypath = "res/build-tools/RhoRuby.exe" #path to RhoRuby
|
150
152
|
|
151
153
|
$bbver = $app_config["bbver"].to_s
|
152
|
-
|
154
|
+
$bb6 = true if $bbver == "6.0"
|
153
155
|
|
154
156
|
$builddir = $config["build"]["bbpath"] + "/build"
|
155
157
|
$bindir = $app_path + "/bin"
|
@@ -373,7 +375,21 @@ namespace "build" do
|
|
373
375
|
f.write "MIDlet-Name: rhodes\n"
|
374
376
|
f.write "MicroEdition-Profile: MIDP-2.0\n"
|
375
377
|
f.write "MIDlet-Jar-Size: 0\n"
|
376
|
-
|
378
|
+
|
379
|
+
if $service_enabled
|
380
|
+
if $hidden_app == "0"
|
381
|
+
f.write "RIM-MIDlet-Flags-1: 1\n"
|
382
|
+
else
|
383
|
+
f.write "RIM-MIDlet-Flags-1: 3\n"
|
384
|
+
end
|
385
|
+
else
|
386
|
+
if $hidden_app == "0"
|
387
|
+
f.write "RIM-MIDlet-Flags-1: 0\n"
|
388
|
+
else
|
389
|
+
f.write "RIM-MIDlet-Flags-1: 2\n"
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
377
393
|
f.close
|
378
394
|
|
379
395
|
end
|
@@ -674,6 +690,7 @@ namespace "package" do
|
|
674
690
|
$stdout.flush
|
675
691
|
|
676
692
|
create_alx_file('rhodesApp', $outfilebase)
|
693
|
+
|
677
694
|
else
|
678
695
|
puts 'rhodes .cod files are up to date'
|
679
696
|
$stdout.flush
|
@@ -787,6 +804,8 @@ namespace "package" do
|
|
787
804
|
exit 1
|
788
805
|
end
|
789
806
|
$stdout.flush
|
807
|
+
|
808
|
+
File.open(File.join($targetdir,"app_info.txt"), "w") { |f| f.write( $outfilebase ) }
|
790
809
|
|
791
810
|
create_alx_file('rhodesApp', $outfilebase)
|
792
811
|
end
|
@@ -6,15 +6,15 @@ import net.rim.device.api.ui.container.MainScreen;
|
|
6
6
|
|
7
7
|
public abstract class RhoMainScreen extends MainScreen {
|
8
8
|
|
9
|
-
protected abstract
|
9
|
+
protected abstract boolean onTouchUnclick();
|
10
10
|
|
11
11
|
protected boolean touchEvent(TouchEvent message) {
|
12
12
|
int nEvent = message.getEvent();
|
13
13
|
|
14
14
|
if ( nEvent == TouchEvent.UNCLICK )
|
15
15
|
{
|
16
|
-
onTouchUnclick()
|
17
|
-
|
16
|
+
if ( onTouchUnclick() )
|
17
|
+
return true;
|
18
18
|
}
|
19
19
|
|
20
20
|
return super.touchEvent(message);
|
@@ -160,8 +160,7 @@ public class RhoRubyHelper implements IRhoRubyHelper {
|
|
160
160
|
|
161
161
|
if ( codeModule != null )
|
162
162
|
{
|
163
|
-
String moduleName =
|
164
|
-
.currentApplicationDescriptor().getModuleName();
|
163
|
+
String moduleName = getModuleName();
|
165
164
|
|
166
165
|
for(int i = 0; i < codeModule.length; i++)
|
167
166
|
{
|
@@ -39,7 +39,7 @@ public class NetworkAccess implements INetworkAccess {
|
|
39
39
|
String strDeviceside = ";deviceside=true";
|
40
40
|
if ( com.rho.RhoConf.getInstance().getInt("no_deviceside_postfix") == 1 )
|
41
41
|
strDeviceside = "";
|
42
|
-
|
42
|
+
|
43
43
|
if (DeviceInfo.isSimulator())
|
44
44
|
{
|
45
45
|
URLsuffix = strDeviceside;
|
@@ -65,18 +65,16 @@ public class NetworkAccess implements INetworkAccess {
|
|
65
65
|
|
66
66
|
ServiceRecord[] srs = sb.getRecords();
|
67
67
|
// search for BIS-B transport
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
break;
|
79
|
-
}
|
68
|
+
for (int i = 0; i < srs.length; i++) {
|
69
|
+
if (srs[i].isDisabled() || !srs[i].isValid())
|
70
|
+
continue;
|
71
|
+
if (srs[i].getCid().equals("IPPP")
|
72
|
+
&& srs[i].getName().equals("IPPP for BIBS")) {
|
73
|
+
LOG.INFO("SRS: CID: " + srs[i].getCid() + " NAME: " + srs[i].getName());
|
74
|
+
|
75
|
+
URLsuffix = ";deviceside=false;ConnectionType=mds-public";
|
76
|
+
networkConfigured = true;
|
77
|
+
break;
|
80
78
|
}
|
81
79
|
}
|
82
80
|
|
@@ -134,7 +132,7 @@ public class NetworkAccess implements INetworkAccess {
|
|
134
132
|
return 0;
|
135
133
|
|
136
134
|
m_nMaxPacketSize = RhoConf.getInstance().getInt("bb_net_maxpacketsize_kb")*1024;
|
137
|
-
if ( (DeviceInfo.isSimulator()
|
135
|
+
if ( (/*DeviceInfo.isSimulator() ||*/ URLsuffix.indexOf(";deviceside=true") < 0) && m_nMaxPacketSize == 0 )
|
138
136
|
{
|
139
137
|
//avoid 403 error on BES/BIS
|
140
138
|
//http://supportforums.blackberry.com/t5/Java-Development/HTTP-Error-413-when-downloading-small-files/m-p/103918
|
@@ -205,8 +203,9 @@ public class NetworkAccess implements INetworkAccess {
|
|
205
203
|
|
206
204
|
String strMsg = ioe.getMessage();
|
207
205
|
boolean bTimeout = strMsg != null && (strMsg.indexOf("timed out") >= 0 || strMsg.indexOf("Timed out") >= 0);
|
206
|
+
boolean bDNS = strMsg != null && (strMsg.equalsIgnoreCase("Error trying to resolve") || strMsg.indexOf("DNS") >= 0);
|
208
207
|
|
209
|
-
if ( bTimeout || bThrowIOException )
|
208
|
+
if ( bTimeout || bDNS || bThrowIOException )
|
210
209
|
{
|
211
210
|
if (conn != null)
|
212
211
|
conn.close();
|
@@ -236,7 +235,7 @@ public class NetworkAccess implements INetworkAccess {
|
|
236
235
|
if ( conn == null )
|
237
236
|
{
|
238
237
|
conn = doConnect(strUrl + URLsuffix, false);
|
239
|
-
if ( conn == null )
|
238
|
+
if ( conn == null && URLsuffix != null && URLsuffix.length() > 0 )
|
240
239
|
conn = doConnect(strUrl, true);
|
241
240
|
}
|
242
241
|
|
@@ -72,6 +72,10 @@ public class RhoCalendar extends RubyBasic {
|
|
72
72
|
PIM.EVENT_LIST, PIM.READ_WRITE);
|
73
73
|
}
|
74
74
|
|
75
|
+
public static boolean has_calendar() {
|
76
|
+
return (PIM.getInstance() != null);
|
77
|
+
}
|
78
|
+
|
75
79
|
//@RubyAllocMethod
|
76
80
|
public static RhoCalendar alloc(RubyValue receiver)throws Exception
|
77
81
|
{
|
@@ -12,6 +12,10 @@ import com.rho.RhodesApp;
|
|
12
12
|
import com.xruby.runtime.builtin.ObjectFactory;
|
13
13
|
import com.xruby.runtime.lang.*;
|
14
14
|
import com.rho.RhoRubyHelper;
|
15
|
+
|
16
|
+
import net.rim.device.api.system.ApplicationDescriptor;
|
17
|
+
import net.rim.device.api.system.ApplicationManager;
|
18
|
+
import net.rim.device.api.system.CodeModuleManager;
|
15
19
|
import net.rim.device.api.system.DeviceInfo;
|
16
20
|
import net.rim.device.api.system.Backlight;
|
17
21
|
|
@@ -136,10 +140,62 @@ public class System {
|
|
136
140
|
}
|
137
141
|
});
|
138
142
|
|
143
|
+
klass.getSingletonClass().defineMethod( "app_installed?", new RubyOneArgMethod(){
|
144
|
+
protected RubyValue run(RubyValue receiver, RubyValue arg1, RubyBlock block )
|
145
|
+
{
|
146
|
+
try
|
147
|
+
{
|
148
|
+
String app_name = arg1.toStr();
|
149
|
+
int nHandle = CodeModuleManager.getModuleHandle(app_name);
|
150
|
+
|
151
|
+
return nHandle != 0 ? RubyConstant.QTRUE : RubyConstant.QFALSE;
|
152
|
+
} catch(Exception e) {
|
153
|
+
LOG.ERROR("run_app failed", e);
|
154
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
155
|
+
}
|
156
|
+
}
|
157
|
+
});
|
158
|
+
|
159
|
+
klass.getSingletonClass().defineMethod( "app_uninstall", new RubyOneArgMethod(){
|
160
|
+
protected RubyValue run(RubyValue receiver, RubyValue arg1, RubyBlock block )
|
161
|
+
{
|
162
|
+
try
|
163
|
+
{
|
164
|
+
String app_name = arg1.toStr();
|
165
|
+
int nHandle = CodeModuleManager.getModuleHandle(app_name);
|
166
|
+
if ( nHandle == 0 )
|
167
|
+
LOG.ERROR("Cannot find application: " + app_name);
|
168
|
+
else
|
169
|
+
{
|
170
|
+
int nCode = CodeModuleManager.deleteModuleEx(nHandle, true);
|
171
|
+
LOG.INFO("CodeModuleManager.deleteModuleEx return code: " + nCode);
|
172
|
+
|
173
|
+
if ( nCode == CodeModuleManager.CMM_OK_MODULE_MARKED_FOR_DELETION )
|
174
|
+
{
|
175
|
+
LOG.INFO("Device need to be restarted.");
|
176
|
+
CodeModuleManager.promptForResetIfRequired();
|
177
|
+
}
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
return RubyConstant.QNIL;
|
182
|
+
} catch(Exception e) {
|
183
|
+
LOG.ERROR("run_app failed", e);
|
184
|
+
throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
185
|
+
}
|
186
|
+
}
|
187
|
+
});
|
188
|
+
|
139
189
|
klass.getSingletonClass().defineMethod( "run_app", new RubyTwoArgMethod(){
|
140
190
|
protected RubyValue run(RubyValue receiver, RubyValue arg1, RubyValue arg2, RubyBlock block )
|
141
191
|
{
|
142
192
|
try {
|
193
|
+
String app_name = arg1.toStr();
|
194
|
+
ApplicationManager appMan = ApplicationManager.getApplicationManager();
|
195
|
+
String strParams = arg2 != null && arg2 != RubyConstant.QNIL ? arg2.toStr() : "";
|
196
|
+
|
197
|
+
appMan.launch(app_name + (strParams.length() > 0 ? "?" + strParams : "") );
|
198
|
+
|
143
199
|
return RubyConstant.QNIL;
|
144
200
|
} catch(Exception e) {
|
145
201
|
LOG.ERROR("run_app failed", e);
|
@@ -204,6 +260,8 @@ public class System {
|
|
204
260
|
return ObjectFactory.createInteger(0);
|
205
261
|
if ( strPropName.equalsIgnoreCase("is_emulator") )
|
206
262
|
return ObjectFactory.createBoolean(DeviceInfo.isSimulator());
|
263
|
+
if ( strPropName.equalsIgnoreCase("has_calendar") )
|
264
|
+
return ObjectFactory.createBoolean(RhoCalendar.has_calendar());
|
207
265
|
|
208
266
|
return RubyConstant.QNIL;
|
209
267
|
}
|