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.
Files changed (368) hide show
  1. data/CHANGELOG +10 -0
  2. data/Rakefile +153 -46
  3. data/doc/build.txt +261 -102
  4. data/doc/configuration.txt +5 -2
  5. data/doc/device-caps.txt +134 -23
  6. data/doc/extensions.txt +922 -69
  7. data/doc/generator.txt +96 -39
  8. data/doc/install.txt +35 -19
  9. data/doc/jqt-jqm-transition.txt +17 -1
  10. data/doc/rhom.txt +23 -2
  11. data/doc/rhostudio-eclipse.txt +49 -0
  12. data/doc/rhostudio-test-plan.txt +440 -0
  13. data/doc/simulator.txt +1 -1
  14. data/doc/synchronization.txt +40 -1
  15. data/lib/build/jake.rb +108 -7
  16. data/lib/extensions/barcode/ext/barcode/platform/android/Rakefile +0 -35
  17. data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +8 -2
  18. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.mm +195 -195
  19. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.m +6 -0
  20. data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +5 -0
  21. data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode_wrap.c +64 -20
  22. data/lib/extensions/debugger/CHANGELOG +3 -0
  23. data/lib/extensions/debugger/debugger.rb +26 -21
  24. data/lib/extensions/digest-md5/ext/Rakefile +5 -5
  25. data/lib/extensions/digest-md5/ext/build +10 -1
  26. data/lib/extensions/digest-md5/ext/defs.h +19 -0
  27. data/lib/extensions/digest-md5/ext/digest-md5.vcproj +317 -9
  28. data/lib/extensions/digest-md5/ext/iphone/Dmd5.xcodeproj/project.pbxproj +290 -0
  29. data/lib/extensions/digest-md5/ext/iphone/Dmd5_Prefix.pch +7 -0
  30. data/lib/extensions/digest-md5/ext/iphone/Rakefile +79 -0
  31. data/lib/extensions/digest-sha1/ext/Rakefile +5 -5
  32. data/lib/extensions/digest-sha1/ext/build +10 -1
  33. data/lib/extensions/digest-sha1/ext/defs.h +19 -0
  34. data/lib/extensions/digest-sha1/ext/digest-sha1.vcproj +317 -9
  35. data/lib/extensions/digest-sha1/ext/iphone/Dsha1.xcodeproj/project.pbxproj +278 -0
  36. data/lib/extensions/digest-sha1/ext/iphone/Dsha1_Prefix.pch +7 -0
  37. data/lib/extensions/digest-sha1/ext/iphone/Rakefile +79 -0
  38. data/lib/extensions/digest/ext/Rakefile +5 -5
  39. data/lib/extensions/digest/ext/build +10 -1
  40. data/lib/extensions/digest/ext/digest.vcproj +317 -9
  41. data/lib/extensions/digest/ext/iphone/Digest.xcodeproj/project.pbxproj +270 -0
  42. data/lib/extensions/digest/ext/iphone/Digest_Prefix.pch +7 -0
  43. data/lib/extensions/digest/ext/iphone/Rakefile +79 -0
  44. data/lib/extensions/esri/ext/esri/platform/iphone/ESRI.xcodeproj/project.pbxproj +10 -2
  45. data/lib/extensions/esri/ext/esri/platform/iphone/Rakefile +6 -0
  46. data/lib/extensions/fcntl/ext/Rakefile +5 -5
  47. data/lib/extensions/fcntl/ext/build +9 -1
  48. data/lib/extensions/fcntl/ext/iphone/Fcntl.xcodeproj/project.pbxproj +262 -0
  49. data/lib/extensions/fcntl/ext/iphone/Fcntl_Prefix.pch +7 -0
  50. data/lib/extensions/fcntl/ext/iphone/Rakefile +79 -0
  51. data/lib/extensions/net-http/net/http.rb +9 -7
  52. data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +64 -20
  53. data/lib/extensions/rhoxml/rexml/document.rb +3 -2
  54. data/lib/extensions/rhoxml/rexml/instruction.rb +70 -0
  55. data/lib/framework/builtinME.rb +9 -0
  56. data/lib/framework/date/format.rb +1 -1
  57. data/lib/framework/dateME.rb +19 -2
  58. data/lib/framework/rho/rho.rb +15 -4
  59. data/lib/framework/rho/rhoapplication.rb +1 -0
  60. data/lib/framework/rho/rhocontact.rb +10 -27
  61. data/lib/framework/rho/rhoevent_c.rb +8 -2
  62. data/lib/framework/rho/rhosupport.rb +25 -0
  63. data/lib/framework/rhodes.rb +1 -1
  64. data/lib/framework/rhoframework.rb +15 -0
  65. data/lib/framework/rholang/localization_simplified.rb +8 -10
  66. data/lib/framework/rhom/rhom_object_factory.rb +8 -2
  67. data/lib/framework/version.rb +1 -1
  68. data/lib/rhodes.rb +1 -1
  69. data/platform/android/Rhodes/jni/Application.mk +2 -1
  70. data/platform/android/Rhodes/jni/include/rhodes.h +9 -0
  71. data/platform/android/Rhodes/jni/src/callbacks.cpp +31 -1
  72. data/platform/android/Rhodes/jni/src/event.cpp +75 -31
  73. data/platform/android/Rhodes/jni/src/nativeview.cpp +1 -1
  74. data/platform/android/Rhodes/jni/src/phonebook.cpp +73 -9
  75. data/platform/android/Rhodes/jni/src/rhodes.cpp +21 -0
  76. data/platform/android/Rhodes/jni/src/rhodesapp.cpp +16 -24
  77. data/platform/android/Rhodes/jni/src/signature.cpp +27 -1
  78. data/platform/android/Rhodes/{default.properties → project.properties} +2 -2
  79. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +14 -12
  80. data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +14 -12
  81. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +38 -115
  82. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +69 -52
  83. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +9 -0
  84. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraNewService.java +21 -1
  85. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraOldService.java +1 -1
  86. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraSemiService.java +1 -1
  87. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraService.java +1 -1
  88. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +38 -6
  89. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/Event.java +212 -1
  90. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +82 -125
  91. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +1 -1
  92. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +2 -1
  93. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +39 -19
  94. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +106 -136
  95. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +26 -25
  96. data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +1 -1
  97. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality.java +40 -0
  98. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality01.java +47 -0
  99. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality02.java +33 -0
  100. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality03.java +33 -0
  101. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality04.java +34 -0
  102. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality05.java +75 -0
  103. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality06.java +34 -0
  104. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality07.java +34 -0
  105. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality08.java +44 -0
  106. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality09.java +34 -0
  107. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality10.java +34 -0
  108. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionalityManager.java +73 -0
  109. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +57 -6
  110. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessor.java +2 -2
  111. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +322 -76
  112. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +11 -6
  113. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +5 -5
  114. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +2 -1
  115. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +125 -0
  116. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsOld.java +2 -3
  117. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebView.java +16 -0
  118. data/platform/android/build/RhodesSRC_build.files +14 -0
  119. data/platform/android/build/android.rake +149 -147
  120. data/platform/android/build/android_tools.rb +58 -0
  121. data/platform/android/build/librhocommon_build.files +1 -0
  122. data/platform/android/build/libruby_build.files +3 -0
  123. data/platform/bb/RubyVM/src/com/rho/RhoConf.java +11 -1
  124. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +11 -5
  125. data/platform/bb/RubyVM/src/com/rho/db/DBAttrManager.java +3 -2
  126. data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +2 -0
  127. data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +20 -8
  128. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +9 -6
  129. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +45 -18
  130. data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +1 -2
  131. data/platform/bb/build/bb.rake +84 -70
  132. data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +106 -14
  133. data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +1 -1
  134. data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +108 -16
  135. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +10 -5
  136. data/platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java +21 -4
  137. data/platform/bb/rhodes/src/rhomobile/mapview/Annotation.java +17 -0
  138. data/platform/bb/rhodes/src/rhomobile/mapview/MapView.java +8 -5
  139. data/platform/bb/rhodes/src/rhomobile/mapview/MapViewScreen.java +3 -1
  140. data/platform/iphone/Classes/AppManager/AppManager.m +15 -3
  141. data/platform/iphone/Classes/Event/Event.m +45 -2
  142. data/platform/iphone/Classes/MapView/MapViewController.m +8 -4
  143. data/platform/iphone/Classes/Phonebook/phonebook.m +30 -7
  144. data/platform/iphone/Classes/Rhodes.h +11 -1
  145. data/platform/iphone/Classes/Rhodes.m +141 -9
  146. data/platform/iphone/Classes/Signature/SignatureDelegate.m +27 -1
  147. data/platform/iphone/Classes/SimpleMainView.h +1 -0
  148. data/platform/iphone/Classes/SimpleMainView.m +4 -0
  149. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +31 -1
  150. data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +10 -0
  151. data/platform/iphone/rbuild/iphone.rake +33 -6
  152. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +10 -2
  153. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +22 -2
  154. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +14 -0
  155. data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +10 -0
  156. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Info.plist +1 -1
  157. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/MacOS/RhoSimulator +0 -0
  158. data/platform/osx/build/osx.rake +58 -7
  159. data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +427 -69
  160. data/platform/shared/RhoConnectClient/RhoConnectClient.h +21 -2
  161. data/platform/shared/common/Android.mk +2 -1
  162. data/platform/shared/common/AutoPointer.h +23 -0
  163. data/platform/shared/common/BundleManager.cpp +333 -0
  164. data/platform/shared/common/RhoFile.cpp +206 -23
  165. data/platform/shared/common/RhoFile.h +14 -4
  166. data/platform/shared/common/RhoFilePath.h +18 -0
  167. data/platform/shared/common/RhoStd.h +11 -1
  168. data/platform/shared/common/RhoThread.h +4 -1
  169. data/platform/shared/common/RhodesApp.cpp +31 -8
  170. data/platform/shared/common/RhodesApp.h +14 -0
  171. data/platform/shared/common/RhodesAppBase.cpp +6 -6
  172. data/platform/shared/common/RhodesAppBase.h +1 -1
  173. data/platform/shared/common/emml.h +34 -0
  174. data/platform/shared/common/iphone/RhoFileImpl.m +30 -2
  175. data/platform/shared/common/map/BaseMapEngine.cpp +3 -3
  176. data/platform/shared/common/map/GeocodingMapEngine.cpp +205 -14
  177. data/platform/shared/common/map/GeocodingMapEngine.h +25 -2
  178. data/platform/shared/common/map/MapEngine.cpp +24 -2
  179. data/platform/shared/common/map/MapEngine.h +23 -12
  180. data/platform/shared/common/phonebook/PhonebookParams.cpp +99 -0
  181. data/platform/shared/common/phonebook/PhonebookParams.h +52 -0
  182. data/platform/shared/common/rhoparams.cpp +14 -0
  183. data/platform/shared/common/rhoparams.h +1 -0
  184. data/platform/shared/db/DBAdapter.cpp +43 -24
  185. data/platform/shared/db/DBAdapter.h +6 -1
  186. data/platform/shared/db/DBAttrManager.cpp +50 -1
  187. data/platform/shared/logging/RhoLog.h +3 -0
  188. data/platform/shared/logging/RhoLogSink.cpp +5 -1
  189. data/platform/shared/net/CURLNetRequest.cpp +2 -0
  190. data/platform/shared/qt/rhodes/QtMainWindow.cpp +14 -1
  191. data/platform/shared/qt/rhodes/impl/PhonebookImpl.cpp +2 -2
  192. data/platform/shared/qt/rhodes/impl/RhoFileImpl.cpp +1 -1
  193. data/platform/shared/qt/rhodes/impl/SignatureImpl.cpp +14 -2
  194. data/platform/shared/qt/rhodes/impl/SystemImpl.cpp +16 -2
  195. data/platform/shared/qt/rhodes/main.cpp +28 -0
  196. data/platform/shared/qt/rhodes/rhodes.pro +3 -0
  197. data/platform/shared/qt/rholib/rholib.pro +2 -1
  198. data/platform/shared/qt/rubylib/rubylib.pro +2 -1
  199. data/platform/shared/ruby/Android.mk +3 -0
  200. data/platform/shared/ruby/class.c +7 -0
  201. data/platform/shared/ruby/compile.c +18 -10
  202. data/platform/shared/ruby/encdb.h +18 -8
  203. data/platform/shared/ruby/eval.c +108 -2
  204. data/platform/shared/ruby/ext/alert/alert_wrap.c +64 -20
  205. data/platform/shared/ruby/ext/asynchttp/asynchttp_wrap.c +64 -20
  206. data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +67 -23
  207. data/platform/shared/ruby/ext/calendar/calendar_wrap.c +64 -20
  208. data/platform/shared/ruby/ext/calendar/event_wrap.c +64 -20
  209. data/platform/shared/ruby/ext/camera/camera_wrap.c +64 -20
  210. data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +64 -20
  211. data/platform/shared/ruby/ext/geolocation/geolocation.i +16 -0
  212. data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +127 -26
  213. data/platform/shared/ruby/ext/mapview/mapview_wrap.c +64 -20
  214. data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +65 -21
  215. data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c +64 -20
  216. data/platform/shared/ruby/ext/navbar/navbar_wrap.c +64 -20
  217. data/platform/shared/ruby/ext/phonebook/phonebook.i +7 -7
  218. data/platform/shared/ruby/ext/phonebook/phonebook_wrap.c +95 -120
  219. data/platform/shared/ruby/ext/rho/rhoruby.c +4 -4
  220. data/platform/shared/ruby/ext/rho/rhoruby.h +2 -0
  221. data/platform/shared/ruby/ext/rho/rhosupport.c +39 -6
  222. data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +65 -21
  223. data/platform/shared/ruby/ext/ringtones/ringtones_wrap.c +64 -20
  224. data/platform/shared/ruby/ext/signature/signature.i +37 -5
  225. data/platform/shared/ruby/ext/signature/signature_wrap.c +274 -45
  226. data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +65 -21
  227. data/platform/shared/ruby/ext/system/system.i +14 -2
  228. data/platform/shared/ruby/ext/system/system_wrap.c +146 -25
  229. data/platform/shared/ruby/ext/webview/webview_wrap.c +65 -21
  230. data/platform/shared/ruby/include/ruby/ruby.h +15 -4
  231. data/platform/shared/ruby/inits.c +1 -0
  232. data/platform/shared/ruby/io.c +13 -3
  233. data/platform/shared/ruby/win32/win32.c +3 -3
  234. data/platform/shared/ruby/wince/io_wce.c +2 -2
  235. data/platform/shared/rubyext/System.cpp +9 -5
  236. data/platform/shared/sync/ClientRegister.cpp +18 -8
  237. data/platform/shared/sync/SyncEngine.cpp +25 -11
  238. data/platform/shared/sync/SyncEngine.h +2 -0
  239. data/platform/shared/sync/SyncSource.cpp +40 -15
  240. data/platform/shared/sync/SyncSource.h +3 -2
  241. data/platform/shared/sync/SyncThread.cpp +9 -4
  242. data/platform/shared/sync/SyncThread.h +3 -1
  243. data/platform/symbian/build/symbian.rake +14 -9
  244. data/platform/symbian/rhodes/rhodes.pro +11 -8
  245. data/platform/symbian/rhodes/src/phonebook/ruby_phonebook.cpp +2 -2
  246. data/platform/symbian/rubylib/rubylib.pro +3 -0
  247. data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
  248. data/platform/wm/RhoLib/RhoLib.vcproj +315 -2
  249. data/platform/wm/build/build_inf.js +235 -187
  250. data/platform/wm/build/wm.rake +388 -233
  251. data/platform/wm/rhodes.sln +56 -0
  252. data/platform/wm/rhodes/MainWindow.cpp +139 -77
  253. data/platform/wm/rhodes/MainWindow.h +27 -22
  254. data/platform/wm/rhodes/MapView/{Graphics.cpp → Bitmap.cpp} +15 -253
  255. data/platform/wm/rhodes/MapView/Bitmap.h +86 -0
  256. data/platform/wm/rhodes/MapView/MapViewManager.cpp +7 -2
  257. data/platform/wm/rhodes/MapView/MapViewManager.h +1 -1
  258. data/platform/wm/rhodes/MapView/Win32Graphics.cpp +263 -0
  259. data/platform/wm/rhodes/MapView/Win32Graphics.h +133 -0
  260. data/platform/wm/rhodes/MapView/WmGraphics.cpp +291 -0
  261. data/platform/wm/rhodes/MapView/{Graphics.h → WmGraphics.h} +14 -56
  262. data/platform/wm/rhodes/Rhodes.cpp +128 -32
  263. data/platform/wm/rhodes/Rhodes.rc +6 -2
  264. data/platform/wm/rhodes/camera/Camera.cpp +1 -0
  265. data/platform/wm/rhodes/phonebook/phonebook.cpp +2 -2
  266. data/platform/wm/rhodes/phonebook/phonebook.h +2 -2
  267. data/platform/wm/rhodes/resource.h +3 -2
  268. data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +6 -0
  269. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +4 -0
  270. data/platform/wm/rhodes/rho/rubyext/RhoSignature.cpp +675 -0
  271. data/platform/wm/rhodes/rho/rubyext/RhoSignature.h +123 -0
  272. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +12 -2
  273. data/platform/wm/rhodes/rhodes.vcproj +2732 -1113
  274. data/platform/wm/rhodes/simulator/MainWindowQt.h +1 -1
  275. data/platform/wm/rhodes/stdafx.h +1 -0
  276. data/platform/wm/rhoelements.sln +118 -62
  277. data/platform/wm/rubylib/rubylib.vcproj +345 -16
  278. data/platform/wm/sqlite3/sqlite3.vcproj +305 -0
  279. data/platform/wm/syncengine/syncengine.vcproj +309 -0
  280. data/platform/wm/tools/detool/LogServer.cpp +19 -2
  281. data/platform/wm/tools/detool/detool.cpp +131 -6
  282. data/platform/wm/tools/detool/detool.vcproj +3 -1
  283. data/platform/wm/tools/detool/stdafx.h +1 -0
  284. data/platform/wp7/IronRuby/Languages/Ruby/Libraries/Builtins/RangeOps.cs +589 -0
  285. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Builtins/RubyEncoding.cs +678 -0
  286. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyExceptionData.cs +271 -0
  287. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyUtils.cs +31 -1
  288. data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.Libraries.dll +0 -0
  289. data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.dll +0 -0
  290. data/platform/wp7/RhoRubyLib/common/RhoStd.cs +6 -0
  291. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +16 -2
  292. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +2 -0
  293. data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +1 -2
  294. data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +13 -10
  295. data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +30 -8
  296. data/platform/wp7/build/wp.rake +5 -0
  297. data/rakefile.rb +153 -46
  298. data/res/build-tools/detool.exe +0 -0
  299. data/res/build-tools/swig_patch/Lib/ruby/rubyerrors.swg +155 -0
  300. data/res/build-tools/swig_patch/Lib/ruby/rubyhead.swg +158 -0
  301. data/res/build-tools/swig_patch/Lib/ruby/rubyiterators.swg +932 -0
  302. data/res/build-tools/swig_patch/Lib/ruby/rubyrun.swg +448 -0
  303. data/res/build-tools/swig_patch/Lib/ruby/rubystdfunctors.swg +162 -0
  304. data/res/build-tools/swig_patch/Lib/ruby/rubytracking.swg +159 -0
  305. data/res/build-tools/swig_patch/Lib/ruby/std_basic_string.i +97 -0
  306. data/res/build-tools/swig_patch/Lib/ruby/std_map.i +418 -0
  307. data/res/build-tools/swig_patch/Lib/ruby/std_multimap.i +227 -0
  308. data/res/build-tools/swig_patch/Lib/swiginit.swg +269 -0
  309. data/res/build-tools/swig_patch/README +7 -0
  310. data/res/generators/templates/application/app/Settings/controller.rb +42 -1
  311. data/res/generators/templates/application/app/Settings/wait.erb +1 -1
  312. data/res/generators/templates/application/app/application.rb +1 -1
  313. data/res/generators/templates/application/app/layout.erb +8 -8
  314. data/res/generators/templates/application/build.yml +0 -1
  315. data/res/generators/templates/application/public/css/android.css +6 -0
  316. data/res/generators/templates/application/public/css/blackberry.css +6 -0
  317. data/res/generators/templates/application/public/css/iphone.css +6 -0
  318. data/res/generators/templates/application/public/css/jqmobile-patch.css +14 -0
  319. data/res/generators/templates/application/public/jqmobile/images/ajax-loader.png +0 -0
  320. data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
  321. data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
  322. data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
  323. data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
  324. data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0rc1.css → jquery.mobile-1.0.css} +452 -354
  325. data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0rc1.js → jquery.mobile-1.0.js} +629 -442
  326. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.css +2 -0
  327. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.js +172 -0
  328. data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.css +714 -0
  329. data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.min.css +2 -0
  330. data/res/generators/templates/application/public/js/jqmobile-patch.js +136 -7
  331. data/res/generators/templates/extension/app/MontanaTest/controller.rb +20 -20
  332. data/res/generators/templates/extension/app/MontanaTest/index.erb +17 -17
  333. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana.xcodeproj/project.pbxproj +8 -2
  334. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Rakefile +5 -0
  335. data/res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana_wrap.c +64 -20
  336. data/rhomobile-debug.gemspec +1 -1
  337. data/spec/framework_spec/app/layout.erb +1 -1
  338. data/spec/framework_spec/app/spec/core/rational/Rational_spec.rb +1 -1
  339. data/spec/framework_spec/app/spec/library/stringio/shared/each_char.rb +6 -2
  340. data/spec/framework_spec/app/spec/shared/rational/{Rational.rb → rational_main.rb} +0 -0
  341. data/spec/framework_spec/build.yml +0 -3
  342. data/spec/perfomance_spec/app/Benchmark/controller.rb +1 -1
  343. data/spec/perfomance_spec/app/layout.erb +1 -1
  344. data/spec/phone_spec/app/BlobTest_s/blob_test_s.rb +13 -0
  345. data/spec/phone_spec/app/BlobTest_s/test.png +0 -0
  346. data/spec/phone_spec/app/BlobTest_s/test2.png +0 -0
  347. data/spec/phone_spec/app/spec/blobsync_spec.rb +27 -15
  348. data/spec/phone_spec/app/spec/date_spec.rb +27 -1
  349. data/spec/phone_spec/app/spec/rho_spec.rb +6 -0
  350. data/spec/phone_spec/app/spec/rhom_object_spec.rb +64 -26
  351. data/spec/phone_spec/app/spec/syncengine_spec.rb +28 -7
  352. data/spec/phone_spec/app/spec/uri_spec.rb +4 -4
  353. data/spec/phone_spec/app/spec_runner.rb +4 -2
  354. data/spec/phone_spec/build.yml +7 -9
  355. data/spec/phone_spec/rhoconfig.txt +1 -0
  356. data/version +1 -1
  357. metadata +75 -22
  358. data/Manifest.txt +0 -7853
  359. data/platform/wm/rhodes/rhoelements/RhoWKBrowserEngine.cpp +0 -384
  360. data/platform/wm/rhodes/rhoelements/RhoWKBrowserEngine.h +0 -41
  361. data/platform/wm/rhodes/signature/Signature.cpp +0 -396
  362. data/platform/wm/rhodes/signature/Signature.h +0 -84
  363. data/platform/wm/rubylib/rubylib.vcproj.VLAD.Vladimir.user +0 -429
  364. data/platform/wm/sqlite3/sqlite3.vcproj.VLAD.Vladimir.user +0 -429
  365. data/platform/wm/syncengine/syncengine.vcproj.VLAD.Vladimir.user +0 -429
  366. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.min.css +0 -12
  367. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.min.js +0 -170
  368. data/rhomobile-debug-1.0.5.gem +0 -0
@@ -62,6 +62,17 @@ typedef struct _RHO_CONNECT_NOTIFY
62
62
  int error_code;
63
63
  char* error_message;
64
64
  char* callback_params;
65
+ unsigned long create_errors;
66
+
67
+ unsigned long update_errors_obj;
68
+ unsigned long update_errors_attrs;
69
+
70
+ unsigned long update_rollback_obj;
71
+ unsigned long update_rollback_attrs;
72
+
73
+ unsigned long delete_errors_obj;
74
+ unsigned long delete_errors_attrs;
75
+
65
76
  }RHO_CONNECT_NOTIFY;
66
77
 
67
78
  typedef struct _RHO_CONNECT_OBJECT_NOTIFY
@@ -83,6 +94,7 @@ void rho_connectclient_destroymodel(RHOM_MODEL* model);
83
94
 
84
95
  void rho_connectclient_init(RHOM_MODEL* pModels, int nModels);
85
96
  void rho_connectclient_destroy();
97
+ void rho_connectclient_database_client_reset();
86
98
  void rho_connectclient_database_full_reset_and_logout();
87
99
  void rho_connectclient_database_fullclient_reset_and_logout();
88
100
  void rho_connectclient_database_full_reset(bool bClientReset);
@@ -94,8 +106,9 @@ void rho_connectclient_parse_objectnotify(const char* msg, RHO_CONNECT_OBJECT_NO
94
106
  void rho_connectclient_free_sync_objectnotify(RHO_CONNECT_OBJECT_NOTIFY* pNotify);
95
107
 
96
108
  unsigned long rho_connectclient_strarray_create();
97
- void rho_connectclient_strarray_add(unsigned long ar, const char* szStr);
109
+ int rho_connectclient_strarray_add(unsigned long ar, const char* szStr);
98
110
  void rho_connectclient_strarray_delete(unsigned long ar);
111
+ int rho_connectclient_strarray_find(unsigned long ar, const char* szStr);
99
112
 
100
113
  unsigned long rho_connectclient_strhasharray_create();
101
114
  void rho_connectclient_strhasharray_add(unsigned long ar, unsigned long hash);
@@ -109,6 +122,8 @@ unsigned long rho_connectclient_find_first(const char* szModel, unsigned long ha
109
122
  unsigned long rho_connectclient_find_all(const char* szModel, unsigned long hashCond );
110
123
  unsigned long rho_connectclient_findbysql(const char* szModel, const char* szSql, unsigned long arParams );
111
124
 
125
+ int rho_connectclient_is_changed(const char* szModel);
126
+
112
127
  void rho_connectclient_save( const char* szModel, unsigned long hash );
113
128
  void rho_connectclient_itemdestroy( const char* szModel, unsigned long hash );
114
129
 
@@ -122,7 +137,11 @@ void rho_connectclient_hash_enumerate(unsigned long hash, int (*enum_func)(const
122
137
 
123
138
  void rho_connectclient_start_bulkupdate(const char* szModel);
124
139
  void rho_connectclient_stop_bulkupdate(const char* szModel);
125
-
140
+
141
+ void rho_connectclient_on_sync_create_error(const char* szModel, RHO_CONNECT_NOTIFY* oNotify, const char* szAction );
142
+ void rho_connectclient_on_sync_update_error(const char* szModel, RHO_CONNECT_NOTIFY* oNotify, const char* szAction );
143
+ void rho_connectclient_on_sync_delete_error(const char* szModel, RHO_CONNECT_NOTIFY* oNotify, const char* szAction );
144
+
126
145
  #ifdef __cplusplus
127
146
  };
128
147
  #endif //__cplusplus
@@ -29,7 +29,8 @@ LOCAL_SRC_FILES := \
29
29
  SplashScreen.cpp \
30
30
  ThreadQueue.cpp \
31
31
  Tokenizer.cpp \
32
- RhoTime.cpp
32
+ RhoTime.cpp \
33
+ BundleManager.cpp
33
34
  LOCAL_C_INCLUDES := $(SHARED_PATH_INC)
34
35
  #$(SHARED_PATH_INC)/curl/include
35
36
  # $(SHARED_PATH_INC)/ruby/include \
@@ -26,6 +26,8 @@
26
26
 
27
27
  #pragma once
28
28
 
29
+ #include "common/IRhoThreadImpl.h"
30
+
29
31
  namespace rho {
30
32
  namespace common {
31
33
 
@@ -162,5 +164,26 @@ private:
162
164
  CBaseDeleter* m_pDeleter;
163
165
  };
164
166
 
167
+ template <typename FUNCTYPE, typename PARAMTYPE>
168
+ class CStaticClassFunctor : public rho::common::IRhoRunnable
169
+ {
170
+ public:
171
+
172
+ CStaticClassFunctor( FUNCTYPE pFunc, PARAMTYPE param ): m_pFunc(pFunc), m_param(param){}
173
+ virtual void runObject()
174
+ {
175
+ m_pFunc(m_param);
176
+ }
177
+
178
+ ~CStaticClassFunctor()
179
+ {
180
+ }
181
+
182
+ private:
183
+ FUNCTYPE m_pFunc;
184
+ PARAMTYPE m_param;
185
+
186
+ };
187
+
165
188
  }
166
189
  }
@@ -0,0 +1,333 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2011 Rhomobile, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://rhomobile.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+ #include "RhodesApp.h"
28
+ #include "common/RhoMutexLock.h"
29
+ #include "common/IRhoClassFactory.h"
30
+ #include "common/RhoFile.h"
31
+ #include "common/RhoConf.h"
32
+ #include "common/RhoFilePath.h"
33
+ #include "common/Tokenizer.h"
34
+
35
+ using namespace rho;
36
+ using namespace rho::common;
37
+ extern "C" void rho_sys_app_exit();
38
+ extern "C" void rho_sys_impl_exit_with_errormessage(const char* szTitle, const char* szMsg);
39
+
40
+ #if !defined(OS_WINDOWS) && !defined(OS_WINCE) && !defined(OS_MACOSX)
41
+ void rho_sys_impl_exit_with_errormessage(const char* szTitle, const char* szMsg)
42
+ {
43
+ }
44
+ #endif
45
+
46
+ namespace rho {
47
+ namespace common {
48
+
49
+ class CFileTransaction
50
+ {
51
+ unsigned int m_nError;
52
+ String m_strError;
53
+ String m_strFolder;
54
+ public:
55
+ CFileTransaction(const String& strFolder);
56
+ ~CFileTransaction();
57
+ unsigned int start();
58
+ void commit();
59
+ unsigned int rollback();
60
+
61
+ boolean isError(){ return m_nError != 0; }
62
+ unsigned int getError(){ return m_nError; }
63
+ String getErrorText(){ return m_strError; }
64
+
65
+ };
66
+
67
+ class CReplaceBundleThread : public rho::common::CRhoThread
68
+ {
69
+ DEFINE_LOGCLASS;
70
+
71
+ String m_bundle_path;
72
+
73
+ unsigned int removeFilesByList( const String& strListPath, const String& strSrcFolder );
74
+ unsigned int moveFilesByList( const String& strListPath, const String& strSrcFolder, const String& strDstFolder );
75
+ void doReplaceBundle();
76
+ public:
77
+
78
+ CReplaceBundleThread(const char* root_path)
79
+ {
80
+ m_bundle_path = root_path;
81
+ start(rho::common::IRhoRunnable::epNormal);
82
+ }
83
+
84
+ virtual ~CReplaceBundleThread() {}
85
+
86
+ virtual void run();
87
+
88
+ static void showError(int nError, const String& strError );
89
+ };
90
+ IMPLEMENT_LOGCLASS(CReplaceBundleThread,"RhoBundle");
91
+
92
+ CFileTransaction::CFileTransaction(const String& strFolder) : m_strFolder(strFolder)
93
+ {
94
+ }
95
+
96
+ unsigned int CFileTransaction::start()
97
+ {
98
+ CRhoFile::createFolder((m_strFolder + "_temp_journal").c_str());
99
+
100
+ m_nError = CRhoFile::copyFoldersContentToAnotherFolder( CFilePath::join(m_strFolder, "").c_str(), (m_strFolder + "_temp_journal").c_str() );
101
+ if (m_nError)
102
+ {
103
+ m_strError = "Unable to copy folder: " + m_strFolder + " to : " + m_strFolder + "_temp_journal";
104
+ return m_nError;
105
+ }
106
+
107
+ m_nError = CRhoFile::renameFile( (m_strFolder + "_temp_journal").c_str(), (m_strFolder + "_journal").c_str());
108
+ if (m_nError)
109
+ {
110
+ m_strError = "Unable to rename folder: " + m_strFolder + "_temp_journal to : " + m_strFolder + "_journal";
111
+ return m_nError;
112
+ }
113
+
114
+ return m_nError;
115
+ }
116
+
117
+ CFileTransaction::~CFileTransaction()
118
+ {
119
+ rollback();
120
+ }
121
+
122
+ void CFileTransaction::commit()
123
+ {
124
+ String strFolder = m_strFolder;
125
+
126
+ m_nError = CRhoFile::renameFile( (strFolder + "_journal").c_str(), (strFolder + "_temp_journal").c_str() );
127
+ if (m_nError)
128
+ {
129
+ m_strError = "Unable to rename folder: " + strFolder + "_journal to : " + strFolder + "_temp_journal";
130
+ return;
131
+ }
132
+ m_strFolder = "";
133
+
134
+ m_nError = CRhoFile::deleteFolder( (strFolder + "_temp_journal").c_str() );
135
+ if (m_nError)
136
+ {
137
+ m_strError = "Unable to delete folder: " + strFolder + "_temp_journal";
138
+ return;
139
+ }
140
+
141
+ }
142
+
143
+ unsigned int CFileTransaction::rollback()
144
+ {
145
+ String strFolder = m_strFolder;
146
+ m_strFolder = "";
147
+
148
+ if ( strFolder.length() == 0 )
149
+ return 0;
150
+
151
+ CRhoFile::deleteFolder( CFilePath(strFolder).changeBaseName("RhoBundle").c_str() );
152
+ CRhoFile::deleteFolder( (strFolder + "_temp_journal").c_str() );
153
+
154
+ if ( !CRhoFile::isFileExist((strFolder + "_journal").c_str()) )
155
+ return 0;
156
+
157
+ m_nError = CRhoFile::deleteFolder( (strFolder).c_str() );
158
+ if (m_nError)
159
+ {
160
+ m_strError = "Unable to delete folder: " + strFolder;
161
+ CReplaceBundleThread::showError(m_nError, m_strError);
162
+ return m_nError;
163
+ }
164
+
165
+ m_nError = CRhoFile::renameFile( (strFolder + "_journal").c_str(), (strFolder).c_str() );
166
+ if (m_nError)
167
+ {
168
+ m_strError = "Unable to rename folder: " + strFolder + "_journal" + " to : " + strFolder;
169
+ CReplaceBundleThread::showError(m_nError, m_strError);
170
+ return m_nError;
171
+ }
172
+
173
+ return m_nError;
174
+ }
175
+
176
+ unsigned int CReplaceBundleThread::removeFilesByList( const String& strListPath, const String& strSrcFolder )
177
+ {
178
+ unsigned int nError = 0;
179
+ String strList;
180
+ CRhoFile::loadTextFile(strListPath.c_str(), strList);
181
+
182
+ CTokenizer oTokenizer( strList, "\n" );
183
+ while (oTokenizer.hasMoreTokens())
184
+ {
185
+ String strLine = oTokenizer.nextToken();
186
+
187
+ CTokenizer oLineTok( strLine, "\t" );
188
+ if ( !oLineTok.hasMoreTokens() )
189
+ continue;
190
+ String strPath = oLineTok.nextToken();
191
+ if ( !oLineTok.hasMoreTokens() )
192
+ continue;
193
+ String strType = oLineTok.nextToken();
194
+
195
+ if ( strType.compare("file") == 0)
196
+ {
197
+ nError = CRhoFile::deleteFile( CFilePath::join( strSrcFolder,strPath).c_str() );
198
+ if (nError != 0)
199
+ {
200
+ LOG(ERROR) + "Cannot remove file: " + CFilePath::join( strSrcFolder,strPath);
201
+ break;
202
+ }
203
+ }
204
+ }
205
+
206
+ return nError;
207
+ }
208
+
209
+ unsigned int CReplaceBundleThread::moveFilesByList( const String& strListPath, const String& strSrcFolder, const String& strDestFolder )
210
+ {
211
+ unsigned int nError = 0;
212
+ String strList;
213
+ CRhoFile::loadTextFile(strListPath.c_str(), strList);
214
+
215
+ CTokenizer oTokenizer( strList, "\n" );
216
+ while (oTokenizer.hasMoreTokens())
217
+ {
218
+ String strLine = oTokenizer.nextToken();
219
+
220
+ CTokenizer oLineTok( strLine, "\t" );
221
+ if ( !oLineTok.hasMoreTokens() )
222
+ continue;
223
+ String strPath = oLineTok.nextToken();
224
+ if ( !oLineTok.hasMoreTokens() )
225
+ continue;
226
+ String strType = oLineTok.nextToken();
227
+ String strSrcPath = CFilePath::join( strSrcFolder,strPath);
228
+ String strDstPath = CFilePath::join( strDestFolder, strPath );
229
+
230
+ if ( strType.compare("dir") == 0)
231
+ {
232
+ CRhoFile::createFolder(strDstPath.c_str());
233
+ }else if ( strType.compare("file") == 0)
234
+ {
235
+ nError = CRhoFile::renameFile( strSrcPath.c_str(), strDstPath.c_str() );
236
+ if (nError != 0)
237
+ {
238
+ LOG(ERROR) + "Cannot rename file from : " + strSrcPath + "; to: " + strDstPath;
239
+ break;
240
+ }
241
+ }
242
+ }
243
+
244
+ return nError;
245
+ }
246
+
247
+ void CReplaceBundleThread::showError(int nError, const String& strError )
248
+ {
249
+ LOG(ERROR) + "Error happen when replace bundle: " + strError + "; Code: " + LOGFMT("%d") + nError;
250
+
251
+ String strMsg = "Error happen when replace bundle: " + strError;
252
+
253
+ rho_sys_impl_exit_with_errormessage("Bundle update", strMsg.c_str());
254
+ }
255
+
256
+ void CReplaceBundleThread::run()
257
+ {
258
+ //Stop application
259
+ rho_rhodesapp_callAppActiveCallback(0);
260
+ rho_rhodesapp_callUiDestroyedCallback();
261
+ RHODESAPP().stopApp();
262
+
263
+ doReplaceBundle();
264
+
265
+ rho_platform_restart_application();
266
+ rho_sys_app_exit();
267
+ }
268
+
269
+ void CReplaceBundleThread::doReplaceBundle()
270
+ {
271
+ CFileTransaction oFT( RHODESAPP().getAppRootPath());
272
+ if (oFT.start())
273
+ {
274
+ showError(oFT.getError(), oFT.getErrorText());
275
+ return;
276
+ }
277
+
278
+ //Remove current files
279
+ unsigned int nError = removeFilesByList( CFilePath::join( RHODESAPP().getAppRootPath(), "rhofilelist.txt"), ::RHODESAPP().getAppRootPath() );
280
+ if ( nError != 0 )
281
+ {
282
+ showError(nError, "Remove files from bundle failed." );
283
+ return;
284
+ }
285
+
286
+ LOG(INFO) + "START";
287
+ //Copy new bundle
288
+ //nError = CRhoFile::moveFoldersContentToAnotherFolder( CFilePath::join(m_bundle_path, "RhoBundle/apps").c_str(), ::RHODESAPP().getAppRootPath().c_str() );
289
+ nError = moveFilesByList( CFilePath::join(m_bundle_path, "RhoBundle/apps/rhofilelist.txt").c_str(), CFilePath::join(m_bundle_path, "RhoBundle/apps"), ::RHODESAPP().getAppRootPath().c_str() );
290
+ if ( nError != 0 )
291
+ {
292
+ showError(nError, "Copy files to bundle failed." );
293
+ return;
294
+ }
295
+ LOG(INFO) + "STOP";
296
+ oFT.commit();
297
+
298
+ //Delete bundle folder
299
+ CRhoFile::deleteFolder( m_bundle_path.c_str());
300
+ }
301
+
302
+ }
303
+ }
304
+
305
+ extern "C"
306
+ {
307
+
308
+ void rho_sys_replace_current_bundle(const char* path)
309
+ {
310
+ new CReplaceBundleThread(path);
311
+ }
312
+
313
+ int rho_sys_check_rollback_bundle(const char* szRhoPath)
314
+ {
315
+ CFileTransaction oFT( CFilePath::join(szRhoPath, "apps") );
316
+ return oFT.rollback() != 0 ? 0 : 1;
317
+ }
318
+
319
+ int rho_sys_delete_folder(const char* szRhoPath)
320
+ {
321
+ return CRhoFile::deleteFolder(szRhoPath);
322
+ }
323
+
324
+ } //extern "C"
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
@@ -29,9 +29,29 @@
29
29
  #include "common/Tokenizer.h"
30
30
  #include "common/RhoFilePath.h"
31
31
 
32
+ #if defined(WINDOWS_PLATFORM)
33
+ extern "C" int _mkdir(const char * dir);
34
+ extern "C" int _unlink(const char *path);
35
+ #endif
36
+
37
+ #if defined(OS_WINCE)
38
+ extern "C" int _rename(const char *, const char *);
39
+ #elif defined(OS_WINDOWS)
40
+ extern "C" int rename(const char *, const char *);
41
+ #endif
42
+
32
43
  namespace rho{
33
44
  namespace common{
34
45
 
46
+ static wchar_t * translate_wchar(wchar_t *p, int from, int to)
47
+ {
48
+ for (; *p; p++) {
49
+ if (*p == from)
50
+ *p = to;
51
+ }
52
+ return p;
53
+ }
54
+
35
55
  class CFileInputStream : public InputStream
36
56
  {
37
57
  CRhoFile& m_oFile;
@@ -196,13 +216,11 @@ void CRhoFile::loadTextFile(const char* szFilePath, String& strFile)
196
216
  oFile.readString(strFile);
197
217
  }
198
218
 
199
- void CRhoFile::deleteFile( const char* szFilePath ){
219
+ unsigned int CRhoFile::deleteFile( const char* szFilePath ){
200
220
  #if defined(OS_WINDOWS) || defined(OS_WINCE)
201
- StringW wFileName;
202
- common::convertToStringW(szFilePath,wFileName);
203
- DeleteFileW(wFileName.c_str());
221
+ return (unsigned int)_unlink(szFilePath);
204
222
  #else
205
- remove(szFilePath);
223
+ return (unsigned int)remove(szFilePath);
206
224
  #endif
207
225
  }
208
226
 
@@ -220,32 +238,27 @@ void CRhoFile::deleteFilesInFolder(const char* szFolderPath)
220
238
  if (hFind == INVALID_HANDLE_VALUE)
221
239
  return;
222
240
 
223
- while (FindNextFileW(hFind, &FindFileData) != 0)
224
- {
241
+ do{
225
242
  if ( FindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY )
226
243
  continue;
227
244
 
228
245
  StringW wFileName = wFolderName + L"/" + FindFileData.cFileName;
229
246
  DeleteFileW(wFileName.c_str());
230
- }
247
+ }while (FindNextFileW(hFind, &FindFileData) != 0);
231
248
 
232
249
  FindClose(hFind);
233
250
 
234
251
  #else
235
- delete_files_in_folder(szFolderPath);
252
+ rho_file_impl_delete_files_in_folder(szFolderPath);
236
253
  #endif
237
254
  }
238
255
 
239
- #if defined(WINDOWS_PLATFORM)
240
- extern "C" int _mkdir(const char * dir);
241
- #endif
242
-
243
- /*static*/ void CRhoFile::createFolder(const char* szFolderPath)
256
+ /*static*/ unsigned int CRhoFile::createFolder(const char* szFolderPath)
244
257
  {
245
258
  #if defined(WINDOWS_PLATFORM)
246
- _mkdir(szFolderPath);
259
+ return _mkdir(szFolderPath);
247
260
  #else
248
- mkdir(szFolderPath, S_IRWXU);
261
+ return mkdir(szFolderPath, S_IRWXU);
249
262
  #endif
250
263
  }
251
264
 
@@ -262,16 +275,13 @@ void CRhoFile::deleteFilesInFolder(const char* szFolderPath)
262
275
  }
263
276
  }
264
277
 
265
- /*static*/ void CRhoFile::renameFile( const char* szOldFilePath, const char* szNewFilePath )
278
+ /*static*/ unsigned int CRhoFile::renameFile( const char* szOldFilePath, const char* szNewFilePath )
266
279
  {
267
- #if defined(OS_WINDOWS) || defined(OS_WINCE)
268
- StringW wNewFileName, wOldFileName;
269
- common::convertToStringW(szNewFilePath,wNewFileName);
270
- common::convertToStringW(szOldFilePath,wOldFileName);
280
+ #if defined(OS_WINCE)
281
+ return _rename( szOldFilePath, szNewFilePath );
271
282
 
272
- BOOL res = MoveFileW( wOldFileName.c_str(), wNewFileName.c_str());
273
283
  #else
274
- rename( szOldFilePath, szNewFilePath );
284
+ return rename( szOldFilePath, szNewFilePath );
275
285
  #endif
276
286
 
277
287
  }
@@ -295,6 +305,179 @@ void CRhoFile::deleteFilesInFolder(const char* szFolderPath)
295
305
  oFile.close();
296
306
  }
297
307
  }
308
+
309
+ /*static*/ unsigned int CRhoFile::copyFile(const char* szSrcFile, const char* szDstFile) {
310
+
311
+ CRhoFile src;
312
+ CRhoFile dst;
313
+
314
+ if (!src.open(szSrcFile, OpenReadOnly)) {
315
+ return -1;
316
+ }
317
+ if (!dst.open(szDstFile, OpenForWrite)) {
318
+ return -1;
319
+ }
320
+
321
+ int buf_size = 1 << 16;
322
+ unsigned char* buf = new unsigned char[buf_size];
323
+
324
+ unsigned int to_copy = src.size();
325
+
326
+ while (to_copy > 0) {
327
+ int portion_size = buf_size;
328
+ if (to_copy < portion_size) {
329
+ portion_size = to_copy;
330
+ }
331
+ src.readData(buf, 0, portion_size);
332
+ dst.write(buf, portion_size);
333
+
334
+ to_copy -= portion_size;
335
+ }
336
+
337
+ src.close();
338
+ dst.flush();
339
+ dst.close();
340
+
341
+ delete buf;
298
342
 
343
+ return 0;
299
344
  }
345
+
346
+ /*static*/ unsigned int CRhoFile::deleteFolder(const char* szFolderPath)
347
+ {
348
+ #if defined(OS_WINDOWS) || defined(OS_WINCE)
349
+
350
+ StringW swPath;
351
+ convertToStringW(szFolderPath, swPath);
352
+ wchar_t* name = new wchar_t[ swPath.length() + 2];
353
+ swprintf(name, L"%s%c", swPath.c_str(), '\0');
354
+ translate_wchar(name, L'/', L'\\');
355
+
356
+ SHFILEOPSTRUCTW fop = {0};
357
+
358
+ fop.hwnd = NULL;
359
+ fop.wFunc = FO_DELETE;
360
+ fop.pFrom = name;
361
+ fop.pTo = NULL;
362
+ fop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR
363
+ #if defined(OS_WINDOWS) || defined(OS_PLATFORM_MOTCE)
364
+ | FOF_NOERRORUI
365
+ #endif
366
+ ;
367
+ int result = SHFileOperationW(&fop);
368
+
369
+ delete name;
370
+
371
+ return result == 0 ? 0 : (unsigned int)-1;
372
+ #else
373
+ rho_file_impl_delete_folder(szFolderPath);
374
+ return 0;
375
+ #endif
376
+
300
377
  }
378
+
379
+ #if defined(OS_WINDOWS) || defined(OS_WINCE)
380
+ static unsigned int copyFolder(const StringW& strSrc, const StringW& strDst, boolean bMove)
381
+ {
382
+ unsigned int nErr = 0;
383
+
384
+ CRhoFile::createFolder(convertToStringA(strDst).c_str());
385
+
386
+ StringW wFolderMask = CFilePath::join(strSrc, L"*");
387
+
388
+ WIN32_FIND_DATAW FindFileData = {0};
389
+ HANDLE hFind = INVALID_HANDLE_VALUE;
390
+
391
+ hFind = FindFirstFileW(wFolderMask.c_str(), &FindFileData);
392
+ if (hFind == INVALID_HANDLE_VALUE)
393
+ return GetLastError();
394
+
395
+ do{
396
+ if (!wcscmp(FindFileData.cFileName , L".")) continue ;
397
+ if (!wcscmp(FindFileData.cFileName , L"..")) continue ;
398
+
399
+ if ( FindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY )
400
+ {
401
+ int i = 0;
402
+ nErr = copyFolder( CFilePath::join(strSrc,FindFileData.cFileName), CFilePath::join(strDst,FindFileData.cFileName), bMove );
403
+ }
404
+ else
405
+ {
406
+ if ( bMove )
407
+ {
408
+ CRhoFile::deleteFile(convertToStringA(CFilePath::join(strDst,FindFileData.cFileName)).c_str());
409
+ nErr = CRhoFile::renameFile(convertToStringA(CFilePath::join(strSrc,FindFileData.cFileName)).c_str(), convertToStringA(CFilePath::join(strDst,FindFileData.cFileName)).c_str());
410
+ }
411
+ else
412
+ nErr = CRhoFile::copyFile( convertToStringA(CFilePath::join(strSrc,FindFileData.cFileName)).c_str(), convertToStringA(CFilePath::join(strDst,FindFileData.cFileName)).c_str() );
413
+ }
414
+
415
+ if ( nErr != 0 )
416
+ return nErr;
417
+ }while (FindNextFileW(hFind, &FindFileData) != 0);
418
+
419
+ FindClose(hFind);
420
+
421
+ return 0;
422
+ }
423
+ #endif
424
+
425
+ /*static*/ unsigned int CRhoFile::copyFoldersContentToAnotherFolder(const char* szSrcFolderPath, const char* szDstFolderPath)
426
+ {
427
+ #if defined(OS_WINDOWS) || defined(OS_WINCE)
428
+
429
+ StringW strSrcW, strDstW;
430
+ common::convertToStringW(szSrcFolderPath,strSrcW);
431
+ common::convertToStringW(szDstFolderPath,strDstW);
432
+ String_replace(strSrcW, L'/', L'\\' );
433
+ String_replace(strDstW, L'/', L'\\' );
434
+
435
+ return copyFolder(strSrcW, strDstW, false);
436
+ #else
437
+ rho_file_impl_copy_folders_content_to_another_folder(szSrcFolderPath, szDstFolderPath);
438
+ return 0;
439
+ #endif
440
+ }
441
+
442
+ /*static*/ unsigned int CRhoFile::moveFoldersContentToAnotherFolder(const char* szSrcFolderPath, const char* szDstFolderPath)
443
+ {
444
+ #if defined(OS_WINDOWS) || defined(OS_WINCE)
445
+
446
+ StringW strSrcW, strDstW;
447
+ common::convertToStringW(szSrcFolderPath,strSrcW);
448
+ common::convertToStringW(szDstFolderPath,strDstW);
449
+ String_replace(strSrcW, L'/', L'\\' );
450
+ String_replace(strDstW, L'/', L'\\' );
451
+
452
+ return copyFolder(strSrcW, strDstW, true);
453
+
454
+ #else
455
+ rho_file_impl_move_folders_content_to_another_folder(szSrcFolderPath, szDstFolderPath);
456
+ return 0;
457
+ #endif
458
+ }
459
+
460
+ }
461
+ }
462
+
463
+ #if defined(OS_MACOSX) || defined(OS_ANDROID)
464
+ void rho_file_impl_move_folders_content_to_another_folder(const char* szSrcFolderPath, const char* szDstFolderPath) {
465
+
466
+ }
467
+ #else
468
+ extern "C" {
469
+
470
+ void rho_file_impl_delete_folder(const char* szFolderPath) {
471
+
472
+ }
473
+
474
+ void rho_file_impl_copy_folders_content_to_another_folder(const char* szSrcFolderPath, const char* szDstFolderPath) {
475
+
476
+ }
477
+
478
+ void rho_file_impl_move_folders_content_to_another_folder(const char* szSrcFolderPath, const char* szDstFolderPath) {
479
+
480
+ }
481
+
482
+ }
483
+ #endif