rhodes 2.2.3 → 2.2.4.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/CHANGELOG +13 -0
  2. data/Rakefile +1 -1
  3. data/bin/c2dm.rb +59 -0
  4. data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +4 -0
  5. data/lib/framework/rho/rho.rb +2 -0
  6. data/lib/framework/rho/rhoapplication.rb +1 -0
  7. data/lib/framework/rhodes.rb +1 -1
  8. data/lib/framework/version.rb +1 -1
  9. data/lib/rhodes.rb +1 -1
  10. data/platform/android/Rhodes/AndroidManifest.xml +1 -1
  11. data/platform/android/Rhodes/jni/src/callbacks.cpp +21 -0
  12. data/platform/android/Rhodes/jni/src/nativebar.cpp +4 -0
  13. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoActivity.java +3 -1
  14. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +68 -7
  15. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +113 -10
  16. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +34 -3
  17. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +21 -17
  18. data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +29 -5
  19. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +7 -0
  20. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java +37 -0
  21. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +0 -1
  22. data/platform/android/build/RhodesSRC_build.files +24 -23
  23. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -0
  24. data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +42 -20
  25. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +111 -19
  26. data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +2 -0
  27. data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +2 -1
  28. data/platform/bb/RubyVM/src/com/rho/net/URI.java +80 -0
  29. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +21 -1
  30. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +6 -1
  31. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +139 -46
  32. data/platform/bb/build/bb.rake +8 -3
  33. data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +32 -21
  34. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +31 -14
  35. data/platform/bb/rhodes/src/com/rho/file/Jsr75File.java +3 -2
  36. data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +3 -2
  37. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +28 -0
  38. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +111 -26
  39. data/platform/iphone/Classes/AppManager/AppManager.m +22 -0
  40. data/platform/iphone/Classes/DateTimePickerDelegate.m +3 -0
  41. data/platform/iphone/Classes/MapView/MapViewController.h +8 -3
  42. data/platform/iphone/Classes/MapView/MapViewController.m +63 -12
  43. data/platform/iphone/Classes/NativeBar.h +4 -3
  44. data/platform/iphone/Classes/NativeBar.m +28 -1
  45. data/platform/iphone/Classes/Rhodes.m +87 -20
  46. data/platform/iphone/Classes/Signature/SignatureView.m +16 -10
  47. data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -0
  48. data/platform/iphone/Classes/SimpleMainView.h +2 -0
  49. data/platform/iphone/Classes/SimpleMainView.m +120 -35
  50. data/platform/iphone/Classes/SplashViewController.h +8 -1
  51. data/platform/iphone/Classes/SplashViewController.m +233 -11
  52. data/platform/iphone/Classes/SplitView/LeftViewController.h +30 -0
  53. data/platform/iphone/Classes/SplitView/LeftViewController.m +189 -0
  54. data/platform/iphone/Classes/SplitView/RightViewController.h +54 -0
  55. data/platform/iphone/Classes/SplitView/RightViewController.m +268 -0
  56. data/platform/iphone/Classes/SplitView/SplitViewDelegate.h +22 -0
  57. data/platform/iphone/Classes/SplitView/SplitViewDelegate.m +92 -0
  58. data/platform/iphone/Classes/SplitView/SplittedMainView.h +65 -0
  59. data/platform/iphone/Classes/SplitView/SplittedMainView.m +304 -0
  60. data/platform/iphone/Classes/TabbedMainView.m +23 -6
  61. data/platform/iphone/Classes/WebView.m +1 -1
  62. data/platform/iphone/Info.plist +11 -2
  63. data/platform/iphone/rbuild/iphone.rake +80 -3
  64. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +50 -3
  65. data/platform/shared/common/RhoConf.cpp +5 -5
  66. data/platform/shared/db/DBAdapter.cpp +81 -3
  67. data/platform/shared/db/DBAdapter.h +1 -0
  68. data/platform/shared/json/JSONIterator.cpp +5 -0
  69. data/platform/shared/json/JSONIterator.h +1 -0
  70. data/platform/shared/net/CURLNetRequest.cpp +2 -2
  71. data/platform/shared/net/URI.cpp +53 -0
  72. data/platform/shared/net/URI.h +5 -1
  73. data/platform/shared/ruby/ext/system/system.i +9 -1
  74. data/platform/shared/ruby/ext/system/system_wrap.c +2632 -2574
  75. data/platform/shared/ruby/win32/win32.c +2 -0
  76. data/platform/shared/ruby/wince/direct.c +4 -0
  77. data/platform/shared/sync/SyncEngine.cpp +20 -1
  78. data/platform/shared/sync/SyncEngine.h +6 -1
  79. data/platform/shared/sync/SyncNotify.cpp +6 -1
  80. data/platform/shared/sync/SyncSource.cpp +130 -74
  81. data/platform/shared/sync/SyncSource.h +3 -1
  82. data/platform/wm/rhodes.sln +30 -22
  83. data/platform/wm/rhodes/Alert.cpp +4 -3
  84. data/platform/wm/rhodes/MainWindow.cpp +73 -20
  85. data/platform/wm/rhodes/RingtoneManager.cpp +4 -4
  86. data/platform/wm/rhodes/RingtoneManager.h +2 -1
  87. data/platform/wm/rhodes/Vibrate.cpp +1 -2
  88. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +37 -0
  89. data/platform/wm/rhodes/rhodes.vcproj +219 -5
  90. data/platform/wm/rhodes/stdafx.h +1 -0
  91. data/platform/wm/rubylib/rubylib.vcproj +10 -8
  92. data/platform/wm/sqlite3/sqlite3.vcproj +6 -4
  93. data/platform/wm/syncengine/syncengine.vcproj +7 -5
  94. data/platform/wm/tcmalloc/tcmalloc.vcproj +11 -8
  95. data/rakefile.rb +1 -1
  96. data/res/generators/templates/application/public/jqtouch/jqtouch.js +9 -1
  97. data/rhodes.gemspec +1 -1
  98. data/spec/phone_spec/app/spec/bulksync_spec.rb +71 -1
  99. metadata +17 -5
@@ -149,7 +149,7 @@ namespace "config" do
149
149
  #$rubypath = "res/build-tools/RhoRuby.exe" #path to RhoRuby
150
150
 
151
151
  $bbver = $app_config["bbver"].to_s
152
- $bb6 = true if $bbver == "6.0"
152
+ #$bb6 = true if $bbver == "6.0"
153
153
 
154
154
  $builddir = $config["build"]["bbpath"] + "/build"
155
155
  $bindir = $app_path + "/bin"
@@ -343,7 +343,12 @@ namespace "build" do
343
343
 
344
344
  namepath = File.join(sdcardpath,"name.txt")
345
345
  old_appname = File.read(namepath) if File.exists?(namepath)
346
- rm_rf sdcardpath if old_appname != $appname
346
+ if old_appname != $appname
347
+ rm_rf sdcardpath
348
+ #This is eclipse bag : it creates rho folder under simulator
349
+ rm_rf $config["env"]["paths"][$bbver]["jde"] +"/simulator/Rho/rhodes"
350
+ end
351
+
347
352
  mkdir_p sdcardpath unless File.exists?(sdcardpath)
348
353
 
349
354
  confpath = File.join( sdcardpath, "/apps/rhoconfig.txt" )
@@ -911,7 +916,7 @@ namespace "run" do
911
916
  startsim
912
917
  end
913
918
 
914
- task :spec => ["run:bb:stopmdsandsim", "package:bb:production_sim"] do
919
+ task :spec => ["run:bb:stopmdsandsim", "clean:bb", "package:bb:production_sim"] do
915
920
  jde = $config["env"]["paths"][$bbver]["jde"]
916
921
  cp_r File.join($targetdir,"/."), jde + "/simulator"
917
922
  rm_rf jde + "/simulator/sdcard/Rho"
@@ -198,28 +198,39 @@ public class RhodesApplicationPlatform extends UiApplication implements PushAppl
198
198
  {
199
199
  public void run()
200
200
  {
201
-
202
- m_PushMessageThread = new PushMessageThread();
203
- String strAppName = RhoConf.getInstance().getString("push_service_appname");
204
- String strUrl = RhoConf.getInstance().getString("push_service_url");
205
- int nPort = RhoConf.getInstance().getInt("push_service_port");
206
- byte btServiceType = RhoConf.getInstance().getString("push_service_type").equalsIgnoreCase("BPAS") ?
207
- PushApplicationDescriptor.SERVER_TYPE_BPAS : PushApplicationDescriptor.SERVER_TYPE_NONE;
208
-
209
- PushApplicationDescriptor pad = new PushApplicationDescriptor(
210
- strAppName, nPort, strUrl, btServiceType,
211
- ApplicationDescriptor.currentApplicationDescriptor());
212
-
213
- PushApplicationStatus status = PushApplicationRegistry.getStatus(pad);
214
-
215
- LOG.INFO("registerPushService status : " + status.toString());
216
-
217
- if (status.getStatus() != PushApplicationStatus.STATUS_ACTIVE && status.getStatus() != PushApplicationStatus.STATUS_PENDING)
201
+ try
202
+ {
203
+ m_PushMessageThread = new PushMessageThread();
204
+ String strAppName = RhoConf.getInstance().getString("push_service_appname");
205
+ String strUrl = RhoConf.getInstance().getString("push_service_url");
206
+ if ( strAppName != null && strAppName.length() > 0 && strUrl != null && strUrl.length() > 0 )
207
+ {
208
+ int nPort = RhoConf.getInstance().getInt("push_service_port");
209
+ byte btServiceType = RhoConf.getInstance().getString("push_service_type").equalsIgnoreCase("BPAS") ?
210
+ PushApplicationDescriptor.SERVER_TYPE_BPAS : PushApplicationDescriptor.SERVER_TYPE_NONE;
211
+
212
+ PushApplicationDescriptor pad = new PushApplicationDescriptor(
213
+ strAppName, nPort, strUrl, btServiceType,
214
+ ApplicationDescriptor.currentApplicationDescriptor());
215
+
216
+ PushApplicationStatus status = PushApplicationRegistry.getStatus(pad);
217
+
218
+ LOG.INFO("registerPushService status : " + status.toString());
219
+
220
+ if (status.getStatus() != PushApplicationStatus.STATUS_ACTIVE && status.getStatus() != PushApplicationStatus.STATUS_PENDING)
221
+ {
222
+
223
+ LOG.INFO("registerPushService registering push");
224
+
225
+ PushApplicationRegistry.registerApplication(pad);
226
+ }
227
+ }
228
+ }catch(Exception exc)
229
+ {
230
+ LOG.ERROR("registerPushService failed.", exc);
231
+ }catch(Throwable t)
218
232
  {
219
-
220
- LOG.INFO("registerPushService registering push");
221
-
222
- PushApplicationRegistry.registerApplication(pad);
233
+ LOG.ERROR("registerPushService crashed.", t);
223
234
  }
224
235
  }
225
236
  });
@@ -2,6 +2,8 @@ package com.rho;
2
2
 
3
3
  import java.util.Hashtable;
4
4
 
5
+ import net.rim.blackberry.api.browser.Browser;
6
+ import net.rim.blackberry.api.browser.BrowserSession;
5
7
  import net.rim.device.api.system.ApplicationDescriptor;
6
8
  import net.rim.device.api.system.CodeModuleGroup;
7
9
  import net.rim.device.api.system.DeviceInfo;
@@ -131,8 +133,17 @@ public class RhoRubyHelper implements IRhoRubyHelper {
131
133
  {
132
134
  RhodesApplication.getInstance().close();
133
135
  }
136
+
137
+ public void open_url(String url)
138
+ {
139
+ BrowserSession session = Browser.getDefaultSession();
140
+ session.showBrowser();
141
+ session.displayPage(url);
142
+ }
134
143
 
135
- static Hashtable m_appProperties = new Hashtable();
144
+ static Hashtable m_appProperties = new Hashtable();
145
+ static CodeModuleGroup m_groupRhodes = null;
146
+ static boolean m_bGroupsInited = false;
136
147
  public String getAppProperty(String name)
137
148
  {
138
149
  String strRes = null;
@@ -142,25 +153,31 @@ public class RhoRubyHelper implements IRhoRubyHelper {
142
153
  strRes = (String)m_appProperties.get(name);
143
154
  else
144
155
  {
145
- CodeModuleGroup[] codeModule = CodeModuleGroup.loadAll();
146
-
147
- if ( codeModule != null )
156
+ if (!m_bGroupsInited)
148
157
  {
149
- String moduleName = ApplicationDescriptor
150
- .currentApplicationDescriptor().getModuleName();
151
-
152
- for(int i = 0; i < codeModule.length; i++)
158
+ m_bGroupsInited = true;
159
+ CodeModuleGroup[] codeModule = CodeModuleGroup.loadAll();
160
+
161
+ if ( codeModule != null )
153
162
  {
154
- String module = codeModule[i].getName();
155
- if( module.indexOf( moduleName ) != -1)
163
+ String moduleName = ApplicationDescriptor
164
+ .currentApplicationDescriptor().getModuleName();
165
+
166
+ for(int i = 0; i < codeModule.length; i++)
156
167
  {
157
- CodeModuleGroup group = codeModule[i];
158
- if ( group != null )
159
- strRes = group.getProperty(name);
160
- break;
168
+ String module = codeModule[i].getName();
169
+ if( module.indexOf( moduleName ) != -1)
170
+ {
171
+ m_groupRhodes = codeModule[i];
172
+ break;
173
+ }
161
174
  }
162
175
  }
163
176
  }
177
+
178
+ if (m_groupRhodes != null)
179
+ strRes = m_groupRhodes.getProperty(name);
180
+
164
181
  /*
165
182
  CodeModuleGroup[] allGroups = CodeModuleGroupManager.loadAll();
166
183
  if ( allGroups != null )
@@ -272,8 +272,9 @@ public class Jsr75File implements SimpleFile
272
272
  if ( strRoot == null )
273
273
  throw new IOException("Could not find storage");
274
274
 
275
- if ( strDir != null && strDir.length() > 0 ){
276
- String strDirPath = FilePath.join(strRoot, strDir);
275
+ if ( strDir != null && strDir.length() > 0 )
276
+ {
277
+ String strDirPath = strDir.startsWith(strRoot) ? strDir : FilePath.join(strRoot, strDir);
277
278
  strDirPath = FilePath.join(strDirPath, "/");
278
279
  createDir( strDirPath );
279
280
  return strDirPath;
@@ -81,7 +81,7 @@ public class Alert
81
81
  mgr.add(tf);
82
82
  }
83
83
 
84
- HorizontalFieldManager lfm = new HorizontalFieldManager();
84
+ HorizontalFieldManager lfm = new HorizontalFieldManager(Manager.FIELD_HCENTER| Manager.FIELD_VCENTER);
85
85
  mgr.add(lfm);
86
86
 
87
87
  Bitmap bmp = null;
@@ -102,7 +102,8 @@ public class Alert
102
102
  LabelField lf = new LabelField(msg, Field.FIELD_HCENTER | Field.FIELD_VCENTER);
103
103
  lfm.add(lf);
104
104
 
105
- hfm = new HorizontalFieldManager();
105
+ hfm = new HorizontalFieldManager(Manager.FIELD_HCENTER| Manager.FIELD_VCENTER);
106
+ hfm.setPadding(10, 0, 0, 10);
106
107
  mgr.add(hfm);
107
108
  }
108
109
 
@@ -135,6 +135,34 @@ public class System {
135
135
  }
136
136
  }
137
137
  });
138
+
139
+ klass.getSingletonClass().defineMethod( "run_app", new RubyTwoArgMethod(){
140
+ protected RubyValue run(RubyValue receiver, RubyValue arg1, RubyValue arg2, RubyBlock block )
141
+ {
142
+ try {
143
+ return RubyConstant.QNIL;
144
+ } catch(Exception e) {
145
+ LOG.ERROR("run_app failed", e);
146
+ throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
147
+ }
148
+ }
149
+ });
150
+
151
+ klass.getSingletonClass().defineMethod( "open_url", new RubyOneArgMethod(){
152
+ protected RubyValue run(RubyValue receiver, RubyValue arg1, RubyBlock block )
153
+ {
154
+ try
155
+ {
156
+ RhoRubyHelper helper = new RhoRubyHelper();
157
+ helper.open_url(arg1.toStr());
158
+
159
+ return RubyConstant.QNIL;
160
+ } catch(Exception e) {
161
+ LOG.ERROR("run_app failed", e);
162
+ throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
163
+ }
164
+ }
165
+ });
138
166
 
139
167
  }
140
168
 
@@ -1,6 +1,7 @@
1
1
  package rhomobile;
2
2
 
3
3
  import j2me.util.LinkedList;
4
+ import j2me.util.StringParser;
4
5
 
5
6
  import java.io.IOException;
6
7
  import java.io.InputStream;
@@ -10,6 +11,8 @@ import java.util.Vector;
10
11
 
11
12
  import javax.microedition.io.HttpConnection;
12
13
 
14
+ import net.rim.blackberry.api.browser.Browser;
15
+ import net.rim.blackberry.api.browser.BrowserSession;
13
16
  import net.rim.device.api.browser.field.RenderingOptions;
14
17
  import net.rim.device.api.io.http.HttpHeaders;
15
18
  import net.rim.device.api.system.Application;
@@ -33,7 +36,6 @@ import net.rim.device.api.ui.component.ButtonField;
33
36
  import net.rim.device.api.ui.component.LabelField;
34
37
  import net.rim.device.api.ui.Manager;
35
38
  import net.rim.device.api.math.Fixed32;
36
-
37
39
  //import net.rim.device.api.system.EventInjector.KeyCodeEvent;
38
40
 
39
41
  import com.rho.*;
@@ -378,8 +380,12 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
378
380
  **************************************************************************/
379
381
  public static void main(String[] args)
380
382
  {
381
- _instance = new RhodesApplication();
383
+ LOG.INFO_EVENT("main start");
384
+
382
385
  try{
386
+ _instance = new RhodesApplication();
387
+ LOG.INFO_EVENT( "RhodesApplication created" );
388
+
383
389
  _instance.enterEventDispatcher();
384
390
  }catch(Exception exc)
385
391
  {
@@ -475,9 +481,21 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
475
481
  private boolean m_bActivate = false;
476
482
  private void rhodes_activate()
477
483
  {
484
+ if ( !m_bStartupFinish )
485
+ {
486
+ this.invokeLater( new Runnable() {
487
+ public void run()
488
+ {
489
+ //LOG.INFO_EVENT("Activate wait till Startup finish");
490
+ rhodes_activate();
491
+ }
492
+ }, 100, false );
493
+ return;
494
+ }
495
+
478
496
  m_bActivate = true;
479
497
  //DO NOT DO ANYTHING before doStartupWork
480
- doStartupWork();
498
+ //doStartupWork();
481
499
  showSplashScreen();
482
500
  LOG.TRACE("Rhodes start activate ***--------------------------***");
483
501
 
@@ -953,6 +971,8 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
953
971
  try{is.close();}catch(IOException exc){}
954
972
  is = null;
955
973
  }
974
+
975
+ pushScreen(_mainScreen);
956
976
  }
957
977
 
958
978
  public void showLogScreen()
@@ -962,9 +982,10 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
962
982
  UiApplication.getUiApplication().pushScreen(screen);
963
983
  }
964
984
 
985
+ boolean m_bStartupFinish = false;
965
986
  private void doStartupWork()
966
987
  {
967
- if (_mainScreen!=null)
988
+ /* if (_mainScreen!=null)
968
989
  return;
969
990
 
970
991
  if ( com.rho.Capabilities.RUNAS_SERVICE && ApplicationManager.getApplicationManager().inStartup() )// || isWaitForSDCardAtStartup() )
@@ -977,31 +998,44 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
977
998
  } );
978
999
 
979
1000
  return;
980
- }
1001
+ }*/
981
1002
 
982
1003
  try{
983
- if ( com.rho.Capabilities.RUNAS_SERVICE )
984
- {
1004
+ if ( com.rho.Capabilities.RUNAS_SERVICE )
1005
+ {
1006
+ while( ApplicationManager.getApplicationManager().inStartup() )
1007
+ {
1008
+ LOG.INFO_EVENT("inStartup");
1009
+ Thread.sleep(1000);
1010
+ }
1011
+
985
1012
  if ( !Jsr75File.isSDCardExist() )
1013
+ {
1014
+ LOG.INFO_EVENT("isSDCardExist");
986
1015
  Thread.sleep(5000); //Wait till SDCard may appear
987
- }
988
-
1016
+ }
1017
+ }
1018
+
989
1019
  RhoLogger.InitRhoLog();
990
-
1020
+
991
1021
  LOG.INFO(" STARTING RHODES: ***----------------------------------*** " );
992
1022
 
993
1023
  RhodesApp.Create(RhoConf.getInstance().getRhoRootPath());
994
-
1024
+
995
1025
  CKeyListener list = new CKeyListener();
996
1026
  CTrackwheelListener wheel = new CTrackwheelListener();
997
1027
  this._history = new Vector();
998
1028
 
999
- _mainScreen = new CMainScreen();
1000
- _mainScreen.addKeyListener(list);
1001
- _mainScreen.addTrackwheelListener(wheel);
1002
-
1003
- pushScreen(_mainScreen);
1004
- createBrowserControl();
1029
+ synchronized (Application.getEventLock())
1030
+ {
1031
+ _mainScreen = new CMainScreen();
1032
+ _mainScreen.addKeyListener(list);
1033
+ _mainScreen.addTrackwheelListener(wheel);
1034
+ //pushScreen(_mainScreen);
1035
+ createBrowserControl();
1036
+ }
1037
+
1038
+ LOG.INFO_EVENT("createBrowserControl" );
1005
1039
 
1006
1040
  try {
1007
1041
  RhoClassFactory.getNetworkAccess().configure();
@@ -1009,17 +1043,37 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
1009
1043
  } catch(IOException exc) {
1010
1044
  LOG.ERROR(exc.getMessage());
1011
1045
  }
1012
-
1013
- PrimaryResourceFetchThread.Create(this);
1046
+ LOG.INFO_EVENT("getNetworkAccess");
1047
+
1048
+ //PrimaryResourceFetchThread.Create(this);
1014
1049
  LOG.INFO("RHODES STARTUP COMPLETED: ***----------------------------------*** " );
1015
1050
 
1051
+ m_bStartupFinish = true;
1016
1052
  if ( com.rho.Capabilities.RUNAS_SERVICE && !m_bActivate &&
1017
1053
  RhoConf.getInstance().getBool("activate_at_startup"))
1018
- rhodes_activate();
1054
+ {
1055
+ this.invokeLater( new Runnable() {
1056
+ public void run()
1057
+ {
1058
+ rhodes_activate();
1059
+ }
1060
+ });
1061
+
1062
+ }
1019
1063
  }catch(Exception exc)
1020
1064
  {
1021
1065
  LOG.ERROR("doStartupWork failed", exc);
1066
+
1067
+ LOG.ERROR_EVENT("doStartupWork failed", exc);
1068
+ }catch(Throwable exc)
1069
+ {
1070
+ LOG.ERROR("doStartupWork crashed.", exc);
1071
+
1072
+ LOG.ERROR_EVENT("doStartupWork failed", exc);
1073
+
1074
+ return;
1022
1075
  }
1076
+
1023
1077
  }
1024
1078
 
1025
1079
  public void executeJavascript(String strJavascript)
@@ -1087,7 +1141,7 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
1087
1141
  }else
1088
1142
  m_oBrowserAdapter = new BrowserAdapter(_mainScreen, this, RhoConf.getInstance().getBool("bb_loadimages_async"));
1089
1143
  }
1090
-
1144
+ /*
1091
1145
  private void invokeStartupWork() {
1092
1146
  // I think this can get called twice
1093
1147
  // 1) Directly from startup, if the app starts while the BB is up - e.g. after download
@@ -1108,16 +1162,16 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
1108
1162
  }else
1109
1163
  doStartupWork();
1110
1164
  }
1111
- }
1165
+ }*/
1112
1166
 
1113
1167
  //----------------------------------------------------------------------
1114
1168
  // SystemListener methods
1115
1169
 
1116
1170
  public void powerUp() {
1117
- LOG.INFO_OUT(" POWER UP ***----------------------------------*** " );
1171
+ LOG.INFO_EVENT("POWER UP" );
1118
1172
  if ( com.rho.Capabilities.RUNAS_SERVICE)
1119
1173
  {
1120
- invokeStartupWork();
1174
+ //invokeStartupWork();
1121
1175
  this.requestBackground();
1122
1176
  }
1123
1177
  }
@@ -1137,12 +1191,17 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
1137
1191
  LOG.INFO_OUT(" Construct RhodesApplication() ***----------------------------------*** " );
1138
1192
  m_activateHooks = new Hashtable();
1139
1193
  this.addSystemListener(this);
1194
+ PrimaryResourceFetchThread.Create(this);
1195
+
1140
1196
  //this.addFileSystemListener(this);
1141
- if ( com.rho.Capabilities.RUNAS_SERVICE && ApplicationManager.getApplicationManager().inStartup() ) {
1197
+ /* if ( com.rho.Capabilities.RUNAS_SERVICE && ApplicationManager.getApplicationManager().inStartup() )
1198
+ {
1199
+ EventLogger.logEvent(0x4c9d3452d87922f2L, "inStartup".getBytes());
1200
+
1142
1201
  LOG.INFO_OUT("We are in the phone startup, don't start Rhodes yet, leave it to power up call");
1143
1202
  } else {
1144
1203
  invokeStartupWork();
1145
- }
1204
+ }*/
1146
1205
  }
1147
1206
 
1148
1207
  public void refreshCurrentPage(){
@@ -1204,6 +1263,12 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
1204
1263
 
1205
1264
  public void run()
1206
1265
  {
1266
+ _application.doStartupWork();
1267
+ if (!_application.m_bStartupFinish)
1268
+ {
1269
+ return;
1270
+ }
1271
+
1207
1272
  LOG.INFO( "Starting HttpServerThread main routine..." );
1208
1273
  //wait(80);
1209
1274
  try{
@@ -1350,6 +1415,26 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
1350
1415
  return;
1351
1416
  }
1352
1417
 
1418
+ URI uri = new URI(_url);
1419
+ String query = uri.getQueryString();
1420
+ if (query != null) {
1421
+ StringParser tok = new StringParser(query, "&");
1422
+ while (tok.hasMoreElements()) {
1423
+ String pair = (String)tok.nextElement();
1424
+ StringParser nv = new StringParser(pair, "=");
1425
+ String name = (String)nv.nextElement();
1426
+ String value = (String)nv.nextElement();
1427
+ if (name == null || value == null)
1428
+ continue;
1429
+
1430
+ if (name.equals("rho_open_target") && value.equals("_blank")) {
1431
+ RhoRubyHelper helper = new RhoRubyHelper();
1432
+ helper.open_url(_url);
1433
+ return;
1434
+ }
1435
+ }
1436
+ }
1437
+
1353
1438
  HttpConnection connection = Utilities.makeConnection(_url, _requestHeaders, _postData, null);
1354
1439
 
1355
1440
  if ( m_bInternalRequest )