rhodes 2.2.4.beta.1 → 2.2.5.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +10 -0
- data/Rakefile +119 -3
- data/lib/build/jake.rb +15 -1
- data/lib/framework/dateME.rb +6 -1
- data/lib/framework/rho/render.rb +18 -15
- data/lib/framework/rho/rho.rb +105 -43
- data/lib/framework/rho/rhoapplication.rb +1 -1
- data/lib/framework/rho/rhocontact.rb +41 -13
- data/lib/framework/rho/rhocontroller.rb +10 -1
- data/lib/framework/rho/rhoevent_c.rb +6 -1
- data/lib/framework/rho/rhosupport.rb +1 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rholang/rhomsg_de.rb +1 -1
- data/lib/framework/rholang/rhomsg_es.rb +1 -1
- data/lib/framework/rholang/rhomsg_it.rb +28 -0
- data/lib/framework/rhom/rhom.rb +6 -0
- data/lib/framework/rhom/rhom_model.rb +14 -7
- data/lib/framework/rhom/rhom_object_factory.rb +121 -56
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.full.xml +62 -0
- data/platform/android/Rhodes/AndroidManifest.xml +3 -34
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +17 -2
- data/platform/android/Rhodes/jni/src/alert.cpp +16 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +27 -3
- data/platform/android/Rhodes/jni/src/nativebar.cpp +3 -0
- data/platform/android/Rhodes/jni/src/nativeview.cpp +131 -1
- data/platform/android/Rhodes/jni/src/phonebook.cpp +102 -41
- data/platform/android/Rhodes/jni/src/rhodes.cpp +113 -32
- data/platform/android/Rhodes/jni/src/ringtones.cpp +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +9 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +184 -49
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +49 -25
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +104 -57
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +36 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +24 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +7 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +185 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +54 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +107 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +72 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +22 -21
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +91 -11
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +10 -0
- data/platform/android/build/android.rake +50 -9
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +3 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/SchemaManager.java +3 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +7 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +2 -2
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +22 -0
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +51 -4
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +21 -10
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +82 -33
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +59 -6
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyFloat_Methods.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +19 -7
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/ArrayPacker.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFloat.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +55 -11
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +18 -2
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +8 -5
- data/platform/bb/RubyVM/src/j2me/lang/CharacterMe.java +1 -1
- data/platform/bb/RubyVM/src/j2me/util/StringParser.java +2 -0
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +21 -2
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +3 -3
- data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +1 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -2
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +15 -16
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +4 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +58 -0
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +90 -4
- data/platform/iphone/Classes/AppManager/AppManager.m +43 -5
- data/platform/iphone/Classes/Event/Event.h +2 -0
- data/platform/iphone/Classes/Event/Event.m +12 -1
- data/platform/iphone/Classes/GeoLocation/LocationController.m +9 -3
- data/platform/iphone/Classes/MapView/MapViewController.m +20 -9
- data/platform/iphone/Classes/NativeBar.m +27 -0
- data/platform/iphone/Classes/Phonebook/phonebook.m +17 -0
- data/platform/iphone/Classes/RhoAlert.m +61 -1
- data/platform/iphone/Classes/RhoMainView.h +1 -0
- data/platform/iphone/Classes/Rhodes.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +108 -1
- data/platform/iphone/Classes/SimpleMainView.h +4 -0
- data/platform/iphone/Classes/SimpleMainView.m +30 -3
- data/platform/iphone/Classes/SplashViewController.m +3 -1
- data/platform/iphone/Classes/TabbedMainView.h +2 -0
- data/platform/iphone/Classes/TabbedMainView.m +63 -11
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +26 -0
- data/platform/iphone/Info.plist +12 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +8 -0
- data/platform/iphone/rbuild/iphone.rake +181 -25
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +5 -5
- data/platform/shared/common/IRhoThreadImpl.h +1 -1
- data/platform/shared/common/PosixThreadImpl.cpp +5 -3
- data/platform/shared/common/PosixThreadImpl.h +1 -1
- data/platform/shared/common/RhoFilePath.h +11 -0
- data/platform/shared/common/RhoNativeViewManager.h +17 -0
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhodesApp.cpp +29 -8
- data/platform/shared/common/ThreadQueue.cpp +5 -3
- data/platform/shared/common/ThreadQueue.h +2 -1
- data/platform/shared/common/app_build_configs.c +25 -0
- data/platform/shared/common/app_build_configs.h +11 -0
- data/platform/shared/net/AsyncHttp.cpp +5 -5
- data/platform/shared/net/CURLNetRequest.cpp +25 -7
- data/platform/shared/net/CURLNetRequest.h +2 -1
- data/platform/shared/net/HttpServer.cpp +28 -0
- data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +26 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +6 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
- data/platform/shared/ruby/ext/rho/rhosupport.c +15 -2
- data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -2
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +97 -2
- data/platform/shared/ruby/ext/system/system.i +13 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +104 -1
- data/platform/shared/rubyext/RhoAppAdapter.cpp +7 -0
- data/platform/shared/sync/SyncEngine.cpp +43 -3
- data/platform/shared/sync/SyncEngine.h +13 -0
- data/platform/shared/sync/SyncNotify.cpp +41 -23
- data/platform/shared/sync/SyncNotify.h +18 -4
- data/platform/shared/sync/SyncSource.cpp +52 -14
- data/platform/shared/sync/SyncSource.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +29 -9
- data/platform/shared/sync/SyncThread.h +4 -2
- data/platform/wm/RhoLib/RhoLib.vcproj +8 -0
- data/platform/wm/build/build_inf.js +15 -9
- data/platform/wm/build/wm.rake +10 -5
- data/platform/wm/rhodes/Alert.cpp +10 -0
- data/platform/wm/rhodes/Alert.h +3 -3
- data/platform/wm/rhodes/MainWindow.cpp +171 -26
- data/platform/wm/rhodes/MainWindow.h +23 -1
- data/platform/wm/rhodes/MetaHandler.cpp +192 -0
- data/platform/wm/rhodes/MetaHandler.h +31 -0
- data/platform/wm/rhodes/RhoNativeViewManager.cpp +126 -0
- data/platform/wm/rhodes/RhoNativeViewManagerWM.h +20 -0
- data/platform/wm/rhodes/Rhodes.cpp +91 -2
- data/platform/wm/rhodes/Rhodes.rc +15 -6
- data/platform/wm/rhodes/SyncStatusDlg.cpp +32 -0
- data/platform/wm/rhodes/SyncStatusDlg.h +29 -0
- data/platform/wm/rhodes/resource.h +5 -2
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +3 -1
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +146 -14
- data/platform/wm/rhodes/rhodes.vcproj +28 -0
- data/rakefile.rb +119 -3
- data/res/build-tools/iphonesim/README +58 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.h +43 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +224 -0
- data/res/build-tools/iphonesim/Source/main.m +52 -0
- data/res/build-tools/iphonesim/Source/nsprintf.h +3 -0
- data/res/build-tools/iphonesim/Source/nsprintf.m +42 -0
- data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
- data/res/build-tools/iphonesim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h +124 -0
- data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +261 -0
- data/res/build-tools/iphonesim/iphonesim_Prefix.pch +7 -0
- data/res/generators/rhogen.rb +5 -0
- data/res/generators/templates/application/app/layout.erb +7 -13
- data/res/generators/templates/application/app/loading.png +0 -0
- data/res/generators/templates/application/build.yml +3 -0
- data/res/generators/templates/application/icon/icon114.png +0 -0
- data/res/generators/templates/application/icon/icon57.png +0 -0
- data/res/generators/templates/application/icon/icon72.png +0 -0
- data/res/generators/templates/application/public/css/iphone.css +96 -0
- data/res/generators/templates/application/public/images/backButton.png +0 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +2 -1
- data/res/generators/templates/application/rhoconfig.txt +2 -0
- data/rhodes.gemspec +1 -1
- data/spec/phone_spec/app/spec/array_pack_spec.rb +108 -0
- data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
- data/spec/phone_spec/app/spec/date_spec.rb +27 -0
- data/spec/phone_spec/app/spec/fixtures/classes.rb +91 -0
- data/spec/phone_spec/app/spec/lstrip_spec.rb +57 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +50 -19
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +78 -0
- data/spec/phone_spec/app/spec/rstrip_spec.rb +51 -0
- data/spec/phone_spec/app/spec/strip_spec.rb +50 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +46 -3
- data/spec/phone_spec/app/spec_runner.rb +6 -0
- metadata +34 -4
@@ -0,0 +1,126 @@
|
|
1
|
+
#include "stdafx.h"
|
2
|
+
|
3
|
+
//#include <common/RhodesApp.h>
|
4
|
+
//#include <logging/RhoLogConf.h>
|
5
|
+
|
6
|
+
|
7
|
+
#include <stdlib.h>
|
8
|
+
//#include <strings.h>
|
9
|
+
|
10
|
+
#include "MainWindow.h"
|
11
|
+
#include "common/RhodesApp.h"
|
12
|
+
|
13
|
+
#include "logging/RhoLog.h"
|
14
|
+
#include "Utils.h"
|
15
|
+
|
16
|
+
|
17
|
+
#include "RhoNativeViewManagerWM.h"
|
18
|
+
|
19
|
+
extern "C" HWND getWebViewWnd();
|
20
|
+
extern "C" HWND getMainWnd();
|
21
|
+
|
22
|
+
class RhoNativeViewHolder{
|
23
|
+
public :
|
24
|
+
RhoNativeViewHolder() {
|
25
|
+
factory = NULL;
|
26
|
+
next = NULL;
|
27
|
+
viewtype = NULL;
|
28
|
+
}
|
29
|
+
virtual ~RhoNativeViewHolder() {
|
30
|
+
if (viewtype != NULL) {
|
31
|
+
delete viewtype;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
void setViewType(const char* viewtypename) {
|
35
|
+
viewtype = new char[strlen(viewtypename)+2];
|
36
|
+
strcpy(viewtype, viewtypename);
|
37
|
+
}
|
38
|
+
bool isApplicable(const char* viewtypename) {
|
39
|
+
return (strcmp(viewtype, viewtypename) == 0);
|
40
|
+
}
|
41
|
+
char* viewtype;
|
42
|
+
NativeViewFactory* factory;
|
43
|
+
RhoNativeViewHolder* next;
|
44
|
+
};
|
45
|
+
|
46
|
+
static RhoNativeViewHolder* first = NULL;
|
47
|
+
|
48
|
+
|
49
|
+
static void addRhoNativeViewHolder(RhoNativeViewHolder* holder) {
|
50
|
+
if (first == NULL) {
|
51
|
+
first = holder;
|
52
|
+
holder->next = NULL;
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
holder->next = first;
|
56
|
+
first = holder;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
static void removeRhoNativeViewHolder(RhoNativeViewHolder* holder) {
|
61
|
+
RhoNativeViewHolder* p = first;
|
62
|
+
RhoNativeViewHolder* prev = NULL;
|
63
|
+
while (p != NULL) {
|
64
|
+
if (p == holder) {
|
65
|
+
RhoNativeViewHolder* next = p->next;
|
66
|
+
if (prev != NULL) {
|
67
|
+
prev->next = next;
|
68
|
+
}
|
69
|
+
if (first == p) {
|
70
|
+
first = NULL;
|
71
|
+
}
|
72
|
+
delete p;
|
73
|
+
}
|
74
|
+
prev = p;
|
75
|
+
p = p->next;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
static RhoNativeViewHolder* getHolderByViewTypeName(const char* name) {
|
80
|
+
RhoNativeViewHolder* p = first;
|
81
|
+
while (p != NULL) {
|
82
|
+
if (p->isApplicable(name)) {
|
83
|
+
return p;
|
84
|
+
}
|
85
|
+
p = p->next;
|
86
|
+
}
|
87
|
+
return NULL;
|
88
|
+
}
|
89
|
+
|
90
|
+
|
91
|
+
void RhoNativeViewManager::registerViewType(const char* viewType, NativeViewFactory* factory) {
|
92
|
+
RhoNativeViewHolder* holder = new RhoNativeViewHolder();
|
93
|
+
holder->factory = factory;
|
94
|
+
holder->setViewType(viewType);
|
95
|
+
addRhoNativeViewHolder(holder);
|
96
|
+
}
|
97
|
+
|
98
|
+
void RhoNativeViewManager::unregisterViewType(const char* viewType) {
|
99
|
+
RhoNativeViewHolder* holder = getHolderByViewTypeName(viewType);
|
100
|
+
if (holder != NULL) {
|
101
|
+
removeRhoNativeViewHolder(holder);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
// that function return native object used for display Web content :
|
106
|
+
// UIWebView* for iPhone
|
107
|
+
// jobject for Android - jobect is android.webkit.WebView class type
|
108
|
+
// HWND for Windows Mobile
|
109
|
+
void* RhoNativeViewManager::getWebViewObject(int tab_index) {
|
110
|
+
HWND main_wnd = getMainWnd();//getWebViewWnd();
|
111
|
+
return main_wnd;
|
112
|
+
}
|
113
|
+
|
114
|
+
NativeViewFactory* RhoNativeViewManagerWM::getFactoryByViewType(const char* viewtype) {
|
115
|
+
RhoNativeViewHolder* h = getHolderByViewTypeName(viewtype);
|
116
|
+
if (h != NULL) {
|
117
|
+
return h->factory;
|
118
|
+
}
|
119
|
+
return NULL;
|
120
|
+
}
|
121
|
+
|
122
|
+
void RhoNativeViewUtil::executeInUIThread_WM(RhoNativeViewRunnable* command) {
|
123
|
+
HWND main_wnd = getMainWnd();
|
124
|
+
::PostMessage(main_wnd, WM_EXECUTE_COMMAND, (WPARAM)command, 0);
|
125
|
+
|
126
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
* RhoNativeViewManagerWM.h
|
3
|
+
* rhorunner
|
4
|
+
*
|
5
|
+
* Created by Dmitry Soldatenkov on 10/08/2010.
|
6
|
+
* Copyright 2010 Rhomobile. All rights reserved.
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
|
10
|
+
#ifndef _RHO_NATIVE_VIEW_MANAGER_WM_
|
11
|
+
#define _RHO_NATIVE_VIEW_MANAGER_WM_
|
12
|
+
|
13
|
+
#include "common/RhoNativeViewManager.h"
|
14
|
+
|
15
|
+
class RhoNativeViewManagerWM {
|
16
|
+
public:
|
17
|
+
static NativeViewFactory* getFactoryByViewType(const char* viewtype);
|
18
|
+
};
|
19
|
+
|
20
|
+
#endif
|
@@ -5,6 +5,7 @@
|
|
5
5
|
#include "common/RhodesApp.h"
|
6
6
|
#include "common/StringConverter.h"
|
7
7
|
#include "common/rhoparams.h"
|
8
|
+
#include "common/app_build_configs.h"
|
8
9
|
#include "rho/rubyext/GeoLocationImpl.h"
|
9
10
|
#include "ruby/ext/rho/rhoruby.h"
|
10
11
|
#include "net/NetRequestImpl.h"
|
@@ -47,9 +48,12 @@ String httpProxy;
|
|
47
48
|
|
48
49
|
class CRhodesModule : public CAtlExeModuleT< CRhodesModule >
|
49
50
|
{
|
51
|
+
private:
|
52
|
+
|
50
53
|
public :
|
51
54
|
bool ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode ) throw( ) {
|
52
55
|
m_nRestarting = 1;
|
56
|
+
//m_bRhoGalleryApp = false;
|
53
57
|
TCHAR szTokens[] = _T("-/");
|
54
58
|
LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
|
55
59
|
getRhoRootPath();
|
@@ -59,6 +63,37 @@ public :
|
|
59
63
|
if (WordCmpI(lpszToken, _T("Restarting"))==0) {
|
60
64
|
m_nRestarting = 10;
|
61
65
|
}
|
66
|
+
/*
|
67
|
+
if (WordCmpI(lpszToken, _T("rhogallery_app"))==0) {
|
68
|
+
m_bRhoGalleryApp = true;
|
69
|
+
}
|
70
|
+
*/
|
71
|
+
{ // -RhoStartParams:
|
72
|
+
rho::String cur_token = wce_wctomb(lpszToken);
|
73
|
+
rho::String start_params_key = "RhoStartParams:";
|
74
|
+
int sppos = cur_token.find(start_params_key.c_str(), 0, start_params_key.length());
|
75
|
+
if (sppos != string::npos) {
|
76
|
+
// extract start params
|
77
|
+
rho::String start_params = cur_token.substr(sppos+start_params_key.length(), cur_token.length() - start_params_key.length() - sppos);
|
78
|
+
|
79
|
+
// check start params for security_token
|
80
|
+
|
81
|
+
rho::String security_key = "security_token=";
|
82
|
+
int skpos = start_params.find(security_key.c_str(), 0, security_key.length());
|
83
|
+
if (skpos != string::npos) {
|
84
|
+
rho::String tmp = start_params.substr(skpos+security_key.length(), start_params.length() - security_key.length() - skpos);
|
85
|
+
|
86
|
+
int divider = tmp.find_first_of(" /-,");
|
87
|
+
if (divider != string::npos) {
|
88
|
+
m_strSecurityToken = tmp.substr(0, divider);
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
m_strSecurityToken = tmp;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
}
|
96
|
+
}
|
62
97
|
|
63
98
|
#if defined(OS_WINDOWS)
|
64
99
|
if (wcsncmp(lpszToken, _T("http_proxy_url"),14)==0) {
|
@@ -130,6 +165,30 @@ public :
|
|
130
165
|
}
|
131
166
|
|
132
167
|
rho_logconf_Init(m_strRootPath.c_str());
|
168
|
+
/*
|
169
|
+
if ( RHOCONF().getBool("rhogallery_only_app") && !m_bRhoGalleryApp)
|
170
|
+
{
|
171
|
+
LOG(INFO) + "This is RhoGallery only app and can be started only from RhoGallery.";
|
172
|
+
return S_FALSE;
|
173
|
+
}
|
174
|
+
*/
|
175
|
+
///*
|
176
|
+
{
|
177
|
+
|
178
|
+
const char* app_security_token_cc = get_app_build_config_item("security_token");
|
179
|
+
if (app_security_token_cc != NULL) {
|
180
|
+
rho::String app_security_token = app_security_token_cc;
|
181
|
+
if (app_security_token.length() > 0) {
|
182
|
+
if (app_security_token.compare(m_strSecurityToken) != 0) {
|
183
|
+
LOG(INFO) + "This is hidden app and can be started only with security key.";
|
184
|
+
return S_FALSE;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
}
|
189
|
+
//*/
|
190
|
+
|
191
|
+
|
133
192
|
LOG(INFO) + "Rhodes started";
|
134
193
|
|
135
194
|
#ifdef OS_WINDOWS
|
@@ -185,8 +244,13 @@ public :
|
|
185
244
|
rho::common::CRhodesApp::Create(m_strRootPath );
|
186
245
|
String strTitle = RHODESAPP().getAppTitle();
|
187
246
|
|
247
|
+
DWORD dwStyle = WS_VISIBLE;
|
248
|
+
|
249
|
+
#if !defined(_WIN32_WCE)
|
250
|
+
dwStyle |= WS_OVERLAPPEDWINDOW;
|
251
|
+
#endif
|
188
252
|
// Create the main application window
|
189
|
-
m_appWindow.Create(NULL, CWindow::rcDefault, convertToStringW(strTitle).c_str(),
|
253
|
+
m_appWindow.Create(NULL, CWindow::rcDefault, convertToStringW(strTitle).c_str(), dwStyle);
|
190
254
|
if (NULL == m_appWindow.m_hWnd)
|
191
255
|
{
|
192
256
|
return S_FALSE;
|
@@ -220,6 +284,10 @@ public :
|
|
220
284
|
return m_appWindow.m_hWnd;
|
221
285
|
}
|
222
286
|
|
287
|
+
HWND GetWebViewWindow() {
|
288
|
+
return m_appWindow.getWebViewHWND();
|
289
|
+
}
|
290
|
+
|
223
291
|
void RunMessageLoop( ) throw( )
|
224
292
|
{
|
225
293
|
MSG msg;
|
@@ -399,16 +467,23 @@ private:
|
|
399
467
|
CMainWindow m_appWindow;
|
400
468
|
rho::String m_strRootPath;
|
401
469
|
int m_nRestarting;
|
470
|
+
|
471
|
+
bool m_bRhoGalleryApp;
|
472
|
+
rho::String m_strSecurityToken;
|
402
473
|
};
|
403
474
|
|
404
475
|
CRhodesModule _AtlModule;
|
476
|
+
HINSTANCE rhoApplicationHINSTANCE = 0;
|
477
|
+
|
405
478
|
//
|
406
479
|
bool g_restartOnExit = false;
|
407
480
|
//
|
408
|
-
extern "C" int WINAPI _tWinMain(HINSTANCE
|
481
|
+
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
|
409
482
|
LPTSTR /*lpCmdLine*/, int nShowCmd)
|
410
483
|
{
|
411
484
|
INITCOMMONCONTROLSEX ctrl;
|
485
|
+
|
486
|
+
rhoApplicationHINSTANCE = hInstance;
|
412
487
|
|
413
488
|
//Required to use datetime picker controls.
|
414
489
|
ctrl.dwSize = sizeof(ctrl);
|
@@ -422,6 +497,11 @@ extern "C" HWND getMainWnd() {
|
|
422
497
|
return _AtlModule.GetManWindow();
|
423
498
|
}
|
424
499
|
|
500
|
+
extern "C" HWND getWebViewWnd() {
|
501
|
+
return _AtlModule.GetWebViewWindow();
|
502
|
+
}
|
503
|
+
|
504
|
+
|
425
505
|
extern "C" const char* rho_native_rhopath()
|
426
506
|
{
|
427
507
|
return _AtlModule.getRhoRootPath().c_str();
|
@@ -432,6 +512,11 @@ extern "C" void rho_conf_show_log()
|
|
432
512
|
::PostMessage(getMainWnd(),WM_COMMAND,IDM_LOG,0);
|
433
513
|
}
|
434
514
|
|
515
|
+
extern "C" const char* rho_sys_get_start_params() {
|
516
|
+
return "";
|
517
|
+
}
|
518
|
+
|
519
|
+
|
435
520
|
//Hook for ruby call to refresh web view
|
436
521
|
|
437
522
|
extern "C" void rho_net_impl_network_indicator(int active)
|
@@ -447,6 +532,10 @@ extern "C" void remove_nativebar() {
|
|
447
532
|
//TODO: Implement me!
|
448
533
|
}
|
449
534
|
|
535
|
+
extern "C" void nativebar_set_tab_badge(int index,char* val)
|
536
|
+
{
|
537
|
+
}
|
538
|
+
|
450
539
|
extern "C" void nativebar_switch_tab(int index) {
|
451
540
|
//TODO: Implement me!
|
452
541
|
}
|
@@ -74,15 +74,9 @@ IDR_MAIN_MENU MENU
|
|
74
74
|
BEGIN
|
75
75
|
POPUP ""
|
76
76
|
BEGIN
|
77
|
-
//MENUITEM "Forward", IDM_FORWARD
|
78
|
-
//MENUITEM "Home", IDM_HOME
|
79
|
-
//MENUITEM "Open URL...", IDM_OPENURL
|
80
77
|
MENUITEM "Refresh", IDM_REFRESH
|
81
|
-
//MENUITEM "Stop", IDM_STOP
|
82
|
-
//MENUITEM "Sync", IDM_SYNC
|
83
78
|
MENUITEM "Options", IDM_OPTIONS
|
84
79
|
MENUITEM "Log...", IDM_LOG
|
85
|
-
//MENUITEM "Reload RhoBundle", IDM_RELOADRHOBUNDLE
|
86
80
|
MENUITEM "Fullscreen", ID_FULLSCREEN
|
87
81
|
MENUITEM "Exit", IDM_EXIT
|
88
82
|
END
|
@@ -222,6 +216,13 @@ BEGIN
|
|
222
216
|
CTEXT "Wait for connection ...",IDC_STATIC,10,49,130,16
|
223
217
|
END
|
224
218
|
|
219
|
+
IDD_SYNCSTATUS DIALOG 2, 50, 157, 44
|
220
|
+
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
221
|
+
FONT 8, "MS Shell Dlg"
|
222
|
+
BEGIN
|
223
|
+
CTEXT "Static",IDC_SYNCSTATUS,7,7,143,24
|
224
|
+
END
|
225
|
+
|
225
226
|
|
226
227
|
/////////////////////////////////////////////////////////////////////////////
|
227
228
|
//
|
@@ -298,6 +299,14 @@ BEGIN
|
|
298
299
|
TOPMARGIN, 3
|
299
300
|
BOTTOMMARGIN, 179
|
300
301
|
END
|
302
|
+
|
303
|
+
IDD_SYNCSTATUS, DIALOG
|
304
|
+
BEGIN
|
305
|
+
LEFTMARGIN, 7
|
306
|
+
RIGHTMARGIN, 180
|
307
|
+
TOPMARGIN, 7
|
308
|
+
BOTTOMMARGIN, 37
|
309
|
+
END
|
301
310
|
END
|
302
311
|
#endif // APSTUDIO_INVOKED
|
303
312
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#include "StdAfx.h"
|
2
|
+
|
3
|
+
#include "SyncStatusDlg.h"
|
4
|
+
#include "logging/RhoLog.h"
|
5
|
+
|
6
|
+
LRESULT CSyncStatusDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
7
|
+
{
|
8
|
+
SetDlgItemText(IDC_SYNCSTATUS, m_strStatus );
|
9
|
+
|
10
|
+
bHandled = TRUE;
|
11
|
+
return 1; // Let the system set the focus
|
12
|
+
}
|
13
|
+
|
14
|
+
void CSyncStatusDlg::setStatusText(LPCWSTR szStatus)
|
15
|
+
{
|
16
|
+
m_strStatus = szStatus;
|
17
|
+
|
18
|
+
if ( m_hWnd )
|
19
|
+
SetDlgItemText(IDC_SYNCSTATUS, m_strStatus );
|
20
|
+
}
|
21
|
+
|
22
|
+
LRESULT CSyncStatusDlg::OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
23
|
+
{
|
24
|
+
return 0;
|
25
|
+
}
|
26
|
+
|
27
|
+
LRESULT CSyncStatusDlg::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
28
|
+
{
|
29
|
+
ShowWindow(SW_HIDE);
|
30
|
+
bHandled = TRUE;
|
31
|
+
return 0;
|
32
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "resource.h"
|
4
|
+
|
5
|
+
class CSyncStatusDlg :
|
6
|
+
public CDialogImpl<CSyncStatusDlg>
|
7
|
+
{
|
8
|
+
CStringW m_strStatus;
|
9
|
+
public:
|
10
|
+
CSyncStatusDlg(){}
|
11
|
+
~CSyncStatusDlg(){}
|
12
|
+
|
13
|
+
enum { IDD = IDD_SYNCSTATUS };
|
14
|
+
|
15
|
+
BEGIN_MSG_MAP(CSyncStatusDlg)
|
16
|
+
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
17
|
+
COMMAND_ID_HANDLER(IDOK, OnOK)
|
18
|
+
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
|
19
|
+
END_MSG_MAP()
|
20
|
+
|
21
|
+
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
22
|
+
|
23
|
+
LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
24
|
+
LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
25
|
+
|
26
|
+
void setStatusText(LPCWSTR szStatus);
|
27
|
+
};
|
28
|
+
|
29
|
+
|
@@ -21,6 +21,8 @@
|
|
21
21
|
#define IDD_BLUETOOTH_DISCOVER 120
|
22
22
|
#define IDR_BLUETOOTH_DISCOVER 120
|
23
23
|
#define IDD_BLUETOOTH_DISCOVERED 121
|
24
|
+
#define IDD_DIALOG1 122
|
25
|
+
#define IDD_SYNCSTATUS 122
|
24
26
|
#define IDC_STATIC_PROMPT 1001
|
25
27
|
#define IDC_EDIT_URL 1002
|
26
28
|
#define IDC_LOGEDIT 1003
|
@@ -29,7 +31,8 @@
|
|
29
31
|
#define IDC_EDIT1 1006
|
30
32
|
#define IDC_MSGCLASSES 1006
|
31
33
|
#define IDC_EDIT2 1007
|
32
|
-
#define IDC_MSGEXCLUDE
|
34
|
+
#define IDC_MSGEXCLUDE 1008
|
35
|
+
#define IDC_SYNCSTATUS 1009
|
33
36
|
#define IDC_BUTTON2 1010
|
34
37
|
#define IDC_DATE_CTRL 1012
|
35
38
|
#define IDC_TIME_CTRL 1013
|
@@ -72,7 +75,7 @@
|
|
72
75
|
//
|
73
76
|
#ifdef APSTUDIO_INVOKED
|
74
77
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
75
|
-
#define _APS_NEXT_RESOURCE_VALUE
|
78
|
+
#define _APS_NEXT_RESOURCE_VALUE 123
|
76
79
|
#define _APS_NEXT_COMMAND_VALUE 40030
|
77
80
|
#define _APS_NEXT_CONTROL_VALUE 1020
|
78
81
|
#define _APS_NEXT_SYMED_VALUE 111
|
@@ -59,11 +59,13 @@ void CRhoThreadImpl::stop(unsigned int nTimeoutToKill)
|
|
59
59
|
}
|
60
60
|
}
|
61
61
|
|
62
|
-
|
62
|
+
int CRhoThreadImpl::wait(unsigned int nTimeout)
|
63
63
|
{
|
64
64
|
DWORD dwRes = ::WaitForSingleObject( m_hAwakeEvent, nTimeout*1000 );
|
65
65
|
if ( dwRes == WAIT_FAILED )
|
66
66
|
LOG(ERROR) + "WaitForSingleObject failed. ID: " + ::GetCurrentThreadId() + "; Result: " + dwRes;
|
67
|
+
|
68
|
+
return dwRes == WAIT_TIMEOUT ? 1 : 0;
|
67
69
|
}
|
68
70
|
|
69
71
|
void CRhoThreadImpl::stopWait()
|
@@ -18,7 +18,7 @@ public:
|
|
18
18
|
|
19
19
|
virtual void start(IRhoRunnable* pRunnable, IRhoRunnable::EPriority ePriority);
|
20
20
|
virtual void stop(unsigned int nTimeoutToKill);
|
21
|
-
virtual
|
21
|
+
virtual int wait(unsigned int nTimeout);
|
22
22
|
virtual void stopWait();
|
23
23
|
virtual void sleep(unsigned int nTimeout);
|
24
24
|
|
@@ -2,9 +2,14 @@
|
|
2
2
|
|
3
3
|
#include "common/RhoPort.h"
|
4
4
|
#include "common/StringConverter.h"
|
5
|
+
#include "common/RhoFilePath.h"
|
5
6
|
#include "ruby/ext/rho/rhoruby.h"
|
6
7
|
#include "MainWindow.h"
|
7
8
|
|
9
|
+
#ifdef OS_WINCE
|
10
|
+
#include <cfgmgrapi.h>
|
11
|
+
#endif
|
12
|
+
|
8
13
|
#ifdef OS_WINCE__
|
9
14
|
#include <tapi.h>
|
10
15
|
#include <tsp.h>
|
@@ -351,6 +356,12 @@ int rho_sysimpl_get_property(char* szPropName, VALUE* resValue)
|
|
351
356
|
return 1;
|
352
357
|
}
|
353
358
|
|
359
|
+
if (strcasecmp("has_calendar",szPropName) == 0)
|
360
|
+
{
|
361
|
+
*resValue = rho_ruby_create_boolean(1);
|
362
|
+
return 1;
|
363
|
+
}
|
364
|
+
|
354
365
|
return 0;
|
355
366
|
}
|
356
367
|
|
@@ -394,26 +405,28 @@ void rho_sys_app_exit()
|
|
394
405
|
::PostMessage(getMainWnd(), WM_COMMAND, MAKEWPARAM(IDM_EXIT,0), (LPARAM )0);
|
395
406
|
}
|
396
407
|
|
397
|
-
void
|
398
|
-
void rho_sys_run_app(const char *appname, VALUE params)
|
399
|
-
{
|
400
|
-
rho_wmsys_run_app(appname, 0);
|
401
|
-
}
|
408
|
+
void rho_wmsys_run_appW(const wchar_t* szPath, const wchar_t* szParams );
|
402
409
|
|
403
|
-
void
|
410
|
+
void rho_wmsys_run_app(const char* szPath, const char* szParams )
|
404
411
|
{
|
405
|
-
|
412
|
+
StringW strAppNameW;
|
413
|
+
convertToStringW(szPath, strAppNameW);
|
414
|
+
|
415
|
+
StringW strParamsW;
|
416
|
+
if ( szParams && *szParams )
|
417
|
+
convertToStringW(szParams, strParamsW);
|
418
|
+
|
419
|
+
rho_wmsys_run_appW(strAppNameW.c_str(), strParamsW.c_str() );
|
406
420
|
}
|
407
421
|
|
408
|
-
void
|
422
|
+
void rho_wmsys_run_appW(const wchar_t* szPath, const wchar_t* szParams )
|
409
423
|
{
|
410
424
|
SHELLEXECUTEINFO se = {0};
|
411
425
|
se.cbSize = sizeof(SHELLEXECUTEINFO);
|
412
426
|
se.fMask = SEE_MASK_NOCLOSEPROCESS;
|
413
427
|
se.lpVerb = L"Open";
|
414
428
|
|
415
|
-
StringW strAppNameW;
|
416
|
-
convertToStringW(szPath, strAppNameW);
|
429
|
+
StringW strAppNameW = szPath;
|
417
430
|
for(int i = 0; i<(int)strAppNameW.length();i++)
|
418
431
|
{
|
419
432
|
if ( strAppNameW.at(i) == '/' )
|
@@ -421,14 +434,133 @@ void rho_wmsys_run_app(const char* szPath, const char* szParams )
|
|
421
434
|
}
|
422
435
|
se.lpFile = strAppNameW.c_str();
|
423
436
|
|
424
|
-
StringW strParamsW;
|
425
437
|
if ( szParams && *szParams )
|
438
|
+
se.lpParameters = szParams;
|
439
|
+
|
440
|
+
if ( !ShellExecuteEx(&se) )
|
441
|
+
LOG(ERROR) + "Cannot execute: " + strAppNameW + ";Error: " + GetLastError();
|
442
|
+
|
443
|
+
if(se.hProcess)
|
444
|
+
CloseHandle(se.hProcess);
|
445
|
+
}
|
446
|
+
|
447
|
+
void rho_sys_open_url(const char* url)
|
448
|
+
{
|
449
|
+
rho_wmsys_run_app(url, 0);
|
450
|
+
}
|
451
|
+
|
452
|
+
void rho_sys_run_app(const char *appname, VALUE params)
|
453
|
+
{
|
454
|
+
CFilePath oPath(appname);
|
455
|
+
String strAppName = oPath.getFolderName();
|
456
|
+
|
457
|
+
StringW strKeyPath = L"Software\\Apps\\";
|
458
|
+
strKeyPath += convertToStringW(strAppName);
|
459
|
+
|
460
|
+
StringW strParamsW;
|
461
|
+
if ( params && !rho_ruby_is_NIL(params) )
|
426
462
|
{
|
427
|
-
convertToStringW(
|
428
|
-
|
463
|
+
convertToStringW(getStringFromValue(params), strParamsW);
|
464
|
+
|
465
|
+
/*
|
466
|
+
int nPos = strParamsW.find(L"rhogallery_app");
|
467
|
+
if ( nPos >= 0 )
|
468
|
+
{
|
469
|
+
if ( nPos == 0 || (nPos > 0 && strParamsW.at(nPos-1)!= '-' ) )
|
470
|
+
strParamsW.insert(nPos, L"-");
|
471
|
+
}
|
472
|
+
*/
|
473
|
+
strParamsW.insert(0, L"-RhoStartParams:");
|
474
|
+
}
|
475
|
+
|
476
|
+
CRegKey oKey;
|
477
|
+
LONG res = oKey.Open(HKEY_LOCAL_MACHINE, strKeyPath.c_str(), KEY_READ);
|
478
|
+
if ( res != ERROR_SUCCESS )
|
479
|
+
{
|
480
|
+
LOG(ERROR) + "Cannot open registry key: " + strKeyPath + "; Code:" + res;
|
481
|
+
}else
|
482
|
+
{
|
483
|
+
TCHAR szBuf[256];
|
484
|
+
ULONG nChars = 255;
|
485
|
+
|
486
|
+
res = oKey.QueryStringValue(L"InstallDir", szBuf, &nChars );
|
487
|
+
if ( res != ERROR_SUCCESS )
|
488
|
+
LOG(ERROR) + "Cannot read registry key: InstallDir; Code:" + res;
|
489
|
+
else
|
490
|
+
{
|
491
|
+
StringW strFullPath = szBuf;
|
492
|
+
if ( strFullPath[strFullPath.length()-1] != '/' && strFullPath[strFullPath.length()-1] != '\\' )
|
493
|
+
strFullPath += L"\\";
|
494
|
+
|
495
|
+
StringW strBaseName;
|
496
|
+
convertToStringW(oPath.getBaseName(), strBaseName);
|
497
|
+
strFullPath += strBaseName;
|
498
|
+
|
499
|
+
rho_wmsys_run_appW(strFullPath.c_str(), strParamsW.c_str());
|
500
|
+
}
|
429
501
|
}
|
430
502
|
|
431
|
-
|
503
|
+
|
504
|
+
}
|
505
|
+
|
506
|
+
int rho_sys_is_app_installed(const char *appname)
|
507
|
+
{
|
508
|
+
int nRet = 0;
|
509
|
+
CFilePath oPath(appname);
|
510
|
+
String strAppName = oPath.getFolderName();
|
511
|
+
|
512
|
+
StringW strRequest =
|
513
|
+
L"<wap-provisioningdoc><characteristic type=\"UnInstall\">"
|
514
|
+
L"<characteristic-query type=\"";
|
515
|
+
strRequest += convertToStringW(strAppName) + L"\"/>"
|
516
|
+
L"</characteristic></wap-provisioningdoc>";
|
517
|
+
|
518
|
+
#ifdef OS_WINCE
|
519
|
+
HRESULT hr = E_FAIL;
|
520
|
+
LPWSTR wszOutput = NULL;
|
521
|
+
hr = DMProcessConfigXML(strRequest.c_str(), CFGFLAG_PROCESS, &wszOutput);
|
522
|
+
if (FAILED(hr) || !wszOutput )
|
523
|
+
LOG(ERROR) + "DMProcessConfigXML failed: " + hr;
|
524
|
+
else
|
525
|
+
{
|
526
|
+
StringW strResp = L"<characteristic type=\"";
|
527
|
+
strResp += convertToStringW(strAppName) + L"\">";
|
528
|
+
nRet = wcsstr(wszOutput, strResp.c_str()) != 0 ? 1 : 0;
|
529
|
+
}
|
530
|
+
|
531
|
+
if ( wszOutput )
|
532
|
+
sys_free( wszOutput );
|
533
|
+
#endif
|
534
|
+
|
535
|
+
return nRet;
|
536
|
+
}
|
537
|
+
|
538
|
+
void rho_sys_app_uninstall(const char *appname)
|
539
|
+
{
|
540
|
+
CFilePath oPath(appname);
|
541
|
+
String strAppName = oPath.getFolderName();
|
542
|
+
|
543
|
+
StringW strRequest =
|
544
|
+
L"<wap-provisioningdoc><characteristic type=\"UnInstall\">"
|
545
|
+
L"<characteristic type=\"";
|
546
|
+
strRequest += convertToStringW(strAppName) + L"\">"
|
547
|
+
L"<parm name=\"uninstall\" value=\"1\"/>"
|
548
|
+
L"</characteristic>"
|
549
|
+
L"</characteristic></wap-provisioningdoc>";
|
550
|
+
|
551
|
+
#ifdef OS_WINCE
|
552
|
+
HRESULT hr = E_FAIL;
|
553
|
+
LPWSTR wszOutput = NULL;
|
554
|
+
hr = DMProcessConfigXML(strRequest.c_str(), CFGFLAG_PROCESS, &wszOutput);
|
555
|
+
if (FAILED(hr) || !wszOutput )
|
556
|
+
LOG(ERROR) + "DMProcessConfigXML failed: " + hr;
|
557
|
+
else
|
558
|
+
{
|
559
|
+
}
|
560
|
+
|
561
|
+
if ( wszOutput )
|
562
|
+
sys_free( wszOutput );
|
563
|
+
#endif
|
432
564
|
}
|
433
565
|
|
434
566
|
} //extern "C"
|