216 // --------------------------------------------------------- |
220 // --------------------------------------------------------- |
217 // |
221 // |
218 void COPPController::TransportDownIndication() |
222 void COPPController::TransportDownIndication() |
219 { |
223 { |
220 TRACE_FUNC |
224 TRACE_FUNC |
|
225 if(!iReceivingFailed && iShowRecvCompleteDialog) |
|
226 { |
|
227 //Launch recevice completed dialog. |
|
228 iRecvDoneDialog = CHbDeviceDialogSymbian::NewL(); |
|
229 iRecvDoneDialog->SetObserver(this); |
|
230 |
|
231 CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); |
|
232 CleanupStack::PushL(variantMap); |
|
233 |
|
234 TInt dialogIdx = TBluetoothDialogParams::EReceiveDone; |
|
235 CHbSymbianVariant* dialogType = CHbSymbianVariant::NewL( (TAny*) &(dialogIdx), |
|
236 CHbSymbianVariant::EInt ); |
|
237 CleanupStack::PushL(dialogType); |
|
238 TBuf16<6> dialogTypeKey; |
|
239 dialogTypeKey.Num(TBluetoothDialogParams::EDialogType); |
|
240 User::LeaveIfError(variantMap->Add(dialogTypeKey, dialogType)); |
|
241 CleanupStack::Pop(dialogType); |
|
242 |
|
243 CHbSymbianVariant* deviceName = CHbSymbianVariant::NewL( (TAny*) (&iRemoteDeviceName), |
|
244 CHbSymbianVariant::EDes ); |
|
245 CleanupStack::PushL(deviceName); |
|
246 TBuf16<6> deviceNameKey; |
|
247 deviceNameKey.Num(TBluetoothDeviceDialog::EDeviceName); |
|
248 User::LeaveIfError(variantMap->Add(deviceNameKey, deviceName)); |
|
249 CleanupStack::Pop(deviceName); |
|
250 |
|
251 CHbSymbianVariant* fileName = CHbSymbianVariant::NewL( (TAny*) (&iReceivingFileName), |
|
252 CHbSymbianVariant::EDes ); |
|
253 CleanupStack::PushL(fileName); |
|
254 TBuf16<6> fileNameKey; |
|
255 fileNameKey.Num(TBluetoothDeviceDialog::EReceivingFileName); |
|
256 User::LeaveIfError(variantMap->Add(fileNameKey, fileName)); |
|
257 CleanupStack::Pop(fileName); |
|
258 |
|
259 CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL( (TAny*) &iTotalSizeByte, |
|
260 CHbSymbianVariant::EInt ); |
|
261 CleanupStack::PushL(fileSz); |
|
262 TBuf16<6> fileSzKey; |
|
263 fileSzKey.Num(TBluetoothDeviceDialog::EReceivingFileSize); |
|
264 User::LeaveIfError(variantMap->Add(fileSzKey, fileSz)); |
|
265 CleanupStack::Pop(fileSz); |
|
266 |
|
267 CHbSymbianVariant* fileCnt = CHbSymbianVariant::NewL( (TAny*) &iFileCount, |
|
268 CHbSymbianVariant::EInt ); |
|
269 CleanupStack::PushL(fileCnt); |
|
270 TBuf16<6> fileCntKey; |
|
271 fileCntKey.Num(TBluetoothDeviceDialog::EReceivedFileCount); |
|
272 User::LeaveIfError(variantMap->Add(fileCntKey, fileCnt)); |
|
273 CleanupStack::Pop(fileCnt); |
|
274 |
|
275 iRecvDoneDialog->Show( KBTDevDialogId(), *variantMap, this ); |
|
276 CleanupStack::PopAndDestroy(variantMap); |
|
277 iShowRecvCompleteDialog = EFalse; |
|
278 } |
|
279 |
221 // Remove receiving buffer and files used during file receiving. |
280 // Remove receiving buffer and files used during file receiving. |
222 // |
281 // |
223 delete iObexObject; |
282 delete iObexObject; |
224 iObexObject = NULL; |
283 iObexObject = NULL; |
225 TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename)); |
284 TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename)); |
967 void COPPController::DataReceived(CHbSymbianVariantMap& aData) |
1027 void COPPController::DataReceived(CHbSymbianVariantMap& aData) |
968 { |
1028 { |
969 if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0) |
1029 if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0) |
970 { |
1030 { |
971 TInt val = *(static_cast<TInt*>(aData.Get(_L("actionResult"))->Data())); |
1031 TInt val = *(static_cast<TInt*>(aData.Get(_L("actionResult"))->Data())); |
972 if(!val) |
1032 switch(val) |
973 { |
1033 { |
974 //Cancel has been clicked |
1034 case TBluetoothDialogParams::ECancelReceive: |
975 CancelTransfer(); |
1035 { |
976 } |
1036 //User choose to cancel receiving. |
977 else |
1037 CancelTransfer(); |
978 { |
1038 }break; |
979 //Hide has been clicked |
1039 |
980 CloseReceivingIndicator(EFalse); |
1040 case TBluetoothDialogParams::EHide: |
|
1041 { |
|
1042 //Use choose to hide the progress dialog. |
|
1043 CloseReceivingIndicator(EFalse); |
|
1044 }break; |
|
1045 |
|
1046 case TBluetoothDialogParams::EShow: |
|
1047 case TBluetoothDialogParams::ECancelShow: |
|
1048 { |
|
1049 //In case of Show, the device dialog will handle the opening of conversation view. |
|
1050 iRecvDoneDialog->Cancel(); |
|
1051 delete iRecvDoneDialog; |
|
1052 iRecvDoneDialog = NULL; |
|
1053 }break; |
981 } |
1054 } |
982 } |
1055 } |
983 } |
1056 } |
984 |
1057 |
985 void COPPController::DeviceDialogClosed(TInt aCompletionCode) |
1058 void COPPController::DeviceDialogClosed(TInt aCompletionCode) |