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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/Manifest.txt +16 -1
  2. data/Rakefile +77 -28
  3. data/doc/build.txt +5 -3
  4. data/doc/configuration.txt +13 -0
  5. data/doc/device-caps.txt +46 -27
  6. data/doc/rhom.txt +2 -2
  7. data/doc/test-log-debug.txt +6 -0
  8. data/doc/ui.txt +13 -0
  9. data/lib/build/jake.rb +11 -11
  10. data/lib/extensions/crypt/crypt/cbc.rb +5 -2
  11. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +14 -4
  12. data/lib/framework/rho/render.rb +17 -4
  13. data/lib/framework/rho/rho.rb +1 -1
  14. data/lib/framework/rho/rhocontroller.rb +11 -1
  15. data/lib/framework/rhomotoapi.rb +110 -0
  16. data/platform/android/Rhodes/jni/Android.mk +2 -5
  17. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
  18. data/platform/android/Rhodes/jni/include/rhodes/fileapi.h +38 -0
  19. data/platform/android/Rhodes/jni/src/callbacks.cpp +7 -26
  20. data/platform/android/Rhodes/jni/src/extmanager.cpp +4 -1
  21. data/platform/android/Rhodes/jni/src/fileapi.cpp +38 -14
  22. data/platform/android/Rhodes/jni/src/mapview.cpp +1 -2
  23. data/platform/android/Rhodes/jni/src/rhodesapp.cpp +10 -0
  24. data/platform/android/Rhodes/jni/src/rhodessystem.cpp +1 -1
  25. data/platform/android/Rhodes/jni/src/signature.cpp +1 -4
  26. data/platform/android/Rhodes/rhobundle.xml +1 -1
  27. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +11 -1
  28. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +4 -3
  29. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -6
  30. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +3 -1
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +70 -0
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtData.java +3 -1
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +21 -7
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +19 -10
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtDataImpl.java +8 -5
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManager.java +18 -0
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +168 -31
  38. data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +46 -9
  39. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +3 -2
  40. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +27 -53
  41. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +27 -3
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/Utils.java +13 -14
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +12 -5
  44. data/platform/android/build/RhodesSRC_build.files +2 -1
  45. data/platform/android/build/android.rake +48 -17
  46. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +1 -1
  47. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +24 -3
  48. data/platform/iphone/Classes/AppManager/AppManager.m +1 -1
  49. data/platform/iphone/Classes/Camera/PickImageDelegate.m +27 -2
  50. data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
  51. data/platform/iphone/Classes/DateTimePickerDelegate.m +85 -9
  52. data/platform/iphone/Classes/DateTimePickerViewController.h +21 -0
  53. data/platform/iphone/Classes/DateTimePickerViewController.m +75 -0
  54. data/platform/iphone/Classes/GeoLocation/LocationController.h +6 -2
  55. data/platform/iphone/Classes/GeoLocation/LocationController.m +54 -14
  56. data/platform/iphone/Classes/RhoMainView.h +2 -0
  57. data/platform/iphone/Classes/Rhodes.m +11 -5
  58. data/platform/iphone/Classes/Signature/SignatureDelegate.m +13 -12
  59. data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -1
  60. data/platform/iphone/Classes/SimpleMainView.m +3 -0
  61. data/platform/iphone/Classes/SplitView/SplittedMainView.m +3 -0
  62. data/platform/iphone/Classes/TabbedMainView.m +30 -11
  63. data/platform/iphone/rbuild/iphone.rake +7 -1
  64. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +6 -0
  65. data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
  66. data/platform/shared/common/BundleManager.cpp +42 -2
  67. data/platform/shared/common/ExtManager.h +7 -0
  68. data/platform/shared/common/RhoFile.cpp +170 -2
  69. data/platform/shared/common/RhoFile.h +4 -0
  70. data/platform/shared/common/RhodesApp.cpp +30 -0
  71. data/platform/shared/common/RhodesApp.h +1 -0
  72. data/platform/shared/common/map/OSMMapEngine.cpp +11 -3
  73. data/platform/shared/common/map/OSMMapEngine.h +3 -0
  74. data/platform/shared/logging/RhoLogConf.cpp +8 -9
  75. data/platform/shared/logging/RhoLogConf.h +5 -7
  76. data/platform/shared/logging/RhoLogSink.cpp +3 -3
  77. data/platform/shared/logging/RhoLogSink.h +1 -1
  78. data/platform/shared/net/HttpServer.cpp +17 -9
  79. data/platform/shared/qt/rhodes/main.cpp +1 -1
  80. data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
  81. data/platform/shared/ruby/ext/webview/webview.i +9 -4
  82. data/platform/shared/ruby/ext/webview/webview_wrap.c +2 -2
  83. data/platform/shared/test/Tests.cpp +2 -2
  84. data/platform/wm/build/build_inf.js +75 -47
  85. data/platform/wm/build/wm.rake +50 -53
  86. data/platform/wm/rhodes/Rhodes.cpp +40 -97
  87. data/platform/wm/rhodes/rho/common/ExtManager.cpp +23 -1
  88. data/platform/wm/rhodes/rho/rubyext/WebView.cpp +9 -0
  89. data/platform/wm/tools/detool/detool.cpp +103 -52
  90. data/platform/wp7/RhoRubyExtGen/RhoDateTimePicker.cs +60 -0
  91. data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +1 -0
  92. data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +4 -4
  93. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +15 -1
  94. data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +12 -2
  95. data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +2 -0
  96. data/platform/wp7/RhoRubyLib/common/RhoFile.cs +3 -3
  97. data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +2 -2
  98. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +39 -24
  99. data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +8 -1
  100. data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +3 -3
  101. data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +1 -1
  102. data/platform/wp7/RhoRubyLib/net/HttpServer.cs +22 -15
  103. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
  104. data/platform/wp7/RhoRubyLib/rubyext/RhoDateTimePicker.cs +237 -0
  105. data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +5 -5
  106. data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml +37 -0
  107. data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml.cs +59 -0
  108. data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +34 -41
  109. data/platform/wp7/rhodes/App.xaml.cs +1 -0
  110. data/platform/wp7/rhodes/Properties/WMAppManifest.xml +18 -18
  111. data/platform/wp7/rhodes/Rhodes.csproj +5 -1
  112. data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Cancel.png +0 -0
  113. data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Check.png +0 -0
  114. data/rakefile.rb +77 -28
  115. data/res/build-tools/Microsoft.Phone.Controls.Toolkit.dll +0 -0
  116. data/res/build-tools/YUICompressorLicense.txt +54 -0
  117. data/res/build-tools/detool.exe +0 -0
  118. data/res/build-tools/yuicompressor-2.4.7.jar +0 -0
  119. data/res/generators/templates/application/app/layout.erb +1 -0
  120. data/res/generators/templates/application/public/js/jquery-wp7-patch.js +8 -2
  121. data/res/generators/templates/application/public/js/syncengine.js +147 -0
  122. data/spec/phone_spec/app/Data/septest.json +1 -1
  123. data/spec/phone_spec/app/spec/asynchttp_spec.rb +11 -10
  124. data/spec/phone_spec/app/spec/blobsync_spec.rb +9 -34
  125. data/spec/phone_spec/app/spec/date_spec.rb +6 -6
  126. data/spec/phone_spec/app/spec/rho_spec.rb +1 -6
  127. data/spec/phone_spec/app/spec/rhofile_spec.rb +13 -7
  128. data/spec/phone_spec/app/spec/rhom_object_spec.rb +4 -3
  129. data/spec/phone_spec/app/spec/syncengine_spec.rb +12 -14
  130. data/spec/phone_spec/app/spec_runner.rb +9 -10
  131. data/version +1 -1
  132. metadata +20 -5
  133. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerSingleton.java +0 -15
@@ -66,7 +66,10 @@ struct IRhoExtManager
66
66
 
67
67
  virtual void onUnhandledProperty( const wchar_t* pModuleName, const wchar_t* pName, const wchar_t* pValue, const CRhoExtData& oExtData ) = 0;
68
68
  virtual void executeRubyCallback( const char* szCallback, const char* szCallbackBody, const char* szCallbackData, bool bWaitForResponse) = 0;
69
+ virtual void executeRubyCallbackWithJsonBody( const char* szCallback, const char* szCallbackBody, const char* szCallbackData, bool bWaitForResponse) = 0;
70
+
69
71
  virtual void requireRubyFile( const char* szFilePath ) = 0;
72
+ virtual unsigned long parseJsonToRubyHash(const char* szJson)=0;
70
73
 
71
74
  virtual void navigate(const wchar_t* szUrl) = 0;
72
75
  virtual bool existsJavascript(const wchar_t* szJSFunction) = 0;
@@ -118,8 +121,12 @@ public:
118
121
  //IRhoExtManager
119
122
  virtual void onUnhandledProperty( const wchar_t* pModuleName, const wchar_t* pName, const wchar_t* pValue, const CRhoExtData& oExtData );
120
123
  virtual void executeRubyCallback( const char* szCallback, const char* szCallbackBody, const char* szCallbackData, bool bWaitForResponse);
124
+ virtual void executeRubyCallbackWithJsonBody( const char* szCallback, const char* szCallbackBody, const char* szCallbackData, bool bWaitForResponse);
125
+
121
126
  virtual void navigate(const wchar_t* szUrl);
122
127
  virtual void requireRubyFile( const char* szFilePath );
128
+ virtual unsigned long parseJsonToRubyHash(const char* szJson);
129
+
123
130
  virtual void executeJavascript(const wchar_t* szJSFunction);
124
131
  virtual bool existsJavascript(const wchar_t* szJSFunction);
125
132
  virtual void rhoLog(int nSeverity, const char* szModule, const char* szMsg, const char* szFile, int nLine);
@@ -28,9 +28,22 @@
28
28
  #include "common/StringConverter.h"
29
29
  #include "common/Tokenizer.h"
30
30
  #include "common/RhoFilePath.h"
31
+ #include "logging/RhoLog.h"
32
+
33
+ #if !defined(WINDOWS_PLATFORM)
34
+ #include <dirent.h>
35
+ #else
36
+ # ifndef S_ISDIR
37
+ # define S_ISDIR(m) ((_S_IFDIR & m) == _S_IFDIR)
38
+ # endif
39
+ #endif
40
+
41
+ #undef DEFAULT_LOGCATEGORY
42
+ #define DEFAULT_LOGCATEGORY "RhoFile"
31
43
 
32
44
  #if defined(WINDOWS_PLATFORM)
33
45
  extern "C" int _mkdir(const char * dir);
46
+ extern "C" int _rmdir(const char * dir);
34
47
  extern "C" int _unlink(const char *path);
35
48
  #endif
36
49
 
@@ -43,6 +56,125 @@
43
56
  namespace rho{
44
57
  namespace common{
45
58
 
59
+ // Below is cross platform folder tree iteration algo implementation
60
+ // but it tested for Android only and removed from other platforms unlil tested
61
+ #ifdef OS_ANDROID
62
+
63
+ template <typename FileFunctor>
64
+ unsigned iterateFolderTree(const String& path, const FileFunctor& functor)
65
+ {
66
+ unsigned res = 0;
67
+ struct dirent *dent;
68
+ DIR *dir;
69
+
70
+ if (!(dir = opendir(path.c_str())))
71
+ {
72
+ LOG(ERROR) + "Can't open dir: " + path;
73
+ return static_cast<unsigned>(errno);
74
+ }
75
+
76
+ while ((dent = readdir(dir))) {
77
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
78
+ continue;
79
+
80
+ String child = CFilePath::join(path, dent->d_name);
81
+ if(child.length() > FILENAME_MAX)
82
+ {
83
+ LOG(ERROR) + "Path is too long: " + child;
84
+ res = ENAMETOOLONG;
85
+ continue;
86
+ }
87
+
88
+ unsigned res1 = functor(child.c_str() + strlen(functor.m_root));
89
+ if(res1 != 0) res = res1;
90
+ }
91
+
92
+ if (dir) closedir(dir);
93
+
94
+ return res;
95
+ }
96
+
97
+ struct RemoveFileFunctor {
98
+ const char* m_root;
99
+ RemoveFileFunctor(const char* root) : m_root(root) {}
100
+
101
+ unsigned operator()(const String& rel_path) const
102
+ {
103
+ unsigned res = 0;
104
+ String path = CFilePath::join(m_root, rel_path);
105
+ if(CRhoFile::isDirectory(path.c_str()))
106
+ {
107
+ res = iterateFolderTree(path, *this);
108
+ unsigned res1 = CRhoFile::deleteEmptyFolder(path.c_str());
109
+ if(res1 != 0) res = res1;
110
+ }
111
+ else
112
+ {
113
+ res = CRhoFile::deleteFile(path.c_str());
114
+ }
115
+ return res;
116
+ }
117
+ };
118
+
119
+ struct CopyFileFunctor {
120
+ const char* m_root;
121
+ const char* m_dst_root;
122
+ CopyFileFunctor(const char* src_root, const char* dst_root)
123
+ : m_root(src_root), m_dst_root(dst_root) {}
124
+
125
+ unsigned operator()(const String& rel_path) const
126
+ {
127
+ unsigned res = 0;
128
+ String path = CFilePath::join(m_root, rel_path);
129
+ String dst_path = CFilePath::join(m_dst_root, rel_path);
130
+
131
+ if(CRhoFile::isDirectory(path.c_str()))
132
+ {
133
+ if((res = CRhoFile::createFolder(dst_path.c_str())) == 0)
134
+ {
135
+ res = iterateFolderTree(path, *this);
136
+ }
137
+ }
138
+ else
139
+ {
140
+ res = CRhoFile::copyFile(path.c_str(), dst_path.c_str());
141
+ }
142
+ return res;
143
+ }
144
+ };
145
+
146
+ struct MoveFileFunctor {
147
+ const char* m_root;
148
+ const char* m_dst_root;
149
+ MoveFileFunctor(const char* src_root, const char* dst_root)
150
+ : m_root(src_root), m_dst_root(dst_root) {}
151
+
152
+ unsigned operator()(const String& rel_path) const
153
+ {
154
+ unsigned res = 0;
155
+ String path = CFilePath::join(m_root, rel_path);
156
+ String dst_path = CFilePath::join(m_dst_root, rel_path);
157
+
158
+ if(CRhoFile::isDirectory(path.c_str()))
159
+ {
160
+ if((res = CRhoFile::createFolder(dst_path.c_str())) == 0)
161
+ {
162
+ if((res = iterateFolderTree(path, *this)) == 0)
163
+ {
164
+ CRhoFile::deleteEmptyFolder(path.c_str());
165
+ }
166
+ }
167
+ }
168
+ else
169
+ {
170
+ res = CRhoFile::renameFile(path.c_str(), dst_path.c_str());
171
+ }
172
+ return res;
173
+ }
174
+ };
175
+
176
+ #endif
177
+
46
178
  static wchar_t * translate_wchar(wchar_t *p, int from, int to)
47
179
  {
48
180
  for (; *p; p++) {
@@ -199,6 +331,17 @@ bool CRhoFile::isFileExist( const char* szFilePath ){
199
331
  return stat(szFilePath, &st) == 0;
200
332
  }
201
333
 
334
+ bool CRhoFile::isDirectory( const char* szFilePath ){
335
+ bool res = false;
336
+ struct stat st;
337
+ memset(&st,0, sizeof(st));
338
+ if (stat(szFilePath, &st) == 0)
339
+ {
340
+ return S_ISDIR(st.st_mode);
341
+ }
342
+ return res;
343
+ }
344
+
202
345
  unsigned int CRhoFile::getFileSize( const char* szFilePath ){
203
346
  struct stat st;
204
347
  memset(&st,0, sizeof(st));
@@ -224,6 +367,15 @@ unsigned int CRhoFile::deleteFile( const char* szFilePath ){
224
367
  #endif
225
368
  }
226
369
 
370
+ unsigned int CRhoFile::deleteEmptyFolder( const char* szFilePath ){
371
+ #if defined(OS_WINDOWS) || defined(OS_WINCE)
372
+ return (unsigned int)_rmdir(szFilePath);
373
+ #else
374
+ return (unsigned int)rmdir(szFilePath);
375
+ #endif
376
+ }
377
+
378
+
227
379
  void CRhoFile::deleteFilesInFolder(const char* szFolderPath)
228
380
  {
229
381
  #if defined(OS_WINDOWS) || defined(OS_WINCE)
@@ -318,13 +470,13 @@ void CRhoFile::deleteFilesInFolder(const char* szFolderPath)
318
470
  return -1;
319
471
  }
320
472
 
321
- int buf_size = 1 << 16;
473
+ unsigned int buf_size = 1 << 16;
322
474
  unsigned char* buf = new unsigned char[buf_size];
323
475
 
324
476
  unsigned int to_copy = src.size();
325
477
 
326
478
  while (to_copy > 0) {
327
- int portion_size = buf_size;
479
+ unsigned int portion_size = buf_size;
328
480
  if (to_copy < portion_size) {
329
481
  portion_size = to_copy;
330
482
  }
@@ -369,6 +521,10 @@ void CRhoFile::deleteFilesInFolder(const char* szFolderPath)
369
521
  delete name;
370
522
 
371
523
  return result == 0 ? 0 : (unsigned int)-1;
524
+ #elif defined (OS_ANDROID)
525
+
526
+ return iterateFolderTree(String(szFolderPath), RemoveFileFunctor(szFolderPath));
527
+
372
528
  #else
373
529
  rho_file_impl_delete_folder(szFolderPath);
374
530
  return 0;
@@ -433,6 +589,10 @@ static unsigned int copyFolder(const StringW& strSrc, const StringW& strDst, boo
433
589
  String_replace(strDstW, L'/', L'\\' );
434
590
 
435
591
  return copyFolder(strSrcW, strDstW, false);
592
+ #elif defined (OS_ANDROID)
593
+
594
+ return iterateFolderTree(String(szSrcFolderPath), CopyFileFunctor(szSrcFolderPath, szDstFolderPath));
595
+
436
596
  #else
437
597
  rho_file_impl_copy_folders_content_to_another_folder(szSrcFolderPath, szDstFolderPath);
438
598
  return 0;
@@ -450,6 +610,9 @@ static unsigned int copyFolder(const StringW& strSrc, const StringW& strDst, boo
450
610
  String_replace(strDstW, L'/', L'\\' );
451
611
 
452
612
  return copyFolder(strSrcW, strDstW, true);
613
+ #elif defined (OS_ANDROID)
614
+
615
+ return iterateFolderTree(String(szSrcFolderPath), MoveFileFunctor(szSrcFolderPath, szDstFolderPath));
453
616
 
454
617
  #else
455
618
  rho_file_impl_move_folders_content_to_another_folder(szSrcFolderPath, szDstFolderPath);
@@ -460,6 +623,11 @@ static unsigned int copyFolder(const StringW& strSrc, const StringW& strDst, boo
460
623
  }
461
624
  }
462
625
 
626
+ #ifndef OS_ANDROID
627
+ extern "C" void rho_file_set_fs_mode(int mode) {
628
+ }
629
+ #endif
630
+
463
631
  #if defined(OS_MACOSX) || defined(OS_ANDROID)
464
632
  void rho_file_impl_move_folders_content_to_another_folder(const char* szSrcFolderPath, const char* szDstFolderPath) {
465
633
 
@@ -63,7 +63,9 @@ public:
63
63
 
64
64
  static unsigned int getFileSize( const char* szFilePath );
65
65
  static bool isFileExist( const char* szFilePath );
66
+ static bool isDirectory( const char* szFilePath );
66
67
  static unsigned int deleteFile( const char* szFilePath );
68
+ static unsigned int deleteEmptyFolder( const char* szFilePath );
67
69
  static unsigned int renameFile( const char* szOldFilePath, const char* szNewFilePath );
68
70
  static void deleteFilesInFolder(const char* szFolderPath);
69
71
  static void loadTextFile(const char* szFilePath, String& strFile);
@@ -92,4 +94,6 @@ extern "C" void rho_file_impl_delete_folder(const char* szFolderPath);
92
94
  extern "C" void rho_file_impl_copy_folders_content_to_another_folder(const char* szSrcFolderPath, const char* szDstFolderPath);
93
95
  extern "C" void rho_file_impl_move_folders_content_to_another_folder(const char* szSrcFolderPath, const char* szDstFolderPath);
94
96
 
97
+ extern "C" void rho_file_set_fs_mode(int mode);
98
+
95
99
  #endif //_RHOFILE_H_
@@ -638,6 +638,36 @@ void CRhodesApp::callCallbackWithData(String strCallbackUrl, String strBody, con
638
638
  runCallbackInThread(strCallbackUrl, strBody);
639
639
  }
640
640
 
641
+ extern "C" VALUE rjson_tokener_parse(const char *str, char** pszError );
642
+
643
+ class CJsonResponse : public rho::ICallbackObject
644
+ {
645
+ String m_strJson;
646
+ public:
647
+ CJsonResponse(const char* szJson) : m_strJson(szJson) { }
648
+ virtual unsigned long getObjectValue()
649
+ {
650
+ char* szError = 0;
651
+ unsigned long valBody = rjson_tokener_parse(m_strJson.c_str(), &szError);
652
+ if ( valBody != 0 )
653
+ return valBody;
654
+
655
+ LOG(ERROR) + "Incorrect json body.Error:" + (szError ? szError : "");
656
+ if ( szError )
657
+ free(szError);
658
+
659
+ return rho_ruby_get_NIL();
660
+ }
661
+ };
662
+
663
+ void CRhodesApp::callCallbackWithJsonBody( const char* szCallback, const char* szCallbackBody, const char* szCallbackData, bool bWaitForResponse)
664
+ {
665
+ String strBody;
666
+ strBody = addCallbackObject( new CJsonResponse( szCallbackBody ), "__rho_inline" );
667
+
668
+ callCallbackWithData(szCallback, strBody, szCallbackData, bWaitForResponse );
669
+ }
670
+
641
671
  void CRhodesApp::callCameraCallback(String strCallbackUrl, const String& strImagePath,
642
672
  const String& strError, boolean bCancel )
643
673
  {
@@ -127,6 +127,7 @@ public:
127
127
 
128
128
  void callBarcodeCallback(String strCallbackUrl, const String& strBarcode, bool isError);
129
129
  void callCallbackWithData(String strCallbackUrl, String strBody, const String& strCallbackData, bool bWaitForResponse);
130
+ void callCallbackWithJsonBody( const char* szCallback, const char* szCallbackBody, const char* szCallbackData, bool bWaitForResponse);
130
131
  void callCameraCallback(String strCallbackUrl, const String& strImagePath, const String& strError, boolean bCancel );
131
132
  void callSignatureCallback(String strCallbackUrl, const String& strSignaturePath, const String& strError, boolean bCancel );
132
133
  void callDateTimeCallback(String strCallbackUrl, long lDateTime, const char* szData, int bCancel );
@@ -49,6 +49,14 @@ OSMMapView::OSMMapView(IDrawingDevice *device)
49
49
  {
50
50
  //MOHUS
51
51
  //preloadMapTiles(60.1, 30, 59.7, 30.6, 6, 12);
52
+
53
+ String url = RHOCONF().getString("OSM_map_url_roadmap");
54
+ if (url.empty())
55
+ url = "http://tile.openstreetmap.org/";
56
+ if (url[url.size() - 1] != '/')
57
+ url.push_back('/');
58
+
59
+ map_url = url + "%d/%d/%d.png";
52
60
  }
53
61
 
54
62
  int OSMMapView::getMapTile(uint64 p_zoom, uint64 p_row, uint64 p_column, void** p_data, size_t* p_size)
@@ -61,16 +69,16 @@ int OSMMapView::getMapTile(uint64 p_zoom, uint64 p_row, uint64 p_column, void**
61
69
  char buf[1024];
62
70
 
63
71
  // Open Street Map
64
- snprintf(buf, sizeof(buf), "http://a.tah.openstreetmap.org/Tiles/tile/%d/%d/%d.png", (int)p_zoom, (int)p_column, (int)p_row);
72
+ snprintf(buf, sizeof(buf), map_url.c_str(), (int)p_zoom, (int)p_column, (int)p_row);
65
73
 
66
74
  url += buf;
67
75
 
68
- RAWLOG_ERROR("########### getMapTime() BEFORE FETCH");
76
+ //RAWLOG_ERROR("########### getMapTime() BEFORE FETCH");
69
77
 
70
78
  if (!fetchData(url, &data, &datasize))
71
79
  return 0;
72
80
 
73
- RAWLOG_ERROR("########### getMapTime() AFTER FETCH");
81
+ //RAWLOG_ERROR("########### getMapTime() AFTER FETCH");
74
82
 
75
83
  *p_data = data;
76
84
  *p_size = datasize;
@@ -48,6 +48,9 @@ public:
48
48
 
49
49
  virtual void setESRILogoImage(IDrawingImage *ESRILogoImg) {}
50
50
  virtual void setGoogleLogoImage(IDrawingImage *GoogleLogoImg) {}
51
+
52
+ private:
53
+ String map_url;
51
54
  };
52
55
 
53
56
  class OSMMapEngine : public IMapEngine
@@ -52,7 +52,7 @@ LogSettings::LogSettings(){
52
52
  m_nMaxLogFileSize = 0;
53
53
  m_bLogPrefix = true;
54
54
 
55
- //m_strLogHost = "PPP_PEER";
55
+ m_strLogURL = "";
56
56
 
57
57
  m_pFileSink = new CLogFileSink(*this);
58
58
  m_pOutputSink = new CLogOutputSink(*this);
@@ -87,10 +87,9 @@ void LogSettings::initRemoteLog()
87
87
  return;
88
88
  #endif
89
89
 
90
- m_strLogHost = RHOCONF().getString("rhologhost");
91
- m_strLogPort = RHOCONF().getString("rhologport");
90
+ m_strLogURL = RHOCONF().getString("rhologurl");
92
91
 
93
- if(!m_pSocketSink && m_strLogHost != "" && m_strLogPort != "")
92
+ if(!m_pSocketSink && m_strLogURL != "")
94
93
  m_pSocketSink = new CLogSocketSink(*this);
95
94
  }
96
95
 
@@ -252,15 +251,15 @@ extern "C" {
252
251
  using namespace rho;
253
252
  using namespace rho::common;
254
253
 
255
- void rho_logconf_Init_with_separate_user_path(const char* szRootPath, const char* szLogPort, const char* szUserPath)
254
+ void rho_logconf_Init_with_separate_user_path(const char* szLogPath, const char* szRootPath, const char* szLogPort, const char* szUserPath)
256
255
  {
257
256
 
258
257
  #ifdef RHODES_EMULATOR
259
- String strRootPath = szRootPath;
258
+ String strRootPath = szLogPath;
260
259
  strRootPath += RHO_EMULATOR_DIR"/";
261
260
  rho::common::CFilePath oLogPath( strRootPath );
262
261
  #else
263
- rho::common::CFilePath oLogPath( szRootPath );
262
+ rho::common::CFilePath oLogPath( szLogPath );
264
263
  #endif
265
264
 
266
265
  //Set defaults
@@ -287,8 +286,8 @@ void rho_logconf_Init_with_separate_user_path(const char* szRootPath, const char
287
286
  LOGCONF().loadFromConf(RHOCONF());
288
287
  }
289
288
 
290
- void rho_logconf_Init(const char* szRootPath, const char* szLogPort){
291
- rho_logconf_Init_with_separate_user_path(szRootPath, szLogPort, szRootPath);
289
+ void rho_logconf_Init(const char* szLogPath, const char* szRootPath, const char* szLogPort){
290
+ rho_logconf_Init_with_separate_user_path(szLogPath, szRootPath, szLogPort, szRootPath);
292
291
  }
293
292
 
294
293
  char* rho_logconf_getText() {
@@ -55,8 +55,7 @@ class LogSettings{
55
55
  // String m_strLogConfFilePath;
56
56
  unsigned int m_nMaxLogFileSize;
57
57
 
58
- String m_strLogHost;
59
- String m_strLogPort;
58
+ String m_strLogURL;
60
59
 
61
60
  bool m_bLogPrefix;
62
61
 
@@ -99,10 +98,9 @@ public:
99
98
  bool isLogPrefix()const{ return m_bLogPrefix;}
100
99
  void setLogPrefix(bool bLogPrefix){ m_bLogPrefix = bLogPrefix; }
101
100
 
102
- const String& getLogHost() const { return m_strLogHost; }
103
- void setLogHost(const char* szLogHost) { m_strLogHost = rho::String(szLogHost); }
101
+ const String& getLogURL() const { return m_strLogURL; }
102
+ void setLogURL(const char* szLogURL) { m_strLogURL = rho::String(szLogURL); }
104
103
 
105
- const String& getLogPort() const { return m_strLogPort; }
106
104
  void initRemoteLog();
107
105
  void closeRemoteLog();
108
106
 
@@ -150,8 +148,8 @@ inline rho::LogSettings& LOGCONF(){ return rho::g_LogSettings; }
150
148
  extern "C"{
151
149
  #endif //__cplusplus
152
150
 
153
- void rho_logconf_Init(const char* szRootPath, const char* szLogPort);
154
- void rho_logconf_Init_with_separate_user_path(const char* szRootPath, const char* szLogPort, const char* szUserPath);
151
+ void rho_logconf_Init(const char* szLogPath, const char* szRootPath, const char* szLogPort);
152
+ void rho_logconf_Init_with_separate_user_path(const char* szLogPath, const char* szRootPath, const char* szLogPort, const char* szUserPath);
155
153
 
156
154
  char* rho_logconf_getText();
157
155
  int rho_logconf_getTextPos();