rhodes 2.1.0 → 2.2.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.textile +4 -5
- data/Rakefile +8 -1
- data/lib/build/jake.rb +22 -16
- data/lib/extensions/rhoxml/rexml/cdata.rb +67 -0
- data/lib/extensions/rhoxml/rexml/document.rb +2 -116
- data/lib/extensions/rhoxml/rexml/element.rb +1 -1
- data/lib/extensions/rhoxml/rexml/text.rb +117 -0
- data/lib/framework/rho/render.rb +19 -11
- data/lib/framework/rho/rho.rb +17 -10
- data/lib/framework/rho/rhobluetooth.rb +103 -0
- data/lib/framework/rho/rhocontroller.rb +2 -0
- data/lib/framework/rho/rhoevent.rb +43 -0
- data/lib/framework/rho/rhoevent_bb.rb +80 -0
- data/lib/framework/rho/rhoevent_c.rb +47 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom_db_adapter.rb +2 -1
- data/lib/framework/rhom/rhom_model.rb +9 -3
- data/lib/framework/rhom/rhom_object_factory.rb +46 -22
- data/lib/framework/rhom/rhom_source.rb +12 -10
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +23 -2
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +54 -38
- data/platform/android/Rhodes/jni/include/rhodes.h +3 -0
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +2 -2
- data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +4 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +16 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_bluetooth_RhoBluetoothManager.h +21 -0
- data/platform/android/Rhodes/jni/src/bluetooth.cpp +169 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +10 -0
- data/platform/android/Rhodes/jni/src/event.cpp +429 -0
- data/platform/android/Rhodes/jni/src/fileapi.cpp +51 -1
- data/platform/android/Rhodes/jni/src/rhodes.cpp +16 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -0
- data/platform/android/Rhodes/res/layout/bt_device_list.xml +42 -0
- data/platform/android/Rhodes/res/layout/bt_device_name.xml +7 -0
- data/platform/android/Rhodes/res/values/strings.xml +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +14 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Push.java +7 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +58 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +53 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +144 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +66 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothDeviceListActivity.java +201 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +139 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +401 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +136 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothSession.java +457 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/UUIDHelper.java +71 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +12 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/Event.java +19 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +261 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +4 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +10 -2
- data/platform/android/build/RhodesSRC_build.files +33 -22
- data/platform/android/build/android.rake +198 -27
- data/platform/android/build/librhodes_build.files +3 -1
- data/platform/android/build/libruby_build.files +4 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +2 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBRowResult.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +7 -4
- data/platform/bb/Hsqldb/src/org/hsqldb/Like.java +3 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/Table.java +3 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +1 -1
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +108 -1
- data/platform/bb/RubyVM/src/com/rho/RhoLogConf.java +7 -1
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +7 -4
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +7 -1
- data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +21 -23
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +19 -10
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +8 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +3 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +14 -17
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFile.java +7 -5
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +2 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyRuntime.java +10 -1
- data/platform/bb/RubyVM/src/j2me/io/File.java +7 -6
- data/platform/bb/build/RubyVM_build.files +412 -412
- data/platform/bb/build/bb.rake +42 -18
- data/platform/bb/build/hsqldb_build.files +151 -151
- data/platform/bb/build/rhodes_build.files +44 -40
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +2 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +237 -0
- data/platform/bb/rhodes/platform/common/com/rho/RhodesApplicationPlatform.java +14 -0
- data/platform/bb/rhodes/rhodes.jdp +6 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +7 -1
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +14 -0
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +62 -76
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +660 -0
- data/platform/bb/rhodes/src/{rhomobile → com/rho/rubyext}/RhoPhonebook.java +95 -38
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +22 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +26 -6
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +21 -7
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothManager.java +528 -0
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothPort.java +281 -0
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothScreen.java +119 -0
- data/platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java +2 -2
- data/platform/iphone/Classes/AppManager/AppManager.m +70 -7
- data/platform/iphone/Classes/Bluetooth/Bluetooth.h +72 -0
- data/platform/iphone/Classes/Bluetooth/Bluetooth.m +414 -0
- data/platform/iphone/Classes/Event/Event.h +12 -0
- data/platform/iphone/Classes/Event/Event.m +300 -0
- data/platform/iphone/Classes/LogOptionsController.h +2 -1
- data/platform/iphone/Classes/LogOptionsController.m +1 -1
- data/platform/iphone/Classes/LogViewController.h +2 -1
- data/platform/iphone/Classes/MapView/MapViewController.h +2 -1
- data/platform/iphone/Classes/RhoViewController.h +16 -0
- data/platform/iphone/Classes/RhoViewController.m +20 -0
- data/platform/iphone/Classes/Rhodes.h +12 -0
- data/platform/iphone/Classes/Rhodes.m +34 -6
- data/platform/iphone/Classes/Signature/SignatureViewController.h +2 -2
- data/platform/iphone/Classes/Signature/SignatureViewController.m +0 -10
- data/platform/iphone/Classes/SimpleMainView.h +2 -2
- data/platform/iphone/Classes/SimpleMainView.m +5 -14
- data/platform/iphone/Classes/SplashViewController.h +2 -2
- data/platform/iphone/Classes/TabbedMainView.h +2 -2
- data/platform/iphone/Classes/TabbedMainView.m +5 -10
- data/platform/iphone/Info.plist +5 -5
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +39 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +47 -4
- data/platform/osx/Rhodes Debugger/NoodleLineNumberView.m +3 -2
- data/platform/shared/common/AutoPointer.h +3 -0
- data/platform/shared/common/RhoConf.cpp +2 -1
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhoTime.h +3 -3
- data/platform/shared/common/RhodesApp.cpp +75 -23
- data/platform/shared/common/RhodesApp.h +4 -0
- data/platform/shared/common/RhodesAppBase.h +2 -0
- data/platform/shared/common/ThreadQueue.cpp +23 -18
- data/platform/shared/common/ThreadQueue.h +2 -0
- data/platform/shared/db/res/db/syncdb.schema +39 -39
- data/platform/shared/logging/RhoLogConf.cpp +58 -3
- data/platform/shared/logging/RhoLogConf.h +3 -1
- data/platform/shared/net/CURLNetRequest.cpp +17 -6
- data/platform/shared/net/HttpServer.cpp +125 -25
- data/platform/shared/net/HttpServer.h +4 -3
- data/platform/shared/ruby/ext/bluetooth/bluetooth.i +56 -0
- data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +2563 -0
- data/platform/shared/ruby/ext/calendar/calendar.i +28 -0
- data/platform/shared/ruby/ext/calendar/calendar_wrap.c +2251 -0
- data/platform/shared/ruby/ext/calendar/event.h +41 -0
- data/platform/shared/ruby/ext/calendar/event.i +28 -0
- data/platform/shared/ruby/ext/calendar/event_wrap.c +2151 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +103 -3
- data/platform/shared/ruby/ext/rho/rhoruby.h +16 -2
- data/platform/shared/ruby/ext/rhoconf/rhoconf.i +12 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +101 -0
- data/platform/shared/ruby/ext/system/system.i +14 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +2568 -2208
- data/platform/shared/ruby/main.c +8 -0
- data/platform/shared/rubyext/GeoLocation.cpp +6 -3
- data/platform/shared/rubyext/System.cpp +14 -0
- data/platform/shared/sync/SyncEngine.cpp +9 -1
- data/platform/shared/sync/SyncNotify.cpp +16 -8
- data/platform/shared/sync/SyncNotify.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +7 -12
- data/platform/shared/sync/SyncThread.h +5 -3
- data/platform/wm/build/wm.rake +7 -1
- data/platform/wm/rhodes/Alert.cpp +1 -1
- data/platform/wm/rhodes/MainWindow.cpp +28 -0
- data/platform/wm/rhodes/MainWindow.h +9 -0
- data/platform/wm/rhodes/OutlookApp.cpp +72 -0
- data/platform/wm/rhodes/OutlookApp.h +22 -0
- data/platform/wm/rhodes/Rhodes.cpp +8 -0
- data/platform/wm/rhodes/Rhodes.rc +31 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +1274 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +321 -0
- data/platform/wm/rhodes/phonebook/NativeAddressBook.cpp +37 -70
- data/platform/wm/rhodes/phonebook/NativeAddressBook.h +0 -4
- data/platform/wm/rhodes/resource.h +8 -1
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +4 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +6 -4
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +487 -0
- data/platform/wm/rhodes/rhodes.vcproj +28 -11
- data/platform/wm/rhodes/stdafx.h +1 -0
- data/platform/wm/rubylib/rubylib.vcproj +32 -0
- data/rakefile.rb +8 -1
- data/res/generators/templates/application/Rakefile +1 -1
- data/res/generators/templates/application/app/layout.erb +4 -1
- data/res/generators/templates/application/build.yml +0 -1
- data/res/generators/templates/application/public/css/iphone.css +2 -2
- data/res/generators/templates/application/public/jqtouch/jqtouch-iphone.css +9 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.css +1 -5
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +3 -2
- data/rhodes.gemspec +1 -1
- data/spec/perfomance_spec/app/Benchmark/benchmark.rb +4 -0
- data/spec/perfomance_spec/app/Benchmark/bulk_results.erb +13 -0
- data/spec/perfomance_spec/app/Benchmark/controller.rb +178 -0
- data/spec/perfomance_spec/app/Benchmark/create_results.erb +13 -0
- data/spec/perfomance_spec/app/Benchmark/customers.erb +35 -0
- data/spec/perfomance_spec/app/Benchmark/index.erb +9 -0
- data/spec/perfomance_spec/app/Benchmark/products.erb +25 -0
- data/spec/perfomance_spec/app/Benchmark/search_results.erb +13 -0
- data/spec/perfomance_spec/app/Customer/customer.rb +6 -0
- data/spec/perfomance_spec/app/Perftest/index.erb +5 -0
- data/spec/perfomance_spec/app/Product/index.erb +25 -0
- data/spec/perfomance_spec/app/Product/product.rb +6 -0
- data/spec/perfomance_spec/app/helpers/application_helper.rb +126 -0
- data/spec/perfomance_spec/app/helpers/browser_helper.rb +18 -0
- data/spec/perfomance_spec/rhoconfig.txt +1 -1
- data/spec/phone_spec/app/Account_s/account_s.rb +5 -2
- data/spec/phone_spec/app/Case/case.rb +1 -0
- data/spec/phone_spec/app/Case_s/case_s.rb +2 -0
- data/spec/phone_spec/app/Data/perftest.json +35 -0
- data/spec/phone_spec/app/Data/testCDATA.xml +11 -0
- data/spec/phone_spec/app/Product/product.rb +1 -1
- data/spec/phone_spec/app/{Spec → spec}/asynchttp_spec.rb +66 -17
- data/spec/phone_spec/app/{Spec → spec}/barcode_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/blobsync_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/bsearch_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/bulksync_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/contacts_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/crypt_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/date_spec.rb +0 -0
- data/spec/phone_spec/app/spec/events_spec.rb +199 -0
- data/spec/phone_spec/app/{Spec → spec}/fixtures/client_info.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/fixtures/object_values.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/json_spec.rb +11 -2
- data/spec/phone_spec/app/{Spec → spec}/mapview_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/nativebar_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/navbar_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/pagination/fixtures/object_values.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/rho_controller_spec.rb +5 -0
- data/spec/phone_spec/app/{Spec → spec}/rho_spec.rb +48 -0
- data/spec/phone_spec/app/{Spec → spec}/rhofile_spec.rb +9 -6
- data/spec/phone_spec/app/{Spec → spec}/rhom_object_spec.rb +188 -9
- data/spec/phone_spec/app/{Spec → spec}/syncengine_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/xml_spec.rb +15 -0
- data/spec/phone_spec/app/{Spec → spec}/xruby_spec.rb +0 -0
- data/spec/phone_spec/app/spec_runner.rb +4 -1
- data/spec/phone_spec/build.yml +2 -1
- metadata +95 -31
- data/platform/bb/rhodes/platform/5.0/com/rho/RhoMainScreen.java +0 -36
- data/platform/bb/rhodes/platform/6.0/com/rho/BrowserAdapter5.java +0 -155
- data/platform/bb/rhodes/platform/6.0/com/rho/RhoMainScreen.java +0 -36
@@ -96,12 +96,8 @@ public:
|
|
96
96
|
|
97
97
|
protected:
|
98
98
|
//outlook
|
99
|
-
bool m_openedOutlookAB;
|
100
|
-
IPOutlookApp* m_outlookApp;
|
101
99
|
IPOutlookItemCollection* m_outlookItems;
|
102
100
|
|
103
|
-
int initOutlookAB();
|
104
|
-
int closeOutlookAB();
|
105
101
|
bool getOutlookItems();
|
106
102
|
int getAllOutlookRecords(std::vector<CABRecord*>& records);
|
107
103
|
CABRecord* getOutlookRecord(long oid);
|
@@ -17,8 +17,10 @@
|
|
17
17
|
#define IDD_SIMULATOR_LOGOPTIONS 116
|
18
18
|
#define IDI_ICON 117
|
19
19
|
#define IDD_DATETIME_PICKER 118
|
20
|
-
//#define IDD_DATEPICKER 119
|
21
20
|
#define IDD_TIME_PICKER 119
|
21
|
+
#define IDD_BLUETOOTH_DISCOVER 120
|
22
|
+
#define IDR_BLUETOOTH_DISCOVER 120
|
23
|
+
#define IDD_BLUETOOTH_DISCOVERED 121
|
22
24
|
#define IDC_STATIC_PROMPT 1001
|
23
25
|
#define IDC_EDIT_URL 1002
|
24
26
|
#define IDC_LOGEDIT 1003
|
@@ -33,11 +35,16 @@
|
|
33
35
|
#define IDC_TIME_CTRL 1013
|
34
36
|
#define IDC_DATE_STATIC 1017
|
35
37
|
#define IDC_TIME_STATIC 1019
|
38
|
+
#define IDC_BT_LIST 1020
|
39
|
+
#define IDC_BUTTON1 1022
|
40
|
+
#define IDC_BT_CANCEL 1022
|
41
|
+
#define IDC_BT_STATIC 1023
|
36
42
|
#define IDS_EXIT 10001
|
37
43
|
#define IDS_MENU 10002
|
38
44
|
#define IDS_OK 10003
|
39
45
|
#define IDS_CANCEL 10004
|
40
46
|
#define IDS_WND_CLASS 10005
|
47
|
+
#define IDS_CONNECT 10006
|
41
48
|
#define IDM_SK1_EXIT 40001
|
42
49
|
#define IDM_SK2_MENU 40002
|
43
50
|
#define IDM_BACK 40003
|
@@ -32,6 +32,7 @@ INetResponse* CNetRequest::pullCookies(const String& strUrl, const String& strBo
|
|
32
32
|
|
33
33
|
INetResponse* CNetRequest::doRequest( const char* method, const String& strUrl, const String& strBody, IRhoSession* oSession, Hashtable<String,String>* pHeaders )
|
34
34
|
{
|
35
|
+
m_bCancel = false;
|
35
36
|
CNetRequestImpl oImpl(this, method,strUrl,oSession,pHeaders, m_sslVerifyPeer);
|
36
37
|
return oImpl.sendString(strBody);
|
37
38
|
}
|
@@ -51,6 +52,7 @@ void CNetRequest::cancel()
|
|
51
52
|
|
52
53
|
INetResponse* CNetRequest::pushMultipartData(const String& strUrl, VectorPtr<CMultipartItem*>& arItems, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
|
53
54
|
{
|
55
|
+
m_bCancel = false;
|
54
56
|
CNetRequestImpl oImpl(this, "POST",strUrl,oSession,pHeaders,m_sslVerifyPeer);
|
55
57
|
CNetResponseImpl* pResp = oImpl.sendMultipartData(arItems);
|
56
58
|
return pResp;
|
@@ -58,6 +60,7 @@ INetResponse* CNetRequest::pushMultipartData(const String& strUrl, VectorPtr<CMu
|
|
58
60
|
|
59
61
|
INetResponse* CNetRequest::pushMultipartData(const String& strUrl, CMultipartItem& oItem, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
|
60
62
|
{
|
63
|
+
m_bCancel = false;
|
61
64
|
VectorPtr<CMultipartItem*> arItems;
|
62
65
|
arItems.addElement(&oItem);
|
63
66
|
|
@@ -69,6 +72,7 @@ INetResponse* CNetRequest::pushMultipartData(const String& strUrl, CMultipartIte
|
|
69
72
|
|
70
73
|
INetResponse* CNetRequest::pullFile(const String& strUrl, const String& strFilePath, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
|
71
74
|
{
|
75
|
+
m_bCancel = false;
|
72
76
|
common::CRhoFile oFile;
|
73
77
|
if ( !oFile.open(strFilePath.c_str(),common::CRhoFile::OpenForAppend) )
|
74
78
|
{
|
@@ -411,11 +411,13 @@ CNetResponseImpl* CNetRequestImpl::downloadFile(common::CRhoFile& oFile)
|
|
411
411
|
break;
|
412
412
|
}
|
413
413
|
|
414
|
-
if (
|
415
|
-
|
416
|
-
|
417
|
-
|
414
|
+
if ( pNetResp->isOK() )
|
415
|
+
{
|
416
|
+
if (!pDownloadBuffer)
|
417
|
+
pDownloadBuffer = new char[nDownloadBufferSize];
|
418
418
|
|
419
|
+
readInetFile(m_hRequest,pNetResp, &oFile, pDownloadBuffer, nDownloadBufferSize);
|
420
|
+
}
|
419
421
|
}while(0);
|
420
422
|
|
421
423
|
if (pDownloadBuffer)
|
@@ -0,0 +1,487 @@
|
|
1
|
+
#include "stdafx.h"
|
2
|
+
|
3
|
+
#include "ruby/ext/rho/rhoruby.h"
|
4
|
+
#if defined(OS_WINCE)
|
5
|
+
#include "ruby/ext/calendar/event.h"
|
6
|
+
#include "OutlookApp.h"
|
7
|
+
#include "common/StringConverter.h"
|
8
|
+
#include "Utils.h"
|
9
|
+
|
10
|
+
#include "logging/RhoLogConf.h"
|
11
|
+
#include "logging/RhoLog.h"
|
12
|
+
|
13
|
+
#undef DEFAULT_LOGCATEGORY
|
14
|
+
#define DEFAULT_LOGCATEGORY "Event"
|
15
|
+
|
16
|
+
#ifdef _WIN32_WCE
|
17
|
+
#define INITGUID
|
18
|
+
#include <pimstore.h>
|
19
|
+
#endif //_WIN32_WCE
|
20
|
+
|
21
|
+
using namespace rho;
|
22
|
+
using namespace rho::common;
|
23
|
+
|
24
|
+
static void calendar_check()
|
25
|
+
{
|
26
|
+
COutlookApp::Create();
|
27
|
+
if ( !COutlookApp::getInstance()->getApp() )
|
28
|
+
{
|
29
|
+
rho_ruby_raise_runtime("No calendar support on this device");
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
int checkHResult(HRESULT res, const char* file, int line, const char* msg )
|
34
|
+
{
|
35
|
+
if (FAILED(res))
|
36
|
+
{
|
37
|
+
LOG(ERROR) + "Method: " + msg + ";Line: " + line;
|
38
|
+
rho_ruby_raise_runtime("Calendar method failed.");
|
39
|
+
return 0;
|
40
|
+
}
|
41
|
+
|
42
|
+
return 1;
|
43
|
+
}
|
44
|
+
|
45
|
+
#define START_CHECK while(1){
|
46
|
+
#define CHECK(res) {if(!checkHResult(res, __FILE__, __LINE__, #res )) break;}
|
47
|
+
#define END_CHECK break; }
|
48
|
+
|
49
|
+
static void addVariantTimeToHash(VALUE hash, const char* key, DATE time)
|
50
|
+
{
|
51
|
+
SYSTEMTIME sysTime = {0};
|
52
|
+
VariantTimeToSystemTime(time, &sysTime);
|
53
|
+
|
54
|
+
addTimeToHash(hash, key, SystemTimeToUnixTime(&sysTime));
|
55
|
+
}
|
56
|
+
|
57
|
+
static DATE dateFromRuby(VALUE rDate)
|
58
|
+
{
|
59
|
+
SYSTEMTIME sysTime = {0};
|
60
|
+
UnixTimeToSystemTime(rho_ruby_get_time(rDate), &sysTime );
|
61
|
+
|
62
|
+
DATE time = 0;
|
63
|
+
SystemTimeToVariantTime(&sysTime, &time);
|
64
|
+
|
65
|
+
return time;
|
66
|
+
}
|
67
|
+
|
68
|
+
static VALUE eventToRuby(IAppointment *pEvent)
|
69
|
+
{
|
70
|
+
if (!pEvent)
|
71
|
+
return rho_ruby_get_NIL();
|
72
|
+
|
73
|
+
VALUE rEvent = rho_ruby_createHash();
|
74
|
+
|
75
|
+
long lOid = 0;
|
76
|
+
if ( SUCCEEDED(pEvent->get_Oid(&lOid)) )
|
77
|
+
addStrToHash(rEvent, RUBY_EV_ID, convertToStringA(lOid).c_str() );
|
78
|
+
|
79
|
+
CComBSTR bstrSubj;
|
80
|
+
if ( SUCCEEDED(pEvent->get_Subject(&bstrSubj)) )
|
81
|
+
addStrToHash(rEvent, RUBY_EV_TITLE, convertToStringA((BSTR)bstrSubj).c_str() );
|
82
|
+
|
83
|
+
long lStatus = 0;
|
84
|
+
if ( SUCCEEDED(pEvent->get_MeetingStatus(&lStatus)) )
|
85
|
+
addBoolToHash(rEvent, RUBY_EV_CANCELED, lStatus==olMeetingCanceled ? 1:0);
|
86
|
+
|
87
|
+
long lSensitivity = 0;
|
88
|
+
if ( SUCCEEDED(pEvent->get_Sensitivity(&lSensitivity)) )
|
89
|
+
{
|
90
|
+
String strPrivacy = "public";
|
91
|
+
switch(lSensitivity)
|
92
|
+
{
|
93
|
+
case olPersonal:
|
94
|
+
strPrivacy = "personal";
|
95
|
+
break;
|
96
|
+
case olPrivate:
|
97
|
+
strPrivacy = "private";
|
98
|
+
break;
|
99
|
+
case olConfidential:
|
100
|
+
strPrivacy = "confidential";
|
101
|
+
break;
|
102
|
+
}
|
103
|
+
|
104
|
+
addStrToHash(rEvent, RUBY_EV_PRIVACY, strPrivacy.c_str());
|
105
|
+
}
|
106
|
+
|
107
|
+
CComBSTR bstrLoc;
|
108
|
+
if ( SUCCEEDED(pEvent->get_Location(&bstrLoc)) )
|
109
|
+
addStrToHash(rEvent, RUBY_EV_LOCATION, convertToStringA((BSTR)bstrLoc).c_str() );
|
110
|
+
|
111
|
+
CComBSTR bstrNotes;
|
112
|
+
if ( SUCCEEDED(pEvent->get_Body(&bstrNotes)) )
|
113
|
+
addStrToHash(rEvent, RUBY_EV_NOTES, convertToStringA((BSTR)bstrNotes).c_str() );
|
114
|
+
|
115
|
+
DATE dStart = 0;
|
116
|
+
if ( SUCCEEDED(pEvent->get_Start(&dStart)) )
|
117
|
+
addVariantTimeToHash(rEvent, RUBY_EV_START_DATE, dStart);
|
118
|
+
|
119
|
+
DATE dEnd = 0;
|
120
|
+
if ( SUCCEEDED(pEvent->get_End(&dEnd)) )
|
121
|
+
addVariantTimeToHash(rEvent, RUBY_EV_END_DATE, dEnd);
|
122
|
+
|
123
|
+
VARIANT_BOOL bReminder;
|
124
|
+
if ( SUCCEEDED(pEvent->get_ReminderSet(&bReminder)) && bReminder == VARIANT_TRUE)
|
125
|
+
{
|
126
|
+
long lMinutes = 0;
|
127
|
+
if ( SUCCEEDED(pEvent->get_ReminderMinutesBeforeStart(&lMinutes)) )
|
128
|
+
addIntToHash(rEvent, RUBY_EV_REMINDER, (int)lMinutes);
|
129
|
+
}
|
130
|
+
|
131
|
+
VARIANT_BOOL bIsRecurring;
|
132
|
+
CComPtr<IRecurrencePattern> pRP;
|
133
|
+
if ( SUCCEEDED(pEvent->get_IsRecurring(&bIsRecurring)) && bIsRecurring == VARIANT_TRUE &&
|
134
|
+
SUCCEEDED(pEvent->GetRecurrencePattern(&pRP)) && pRP )
|
135
|
+
{
|
136
|
+
long lRecType = 0;
|
137
|
+
if ( SUCCEEDED(pEvent->get_IsRecurring(&bIsRecurring)) && bIsRecurring == VARIANT_TRUE &&
|
138
|
+
SUCCEEDED(pRP->get_RecurrenceType(&lRecType)) && lRecType != olRecursOnce )
|
139
|
+
{
|
140
|
+
VALUE rRecur = rho_ruby_createHash();
|
141
|
+
|
142
|
+
switch( lRecType )
|
143
|
+
{
|
144
|
+
case olRecursDaily:
|
145
|
+
addStrToHash(rRecur, RUBY_EV_RECURRENCE_FREQUENCY, RUBY_EV_RECURRENCE_FREQUENCY_DAILY );
|
146
|
+
break;
|
147
|
+
case olRecursWeekly:
|
148
|
+
addStrToHash(rRecur, RUBY_EV_RECURRENCE_FREQUENCY, RUBY_EV_RECURRENCE_FREQUENCY_WEEKLY );
|
149
|
+
break;
|
150
|
+
case olRecursMonthly:
|
151
|
+
case olRecursMonthNth:
|
152
|
+
addStrToHash(rRecur, RUBY_EV_RECURRENCE_FREQUENCY, RUBY_EV_RECURRENCE_FREQUENCY_MONTHLY );
|
153
|
+
break;
|
154
|
+
case olRecursYearly:
|
155
|
+
case olRecursYearNth:
|
156
|
+
addStrToHash(rRecur, RUBY_EV_RECURRENCE_FREQUENCY, RUBY_EV_RECURRENCE_FREQUENCY_YEARLY );
|
157
|
+
break;
|
158
|
+
}
|
159
|
+
|
160
|
+
long lInterval = 0;
|
161
|
+
if ( SUCCEEDED(pRP->get_Interval(&lInterval)) )
|
162
|
+
addIntToHash(rRecur, RUBY_EV_RECURRENCE_INTERVAL, (int)lInterval);
|
163
|
+
long lOccurrences = 0;
|
164
|
+
VARIANT_BOOL bNoEndDate;
|
165
|
+
if ( SUCCEEDED(pRP->get_NoEndDate(&bNoEndDate)) && bNoEndDate == VARIANT_FALSE &&
|
166
|
+
SUCCEEDED(pRP->get_Occurrences(&lOccurrences)) )
|
167
|
+
addIntToHash(rRecur, RUBY_EV_RECURRENCE_COUNT, (int)lOccurrences);
|
168
|
+
|
169
|
+
DATE dEnd = 0;
|
170
|
+
if ( SUCCEEDED(pRP->get_EndTime(&dEnd)) )
|
171
|
+
addVariantTimeToHash(rEvent, RUBY_EV_RECURRENCE_END, dEnd);
|
172
|
+
|
173
|
+
long lDayOfMonth = 0;
|
174
|
+
if ( SUCCEEDED(pRP->get_DayOfMonth(&lDayOfMonth)) )
|
175
|
+
addIntToHash(rRecur, RUBY_EV_RECURRENCE_DAYOFMONTH, (int)lDayOfMonth);
|
176
|
+
|
177
|
+
long lMonthOfYear = 0;
|
178
|
+
if ( SUCCEEDED(pRP->get_MonthOfYear(&lMonthOfYear)) )
|
179
|
+
{
|
180
|
+
VALUE arMonths = rho_ruby_create_array();
|
181
|
+
for ( int i = 1; i <= 12; i++ )
|
182
|
+
rho_ruby_add_to_array(arMonths, rho_ruby_create_integer(i == lMonthOfYear ? 1:0) );
|
183
|
+
|
184
|
+
addHashToHash(rRecur, RUBY_EV_RECURRENCE_MONTHS, arMonths);
|
185
|
+
}
|
186
|
+
|
187
|
+
long lDayOfWeekMask = 0;
|
188
|
+
if ( SUCCEEDED(pRP->get_DayOfWeekMask(&lDayOfWeekMask)) )
|
189
|
+
{
|
190
|
+
VALUE arDays = rho_ruby_create_array();
|
191
|
+
rho_ruby_add_to_array(arDays, rho_ruby_create_integer( (lDayOfWeekMask&olMonday)!= 0 ? 1:0) );
|
192
|
+
rho_ruby_add_to_array(arDays, rho_ruby_create_integer( (lDayOfWeekMask&olTuesday)!= 0 ? 1:0) );
|
193
|
+
rho_ruby_add_to_array(arDays, rho_ruby_create_integer( (lDayOfWeekMask&olWednesday)!= 0 ? 1:0) );
|
194
|
+
rho_ruby_add_to_array(arDays, rho_ruby_create_integer( (lDayOfWeekMask&olThursday)!= 0 ? 1:0) );
|
195
|
+
rho_ruby_add_to_array(arDays, rho_ruby_create_integer( (lDayOfWeekMask&olFriday)!= 0 ? 1:0) );
|
196
|
+
rho_ruby_add_to_array(arDays, rho_ruby_create_integer( (lDayOfWeekMask&olSaturday)!= 0 ? 1:0) );
|
197
|
+
rho_ruby_add_to_array(arDays, rho_ruby_create_integer( (lDayOfWeekMask&olSunday)!= 0 ? 1:0) );
|
198
|
+
|
199
|
+
addHashToHash(rRecur, RUBY_EV_RECURRENCE_DAYS, arDays);
|
200
|
+
}
|
201
|
+
|
202
|
+
addHashToHash(rEvent, RUBY_EV_RECURRENCE, rRecur);
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
return rEvent;
|
207
|
+
}
|
208
|
+
|
209
|
+
static void eventFromRuby(VALUE rEvent, IAppointment* pEvent)
|
210
|
+
{
|
211
|
+
//VALUE rId = rb_hash_aref(rEvent, rb_str_new2(RUBY_EV_ID));
|
212
|
+
//if (!NIL_P(rId))
|
213
|
+
// Check_Type(rId, T_STRING);
|
214
|
+
START_CHECK
|
215
|
+
|
216
|
+
VALUE rTitle = rho_ruby_hash_aref(rEvent, RUBY_EV_TITLE);
|
217
|
+
if (!rho_ruby_is_NIL(rTitle))
|
218
|
+
CHECK( pEvent->put_Subject(const_cast<BSTR>(convertToStringW( String(getStringFromValue(rTitle))).c_str())) );
|
219
|
+
|
220
|
+
VALUE rCancelled = rho_ruby_hash_aref(rEvent, RUBY_EV_CANCELED);
|
221
|
+
if (!rho_ruby_is_NIL(rCancelled))
|
222
|
+
{
|
223
|
+
if( rho_ruby_get_bool(rCancelled) )
|
224
|
+
CHECK( pEvent->Cancel() );
|
225
|
+
}
|
226
|
+
|
227
|
+
VALUE rPrivacy = rho_ruby_hash_aref(rEvent, RUBY_EV_PRIVACY);
|
228
|
+
if (!rho_ruby_is_NIL(rPrivacy))
|
229
|
+
{
|
230
|
+
String strPrivacy = getStringFromValue(rPrivacy);
|
231
|
+
long lSensitivity = olNormal;
|
232
|
+
if ( strPrivacy.compare("personal") == 0 )
|
233
|
+
lSensitivity = olPersonal;
|
234
|
+
else if ( strPrivacy.compare("private") == 0 )
|
235
|
+
lSensitivity = olPrivate;
|
236
|
+
else if ( strPrivacy.compare("confidential") == 0 )
|
237
|
+
lSensitivity = olConfidential;
|
238
|
+
|
239
|
+
CHECK( pEvent->put_Sensitivity(lSensitivity) );
|
240
|
+
}
|
241
|
+
|
242
|
+
VALUE rLoc = rho_ruby_hash_aref(rEvent, RUBY_EV_LOCATION);
|
243
|
+
if (!rho_ruby_is_NIL(rLoc))
|
244
|
+
CHECK( pEvent->put_Location(const_cast<BSTR>(convertToStringW( String(getStringFromValue(rLoc))).c_str())) );
|
245
|
+
|
246
|
+
VALUE rNotes = rho_ruby_hash_aref(rEvent, RUBY_EV_NOTES);
|
247
|
+
if (!rho_ruby_is_NIL(rNotes))
|
248
|
+
CHECK( pEvent->put_Body(const_cast<BSTR>(convertToStringW( String(getStringFromValue(rNotes))).c_str())));
|
249
|
+
|
250
|
+
VALUE rStartDate = rho_ruby_hash_aref(rEvent, RUBY_EV_START_DATE);
|
251
|
+
if (!rho_ruby_is_NIL(rStartDate))
|
252
|
+
CHECK( pEvent->put_Start(dateFromRuby(rStartDate)));
|
253
|
+
|
254
|
+
VALUE rEndDate = rho_ruby_hash_aref(rEvent, RUBY_EV_END_DATE);
|
255
|
+
if (!rho_ruby_is_NIL(rEndDate))
|
256
|
+
CHECK( pEvent->put_End(dateFromRuby(rEndDate)) );
|
257
|
+
|
258
|
+
VALUE rReminder = rho_ruby_hash_aref(rEvent, RUBY_EV_REMINDER);
|
259
|
+
if (!rho_ruby_is_NIL(rReminder))
|
260
|
+
{
|
261
|
+
CHECK( pEvent->put_ReminderSet(VARIANT_TRUE) );
|
262
|
+
CHECK( pEvent->put_ReminderMinutesBeforeStart(rho_ruby_get_int(rReminder)) );
|
263
|
+
}
|
264
|
+
|
265
|
+
VALUE rRecur = rho_ruby_hash_aref(rEvent, RUBY_EV_RECURRENCE);
|
266
|
+
if (!rho_ruby_is_NIL(rRecur))
|
267
|
+
{
|
268
|
+
CHECK( pEvent->ClearRecurrencePattern() );
|
269
|
+
CComPtr<IRecurrencePattern> pRP;
|
270
|
+
if ( SUCCEEDED(pEvent->GetRecurrencePattern(&pRP)) && pRP )
|
271
|
+
{
|
272
|
+
VALUE rFreq = rho_ruby_hash_aref(rRecur, RUBY_EV_RECURRENCE_FREQUENCY);
|
273
|
+
if (!rho_ruby_is_NIL(rFreq))
|
274
|
+
{
|
275
|
+
long lRecType = 0;
|
276
|
+
String strFreq = getStringFromValue(rFreq);
|
277
|
+
if ( strFreq.compare(RUBY_EV_RECURRENCE_FREQUENCY_DAILY) == 0 )
|
278
|
+
lRecType = olRecursDaily;
|
279
|
+
else if ( strFreq.compare(RUBY_EV_RECURRENCE_FREQUENCY_WEEKLY) == 0 )
|
280
|
+
lRecType = olRecursWeekly;
|
281
|
+
else if ( strFreq.compare(RUBY_EV_RECURRENCE_FREQUENCY_MONTHLY) == 0 )
|
282
|
+
lRecType = olRecursMonthly;
|
283
|
+
else if ( strFreq.compare(RUBY_EV_RECURRENCE_FREQUENCY_YEARLY) == 0 )
|
284
|
+
lRecType = olRecursYearly;
|
285
|
+
|
286
|
+
CHECK( pRP->put_RecurrenceType(lRecType) );
|
287
|
+
}
|
288
|
+
|
289
|
+
VALUE rInterval = rho_ruby_hash_aref(rRecur, RUBY_EV_RECURRENCE_INTERVAL);
|
290
|
+
if (!rho_ruby_is_NIL(rInterval))
|
291
|
+
CHECK( pRP->put_Interval(rho_ruby_get_int(rInterval)) );
|
292
|
+
|
293
|
+
VALUE rOccurrences = rho_ruby_hash_aref(rRecur, RUBY_EV_RECURRENCE_COUNT);
|
294
|
+
if (!rho_ruby_is_NIL(rOccurrences))
|
295
|
+
{
|
296
|
+
CHECK( pRP->put_NoEndDate(VARIANT_FALSE) );
|
297
|
+
CHECK( pRP->put_Occurrences(rho_ruby_get_int(rOccurrences)) );
|
298
|
+
}
|
299
|
+
|
300
|
+
VALUE rEnd = rho_ruby_hash_aref(rRecur, RUBY_EV_RECURRENCE_END);
|
301
|
+
if (!rho_ruby_is_NIL(rEnd))
|
302
|
+
CHECK( pRP->put_EndTime(dateFromRuby(rEnd)) );
|
303
|
+
|
304
|
+
VALUE rDayOfMonth = rho_ruby_hash_aref(rRecur, RUBY_EV_RECURRENCE_DAYOFMONTH);
|
305
|
+
if (!rho_ruby_is_NIL(rDayOfMonth))
|
306
|
+
CHECK( pRP->put_DayOfMonth(rho_ruby_get_int(rDayOfMonth)) );
|
307
|
+
|
308
|
+
VALUE rMonthOfYear = rho_ruby_hash_aref(rRecur, RUBY_EV_RECURRENCE_MONTHS);
|
309
|
+
if (!rho_ruby_is_NIL(rMonthOfYear))
|
310
|
+
{
|
311
|
+
for ( int i = 1; i <= 12; i++ )
|
312
|
+
{
|
313
|
+
VALUE val = rho_ruby_array_get(rMonthOfYear, i-1);
|
314
|
+
if ( rho_ruby_get_int(val) != 0)
|
315
|
+
{
|
316
|
+
CHECK( pRP->put_MonthOfYear(i) );
|
317
|
+
break;
|
318
|
+
}
|
319
|
+
}
|
320
|
+
}
|
321
|
+
|
322
|
+
VALUE rDayOfWeek = rho_ruby_hash_aref(rRecur, RUBY_EV_RECURRENCE_DAYS);
|
323
|
+
if (!rho_ruby_is_NIL(rDayOfWeek))
|
324
|
+
{
|
325
|
+
long lDayOfWeekMask = 0;
|
326
|
+
|
327
|
+
if ( rho_ruby_get_int( rho_ruby_array_get(rDayOfWeek, 0) ) )
|
328
|
+
lDayOfWeekMask |= olMonday;
|
329
|
+
if ( rho_ruby_get_int( rho_ruby_array_get(rDayOfWeek, 1) ) )
|
330
|
+
lDayOfWeekMask |= olTuesday;
|
331
|
+
if ( rho_ruby_get_int( rho_ruby_array_get(rDayOfWeek, 2) ) )
|
332
|
+
lDayOfWeekMask |= olWednesday;
|
333
|
+
if ( rho_ruby_get_int( rho_ruby_array_get(rDayOfWeek, 3) ) )
|
334
|
+
lDayOfWeekMask |= olThursday;
|
335
|
+
if ( rho_ruby_get_int( rho_ruby_array_get(rDayOfWeek, 4) ) )
|
336
|
+
lDayOfWeekMask |= olFriday;
|
337
|
+
if ( rho_ruby_get_int( rho_ruby_array_get(rDayOfWeek, 5) ) )
|
338
|
+
lDayOfWeekMask |= olSaturday;
|
339
|
+
if ( rho_ruby_get_int( rho_ruby_array_get(rDayOfWeek, 6) ) )
|
340
|
+
lDayOfWeekMask |= olSunday;
|
341
|
+
|
342
|
+
CHECK( pRP->put_DayOfWeekMask(lDayOfWeekMask) );
|
343
|
+
}
|
344
|
+
}
|
345
|
+
}
|
346
|
+
END_CHECK
|
347
|
+
|
348
|
+
}
|
349
|
+
|
350
|
+
extern "C" VALUE event_fetch(VALUE params)
|
351
|
+
{
|
352
|
+
calendar_check();
|
353
|
+
IPOutlookApp * polApp = COutlookApp::getInstance()->getApp();
|
354
|
+
|
355
|
+
CComPtr<IPOutlookItemCollection> pItems;
|
356
|
+
CComPtr<IFolder> pFolder;
|
357
|
+
|
358
|
+
VALUE start_date = rho_ruby_hash_aref(params,RUBY_EV_START_DATE);
|
359
|
+
VALUE end_date = rho_ruby_hash_aref(params,RUBY_EV_END_DATE);
|
360
|
+
VALUE include_repeating = rho_ruby_hash_aref(params,RUBY_FETCH_include_repeating);
|
361
|
+
VALUE ret = rho_ruby_create_array();
|
362
|
+
|
363
|
+
START_CHECK
|
364
|
+
CHECK( polApp->GetDefaultFolder(olFolderCalendar, &pFolder) );
|
365
|
+
|
366
|
+
CHECK( pFolder->get_Items(&pItems) );
|
367
|
+
|
368
|
+
if (rho_ruby_get_bool(include_repeating))
|
369
|
+
CHECK( pItems->put_IncludeRecurrences(VARIANT_TRUE) );
|
370
|
+
|
371
|
+
DATE dStart = dateFromRuby(start_date);
|
372
|
+
DATE dEnd = dateFromRuby(end_date);
|
373
|
+
WCHAR szRestrict[250];
|
374
|
+
StringCchPrintf(szRestrict, ARRAYSIZE(szRestrict), TEXT("[Start] >= <%f AND [End] <= <%f"), dStart, dEnd);
|
375
|
+
bool bFirst = true;
|
376
|
+
while(true)
|
377
|
+
{
|
378
|
+
CComPtr<IAppointment> pEvent;
|
379
|
+
if ( bFirst )
|
380
|
+
pItems->Find(szRestrict, (IDispatch **)&pEvent);
|
381
|
+
else
|
382
|
+
pItems->FindNext((IDispatch **)&pEvent);
|
383
|
+
|
384
|
+
if (!pEvent)
|
385
|
+
break;
|
386
|
+
|
387
|
+
VALUE rEvent = eventToRuby(pEvent);
|
388
|
+
rho_ruby_add_to_array(ret, rEvent);
|
389
|
+
|
390
|
+
bFirst = false;
|
391
|
+
}
|
392
|
+
END_CHECK
|
393
|
+
|
394
|
+
return ret;
|
395
|
+
}
|
396
|
+
|
397
|
+
IAppointment* findEventById(IPOutlookApp * polApp, const char *eid)
|
398
|
+
{
|
399
|
+
if ( !eid || !*eid )
|
400
|
+
return 0;
|
401
|
+
|
402
|
+
CComPtr<IPOutlookItemCollection> pItems;
|
403
|
+
CComPtr<IFolder> pFolder;
|
404
|
+
|
405
|
+
START_CHECK
|
406
|
+
|
407
|
+
CHECK( polApp->GetDefaultFolder(olFolderCalendar, &pFolder) );
|
408
|
+
CHECK( pFolder->get_Items(&pItems) );
|
409
|
+
|
410
|
+
String strCond = String("[Oid] = ") + eid;
|
411
|
+
IAppointment* pEvent;
|
412
|
+
CHECK( pItems->Find( const_cast<BSTR>(convertToStringW(strCond).c_str()), (IDispatch**)&pEvent) );
|
413
|
+
|
414
|
+
return pEvent;
|
415
|
+
|
416
|
+
END_CHECK
|
417
|
+
|
418
|
+
return 0;
|
419
|
+
}
|
420
|
+
|
421
|
+
extern "C" VALUE event_fetch_by_id(const char *eid)
|
422
|
+
{
|
423
|
+
calendar_check();
|
424
|
+
IPOutlookApp * polApp = COutlookApp::getInstance()->getApp();
|
425
|
+
|
426
|
+
CComPtr<IAppointment> pEvent = findEventById(polApp, eid);
|
427
|
+
if ( pEvent )
|
428
|
+
return eventToRuby(pEvent);
|
429
|
+
|
430
|
+
return rho_ruby_get_NIL();
|
431
|
+
}
|
432
|
+
|
433
|
+
extern "C" void event_save(VALUE rEvent)
|
434
|
+
{
|
435
|
+
calendar_check();
|
436
|
+
IPOutlookApp * polApp = COutlookApp::getInstance()->getApp();
|
437
|
+
|
438
|
+
START_CHECK
|
439
|
+
CComPtr<IAppointment> pEvent;
|
440
|
+
VALUE rId = rho_ruby_hash_aref(rEvent, RUBY_EV_ID);
|
441
|
+
if (!rho_ruby_is_NIL(rId))
|
442
|
+
pEvent = findEventById(polApp, getStringFromValue(rId));
|
443
|
+
|
444
|
+
if ( !pEvent )
|
445
|
+
CHECK(polApp->CreateItem(olAppointmentItem, (IDispatch**)&pEvent));
|
446
|
+
|
447
|
+
eventFromRuby(rEvent, pEvent);
|
448
|
+
|
449
|
+
CHECK(pEvent->Save());
|
450
|
+
END_CHECK
|
451
|
+
}
|
452
|
+
|
453
|
+
extern "C" void event_delete(const char *eid)
|
454
|
+
{
|
455
|
+
calendar_check();
|
456
|
+
IPOutlookApp * polApp = COutlookApp::getInstance()->getApp();
|
457
|
+
|
458
|
+
START_CHECK
|
459
|
+
|
460
|
+
CComPtr<IAppointment> pEvent = findEventById(polApp, eid);
|
461
|
+
if ( pEvent )
|
462
|
+
CHECK(pEvent->Delete());
|
463
|
+
|
464
|
+
END_CHECK
|
465
|
+
|
466
|
+
}
|
467
|
+
#else //!OS_WINCE
|
468
|
+
|
469
|
+
extern "C" VALUE event_fetch(VALUE start_date, VALUE end_date)
|
470
|
+
{
|
471
|
+
return rho_ruby_create_array();
|
472
|
+
}
|
473
|
+
|
474
|
+
extern "C" VALUE event_fetch_by_id(const char *eid)
|
475
|
+
{
|
476
|
+
return rho_ruby_get_NIL();
|
477
|
+
}
|
478
|
+
|
479
|
+
extern "C" void event_save(VALUE rEvent)
|
480
|
+
{
|
481
|
+
}
|
482
|
+
|
483
|
+
extern "C" void event_delete(const char *eid)
|
484
|
+
{
|
485
|
+
}
|
486
|
+
|
487
|
+
#endif
|