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
@@ -10,6 +10,9 @@
|
|
10
10
|
#include "unzip/unzip.h"
|
11
11
|
#include "ext/rho/rhoruby.h"
|
12
12
|
#include "common/AutoPointer.h"
|
13
|
+
#include "common/StringConverter.h"
|
14
|
+
|
15
|
+
using namespace rho::common;
|
13
16
|
|
14
17
|
extern "C" wchar_t* wce_mbtowc(const char* a);
|
15
18
|
|
@@ -21,24 +24,65 @@ CAppManager::~CAppManager(void)
|
|
21
24
|
{
|
22
25
|
}
|
23
26
|
|
24
|
-
bool CAppManager::RemoveFolder(
|
27
|
+
bool CAppManager::RemoveFolder(String pathname)
|
28
|
+
{
|
29
|
+
if (pathname.length() > 0) {
|
30
|
+
LPWSTR swPath = wce_mbtowc(pathname.c_str());
|
31
|
+
TCHAR name[MAX_PATH+2];
|
32
|
+
wsprintf(name, L"%s%c", swPath, '\0');
|
25
33
|
|
26
|
-
if (szPath) {
|
27
34
|
SHFILEOPSTRUCT fop;
|
28
|
-
|
35
|
+
|
29
36
|
fop.hwnd = NULL;
|
30
37
|
fop.wFunc = FO_DELETE;
|
31
|
-
fop.pFrom =
|
38
|
+
fop.pFrom = name;
|
32
39
|
fop.pTo = NULL;
|
33
40
|
fop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
|
41
|
+
int result = SHFileOperation(&fop);
|
42
|
+
|
43
|
+
if (swPath)
|
44
|
+
free (swPath);
|
45
|
+
|
46
|
+
return result == 0;
|
47
|
+
}
|
48
|
+
return false;
|
49
|
+
}
|
50
|
+
|
51
|
+
bool CAppManager::MoveFolder(const String& pathFrom, const String &pathTo)
|
52
|
+
{
|
53
|
+
if (pathFrom.length() > 0 && pathTo.length() > 0) {
|
54
|
+
|
55
|
+
LPWSTR swPathFrom = wce_mbtowc(pathFrom.c_str());
|
56
|
+
LPWSTR swPathTo = wce_mbtowc(pathTo.c_str());
|
57
|
+
|
58
|
+
TCHAR tcPathFrom[MAX_PATH+2];
|
59
|
+
TCHAR tcPathTo[MAX_PATH+2];
|
60
|
+
|
61
|
+
wsprintf(tcPathFrom, L"%s%c", swPathFrom,'\0');
|
62
|
+
wsprintf(tcPathTo, L"%s%c", swPathTo,'\0');
|
63
|
+
|
64
|
+
SHFILEOPSTRUCT fop;
|
65
|
+
|
66
|
+
fop.hwnd = NULL;
|
67
|
+
fop.wFunc = FO_MOVE;
|
68
|
+
fop.pFrom = tcPathFrom;
|
69
|
+
fop.pTo = tcPathTo;
|
70
|
+
fop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
|
34
71
|
|
35
72
|
int result = SHFileOperation(&fop);
|
73
|
+
|
74
|
+
if (swPathFrom)
|
75
|
+
free (swPathFrom);
|
76
|
+
if (swPathTo)
|
77
|
+
free (swPathTo);
|
78
|
+
|
36
79
|
return result == 0;
|
37
80
|
}
|
38
81
|
return false;
|
39
82
|
}
|
40
83
|
|
41
|
-
bool CAppManager::RestartClient(HWND hwnd)
|
84
|
+
bool CAppManager::RestartClient(HWND hwnd)
|
85
|
+
{
|
42
86
|
TCHAR module[MAX_PATH];
|
43
87
|
GetModuleFileName(NULL,module,MAX_PATH);
|
44
88
|
HINSTANCE res = ShellExecute(hwnd, L"open", module, L"-restarting", NULL, SW_SHOWNORMAL);
|
@@ -46,84 +90,180 @@ bool CAppManager::RestartClient(HWND hwnd) {
|
|
46
90
|
}
|
47
91
|
|
48
92
|
void CAppManager::ReloadRhoBundle(HWND hwnd, const char* szUrl, const char* szZipPassword)
|
93
|
+
{
|
94
|
+
const char *tmp_dir_name = "_tmp_";
|
95
|
+
const char *loadData = NULL;
|
96
|
+
unsigned int loadSize = 0;
|
97
|
+
String root_dir = rho_native_rhopath();
|
98
|
+
String tmp_unzip_dir;
|
99
|
+
int errCode = RRB_UNKNOWN_ERR;
|
100
|
+
|
101
|
+
root_dir.at(root_dir.length()-1) = '\\';
|
102
|
+
tmp_unzip_dir = root_dir + tmp_dir_name;
|
103
|
+
|
104
|
+
if (szUrl == NULL) {
|
105
|
+
LOG(ERROR) + "null url passed to ReloadRhoBundle";
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
|
109
|
+
//trying to load file
|
110
|
+
rho::net::CNetRequest request;
|
111
|
+
//NB: for mobile devices should use filesystem instead of RAM
|
112
|
+
NetResponse (resp, request.pullData(szUrl, null));
|
113
|
+
if (resp.getDataSize() > 0 && resp.getCharData()) {
|
114
|
+
loadData = resp.getCharData();
|
115
|
+
loadSize = resp.getDataSize();
|
116
|
+
errCode = RRB_NONE_ERR;
|
117
|
+
} else {
|
118
|
+
errCode = RRB_LOADING_ERR;
|
119
|
+
}
|
120
|
+
|
121
|
+
//trying to unzip loaded file
|
122
|
+
if (errCode == RRB_NONE_ERR)
|
123
|
+
errCode = unzipRhoBundle(loadData, loadSize, szZipPassword, tmp_unzip_dir);
|
124
|
+
|
125
|
+
RHODESAPP().stopApp();
|
126
|
+
|
127
|
+
//trying to delete old rhobundle
|
128
|
+
if (errCode == RRB_NONE_ERR)
|
129
|
+
errCode = removeOldRhoBundle();
|
130
|
+
|
131
|
+
//move new rhobundle from temporary dir
|
132
|
+
if (errCode == RRB_NONE_ERR) {
|
133
|
+
errCode = updateRhoBundle (root_dir, tmp_unzip_dir);
|
134
|
+
}
|
135
|
+
|
136
|
+
showMessage(hwnd, errCode);
|
137
|
+
}
|
138
|
+
|
139
|
+
int CAppManager::unzipRhoBundle (const char *zipData, unsigned int zipDataSize, const char *zipPassword, const String &targetPath)
|
49
140
|
{
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
if (
|
65
|
-
|
66
|
-
|
67
|
-
if( RemoveFolder(name) ) {
|
68
|
-
wsprintf(name,L"%slib%c",rootw,'\0');
|
69
|
-
|
70
|
-
ret = RemoveFolder(name);
|
71
|
-
}
|
141
|
+
int err_code = RRB_NONE_ERR;
|
142
|
+
HANDLE hFind = 0;
|
143
|
+
|
144
|
+
HZIP hz = OpenZip((void *)zipData, zipDataSize, zipPassword);
|
145
|
+
if (!hz) {
|
146
|
+
LOG(ERROR) + "Failed to open zipfile";
|
147
|
+
err_code = RRB_UNZIP_ERR;
|
148
|
+
}
|
149
|
+
|
150
|
+
if (err_code == RRB_NONE_ERR) {
|
151
|
+
//check for target dir
|
152
|
+
WIN32_FIND_DATA wfd;
|
153
|
+
hFind = FindFirstFile(convertToStringW(targetPath).c_str(), &wfd);
|
154
|
+
if (INVALID_HANDLE_VALUE == hFind) {
|
155
|
+
if (CreateDirectory(convertToStringW(targetPath).c_str(), NULL) != TRUE) {
|
156
|
+
LOG(ERROR) + "Failed to create temporary dir";
|
157
|
+
err_code = RRB_UNZIP_ERR;
|
72
158
|
}
|
159
|
+
} else {
|
160
|
+
LOG(WARNING) + "Temporary dir exists";
|
161
|
+
if (!RemoveFolder (targetPath)) {
|
162
|
+
LOG(ERROR) + "Failed to delete old temporary dir";
|
163
|
+
err_code = RRB_UNZIP_ERR;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
}
|
73
167
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
// Open zip file
|
78
|
-
HZIP hz = OpenZip(const_cast<char*>(zipData), dwDataSize, szZipPassword);
|
79
|
-
|
80
|
-
if ( hz ) {
|
81
|
-
//Stop HTTP Server
|
82
|
-
RHODESAPP().stopApp();
|
83
|
-
|
84
|
-
// Set base for unziping
|
85
|
-
SetUnzipBaseDir(hz, rootw);
|
86
|
-
|
87
|
-
// Get info about the zip
|
88
|
-
// -1 gives overall information about the zipfile
|
89
|
-
GetZipItem(hz,-1,&ze);
|
90
|
-
int numitems = ze.index;
|
91
|
-
|
92
|
-
// Iterate through items and unzip them
|
93
|
-
for (int zi = 0; zi<numitems; zi++)
|
94
|
-
{
|
95
|
-
// fetch individual details, e.g. the item's name.
|
96
|
-
GetZipItem(hz,zi,&ze);
|
97
|
-
// unzip item
|
98
|
-
UnzipItem(hz, zi, ze.name);
|
99
|
-
}
|
100
|
-
|
101
|
-
CloseZip(hz);
|
168
|
+
if (err_code == RRB_NONE_ERR) {
|
169
|
+
// Set base for unziping
|
170
|
+
SetUnzipBaseDir(hz, convertToStringW(targetPath).c_str());
|
102
171
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
172
|
+
// Get info about the zip
|
173
|
+
// -1 gives overall information about the zipfile
|
174
|
+
ZIPENTRY ze;
|
175
|
+
GetZipItem(hz,-1, &ze);
|
176
|
+
int numitems = ze.index;
|
177
|
+
|
178
|
+
// Iterate through items and unzip them
|
179
|
+
for (int zi = 0; zi<numitems; zi++) {
|
180
|
+
// fetch individual details, e.g. the item's name.
|
181
|
+
if (ZR_OK != GetZipItem(hz,zi,&ze)) {
|
182
|
+
LOG(ERROR) + "Failed to unzip item";
|
183
|
+
RemoveFolder (targetPath);
|
184
|
+
err_code = RRB_UNZIP_ERR;
|
185
|
+
break;
|
114
186
|
}
|
187
|
+
UnzipItem(hz, zi, ze.name);
|
188
|
+
}
|
189
|
+
}
|
115
190
|
|
116
|
-
|
117
|
-
|
191
|
+
if (hz)
|
192
|
+
CloseZip(hz);
|
118
193
|
|
119
|
-
|
120
|
-
|
194
|
+
return err_code;
|
195
|
+
}
|
196
|
+
|
197
|
+
int CAppManager::removeOldRhoBundle (void)
|
198
|
+
{
|
199
|
+
String root = rho_native_rhopath();
|
200
|
+
root.at(root.length()-1) = '\\';
|
201
|
+
|
202
|
+
if (!RemoveFolder(root + "apps")) {
|
203
|
+
LOG(ERROR) + "Failed to remove" + "\"" + (root + "apps") + "\"";
|
204
|
+
return RRB_REMOVEOLD_ERR;
|
205
|
+
}
|
206
|
+
|
207
|
+
if (!RemoveFolder(root + "lib")) {
|
208
|
+
LOG(ERROR) + "Failed to remove" + "\"" + (root + "lib ") + "\"";
|
209
|
+
return RRB_REMOVEOLD_ERR;
|
210
|
+
}
|
211
|
+
|
212
|
+
return RRB_NONE_ERR;
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
int CAppManager::updateRhoBundle (const String &root_path, const String &from_path)
|
217
|
+
{
|
218
|
+
int err_code = RRB_NONE_ERR;
|
219
|
+
|
220
|
+
if (!MoveFolder (from_path + "\\*.*", root_path)) {
|
221
|
+
LOG(ERROR) + "Failed to move new rhobundle content";
|
222
|
+
err_code = RRB_UPDATE_ERR;
|
223
|
+
}
|
224
|
+
|
225
|
+
if (err_code == RRB_NONE_ERR) {
|
226
|
+
if (!RemoveFolder (from_path)) {
|
227
|
+
LOG(ERROR) + "Failed to remove temporary dir";
|
121
228
|
}
|
229
|
+
}
|
230
|
+
|
231
|
+
return err_code;
|
232
|
+
}
|
233
|
+
|
234
|
+
void CAppManager::showMessage(HWND hWnd, int rrbErrCode)
|
235
|
+
{
|
236
|
+
String messageText;
|
237
|
+
|
238
|
+
if (rrbErrCode == RRB_NONE_ERR) {
|
239
|
+
MessageBox(hWnd,
|
240
|
+
_T("Rhobundle has been updated successfully.\nApplication will be restarted."),
|
241
|
+
_T("Information"),
|
242
|
+
MB_OK | MB_ICONINFORMATION );
|
243
|
+
RestartClient(hWnd);
|
244
|
+
//Close main window and client
|
245
|
+
::PostMessage(hWnd,WM_CLOSE,0,0);
|
246
|
+
}
|
122
247
|
|
123
|
-
|
124
|
-
|
248
|
+
switch (rrbErrCode) {
|
249
|
+
case RRB_LOADING_ERR:
|
250
|
+
messageText = "Error loading rhobundle.";
|
251
|
+
break;
|
252
|
+
case RRB_UNZIP_ERR:
|
253
|
+
messageText= "Can't unzip loaded rhobundle.";
|
254
|
+
break;
|
255
|
+
case RRB_REMOVEOLD_ERR:
|
256
|
+
messageText = "Can't remove old version of rhobundle. However, it may be corrupted. Exit application and reinstall rhobundle manualy.";
|
257
|
+
break;
|
258
|
+
case RRB_UPDATE_ERR:
|
259
|
+
messageText= "Error updating rhobundle. Exit application and reinstall rhobundle manualy.";
|
260
|
+
break;
|
261
|
+
default:
|
262
|
+
messageText = "Error reloading rhobundle.";
|
263
|
+
break;
|
125
264
|
}
|
126
265
|
|
266
|
+
MessageBox(hWnd, convertToStringW(messageText).c_str(), _T("Stop"), MB_OK | MB_ICONSTOP );
|
127
267
|
}
|
128
268
|
|
129
269
|
#endif
|
@@ -1,19 +1,40 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
+
#include "common/RhoStd.h"
|
4
|
+
|
5
|
+
using namespace rho;
|
6
|
+
|
3
7
|
#ifdef ENABLE_DYNAMIC_RHOBUNDLE
|
4
8
|
class CAppManager
|
5
9
|
{
|
10
|
+
enum {
|
11
|
+
RRB_NONE_ERR,
|
12
|
+
RRB_LOADING_ERR,
|
13
|
+
RRB_UNZIP_ERR,
|
14
|
+
RRB_REMOVEOLD_ERR,
|
15
|
+
RRB_UPDATE_ERR,
|
16
|
+
RRB_UNKNOWN_ERR
|
17
|
+
};
|
18
|
+
|
6
19
|
public:
|
7
|
-
CAppManager(void);
|
8
|
-
~CAppManager(void);
|
20
|
+
CAppManager (void);
|
21
|
+
~CAppManager (void);
|
9
22
|
|
10
23
|
/**
|
11
24
|
* @param szUrl - url of the zip file with rhobundle
|
12
25
|
* @param szZipPassword - zip password if required
|
13
26
|
*/
|
14
27
|
static void ReloadRhoBundle(HWND hwnd, const char* szUrl, const char* szZipPassword);
|
15
|
-
static bool RemoveFolder(
|
28
|
+
static bool RemoveFolder(String pathname);
|
29
|
+
static bool MoveFolder(const String& pathFrom, const String &pathTo);
|
16
30
|
static bool RestartClient(HWND hwnd);
|
31
|
+
|
32
|
+
private:
|
33
|
+
|
34
|
+
static int unzipRhoBundle (const char *zipData, unsigned int zipDataSize, const char *zipPassword, const String &targetPath);
|
35
|
+
static int removeOldRhoBundle (void);
|
36
|
+
static int updateRhoBundle(const String &root_path, const String &from_path);
|
37
|
+
static void showMessage (HWND hWnd, int rrbErrCode);
|
17
38
|
};
|
18
39
|
|
19
40
|
#endif
|
@@ -5,6 +5,9 @@
|
|
5
5
|
#include "Utils.h"
|
6
6
|
#include "DateTimePicker.h"
|
7
7
|
|
8
|
+
extern "C" int rho_sys_get_screen_height();
|
9
|
+
extern "C" int rho_sys_get_screen_width();
|
10
|
+
|
8
11
|
#define DLG_ITEM_SET_FONT_BOLD(ITEM_ID) \
|
9
12
|
{ \
|
10
13
|
HFONT hFont = GetDlgItem((ITEM_ID)).GetFont(); \
|
@@ -17,7 +20,7 @@
|
|
17
20
|
|
18
21
|
|
19
22
|
/*
|
20
|
-
* TODO: title and initial time
|
23
|
+
* TODO: title and initial time
|
21
24
|
*/
|
22
25
|
|
23
26
|
extern "C" HWND getMainWnd();
|
@@ -36,10 +39,10 @@ CDateTimePickerDialog::~CDateTimePickerDialog ()
|
|
36
39
|
|
37
40
|
LRESULT CDateTimePickerDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
38
41
|
{
|
39
|
-
#if defined(_WIN32_WCE)
|
40
|
-
//USES_CONVERSION;
|
41
42
|
SetWindowText(_T("Date"));
|
42
43
|
|
44
|
+
#if defined(_WIN32_WCE)
|
45
|
+
|
43
46
|
SHINITDLGINFO shidi = { SHIDIM_FLAGS, m_hWnd, SHIDIF_SIZEDLGFULLSCREEN };
|
44
47
|
RHO_ASSERT(SHInitDialog(&shidi));
|
45
48
|
|
@@ -49,6 +52,14 @@ LRESULT CDateTimePickerDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LP
|
|
49
52
|
mbi.nToolBarId = IDR_GETURL_MENUBAR;
|
50
53
|
mbi.hInstRes = _AtlBaseModule.GetResourceInstance();
|
51
54
|
RHO_ASSERT(SHCreateMenuBar(&mbi));
|
55
|
+
GotoDlgCtrl(GetDlgItem(IDC_DATE_CTRL));
|
56
|
+
|
57
|
+
#else
|
58
|
+
|
59
|
+
CreateButtons();
|
60
|
+
GotoDlgCtrl(m_btnOk);
|
61
|
+
|
62
|
+
#endif
|
52
63
|
|
53
64
|
DLG_ITEM_SET_FONT_BOLD (IDC_DATE_STATIC);
|
54
65
|
DLG_ITEM_SET_FONT_BOLD (IDC_TIME_STATIC);
|
@@ -57,9 +68,6 @@ LRESULT CDateTimePickerDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LP
|
|
57
68
|
GetDlgItem(IDC_TIME_CTRL).ShowWindow(SW_HIDE);
|
58
69
|
GetDlgItem(IDC_TIME_STATIC).ShowWindow(SW_HIDE);
|
59
70
|
}
|
60
|
-
|
61
|
-
GotoDlgCtrl(GetDlgItem(IDC_DATE_CTRL));
|
62
|
-
#endif
|
63
71
|
|
64
72
|
return FALSE;
|
65
73
|
}
|
@@ -129,25 +137,29 @@ CTimePickerDialog::~CTimePickerDialog ()
|
|
129
137
|
|
130
138
|
LRESULT CTimePickerDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
131
139
|
{
|
132
|
-
#if defined(_WIN32_WCE)
|
133
|
-
//USES_CONVERSION;
|
134
140
|
SetWindowText(_T("Date"));
|
135
141
|
|
142
|
+
#if defined(_WIN32_WCE)
|
143
|
+
|
136
144
|
SHINITDLGINFO shidi = { SHIDIM_FLAGS, m_hWnd, SHIDIF_SIZEDLGFULLSCREEN };
|
137
145
|
RHO_ASSERT(SHInitDialog(&shidi));
|
138
146
|
|
139
|
-
|
140
147
|
SHMENUBARINFO mbi = { sizeof(mbi), 0 };
|
141
148
|
mbi.hwndParent = m_hWnd;
|
142
149
|
mbi.nToolBarId = IDR_GETURL_MENUBAR;
|
143
150
|
mbi.hInstRes = _AtlBaseModule.GetResourceInstance();
|
144
151
|
RHO_ASSERT(SHCreateMenuBar(&mbi));
|
152
|
+
GotoDlgCtrl(GetDlgItem(IDC_TIME_CTRL));
|
145
153
|
|
146
|
-
|
154
|
+
#else
|
155
|
+
|
156
|
+
CreateButtons();
|
157
|
+
GotoDlgCtrl(m_btnOk);
|
147
158
|
|
148
|
-
GotoDlgCtrl(GetDlgItem(IDC_TIME_CTRL));
|
149
159
|
#endif
|
150
160
|
|
161
|
+
DLG_ITEM_SET_FONT_BOLD (IDC_TIME_STATIC);
|
162
|
+
|
151
163
|
return FALSE;
|
152
164
|
}
|
153
165
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#ifndef __DATETIMEPICKER_H__
|
2
2
|
#define __DATETIMEPICKER_H__
|
3
3
|
|
4
|
+
#include "OkCancelModalDialog.h"
|
4
5
|
#include "resource.h"
|
5
6
|
|
6
7
|
//TODO: delegates
|
@@ -9,7 +10,7 @@ class CDateTimeMessage
|
|
9
10
|
public:
|
10
11
|
static enum
|
11
12
|
{
|
12
|
-
FORMAT_DATE_TIME,
|
13
|
+
FORMAT_DATE_TIME = 0,
|
13
14
|
FORMAT_DATE,
|
14
15
|
FORMAT_TIME
|
15
16
|
};
|
@@ -37,7 +38,12 @@ public:
|
|
37
38
|
int m_format;
|
38
39
|
};
|
39
40
|
|
40
|
-
class CDateTimePickerDialog : public
|
41
|
+
class CDateTimePickerDialog : public
|
42
|
+
#if defined(OS_WINDOWS)
|
43
|
+
COkCancelModalDialog<CDateTimePickerDialog>
|
44
|
+
#else
|
45
|
+
CDialogImpl <CDateTimePickerDialog>
|
46
|
+
#endif
|
41
47
|
{
|
42
48
|
public:
|
43
49
|
CDateTimePickerDialog (const CDateTimeMessage *msg);
|
@@ -53,11 +59,10 @@ public:
|
|
53
59
|
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
|
54
60
|
END_MSG_MAP()
|
55
61
|
|
56
|
-
|
62
|
+
public:
|
57
63
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
58
64
|
LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
59
65
|
LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
60
|
-
|
61
66
|
private:
|
62
67
|
int m_format;
|
63
68
|
time_t m_returnTime;
|
@@ -65,7 +70,13 @@ private:
|
|
65
70
|
const char *m_title;
|
66
71
|
};
|
67
72
|
|
68
|
-
|
73
|
+
|
74
|
+
class CTimePickerDialog : public
|
75
|
+
#if defined(OS_WINDOWS)
|
76
|
+
COkCancelModalDialog<CTimePickerDialog>
|
77
|
+
#else
|
78
|
+
CDialogImpl <CTimePickerDialog>
|
79
|
+
#endif
|
69
80
|
{
|
70
81
|
public:
|
71
82
|
CTimePickerDialog (const CDateTimeMessage *msg);
|
@@ -580,15 +580,21 @@ void __stdcall CMainWindow::OnNavigateComplete2(IDispatch* pDisp, VARIANT * pvtU
|
|
580
580
|
LOG(TRACE) + "OnNavigateComplete2: " + OLE2CT(V_BSTR(pvtURL));
|
581
581
|
}
|
582
582
|
|
583
|
-
|
584
|
-
|
583
|
+
std::wstring& loadLoadingHtml(std::wstring& str)
|
584
|
+
{
|
585
585
|
FILE *file;
|
586
586
|
wchar_t buf[1024];
|
587
587
|
|
588
|
-
|
588
|
+
rho::String fname = RHODESAPP().getLoadingPagePath();
|
589
|
+
|
590
|
+
size_t pos = fname.find("file://");
|
591
|
+
if (pos == 0 && pos != std::string::npos)
|
592
|
+
fname.erase(0, 7);
|
593
|
+
|
589
594
|
file = fopen(fname.c_str(), "r");
|
590
595
|
|
591
596
|
if(file==NULL) {
|
597
|
+
LOG(ERROR) + "failed to open loading page \"" + fname + "\"";
|
592
598
|
str.append(L"<html><head><title>Loading...</title></head><body><h1>Loading...</h1></body></html>");
|
593
599
|
} else {
|
594
600
|
while(fgetws(buf, sizeof(buf), file) != NULL) {
|
@@ -599,7 +605,14 @@ std::wstring& loadLoadingHtml(std::wstring& str) {
|
|
599
605
|
return str;
|
600
606
|
}
|
601
607
|
|
602
|
-
void writeToTheDoc(
|
608
|
+
void writeToTheDoc (
|
609
|
+
#if defined(_WIN32_WCE)
|
610
|
+
IPIEHTMLDocument2 *document
|
611
|
+
#else
|
612
|
+
IHTMLDocument2 *document
|
613
|
+
#endif
|
614
|
+
)
|
615
|
+
{
|
603
616
|
HRESULT hresult = S_OK;
|
604
617
|
VARIANT *param;
|
605
618
|
SAFEARRAY *sfArray;
|
@@ -635,8 +648,13 @@ void CMainWindow::ShowLoadingPage(LPDISPATCH pDisp, VARIANT* URL)
|
|
635
648
|
hr = m_spIWebBrowser2->get_Document( &pHtmlDoc );
|
636
649
|
if ( SUCCEEDED(hr) )
|
637
650
|
{
|
651
|
+
#if defined(_WIN32_WCE)
|
638
652
|
IPIEHTMLDocument2* pDoc;
|
639
653
|
hr = pHtmlDoc->QueryInterface(__uuidof(IPIEHTMLDocument2), (void**)&pDoc );
|
654
|
+
#else
|
655
|
+
IHTMLDocument2* pDoc;
|
656
|
+
hr = pHtmlDoc->QueryInterface(__uuidof(IHTMLDocument2), (void**)&pDoc );
|
657
|
+
#endif
|
640
658
|
if ( SUCCEEDED(hr) )
|
641
659
|
{
|
642
660
|
// Write to the document
|
@@ -645,7 +663,6 @@ void CMainWindow::ShowLoadingPage(LPDISPATCH pDisp, VARIANT* URL)
|
|
645
663
|
}
|
646
664
|
}
|
647
665
|
}
|
648
|
-
#endif //_WIN32_WCE
|
649
666
|
|
650
667
|
void __stdcall CMainWindow::OnDocumentComplete(IDispatch* pDisp, VARIANT * pvtURL)
|
651
668
|
{
|
@@ -655,9 +672,7 @@ void __stdcall CMainWindow::OnDocumentComplete(IDispatch* pDisp, VARIANT * pvtUR
|
|
655
672
|
LPCTSTR url = OLE2CT(V_BSTR(pvtURL));
|
656
673
|
if (m_bLoading && wcscmp(url,_T("about:blank"))==0) {
|
657
674
|
LOG(TRACE) + "Show loading page";
|
658
|
-
#if defined(_WIN32_WCE)
|
659
675
|
ShowLoadingPage(pDisp, pvtURL);
|
660
|
-
#endif //_WIN32_WCE
|
661
676
|
m_bLoading = false; //show loading page only once
|
662
677
|
}else
|
663
678
|
{
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#if defined(OS_WINDOWS)
|
4
|
+
|
5
|
+
template <class T> class COkCancelModalDialog : public CDialogImpl<T>
|
6
|
+
{
|
7
|
+
public:
|
8
|
+
CButton m_btnOk;
|
9
|
+
CButton m_btnCancel;
|
10
|
+
|
11
|
+
COkCancelModalDialog()
|
12
|
+
{
|
13
|
+
m_width = m_height = 0;
|
14
|
+
m_xborder = m_yborder =0;
|
15
|
+
m_btnHeight = 0;
|
16
|
+
};
|
17
|
+
|
18
|
+
void CreateButtons ()
|
19
|
+
{
|
20
|
+
Maximize();
|
21
|
+
|
22
|
+
RECT rect;
|
23
|
+
rect.left = 1;
|
24
|
+
rect.top = m_height - m_btnHeight;
|
25
|
+
rect.right = rect.left + (m_width >> 1) - 2;
|
26
|
+
rect.bottom = rect.top + m_btnHeight;
|
27
|
+
m_btnOk.Create(m_hWnd, rect, TEXT("Ok"), WS_CHILD | WS_VISIBLE, 0, IDOK);
|
28
|
+
|
29
|
+
rect.left = (m_width >> 1);
|
30
|
+
rect.top = m_height - m_btnHeight;
|
31
|
+
rect.right = rect.left + (m_width >> 1) + 2;
|
32
|
+
rect.bottom = rect.top + m_btnHeight;
|
33
|
+
m_btnCancel.Create(m_hWnd, rect,TEXT("Cancel"),WS_CHILD|WS_VISIBLE,0,IDCANCEL);
|
34
|
+
}
|
35
|
+
|
36
|
+
private:
|
37
|
+
|
38
|
+
void Maximize ()
|
39
|
+
{
|
40
|
+
RECT rect;
|
41
|
+
NONCLIENTMETRICS ncm = { sizeof(NONCLIENTMETRICS) };
|
42
|
+
|
43
|
+
GetParent().GetWindowRect(&rect);
|
44
|
+
SystemParametersInfo ( SPI_GETNONCLIENTMETRICS, 0, &ncm, false );
|
45
|
+
|
46
|
+
m_width = rect.right - rect.left - GetSystemMetrics(SM_CXEDGE)*2;
|
47
|
+
m_height = rect.bottom - rect.top - GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYEDGE)*2;
|
48
|
+
m_xborder = GetSystemMetrics(SM_CXEDGE) > GetSystemMetrics(SM_CXBORDER) ?
|
49
|
+
GetSystemMetrics(SM_CXEDGE) : GetSystemMetrics(SM_CXBORDER);
|
50
|
+
m_yborder = GetSystemMetrics(SM_CYEDGE) > GetSystemMetrics(SM_CYBORDER) ?
|
51
|
+
GetSystemMetrics(SM_CYEDGE) : GetSystemMetrics(SM_CYBORDER);
|
52
|
+
m_btnHeight = ncm.iMenuHeight+ncm.iBorderWidth * 4 + 2;
|
53
|
+
|
54
|
+
MoveWindow(rect.left + m_xborder, rect.top + GetSystemMetrics(SM_CYCAPTION), m_width, m_height);
|
55
|
+
}
|
56
|
+
|
57
|
+
private:
|
58
|
+
int m_width, m_height;
|
59
|
+
int m_xborder, m_yborder;
|
60
|
+
int m_btnHeight;
|
61
|
+
};
|
62
|
+
|
63
|
+
#endif
|