Changeset 58329 in vbox for trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
- Timestamp:
- Oct 20, 2015 10:05:12 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r58257 r58329 866 866 AssertPtrReturn(pMsg, VERR_INVALID_POINTER); 867 867 868 DnDURIObject *pObj = pObjCtx-> pObjURI;868 DnDURIObject *pObj = pObjCtx->getObj(); 869 869 AssertPtr(pObj); 870 870 … … 893 893 AssertPtrReturn(pMsg, VERR_INVALID_POINTER); 894 894 895 DnDURIObject *pObj = pObjCtx-> pObjURI;895 DnDURIObject *pObj = pObjCtx->getObj(); 896 896 AssertPtr(pObj); 897 897 … … 920 920 if (mDataBase.m_uProtocolVersion >= 2) 921 921 { 922 if (!pObjCtx->fHeaderSent) 922 uint32_t fState = pObjCtx->getState(); 923 if (!(fState & DND_OBJCTX_STATE_HAS_HDR)) 923 924 { 924 925 /* … … 941 942 /** @todo Set progress object title to current file being transferred? */ 942 943 943 pObjCtx-> fHeaderSent = true;944 pObjCtx->setState(fState | DND_OBJCTX_STATE_HAS_HDR); 944 945 } 945 946 else … … 972 973 AssertPtrReturn(pMsg, VERR_INVALID_POINTER); 973 974 974 DnDURIObject *pObj = pObjCtx-> pObjURI;975 DnDURIObject *pObj = pObjCtx->getObj(); 975 976 AssertPtr(pObj); 976 977 … … 1058 1059 switch (uMsg) 1059 1060 { 1061 case GUEST_DND_CONNECT: 1062 /* Nothing to do here (yet). */ 1063 break; 1064 1065 case GUEST_DND_DISCONNECT: 1066 rc = VERR_CANCELLED; 1067 break; 1068 1060 1069 case GUEST_DND_GET_NEXT_HOST_MSG: 1061 1070 { … … 1252 1261 rc = pCtx->mpResp->setCallback(x, i_sendURIDataCallback, pCtx); \ 1253 1262 if (RT_FAILURE(rc)) \ 1254 break;1263 return rc; 1255 1264 1256 1265 #define UNREGISTER_CALLBACK(x) \ … … 1267 1276 if (RT_FAILURE(rc)) 1268 1277 return rc; 1278 1279 /* 1280 * Register callbacks. 1281 */ 1282 /* Guest callbacks. */ 1283 REGISTER_CALLBACK(GUEST_DND_CONNECT); 1284 REGISTER_CALLBACK(GUEST_DND_DISCONNECT); 1285 REGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG); 1286 REGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR); 1287 /* Host callbacks. */ 1288 REGISTER_CALLBACK(HOST_DND_HG_SND_DIR); 1289 if (mDataBase.m_uProtocolVersion >= 2) 1290 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR); 1291 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA); 1269 1292 1270 1293 do … … 1276 1299 GuestDnDURIData *pURI = &pCtx->mURI; 1277 1300 1278 rc = pURI->from MetaData(pData->getMeta());1301 rc = pURI->fromLocalMetaData(pData->getMeta()); 1279 1302 if (RT_FAILURE(rc)) 1280 1303 break; … … 1291 1314 1292 1315 /* 1293 * Set the additional size we are going to send after the meta data header + meta data.1294 * Th is additional data will contain the actual file data we want to transfer.1316 * Set the estimated data sizes we are going to send. 1317 * The total size also contains the meta data size. 1295 1318 */ 1296 pData->setAdditionalSize(pURI->getURIList().TotalBytes()); 1297 1319 const uint32_t cbMeta = pData->getMeta().getSize(); 1320 pData->setEstimatedSize(pURI->getURIList().TotalBytes() + cbMeta /* cbTotal */, 1321 cbMeta /* cbMeta */); 1322 1323 /* 1324 * Set the meta format. 1325 */ 1298 1326 void *pvFmt = (void *)pCtx->mFmtReq.c_str(); 1299 1327 uint32_t cbFmt = pCtx->mFmtReq.length() + 1; /* Include terminating zero. */ … … 1326 1354 if (RT_SUCCESS(rc)) 1327 1355 { 1328 /*1329 * Register callbacks.1330 */1331 /* Guest callbacks. */1332 REGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG);1333 REGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR);1334 /* Host callbacks. */1335 REGISTER_CALLBACK(HOST_DND_HG_SND_DIR);1336 if (mDataBase.m_uProtocolVersion >= 2)1337 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);1338 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);1339 1340 1356 rc = waitForEvent(&pCtx->mCBEvent, pCtx->mpResp, msTimeout); 1341 if (RT_FAILURE(rc)) 1342 { 1343 if (rc == VERR_CANCELLED) 1344 rc = pCtx->mpResp->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS); 1345 else if (rc != VERR_GSTDND_GUEST_ERROR) /* Guest-side error are already handled in the callback. */ 1346 rc = pCtx->mpResp->setProgress(100, DND_PROGRESS_ERROR, rc, 1347 GuestDnDTarget::i_hostErrorToString(rc)); 1348 } 1349 else 1350 rc = pCtx->mpResp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS); 1351 1352 /* 1353 * Unregister callbacks. 1354 */ 1355 /* Guest callbacks. */ 1356 UNREGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG); 1357 UNREGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR); 1358 /* Host callbacks. */ 1359 UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR); 1360 if (mDataBase.m_uProtocolVersion >= 2) 1361 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR); 1362 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA); 1357 if (RT_SUCCESS(rc)) 1358 pCtx->mpResp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS); 1363 1359 } 1364 1360 1365 1361 } while (0); 1362 1363 /* 1364 * Unregister callbacks. 1365 */ 1366 /* Guest callbacks. */ 1367 UNREGISTER_CALLBACK(GUEST_DND_CONNECT); 1368 UNREGISTER_CALLBACK(GUEST_DND_DISCONNECT); 1369 UNREGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG); 1370 UNREGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR); 1371 /* Host callbacks. */ 1372 UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR); 1373 if (mDataBase.m_uProtocolVersion >= 2) 1374 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR); 1375 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA); 1366 1376 1367 1377 #undef REGISTER_CALLBACK 1368 1378 #undef UNREGISTER_CALLBACK 1379 1380 if (RT_FAILURE(rc)) 1381 { 1382 if (rc == VERR_CANCELLED) 1383 pCtx->mpResp->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS); 1384 else if (rc != VERR_GSTDND_GUEST_ERROR) /* Guest-side error are already handled in the callback. */ 1385 pCtx->mpResp->setProgress(100, DND_PROGRESS_ERROR, rc, 1386 GuestDnDTarget::i_hostErrorToString(rc)); 1387 } 1369 1388 1370 1389 /* … … 1401 1420 return VERR_WRONG_ORDER; 1402 1421 1403 DnDURIObject *pCurObj = objCtx. pObjURI;1422 DnDURIObject *pCurObj = objCtx.getObj(); 1404 1423 AssertPtr(pCurObj); 1405 1424
Note:
See TracChangeset
for help on using the changeset viewer.