rhodes 3.3.3.beta.3 → 3.3.3.beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/Manifest.txt +16 -1
  2. data/Rakefile +77 -28
  3. data/doc/build.txt +5 -3
  4. data/doc/configuration.txt +13 -0
  5. data/doc/device-caps.txt +46 -27
  6. data/doc/rhom.txt +2 -2
  7. data/doc/test-log-debug.txt +6 -0
  8. data/doc/ui.txt +13 -0
  9. data/lib/build/jake.rb +11 -11
  10. data/lib/extensions/crypt/crypt/cbc.rb +5 -2
  11. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +14 -4
  12. data/lib/framework/rho/render.rb +17 -4
  13. data/lib/framework/rho/rho.rb +1 -1
  14. data/lib/framework/rho/rhocontroller.rb +11 -1
  15. data/lib/framework/rhomotoapi.rb +110 -0
  16. data/platform/android/Rhodes/jni/Android.mk +2 -5
  17. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
  18. data/platform/android/Rhodes/jni/include/rhodes/fileapi.h +38 -0
  19. data/platform/android/Rhodes/jni/src/callbacks.cpp +7 -26
  20. data/platform/android/Rhodes/jni/src/extmanager.cpp +4 -1
  21. data/platform/android/Rhodes/jni/src/fileapi.cpp +38 -14
  22. data/platform/android/Rhodes/jni/src/mapview.cpp +1 -2
  23. data/platform/android/Rhodes/jni/src/rhodesapp.cpp +10 -0
  24. data/platform/android/Rhodes/jni/src/rhodessystem.cpp +1 -1
  25. data/platform/android/Rhodes/jni/src/signature.cpp +1 -4
  26. data/platform/android/Rhodes/rhobundle.xml +1 -1
  27. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +11 -1
  28. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +4 -3
  29. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -6
  30. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +3 -1
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +70 -0
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtData.java +3 -1
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +21 -7
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +19 -10
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtDataImpl.java +8 -5
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManager.java +18 -0
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +168 -31
  38. data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +46 -9
  39. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +3 -2
  40. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +27 -53
  41. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +27 -3
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/Utils.java +13 -14
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +12 -5
  44. data/platform/android/build/RhodesSRC_build.files +2 -1
  45. data/platform/android/build/android.rake +48 -17
  46. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +1 -1
  47. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +24 -3
  48. data/platform/iphone/Classes/AppManager/AppManager.m +1 -1
  49. data/platform/iphone/Classes/Camera/PickImageDelegate.m +27 -2
  50. data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
  51. data/platform/iphone/Classes/DateTimePickerDelegate.m +85 -9
  52. data/platform/iphone/Classes/DateTimePickerViewController.h +21 -0
  53. data/platform/iphone/Classes/DateTimePickerViewController.m +75 -0
  54. data/platform/iphone/Classes/GeoLocation/LocationController.h +6 -2
  55. data/platform/iphone/Classes/GeoLocation/LocationController.m +54 -14
  56. data/platform/iphone/Classes/RhoMainView.h +2 -0
  57. data/platform/iphone/Classes/Rhodes.m +11 -5
  58. data/platform/iphone/Classes/Signature/SignatureDelegate.m +13 -12
  59. data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -1
  60. data/platform/iphone/Classes/SimpleMainView.m +3 -0
  61. data/platform/iphone/Classes/SplitView/SplittedMainView.m +3 -0
  62. data/platform/iphone/Classes/TabbedMainView.m +30 -11
  63. data/platform/iphone/rbuild/iphone.rake +7 -1
  64. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +6 -0
  65. data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
  66. data/platform/shared/common/BundleManager.cpp +42 -2
  67. data/platform/shared/common/ExtManager.h +7 -0
  68. data/platform/shared/common/RhoFile.cpp +170 -2
  69. data/platform/shared/common/RhoFile.h +4 -0
  70. data/platform/shared/common/RhodesApp.cpp +30 -0
  71. data/platform/shared/common/RhodesApp.h +1 -0
  72. data/platform/shared/common/map/OSMMapEngine.cpp +11 -3
  73. data/platform/shared/common/map/OSMMapEngine.h +3 -0
  74. data/platform/shared/logging/RhoLogConf.cpp +8 -9
  75. data/platform/shared/logging/RhoLogConf.h +5 -7
  76. data/platform/shared/logging/RhoLogSink.cpp +3 -3
  77. data/platform/shared/logging/RhoLogSink.h +1 -1
  78. data/platform/shared/net/HttpServer.cpp +17 -9
  79. data/platform/shared/qt/rhodes/main.cpp +1 -1
  80. data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
  81. data/platform/shared/ruby/ext/webview/webview.i +9 -4
  82. data/platform/shared/ruby/ext/webview/webview_wrap.c +2 -2
  83. data/platform/shared/test/Tests.cpp +2 -2
  84. data/platform/wm/build/build_inf.js +75 -47
  85. data/platform/wm/build/wm.rake +50 -53
  86. data/platform/wm/rhodes/Rhodes.cpp +40 -97
  87. data/platform/wm/rhodes/rho/common/ExtManager.cpp +23 -1
  88. data/platform/wm/rhodes/rho/rubyext/WebView.cpp +9 -0
  89. data/platform/wm/tools/detool/detool.cpp +103 -52
  90. data/platform/wp7/RhoRubyExtGen/RhoDateTimePicker.cs +60 -0
  91. data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +1 -0
  92. data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +4 -4
  93. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +15 -1
  94. data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +12 -2
  95. data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +2 -0
  96. data/platform/wp7/RhoRubyLib/common/RhoFile.cs +3 -3
  97. data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +2 -2
  98. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +39 -24
  99. data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +8 -1
  100. data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +3 -3
  101. data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +1 -1
  102. data/platform/wp7/RhoRubyLib/net/HttpServer.cs +22 -15
  103. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
  104. data/platform/wp7/RhoRubyLib/rubyext/RhoDateTimePicker.cs +237 -0
  105. data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +5 -5
  106. data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml +37 -0
  107. data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml.cs +59 -0
  108. data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +34 -41
  109. data/platform/wp7/rhodes/App.xaml.cs +1 -0
  110. data/platform/wp7/rhodes/Properties/WMAppManifest.xml +18 -18
  111. data/platform/wp7/rhodes/Rhodes.csproj +5 -1
  112. data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Cancel.png +0 -0
  113. data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Check.png +0 -0
  114. data/rakefile.rb +77 -28
  115. data/res/build-tools/Microsoft.Phone.Controls.Toolkit.dll +0 -0
  116. data/res/build-tools/YUICompressorLicense.txt +54 -0
  117. data/res/build-tools/detool.exe +0 -0
  118. data/res/build-tools/yuicompressor-2.4.7.jar +0 -0
  119. data/res/generators/templates/application/app/layout.erb +1 -0
  120. data/res/generators/templates/application/public/js/jquery-wp7-patch.js +8 -2
  121. data/res/generators/templates/application/public/js/syncengine.js +147 -0
  122. data/spec/phone_spec/app/Data/septest.json +1 -1
  123. data/spec/phone_spec/app/spec/asynchttp_spec.rb +11 -10
  124. data/spec/phone_spec/app/spec/blobsync_spec.rb +9 -34
  125. data/spec/phone_spec/app/spec/date_spec.rb +6 -6
  126. data/spec/phone_spec/app/spec/rho_spec.rb +1 -6
  127. data/spec/phone_spec/app/spec/rhofile_spec.rb +13 -7
  128. data/spec/phone_spec/app/spec/rhom_object_spec.rb +4 -3
  129. data/spec/phone_spec/app/spec/syncengine_spec.rb +12 -14
  130. data/spec/phone_spec/app/spec_runner.rb +9 -10
  131. data/version +1 -1
  132. metadata +20 -5
  133. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerSingleton.java +0 -15
@@ -59,8 +59,17 @@ extern "C" int rho_sys_check_rollback_bundle(const char* szRhoPath);
59
59
 
60
60
  #ifdef APP_BUILD_CAPABILITY_WEBKIT_BROWSER
61
61
  class CEng;
62
+ class CConfig;
62
63
  extern "C" CEng* rho_wmimpl_get_webkitbrowser(HWND hParentWnd, HINSTANCE hInstance);
64
+ extern "C" CConfig* rho_wmimpl_get_webkitconfig();
63
65
  extern rho::IBrowserEngine* rho_wmimpl_get_webkitBrowserEngine(HWND hwndParent, HINSTANCE rhoAppInstance);
66
+ extern "C" WCHAR* rho_wmimpl_get_configfilepath();
67
+ extern "C" void rho_wmimpl_set_configfilepath(const char* path);
68
+ extern "C" TCHAR* rho_wmimpl_get_startpage();
69
+ extern "C" void rho_wmimpl_set_startpage(const char* path);
70
+ extern "C" void rho_wmimpl_set_logpath(const TCHAR* path);
71
+ extern "C" const char* rho_wmimpl_get_logpath();
72
+ extern "C" const char* rho_wmimpl_get_logurl();
64
73
  #endif
65
74
 
66
75
 
@@ -122,11 +131,6 @@ class CRhodesModule : public CAtlExeModuleT< CRhodesModule >
122
131
  int m_nRestarting;
123
132
  CExtManager m_oExtManager;
124
133
 
125
- #if defined(APP_BUILD_CAPABILITY_MOTOROLA)
126
- static WCHAR g_ConfigFilePath[MAX_PATH + 1];
127
- static TCHAR g_StartPage[MAX_PATH + 1];
128
- #endif // APP_BUILD_CAPABILITY_MOTOROLA
129
-
130
134
  #ifdef OS_WINDOWS
131
135
  String m_strHttpProxy;
132
136
  #endif
@@ -134,15 +138,6 @@ class CRhodesModule : public CAtlExeModuleT< CRhodesModule >
134
138
  public :
135
139
  static HINSTANCE GetModuleInstance(){return m_hInstance;}
136
140
  static void SetModuleInstance(HINSTANCE hInstance){m_hInstance = hInstance;}
137
-
138
- #if defined(APP_BUILD_CAPABILITY_MOTOROLA)
139
- static void setConfigFilePath(const char* path);
140
- static void setStartPage(const char* path);
141
- static void setStartPage(const TCHAR* tpath);
142
- static WCHAR* getConfigFilePath();
143
- static TCHAR* getStartPage();
144
- #endif // APP_BUILD_CAPABILITY_MOTOROLA
145
-
146
141
  HWND GetMainWindow() { return m_appWindow.m_hWnd;}
147
142
  CMainWindow* GetMainWindowObject() { return &m_appWindow;}
148
143
  CMainWindow& GetAppWindow() { return m_appWindow; }
@@ -166,33 +161,6 @@ HINSTANCE CRhodesModule::m_hInstance;
166
161
  CRhodesModule _AtlModule;
167
162
  bool g_restartOnExit = false;
168
163
 
169
- #if defined(APP_BUILD_CAPABILITY_MOTOROLA)
170
- WCHAR CRhodesModule::g_ConfigFilePath[MAX_PATH + 1] = {0};
171
- TCHAR CRhodesModule::g_StartPage[MAX_PATH + 1] = {0};
172
-
173
- extern "C" WCHAR* rho_wmimpl_get_configfilepath()
174
- {
175
- return CRhodesModule::getConfigFilePath();
176
- }
177
- extern "C" TCHAR* rho_wmimpl_get_startpage()
178
- {
179
- return CRhodesModule::getStartPage();
180
- }
181
- extern "C" void rho_wmimpl_set_configfilepath(const char* path)
182
- {
183
- CRhodesModule::setConfigFilePath(path);
184
- }
185
- extern "C" void rho_wmimpl_set_startpage(const char* path)
186
- {
187
- CRhodesModule::setStartPage(path);
188
- }
189
- extern "C" void rho_wmimpl_set_startpage_tchar(const TCHAR* path)
190
- {
191
- CRhodesModule::setStartPage(path);
192
- }
193
- #endif // APP_BUILD_CAPABILITY_MOTOROLA
194
-
195
-
196
164
  #ifndef RHODES_EMULATOR
197
165
  rho::IBrowserEngine* rho_wmimpl_createBrowserEngine(HWND hwndParent)
198
166
  {
@@ -240,20 +208,8 @@ bool CRhodesModule::ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode ) thr
240
208
  String token = convertToStringA(lpszToken);
241
209
  char* path = parseToken( token.c_str(), token.length() );
242
210
  if (path) {
243
- if ((_strnicmp(path+strlen(path)-1,".html",5)==0) || (_strnicmp(path+strlen(path)-5,".htm",4)==0))
244
- {
245
- // RhoElements v1.0 compatibility mode
246
- rho_wmimpl_set_startpage(path);
247
- } else {
248
- // RhoElements v2.0 mode
249
- m_strRootPath = path;
250
- if (m_strRootPath.substr(0,7).compare("file://")==0)
251
- m_strRootPath.erase(0,7);
252
- ::std::replace(m_strRootPath.begin(), m_strRootPath.end(), '\\', '/');
253
- if (m_strRootPath.at(m_strRootPath.length()-1)!='/')
254
- m_strRootPath.append("/");
255
- m_strRootPath.append("rho/");
256
- }
211
+ // RhoElements v1.0 compatibility mode
212
+ rho_wmimpl_set_startpage(path);
257
213
  free(path);
258
214
  }
259
215
  }
@@ -262,7 +218,10 @@ bool CRhodesModule::ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode ) thr
262
218
  String token = convertToStringA(lpszToken);
263
219
  char* path = parseToken( token.c_str(), token.length() );
264
220
  if (path) {
265
- rho_wmimpl_set_configfilepath(path);
221
+ token = path;
222
+ if (token.substr(0,7).compare("file://")==0)
223
+ token.erase(0,7);
224
+ rho_wmimpl_set_configfilepath(token.c_str());
266
225
  free(path);
267
226
  }
268
227
  }
@@ -337,6 +296,23 @@ bool CRhodesModule::ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode ) thr
337
296
  free(port);
338
297
  }
339
298
  } */
299
+ #else
300
+ else if (wcsnicmp(lpszToken, _T("approot"),7)==0)
301
+ {
302
+ String token = convertToStringA(lpszToken);
303
+ char* path = parseToken( token.c_str(), token.length() );
304
+ if (path) {
305
+ // RhoElements v2.0 Shared Runtime command line parameter
306
+ m_strRootPath = path;
307
+ if (m_strRootPath.substr(0,7).compare("file://")==0)
308
+ m_strRootPath.erase(0,7);
309
+ ::std::replace(m_strRootPath.begin(), m_strRootPath.end(), '\\', '/');
310
+ if (m_strRootPath.at(m_strRootPath.length()-1)!='/')
311
+ m_strRootPath.append("/");
312
+ m_strRootPath.append("rho/");
313
+ }
314
+ free(path);
315
+ }
340
316
  #endif
341
317
  lpszToken = FindOneOf(lpszToken, szTokens);
342
318
  }
@@ -356,46 +332,6 @@ extern "C" void rho_sys_impl_exit_with_errormessage(const char* szTitle, const c
356
332
  extern "C" void rho_scanner_TEST(HWND hwnd);
357
333
  extern "C" void rho_scanner_TEST2();
358
334
 
359
- #if defined(APP_BUILD_CAPABILITY_MOTOROLA)
360
-
361
- WCHAR* CRhodesModule::getConfigFilePath()
362
- {
363
- return g_ConfigFilePath;
364
- }
365
-
366
- TCHAR* CRhodesModule::getStartPage()
367
- {
368
- return g_StartPage;
369
- }
370
-
371
- void CRhodesModule::setConfigFilePath(const char* path)
372
- {
373
- USES_CONVERSION;
374
- WCHAR* wpath = A2W(path);
375
- _tcscpy(g_ConfigFilePath, wpath);
376
- }
377
-
378
- void CRhodesModule::setStartPage(const char* path)
379
- {
380
- USES_CONVERSION;
381
- TCHAR* tpath = A2T(path);
382
- setStartPage(tpath);
383
- }
384
-
385
- void CRhodesModule::setStartPage(const TCHAR* tpath)
386
- {
387
- _tcscpy(g_StartPage, tpath);
388
- // Store command line parameter in the registry
389
- HKEY hKey;
390
- DWORD Disposition;
391
- RegCreateKeyEx( HKEY_CURRENT_USER, L"Software\\Symbol\\SymbolPB\\Temp", 0, NULL, 0, 0, 0, &hKey, &Disposition );
392
- RegSetValueEx(hKey, L"cmdline", 0, REG_MULTI_SZ, (const BYTE *) tpath, (wcslen(tpath)+1)*2);
393
- RegCloseKey(hKey);
394
- }
395
-
396
- #endif // APP_BUILD_CAPABILITY_MOTOROLA
397
-
398
-
399
335
  // This method is called immediately before entering the message loop.
400
336
  // It contains initialization code for the application.
401
337
  // Returns:
@@ -438,7 +374,14 @@ HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw()
438
374
  return S_FALSE;
439
375
  }
440
376
 
441
- rho_logconf_Init(m_strRootPath.c_str(), m_logPort.c_str());
377
+ #if defined(APP_BUILD_CAPABILITY_MOTOROLA)
378
+ CConfig* conf = rho_wmimpl_get_webkitconfig();
379
+ rho_logconf_Init((rho_wmimpl_get_logpath()[0]==0 ? m_strRootPath.c_str() : rho_wmimpl_get_logpath()), m_strRootPath.c_str(), m_logPort.c_str());
380
+ if (rho_wmimpl_get_logurl()[0]!=0)
381
+ RHOCONF().setString("rhologurl", rho_wmimpl_get_logurl(), false);
382
+ #else
383
+ rho_logconf_Init(m_strRootPath.c_str(), m_strRootPath.c_str(), m_logPort.c_str());
384
+ #endif // APP_BUILD_CAPABILITY_MOTOROLA
442
385
 
443
386
  #ifdef RHODES_EMULATOR
444
387
  RHOSIMCONF().setAppConfFilePath(CFilePath::join( m_strRootPath, RHO_EMULATOR_DIR"/rhosimconfig.txt").c_str());
@@ -64,7 +64,9 @@ CRhoExtData CExtManager::makeExtData()
64
64
  CRhoExtData oData;
65
65
  oData.m_hWnd = getMainWnd();
66
66
  oData.m_hInstance = rho_wmimpl_get_appinstance();
67
+ #ifndef RHODES_EMULATOR
67
68
  oData.m_hBrowserWnd = getAppWindow().getWebKitEngine()->GetHTMLWND();
69
+ #endif
68
70
 
69
71
  oData.m_iTabIndex = rho_webview_active_tab();
70
72
  return oData;
@@ -105,7 +107,7 @@ void CExtManager::onDocumentComplete(const wchar_t* szUrlOfDocument)
105
107
  {
106
108
  for ( HashtablePtr<String, IRhoExtension*>::iterator it = m_hashExtensions.begin(); it != m_hashExtensions.end(); ++it )
107
109
  {
108
- (it->second)->onNavigateComplete( szUrlOfDocument, makeExtData() );
110
+ (it->second)->onDocumentComplete( szUrlOfDocument, makeExtData() );
109
111
  }
110
112
  }
111
113
 
@@ -119,6 +121,26 @@ void CExtManager::executeRubyCallback( const char* szCallback, const char* szCal
119
121
  RHODESAPP().callCallbackWithData(szCallback, szCallbackBody, szCallbackData, bWaitForResponse );
120
122
  }
121
123
 
124
+ void CExtManager::executeRubyCallbackWithJsonBody( const char* szCallback, const char* szCallbackBody, const char* szCallbackData, bool bWaitForResponse)
125
+ {
126
+ RHODESAPP().callCallbackWithJsonBody(szCallback, szCallbackBody, szCallbackData, bWaitForResponse );
127
+ }
128
+
129
+ extern "C" VALUE rjson_tokener_parse(const char *str, char** pszError );
130
+ unsigned long CExtManager::parseJsonToRubyHash(const char* szJson)
131
+ {
132
+ char* szError = 0;
133
+ unsigned long valBody = rjson_tokener_parse(szJson, &szError);
134
+ if ( valBody != 0 )
135
+ return valBody;
136
+
137
+ LOG(ERROR) + "Incorrect json body.Error:" + (szError ? szError : "");
138
+ if ( szError )
139
+ free(szError);
140
+
141
+ return rho_ruby_get_NIL();
142
+ }
143
+
122
144
  void CExtManager::navigate(const wchar_t* szUrl)
123
145
  {
124
146
  ::PostMessage( getMainWnd(), WM_COMMAND, IDM_NAVIGATE, (LPARAM)_wcsdup(szUrl) );
@@ -89,7 +89,16 @@ const char* rho_webview_execute_js(const char* js, int index)
89
89
  //rho_webview_navigate(strJS.c_str(), index);
90
90
  StringW strJsW;
91
91
  convertToStringW(js, strJsW);
92
+
93
+ #ifdef RHODES_EMULATOR
94
+ TNavigateData* nd = (TNavigateData*)malloc(sizeof(TNavigateData));
95
+ nd->index = index;
96
+ nd->url = _tcsdup(strJsW.c_str());
97
+ ::PostMessage( getMainWnd(), WM_COMMAND, IDM_EXECUTEJS, (LPARAM)nd );
98
+ #else
92
99
  ::PostMessage( getMainWnd(), WM_COMMAND, IDM_EXECUTEJS, (LPARAM)_tcsdup(strJsW.c_str()) );
100
+ #endif
101
+
93
102
  return "";
94
103
  }
95
104
 
@@ -33,7 +33,7 @@
33
33
  #include "LogServer.h"
34
34
 
35
35
  #define RHOSETUP_DLL "rhosetup.dll"
36
-
36
+ #define RE2_RUNTIME TEXT("\\Program Files\\RhoElements2\\RhoElements2.exe")
37
37
 
38
38
  TCHAR *app_name = NULL;
39
39
 
@@ -492,7 +492,7 @@ enum {
492
492
  DEPLOY_EMU_WEBKIT
493
493
  };
494
494
 
495
- int copyExecutable (TCHAR *file_name, TCHAR *app_dir)
495
+ int copyExecutable (TCHAR *file_name, TCHAR *app_dir, bool use_re_runtime)
496
496
  {
497
497
  TCHAR exe_fullpath[MAX_PATH];
498
498
  int retval = 0;
@@ -505,7 +505,7 @@ int copyExecutable (TCHAR *file_name, TCHAR *app_dir)
505
505
  _tcscpy(exe_fullpath, app_dir);
506
506
  _tcscat(exe_fullpath, _T("\\"));
507
507
  _tcscat(exe_fullpath, app_name);
508
- _tcscat(exe_fullpath, _T(".exe"));
508
+ _tcscat(exe_fullpath, (use_re_runtime ? _T(".lnk") : _T(".exe")));
509
509
 
510
510
  hSrc = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
511
511
  if (INVALID_HANDLE_VALUE == hSrc) {
@@ -764,6 +764,20 @@ void connectWMDC() {
764
764
  }
765
765
  }
766
766
 
767
+ bool str_ends_with(const TCHAR* str, const TCHAR* suffix)
768
+ {
769
+ if( str == NULL || suffix == NULL )
770
+ return 0;
771
+
772
+ size_t str_len = wcslen(str);
773
+ size_t suffix_len = wcslen(suffix);
774
+
775
+ if(suffix_len > str_len)
776
+ return 0;
777
+
778
+ return (_wcsnicmp( str + str_len - suffix_len, suffix, suffix_len ) == 0);
779
+ }
780
+
767
781
  int _tmain(int argc, _TCHAR* argv[])
768
782
  {
769
783
  TCHAR *emu_name = NULL;
@@ -778,6 +792,7 @@ int _tmain(int argc, _TCHAR* argv[])
778
792
  //WIN32_FIND_DATAW findData;
779
793
  int new_copy = 0;
780
794
  int deploy_type;
795
+ bool use_re_runtime = false;
781
796
 
782
797
  USES_CONVERSION;
783
798
 
@@ -794,7 +809,9 @@ int _tmain(int argc, _TCHAR* argv[])
794
809
  emu_name = argv[2];
795
810
  cab_file = argv[3];
796
811
  app_name = argv[4];
797
- log_port = argv[5];
812
+ //log_port = argv[5];
813
+ if (strcmp(T2A(argv[5]), "1") == 0)
814
+ use_re_runtime = true;
798
815
  deploy_type = DEPLOY_EMUCAB;
799
816
  }
800
817
 
@@ -815,7 +832,9 @@ int _tmain(int argc, _TCHAR* argv[])
815
832
  else {
816
833
  cab_file = argv[2];
817
834
  app_name = argv[3];
818
- log_port = argv[4];
835
+ //log_port = argv[4];
836
+ if (strcmp(T2A(argv[4]), "1") == 0)
837
+ use_re_runtime = true;
819
838
  deploy_type = DEPLOY_DEVCAB;
820
839
  }
821
840
  } else if (argc == 4) { // log
@@ -828,13 +847,15 @@ int _tmain(int argc, _TCHAR* argv[])
828
847
  else if (strcmp(T2A(argv[1]), "wk-dev") == 0) {
829
848
  deploy_type = DEPLOY_DEV_WEBKIT;
830
849
  src_path = argv[2];
831
- app_name = argv[3];
850
+ app_name = argv[3];
832
851
  }
833
852
  }
834
853
  else {
835
854
  usage();
836
855
  return EXIT_FAILURE;
837
856
  }
857
+ if ((!use_re_runtime) && app_exe)
858
+ use_re_runtime = str_ends_with(app_exe, L".lnk");
838
859
 
839
860
  TCHAR app_dir[MAX_PATH];
840
861
  _tcscpy(app_dir, TEXT("\\Program Files\\"));
@@ -871,7 +892,7 @@ int _tmain(int argc, _TCHAR* argv[])
871
892
 
872
893
  hFind = CeFindFirstFile(app_dir, &findData);
873
894
  if (INVALID_HANDLE_VALUE == hFind) {
874
- _tprintf( TEXT("Application directory on device was no found\n"));
895
+ _tprintf( TEXT("Application directory on device was not found\n"));
875
896
 
876
897
  new_copy = 1;
877
898
 
@@ -895,7 +916,7 @@ int _tmain(int argc, _TCHAR* argv[])
895
916
 
896
917
  hFind = CeFindFirstFile(remote_bundle_path, &findData);
897
918
  if (INVALID_HANDLE_VALUE == hFind) {
898
- _tprintf( TEXT("Bundle directory on device was no found\n"));
919
+ _tprintf( TEXT("Bundle directory on device was not found\n"));
899
920
 
900
921
  if (!CeCreateDirectory(remote_bundle_path, NULL)) {
901
922
  printf ("Failed to create bundle directory\n");
@@ -904,7 +925,7 @@ int _tmain(int argc, _TCHAR* argv[])
904
925
  }
905
926
  FindClose( hFind);
906
927
 
907
- int retval = copyExecutable (app_exe, app_dir);
928
+ int retval = copyExecutable (app_exe, app_dir, use_re_runtime);
908
929
  if (retval != EXIT_SUCCESS) {
909
930
  printf ("Failed to copy application executable\n");
910
931
  if (retval == 32) {
@@ -924,15 +945,23 @@ int _tmain(int argc, _TCHAR* argv[])
924
945
  emuBringToFront(emu_name);
925
946
 
926
947
  _tprintf( TEXT("Starting application..."));
927
- _tcscpy(params_buf, TEXT("\\Program Files\\"));
928
- _tcscat(params_buf, app_name);
929
- _tcscat(params_buf, _T("\\"));
930
- _tcscat(params_buf, app_name);
931
- _tcscat(params_buf, _T(".exe"));
932
-
933
- TCHAR params[128];
934
- _tcscpy(params, _T("-log="));
935
- _tcscat(params, log_port);
948
+ TCHAR params[MAX_PATH];
949
+ params[0] = 0;
950
+ if (use_re_runtime) {
951
+ _tcscpy(params_buf, RE2_RUNTIME);
952
+ _tcscpy(params, _T("-approot='\\Program Files\\"));
953
+ _tcscat(params, app_name);
954
+ _tcscat(params, _T("'"));
955
+ } else {
956
+ _tcscpy(params_buf, TEXT("\\Program Files\\"));
957
+ _tcscat(params_buf, app_name);
958
+ _tcscat(params_buf, _T("\\"));
959
+ _tcscat(params_buf, app_name);
960
+ _tcscat(params_buf, _T(".exe"));
961
+ }
962
+ //_tcscpy(params, _T("-log="));
963
+ //_tcscat(params, log_port);
964
+ _tprintf( TEXT("%s %s\n"), params_buf, params);
936
965
 
937
966
  if(!wceRunProcess(T2A(params_buf), T2A(params))) {
938
967
  _tprintf( TEXT("FAILED\n"));
@@ -1007,15 +1036,23 @@ int _tmain(int argc, _TCHAR* argv[])
1007
1036
  emuBringToFront(emu_name);
1008
1037
 
1009
1038
  _tprintf( TEXT("Starting application..."));
1010
- _tcscpy(params_buf, TEXT("\\Program Files\\"));
1011
- _tcscat(params_buf, app_name);
1012
- _tcscat(params_buf, _T("\\"));
1013
- _tcscat(params_buf, app_name);
1014
- _tcscat(params_buf, _T(".exe"));
1015
-
1016
- TCHAR params[128];
1017
- _tcscpy(params, _T("-log="));
1018
- _tcscat(params, log_port);
1039
+ TCHAR params[MAX_PATH];
1040
+ params[0] = 0;
1041
+ if (use_re_runtime) {
1042
+ _tcscpy(params_buf, RE2_RUNTIME);
1043
+ _tcscpy(params, _T("-approot='\\Program Files\\"));
1044
+ _tcscat(params, app_name);
1045
+ _tcscat(params, _T("'"));
1046
+ } else {
1047
+ _tcscpy(params_buf, TEXT("\\Program Files\\"));
1048
+ _tcscat(params_buf, app_name);
1049
+ _tcscat(params_buf, _T("\\"));
1050
+ _tcscat(params_buf, app_name);
1051
+ _tcscat(params_buf, _T(".exe"));
1052
+ }
1053
+ //_tcscat(params, _T("-log="));
1054
+ //_tcscat(params, log_port);
1055
+ _tprintf( TEXT("%s %s\n"), params_buf, params);
1019
1056
 
1020
1057
  if(!wceRunProcess(T2A(params_buf), T2A(params))) {
1021
1058
  _tprintf( TEXT("FAILED\n"));
@@ -1050,7 +1087,7 @@ int _tmain(int argc, _TCHAR* argv[])
1050
1087
 
1051
1088
  hFind = CeFindFirstFile(app_dir, &findData);
1052
1089
  if (INVALID_HANDLE_VALUE == hFind) {
1053
- _tprintf( TEXT("Application directory on device was no found\n"));
1090
+ _tprintf( TEXT("Application directory on device was not found\n"));
1054
1091
 
1055
1092
  new_copy = 1;
1056
1093
 
@@ -1074,7 +1111,7 @@ int _tmain(int argc, _TCHAR* argv[])
1074
1111
 
1075
1112
  hFind = CeFindFirstFile(remote_bundle_path, &findData);
1076
1113
  if (INVALID_HANDLE_VALUE == hFind) {
1077
- _tprintf( TEXT("Bundle directory on device was no found\n"));
1114
+ _tprintf( TEXT("Bundle directory on device was not found\n"));
1078
1115
 
1079
1116
  if (!CeCreateDirectory(remote_bundle_path, NULL)) {
1080
1117
  printf ("Failed to create bundle directory\n");
@@ -1083,8 +1120,7 @@ int _tmain(int argc, _TCHAR* argv[])
1083
1120
  }
1084
1121
  FindClose( hFind);
1085
1122
 
1086
-
1087
- int retval = copyExecutable (app_exe, app_dir);
1123
+ int retval = copyExecutable (app_exe, app_dir, use_re_runtime);
1088
1124
  if (retval != EXIT_SUCCESS) {
1089
1125
  printf ("Failed to copy application executable\n");
1090
1126
  if (retval == 32) {
@@ -1104,16 +1140,23 @@ int _tmain(int argc, _TCHAR* argv[])
1104
1140
  Sleep(2 * 1000);
1105
1141
 
1106
1142
  _tprintf( TEXT("Starting application..."));
1107
- _tcscpy(params_buf, TEXT("\\Program Files\\"));
1108
- _tcscat(params_buf, app_name);
1109
- _tcscat(params_buf, _T("\\"));
1110
- _tcscat(params_buf, app_name);
1111
- _tcscat(params_buf, _T(".exe"));
1112
- _tprintf( TEXT("%s\n"), params_buf);
1113
-
1114
- TCHAR params[128];
1115
- _tcscpy(params, _T("-log="));
1116
- _tcscat(params, log_port);
1143
+ TCHAR params[MAX_PATH];
1144
+ params[0] = 0;
1145
+ if (use_re_runtime) {
1146
+ _tcscpy(params_buf, RE2_RUNTIME);
1147
+ _tcscpy(params, _T("-approot='\\Program Files\\"));
1148
+ _tcscat(params, app_name);
1149
+ _tcscat(params, _T("'"));
1150
+ } else {
1151
+ _tcscpy(params_buf, TEXT("\\Program Files\\"));
1152
+ _tcscat(params_buf, app_name);
1153
+ _tcscat(params_buf, _T("\\"));
1154
+ _tcscat(params_buf, app_name);
1155
+ _tcscat(params_buf, _T(".exe"));
1156
+ }
1157
+ //_tcscat(params, _T("-log="));
1158
+ //_tcscat(params, log_port);
1159
+ _tprintf( TEXT("%s %s\n"), params_buf, params);
1117
1160
 
1118
1161
  if(!wceRunProcess(T2A(params_buf), T2A(params))) {
1119
1162
  _tprintf( TEXT("FAILED\n"));
@@ -1183,15 +1226,23 @@ int _tmain(int argc, _TCHAR* argv[])
1183
1226
  connectWMDC();
1184
1227
 
1185
1228
  _tprintf( TEXT("Starting application..."));
1186
- _tcscpy(params_buf, TEXT("\\Program Files\\"));
1187
- _tcscat(params_buf, app_name);
1188
- _tcscat(params_buf, _T("\\"));
1189
- _tcscat(params_buf, app_name);
1190
- _tcscat(params_buf, _T(".exe"));
1191
-
1192
- TCHAR params[128];
1193
- _tcscpy(params, _T("-log="));
1194
- _tcscat(params, log_port);
1229
+ TCHAR params[MAX_PATH];
1230
+ params[0] = 0;
1231
+ if (use_re_runtime) {
1232
+ _tcscpy(params_buf, RE2_RUNTIME);
1233
+ _tcscpy(params, _T("-approot='\\Program Files\\"));
1234
+ _tcscat(params, app_name);
1235
+ _tcscat(params, _T("'"));
1236
+ } else {
1237
+ _tcscpy(params_buf, TEXT("\\Program Files\\"));
1238
+ _tcscat(params_buf, app_name);
1239
+ _tcscat(params_buf, _T("\\"));
1240
+ _tcscat(params_buf, app_name);
1241
+ _tcscat(params_buf, _T(".exe"));
1242
+ }
1243
+ //_tcscat(params, _T("-log="));
1244
+ //_tcscat(params, log_port);
1245
+ _tprintf( TEXT("%s %s\n"), params_buf, params);
1195
1246
 
1196
1247
  if(!wceRunProcess (T2A(params_buf), T2A(params))) {
1197
1248
  _tprintf( TEXT("FAILED\n"));
@@ -1224,7 +1275,7 @@ int _tmain(int argc, _TCHAR* argv[])
1224
1275
 
1225
1276
  hFind = CeFindFirstFile(app_dir, &findData);
1226
1277
  if (INVALID_HANDLE_VALUE == hFind) {
1227
- _tprintf( TEXT("Application directory on device was no found\n"));
1278
+ _tprintf( TEXT("Application directory on device was not found\n"));
1228
1279
 
1229
1280
  new_copy = 1;
1230
1281
 
@@ -1284,7 +1335,7 @@ int _tmain(int argc, _TCHAR* argv[])
1284
1335
  } else {
1285
1336
  hFind = CeFindFirstFile(app_dir, &findData);
1286
1337
  if (INVALID_HANDLE_VALUE == hFind) {
1287
- _tprintf( TEXT("Application directory on device was no found\n"));
1338
+ _tprintf( TEXT("Application directory on device was not found\n"));
1288
1339
 
1289
1340
  new_copy = 1;
1290
1341