rhodes 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +10 -0
- data/lib/framework/rho/rhoerror.rb +4 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom.rb +21 -1
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +21 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesInstance.java +1 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +10 -0
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +1 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +2 -2
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +4 -2
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +52 -11
- data/platform/iphone/Classes/NativeBar.m +37 -18
- data/platform/iphone/Classes/Rhodes.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +27 -8
- data/platform/iphone/Classes/SimpleMainView.h +7 -5
- data/platform/iphone/Classes/SimpleMainView.m +155 -36
- data/platform/iphone/Classes/TabbedMainView.h +2 -4
- data/platform/iphone/Classes/TabbedMainView.m +12 -10
- data/platform/iphone/Classes/WebView.m +1 -0
- data/platform/iphone/Info.plist +7 -1
- data/platform/iphone/icon114.png +0 -0
- data/platform/iphone/icon57.png +0 -0
- data/platform/iphone/icon72.png +0 -0
- data/platform/iphone/rbuild/iphone.rake +102 -16
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +12 -0
- data/platform/shared/common/IRhoThreadImpl.h +1 -1
- data/platform/shared/common/PosixThreadImpl.cpp +17 -22
- data/platform/shared/common/PosixThreadImpl.h +1 -1
- data/platform/shared/common/RhoThread.cpp +7 -3
- data/platform/shared/common/RhoThread.h +21 -7
- data/platform/shared/common/RhodesApp.cpp +13 -9
- data/platform/shared/common/RhodesApp.h +1 -1
- data/platform/shared/common/ThreadQueue.cpp +6 -4
- data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoThread.java +18 -8
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +70 -2
- data/platform/shared/rubyJVM/src/com/rho/ThreadQueue.java +143 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +15 -5
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +42 -36
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncNotify.java +63 -20
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +4 -4
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +12 -2
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RhoSupport.java +9 -3
- data/platform/shared/sync/ClientRegister.cpp +11 -3
- data/platform/shared/sync/ClientRegister.h +1 -0
- data/platform/shared/sync/SyncEngine.cpp +38 -35
- data/platform/shared/sync/SyncEngine.h +2 -1
- data/platform/shared/sync/SyncNotify.cpp +53 -20
- data/platform/shared/sync/SyncNotify.h +9 -2
- data/platform/shared/sync/SyncSource.cpp +3 -3
- data/platform/shared/sync/SyncSource.h +1 -1
- data/platform/shared/sync/SyncThread.cpp +9 -2
- data/platform/wm/rhodes/Alert.cpp +35 -21
- data/platform/wm/rhodes/Alert.h +11 -2
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +11 -12
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +2 -0
- data/res/generators/templates/application/build.yml +1 -1
- data/rhodes.gemspec +2 -2
- data/spec/framework_spec/rhoconfig.txt +1 -0
- data/spec/phone_spec/rhoconfig.txt +2 -0
- metadata +8 -5
- data/Manifest.txt +0 -5333
@@ -46,6 +46,7 @@ private:
|
|
46
46
|
int m_nSyncPageSize;
|
47
47
|
boolean m_bNoThreaded;
|
48
48
|
int m_nErrCode;
|
49
|
+
String m_strError;
|
49
50
|
|
50
51
|
public:
|
51
52
|
CSyncEngine();
|
@@ -83,7 +84,7 @@ public:
|
|
83
84
|
|
84
85
|
void loadAllSources();
|
85
86
|
void syncAllSources();
|
86
|
-
void prepareSync(ESyncState eState);
|
87
|
+
void prepareSync(ESyncState eState, const CSourceID* oSrcID);
|
87
88
|
|
88
89
|
VectorPtr<CSyncSource*>& getSources(){ return m_sources; }
|
89
90
|
int getStartSource();
|
@@ -211,9 +211,10 @@ void CSyncNotify::onSyncSourceEnd( int nSrc, VectorPtr<CSyncSource*>& sources )
|
|
211
211
|
{
|
212
212
|
CSyncSource& src = *sources.elementAt(nSrc);
|
213
213
|
|
214
|
-
fireSyncNotification(&src, true, src.m_nErrCode, "");
|
215
214
|
if ( getSync().getState() == CSyncEngine::esStop )
|
216
|
-
fireAllSyncNotifications(true, src.m_nErrCode,
|
215
|
+
fireAllSyncNotifications(true, src.m_nErrCode, src.m_strError, sources, nSrc );
|
216
|
+
else
|
217
|
+
fireSyncNotification(&src, true, src.m_nErrCode, "");
|
217
218
|
|
218
219
|
cleanCreateObjectErrors();
|
219
220
|
}
|
@@ -293,14 +294,6 @@ void CSyncNotify::reportSyncStatus(String status, int error, String strDetails)
|
|
293
294
|
//LOG(INFO) + "Status: "+status;
|
294
295
|
}
|
295
296
|
|
296
|
-
void CSyncNotify::fireAllSyncNotifications( boolean bFinish, int nErrCode, String strMessage, VectorPtr<CSyncSource*>& sources )
|
297
|
-
{
|
298
|
-
for( int i = 0; i < (int)sources.size(); i++ )
|
299
|
-
{
|
300
|
-
doFireSyncNotification( sources.elementAt(i), bFinish, nErrCode, strMessage );
|
301
|
-
}
|
302
|
-
}
|
303
|
-
|
304
297
|
void CSyncNotify::fireBulkSyncNotification( boolean bFinish, String status, String partition, int nErrCode )
|
305
298
|
{
|
306
299
|
if ( getSync().getState() == CSyncEngine::esExit )
|
@@ -357,6 +350,33 @@ void CSyncNotify::fireBulkSyncNotification( boolean bFinish, String status, Stri
|
|
357
350
|
clearBulkSyncNotification();
|
358
351
|
}
|
359
352
|
|
353
|
+
void CSyncNotify::fireAllSyncNotifications( boolean bFinish, int nErrCode, String strError, VectorPtr<CSyncSource*>& sources, int nCurSrc )
|
354
|
+
{
|
355
|
+
synchronized(m_mxSyncNotifications)
|
356
|
+
{
|
357
|
+
if ( nCurSrc >= 0 )
|
358
|
+
{
|
359
|
+
CSyncNotification* pSN = getSyncNotifyBySrc(*sources.elementAt(nCurSrc));
|
360
|
+
if ( pSN != null )
|
361
|
+
{
|
362
|
+
doFireSyncNotification( sources.elementAt(nCurSrc), bFinish, nErrCode, strError );
|
363
|
+
return;
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
//find any source with notify
|
368
|
+
for( int i = 0; i < (int)sources.size(); i++ )
|
369
|
+
{
|
370
|
+
CSyncNotification* pSN = getSyncNotifyBySrc(*sources.elementAt(i));
|
371
|
+
if ( pSN != null )
|
372
|
+
{
|
373
|
+
doFireSyncNotification( sources.elementAt(i), bFinish, nErrCode, strError );
|
374
|
+
break;
|
375
|
+
}
|
376
|
+
}
|
377
|
+
}
|
378
|
+
}
|
379
|
+
|
360
380
|
void CSyncNotify::fireSyncNotification( CSyncSource* psrc, boolean bFinish, int nErrCode, String strMessage)
|
361
381
|
{
|
362
382
|
if ( getSync().getState() == CSyncEngine::esExit )
|
@@ -373,10 +393,24 @@ void CSyncNotify::fireSyncNotification( CSyncSource* psrc, boolean bFinish, int
|
|
373
393
|
}
|
374
394
|
}
|
375
395
|
|
376
|
-
doFireSyncNotification(psrc, bFinish, nErrCode,
|
396
|
+
doFireSyncNotification(psrc, bFinish, nErrCode, "" );
|
377
397
|
}
|
378
398
|
|
379
|
-
|
399
|
+
CSyncNotify::CSyncNotification* CSyncNotify::getSyncNotifyBySrc(CSyncSource& src)
|
400
|
+
{
|
401
|
+
CSyncNotification* pSN = null;
|
402
|
+
if ( src.isSearch() )
|
403
|
+
pSN = m_pSearchNotification;
|
404
|
+
else
|
405
|
+
pSN = m_mapSyncNotifications.get(src.getID());
|
406
|
+
|
407
|
+
if ( pSN == null && !getSync().isNoThreadedMode() )
|
408
|
+
return null;
|
409
|
+
|
410
|
+
return pSN != null ? pSN : &m_emptyNotify;
|
411
|
+
}
|
412
|
+
|
413
|
+
void CSyncNotify::doFireSyncNotification( CSyncSource* psrc, boolean bFinish, int nErrCode, String strError)
|
380
414
|
{
|
381
415
|
if ( psrc == null || getSync().isStoppedByUser() )
|
382
416
|
return; //TODO: implement all sources callback
|
@@ -387,13 +421,8 @@ void CSyncNotify::doFireSyncNotification( CSyncSource* psrc, boolean bFinish, in
|
|
387
421
|
{
|
388
422
|
synchronized(m_mxSyncNotifications)
|
389
423
|
{
|
390
|
-
CSyncNotification* pSN =
|
391
|
-
|
392
|
-
pSN = m_pSearchNotification;
|
393
|
-
else
|
394
|
-
pSN = m_mapSyncNotifications.get(src.getID());
|
395
|
-
|
396
|
-
if ( pSN == 0 )
|
424
|
+
CSyncNotification* pSN = getSyncNotifyBySrc(src);
|
425
|
+
if ( pSN == null )
|
397
426
|
return;
|
398
427
|
CSyncNotification& sn = *pSN;
|
399
428
|
|
@@ -421,7 +450,11 @@ void CSyncNotify::doFireSyncNotification( CSyncSource* psrc, boolean bFinish, in
|
|
421
450
|
strBody += "error";
|
422
451
|
strBody += "&error_code=" + convertToStringA(nErrCode);
|
423
452
|
strBody += "&error_message=";
|
424
|
-
|
453
|
+
|
454
|
+
if ( strError.length() > 0 )
|
455
|
+
URI::urlEncode(strError,strBody);
|
456
|
+
else
|
457
|
+
URI::urlEncode(src.m_strError,strBody);
|
425
458
|
}
|
426
459
|
|
427
460
|
strBody += makeCreateObjectErrorBody(src.getID());
|
@@ -49,6 +49,7 @@ private:
|
|
49
49
|
HashtablePtr<int,CSyncNotification*> m_mapSyncNotifications;
|
50
50
|
common::CAutoPtr<CSyncNotification> m_pSearchNotification;
|
51
51
|
CSyncNotification m_bulkSyncNotify;
|
52
|
+
CSyncNotification m_emptyNotify;
|
52
53
|
common::CMutex m_mxSyncNotifications;
|
53
54
|
|
54
55
|
net::INetRequest& getNet();
|
@@ -90,13 +91,19 @@ public:
|
|
90
91
|
|
91
92
|
void enableReporting(boolean bEnable){m_bEnableReporting = bEnable;}
|
92
93
|
|
94
|
+
// const String& getNotifyBody(){ return m_strNotifyBody; }
|
95
|
+
// void cleanNotifyBody(){ m_strNotifyBody = ""; }
|
96
|
+
|
97
|
+
void fireAllSyncNotifications( boolean bFinish, int nErrCode, String strError, VectorPtr<CSyncSource*>& sources, int nCurSrc );
|
98
|
+
|
93
99
|
private:
|
100
|
+
CSyncNotification* getSyncNotifyBySrc(CSyncSource& src);
|
101
|
+
|
94
102
|
String makeCreateObjectErrorBody(int nSrcID);
|
95
103
|
void processSingleObject();
|
96
104
|
|
97
|
-
void doFireSyncNotification( CSyncSource* psrc, boolean bFinish, int nErrCode, String
|
105
|
+
void doFireSyncNotification( CSyncSource* psrc, boolean bFinish, int nErrCode, String strError);
|
98
106
|
void reportSyncStatus(String status, int error, String strDetails);
|
99
|
-
void fireAllSyncNotifications( boolean bFinish, int nErrCode, String strMessage, VectorPtr<CSyncSource*>& sources );
|
100
107
|
|
101
108
|
boolean callNotify(const String& strUrl, const String& strBody );
|
102
109
|
|
@@ -48,7 +48,7 @@ CSyncSource::CSyncSource(CSyncEngine& syncEngine, db::CDBAdapter& db ) : m_sync
|
|
48
48
|
m_nRefreshTime = 0;
|
49
49
|
|
50
50
|
m_nErrCode = RhoRuby.ERR_NONE;
|
51
|
-
m_bIsSearch =
|
51
|
+
m_bIsSearch = m_syncEngine.getState() == CSyncEngine::esSearch;
|
52
52
|
m_bSchemaSource = db.isTableExist(m_strName);
|
53
53
|
}
|
54
54
|
|
@@ -66,7 +66,7 @@ CSyncSource::CSyncSource(int id, const String& strName, const String& strSyncTyp
|
|
66
66
|
m_nRefreshTime = 0;
|
67
67
|
|
68
68
|
m_nErrCode = RhoRuby.ERR_NONE;
|
69
|
-
m_bIsSearch =
|
69
|
+
m_bIsSearch = m_syncEngine.getState() == CSyncEngine::esSearch;
|
70
70
|
|
71
71
|
DBResult( res, db.executeSQL("SELECT token,associations from sources WHERE source_id=?", m_nID) );
|
72
72
|
if ( !res.isEnd() )
|
@@ -115,7 +115,7 @@ void CSyncSource::sync()
|
|
115
115
|
getNotify().fireSyncNotification(null, false, RhoRuby.ERR_NONE, RhoRuby.getMessageText("syncronizing") + getName() + "...");
|
116
116
|
|
117
117
|
CTimeInterval startTime = CTimeInterval::getCurrentTime();
|
118
|
-
m_bIsSearch = false;
|
118
|
+
//m_bIsSearch = false;
|
119
119
|
|
120
120
|
if ( isEmptyToken() )
|
121
121
|
processToken(1);
|
@@ -55,11 +55,11 @@ class CSyncSource
|
|
55
55
|
Hashtable<String,String> m_hashAssociations;
|
56
56
|
VectorPtr<net::CMultipartItem*> m_arMultipartItems;
|
57
57
|
Vector<String> m_arBlobAttrs;
|
58
|
+
boolean m_bIsSearch;
|
58
59
|
|
59
60
|
public:
|
60
61
|
int m_nErrCode;
|
61
62
|
String m_strError;
|
62
|
-
boolean m_bIsSearch;
|
63
63
|
|
64
64
|
public:
|
65
65
|
CSyncSource(int id, const String& strName, const String& strSyncType, db::CDBAdapter& db, CSyncEngine& syncEngine );
|
@@ -4,6 +4,7 @@
|
|
4
4
|
#include "common/RhoFilePath.h"
|
5
5
|
|
6
6
|
#include "ruby/ext/rho/rhoruby.h"
|
7
|
+
#include "sync/ClientRegister.h"
|
7
8
|
|
8
9
|
namespace rho {
|
9
10
|
namespace sync {
|
@@ -50,8 +51,6 @@ CSyncThread::~CSyncThread(void)
|
|
50
51
|
stop(SYNC_WAIT_BEFOREKILL_SECONDS);
|
51
52
|
|
52
53
|
db::CDBAdapter::closeAll();
|
53
|
-
|
54
|
-
LOG(INFO) + "Sync engine thread shutdown";
|
55
54
|
}
|
56
55
|
|
57
56
|
int CSyncThread::getLastPollInterval()
|
@@ -221,9 +220,17 @@ void rho_sync_set_syncserver(char* syncserver)
|
|
221
220
|
CSyncThread::getSyncEngine().setSyncServer(syncserver);
|
222
221
|
|
223
222
|
if ( syncserver && *syncserver )
|
223
|
+
{
|
224
224
|
CSyncThread::getInstance()->start(CSyncThread::epLow);
|
225
|
+
if ( CClientRegister::getInstance() != null )
|
226
|
+
CClientRegister::getInstance()->startUp();
|
227
|
+
}
|
225
228
|
else
|
229
|
+
{
|
226
230
|
CSyncThread::getInstance()->stop(CSyncThread::SYNC_WAIT_BEFOREKILL_SECONDS);
|
231
|
+
if ( CClientRegister::getInstance() != null )
|
232
|
+
CClientRegister::getInstance()->stop(CSyncThread::SYNC_WAIT_BEFOREKILL_SECONDS);
|
233
|
+
}
|
227
234
|
}
|
228
235
|
|
229
236
|
void rho_sync_login(const char *name, const char *password, const char* callback)
|
@@ -33,13 +33,24 @@ CAlertDialog::CAlertDialog(Params *params)
|
|
33
33
|
m_icon = params->m_icon;
|
34
34
|
|
35
35
|
int id = ID_ALERT_DLG_BUTTON_FIRST;
|
36
|
-
|
36
|
+
for (int i = 0; i < (int)params->m_buttons.size(); i++)
|
37
|
+
{
|
38
|
+
if(id > ID_ALERT_DLG_BUTTON_LAST)
|
39
|
+
{
|
40
|
+
LOG(ERROR) + "too many buttons";
|
41
|
+
break;
|
42
|
+
}
|
43
|
+
m_buttons.addElement(CustomButton( params->m_buttons.elementAt(i).m_strCaption,
|
44
|
+
params->m_buttons.elementAt(i).m_strID, id++));
|
45
|
+
}
|
46
|
+
|
47
|
+
/*for (Hashtable<String, String>::iterator itr = params->m_buttons.begin(); itr != params->m_buttons.end(); ++itr) {
|
37
48
|
if(id > ID_ALERT_DLG_BUTTON_LAST) {
|
38
49
|
LOG(ERROR) + "too many buttons";
|
39
50
|
break;
|
40
51
|
}
|
41
52
|
m_buttons.addElement(CustomButton(itr->first, itr->second, id++));
|
42
|
-
}
|
53
|
+
}*/
|
43
54
|
}
|
44
55
|
|
45
56
|
CAlertDialog::~CAlertDialog()
|
@@ -82,7 +93,7 @@ LRESULT CAlertDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lP
|
|
82
93
|
unsigned int maxHeight = GetSystemMetrics(SM_CYSCREEN) - (GAP * 2);
|
83
94
|
#else
|
84
95
|
int maxWidth = CMainWindow::getScreenWidth() - (GAP * 2);
|
85
|
-
int maxHeight = CMainWindow::
|
96
|
+
int maxHeight = CMainWindow::getScreenHeight() - (GAP * 2);
|
86
97
|
#endif
|
87
98
|
int xBorderWidth = GetSystemMetrics(SM_CXEDGE);
|
88
99
|
int yBorderWidth = GetSystemMetrics(SM_CYEDGE);
|
@@ -135,6 +146,13 @@ LRESULT CAlertDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lP
|
|
135
146
|
|
136
147
|
int desiredDlgWidth = iconRect.right + msgWidth + (INDENT * 2);
|
137
148
|
|
149
|
+
//space around label on buttons.
|
150
|
+
const int btnHIndent = 12; //horizontal
|
151
|
+
const int btnVIndent = 8; //vertical
|
152
|
+
|
153
|
+
int btnsNum = m_buttons.size();
|
154
|
+
int btnsHeight =tm.tmHeight + btnVIndent;
|
155
|
+
|
138
156
|
//if desired widht is bigger than current - make dialog window bigger
|
139
157
|
if (desiredDlgWidth > (dlgRect.right - dlgRect.left)) {
|
140
158
|
// if desired width is bigger than maximum width
|
@@ -147,14 +165,15 @@ LRESULT CAlertDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lP
|
|
147
165
|
}
|
148
166
|
|
149
167
|
MoveWindow(0, 0, desiredDlgWidth,
|
150
|
-
MAX(iconRect.bottom, msgHeight) + GetSystemMetrics(SM_CYCAPTION) + INDENT + yBorderWidth * 2
|
168
|
+
MAX(iconRect.bottom, msgHeight) + GetSystemMetrics(SM_CYCAPTION) + INDENT + yBorderWidth * 2 +
|
169
|
+
btnsHeight);
|
151
170
|
} else {
|
152
171
|
//TODO: centering message
|
153
172
|
}
|
154
173
|
|
155
174
|
m_messageCtrl.SetWindowText(convertToStringW(m_message).c_str());
|
156
175
|
|
157
|
-
LOG(INFO) + "iconHeight msgHeight " + iconHeight + " "+ msgHeight;
|
176
|
+
//LOG(INFO) + "iconHeight msgHeight " + iconHeight + " "+ msgHeight;
|
158
177
|
|
159
178
|
if (iconHeight > msgHeight) {
|
160
179
|
msgRect.left = iconRect.right + INDENT;
|
@@ -187,28 +206,22 @@ LRESULT CAlertDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lP
|
|
187
206
|
|
188
207
|
GetClientRect(&dlgRect);
|
189
208
|
|
190
|
-
//
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
int btnsNum = m_buttons.size();
|
195
|
-
int btnsWidth = 0, btnsHeight =tm.tmHeight + btnVIndent;
|
196
|
-
|
197
|
-
for (Vector<CustomButton>::iterator itr = m_buttons.begin(); itr != m_buttons.end(); ++itr) {
|
198
|
-
btnsWidth += (itr->m_title.length() * tm.tmAveCharWidth) + btnHIndent + (INDENT * 2);
|
199
|
-
}
|
209
|
+
//for (Vector<CustomButton>::iterator itr = m_buttons.begin(); itr != m_buttons.end(); ++itr) {
|
210
|
+
// btnsWidth += (itr->m_title.length() * tm.tmAveCharWidth) + btnHIndent + (INDENT * 2);
|
211
|
+
//}
|
200
212
|
|
201
213
|
POINT point;
|
202
214
|
point.x = INDENT, point.y = (iconHeight > msgHeight ? point.y = iconHeight + 6 : msgHeight + 2) + INDENT;
|
203
215
|
|
204
|
-
unsigned int btnWidth =
|
216
|
+
unsigned int btnWidth = 87, btnHeight = 0;
|
205
217
|
btnHeight = tm.tmHeight + btnVIndent;
|
206
218
|
|
207
219
|
//if (iconHeight + msgHeight + INDENT + btnHeight + INDENT > dlgRect.) {
|
208
220
|
//}
|
209
221
|
|
210
|
-
for (Vector<CustomButton>::iterator itr = m_buttons.begin(); itr != m_buttons.end(); ++itr)
|
211
|
-
|
222
|
+
for (Vector<CustomButton>::iterator itr = m_buttons.begin(); itr != m_buttons.end(); ++itr)
|
223
|
+
{
|
224
|
+
//btnWidth = (itr->m_title.length() * tm.tmAveCharWidth) + btnHIndent;
|
212
225
|
|
213
226
|
RECT rc = {point.x, point.y, point.x + btnWidth, point.y + btnHeight};
|
214
227
|
itr->Create(m_hWnd, rc,
|
@@ -282,7 +295,7 @@ HICON CAlertDialog::loadIcon()
|
|
282
295
|
|
283
296
|
for (int i = 0; i < (sizeof(iconTable)/sizeof(iconTable[0])); i++)
|
284
297
|
{
|
285
|
-
LOG(ERROR) + "ICON == " + iconTable[i].name;
|
298
|
+
//LOG(ERROR) + "ICON == " + iconTable[i].name;
|
286
299
|
if (iconTable[i].name == m_icon)
|
287
300
|
iconId = iconTable[i].id;
|
288
301
|
}
|
@@ -356,7 +369,8 @@ extern "C" void alert_show_popup(rho_param *p)
|
|
356
369
|
} else if (p->type == RHO_PARAM_HASH) {
|
357
370
|
String title, message, callback, icon;
|
358
371
|
String btnId, btnTitle;
|
359
|
-
Hashtable<String, String> buttons;
|
372
|
+
//Hashtable<String, String> buttons;
|
373
|
+
Vector<CAlertDialog::Params::CAlertButton> buttons;
|
360
374
|
|
361
375
|
for (int i = 0, lim = p->v.hash->size; i < lim; ++i) {
|
362
376
|
char *name = p->v.hash->name[i];
|
@@ -425,7 +439,7 @@ extern "C" void alert_show_popup(rho_param *p)
|
|
425
439
|
continue;
|
426
440
|
}
|
427
441
|
|
428
|
-
|
442
|
+
buttons.addElement( CAlertDialog::Params::CAlertButton(btnTitle, btnId) );
|
429
443
|
}
|
430
444
|
}//buttons
|
431
445
|
}
|
data/platform/wm/rhodes/Alert.h
CHANGED
@@ -20,6 +20,12 @@ public:
|
|
20
20
|
class Params {
|
21
21
|
public:
|
22
22
|
enum {DLG_DEFAULT, DLG_CUSTOM};
|
23
|
+
struct CAlertButton
|
24
|
+
{
|
25
|
+
String m_strCaption, m_strID;
|
26
|
+
CAlertButton ( const String& strCaption, const String& strID ): m_strCaption(strCaption), m_strID(strID){}
|
27
|
+
|
28
|
+
};
|
23
29
|
|
24
30
|
Params (String &message)
|
25
31
|
{
|
@@ -27,7 +33,7 @@ public:
|
|
27
33
|
m_message = message;
|
28
34
|
}
|
29
35
|
|
30
|
-
Params (String &title, String &message, String &icon, String &callback,
|
36
|
+
Params (String &title, String &message, String &icon, String &callback, Vector<CAlertButton>& buttons)
|
31
37
|
{
|
32
38
|
m_dlgType = DLG_CUSTOM;
|
33
39
|
m_title = title;
|
@@ -42,7 +48,10 @@ public:
|
|
42
48
|
String m_message;
|
43
49
|
String m_icon;
|
44
50
|
String m_callback;
|
45
|
-
|
51
|
+
|
52
|
+
//Hashtable<String, String> m_buttons;
|
53
|
+
Vector<CAlertButton> m_buttons;
|
54
|
+
|
46
55
|
};
|
47
56
|
|
48
57
|
class CustomButton : public CButton {
|
@@ -8,26 +8,28 @@ IMPLEMENT_LOGCLASS(CRhoThreadImpl,"RhoThread");
|
|
8
8
|
|
9
9
|
CRhoThreadImpl::CRhoThreadImpl() : m_hAwakeEvent(0), m_hThread(0)
|
10
10
|
{
|
11
|
+
m_hAwakeEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
|
12
|
+
}
|
11
13
|
|
14
|
+
CRhoThreadImpl::~CRhoThreadImpl()
|
15
|
+
{
|
16
|
+
if ( m_hAwakeEvent )
|
17
|
+
::CloseHandle(m_hAwakeEvent);
|
12
18
|
}
|
13
19
|
|
14
20
|
static DWORD WINAPI runProc(void* pv) throw()
|
15
21
|
{
|
16
22
|
IRhoRunnable* p = static_cast<IRhoRunnable*>(pv);
|
17
|
-
p->
|
23
|
+
p->runObject();
|
18
24
|
::ExitThread(0);
|
19
25
|
return 0;
|
20
26
|
}
|
21
27
|
|
22
28
|
void CRhoThreadImpl::start(IRhoRunnable* pRunnable, IRhoRunnable::EPriority ePriority)
|
23
29
|
{
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
DWORD dwThreadID;
|
28
|
-
m_hThread = ::CreateThread(NULL, 0, runProc, pRunnable, 0, &dwThreadID);
|
29
|
-
setThreadPriority(ePriority);
|
30
|
-
}
|
30
|
+
DWORD dwThreadID;
|
31
|
+
m_hThread = ::CreateThread(NULL, 0, runProc, pRunnable, 0, &dwThreadID);
|
32
|
+
setThreadPriority(ePriority);
|
31
33
|
}
|
32
34
|
|
33
35
|
void CRhoThreadImpl::setThreadPriority(IRhoRunnable::EPriority ePriority)
|
@@ -53,11 +55,8 @@ void CRhoThreadImpl::stop(unsigned int nTimeoutToKill)
|
|
53
55
|
::TerminateThread(m_hThread,0);
|
54
56
|
}
|
55
57
|
::CloseHandle(m_hThread);
|
56
|
-
m_hThread =
|
58
|
+
m_hThread = null;
|
57
59
|
}
|
58
|
-
|
59
|
-
if ( m_hAwakeEvent )
|
60
|
-
::CloseHandle(m_hAwakeEvent);
|
61
60
|
}
|
62
61
|
|
63
62
|
void CRhoThreadImpl::wait(unsigned int nTimeout)
|