rhodes 1.5.5 → 2.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (529) hide show
  1. data/CHANGELOG +5 -0
  2. data/Manifest.txt +214 -32
  3. data/Rakefile +33 -10
  4. data/bin/upgrade-rhodes-app +0 -1
  5. data/lib/build/compileERB/bb.rb +2 -2
  6. data/lib/build/compileERB/default.rb +7 -5
  7. data/lib/build/jake.rb +1 -1
  8. data/lib/extensions/digest-md5/ext.yml +1 -1
  9. data/lib/extensions/digest-md5/ext/Rakefile +35 -36
  10. data/lib/extensions/digest-md5/ext/build.bat +1 -0
  11. data/lib/extensions/digest-md5/ext/digest-md5.vcproj +203 -0
  12. data/lib/extensions/digest-sha1/ext.yml +1 -1
  13. data/lib/extensions/digest/ext.yml +1 -1
  14. data/lib/extensions/digest/ext/Rakefile +35 -39
  15. data/lib/extensions/digest/ext/build.bat +1 -2
  16. data/lib/extensions/digest/ext/digest.vcproj +203 -0
  17. data/lib/framework/rho/render.rb +79 -22
  18. data/lib/framework/rho/rho.rb +294 -56
  19. data/lib/framework/rho/rhoapplication.rb +10 -0
  20. data/lib/framework/rho/rhofsconnector.rb +2 -6
  21. data/lib/framework/rho/rhoutils.rb +56 -14
  22. data/lib/framework/rho/rhoviewhelpers.rb +2 -0
  23. data/lib/framework/rhodes.rb +2 -2
  24. data/lib/framework/rhom/rhom.rb +42 -15
  25. data/lib/framework/rhom/rhom_db_adapter.rb +165 -159
  26. data/lib/framework/rhom/rhom_object.rb +0 -1
  27. data/lib/framework/rhom/rhom_object_factory.rb +343 -166
  28. data/lib/framework/rhom/rhom_source.rb +28 -15
  29. data/lib/framework/version.rb +2 -2
  30. data/lib/rhodes.rb +2 -2
  31. data/platform/android/Rhodes/AndroidManifest.xml +2 -2
  32. data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +39 -44
  33. data/platform/android/Rhodes/jni/include/JNIRhodes.h +1 -1
  34. data/platform/android/Rhodes/jni/include/details/rhojava.inc +23 -20
  35. data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_RhoMenu.h +61 -0
  36. data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_Rhodes.h +16 -0
  37. data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_alert_Alert.h +21 -0
  38. data/platform/android/Rhodes/jni/include/sslimpl.h +1 -1
  39. data/platform/android/Rhodes/jni/src/alert.cpp +32 -5
  40. data/platform/android/Rhodes/jni/src/callbacks.cpp +51 -21
  41. data/platform/android/Rhodes/jni/src/mapview.cpp +3 -8
  42. data/platform/android/Rhodes/jni/src/menu.cpp +70 -0
  43. data/platform/android/Rhodes/jni/src/navbar.cpp +16 -0
  44. data/platform/android/Rhodes/jni/src/rhodes.cpp +37 -0
  45. data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -3
  46. data/platform/android/Rhodes/jni/src/webview.cpp +21 -7
  47. data/platform/android/Rhodes/res/drawable/alert_alert.png +0 -0
  48. data/platform/android/Rhodes/res/drawable/alert_info.png +0 -0
  49. data/platform/android/Rhodes/res/drawable/alert_question.png +0 -0
  50. data/platform/android/Rhodes/res/drawable/camera.png +0 -0
  51. data/platform/android/Rhodes/res/layout/camera.xml +18 -3
  52. data/platform/android/Rhodes/res/menu/options.xml +0 -10
  53. data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +5 -10
  54. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +12 -0
  55. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +105 -0
  56. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +157 -122
  57. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +7 -58
  58. data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +16 -0
  59. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +220 -17
  60. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +22 -4
  61. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +44 -25
  62. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +10 -0
  63. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +3 -0
  64. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +10 -21
  65. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +15 -12
  66. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +44 -0
  67. data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +47 -3
  68. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +13 -6
  69. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/TelUriHandler.java +11 -5
  70. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java +1 -4
  71. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/VideoUriHandler.java +61 -0
  72. data/platform/android/build/RhodesSRC_build.files +3 -0
  73. data/platform/android/build/android.rake +173 -60
  74. data/platform/android/build/androidcommon.rb +1 -2
  75. data/platform/android/build/librhocommon_build.files +5 -0
  76. data/platform/android/build/librhodes_build.files +2 -0
  77. data/platform/android/build/libruby_build.files +2 -1
  78. data/platform/bb/Hsqldb/Hsqldb.jdp +0 -3
  79. data/platform/bb/Hsqldb/src/com/rho/db/FileUtilBB.java +1 -1
  80. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +16 -1
  81. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBRowResult.java +5 -0
  82. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +25 -4
  83. data/platform/bb/Hsqldb/src/com/rho/db/Journal.java +1 -1
  84. data/platform/bb/Hsqldb/src/com/rho/file/FileAccessBB.java +0 -1
  85. data/platform/bb/Hsqldb/src/j2me/math/Number.java +6 -3
  86. data/platform/bb/Hsqldb/src/org/hsqldb/CompiledStatementExecutor.java +2 -1
  87. data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +1 -0
  88. data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +1 -0
  89. data/platform/bb/Hsqldb/src/org/hsqldb/Result.java +2 -0
  90. data/platform/bb/Hsqldb/src/org/hsqldb/Select.java +12 -6
  91. data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +19 -12
  92. data/platform/bb/Hsqldb/src/org/hsqldb/Table.java +10 -4
  93. data/platform/bb/Hsqldb/src/org/hsqldb/Token.java +10 -2
  94. data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +3 -3
  95. data/platform/bb/Hsqldb/src/org/hsqldb/lib/java/JavaSystem.java +1 -1
  96. data/platform/bb/Hsqldb/src/org/hsqldb/persist/HsqlProperties.java +2 -1
  97. data/platform/bb/Hsqldb/src/org/hsqldb/persist/ScaledRAFile.java +1 -1
  98. data/platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptReaderText.java +1 -1
  99. data/platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptWriterBase.java +1 -1
  100. data/platform/bb/RubyVM/RubyVM.jdp +9 -10
  101. data/platform/bb/build/RubyVM_build.files +9 -7
  102. data/platform/bb/build/bb.rake +13 -3
  103. data/platform/bb/build/hsqldb_build.files +0 -2
  104. data/platform/bb/build/rhodes_build.files +5 -2
  105. data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +8 -0
  106. data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +154 -0
  107. data/platform/bb/rhodes/platform/5.0/com/rho/RhoMainScreen.java +8 -0
  108. data/platform/bb/rhodes/platform/common/com/rho/BrowserAdapter5.java +28 -0
  109. data/platform/bb/rhodes/rhodes.jdp +12 -7
  110. data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +331 -0
  111. data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +28 -0
  112. data/platform/bb/rhodes/src/com/rho/IBrowserAdapter.java +10 -0
  113. data/platform/bb/rhodes/src/com/rho/RhoMainScreen.java +4 -0
  114. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +2 -4
  115. data/platform/bb/rhodes/src/com/rho/{Jsr75File.java → file/Jsr75File.java} +83 -36
  116. data/platform/bb/{Hsqldb → rhodes}/src/com/rho/file/Jsr75RAFileImpl.java +0 -1
  117. data/platform/bb/{Hsqldb → rhodes}/src/com/rho/file/PersistRAFileImpl.java +0 -2
  118. data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +8 -10
  119. data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +1 -1
  120. data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +39 -0
  121. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +63 -2
  122. data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +100 -0
  123. data/platform/bb/rhodes/src/rhomobile/LogScreen.java +1 -1
  124. data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +13 -1
  125. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +138 -492
  126. data/platform/bb/rhodes/src/rhomobile/SecondaryResourceFetchThread.java +11 -2
  127. data/platform/bb/rhodes/src/rhomobile/Utilities.java +14 -10
  128. data/platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java +5 -14
  129. data/platform/bb/rhodes/src/rhomobile/camera/ImageBrowserScreen.java +1 -1
  130. data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +2 -2
  131. data/platform/iphone/Classes/AppManager/AppManager.m +37 -14
  132. data/platform/iphone/Classes/Camera/PickImageDelegate.h +15 -4
  133. data/platform/iphone/Classes/Camera/PickImageDelegate.m +53 -50
  134. data/platform/iphone/Classes/DateTimePicker.h +17 -0
  135. data/platform/iphone/Classes/DateTimePicker.m +35 -0
  136. data/platform/iphone/Classes/GeoLocation/LocationController.m +2 -3
  137. data/platform/iphone/Classes/LogOptionsController.m +3 -2
  138. data/platform/iphone/Classes/LogViewController.m +4 -2
  139. data/platform/iphone/Classes/MapView/GoogleGeocoder.m +12 -20
  140. data/platform/iphone/Classes/MapView/MapAnnotation.h +9 -13
  141. data/platform/iphone/Classes/MapView/MapAnnotation.m +17 -65
  142. data/platform/iphone/Classes/MapView/MapViewController.h +1 -7
  143. data/platform/iphone/Classes/MapView/MapViewController.m +51 -25
  144. data/platform/iphone/Classes/NativeBar.h +0 -12
  145. data/platform/iphone/Classes/NativeBar.m +121 -2
  146. data/platform/iphone/Classes/NavBar.h +16 -0
  147. data/platform/iphone/Classes/NavBar.m +115 -0
  148. data/platform/iphone/Classes/RhoAlert.h +19 -0
  149. data/platform/iphone/Classes/RhoAlert.m +258 -0
  150. data/platform/iphone/Classes/RhoDelegate.m +1 -0
  151. data/platform/iphone/Classes/RhoMainView.h +33 -0
  152. data/platform/iphone/Classes/Rhodes.h +56 -0
  153. data/platform/iphone/Classes/Rhodes.m +533 -0
  154. data/platform/iphone/Classes/RingtoneManager.h +17 -0
  155. data/platform/iphone/Classes/RingtoneManager.m +73 -0
  156. data/platform/iphone/Classes/SimpleMainView.h +30 -0
  157. data/platform/iphone/Classes/SimpleMainView.m +380 -0
  158. data/platform/iphone/Classes/TabbedMainView.h +24 -0
  159. data/platform/iphone/Classes/TabbedMainView.m +202 -0
  160. data/platform/iphone/Classes/WebView.m +123 -0
  161. data/platform/iphone/Classes/rho/net/NetRequestImpl.m +2 -2
  162. data/platform/iphone/Classes/rho/net/sslimpl.cpp +13 -1
  163. data/platform/iphone/Classes/rho/net/sslimpl.h +1 -1
  164. data/platform/iphone/Info.plist +1 -1
  165. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +44 -0
  166. data/platform/iphone/main.m +1 -2
  167. data/platform/iphone/rbuild/iphone.rake +8 -16
  168. data/platform/iphone/rhoextlib/dosyscall.c +1 -1
  169. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +6 -4
  170. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +12 -0
  171. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +97 -62
  172. data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +12 -0
  173. data/platform/osx/Rhodes Launcher/launch.rb +14 -21
  174. data/platform/shared/common/AppMenu.cpp +122 -0
  175. data/platform/shared/common/AppMenu.h +46 -0
  176. data/platform/shared/common/PosixThreadImpl.cpp +1 -1
  177. data/platform/shared/common/RhoConf.cpp +27 -2
  178. data/platform/shared/common/RhoConf.h +5 -0
  179. data/platform/shared/common/RhoFilePath.h +21 -0
  180. data/platform/shared/common/RhoStd.h +44 -5
  181. data/platform/shared/common/RhoTime.h +20 -7
  182. data/platform/shared/common/RhodesApp.cpp +236 -177
  183. data/platform/shared/common/RhodesApp.h +36 -13
  184. data/platform/shared/common/SplashScreen.cpp +2 -2
  185. data/platform/shared/common/StringConverter.h +10 -11
  186. data/platform/shared/common/rhoparams.c +0 -6
  187. data/platform/shared/curl/lib/rhossl.c +3 -2
  188. data/platform/shared/curl/lib/url.c +0 -5
  189. data/platform/shared/db/DBAdapter.cpp +304 -81
  190. data/platform/shared/db/DBAdapter.h +24 -7
  191. data/platform/shared/db/DBAttrManager.cpp +83 -30
  192. data/platform/shared/db/DBAttrManager.h +6 -0
  193. data/platform/shared/db/DBResult.h +15 -4
  194. data/platform/shared/json/JSONIterator.cpp +100 -3
  195. data/platform/shared/json/JSONIterator.h +28 -3
  196. data/platform/shared/net/AsyncHttp.cpp +25 -22
  197. data/platform/shared/net/AsyncHttp.h +10 -6
  198. data/platform/shared/net/CURLNetRequest.cpp +115 -36
  199. data/platform/shared/net/CURLNetRequest.h +6 -0
  200. data/platform/shared/net/HttpServer.cpp +6 -4
  201. data/platform/shared/net/HttpServer.h +0 -1
  202. data/platform/shared/net/INetRequest.h +19 -3
  203. data/platform/shared/net/URI.cpp +2 -2
  204. data/platform/shared/net/ssl.cpp +2 -2
  205. data/platform/shared/net/ssl.h +2 -2
  206. data/platform/shared/ruby/ext/alert/alert.i +14 -2
  207. data/platform/shared/ruby/ext/alert/alert_wrap.c +40 -20
  208. data/platform/shared/ruby/ext/asynchttp/asynchttp.i +8 -8
  209. data/platform/shared/ruby/ext/asynchttp/asynchttp_wrap.c +112 -16
  210. data/platform/shared/ruby/ext/geolocation/geolocation.i +16 -12
  211. data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +481 -125
  212. data/platform/shared/ruby/ext/navbar/navbar.i +20 -0
  213. data/platform/shared/ruby/ext/navbar/navbar_wrap.c +1859 -0
  214. data/platform/shared/ruby/ext/rho/extensions.c +1 -1
  215. data/platform/shared/ruby/ext/rho/rhoruby.c +32 -2
  216. data/platform/shared/ruby/ext/rho/rhoruby.h +7 -2
  217. data/platform/shared/ruby/ext/rhoconf/rhoconf.i +4 -0
  218. data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +31 -0
  219. data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +188 -3226
  220. data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -25
  221. data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +96 -104
  222. data/platform/shared/ruby/ext/system/system.i +12 -0
  223. data/platform/shared/ruby/ext/system/system_wrap.c +101 -7
  224. data/platform/shared/ruby/ext/webview/webview.i +20 -15
  225. data/platform/shared/ruby/ext/webview/webview_wrap.c +42 -16
  226. data/platform/shared/ruby/thread_pthread.c +4 -4
  227. data/platform/shared/ruby/thread_win32.c +4 -4
  228. data/platform/shared/ruby/wince/io_wce.c +0 -1
  229. data/platform/shared/rubyJVM/src/com/rho/FilePath.java +18 -2
  230. data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +1 -0
  231. data/platform/shared/rubyJVM/src/com/rho/Properties.java +9 -0
  232. data/platform/shared/rubyJVM/src/com/rho/RhoClassFactory.java +2 -3
  233. data/platform/shared/rubyJVM/src/com/rho/RhoConf.java +47 -8
  234. data/platform/shared/rubyJVM/src/com/rho/RhoLogConf.java +1 -0
  235. data/platform/shared/rubyJVM/src/com/rho/RhoLogFileSink.java +1 -0
  236. data/platform/shared/rubyJVM/src/com/rho/RhoRuby.java +43 -5
  237. data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +98 -3
  238. data/platform/shared/rubyJVM/src/com/rho/db/DBAdapter.java +460 -175
  239. data/platform/shared/rubyJVM/src/com/rho/db/DBAttrManager.java +81 -33
  240. data/platform/shared/rubyJVM/src/com/rho/db/IDBCallback.java +3 -5
  241. data/platform/shared/rubyJVM/src/com/rho/db/IDBResult.java +2 -0
  242. data/platform/shared/rubyJVM/src/com/rho/db/IDBStorage.java +2 -0
  243. data/platform/shared/rubyJVM/src/com/rho/{IFile.java → file/IFile.java} +1 -1
  244. data/platform/shared/rubyJVM/src/com/rho/{IFileAccess.java → file/IFileAccess.java} +1 -1
  245. data/platform/shared/rubyJVM/src/com/rho/{IRAFile.java → file/IRAFile.java} +1 -1
  246. data/platform/{bb/Hsqldb/src/com/rho/db → shared/rubyJVM/src/com/rho/file}/RandomAccessFile.java +1 -2
  247. data/platform/shared/rubyJVM/src/com/rho/{SimpleFile.java → file/SimpleFile.java} +5 -1
  248. data/platform/shared/rubyJVM/src/com/rho/net/AsyncHttp.java +23 -18
  249. data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +167 -250
  250. data/platform/shared/rubyJVM/src/com/rho/net/RhoConnection.java +100 -30
  251. data/platform/shared/rubyJVM/src/com/rho/net/URI.java +0 -1
  252. data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +30 -33
  253. data/platform/shared/rubyJVM/src/com/rho/sync/ISyncProtocol.java +20 -0
  254. data/platform/shared/rubyJVM/src/com/rho/sync/JSONEntry.java +5 -0
  255. data/platform/shared/rubyJVM/src/com/rho/sync/JSONStructIterator.java +74 -0
  256. data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +486 -257
  257. data/platform/shared/rubyJVM/src/com/rho/sync/SyncNotify.java +89 -58
  258. data/platform/shared/rubyJVM/src/com/rho/sync/SyncProtocol_3.java +79 -0
  259. data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +634 -495
  260. data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +74 -90
  261. data/platform/shared/rubyJVM/src/com/xruby/GeneratedMethods/RubySymbol_Methods.java +1 -0
  262. data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyThread.java +6 -0
  263. data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyRuntime.java +6 -2
  264. data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubySymbol.java +17 -1
  265. data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyValue.java +1 -0
  266. data/platform/shared/rubyJVM/src/org/json/me/JSONObject.java +3 -0
  267. data/platform/shared/rubyext/GeoLocation.cpp +23 -0
  268. data/platform/shared/rubyext/GeoLocation.h +2 -0
  269. data/platform/shared/rubyext/RhoRuby.cpp +31 -0
  270. data/platform/shared/rubyext/RhoRuby.h +32 -0
  271. data/platform/shared/rubyext/System.cpp +14 -3
  272. data/platform/shared/rubyext/WebView.h +21 -0
  273. data/platform/shared/sync/ClientRegister.cpp +23 -28
  274. data/platform/shared/sync/ClientRegister.h +6 -2
  275. data/platform/shared/sync/ISyncProtocol.h +29 -0
  276. data/platform/shared/sync/SyncEngine.cpp +450 -190
  277. data/platform/shared/sync/SyncEngine.h +28 -38
  278. data/platform/shared/sync/SyncNotify.cpp +43 -41
  279. data/platform/shared/sync/SyncNotify.h +7 -7
  280. data/platform/shared/sync/SyncProtocol_3.h +86 -0
  281. data/platform/shared/sync/SyncSource.cpp +535 -371
  282. data/platform/shared/sync/SyncSource.h +48 -55
  283. data/platform/shared/sync/SyncThread.cpp +59 -103
  284. data/platform/shared/sync/SyncThread.h +10 -23
  285. data/platform/shared/unzip/unzip.cpp +3 -2
  286. data/platform/shared/unzip/unzip.h +5 -1
  287. data/platform/shared/wtl80/include/atlapp.h +10 -10
  288. data/platform/wm/RhoLib/RhoLib.vcproj +32 -0
  289. data/platform/wm/build/build_inf.js +40 -3
  290. data/platform/wm/build/wm.rake +95 -9
  291. data/platform/wm/rhodes/Alert.cpp +4 -0
  292. data/platform/wm/rhodes/DateTimePicker.cpp +183 -0
  293. data/platform/wm/rhodes/DateTimePicker.h +100 -0
  294. data/platform/wm/rhodes/MainWindow.cpp +222 -209
  295. data/platform/wm/rhodes/MainWindow.h +28 -35
  296. data/platform/wm/rhodes/Rhodes.cpp +20 -60
  297. data/platform/wm/rhodes/Rhodes.rc +41 -7
  298. data/platform/wm/rhodes/Utils.cpp +65 -0
  299. data/platform/wm/rhodes/Utils.h +9 -0
  300. data/platform/wm/rhodes/camera/Camera.cpp +2 -2
  301. data/platform/wm/rhodes/menubar.cpp +2 -33
  302. data/platform/wm/rhodes/menubar.h +0 -14
  303. data/platform/wm/rhodes/resource.h +13 -11
  304. data/platform/wm/rhodes/rho/net/NetRequest.cpp +16 -35
  305. data/platform/wm/rhodes/rho/net/NetRequest.h +8 -2
  306. data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +264 -46
  307. data/platform/wm/rhodes/rho/net/NetRequestImpl.h +14 -4
  308. data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +1 -1
  309. data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.h +1 -1
  310. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +77 -4
  311. data/platform/wm/rhodes/rho/rubyext/WebView.cpp +63 -0
  312. data/platform/wm/rhodes/rhodes.vcproj +20 -66
  313. data/platform/wm/rhodes/stdafx.h +22 -0
  314. data/platform/wm/rubylib/rubylib.vcproj +4 -0
  315. data/platform/wm/syncengine/syncengine.vcproj +8 -0
  316. data/platform/wm/tools/detool.sln +66 -0
  317. data/platform/wm/tools/detool/DEMComInterface.tlb +0 -0
  318. data/platform/wm/tools/detool/ReadMe.txt +33 -0
  319. data/platform/wm/tools/detool/detool.cpp +559 -0
  320. data/platform/wm/tools/detool/detool.h +5 -0
  321. data/platform/wm/tools/detool/detool.vcproj +233 -0
  322. data/platform/wm/tools/detool/stdafx.cpp +8 -0
  323. data/platform/wm/tools/detool/stdafx.h +15 -0
  324. data/platform/wm/tools/detool/targetver.h +24 -0
  325. data/platform/wm/tools/rhosetup/ReadMe.txt +41 -0
  326. data/platform/wm/tools/rhosetup/rhosetup.cpp +52 -0
  327. data/platform/wm/tools/rhosetup/rhosetup.vcproj +641 -0
  328. data/platform/wm/tools/rhosetup/stdafx.cpp +8 -0
  329. data/platform/wm/tools/rhosetup/stdafx.h +59 -0
  330. data/rakefile.rb +33 -10
  331. data/res/build-tools/db/syncdb.schema +25 -23
  332. data/res/build-tools/db/syncdb.triggers +1 -1
  333. data/res/build-tools/detool.exe +0 -0
  334. data/res/build-tools/rhosetup.dll +0 -0
  335. data/res/generators/rhogen.rb +27 -22
  336. data/res/generators/templates/application/app/Settings/controller.rb +3 -1
  337. data/res/generators/templates/application/app/Settings/home.bb.erb +17 -0
  338. data/res/generators/templates/application/app/Settings/home.erb +21 -12
  339. data/res/generators/templates/application/app/Settings/index.bb.erb +32 -0
  340. data/res/generators/templates/application/app/Settings/index.erb +44 -15
  341. data/res/generators/templates/application/app/Settings/login.bb.erb +35 -0
  342. data/res/generators/templates/application/app/Settings/login.erb +29 -30
  343. data/res/generators/templates/application/app/Settings/reset.bb.erb +15 -0
  344. data/res/generators/templates/application/app/Settings/reset.erb +16 -13
  345. data/res/generators/templates/application/app/Settings/wait.bb.erb +3 -0
  346. data/res/generators/templates/application/app/Settings/wait.erb +4 -4
  347. data/res/generators/templates/application/app/application.rb +8 -0
  348. data/res/generators/templates/application/app/helpers/browser_helper.rb +13 -0
  349. data/res/generators/templates/application/app/index.bb.erb +26 -0
  350. data/res/generators/templates/application/app/index.erb +21 -12
  351. data/res/generators/templates/application/app/layout.erb +9 -11
  352. data/res/generators/templates/application/public/css/android.css +285 -0
  353. data/res/generators/templates/application/public/css/blackberry.css +85 -78
  354. data/res/generators/templates/application/public/css/iphone.css +286 -296
  355. data/res/generators/templates/application/public/css/webkit.css +34 -0
  356. data/res/generators/templates/application/public/css/windows_mobile.css +208 -0
  357. data/res/generators/templates/application/public/icons/Read me first - license.txt +14 -0
  358. data/res/generators/templates/application/public/icons/about.png +0 -0
  359. data/res/generators/templates/application/public/icons/airplane.png +0 -0
  360. data/res/generators/templates/application/public/icons/baby.png +0 -0
  361. data/res/generators/templates/application/public/icons/badge.png +0 -0
  362. data/res/generators/templates/application/public/icons/bandaid.png +0 -0
  363. data/res/generators/templates/application/public/icons/bar-chart.png +0 -0
  364. data/res/generators/templates/application/public/icons/battery.png +0 -0
  365. data/res/generators/templates/application/public/icons/beaker.png +0 -0
  366. data/res/generators/templates/application/public/icons/beaker2.png +0 -0
  367. data/res/generators/templates/application/public/icons/beermug.png +0 -0
  368. data/res/generators/templates/application/public/icons/bird.png +0 -0
  369. data/res/generators/templates/application/public/icons/book.png +0 -0
  370. data/res/generators/templates/application/public/icons/bookmark.png +0 -0
  371. data/res/generators/templates/application/public/icons/brightness.png +0 -0
  372. data/res/generators/templates/application/public/icons/bug.png +0 -0
  373. data/res/generators/templates/application/public/icons/cabinet.png +0 -0
  374. data/res/generators/templates/application/public/icons/calendar.png +0 -0
  375. data/res/generators/templates/application/public/icons/camera.png +0 -0
  376. data/res/generators/templates/application/public/icons/changeName.rb +22 -0
  377. data/res/generators/templates/application/public/icons/chat2.png +0 -0
  378. data/res/generators/templates/application/public/icons/chicken.png +0 -0
  379. data/res/generators/templates/application/public/icons/clock.png +0 -0
  380. data/res/generators/templates/application/public/icons/cloud.png +0 -0
  381. data/res/generators/templates/application/public/icons/coffee.png +0 -0
  382. data/res/generators/templates/application/public/icons/compass.png +0 -0
  383. data/res/generators/templates/application/public/icons/contrast.png +0 -0
  384. data/res/generators/templates/application/public/icons/dashboard.png +0 -0
  385. data/res/generators/templates/application/public/icons/display.png +0 -0
  386. data/res/generators/templates/application/public/icons/dogpaw.png +0 -0
  387. data/res/generators/templates/application/public/icons/download.png +0 -0
  388. data/res/generators/templates/application/public/icons/dumbbell.png +0 -0
  389. data/res/generators/templates/application/public/icons/ekg.png +0 -0
  390. data/res/generators/templates/application/public/icons/envelope.png +0 -0
  391. data/res/generators/templates/application/public/icons/equalizer.png +0 -0
  392. data/res/generators/templates/application/public/icons/eye.png +0 -0
  393. data/res/generators/templates/application/public/icons/film-roll.png +0 -0
  394. data/res/generators/templates/application/public/icons/flag.png +0 -0
  395. data/res/generators/templates/application/public/icons/fork-and-knife.png +0 -0
  396. data/res/generators/templates/application/public/icons/fuel.png +0 -0
  397. data/res/generators/templates/application/public/icons/gameplan.png +0 -0
  398. data/res/generators/templates/application/public/icons/gear.png +0 -0
  399. data/res/generators/templates/application/public/icons/gear2.png +0 -0
  400. data/res/generators/templates/application/public/icons/gift.png +0 -0
  401. data/res/generators/templates/application/public/icons/heart.png +0 -0
  402. data/res/generators/templates/application/public/icons/house.png +0 -0
  403. data/res/generators/templates/application/public/icons/inbox.png +0 -0
  404. data/res/generators/templates/application/public/icons/index-cards.png +0 -0
  405. data/res/generators/templates/application/public/icons/iphone.png +0 -0
  406. data/res/generators/templates/application/public/icons/ipod.png +0 -0
  407. data/res/generators/templates/application/public/icons/key.png +0 -0
  408. data/res/generators/templates/application/public/icons/lifebuoy.png +0 -0
  409. data/res/generators/templates/application/public/icons/lightbulb.png +0 -0
  410. data/res/generators/templates/application/public/icons/line-chart.png +0 -0
  411. data/res/generators/templates/application/public/icons/location.png +0 -0
  412. data/res/generators/templates/application/public/icons/lock.png +0 -0
  413. data/res/generators/templates/application/public/icons/loopback.png +0 -0
  414. data/res/generators/templates/application/public/icons/magnifying-glass.png +0 -0
  415. data/res/generators/templates/application/public/icons/map-marker.png +0 -0
  416. data/res/generators/templates/application/public/icons/map.png +0 -0
  417. data/res/generators/templates/application/public/icons/medical-bag.png +0 -0
  418. data/res/generators/templates/application/public/icons/medical.png +0 -0
  419. data/res/generators/templates/application/public/icons/microphone.png +0 -0
  420. data/res/generators/templates/application/public/icons/movie1.png +0 -0
  421. data/res/generators/templates/application/public/icons/movie2.png +0 -0
  422. data/res/generators/templates/application/public/icons/network.png +0 -0
  423. data/res/generators/templates/application/public/icons/note.png +0 -0
  424. data/res/generators/templates/application/public/icons/outlet.png +0 -0
  425. data/res/generators/templates/application/public/icons/palette.png +0 -0
  426. data/res/generators/templates/application/public/icons/paperclip.png +0 -0
  427. data/res/generators/templates/application/public/icons/phone.png +0 -0
  428. data/res/generators/templates/application/public/icons/photos.png +0 -0
  429. data/res/generators/templates/application/public/icons/piano.png +0 -0
  430. data/res/generators/templates/application/public/icons/picture-frame.png +0 -0
  431. data/res/generators/templates/application/public/icons/pill.png +0 -0
  432. data/res/generators/templates/application/public/icons/pin.png +0 -0
  433. data/res/generators/templates/application/public/icons/pinetree.png +0 -0
  434. data/res/generators/templates/application/public/icons/planet.png +0 -0
  435. data/res/generators/templates/application/public/icons/puzzle.png +0 -0
  436. data/res/generators/templates/application/public/icons/radar.png +0 -0
  437. data/res/generators/templates/application/public/icons/redo.png +0 -0
  438. data/res/generators/templates/application/public/icons/refresh.png +0 -0
  439. data/res/generators/templates/application/public/icons/runner.png +0 -0
  440. data/res/generators/templates/application/public/icons/shoebox.png +0 -0
  441. data/res/generators/templates/application/public/icons/shopping-bag.png +0 -0
  442. data/res/generators/templates/application/public/icons/shopping-cart.png +0 -0
  443. data/res/generators/templates/application/public/icons/shuffle.png +0 -0
  444. data/res/generators/templates/application/public/icons/signpost.png +0 -0
  445. data/res/generators/templates/application/public/icons/skull-n-crossbones.png +0 -0
  446. data/res/generators/templates/application/public/icons/skull.png +0 -0
  447. data/res/generators/templates/application/public/icons/sliders.png +0 -0
  448. data/res/generators/templates/application/public/icons/spraycan.png +0 -0
  449. data/res/generators/templates/application/public/icons/squiggle.png +0 -0
  450. data/res/generators/templates/application/public/icons/star.png +0 -0
  451. data/res/generators/templates/application/public/icons/stopwatch.png +0 -0
  452. data/res/generators/templates/application/public/icons/suitcase.png +0 -0
  453. data/res/generators/templates/application/public/icons/tag.png +0 -0
  454. data/res/generators/templates/application/public/icons/tags.png +0 -0
  455. data/res/generators/templates/application/public/icons/target.png +0 -0
  456. data/res/generators/templates/application/public/icons/testtube.png +0 -0
  457. data/res/generators/templates/application/public/icons/thermometer.png +0 -0
  458. data/res/generators/templates/application/public/icons/toolbox.png +0 -0
  459. data/res/generators/templates/application/public/icons/trophy.png +0 -0
  460. data/res/generators/templates/application/public/icons/tshirt.png +0 -0
  461. data/res/generators/templates/application/public/icons/tv.png +0 -0
  462. data/res/generators/templates/application/public/icons/umbrella.png +0 -0
  463. data/res/generators/templates/application/public/icons/walk.png +0 -0
  464. data/res/generators/templates/application/public/icons/weather.png +0 -0
  465. data/res/generators/templates/application/public/icons/widescreen.png +0 -0
  466. data/res/generators/templates/application/public/icons/wineglass.png +0 -0
  467. data/res/generators/templates/application/public/icons/zap.png +0 -0
  468. data/res/generators/templates/application/public/images/android/btn_check_off.png +0 -0
  469. data/res/generators/templates/application/public/images/android/btn_check_on.png +0 -0
  470. data/res/generators/templates/application/public/images/android/btn_radio_off.png +0 -0
  471. data/res/generators/templates/application/public/images/android/btn_radio_on.png +0 -0
  472. data/res/generators/templates/application/public/images/android/ic_menu_more.png +0 -0
  473. data/res/generators/templates/application/public/images/iphone/disclosure.png +0 -0
  474. data/res/generators/templates/application/public/images/iphone/disclosure_detail.png +0 -0
  475. data/res/generators/templates/application/public/images/iphone/radiobutton.png +0 -0
  476. data/res/generators/templates/application/public/images/iphone/select.png +0 -0
  477. data/res/generators/templates/application/public/images/iphone/switch.png +0 -0
  478. data/res/generators/templates/application/public/images/listArrow.png +0 -0
  479. data/res/generators/templates/application/public/images/listArrowDown.png +0 -0
  480. data/res/generators/templates/model/controller.rb +2 -0
  481. data/res/generators/templates/model/edit.bb.erb +24 -0
  482. data/res/generators/templates/model/edit.erb +21 -25
  483. data/res/generators/templates/model/index.bb.erb +21 -0
  484. data/res/generators/templates/model/index.erb +28 -14
  485. data/res/generators/templates/model/new.bb.erb +24 -0
  486. data/res/generators/templates/model/new.erb +20 -20
  487. data/res/generators/templates/model/show.bb.erb +21 -0
  488. data/res/generators/templates/model/show.erb +15 -15
  489. data/rhobuild.yml +37 -0
  490. data/rhodes.gemspec +1 -1
  491. data/spec/framework_spec/app/Account/config.rb +57 -1
  492. data/spec/framework_spec/app/Case/config.rb +1 -1
  493. data/spec/framework_spec/app/Customer/config.rb +1 -1
  494. data/spec/framework_spec/app/Product/config.rb +15 -1
  495. data/spec/framework_spec/app/spec/fixtures/object_values.txt +90 -90
  496. data/spec/framework_spec/app/spec/pagination/fixtures/object_values.txt +91 -91
  497. data/spec/framework_spec/app/spec/rho_spec.rb +1 -1
  498. data/spec/framework_spec/app/spec/rhom_object_spec.rb +47 -28
  499. data/spec/framework_spec/app/spec/rhom_spec.rb +8 -8
  500. data/spec/framework_spec/app/spec/spec_helper.rb +13 -5
  501. data/spec/framework_spec/app/spec_runner.rb +5 -4
  502. data/spec/framework_spec/public/css/base.css +0 -1
  503. data/spec/framework_spec/public/css/iphone.css +0 -1
  504. data/spec/framework_spec/rhoconfig.txt +3 -1
  505. metadata +220 -37
  506. data/platform/bb/rhodes/src/rhomobile/WebView.java +0 -90
  507. data/platform/iphone/Classes/BarItem.h +0 -27
  508. data/platform/iphone/Classes/BarItem.m +0 -32
  509. data/platform/iphone/Classes/JSString.h +0 -12
  510. data/platform/iphone/Classes/JSString.m +0 -7
  511. data/platform/iphone/Classes/RhoRunnerAppDelegate.h +0 -48
  512. data/platform/iphone/Classes/RhoRunnerAppDelegate.m +0 -617
  513. data/platform/iphone/Classes/Server/ServerHost.h +0 -81
  514. data/platform/iphone/Classes/Server/ServerHost.m +0 -597
  515. data/platform/iphone/Classes/Server/WebViewUrl.h +0 -13
  516. data/platform/iphone/Classes/Server/WebViewUrl.m +0 -8
  517. data/platform/iphone/Classes/TabBarDelegate.h +0 -39
  518. data/platform/iphone/Classes/TabBarDelegate.m +0 -151
  519. data/platform/iphone/Classes/Utils/unzip.cpp +0 -4328
  520. data/platform/iphone/Classes/Utils/unzip.h +0 -234
  521. data/platform/iphone/Classes/WebViewController.h +0 -59
  522. data/platform/iphone/Classes/WebViewController.m +0 -472
  523. data/platform/wm/rhodes/GetURLDialog.cpp +0 -64
  524. data/platform/wm/rhodes/GetURLDialog.h +0 -39
  525. data/res/generators/templates/application/public/css/base.css +0 -39
  526. data/res/generators/templates/application/public/css/rho.css +0 -3
  527. data/res/generators/templates/application/public/css/xhtml.css +0 -114
  528. data/spec/framework_spec/app/Question/config.rb +0 -3
  529. data/spec/generator_spec/source_generator_spec.rb +0 -27
@@ -1,81 +0,0 @@
1
- //
2
- // ServerHost.h
3
- // Browser
4
- //
5
- // Created by adam blum on 9/10/08.
6
- // Copyright 2008 __MyCompanyName__. All rights reserved.
7
- //
8
-
9
- #import "AppManager.h"
10
- //#import "SyncEngine.h"
11
-
12
- @interface ServerHost : NSObject
13
- {
14
- AppManager * appManager;
15
- //sqlite3 *database;
16
- //NSString *homeUrl,*optionsUrl;
17
-
18
- @public
19
- CFRunLoopRef runLoop;
20
- NSThread* m_geoThread;
21
- id actionTarget;
22
- SEL onStartSuccess;
23
- //SEL onStartFailure;
24
- SEL onRefreshView;
25
- SEL onNavigateTo;
26
- SEL onExecuteJs;
27
- //SEL onSetViewHomeUrl;
28
- SEL onTakePicture;
29
- SEL onChoosePicture;
30
- SEL onChooseDateTime;
31
- SEL onCreateNativeBar;
32
- SEL onRemoveNativeBar;
33
- SEL onSwitchTab;
34
- //SEL onSetViewOptionsUrl;
35
- SEL onShowPopup;
36
- SEL onVibrate;
37
- SEL onPlayFile;
38
- SEL onStopPlaying;
39
- SEL onSysCall;
40
- SEL onMapLocation;
41
- SEL onCreateMap;
42
- SEL onActiveTab;
43
- SEL onShowLog;
44
- }
45
-
46
- // callbacks
47
- @property (assign) id actionTarget;
48
- @property (assign) SEL onStartSuccess;
49
- //@property (assign) SEL onStartFailure;
50
- @property (assign) SEL onRefreshView;
51
- @property (assign) SEL onNavigateTo;
52
- @property (assign) SEL onExecuteJs;
53
- //@property (assign) SEL onSetViewHomeUrl;
54
- @property (assign) SEL onTakePicture;
55
- @property (assign) SEL onChoosePicture;
56
- @property (assign) SEL onChooseDateTime;
57
- @property (assign) SEL onCreateNativeBar;
58
- @property (assign) SEL onRemoveNativeBar;
59
- @property (assign) SEL onSwitchTab;
60
- //@property (assign) SEL onSetViewOptionsUrl;
61
- @property (assign) SEL onShowPopup;
62
- @property (assign) SEL onVibrate;
63
- @property (assign) SEL onPlayFile;
64
- @property (assign) SEL onStopPlaying;
65
- @property (assign) SEL onSysCall;
66
- @property (assign) SEL onMapLocation;
67
- @property (assign) SEL onCreateMap;
68
- @property (assign) SEL onActiveTab;
69
- @property (assign) SEL onShowLog;
70
-
71
- - (void) create;
72
- - (void) start;
73
- //TODO - implement pause and stop operations and graceful termination of the thread...
74
- - (void) stop;
75
- //Sync all sources
76
- //- (void) doSync;
77
- //- (void) doSyncFor:(NSString*)url;
78
-
79
- + (ServerHost *)sharedInstance;
80
-
81
- @end
@@ -1,597 +0,0 @@
1
- //
2
- // ServerHost.m
3
- // Browser
4
- //
5
- // Created by adam blum on 9/10/08.
6
- // Copyright 2008 __MyCompanyName__. All rights reserved.
7
- //
8
-
9
- #pragma mark Includes
10
-
11
- #include <assert.h>
12
- #include <unistd.h>
13
-
14
- #include "common/RhoPort.h"
15
- #include "common/rhoparams.h"
16
- //#include "Server.h"
17
- //#include "HttpContext.h"
18
- #include "ServerHost.h"
19
- //#include "Dispatcher.h"
20
- #include "AppManagerI.h"
21
- #include "common/RhoConf.h"
22
- #include "logging/RhoLogConf.h"
23
- //#include "sync/syncthread.h"
24
- #include "common/RhodesApp.h"
25
- #include "JSString.h"
26
- #import "WebViewUrl.h"
27
- #import "ParamsWrapper.h"
28
- #import "DateTime.h"
29
- #import "NativeBar.h"
30
- #import "MapViewController.h"
31
- #include "ruby/ext/rho/rhoruby.h"
32
-
33
- #import "logging/RhoLog.h"
34
- #undef DEFAULT_LOGCATEGORY
35
- #define DEFAULT_LOGCATEGORY "ServerHost"
36
-
37
- extern void rho_geoimpl_init();
38
-
39
- #pragma mark -
40
- #pragma mark Constant Definitions
41
-
42
- #define kServiceType CFSTR("_http._tcp.")
43
-
44
-
45
- #pragma mark -
46
- #pragma mark Static Function Declarations
47
-
48
- //static void AcceptConnection(ServerRef server, CFSocketNativeHandle sock, CFStreamError* error, void* info);
49
-
50
-
51
- /* static */ //void
52
- /*AcceptConnection(ServerRef server, CFSocketNativeHandle sock, CFStreamError* error, void* info) {
53
-
54
- if (sock == ((CFSocketNativeHandle)(-1))) {
55
-
56
- RAWLOG_INFO2("AcceptConnection - Received an error (%d, %d)", (int)error->domain, (int)error->error );
57
-
58
- ServerInvalidate(server);
59
- ServerRelease(server);
60
-
61
- CFRunLoopStop(CFRunLoopGetCurrent());
62
- }
63
- else {
64
-
65
- HttpContextRef http = HttpContextCreate(NULL, sock);
66
-
67
- if ((http != NULL) && !HttpContextOpen(http))
68
- HttpContextRelease(http);
69
- }
70
- }*/
71
-
72
- #pragma mark -
73
-
74
- static ServerHost* sharedSH = nil;
75
-
76
- @implementation ServerHost
77
-
78
- @synthesize actionTarget, /*onStartFailure,*/ onStartSuccess, onRefreshView, onNavigateTo, onExecuteJs;
79
- @synthesize /*onSetViewHomeUrl, onSetViewOptionsUrl,*/ onTakePicture, onChoosePicture, onChooseDateTime;
80
- @synthesize onCreateNativeBar, onRemoveNativeBar, onSwitchTab;
81
- @synthesize onShowPopup, onVibrate, onPlayFile, onStopPlaying, onSysCall, onMapLocation, onCreateMap, onActiveTab, onShowLog;
82
-
83
- - (void)serverStarted:(NSString*)data {
84
- if(actionTarget && [actionTarget respondsToSelector:onStartSuccess]) {
85
- [actionTarget performSelector:onStartSuccess withObject:data];
86
- }
87
- // Do sync w/ remote DB
88
- //wake_up_sync_engine();
89
- }
90
- /*
91
- - (void)serverFailed:(void*)data {
92
- if(actionTarget && [actionTarget respondsToSelector:onStartFailure]) {
93
- [actionTarget performSelector:onStartFailure];
94
- }
95
- }*/
96
-
97
- - (void)refreshView:(int)index {
98
- if(actionTarget && [actionTarget respondsToSelector:onRefreshView]) {
99
- [actionTarget performSelectorOnMainThread:onRefreshView withObject:(void*)index waitUntilDone:NO];
100
- }
101
- }
102
-
103
- - (void)navigateTo:(WebViewUrl*) wvUrl {
104
- if(actionTarget && [actionTarget respondsToSelector:onNavigateTo]) {
105
- [actionTarget performSelectorOnMainThread:onNavigateTo withObject:wvUrl waitUntilDone:NO];
106
- }
107
- }
108
-
109
- - (void)executeJs:(JSString*) js {
110
- if(actionTarget && [actionTarget respondsToSelector:onExecuteJs]) {
111
- [actionTarget performSelectorOnMainThread:onExecuteJs withObject:js waitUntilDone:YES];
112
- }
113
- }
114
-
115
- - (void)performRefreshView {
116
- [self performSelectorOnMainThread:@selector(refreshView)
117
- withObject:NULL waitUntilDone:NO];
118
- }
119
- /*
120
- - (void)setViewHomeUrl:(NSString*)url {
121
- if(actionTarget && [actionTarget respondsToSelector:onSetViewHomeUrl]) {
122
- [actionTarget performSelector:onSetViewHomeUrl withObject:url];
123
- }
124
- }*/
125
-
126
- - (void)takePicture:(NSString*) url {
127
- if(actionTarget && [actionTarget respondsToSelector:onTakePicture]) {
128
- [actionTarget performSelectorOnMainThread:onTakePicture withObject:url waitUntilDone:NO];
129
- }
130
- }
131
-
132
- - (void)choosePicture:(NSString*) url {
133
- if(actionTarget && [actionTarget respondsToSelector:onChoosePicture]) {
134
- [actionTarget performSelectorOnMainThread:onChoosePicture withObject:url waitUntilDone:NO];
135
- }
136
- }
137
-
138
- - (void)chooseDateTime:(NSString*)url title:(NSString*)title initialTime:(long)initial_time format:(int)format data:(NSString*)data {
139
- if(actionTarget && [actionTarget respondsToSelector:onChooseDateTime]) {
140
- DateTime* dateTime = [[DateTime alloc] init];
141
- dateTime.url = url;
142
- dateTime.title = title;
143
- dateTime.initialTime = initial_time;
144
- dateTime.format = format;
145
- dateTime.data = data;
146
- [actionTarget performSelectorOnMainThread:onChooseDateTime withObject:dateTime waitUntilDone:YES];
147
- [dateTime release];
148
- }
149
- }
150
-
151
- - (void)createNativeBar:(int)barType dataArray:(NSArray*)dataArray {
152
- if(actionTarget && [actionTarget respondsToSelector:onCreateNativeBar]) {
153
- NativeBar* nativeBar = [[NativeBar alloc] init];
154
- nativeBar.barType = barType;
155
- nativeBar.barItemDataArray = dataArray;
156
- [actionTarget performSelectorOnMainThread:onCreateNativeBar withObject:nativeBar waitUntilDone:YES];
157
- [nativeBar release];
158
- }
159
- }
160
-
161
- - (void)removeNativeBar {
162
- if (actionTarget && [actionTarget respondsToSelector:onRemoveNativeBar]) {
163
- [actionTarget performSelectorOnMainThread:onRemoveNativeBar withObject:nil waitUntilDone:YES];
164
- }
165
- }
166
-
167
- - (void)switchTab:(int)index {
168
- if (actionTarget && [actionTarget respondsToSelector:onSwitchTab]) {
169
- NSValue* value = [NSValue valueWithPointer:&index];
170
- [actionTarget performSelectorOnMainThread:onSwitchTab withObject:value waitUntilDone:YES];
171
- [value release];
172
- }
173
- }
174
-
175
- - (void)showLog {
176
- if (actionTarget && [actionTarget respondsToSelector:onShowLog]) {
177
- [actionTarget performSelectorOnMainThread:onShowLog withObject:nil waitUntilDone:NO];
178
- }
179
- }
180
-
181
- /*
182
- - (void)setViewOptionsUrl:(NSString*)url {
183
- if(actionTarget && [actionTarget respondsToSelector:onSetViewOptionsUrl]) {
184
- [actionTarget performSelector:onSetViewOptionsUrl withObject:url];
185
- }
186
- }*/
187
-
188
- - (void)showPopup:(NSString*) message {
189
- if(actionTarget && [actionTarget respondsToSelector:onShowPopup]) {
190
- [actionTarget performSelectorOnMainThread:onShowPopup withObject:message waitUntilDone:NO];
191
- }
192
- }
193
-
194
- - (void)vibrate:(int) duration {
195
- if(actionTarget && [actionTarget respondsToSelector:onVibrate]) {
196
- [actionTarget performSelectorOnMainThread:onVibrate withObject:(void*)duration waitUntilDone:NO];
197
- }
198
- }
199
-
200
- - (void)playFile:(NSString*) fileName mediaType:(NSString*) media_type {
201
- if(actionTarget && [actionTarget respondsToSelector:onPlayFile]) {
202
- [actionTarget performSelectorOnMainThread:onPlayFile withObject:fileName waitUntilDone:NO];
203
- }
204
- }
205
-
206
- - (void)stopPlaying {
207
- if (actionTarget && [actionTarget respondsToSelector:onStopPlaying]) {
208
- [actionTarget performSelectorOnMainThread:onStopPlaying withObject:nil waitUntilDone:NO];
209
- }
210
- }
211
-
212
- - (void)mapLocation:(NSString*) query {
213
- if(actionTarget && [actionTarget respondsToSelector:onMapLocation]) {
214
- [actionTarget performSelectorOnMainThread:onMapLocation withObject:query waitUntilDone:NO];
215
- }
216
- }
217
-
218
- - (void)createMap:(rho_param*)p {
219
- if(actionTarget && [actionTarget respondsToSelector:onCreateMap]) {
220
- NSValue *value = [NSValue valueWithPointer:p];
221
- if (!value) return;
222
- [actionTarget performSelectorOnMainThread:onCreateMap withObject:value waitUntilDone:NO];
223
- }
224
- }
225
-
226
- - (int)activeTab {
227
- int retval = 0;
228
- if(actionTarget && [actionTarget respondsToSelector:onActiveTab]) {
229
- NSValue* result = [NSValue valueWithPointer: &retval];
230
- if (!result) return 0;
231
- [actionTarget performSelectorOnMainThread:onActiveTab withObject:result waitUntilDone:YES];
232
- }
233
- return retval;
234
- }
235
-
236
- - (void)sysCall:(PARAMS_WRAPPER*)params {
237
- }
238
-
239
- - (void)doSysCall:(PARAMS_WRAPPER*)params {
240
- ParamsWrapper* pw = [ParamsWrapper wrap:params];
241
- if(actionTarget && [actionTarget respondsToSelector:onSysCall]) {
242
- [actionTarget performSelectorOnMainThread:onSysCall withObject:pw waitUntilDone:NO];
243
- }
244
- }
245
-
246
- #if defined(RHO_USE_OWN_HTTPD) && !defined(RHO_HTTPD_COMMON_IMPL)
247
- - (void)ServerHostThreadRoutine:(id)anObject {
248
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
249
-
250
- runLoop = CFRunLoopGetCurrent();
251
- m_geoThread = [NSThread currentThread];
252
- geo_init();
253
-
254
- RAWLOG_INFO("Initializing ruby");
255
- RhoRubyStart();
256
-
257
- ServerContext c = {NULL, NULL, NULL, NULL};
258
- ServerRef server = ServerCreate(NULL, AcceptConnection, &c);
259
- if (server != NULL && ServerConnect(server, NULL, kServiceType, 8080)) {
260
- RAWLOG_INFO("HTTP Server started and ready");
261
-
262
- RAWLOG_INFO("Create Sync");
263
- rho_sync_create();
264
- RhoRubyInitApp();
265
- rho_ruby_activateApp();
266
-
267
- [self performSelectorOnMainThread:@selector(serverStarted:)
268
- withObject:NULL waitUntilDone:NO];
269
-
270
- [[NSRunLoop currentRunLoop] run];
271
-
272
-
273
- RAWLOG_INFO("Invalidating local server");
274
- ServerInvalidate(server);
275
- } else {
276
- RAWLOG_INFO("Failed to start HTTP Server");
277
- [self performSelectorOnMainThread:@selector(serverFailed:)
278
- withObject:NULL waitUntilDone:NO];
279
- }
280
-
281
- RAWLOG_INFO("Destroy Sync");
282
- rho_sync_destroy();
283
-
284
- RAWLOG_INFO("Stopping ruby");
285
- RhoRubyStop();
286
-
287
- RAWLOG_INFO("Server host thread routine is completed");
288
- [pool release];
289
- }
290
- #else // defined(RHO_USE_OWN_HTTPD) && !defined(RHO_HTTPD_COMMON_IMPL)
291
- - (void)ServerHostThreadRoutine:(id)anObject {
292
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
293
-
294
- runLoop = CFRunLoopGetCurrent();
295
- m_geoThread = [NSThread currentThread];
296
- rho_geoimpl_init();
297
- [self performSelectorOnMainThread:@selector(serverStarted:)
298
- withObject:NULL waitUntilDone:NO];
299
- [[NSRunLoop currentRunLoop] run];
300
-
301
- RAWLOG_INFO("Server host thread routine is completed");
302
- [pool release];
303
- }
304
- #endif // defined(RHO_USE_OWN_HTTPD) && !defined(RHO_HTTPD_COMMON_IMPL)
305
-
306
- /*
307
- - (int)initializeDatabaseConn {
308
- NSString *appRoot = [AppManager getApplicationsRootPath];
309
- NSString *path = [appRoot stringByAppendingPathComponent:@"../db/syncdb.sqlite"];
310
- return sqlite3_open([path UTF8String], &database);
311
- }*/
312
-
313
- //extern const char* RhoGetRootPath();
314
-
315
- -(void) create {
316
- //Create
317
- appManager = [AppManager instance];
318
- //Configure AppManager
319
- [appManager configure];
320
- //Init log and settings
321
-
322
- //Start Sync engine
323
- //[self initializeDatabaseConn];
324
- // Startup the sync engine thread
325
- //start_sync_engine(database);
326
-
327
- // Start server thread
328
- [NSThread detachNewThreadSelector:@selector(ServerHostThreadRoutine:)
329
- toTarget:self withObject:nil];
330
- rho_rhodesapp_create(rho_native_rhopath());
331
- }
332
-
333
- -(void)start {
334
- #if !defined(RHO_USE_OWN_HTTPD) || defined(RHO_HTTPD_COMMON_IMPL)
335
- rho_rhodesapp_start();
336
- #endif
337
- }
338
-
339
- void* rho_nativethread_start()
340
- {
341
- return [[NSAutoreleasePool alloc] init];
342
- }
343
-
344
- void rho_nativethread_end(void* pData)
345
- {
346
- NSAutoreleasePool *pool = (NSAutoreleasePool *)pData;
347
- [pool release];
348
- }
349
-
350
- -(void) stop {
351
- rho_rhodesapp_destroy();
352
- CFRunLoopStop(runLoop);
353
- // Stop the sync engine
354
- //stop_sync_engine();
355
- //shutdown_database();
356
- }
357
- /*
358
- //Sync all sources
359
- - (void) doSync {
360
- rho_sync_doSyncAllSources(TRUE);
361
- }
362
-
363
- - (void) doSyncFor:(NSString*)url {
364
- rho_sync_doSyncSourceByUrl([url cStringUsingEncoding:[NSString defaultCStringEncoding]]);
365
- }*/
366
-
367
- - (void)dealloc
368
- {
369
- [appManager release];
370
- //[homeUrl release];
371
- //[optionsUrl release];
372
- [super dealloc];
373
- }
374
-
375
- + (ServerHost *)sharedInstance {
376
- @synchronized(self) {
377
- if (sharedSH == nil) {
378
- [[self alloc] init]; // assignment not done here
379
- }
380
- }
381
- return sharedSH;
382
- }
383
-
384
- + (id)allocWithZone:(NSZone *)zone {
385
- @synchronized(self) {
386
- if (sharedSH == nil) {
387
- sharedSH = [super allocWithZone:zone];
388
- return sharedSH; // assignment and return on first allocation
389
- }
390
- }
391
- return nil; // on subsequent allocation attempts return nil
392
- }
393
-
394
- - (id)copyWithZone:(NSZone *)zone
395
- {
396
- return self;
397
- }
398
-
399
- - (id)retain {
400
- return self;
401
- }
402
-
403
- - (unsigned)retainCount {
404
- return UINT_MAX; // denotes an object that cannot be released
405
- }
406
-
407
- - (void)release {
408
- //do nothing
409
- }
410
-
411
- - (id)autorelease {
412
- return self;
413
- }
414
-
415
- @end
416
-
417
- //ruby extension hooks
418
- void webview_refresh(int index) {
419
- [[ServerHost sharedInstance] refreshView:index];
420
- }
421
-
422
- void webview_navigate(char* url, int index) {
423
- WebViewUrl *webViewUrl = [[[WebViewUrl alloc] init] autorelease];
424
- //char* szNormUrl = rho_http_normalizeurl(url);
425
- webViewUrl.url = [NSString stringWithUTF8String:url];
426
- //rho_http_free(szNormUrl);
427
- webViewUrl.webViewIndex = index;
428
- [[ServerHost sharedInstance] navigateTo:webViewUrl];
429
- }
430
-
431
- char* webview_execute_js(char* js, int index) {
432
- char * retval;
433
- JSString *javascript = [[[JSString alloc] init] autorelease];
434
- javascript.inputJs = [NSString stringWithUTF8String:js];
435
- javascript->index = index;
436
- [[ServerHost sharedInstance] executeJs:javascript];
437
- // TBD: Does ruby GC pick this up?
438
- retval = strdup([[javascript outputJs] cStringUsingEncoding:[NSString defaultCStringEncoding]]);
439
- return retval;
440
- }
441
-
442
- void perform_webview_refresh() {
443
- [[ServerHost sharedInstance] performRefreshView];
444
- }
445
-
446
- void rho_conf_show_log() {
447
- [[ServerHost sharedInstance] showLog];
448
- }
449
-
450
- char* webview_current_location(int index) {
451
- return (char*)rho_rhodesapp_getcurrenturl(index);
452
- }
453
-
454
- void webview_set_menu_items(VALUE valMenu) {
455
- //TODO: webview_set_menu_items
456
- rho_rhodesapp_setViewMenu(valMenu);
457
- }
458
-
459
- void alert_show_popup(char* message) {
460
- if (message==NULL) {
461
- RAWLOG_ERROR("Alert.show_popup - wrong arguments");
462
- } else {
463
- [[ServerHost sharedInstance] showPopup:[NSString stringWithUTF8String:message]];
464
- }
465
- }
466
-
467
- void alert_vibrate(int duration) {
468
- [[ServerHost sharedInstance] vibrate:duration];
469
- }
470
-
471
- void alert_play_file(char* file_name, char* media_type) {
472
- if (file_name==NULL) {
473
- RAWLOG_ERROR("Alert.play_file - please specify file name to play");
474
- } else {
475
- [[ServerHost sharedInstance] playFile:[NSString stringWithUTF8String:file_name]
476
- mediaType:media_type?[NSString stringWithUTF8String:media_type]:NULL];
477
- }
478
- }
479
-
480
- VALUE rho_ringtone_manager_get_all()
481
- {
482
- // No API to get ringtones
483
- return rho_ruby_get_NIL();
484
- }
485
-
486
- void rho_ringtone_manager_play(char *file_name)
487
- {
488
- if (file_name == NULL) {
489
- RAWLOG_ERROR("RingtoneManager.play - please specify file name to play");
490
- return;
491
- }
492
-
493
- [[ServerHost sharedInstance] playFile:[NSString stringWithUTF8String:file_name]
494
- mediaType:NULL];
495
- }
496
-
497
- void rho_ringtone_manager_stop()
498
- {
499
- [[ServerHost sharedInstance] stopPlaying];
500
- }
501
-
502
- void take_picture(char* callback_url) {
503
- [[ServerHost sharedInstance] takePicture:[NSString stringWithUTF8String:callback_url]];
504
- }
505
-
506
- void choose_picture(char* callback_url) {
507
- [[ServerHost sharedInstance] choosePicture:[NSString stringWithUTF8String:callback_url]];
508
- }
509
-
510
- void choose_datetime(char* callback, char* title, long initial_time, int format, char* data) {
511
- [[ServerHost sharedInstance] chooseDateTime:[NSString stringWithUTF8String:callback]
512
- title:[NSString stringWithUTF8String:title]
513
- initialTime:initial_time
514
- format:format
515
- data:[NSString stringWithUTF8String:data]];
516
- }
517
-
518
- void rho_map_location(char* query) {
519
- [[ServerHost sharedInstance] mapLocation:[NSString stringWithUTF8String:query]];
520
- }
521
-
522
- void mapview_create(rho_param *p) {
523
- #ifdef __IPHONE_3_0
524
- [[ServerHost sharedInstance] createMap:rho_param_dup(p)];
525
- #endif
526
- }
527
-
528
- void _rho_ext_syscall(PARAMS_WRAPPER* params) {
529
- [[ServerHost sharedInstance] doSysCall:params];
530
- }
531
-
532
- void create_nativebar(int bar_type, rho_param *p)
533
- {
534
- if (p->type != RHO_PARAM_ARRAY) {
535
- RAWLOG_ERROR("Unexpected parameter type for create_nativebar, should be Array");
536
- return;
537
- }
538
-
539
- int size = p->v.array->size;
540
- NSMutableArray *items = [NSMutableArray arrayWithCapacity:size];
541
- for (int i = 0; i < size; ++i) {
542
- rho_param *hash = p->v.array->value[i];
543
- if (hash->type != RHO_PARAM_HASH) {
544
- RAWLOG_ERROR("Unexpected type of array item for create_nativebar, should be Hash");
545
- return;
546
- }
547
-
548
- const char *label = NULL;
549
- const char *action = NULL;
550
- const char *icon = NULL;
551
- const char *reload = NULL;
552
-
553
- for (int j = 0, lim = hash->v.hash->size; j < lim; ++j) {
554
- const char *name = hash->v.hash->name[j];
555
- rho_param *value = hash->v.hash->value[j];
556
- if (value->type != RHO_PARAM_STRING) {
557
- RAWLOG_ERROR1("Unexpected '%s' type, should be String", name);
558
- return;
559
- }
560
-
561
- if (strcasecmp(name, "label") == 0)
562
- label = value->v.string;
563
- else if (strcasecmp(name, "action") == 0)
564
- action = value->v.string;
565
- else if (strcasecmp(name, "icon") == 0)
566
- icon = value->v.string;
567
- else if (strcasecmp(name, "reload") == 0)
568
- reload = value->v.string;
569
- }
570
-
571
- if (label == NULL && bar_type == TOOLBAR_TYPE)
572
- label = "";
573
-
574
- if (label == NULL || action == NULL) {
575
- RAWLOG_ERROR("Illegal argument for create_nativebar");
576
- return;
577
- }
578
-
579
- [items addObject:[NSString stringWithUTF8String:label]];
580
- [items addObject:[NSString stringWithUTF8String:action]];
581
- [items addObject:[NSString stringWithUTF8String:(icon ? icon : "")]];
582
- [items addObject:[NSString stringWithUTF8String:(reload ? reload : "false")]];
583
- }
584
- [[ServerHost sharedInstance] createNativeBar:bar_type dataArray:items];
585
- }
586
-
587
- void remove_nativebar() {
588
- [[ServerHost sharedInstance] removeNativeBar];
589
- }
590
-
591
- void nativebar_switch_tab(int index) {
592
- [[ServerHost sharedInstance] switchTab:index];
593
- }
594
-
595
- int webview_active_tab() {
596
- return [[ServerHost sharedInstance] activeTab];
597
- }