rhodes 2.0.0.beta2 → 2.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +2 -0
- data/Manifest.txt +27 -148
- data/Rakefile +49 -3
- data/lib/framework/builtinME.rb +6 -0
- data/lib/framework/rho/render.rb +13 -8
- data/lib/framework/rho/rho.rb +97 -43
- data/lib/framework/rho/rhoapplication.rb +8 -3
- data/lib/framework/rho/rhocontroller.rb +1 -1
- data/lib/framework/rhodes-framework.rb +1 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhoframework.rb +7 -22
- data/lib/framework/rhofsconnector.rb +1 -1
- data/lib/framework/rholang/localization_simplified.rb +2 -2
- data/lib/framework/rhom/rhom.rb +1 -0
- data/lib/framework/rhom/rhom_db_adapter.rb +2 -2
- data/lib/framework/rhom/rhom_model.rb +98 -0
- data/lib/framework/rhom/rhom_object_factory.rb +13 -12
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/jni/include/{JNIRhodes.h → rhodes/JNIRhodes.h} +3 -54
- data/platform/android/Rhodes/jni/include/{RhoClassFactory.h → rhodes/RhoClassFactory.h} +0 -0
- data/platform/android/Rhodes/jni/include/{SystemInfoImpl.h → rhodes/SystemInfoImpl.h} +0 -0
- data/platform/android/Rhodes/jni/include/{details → rhodes/details}/rhojava.inc +1 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_Logger.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_RhoConf.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_RhoLogConf.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_RhoMenu.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_Rhodes.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_SplashScreen.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_alert_Alert.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_camera_Camera.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_datetime_DateTimePicker.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_geolocation_GeoLocationImpl.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_socket_RhoSocketImpl.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_socket_SSLImpl.h +0 -0
- data/platform/android/Rhodes/jni/include/{sslimpl.h → rhodes/sslimpl.h} +0 -0
- data/platform/android/Rhodes/jni/include/rhodes.h +59 -0
- data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +3 -3
- data/platform/android/Rhodes/jni/src/alert.cpp +2 -2
- data/platform/android/Rhodes/jni/src/callbacks.cpp +4 -3
- data/platform/android/Rhodes/jni/src/camera.cpp +2 -2
- data/platform/android/Rhodes/jni/src/datetimepicker.cpp +2 -2
- data/platform/android/Rhodes/jni/src/geolocation.cpp +2 -2
- data/platform/android/Rhodes/jni/src/logconf.cpp +2 -2
- data/platform/android/Rhodes/jni/src/logger.cpp +2 -2
- data/platform/android/Rhodes/jni/src/mapview.cpp +1 -1
- data/platform/android/Rhodes/jni/src/menu.cpp +2 -2
- data/platform/android/Rhodes/jni/src/nativebar.cpp +1 -1
- data/platform/android/Rhodes/jni/src/navbar.cpp +17 -3
- data/platform/android/Rhodes/jni/src/phonebook.cpp +1 -1
- data/platform/android/Rhodes/jni/src/rhoconf.cpp +2 -2
- data/platform/android/Rhodes/jni/src/rhodes.cpp +3 -3
- data/platform/android/Rhodes/jni/src/ringtones.cpp +1 -1
- data/platform/android/Rhodes/jni/src/socketimpl.cpp +2 -2
- data/platform/android/Rhodes/jni/src/splashscreen.cpp +2 -2
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -3
- data/platform/android/Rhodes/jni/src/syncengine.cpp +2 -2
- data/platform/android/Rhodes/jni/src/webview.cpp +15 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeLibraries.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NavBar.java +52 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +8 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +26 -28
- data/platform/android/build/RhodesSRC_build.files +21 -20
- data/platform/android/build/android.rake +69 -24
- data/platform/android/build/androidcommon.rb +17 -12
- data/platform/bb/build/bb.rake +23 -21
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +5 -2
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +6 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +9 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +31 -2
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +17 -6
- data/platform/bb/rhodes/src/rhomobile/Utilities.java +6 -0
- data/platform/iphone/Classes/AppManager/AppManager.m +16 -4
- data/platform/iphone/Classes/DateTime.h +5 -6
- data/platform/iphone/Classes/DateTimePicker.m +4 -18
- data/platform/iphone/Classes/DateTimePickerDelegate.h +7 -9
- data/platform/iphone/Classes/DateTimePickerDelegate.m +141 -152
- data/platform/iphone/Classes/Rhodes.h +6 -1
- data/platform/iphone/Classes/Rhodes.m +17 -43
- data/platform/iphone/Classes/SimpleMainView.h +1 -1
- data/platform/iphone/Classes/SimpleMainView.m +54 -4
- data/platform/iphone/Classes/WebView.m +17 -0
- data/platform/iphone/rbuild/iphone.rake +1 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +0 -45
- data/platform/shared/common/PosixThreadImpl.cpp +8 -0
- data/platform/shared/common/PosixThreadImpl.h +1 -0
- data/platform/shared/common/RhoThread.cpp +1 -0
- data/platform/shared/common/RhoThread.h +4 -2
- data/platform/shared/curl/include/curl/curl.h +4 -0
- data/platform/shared/db/DBAdapter.cpp +47 -60
- data/platform/shared/db/DBAdapter.h +6 -2
- data/platform/shared/net/AsyncHttp.cpp +27 -11
- data/platform/shared/net/AsyncHttp.h +3 -1
- data/platform/shared/net/CURLNetRequest.cpp +11 -10
- data/platform/shared/net/CURLNetRequest.h +6 -4
- data/platform/shared/net/HttpServer.cpp +11 -6
- data/platform/shared/ruby/ext/asynchttp/asynchttp.i +2 -2
- data/platform/shared/ruby/ext/asynchttp/asynchttp_wrap.c +22 -11
- data/platform/shared/ruby/ext/rho/rhoruby.c +2 -2
- data/platform/shared/ruby/ext/rho/rhosupport.c +23 -3
- data/platform/shared/ruby/ext/webview/webview.i +4 -0
- data/platform/shared/ruby/ext/webview/webview_wrap.c +39 -0
- data/platform/shared/ruby/re.c +8 -0
- data/platform/shared/ruby/string.c +1 -1
- data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoClassFactory.java +6 -1
- data/platform/shared/rubyJVM/src/com/rho/RhoThread.java +3 -0
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +34 -0
- data/platform/shared/rubyJVM/src/com/rho/db/DBAdapter.java +40 -53
- data/platform/shared/rubyJVM/src/com/rho/net/AsyncHttp.java +32 -15
- data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +31 -17
- data/platform/shared/rubyJVM/src/com/rho/net/RhoConnection.java +3 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/JSONArrayIterator.java +17 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +158 -137
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +18 -17
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +10 -2
- data/platform/shared/rubyJVM/src/com/xruby/GeneratedMethods/RubyFile_Methods.java +6 -0
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyFile.java +18 -3
- data/platform/shared/rubyJVM/src/j2me/io/File.java +37 -9
- data/platform/shared/sqlite/sqlite3.c +14613 -13016
- data/platform/shared/sqlite/sqlite3.h +1461 -1499
- data/platform/shared/sqlite/sqlite3ext.h +0 -2
- data/platform/shared/sync/ClientRegister.cpp +3 -3
- data/platform/shared/sync/ClientRegister.h +2 -1
- data/platform/shared/sync/SyncEngine.cpp +20 -8
- data/platform/shared/sync/SyncSource.cpp +12 -12
- data/platform/shared/sync/SyncSource.h +4 -4
- data/platform/shared/sync/SyncThread.cpp +8 -1
- data/platform/shared/tcmalloc/rhomem.h +3 -0
- data/platform/shared/tcmalloc/tcmalloc_.cpp +11 -0
- data/platform/wm/rhodes/Alert.cpp +148 -101
- data/platform/wm/rhodes/Alert.h +4 -1
- data/platform/wm/rhodes/AppManager.cpp +212 -72
- data/platform/wm/rhodes/AppManager.h +24 -3
- data/platform/wm/rhodes/DateTimePicker.cpp +23 -11
- data/platform/wm/rhodes/DateTimePicker.h +16 -5
- data/platform/wm/rhodes/MainWindow.cpp +22 -7
- data/platform/wm/rhodes/OkCancelModalDialog.h +63 -0
- data/platform/wm/rhodes/Rhodes.cpp +29 -17
- data/platform/wm/rhodes/phonebook/NativeAddressBook.cpp +128 -4
- data/platform/wm/rhodes/phonebook/NativeAddressBook.h +33 -3
- data/platform/wm/rhodes/resource.h +1 -1
- data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +5 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +136 -102
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +12 -5
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +24 -10
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +6 -0
- data/platform/wm/rhodes/rhodes.vcproj +4 -0
- data/platform/wm/tools/detool/detool.cpp +17 -4
- data/rakefile.rb +49 -3
- data/res/build-tools/db/syncdb.schema +2 -2
- data/res/build-tools/detool.exe +0 -0
- data/res/generators/rhogen.rb +10 -10
- data/res/generators/templates/application/app/helpers/browser_helper.rb +9 -4
- data/res/generators/templates/application/app/index.bb.erb +5 -5
- data/res/generators/templates/application/build.yml +1 -0
- data/res/generators/templates/application/public/css/android.css +10 -8
- data/res/generators/templates/application/public/css/blackberry.css +40 -31
- data/res/generators/templates/application/public/css/iphone.css +4 -4
- data/res/generators/templates/application/public/css/webkit.css +7 -0
- data/res/generators/templates/application/public/css/windows_mobile.css +31 -27
- data/res/generators/templates/application/rhoconfig.txt +2 -2
- data/res/generators/templates/model/edit.bb.erb +2 -2
- data/res/generators/templates/model/index.bb.erb +6 -4
- data/res/generators/templates/model/model.rb +2 -1
- data/res/generators/templates/model/new.bb.erb +2 -2
- data/res/generators/templates/model/show.bb.erb +2 -2
- data/rhobuild.yml +37 -0
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/Account/account.rb +7 -0
- data/spec/framework_spec/app/Case/case.rb +6 -0
- data/spec/framework_spec/app/Customer/customer.rb +6 -0
- data/spec/framework_spec/app/Product/product.rb +9 -0
- data/spec/framework_spec/app/spec/rhom_object_spec.rb +1 -1
- data/spec/framework_spec/app/spec/syncengine_spec.rb +2 -1
- metadata +45 -151
- data/lib/build/manifest/createAppManifest.rb +0 -18
- data/lib/build/tasks/android.rake +0 -317
- data/lib/build/tasks/blackberry.rake +0 -355
- data/lib/build/tasks/common.rake +0 -62
- data/lib/build/tasks/iphone.rake +0 -108
- data/lib/build/tasks/linux.rake +0 -81
- data/lib/build/tasks/rhodes-build.rb +0 -11
- data/lib/build/tasks/rspec.rake +0 -20
- data/lib/build/tasks/symbian.rake +0 -202
- data/lib/build/tasks/wm.rake +0 -166
- data/lib/framework/ServeME.rb +0 -7
- data/platform/bb/build/MANIFEST.MF +0 -12
- data/platform/iphone/Classes/DateTimePicker.h +0 -17
- data/res/generators/templates/application/public/icons/Read me first - license.txt +0 -14
- data/res/generators/templates/application/public/icons/about.png +0 -0
- data/res/generators/templates/application/public/icons/airplane.png +0 -0
- data/res/generators/templates/application/public/icons/baby.png +0 -0
- data/res/generators/templates/application/public/icons/badge.png +0 -0
- data/res/generators/templates/application/public/icons/bandaid.png +0 -0
- data/res/generators/templates/application/public/icons/bar-chart.png +0 -0
- data/res/generators/templates/application/public/icons/battery.png +0 -0
- data/res/generators/templates/application/public/icons/beaker.png +0 -0
- data/res/generators/templates/application/public/icons/beaker2.png +0 -0
- data/res/generators/templates/application/public/icons/beermug.png +0 -0
- data/res/generators/templates/application/public/icons/bird.png +0 -0
- data/res/generators/templates/application/public/icons/book.png +0 -0
- data/res/generators/templates/application/public/icons/bookmark.png +0 -0
- data/res/generators/templates/application/public/icons/brightness.png +0 -0
- data/res/generators/templates/application/public/icons/bug.png +0 -0
- data/res/generators/templates/application/public/icons/cabinet.png +0 -0
- data/res/generators/templates/application/public/icons/calendar.png +0 -0
- data/res/generators/templates/application/public/icons/camera.png +0 -0
- data/res/generators/templates/application/public/icons/changeName.rb +0 -22
- data/res/generators/templates/application/public/icons/chat2.png +0 -0
- data/res/generators/templates/application/public/icons/chicken.png +0 -0
- data/res/generators/templates/application/public/icons/clock.png +0 -0
- data/res/generators/templates/application/public/icons/cloud.png +0 -0
- data/res/generators/templates/application/public/icons/coffee.png +0 -0
- data/res/generators/templates/application/public/icons/compass.png +0 -0
- data/res/generators/templates/application/public/icons/contrast.png +0 -0
- data/res/generators/templates/application/public/icons/dashboard.png +0 -0
- data/res/generators/templates/application/public/icons/display.png +0 -0
- data/res/generators/templates/application/public/icons/dogpaw.png +0 -0
- data/res/generators/templates/application/public/icons/download.png +0 -0
- data/res/generators/templates/application/public/icons/dumbbell.png +0 -0
- data/res/generators/templates/application/public/icons/ekg.png +0 -0
- data/res/generators/templates/application/public/icons/envelope.png +0 -0
- data/res/generators/templates/application/public/icons/equalizer.png +0 -0
- data/res/generators/templates/application/public/icons/eye.png +0 -0
- data/res/generators/templates/application/public/icons/film-roll.png +0 -0
- data/res/generators/templates/application/public/icons/flag.png +0 -0
- data/res/generators/templates/application/public/icons/fork-and-knife.png +0 -0
- data/res/generators/templates/application/public/icons/fuel.png +0 -0
- data/res/generators/templates/application/public/icons/gameplan.png +0 -0
- data/res/generators/templates/application/public/icons/gear.png +0 -0
- data/res/generators/templates/application/public/icons/gear2.png +0 -0
- data/res/generators/templates/application/public/icons/gift.png +0 -0
- data/res/generators/templates/application/public/icons/heart.png +0 -0
- data/res/generators/templates/application/public/icons/house.png +0 -0
- data/res/generators/templates/application/public/icons/inbox.png +0 -0
- data/res/generators/templates/application/public/icons/index-cards.png +0 -0
- data/res/generators/templates/application/public/icons/iphone.png +0 -0
- data/res/generators/templates/application/public/icons/ipod.png +0 -0
- data/res/generators/templates/application/public/icons/key.png +0 -0
- data/res/generators/templates/application/public/icons/lifebuoy.png +0 -0
- data/res/generators/templates/application/public/icons/lightbulb.png +0 -0
- data/res/generators/templates/application/public/icons/line-chart.png +0 -0
- data/res/generators/templates/application/public/icons/location.png +0 -0
- data/res/generators/templates/application/public/icons/lock.png +0 -0
- data/res/generators/templates/application/public/icons/loopback.png +0 -0
- data/res/generators/templates/application/public/icons/magnifying-glass.png +0 -0
- data/res/generators/templates/application/public/icons/map-marker.png +0 -0
- data/res/generators/templates/application/public/icons/map.png +0 -0
- data/res/generators/templates/application/public/icons/medical-bag.png +0 -0
- data/res/generators/templates/application/public/icons/medical.png +0 -0
- data/res/generators/templates/application/public/icons/microphone.png +0 -0
- data/res/generators/templates/application/public/icons/movie1.png +0 -0
- data/res/generators/templates/application/public/icons/movie2.png +0 -0
- data/res/generators/templates/application/public/icons/network.png +0 -0
- data/res/generators/templates/application/public/icons/note.png +0 -0
- data/res/generators/templates/application/public/icons/outlet.png +0 -0
- data/res/generators/templates/application/public/icons/palette.png +0 -0
- data/res/generators/templates/application/public/icons/paperclip.png +0 -0
- data/res/generators/templates/application/public/icons/phone.png +0 -0
- data/res/generators/templates/application/public/icons/photos.png +0 -0
- data/res/generators/templates/application/public/icons/piano.png +0 -0
- data/res/generators/templates/application/public/icons/picture-frame.png +0 -0
- data/res/generators/templates/application/public/icons/pill.png +0 -0
- data/res/generators/templates/application/public/icons/pin.png +0 -0
- data/res/generators/templates/application/public/icons/pinetree.png +0 -0
- data/res/generators/templates/application/public/icons/planet.png +0 -0
- data/res/generators/templates/application/public/icons/puzzle.png +0 -0
- data/res/generators/templates/application/public/icons/radar.png +0 -0
- data/res/generators/templates/application/public/icons/redo.png +0 -0
- data/res/generators/templates/application/public/icons/refresh.png +0 -0
- data/res/generators/templates/application/public/icons/runner.png +0 -0
- data/res/generators/templates/application/public/icons/shoebox.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-bag.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-cart.png +0 -0
- data/res/generators/templates/application/public/icons/shuffle.png +0 -0
- data/res/generators/templates/application/public/icons/signpost.png +0 -0
- data/res/generators/templates/application/public/icons/skull-n-crossbones.png +0 -0
- data/res/generators/templates/application/public/icons/skull.png +0 -0
- data/res/generators/templates/application/public/icons/sliders.png +0 -0
- data/res/generators/templates/application/public/icons/spraycan.png +0 -0
- data/res/generators/templates/application/public/icons/squiggle.png +0 -0
- data/res/generators/templates/application/public/icons/star.png +0 -0
- data/res/generators/templates/application/public/icons/stopwatch.png +0 -0
- data/res/generators/templates/application/public/icons/suitcase.png +0 -0
- data/res/generators/templates/application/public/icons/tag.png +0 -0
- data/res/generators/templates/application/public/icons/tags.png +0 -0
- data/res/generators/templates/application/public/icons/target.png +0 -0
- data/res/generators/templates/application/public/icons/testtube.png +0 -0
- data/res/generators/templates/application/public/icons/thermometer.png +0 -0
- data/res/generators/templates/application/public/icons/toolbox.png +0 -0
- data/res/generators/templates/application/public/icons/trophy.png +0 -0
- data/res/generators/templates/application/public/icons/tshirt.png +0 -0
- data/res/generators/templates/application/public/icons/tv.png +0 -0
- data/res/generators/templates/application/public/icons/umbrella.png +0 -0
- data/res/generators/templates/application/public/icons/walk.png +0 -0
- data/res/generators/templates/application/public/icons/weather.png +0 -0
- data/res/generators/templates/application/public/icons/widescreen.png +0 -0
- data/res/generators/templates/application/public/icons/wineglass.png +0 -0
- data/res/generators/templates/application/public/icons/zap.png +0 -0
- data/res/generators/templates/application/public/js/jquery-1.2.6.min.js +0 -32
- data/res/generators/templates/model/config.rb +0 -3
- data/res/generators/templates/spec/app/spec/webview_spec.rb +0 -5
- data/spec/framework_spec/app/Account/config.rb +0 -59
- data/spec/framework_spec/app/Case/config.rb +0 -3
- data/spec/framework_spec/app/Customer/config.rb +0 -3
- data/spec/framework_spec/app/Product/config.rb +0 -17
@@ -14,8 +14,6 @@
|
|
14
14
|
** an SQLite instance. Shared libraries that intend to be loaded
|
15
15
|
** as extensions by SQLite should #include this file instead of
|
16
16
|
** sqlite3.h.
|
17
|
-
**
|
18
|
-
** @(#) $Id: sqlite3ext.h,v 1.25 2008/10/12 00:27:54 shane Exp $
|
19
17
|
*/
|
20
18
|
#ifndef _SQLITE3EXT_H_
|
21
19
|
#define _SQLITE3EXT_H_
|
@@ -23,13 +23,13 @@ CClientRegister* CClientRegister::m_pInstance = 0;
|
|
23
23
|
return m_pInstance;
|
24
24
|
}
|
25
25
|
|
26
|
-
/*static void CClientRegister::Destroy()
|
26
|
+
/*static*/ void CClientRegister::Destroy()
|
27
27
|
{
|
28
28
|
if ( m_pInstance )
|
29
29
|
delete m_pInstance;
|
30
30
|
|
31
31
|
m_pInstance = 0;
|
32
|
-
}
|
32
|
+
}
|
33
33
|
|
34
34
|
CClientRegister::CClientRegister(common::IRhoClassFactory* factory,const char* device_pin) : CRhoThread(factory)
|
35
35
|
{
|
@@ -56,7 +56,7 @@ CClientRegister::~CClientRegister()
|
|
56
56
|
void CClientRegister::run()
|
57
57
|
{
|
58
58
|
LOG(INFO)+"ClientRegister start";
|
59
|
-
while(
|
59
|
+
while(!isStopped())
|
60
60
|
{
|
61
61
|
if ( CSyncThread::getInstance() != null )
|
62
62
|
{
|
@@ -28,7 +28,7 @@ class CClientRegister : public common::CRhoThread
|
|
28
28
|
unsigned int m_nPollInterval;
|
29
29
|
public:
|
30
30
|
static CClientRegister* Create(common::IRhoClassFactory* factory,const char* device_pin);
|
31
|
-
|
31
|
+
static void Destroy();
|
32
32
|
static CClientRegister* getInstance() { return m_pInstance; }
|
33
33
|
|
34
34
|
virtual void run();
|
@@ -55,6 +55,7 @@ extern "C" {
|
|
55
55
|
#endif //__cplusplus
|
56
56
|
|
57
57
|
void rho_clientregister_create(const char* szDevicePin);
|
58
|
+
void rho_clientregister_destroy();
|
58
59
|
|
59
60
|
#ifdef __cplusplus
|
60
61
|
};
|
@@ -140,10 +140,10 @@ void CSyncEngine::doSearch(rho::Vector<rho::String>& arSources, String strParams
|
|
140
140
|
CSyncSource* pSrc = findSourceByName(arSources.elementAt(i));
|
141
141
|
if ( pSrc != null )
|
142
142
|
{
|
143
|
-
strQuery += "&
|
143
|
+
strQuery += "&source[][name]=" + pSrc->getName();
|
144
144
|
|
145
145
|
if ( !pSrc->isTokenFromDB() && pSrc->getToken() > 1 )
|
146
|
-
strQuery += "&
|
146
|
+
strQuery += "&source[][token]=" + convertToStringA(pSrc->getToken());
|
147
147
|
}
|
148
148
|
}
|
149
149
|
|
@@ -212,7 +212,12 @@ void CSyncEngine::doSearch(rho::Vector<rho::String>& arSources, String strParams
|
|
212
212
|
}
|
213
213
|
|
214
214
|
if ( isContinueSync() )
|
215
|
-
|
215
|
+
{
|
216
|
+
CSyncSource& src = *m_sources.elementAt(getStartSource());
|
217
|
+
src.m_bIsSearch = true;
|
218
|
+
|
219
|
+
getNotify().fireSyncNotification(&src, true, RhoRuby.ERR_NONE, RhoRuby.getMessageText("sync_completed"));
|
220
|
+
}
|
216
221
|
else if ( nErrCode != 0 )
|
217
222
|
{
|
218
223
|
CSyncSource& src = *m_sources.elementAt(getStartSource());
|
@@ -298,7 +303,7 @@ void CSyncEngine::loadAllSources()
|
|
298
303
|
m_sources.clear();
|
299
304
|
m_arPartitions.clear();
|
300
305
|
|
301
|
-
DBResult( res, getUserDB().executeSQL("SELECT source_id,sync_type,name, partition from sources ORDER BY
|
306
|
+
DBResult( res, getUserDB().executeSQL("SELECT source_id,sync_type,name, partition from sources ORDER BY sync_priority") );
|
302
307
|
for ( ; !res.isEnd(); res.next() )
|
303
308
|
{
|
304
309
|
String strShouldSync = res.getStringByIdx(1);
|
@@ -372,7 +377,7 @@ boolean CSyncEngine::resetClientIDByNet(const String& strClientID)//throws Excep
|
|
372
377
|
|
373
378
|
NetResponse( resp, getNet().pullData(getProtocol().getClientResetUrl(strClientID), this) );
|
374
379
|
|
375
|
-
/* processServerSources("{\"server_sources\":[{\"name\":\"Product\",\"partition\":\"application\",\"source_id\":\"2\",\"
|
380
|
+
/* processServerSources("{\"server_sources\":[{\"name\":\"Product\",\"partition\":\"application\",\"source_id\":\"2\",\"sync_priority\":\"0\","
|
376
381
|
"\"schema_version\":\"7.0\",\"schema\":{"
|
377
382
|
"\"columns\":[\'brand\',\'created_at\',\'name\',\'price\',\'quantity\',\'sku\',\'updated_at\']"*/
|
378
383
|
/* "\"sql\":\"CREATE TABLE Product ( "
|
@@ -409,7 +414,7 @@ String CSyncEngine::requestClientIDByNet()
|
|
409
414
|
{
|
410
415
|
const char* szData = resp.getCharData();
|
411
416
|
/*
|
412
|
-
"{\"client\":{\"client_id\":\"vasy\"},\"server_sources\":[{\"name\":\"Product\",\"partition\":\"application\",\"source_id\":\"2\",\"
|
417
|
+
"{\"client\":{\"client_id\":\"vasy\"},\"server_sources\":[{\"name\":\"Product\",\"partition\":\"application\",\"source_id\":\"2\",\"sync_priority\":\"0\","
|
413
418
|
"\"schema\":{\"version\":\"1.0\","
|
414
419
|
"\"sql\":\"CREATE TABLE Product ( "
|
415
420
|
"brand varchar default NULL,"
|
@@ -441,6 +446,8 @@ String CSyncEngine::requestClientIDByNet()
|
|
441
446
|
|
442
447
|
void CSyncEngine::doBulkSync()//throws Exception
|
443
448
|
{
|
449
|
+
// processServerSources(String("{\"partition\":\"") + "application" + "\"}");
|
450
|
+
|
444
451
|
if ( !RHOCONF().isExist("bulksync_state") )
|
445
452
|
return;
|
446
453
|
|
@@ -517,9 +524,13 @@ void CSyncEngine::loadBulkPartition(const String& strPartition )
|
|
517
524
|
|
518
525
|
getNotify().fireBulkSyncNotification(false, "download", strPartition, RhoRuby.ERR_NONE);
|
519
526
|
|
520
|
-
String fDataName = makeBulkDataFileName(
|
527
|
+
String fDataName = makeBulkDataFileName(strDataUrl, dbPartition.getDBPath(), "");
|
521
528
|
String strZip = ".rzip";
|
522
|
-
|
529
|
+
String hostName = getHostFromUrl(serverUrl);
|
530
|
+
if (hostName.c_str()[hostName.length()-1] == '/') {
|
531
|
+
hostName = hostName.substr(0,hostName.length()-1);
|
532
|
+
}
|
533
|
+
String strSqlDataUrl = hostName + strDataUrl+strZip;
|
523
534
|
LOG(INFO) + "Bulk sync: download data from server: " + strSqlDataUrl;
|
524
535
|
{
|
525
536
|
NetResponse( resp1, getNet().pullFile(strSqlDataUrl, fDataName+strZip, this, null) );
|
@@ -551,6 +562,7 @@ void CSyncEngine::loadBulkPartition(const String& strPartition )
|
|
551
562
|
getNotify().fireBulkSyncNotification(false, "change_db", strPartition, RhoRuby.ERR_NONE);
|
552
563
|
|
553
564
|
dbPartition.setBulkSyncDB(fDataName);
|
565
|
+
processServerSources(String("{\"partition\":\"") + strPartition + "\"}");
|
554
566
|
|
555
567
|
LOG(INFO) + "Bulk sync: end change db";
|
556
568
|
getNotify().fireBulkSyncNotification(false, "", strPartition, RhoRuby.ERR_NONE);
|
@@ -66,7 +66,7 @@ CSyncSource::CSyncSource(int id, const String& strName, const String& strSyncTyp
|
|
66
66
|
m_nErrCode = RhoRuby.ERR_NONE;
|
67
67
|
m_bIsSearch = false;
|
68
68
|
|
69
|
-
DBResult( res, db.executeSQL("SELECT token,
|
69
|
+
DBResult( res, db.executeSQL("SELECT token,associations from sources WHERE source_id=?", m_nID) );
|
70
70
|
if ( !res.isEnd() )
|
71
71
|
{
|
72
72
|
m_token = res.getUInt64ByIdx(0);
|
@@ -78,15 +78,15 @@ CSyncSource::CSyncSource(int id, const String& strName, const String& strSyncTyp
|
|
78
78
|
}
|
79
79
|
|
80
80
|
m_bSchemaSource = db.isTableExist(m_strName);
|
81
|
-
|
81
|
+
parseAssociations(res.getStringByIdx(1));
|
82
82
|
}
|
83
83
|
|
84
|
-
void CSyncSource::
|
84
|
+
void CSyncSource::parseAssociations(const String& strAssociations)
|
85
85
|
{
|
86
|
-
if (
|
86
|
+
if (strAssociations.length() == 0 )
|
87
87
|
return;
|
88
88
|
|
89
|
-
CTokenizer oTokenizer(
|
89
|
+
CTokenizer oTokenizer( strAssociations, "," );
|
90
90
|
|
91
91
|
String strSrcName = "";
|
92
92
|
while (oTokenizer.hasMoreTokens())
|
@@ -97,7 +97,7 @@ void CSyncSource::parseLinks(const String& strLinks)
|
|
97
97
|
|
98
98
|
if ( strSrcName.length() > 0 )
|
99
99
|
{
|
100
|
-
|
100
|
+
m_hashAssociations.put(strSrcName, tok);
|
101
101
|
strSrcName = "";
|
102
102
|
}else
|
103
103
|
strSrcName = tok;
|
@@ -529,17 +529,17 @@ void CSyncSource::processSyncCommand(const String& strCmd, CJSONEntry oCmdEntry)
|
|
529
529
|
}
|
530
530
|
}
|
531
531
|
|
532
|
-
void CSyncSource::
|
532
|
+
void CSyncSource::processAssociations(const String& strOldObject, const String& strNewObject)
|
533
533
|
{
|
534
|
-
for ( Hashtable<String,String>::iterator it =
|
534
|
+
for ( Hashtable<String,String>::iterator it = m_hashAssociations.begin(); it != m_hashAssociations.end(); ++it )
|
535
535
|
{
|
536
536
|
CSyncSource* pSrc = getSync().findSourceByName(it->first);
|
537
537
|
if ( pSrc != null )
|
538
|
-
pSrc->
|
538
|
+
pSrc->updateAssociation(strOldObject, strNewObject, it->second);
|
539
539
|
}
|
540
540
|
}
|
541
541
|
|
542
|
-
void CSyncSource::
|
542
|
+
void CSyncSource::updateAssociation(const String& strOldObject, const String& strNewObject, const String& strAttrib)
|
543
543
|
{
|
544
544
|
if ( m_bSchemaSource )
|
545
545
|
{
|
@@ -672,7 +672,7 @@ void CSyncSource::processServerCmd_Ver3_Schema(const String& strCmd, const Strin
|
|
672
672
|
}else if ( strCmd.compare("links") == 0 )
|
673
673
|
{
|
674
674
|
String strValue = attrIter.getCurString();
|
675
|
-
|
675
|
+
processAssociations(strObject, strValue);
|
676
676
|
|
677
677
|
String strSqlUpdate = "UPDATE ";
|
678
678
|
strSqlUpdate += getName() + " SET object=? WHERE object=?";
|
@@ -766,7 +766,7 @@ void CSyncSource::processServerCmd_Ver3(const String& strCmd, const String& strO
|
|
766
766
|
m_nDeleted++;
|
767
767
|
}else if ( strCmd.compare("links") == 0 )
|
768
768
|
{
|
769
|
-
|
769
|
+
processAssociations(strObject, oAttrValue.m_strValue);
|
770
770
|
|
771
771
|
getDB().executeSQL("UPDATE object_values SET object=? where object=? and source_id=?", oAttrValue.m_strValue, strObject, getID() );
|
772
772
|
getDB().executeSQL("UPDATE changed_values SET object=?,sent=3 where object=? and source_id=?", oAttrValue.m_strValue, strObject, getID() );
|
@@ -52,7 +52,7 @@ class CSyncSource
|
|
52
52
|
int m_nRefreshTime;
|
53
53
|
int m_nProgressStep;
|
54
54
|
boolean m_bSchemaSource;
|
55
|
-
Hashtable<String,String>
|
55
|
+
Hashtable<String,String> m_hashAssociations;
|
56
56
|
VectorPtr<net::CMultipartItem*> m_arMultipartItems;
|
57
57
|
Vector<String> m_arBlobAttrs;
|
58
58
|
|
@@ -121,9 +121,9 @@ public:
|
|
121
121
|
|
122
122
|
void processServerCmd_Ver3_Schema(const String& strCmd, const String& strObject, json::CJSONStructIterator& attrIter);//throws Exception
|
123
123
|
|
124
|
-
void
|
125
|
-
void
|
126
|
-
void
|
124
|
+
void parseAssociations(const String& strAssociations);
|
125
|
+
void processAssociations(const String& strOldObject, const String& strNewObject);
|
126
|
+
void updateAssociation(const String& strOldObject, const String& strNewObject, const String& strAttrib);
|
127
127
|
private:
|
128
128
|
CSyncEngine& getSync(){ return m_syncEngine; }
|
129
129
|
CSyncNotify& getNotify();
|
@@ -299,7 +299,14 @@ void rho_sync_set_pollinterval(int nInterval)
|
|
299
299
|
|
300
300
|
void rho_sync_set_syncserver(char* syncserver)
|
301
301
|
{
|
302
|
-
|
302
|
+
rho_sync_stop();
|
303
|
+
|
304
|
+
CSyncThread::getSyncEngine().setSyncServer(syncserver);
|
305
|
+
|
306
|
+
if ( syncserver && *syncserver )
|
307
|
+
CSyncThread::getInstance()->start(CSyncThread::epLow);
|
308
|
+
else
|
309
|
+
CSyncThread::getInstance()->stop(SYNC_WAIT_BEFOREKILL_SECONDS);
|
303
310
|
}
|
304
311
|
|
305
312
|
void rho_sync_login(const char *name, const char *password, const char* callback)
|
@@ -33,6 +33,7 @@ void * rho_calloc(size_t num, size_t size);
|
|
33
33
|
size_t rho_msize(void *);
|
34
34
|
void * rho_realloc(void *, size_t);
|
35
35
|
char * rho_strdup(const char *);
|
36
|
+
wchar_t * rho_wcsdup(const wchar_t * str);
|
36
37
|
void sys_free(void *);
|
37
38
|
#ifdef __cplusplus
|
38
39
|
}
|
@@ -45,6 +46,7 @@ void sys_free(void *);
|
|
45
46
|
#undef realloc
|
46
47
|
#undef strdup
|
47
48
|
#undef _strdup
|
49
|
+
#undef _wcsdup
|
48
50
|
|
49
51
|
//#define _recalloc(p, n, s) rho_realloc(p, n*s)
|
50
52
|
#define free(p) rho_free(p)
|
@@ -55,6 +57,7 @@ void sys_free(void *);
|
|
55
57
|
|
56
58
|
#define strdup(s) rho_strdup(s)
|
57
59
|
#define _strdup(s) rho_strdup(s)
|
60
|
+
#define _wcsdup(s) rho_wcsdup(s)
|
58
61
|
|
59
62
|
#ifndef __SYMBIAN32__
|
60
63
|
|
@@ -1041,6 +1041,17 @@ char * rho_strdup(const char * str)
|
|
1041
1041
|
return tmp;
|
1042
1042
|
}
|
1043
1043
|
|
1044
|
+
wchar_t * rho_wcsdup(const wchar_t * str)
|
1045
|
+
{
|
1046
|
+
wchar_t *tmp;
|
1047
|
+
int len = (wcslen(str) + 1)*sizeof(wchar_t);
|
1048
|
+
|
1049
|
+
tmp = (wchar_t*)do_malloc(len);
|
1050
|
+
memcpy(tmp, str, len);
|
1051
|
+
|
1052
|
+
return tmp;
|
1053
|
+
}
|
1054
|
+
|
1044
1055
|
#ifdef MALLOC_STAT
|
1045
1056
|
void do_malloc_stats() {
|
1046
1057
|
PrintStats(2);
|
@@ -70,132 +70,127 @@ void CAlertDialog::DoInitControls()
|
|
70
70
|
|
71
71
|
LRESULT CAlertDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL&bHandled)
|
72
72
|
{
|
73
|
+
|
73
74
|
#define MAX(i, j) ((i) > (j) ? (i) : (j))
|
75
|
+
#define MIN(i, j) ((i) < (j) ? (i) : (j))
|
76
|
+
|
77
|
+
const int GAP = 12; //space around dialog
|
78
|
+
const int INDENT = 14; //for dialog items
|
74
79
|
|
75
|
-
const int GAP = 10; //space around dialog
|
76
|
-
const int INDENT = 8; //for dialog items
|
77
|
-
const unsigned int iconHeight = 42;
|
78
|
-
//space around label on buttons.
|
79
|
-
const int btnHIndent = 12; //horizontal
|
80
|
-
const int btnVIndent = 8; //vertical
|
81
80
|
#ifdef OS_WINCE
|
82
81
|
unsigned int maxWidth = GetSystemMetrics(SM_CXSCREEN) - (GAP * 2);
|
83
82
|
unsigned int maxHeight = GetSystemMetrics(SM_CYSCREEN) - (GAP * 2);
|
84
83
|
#else
|
85
|
-
|
86
|
-
|
84
|
+
int maxWidth = CMainWindow::getScreenWidth() - (GAP * 2);
|
85
|
+
int maxHeight = CMainWindow::getScreenWidth() - (GAP * 2);
|
87
86
|
#endif
|
88
|
-
|
87
|
+
int xBorderWidth = GetSystemMetrics(SM_CXEDGE);
|
88
|
+
int yBorderWidth = GetSystemMetrics(SM_CYEDGE);
|
89
89
|
CClientDC dc(m_hWnd);
|
90
90
|
TEXTMETRIC tm = { 0 };
|
91
|
-
RECT dlgRect, iconRect = {0 }, msgRect = { 0 }, buttonsRect = { 0 };
|
92
|
-
RECT rect = {0}; POINT point = { 0 };
|
93
|
-
#ifdef OS_WINCE
|
94
|
-
int iconId = 0;
|
95
|
-
#else
|
96
|
-
LPWSTR iconId = NULL;
|
97
|
-
#endif
|
91
|
+
RECT rect = {0}, dlgRect, iconRect = {0 }, msgRect = { 0 }, buttonsRect = { 0 };
|
98
92
|
|
99
93
|
GetClientRect(&dlgRect);
|
100
|
-
LOG(INFO) + "dlgRect: " + dlgRect.left + " " + dlgRect.top + " " + dlgRect.right + " " + dlgRect.bottom;
|
101
94
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
if (
|
107
|
-
|
108
|
-
else
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
#endif
|
120
|
-
|
121
|
-
//if icon has predefined type - try to load it from system resources.
|
122
|
-
if (iconId != 0) {
|
123
|
-
#ifdef OS_WINCE
|
124
|
-
HMODULE hGWES = LoadLibraryEx( L"gwes.exe", NULL, LOAD_LIBRARY_AS_DATAFILE );
|
125
|
-
HICON hIcon = LoadIcon(hGWES, MAKEINTRESOURCE(iconId));
|
126
|
-
#else
|
127
|
-
HICON hIcon = LoadIcon(NULL, iconId);
|
128
|
-
#endif
|
95
|
+
/***************************************************************************
|
96
|
+
Icon.
|
97
|
+
***************************************************************************/
|
98
|
+
HICON hIcon = loadIcon();
|
99
|
+
if (hIcon == NULL) {
|
100
|
+
LOG(ERROR) + "Failed to load icon";
|
101
|
+
} else {
|
102
|
+
iconRect.left = INDENT;
|
103
|
+
iconRect.top = INDENT;
|
104
|
+
iconRect.right = iconRect.left + GetSystemMetrics(SM_CXICON);
|
105
|
+
iconRect.bottom = iconRect.top + GetSystemMetrics(SM_CYICON);
|
106
|
+
|
107
|
+
m_iconCtrl.Create(m_hWnd, iconRect, NULL, WS_CHILD | WS_VISIBLE | SS_ICON);
|
108
|
+
m_iconCtrl.SetIcon(hIcon);
|
109
|
+
}
|
110
|
+
int iconHeight = iconRect.bottom - iconRect.top;
|
111
|
+
int iconWidth = iconRect.left - iconRect.right;
|
129
112
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
iconRect.top = INDENT;
|
135
|
-
iconRect.right = iconRect.left + iconHeight;
|
136
|
-
iconRect.bottom = iconRect.top + iconHeight;
|
113
|
+
/***************************************************************************
|
114
|
+
Message.
|
115
|
+
***************************************************************************/
|
116
|
+
GetClientRect(&dlgRect);
|
137
117
|
|
138
|
-
|
118
|
+
//create control
|
119
|
+
m_messageCtrl.Create(m_hWnd, CWindow::rcDefault, NULL, WS_CHILD | WS_VISIBLE);
|
139
120
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
121
|
+
//change control font to normal
|
122
|
+
HFONT hFont = m_messageCtrl.GetFont();
|
123
|
+
LOGFONT fontAttributes = { 0 };
|
124
|
+
::GetObject(hFont, sizeof(fontAttributes), &fontAttributes);
|
125
|
+
fontAttributes.lfWeight = FW_NORMAL;
|
126
|
+
hFont = CreateFontIndirect(&fontAttributes);
|
127
|
+
m_messageCtrl.SetFont(hFont);
|
144
128
|
|
145
|
-
|
146
|
-
|
147
|
-
*/
|
148
|
-
GetClientRect(&dlgRect);
|
129
|
+
|
130
|
+
//get text metrics
|
149
131
|
dc.GetTextMetrics(&tm);
|
150
|
-
|
151
|
-
msgWidth
|
152
|
-
msgHeight =
|
153
|
-
point.x = iconRect.right; point.y = iconRect.top;
|
132
|
+
|
133
|
+
int msgWidth = m_message.length() * (tm.tmAveCharWidth * 1.3) + (2 * INDENT);
|
134
|
+
int msgHeight = tm.tmHeight + tm.tmExternalLeading + tm.tmInternalLeading;
|
154
135
|
|
155
136
|
int desiredDlgWidth = iconRect.right + msgWidth + (INDENT * 2);
|
156
137
|
|
157
|
-
//if
|
158
|
-
if (
|
159
|
-
if
|
160
|
-
|
138
|
+
//if desired widht is bigger than current - make dialog window bigger
|
139
|
+
if (desiredDlgWidth > (dlgRect.right - dlgRect.left)) {
|
140
|
+
// if desired width is bigger than maximum width
|
141
|
+
// - recalculate dialog window with wrapped text
|
142
|
+
if (desiredDlgWidth >= maxWidth) {
|
143
|
+
msgWidth = maxWidth - (iconRect.right + INDENT*2 + xBorderWidth*2);
|
161
144
|
msgHeight = (((m_message.length() * tm.tmAveCharWidth) / msgWidth) + 1)
|
162
145
|
* (tm.tmHeight + tm.tmExternalLeading + tm.tmInternalLeading);
|
163
|
-
desiredDlgWidth =
|
164
|
-
} else {
|
165
|
-
msgHeight = tm.tmHeight + tm.tmExternalLeading + tm.tmInternalLeading;
|
166
|
-
}
|
167
|
-
|
168
|
-
if (m_buttons.size() == 0) {
|
169
|
-
MoveWindow(GAP, GAP,
|
170
|
-
desiredDlgWidth + 13 + INDENT,
|
171
|
-
MAX((unsigned int )iconRect.bottom, msgHeight) + msgHeight + GetSystemMetrics(SM_CYCAPTION) + INDENT);
|
172
|
-
} else {
|
173
|
-
MoveWindow(GAP, GAP,
|
174
|
-
desiredDlgWidth + 13 + INDENT,
|
175
|
-
MAX((unsigned int )iconRect.bottom, msgHeight) + GetSystemMetrics(SM_CYCAPTION) + INDENT +
|
176
|
-
(tm.tmHeight + btnVIndent + INDENT * 2)); //reserved place for buttons
|
146
|
+
desiredDlgWidth = maxWidth;
|
177
147
|
}
|
148
|
+
|
149
|
+
MoveWindow(0, 0, desiredDlgWidth,
|
150
|
+
MAX(iconRect.bottom, msgHeight) + GetSystemMetrics(SM_CYCAPTION) + INDENT + yBorderWidth * 2);
|
151
|
+
} else {
|
152
|
+
//TODO: centering message
|
178
153
|
}
|
179
|
-
|
180
|
-
msgRect.left = iconRect.right + INDENT;
|
181
|
-
msgRect.top = iconRect.top;
|
182
|
-
msgRect.right = iconRect.right + msgWidth + 2 * INDENT + INDENT * 2;
|
183
|
-
msgRect.bottom = msgRect.top + msgHeight;
|
184
|
-
|
185
|
-
//LOG(DEBUG) + " msgWidth: " + msgWidth;
|
186
|
-
//LOG(DEBUG) + " msgRect: " + msgRect.left + " " + msgRect.top + " " + msgRect.right + " " + msgRect.bottom;
|
187
|
-
|
188
|
-
m_messageCtrl.Create(m_hWnd, msgRect, NULL, WS_CHILD | WS_VISIBLE);
|
154
|
+
|
189
155
|
m_messageCtrl.SetWindowText(convertToStringW(m_message).c_str());
|
156
|
+
|
157
|
+
LOG(INFO) + "iconHeight msgHeight " + iconHeight + " "+ msgHeight;
|
158
|
+
|
159
|
+
if (iconHeight > msgHeight) {
|
160
|
+
msgRect.left = iconRect.right + INDENT;
|
161
|
+
msgRect.top = iconRect.top + (iconHeight - msgHeight)/2;
|
162
|
+
msgRect.right = msgRect.left + msgWidth;
|
163
|
+
msgRect.bottom = msgRect.top + msgHeight;
|
164
|
+
//center message on icon
|
165
|
+
m_messageCtrl.MoveWindow(iconRect.right + INDENT, iconRect.top + (iconHeight - msgHeight)/2, msgWidth, msgHeight);
|
166
|
+
} else {
|
167
|
+
msgRect.left = iconRect.right + INDENT;
|
168
|
+
msgRect.top = iconRect.top;
|
169
|
+
msgRect.right = msgRect.left + msgWidth;
|
170
|
+
msgRect.bottom = msgRect.top + msgHeight;
|
171
|
+
m_messageCtrl.MoveWindow(iconRect.right + INDENT, iconRect.top, msgWidth, msgHeight);
|
172
|
+
//center icon on message
|
173
|
+
if (hIcon) {
|
174
|
+
m_iconCtrl.MoveWindow(INDENT, iconRect.top + (msgHeight - iconHeight)/2, iconWidth, iconHeight);
|
175
|
+
m_iconCtrl.SetIcon(hIcon);
|
176
|
+
}
|
177
|
+
}
|
190
178
|
|
191
179
|
//for Wait dailog text should be centered
|
192
180
|
if (m_buttons.size() == 0) {
|
193
181
|
m_messageCtrl.CenterWindow();
|
194
182
|
}
|
195
183
|
|
196
|
-
|
197
|
-
|
198
|
-
|
184
|
+
/***************************************************************************
|
185
|
+
Buttons.
|
186
|
+
***************************************************************************/
|
187
|
+
|
188
|
+
GetClientRect(&dlgRect);
|
189
|
+
|
190
|
+
//space around label on buttons.
|
191
|
+
const int btnHIndent = 12; //horizontal
|
192
|
+
const int btnVIndent = 8; //vertical
|
193
|
+
|
199
194
|
int btnsNum = m_buttons.size();
|
200
195
|
int btnsWidth = 0, btnsHeight =tm.tmHeight + btnVIndent;
|
201
196
|
|
@@ -203,21 +198,22 @@ LRESULT CAlertDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lP
|
|
203
198
|
btnsWidth += (itr->m_title.length() * tm.tmAveCharWidth) + btnHIndent + (INDENT * 2);
|
204
199
|
}
|
205
200
|
|
201
|
+
POINT point;
|
206
202
|
point.x = INDENT, point.y = (iconHeight > msgHeight ? point.y = iconHeight + 6 : msgHeight + 2) + INDENT;
|
207
203
|
|
208
204
|
unsigned int btnWidth = 0, btnHeight = 0;
|
205
|
+
btnHeight = tm.tmHeight + btnVIndent;
|
206
|
+
|
207
|
+
//if (iconHeight + msgHeight + INDENT + btnHeight + INDENT > dlgRect.) {
|
208
|
+
//}
|
209
|
+
|
209
210
|
for (Vector<CustomButton>::iterator itr = m_buttons.begin(); itr != m_buttons.end(); ++itr) {
|
210
211
|
btnWidth = (itr->m_title.length() * tm.tmAveCharWidth) + btnHIndent;
|
211
|
-
btnHeight = tm.tmHeight + btnVIndent;
|
212
212
|
|
213
213
|
RECT rc = {point.x, point.y, point.x + btnWidth, point.y + btnHeight};
|
214
214
|
itr->Create(m_hWnd, rc,
|
215
215
|
convertToStringW(itr->m_title).c_str(),
|
216
|
-
WS_CHILD | WS_VISIBLE
|
217
|
-
#if defined(OS_WINDOWS)
|
218
|
-
| BS_DEFPUSHBUTTON
|
219
|
-
#endif
|
220
|
-
, 0,
|
216
|
+
WS_CHILD | WS_VISIBLE, 0,
|
221
217
|
itr->m_numId);
|
222
218
|
|
223
219
|
point.x += btnWidth + INDENT;
|
@@ -228,6 +224,7 @@ LRESULT CAlertDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lP
|
|
228
224
|
return bHandled = FALSE;
|
229
225
|
|
230
226
|
#undef MAX
|
227
|
+
#undef MIN
|
231
228
|
}
|
232
229
|
|
233
230
|
bool CAlertDialog::findButton(int id, CustomButton &btn)
|
@@ -254,6 +251,56 @@ LRESULT CAlertDialog::OnAlertDialogButton (WORD /*wNotifyCode*/, WORD wID, HWND
|
|
254
251
|
return 0;
|
255
252
|
}
|
256
253
|
|
254
|
+
HICON CAlertDialog::loadIcon()
|
255
|
+
{
|
256
|
+
HICON hIcon = NULL;
|
257
|
+
|
258
|
+
struct iconTable_s {
|
259
|
+
String name;
|
260
|
+
#ifdef OS_WINCE
|
261
|
+
int id;
|
262
|
+
#else
|
263
|
+
LPWSTR id;
|
264
|
+
#endif
|
265
|
+
} iconTable[] = {
|
266
|
+
#ifdef OS_WINCE
|
267
|
+
{ "alert", MB_ICONWARNING },
|
268
|
+
{ "question", MB_ICONQUESTION },
|
269
|
+
{ "info", MB_ICONINFORMATION }
|
270
|
+
#else
|
271
|
+
{ "alert", IDI_WARNING },
|
272
|
+
{ "question", IDI_QUESTION },
|
273
|
+
{ "info", IDI_INFORMATION }
|
274
|
+
#endif
|
275
|
+
};
|
276
|
+
|
277
|
+
#ifdef OS_WINCE
|
278
|
+
int iconId = 0;
|
279
|
+
#else
|
280
|
+
LPWSTR iconId = NULL;
|
281
|
+
#endif
|
282
|
+
|
283
|
+
for (int i = 0; i < (sizeof(iconTable)/sizeof(iconTable[0])); i++)
|
284
|
+
{
|
285
|
+
LOG(ERROR) + "ICON == " + iconTable[i].name;
|
286
|
+
if (iconTable[i].name == m_icon)
|
287
|
+
iconId = iconTable[i].id;
|
288
|
+
}
|
289
|
+
|
290
|
+
if (iconId != 0)
|
291
|
+
{
|
292
|
+
#ifdef OS_WINCE
|
293
|
+
HMODULE hGWES = LoadLibraryEx( L"gwes.exe", NULL, LOAD_LIBRARY_AS_DATAFILE );
|
294
|
+
hIcon = LoadIcon(hGWES, MAKEINTRESOURCE(iconId));
|
295
|
+
#else
|
296
|
+
hIcon = LoadIcon(NULL, iconId);
|
297
|
+
#endif
|
298
|
+
}
|
299
|
+
//TODO: if icon has predefined type - try to load it from system resources.
|
300
|
+
|
301
|
+
return hIcon;
|
302
|
+
}
|
303
|
+
|
257
304
|
/**
|
258
305
|
********************************************************************************
|
259
306
|
* CAlert members.
|
data/platform/wm/rhodes/Alert.h
CHANGED
@@ -75,10 +75,12 @@ public:
|
|
75
75
|
|
76
76
|
bool findButton(int id, CustomButton &button);
|
77
77
|
|
78
|
-
public:
|
79
78
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL&bHandled);
|
80
79
|
LRESULT OnAlertDialogButton (WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
81
80
|
|
81
|
+
private:
|
82
|
+
HICON loadIcon(void);
|
83
|
+
|
82
84
|
private:
|
83
85
|
String m_title;
|
84
86
|
String m_message;
|
@@ -90,6 +92,7 @@ private:
|
|
90
92
|
Vector<CustomButton> m_buttons;
|
91
93
|
};
|
92
94
|
|
95
|
+
|
93
96
|
class CAlert {
|
94
97
|
DEFINE_LOGCLASS;
|
95
98
|
public:
|