rhodes 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/CHANGELOG +10 -0
  2. data/lib/framework/rho/rhoerror.rb +4 -0
  3. data/lib/framework/rhodes.rb +2 -2
  4. data/lib/framework/rhom/rhom.rb +21 -1
  5. data/lib/framework/version.rb +2 -2
  6. data/lib/rhodes.rb +2 -2
  7. data/platform/android/Rhodes/AndroidManifest.xml +2 -2
  8. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +21 -6
  9. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesInstance.java +1 -1
  10. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +10 -0
  11. data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +1 -1
  12. data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +2 -2
  13. data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +4 -2
  14. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +52 -11
  15. data/platform/iphone/Classes/NativeBar.m +37 -18
  16. data/platform/iphone/Classes/Rhodes.h +2 -0
  17. data/platform/iphone/Classes/Rhodes.m +27 -8
  18. data/platform/iphone/Classes/SimpleMainView.h +7 -5
  19. data/platform/iphone/Classes/SimpleMainView.m +155 -36
  20. data/platform/iphone/Classes/TabbedMainView.h +2 -4
  21. data/platform/iphone/Classes/TabbedMainView.m +12 -10
  22. data/platform/iphone/Classes/WebView.m +1 -0
  23. data/platform/iphone/Info.plist +7 -1
  24. data/platform/iphone/icon114.png +0 -0
  25. data/platform/iphone/icon57.png +0 -0
  26. data/platform/iphone/icon72.png +0 -0
  27. data/platform/iphone/rbuild/iphone.rake +102 -16
  28. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +12 -0
  29. data/platform/shared/common/IRhoThreadImpl.h +1 -1
  30. data/platform/shared/common/PosixThreadImpl.cpp +17 -22
  31. data/platform/shared/common/PosixThreadImpl.h +1 -1
  32. data/platform/shared/common/RhoThread.cpp +7 -3
  33. data/platform/shared/common/RhoThread.h +21 -7
  34. data/platform/shared/common/RhodesApp.cpp +13 -9
  35. data/platform/shared/common/RhodesApp.h +1 -1
  36. data/platform/shared/common/ThreadQueue.cpp +6 -4
  37. data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +2 -0
  38. data/platform/shared/rubyJVM/src/com/rho/RhoThread.java +18 -8
  39. data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +70 -2
  40. data/platform/shared/rubyJVM/src/com/rho/ThreadQueue.java +143 -0
  41. data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +15 -5
  42. data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +42 -36
  43. data/platform/shared/rubyJVM/src/com/rho/sync/SyncNotify.java +63 -20
  44. data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +4 -4
  45. data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +12 -2
  46. data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RhoSupport.java +9 -3
  47. data/platform/shared/sync/ClientRegister.cpp +11 -3
  48. data/platform/shared/sync/ClientRegister.h +1 -0
  49. data/platform/shared/sync/SyncEngine.cpp +38 -35
  50. data/platform/shared/sync/SyncEngine.h +2 -1
  51. data/platform/shared/sync/SyncNotify.cpp +53 -20
  52. data/platform/shared/sync/SyncNotify.h +9 -2
  53. data/platform/shared/sync/SyncSource.cpp +3 -3
  54. data/platform/shared/sync/SyncSource.h +1 -1
  55. data/platform/shared/sync/SyncThread.cpp +9 -2
  56. data/platform/wm/rhodes/Alert.cpp +35 -21
  57. data/platform/wm/rhodes/Alert.h +11 -2
  58. data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +11 -12
  59. data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +2 -0
  60. data/res/generators/templates/application/build.yml +1 -1
  61. data/rhodes.gemspec +2 -2
  62. data/spec/framework_spec/rhoconfig.txt +1 -0
  63. data/spec/phone_spec/rhoconfig.txt +2 -0
  64. metadata +8 -5
  65. data/Manifest.txt +0 -5333
@@ -22,6 +22,7 @@
22
22
  // perform actual url loading from time to time
23
23
  int index;
24
24
  [value getValue:&index];
25
+ [[Rhodes sharedInstance] hideSplash];
25
26
  [[[Rhodes sharedInstance] mainView] navigateRedirect:url tab:index];
26
27
  }
27
28
  @end
@@ -10,6 +10,12 @@
10
10
  <string>${EXECUTABLE_NAME}</string>
11
11
  <key>CFBundleIconFile</key>
12
12
  <string>icon.png</string>
13
+ <key>CFBundleIconFiles</key>
14
+ <array>
15
+ <string>icon57</string>
16
+ <string>icon72</string>
17
+ <string>icon114</string>
18
+ </array>
13
19
  <key>CFBundleIdentifier</key>
14
20
  <string>com.rhomobile.rhosyncclient</string>
15
21
  <key>CFBundleInfoDictionaryVersion</key>
@@ -21,7 +27,7 @@
21
27
  <key>CFBundleSignature</key>
22
28
  <string>????</string>
23
29
  <key>CFBundleVersion</key>
24
- <string>2.0.2</string>
30
+ <string>2.0.3</string>
25
31
  <key>LSRequiresIPhoneOS</key>
26
32
  <true/>
27
33
  </dict>
Binary file
Binary file
Binary file
@@ -23,6 +23,38 @@ def set_app_name(newname)
23
23
 
24
24
  end
25
25
 
26
+ ICONS = ['icon', 'icon57', 'icon72', 'icon114']
27
+
28
+ def restore_app_icon
29
+ puts "restore icon"
30
+ ipath = $config["build"]["iphonepath"]
31
+ ICONS.each do |name|
32
+ ibak = File.join(ipath, name + '.bak')
33
+ icon = File.join(ipath, name + '.png')
34
+ next if !File.exists? ibak
35
+ rm_f icon
36
+ cp ibak, icon
37
+ rm_f ibak
38
+ end
39
+ end
40
+
41
+ def set_app_icon
42
+ puts "set icon"
43
+ ipath = $config["build"]["iphonepath"]
44
+ begin
45
+ ICONS.each do |name|
46
+ ibak = File.join(ipath, name + '.bak')
47
+ icon = File.join(ipath, name + '.png')
48
+ appicon = File.join($app_path, 'icon', name + '.png')
49
+ cp icon, ibak unless File.exists? ibak
50
+ cp appicon, ipath
51
+ end
52
+ rescue => e
53
+ puts "WARNING!!! Can not change icon: #{e.to_s}"
54
+ end
55
+
56
+ end
57
+
26
58
  def set_signing_identity(identity,profile,entitlements)
27
59
  fname = $config["build"]["iphonepath"] + "/rhorunner.xcodeproj/project.pbxproj"
28
60
  buf = ""
@@ -76,6 +108,8 @@ namespace "config" do
76
108
  $excludelib = ['**/builtinME.rb','**/ServeME.rb','**/TestServe.rb']
77
109
  $tmpdir = $bindir +"/tmp"
78
110
 
111
+ $devroot = '/Developer' if $devroot.nil?
112
+
79
113
  $homedir = ENV['HOME']
80
114
  $simdir = "#{$homedir}/Library/Application Support/iPhone Simulator/"
81
115
  $sim="/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications"
@@ -97,6 +131,14 @@ namespace "config" do
97
131
  $sdk = $app_config["iphone"]["sdk"]
98
132
  end
99
133
 
134
+ if $sdk =~ /iphonesimulator/
135
+ $sdkroot = $devroot + "/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" +
136
+ $sdk.gsub(/iphonesimulator/,"") + ".sdk"
137
+ else
138
+ $sdkroot = $devroot + "/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" +
139
+ $sdk.gsub(/iphoneos/,"") + ".sdk"
140
+ end
141
+
100
142
  unless File.exists? $homedir + "/.profile"
101
143
  File.open($homedir + "/.profile","w") {|f| f << "#" }
102
144
  chmod 0744, $homedir + "/.profile"
@@ -138,14 +180,11 @@ namespace "build" do
138
180
  simulator = $sdk =~ /iphonesimulator/
139
181
  ENV["PLATFORM_DEVELOPER_BIN_DIR"] ||= "/Developer/Platforms/" + ( simulator ? "iPhoneSimulator" : "iPhoneOS" ) +
140
182
  ".platform/Developer/usr/bin"
183
+ ENV["SDKROOT"] = $sdkroot
184
+
185
+ #ENV["SDKROOT"] = $xcode_sdk_dir if not $xcode_sdk_dir.nil?
186
+
141
187
 
142
- if simulator
143
- ENV["SDKROOT"] ||= "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" +
144
- $sdk.gsub(/iphonesimulator/,"") + ".sdk"
145
- else
146
- ENV["SDKROOT"] ||= "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" +
147
- $sdk.gsub(/iphoneos/,"") + ".sdk"
148
- end
149
188
  ENV["BUILD_DIR"] ||= $startdir + "/platform/iphone/build"
150
189
  ENV["TARGET_TEMP_DIR"] ||= $startdir + "/platform/iphone/build/rhorunner.build/#{$configuration}-" +
151
190
  ( simulator ? "iphonesimulator" : "iphoneos") + "/rhorunner.build"
@@ -171,9 +210,7 @@ namespace "build" do
171
210
  task :rhodes => ["config:iphone", "build:iphone:rhobundle"] do
172
211
 
173
212
  set_app_name($app_config["name"]) unless $app_config["name"].nil?
174
- ipath = $config["build"]["iphonepath"]
175
- cp File.join(ipath, 'icon.png'), File.join(ipath, 'icon.png.bak') unless File.exists? File.join(ipath, 'icon.png.bak')
176
- cp $app_path + "/icon/icon.png", ipath
213
+ set_app_icon
177
214
 
178
215
  set_signing_identity($signidentity,$provisionprofile,$entitlements.to_s) if $signidentity.to_s != ""
179
216
 
@@ -185,9 +222,7 @@ namespace "build" do
185
222
 
186
223
  chdir $startdir
187
224
  set_app_name("Rhodes") unless $app_config["name"].nil?
188
- rm_f File.join(ipath, 'icon.png')
189
- cp File.join(ipath, 'icon.png.bak'), File.join(ipath, 'icon.png')
190
- rm_f File.join(ipath, 'icon.png.bak')
225
+ restore_app_icon
191
226
 
192
227
  unless ret == 0
193
228
  puts "Error cleaning"
@@ -208,15 +243,66 @@ namespace "run" do
208
243
  end
209
244
  `killall "iPhone Simulator"`
210
245
 
211
- puts "sdk: #{$sdk.inspect.to_s}"
212
246
  sdkver = $sdk.gsub(/^iphonesimulator/, '')
213
-
247
+
248
+ elements = []
249
+ binplist = File.join(ENV['HOME'], 'Library', 'Preferences', 'com.apple.iphonesimulator.plist')
250
+ xmlplist = '/tmp/iphone.plist'
251
+ if File.exists? binplist
252
+ `plutil -convert xml1 -o #{xmlplist} #{binplist}`
253
+
254
+ elements = []
255
+ doc = REXML::Document.new(File.new(xmlplist))
256
+ nextignore = false
257
+ doc.elements.each('plist/dict/*') do |element|
258
+ if nextignore
259
+ nextignore = false
260
+ next
261
+ end
262
+ if element.name == 'key'
263
+ if element.text == 'currentSDKRoot' or element.text == 'SimulateDevice'
264
+ nextignore = true
265
+ next
266
+ end
267
+ end
268
+
269
+ elements << element
270
+ end
271
+ end
272
+
273
+ e = REXML::Element.new 'key'
274
+ e.text = 'SimulateDevice'
275
+ elements << e
276
+ e = REXML::Element.new 'string'
277
+ e.text = sdkver == '3.2' ? 'iPad' : 'iPhone'
278
+ elements << e
279
+ e = REXML::Element.new 'key'
280
+ e.text = 'currentSDKRoot'
281
+ elements << e
282
+ e = REXML::Element.new 'string'
283
+ e.text = $sdkroot
284
+ elements << e
285
+
286
+ File.open(xmlplist, 'w') do |f|
287
+ f.puts "<?xml version=\"1.0\" encoding=\"UTF-8'\"?>"
288
+ f.puts "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
289
+ f.puts "<plist version=\"1.0\">"
290
+ f.puts "<dict>"
291
+ elements.each do |e|
292
+ f.puts "\t#{e.to_s}"
293
+ end
294
+ f.puts "</dict>"
295
+ f.puts "</plist>"
296
+ end
297
+
298
+ `plutil -convert binary1 -o #{binplist} #{xmlplist}`
299
+
214
300
  rhorunner = $config["build"]["iphonepath"] + "/build/#{$configuration}-iphonesimulator/rhorunner.app"
215
301
  puts "rhorunner: #{rhorunner}"
216
302
 
217
-
218
303
  puts "our app name: #{$app_config['name']}"
219
304
  puts "simdir: #{$simdir}"
305
+
220
306
  Dir.glob(File.join($simdir, sdkver, "Applications", "*")).each do |simapppath|
221
307
  need_rm = true if File.directory? simapppath
222
308
  if File.exists?(File.join(simapppath, 'rhorunner.app', 'name'))
@@ -37,6 +37,9 @@
37
37
  BDB15ED510B2EC8700003DFA /* librhorubylib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F59F16000E9449B8004103B4 /* librhorubylib.a */; };
38
38
  BDB373661144220F006EA6DA /* SimpleMainView.m in Sources */ = {isa = PBXBuildFile; fileRef = BDB373651144220F006EA6DA /* SimpleMainView.m */; };
39
39
  BDB373C511444A8F006EA6DA /* Rhodes.m in Sources */ = {isa = PBXBuildFile; fileRef = BDB373C411444A8F006EA6DA /* Rhodes.m */; };
40
+ BDC6F34911F4ABBF0056C1C3 /* icon57.png in Resources */ = {isa = PBXBuildFile; fileRef = BDC6F34611F4ABBF0056C1C3 /* icon57.png */; };
41
+ BDC6F34A11F4ABBF0056C1C3 /* icon72.png in Resources */ = {isa = PBXBuildFile; fileRef = BDC6F34711F4ABBF0056C1C3 /* icon72.png */; };
42
+ BDC6F34B11F4ABBF0056C1C3 /* icon114.png in Resources */ = {isa = PBXBuildFile; fileRef = BDC6F34811F4ABBF0056C1C3 /* icon114.png */; };
40
43
  BDE35A7A107F900A009941C7 /* RhoFileImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = BDE35A79107F900A009941C7 /* RhoFileImpl.m */; };
41
44
  BDFBD99610B1B99A00BAAFAB /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = BDFBD99510B1B99A00BAAFAB /* Entitlements.plist */; };
42
45
  BDFBD99A10B1B9A900BAAFAB /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BDFBD99910B1B9A900BAAFAB /* Settings.bundle */; };
@@ -183,6 +186,9 @@
183
186
  BDB373651144220F006EA6DA /* SimpleMainView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleMainView.m; sourceTree = "<group>"; };
184
187
  BDB373C3114449B6006EA6DA /* Rhodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Rhodes.h; sourceTree = "<group>"; };
185
188
  BDB373C411444A8F006EA6DA /* Rhodes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Rhodes.m; sourceTree = "<group>"; };
189
+ BDC6F34611F4ABBF0056C1C3 /* icon57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon57.png; sourceTree = SOURCE_ROOT; };
190
+ BDC6F34711F4ABBF0056C1C3 /* icon72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.png; sourceTree = SOURCE_ROOT; };
191
+ BDC6F34811F4ABBF0056C1C3 /* icon114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon114.png; sourceTree = SOURCE_ROOT; };
186
192
  BDE35A79107F900A009941C7 /* RhoFileImpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RhoFileImpl.m; sourceTree = "<group>"; };
187
193
  BDFBD99510B1B99A00BAAFAB /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = "<group>"; };
188
194
  BDFBD99910B1B9A900BAAFAB /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
@@ -258,6 +264,9 @@
258
264
  080E96DDFE201D6D7F000001 /* Classes */ = {
259
265
  isa = PBXGroup;
260
266
  children = (
267
+ BDC6F34611F4ABBF0056C1C3 /* icon57.png */,
268
+ BDC6F34711F4ABBF0056C1C3 /* icon72.png */,
269
+ BDC6F34811F4ABBF0056C1C3 /* icon114.png */,
261
270
  BDFBD9A610B1BA2000BAAFAB /* icon.png */,
262
271
  BD97AC1E1160EE7A006960F9 /* Alert */,
263
272
  F579170F0E8AB2A200BBC54D /* AppManager */,
@@ -682,6 +691,9 @@
682
691
  BDFBD9A410B1B9E500BAAFAB /* forward_btn.png in Resources */,
683
692
  BDFBD9A510B1B9E500BAAFAB /* home_btn.png in Resources */,
684
693
  BDFBD9A710B1BA2000BAAFAB /* icon.png in Resources */,
694
+ BDC6F34911F4ABBF0056C1C3 /* icon57.png in Resources */,
695
+ BDC6F34A11F4ABBF0056C1C3 /* icon72.png in Resources */,
696
+ BDC6F34B11F4ABBF0056C1C3 /* icon114.png in Resources */,
685
697
  );
686
698
  runOnlyForDeploymentPostprocessing = 0;
687
699
  };
@@ -7,7 +7,7 @@ struct IRhoRunnable
7
7
  {
8
8
  enum EPriority{ epNormal = 0, epHigh, epLow};
9
9
 
10
- virtual void run() = 0;
10
+ virtual void runObject() = 0;
11
11
  };
12
12
 
13
13
  struct IRhoThreadImpl
@@ -14,27 +14,7 @@ namespace common
14
14
  IMPLEMENT_LOGCLASS(CPosixThreadImpl, "RhoThread");
15
15
 
16
16
  CPosixThreadImpl::CPosixThreadImpl()
17
- :m_started(false)
18
- {}
19
-
20
- void *runProc(void *pv)
21
17
  {
22
- IRhoRunnable *p = static_cast<IRhoRunnable *>(pv);
23
- void *pData = rho_nativethread_start();
24
- p->run();
25
- rho_nativethread_end(pData);
26
- return 0;
27
- }
28
-
29
- void CPosixThreadImpl::start(IRhoRunnable *pRunnable, IRhoRunnable::EPriority ePriority)
30
- {
31
- {
32
- common::CMutexLock lock(m_mxSync);
33
- if (m_started)
34
- return;
35
- m_started = true;
36
- }
37
-
38
18
  #if defined(OS_ANDROID)
39
19
  // Android has no pthread_condattr_xxx API
40
20
  pthread_cond_init(&m_condSync, NULL);
@@ -44,7 +24,24 @@ void CPosixThreadImpl::start(IRhoRunnable *pRunnable, IRhoRunnable::EPriority eP
44
24
  pthread_cond_init(&m_condSync, &sync_details);
45
25
  pthread_condattr_destroy(&sync_details);
46
26
  #endif
27
+ }
28
+
29
+ CPosixThreadImpl::~CPosixThreadImpl()
30
+ {
31
+ pthread_cond_destroy(&m_condSync);
32
+ }
47
33
 
34
+ void *runProc(void *pv)
35
+ {
36
+ IRhoRunnable *p = static_cast<IRhoRunnable *>(pv);
37
+ void *pData = rho_nativethread_start();
38
+ p->runObject();
39
+ rho_nativethread_end(pData);
40
+ return 0;
41
+ }
42
+
43
+ void CPosixThreadImpl::start(IRhoRunnable *pRunnable, IRhoRunnable::EPriority ePriority)
44
+ {
48
45
  pthread_attr_t attr;
49
46
  int return_val = pthread_attr_init(&attr);
50
47
  //return_val = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@@ -71,8 +68,6 @@ void CPosixThreadImpl::stop(unsigned int nTimeoutToKill)
71
68
  //TODO: wait for nTimeoutToKill and kill thread
72
69
  void* status;
73
70
  pthread_join(m_thread,&status);
74
-
75
- pthread_cond_destroy(&m_condSync);
76
71
  }
77
72
 
78
73
  void CPosixThreadImpl::wait(unsigned int nTimeout)
@@ -14,6 +14,7 @@ class CPosixThreadImpl : public IRhoThreadImpl
14
14
  DEFINE_LOGCLASS;
15
15
  public:
16
16
  CPosixThreadImpl();
17
+ ~CPosixThreadImpl();
17
18
 
18
19
  void start(IRhoRunnable *pRunnable, IRhoRunnable::EPriority ePriority);
19
20
  void stop(unsigned int nTimeoutToKill);
@@ -25,7 +26,6 @@ private:
25
26
  pthread_cond_t m_condSync;
26
27
  common::CMutex m_mxSync;
27
28
  pthread_t m_thread;
28
- bool m_started;
29
29
  };
30
30
 
31
31
  } // namespace common
@@ -6,14 +6,18 @@ namespace common {
6
6
 
7
7
  CRhoThread::CRhoThread(IRhoClassFactory* factory)
8
8
  {
9
- m_isInWaitState = false;
10
- m_bStop = false;
9
+ m_nState = TS_NONE;
11
10
  m_pImpl = factory->createThreadImpl();
12
11
  }
13
12
 
14
13
  void CRhoThread::start(EPriority ePriority)
15
14
  {
16
- m_pImpl->start(this, ePriority);
15
+ if ( !isRunning() )
16
+ {
17
+ m_pImpl->start(this, ePriority);
18
+
19
+ m_nState = TS_RUNNING;
20
+ }
17
21
  }
18
22
 
19
23
  }
@@ -1,5 +1,6 @@
1
1
  #pragma once
2
2
 
3
+ #include "RhoStd.h"
3
4
  #include "IRhoThreadImpl.h"
4
5
  #include "AutoPointer.h"
5
6
 
@@ -10,20 +11,33 @@ struct IRhoClassFactory;
10
11
  class CRhoThread : public IRhoRunnable
11
12
  {
12
13
  CAutoPtr<IRhoThreadImpl> m_pImpl;
13
- bool m_isInWaitState;
14
- bool m_bStop;
14
+ static const int TS_NONE = 0;
15
+ static const int TS_WAIT = 1;
16
+ static const int TS_STOPPING = 2;
17
+ static const int TS_RUNNING = 4;
18
+
19
+ int m_nState;
15
20
  public:
16
21
 
17
22
  CRhoThread(IRhoClassFactory* factory);
18
- virtual ~CRhoThread(void){}
23
+ virtual ~CRhoThread(void){};
19
24
 
20
25
  virtual void start(EPriority ePriority);
21
- virtual void stop(unsigned int nTimeoutToKill){ m_bStop = true; m_pImpl->stop(nTimeoutToKill); }
22
- virtual void wait(unsigned int nTimeout){ m_isInWaitState = true; m_pImpl->wait(nTimeout); m_isInWaitState = false; }
23
- virtual void stopWait(){ if (m_isInWaitState) m_pImpl->stopWait(); }
26
+ virtual void stop(unsigned int nTimeoutToKill){ m_nState |= TS_STOPPING; m_pImpl->stop(nTimeoutToKill); m_nState &= ~TS_STOPPING; }
27
+ virtual void wait(unsigned int nTimeout){ m_nState |= TS_WAIT; m_pImpl->wait(nTimeout); m_nState &= ~TS_WAIT; }
28
+ virtual void stopWait(){ if (isWaiting()) m_pImpl->stopWait(); }
24
29
  virtual void sleep(unsigned int nTimeout){ m_pImpl->sleep(nTimeout); }
30
+ virtual void run() = 0;
31
+ virtual void runObject()
32
+ {
33
+ run();
34
+ m_nState = TS_NONE;
35
+ }
36
+
37
+ boolean isStopping(){return (m_nState&TS_STOPPING) != 0;}
38
+ boolean isWaiting(){return (m_nState&TS_WAIT) != 0;}
39
+ boolean isRunning(){return (m_nState&TS_RUNNING) != 0;}
25
40
 
26
- bool isStopped(){return m_bStop;}
27
41
  };
28
42
 
29
43
  }
@@ -465,9 +465,15 @@ void CRhodesApp::keepLastVisitedUrl(String strUrl)
465
465
  void CRhodesApp::setAppBackUrl(const String& url)
466
466
  {
467
467
  if ( url.length() > 0 )
468
+ {
469
+ m_strAppBackUrlOrig = url;
468
470
  m_strAppBackUrl = canonicalizeRhoUrl(url);
471
+ }
469
472
  else
473
+ {
474
+ m_strAppBackUrlOrig = "";
470
475
  m_strAppBackUrl = "";
476
+ }
471
477
  }
472
478
 
473
479
  String CRhodesApp::getAppTitle()
@@ -502,7 +508,7 @@ const String& CRhodesApp::getOptionsUrl()
502
508
  return m_strOptionsUrl;
503
509
  }
504
510
 
505
- const String& CRhodesApp::getCurrentUrl(int index)
511
+ const String& CRhodesApp::getCurrentUrl(int /*index*/)
506
512
  {
507
513
  return m_currentUrls[m_currentTabIndex];
508
514
  }
@@ -533,10 +539,10 @@ void CRhodesApp::navigateToUrl( const String& strUrl)
533
539
 
534
540
  void CRhodesApp::navigateBack()
535
541
  {
536
- rho::String strAppUrl = getAppBackUrl();
542
+ //rho::String strAppUrl = getAppBackUrl();
537
543
 
538
- if ( strAppUrl.length() > 0 )
539
- rho_webview_navigate(strAppUrl.c_str(), 0);
544
+ if ( m_strAppBackUrlOrig.length() > 0 )
545
+ loadUrl(m_strAppBackUrlOrig);
540
546
  else if ( strcasecmp(getCurrentUrl().c_str(),getStartUrl().c_str()) != 0 )
541
547
  rho_webview_navigate_back();
542
548
  }
@@ -700,18 +706,16 @@ void CRhodesApp::callScreenRotationCallback(int width, int height, int degrees)
700
706
  void CRhodesApp::loadUrl(String url)
701
707
  {
702
708
  boolean callback = false;
703
- if (url.size() >= 9 && url.substr(0, 9) == "callback:")
709
+ if (String_startsWith(url, "callback:") )
704
710
  {
705
711
  callback = true;
706
712
  url = url.substr(9);
707
713
  }
708
- char *s = rho_http_normalizeurl(url.c_str());
709
- url = s;
710
- free(s);
714
+ url = canonicalizeRhoUrl(url);
711
715
  if (callback)
712
716
  {
713
717
  common::CAutoPtr<net::INetRequest> pNetRequest = m_ptrFactory->createNetRequest();
714
- NetResponse(resp, pNetRequest->pullData( url, null ));
718
+ NetResponse(resp, pNetRequest->pushData( url, "rho_callback=1", null ));
715
719
  (void)resp;
716
720
  }
717
721
  else