|
1 /* |
|
2 * Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Creates and sends as many MMS messages as there are files |
|
15 * to be send. Oversize JPEG images are compressed to fit into |
|
16 * message. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <coemain.h> |
|
24 #include <MuiuMsvUiServiceUtilities.h> |
|
25 #include <MmsConst.h> |
|
26 #include <mmsclient.h> |
|
27 #include <MmsDirectUploadUi.rsg> |
|
28 #include <eikprogi.h> |
|
29 #include <StringLoader.h> |
|
30 #include <msvids.h> |
|
31 #include <apmstd.h> |
|
32 #include <CMsvMimeHeaders.h> |
|
33 #include <mtmuibas.h> // MTM UI base |
|
34 #include <mtuireg.h> // MTM UI registery |
|
35 |
|
36 #include <MTMExtendedCapabilities.hrh> |
|
37 #include <UniImageProcessor.h> |
|
38 #include <MsgMimeTypes.h> |
|
39 #ifdef RD_MULTIPLE_DRIVE |
|
40 #include <driveinfo.h> |
|
41 #endif |
|
42 |
|
43 #include <SendUiConsts.h> |
|
44 #include <sendnorm.rsg> |
|
45 #include <senduisingleton.h> |
|
46 |
|
47 #include "SendUiFileRightsEngine.h" |
|
48 #include "MDUCreateAndSend.h" |
|
49 #include "CSendUiAttachment.h" |
|
50 |
|
51 // CONSTANTS |
|
52 const TInt KProgressIncrement = 1; |
|
53 const TInt KTenKiloBytes = 10240; |
|
54 const TInt KImageTargetWidth = 1600; |
|
55 const TInt KImageTargetHeight = 1200; |
|
56 |
|
57 // Ram drive, path structure is created if it does not exist |
|
58 _LIT( KTempFilePath, ":\\system\\temp\\mmsupload\\"); |
|
59 |
|
60 // ============================ MEMBER FUNCTIONS =============================== |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CMDUCreateAndSend::CMDUCreateAndSend |
|
64 // C++ default constructor can NOT contain any code, that |
|
65 // might leave. |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 CMDUCreateAndSend::CMDUCreateAndSend( |
|
69 CCoeEnv& aCoeEnv, |
|
70 CSendUiSingleton& aSingleton, |
|
71 MMDUCreateAndSendCallback* aCallback ) |
|
72 : CActive( EPriorityStandard ), |
|
73 iCoeEnv( aCoeEnv ), |
|
74 iSingleton( aSingleton ), |
|
75 iFs( iCoeEnv.FsSession() ), |
|
76 iCallback( aCallback ), |
|
77 iMessageCreated( EFalse ) |
|
78 { |
|
79 CActiveScheduler::Add( this ); |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CMDUCreateAndSend::ConstructL |
|
84 // Symbian 2nd phase constructor can leave. |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 void CMDUCreateAndSend::ConstructL() |
|
88 { |
|
89 iError = iSendAsSession.Connect(); |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CMDUCreateAndSend::NewL |
|
94 // Two-phased constructor. |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 CMDUCreateAndSend* CMDUCreateAndSend::NewL( |
|
98 CCoeEnv& aCoeEnv, |
|
99 CSendUiSingleton& aSingleton, |
|
100 MMDUCreateAndSendCallback* aCallback ) |
|
101 { |
|
102 CMDUCreateAndSend* self = CMDUCreateAndSend::NewLC( aCoeEnv, aSingleton, aCallback ); |
|
103 |
|
104 CleanupStack::Pop( self ); |
|
105 |
|
106 return self; |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------- |
|
110 // CMDUCreateAndSend::NewLC |
|
111 // Two-phased constructor. |
|
112 // --------------------------------------------------------- |
|
113 // |
|
114 CMDUCreateAndSend* CMDUCreateAndSend::NewLC( |
|
115 CCoeEnv& aCoeEnv, |
|
116 CSendUiSingleton& aSingleton, |
|
117 MMDUCreateAndSendCallback* aCallback) |
|
118 { |
|
119 CMDUCreateAndSend* self = new (ELeave) CMDUCreateAndSend( aCoeEnv, aSingleton, aCallback ); |
|
120 |
|
121 CleanupStack::PushL( self ); |
|
122 self->ConstructL(); |
|
123 |
|
124 return self; |
|
125 } |
|
126 |
|
127 // Destructor |
|
128 CMDUCreateAndSend::~CMDUCreateAndSend() |
|
129 { |
|
130 iSendAsSession.Close(); |
|
131 Cancel(); |
|
132 Reset(); |
|
133 } |
|
134 |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CMDUCreateAndSend::CMDUCreateAndSend |
|
138 // Creates and sends as many MMS messages as there are files |
|
139 // to be send. Oversize JPEG images are compressed to fit into |
|
140 // message. |
|
141 // (other items were commented in a header). |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 void CMDUCreateAndSend::CreateAndSendL( |
|
145 CArrayPtrFlat<CSendUiAttachment>* aAttachments, |
|
146 const TDesC& aToAddress, |
|
147 const TDesC& aToAlias, |
|
148 TInt aMaxMsgSize ) |
|
149 { |
|
150 iError = KErrNone; |
|
151 iCompressionOk = 0; |
|
152 iCompressionFail = 0; |
|
153 iMaxMsgSize = aMaxMsgSize; |
|
154 |
|
155 if ( aAttachments->Count() ) |
|
156 { |
|
157 iAttachments = aAttachments; |
|
158 } |
|
159 else |
|
160 { |
|
161 User::Leave( KErrArgument ); |
|
162 } |
|
163 |
|
164 if( aToAlias.Length() ) |
|
165 { |
|
166 iToAlias = aToAlias.AllocL(); |
|
167 } |
|
168 else |
|
169 { |
|
170 User::Leave( KErrArgument ); |
|
171 } |
|
172 |
|
173 if( aToAddress.Length() ) |
|
174 { |
|
175 iToAddress = aToAddress.AllocL(); |
|
176 } |
|
177 else |
|
178 { |
|
179 User::Leave( KErrArgument ); |
|
180 } |
|
181 |
|
182 if ( !CheckMmsServiceAvailabilityL() ) |
|
183 { |
|
184 CSendUiFileRightsEngine* fileRightsEngine = |
|
185 CSendUiFileRightsEngine::NewLC( iCoeEnv.FsSession() ); |
|
186 |
|
187 TUint i; |
|
188 if ( iAttachments->Count() > 1 ) |
|
189 { |
|
190 i = R_SENDUI_SETTINGS_NOT_OK_MANY; |
|
191 } |
|
192 else |
|
193 { |
|
194 i = R_SENDUI_SETTINGS_NOT_OK; |
|
195 } |
|
196 |
|
197 fileRightsEngine->ShowInformationNoteL( i ); |
|
198 CleanupStack::PopAndDestroy( fileRightsEngine ); |
|
199 User::Leave( KErrCompletion ); |
|
200 } |
|
201 |
|
202 CreateProgressNoteL( aAttachments->Count() ); |
|
203 |
|
204 iState = EStateCreateMessage; |
|
205 |
|
206 CreateMessageAndSetDataL(); |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CMDUCreateAndSend::RunL |
|
211 // |
|
212 // (other items were commented in a header). |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 void CMDUCreateAndSend::RunL() |
|
216 { |
|
217 if ( iStatus < 0 ) |
|
218 { |
|
219 iError = iStatus.Int(); |
|
220 } |
|
221 |
|
222 if ( iError != KErrNone ) |
|
223 { |
|
224 Reset(); |
|
225 iCallback->MessagesReady(); |
|
226 } |
|
227 else |
|
228 { |
|
229 switch ( iState ) |
|
230 { |
|
231 case EStateCreateMessage: |
|
232 { |
|
233 if ( iMessageCount < iAttachments->Count() ) |
|
234 { |
|
235 CreateMessageAndSetDataL(); |
|
236 } |
|
237 else |
|
238 { |
|
239 iState = EStateReady; |
|
240 CompleteSelf(); |
|
241 } |
|
242 } |
|
243 break; |
|
244 case EStateImageCompression: |
|
245 { |
|
246 if ( IsCompressionNeededL() ) |
|
247 { |
|
248 CompressImageL(); |
|
249 } |
|
250 else |
|
251 { |
|
252 iState = EStateAddAttachment; |
|
253 CompleteSelf(); |
|
254 } |
|
255 } |
|
256 break; |
|
257 case EStateAddAttachment: |
|
258 { |
|
259 AddAttachmentL(); |
|
260 } |
|
261 break; |
|
262 case EStateSendMessage: |
|
263 { |
|
264 SendMessage(); |
|
265 } |
|
266 break; |
|
267 case EStateFinalize: |
|
268 { |
|
269 TSendAsProgress progress; |
|
270 iSendAsMessage.ProgressL( progress ); |
|
271 |
|
272 if ( progress.iError == KErrNone ) |
|
273 { |
|
274 FinalizeL(); |
|
275 } |
|
276 else |
|
277 { |
|
278 iState = EStateReady; |
|
279 CompleteSelf(); |
|
280 } |
|
281 } |
|
282 break; |
|
283 case EStateReady: |
|
284 { |
|
285 iCallback->MessagesReady(); |
|
286 Reset(); |
|
287 iState = EStateIdle; |
|
288 } |
|
289 break; |
|
290 default: |
|
291 { |
|
292 // Should never end up here. |
|
293 } |
|
294 break; |
|
295 } |
|
296 } |
|
297 } |
|
298 |
|
299 // ----------------------------------------------------------------------------- |
|
300 // CMDUCreateAndSend::DoCancel |
|
301 // |
|
302 // (other items were commented in a header). |
|
303 // ----------------------------------------------------------------------------- |
|
304 // |
|
305 void CMDUCreateAndSend::DoCancel() |
|
306 { |
|
307 if ( iCompressor ) |
|
308 { |
|
309 iCompressor->Cancel(); |
|
310 } |
|
311 iSendAsMessage.Cancel(); |
|
312 iMessageCreated = EFalse; |
|
313 } |
|
314 |
|
315 // ----------------------------------------------------------------------------- |
|
316 // CMDUCreateAndSend::RunError |
|
317 // |
|
318 // (other items were commented in a header). |
|
319 // ----------------------------------------------------------------------------- |
|
320 // |
|
321 TInt CMDUCreateAndSend::RunError( TInt aError ) |
|
322 { |
|
323 iError = aError; |
|
324 Reset(); |
|
325 iCallback->MessagesReady(); |
|
326 return KErrNone; |
|
327 } |
|
328 |
|
329 // --------------------------------------------------------- |
|
330 // CMDUCreateAndSend::CompleteSelf |
|
331 // |
|
332 // (other items were commented in a header). |
|
333 // --------------------------------------------------------- |
|
334 // |
|
335 void CMDUCreateAndSend::CompleteSelf() |
|
336 { |
|
337 iStatus = KRequestPending; |
|
338 TRequestStatus* pStatus = &iStatus; |
|
339 SetActive(); |
|
340 User::RequestComplete( pStatus, KErrNone ); |
|
341 } |
|
342 |
|
343 // ----------------------------------------------------------------------------- |
|
344 // CMDUCreateAndSend::Reset |
|
345 // |
|
346 // (other items were commented in a header). |
|
347 // ----------------------------------------------------------------------------- |
|
348 // |
|
349 void CMDUCreateAndSend::Reset() |
|
350 { |
|
351 iMessageCount = 0; |
|
352 |
|
353 delete iCompressor; |
|
354 iCompressor = NULL; |
|
355 |
|
356 delete iToAddress; |
|
357 iToAddress = NULL; |
|
358 |
|
359 delete iToAlias; |
|
360 iToAlias = NULL; |
|
361 |
|
362 if ( iMessageCreated ) |
|
363 { |
|
364 iSendAsMessage.Close(); |
|
365 iMessageCreated = EFalse; |
|
366 } |
|
367 |
|
368 if( iProgressDialog ) |
|
369 { |
|
370 // Progress note showing, try to dismiss it |
|
371 TRAP_IGNORE( iProgressDialog->ProcessFinishedL() ); |
|
372 |
|
373 // If the ProcessFinishedL() leaves, force the dialog away with delete |
|
374 delete iProgressDialog; |
|
375 iProgressDialog = NULL; |
|
376 } |
|
377 |
|
378 if ( iImageCompressed ) |
|
379 { |
|
380 iCompressedImage.Close(); |
|
381 // Delete the temporary file from RAM |
|
382 iFs.Delete( iCompressedImagePath ); |
|
383 iImageCompressed = EFalse; |
|
384 } |
|
385 } |
|
386 |
|
387 // ----------------------------------------------------------------------------- |
|
388 // CMDUCreateAndSend::CreateMessageAndSetDataL |
|
389 // Starts message entry creation. |
|
390 // (other items were commented in a header). |
|
391 // ----------------------------------------------------------------------------- |
|
392 // |
|
393 void CMDUCreateAndSend::CreateMessageAndSetDataL() |
|
394 { |
|
395 iStatus = KRequestPending; |
|
396 |
|
397 iSendAsMessage.CreateL( iSendAsSession, KSenduiMtmMmsUid ); |
|
398 iMessageCreated = ETrue; |
|
399 |
|
400 iSendAsMessage.SetBioTypeL( KUidMsgSubTypeMmsUpload ); |
|
401 |
|
402 iSendAsMessage.AddRecipientL( |
|
403 *iToAddress, |
|
404 *iToAlias, |
|
405 RSendAsMessage::ESendAsRecipientTo ); |
|
406 |
|
407 // Set file name as subject. |
|
408 TFileName fileName; |
|
409 CSendUiAttachment& attachment = *(iAttachments->At(iMessageCount)); |
|
410 attachment.Handle()->Name( fileName ); |
|
411 |
|
412 iSendAsMessage.SetSubjectL( fileName ); |
|
413 |
|
414 iState = EStateImageCompression; |
|
415 CompleteSelf(); |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------- |
|
419 // CMDUCreateAndSend::IsCompressionNeededL |
|
420 // Checks if file is oversized JPEG image. |
|
421 // Returns ETrue if image should be compressed. |
|
422 // (other items were commented in a header). |
|
423 // --------------------------------------------------------- |
|
424 // |
|
425 TBool CMDUCreateAndSend::IsCompressionNeededL() |
|
426 { |
|
427 iImageCompressed = EFalse; |
|
428 iAttachmentSize = 0; |
|
429 |
|
430 CSendUiAttachment& attachment = (*iAttachments->At(iMessageCount)); |
|
431 |
|
432 // Get file size and type. |
|
433 iAttachmentSize = attachment.Size(); |
|
434 if ( iAttachmentSize > iMaxMsgSize && |
|
435 attachment.MimeType().CompareF( KMsgMimeImageJpeg ) == 0 ) |
|
436 { |
|
437 return ETrue; |
|
438 } |
|
439 return EFalse; |
|
440 } |
|
441 |
|
442 // --------------------------------------------------------- |
|
443 // CMDUCreateAndSend::CompressImageL |
|
444 // Compress oversized JPEG image. |
|
445 // (other items were commented in a header). |
|
446 // --------------------------------------------------------- |
|
447 // |
|
448 void CMDUCreateAndSend::CompressImageL() |
|
449 { |
|
450 TInt targetSize = iMaxMsgSize - KTenKiloBytes; |
|
451 RFile sourceFile = *(*iAttachments->At(iMessageCount)).Handle(); |
|
452 CreateTempFileL( sourceFile, iCompressedImage ); |
|
453 |
|
454 TSize targetDimensions( KImageTargetWidth, KImageTargetHeight ); |
|
455 if ( !iCompressor ) |
|
456 { |
|
457 iCompressor = new ( ELeave ) CUniImageProcessor( this ); |
|
458 } |
|
459 iCompressor->ProcessImageL( |
|
460 sourceFile, |
|
461 iCompressedImage, |
|
462 targetDimensions, |
|
463 KMsgMimeImageJpeg, |
|
464 ETrue, |
|
465 targetSize ); |
|
466 } |
|
467 |
|
468 // --------------------------------------------------------- |
|
469 // CMDUCreateAndSend::AddAttachment |
|
470 // Add attachment to message. |
|
471 // (other items were commented in a header). |
|
472 // --------------------------------------------------------- |
|
473 // |
|
474 void CMDUCreateAndSend::AddAttachmentL() |
|
475 { |
|
476 CSendUiAttachment& attachmentPacket = *(iAttachments->At(iMessageCount)); |
|
477 if ( iAttachmentSize > 0 && iAttachmentSize < iMaxMsgSize ) |
|
478 { |
|
479 if ( iImageCompressed ) |
|
480 { |
|
481 iSendAsMessage.AddAttachment( |
|
482 iCompressedImage, |
|
483 iStatus ); |
|
484 } |
|
485 else |
|
486 { |
|
487 RFile attachment; |
|
488 attachment.Duplicate( *attachmentPacket.Handle()); |
|
489 iSendAsMessage.AddAttachment( |
|
490 attachment, |
|
491 iStatus ); |
|
492 } |
|
493 iState = EStateSendMessage; |
|
494 SetActive(); |
|
495 } |
|
496 else |
|
497 { |
|
498 // file could not be fit into the message |
|
499 FinalizeL(); |
|
500 } |
|
501 |
|
502 |
|
503 } |
|
504 |
|
505 // --------------------------------------------------------- |
|
506 // CMDUCreateAndSend::SendMessage |
|
507 // Sends message. |
|
508 // (other items were commented in a header). |
|
509 // --------------------------------------------------------- |
|
510 // |
|
511 void CMDUCreateAndSend::SendMessage() |
|
512 { |
|
513 iSendAsMessage.SendMessage( iStatus ); |
|
514 iState = EStateFinalize; |
|
515 SetActive(); |
|
516 } |
|
517 |
|
518 // --------------------------------------------------------- |
|
519 // CMDUCreateAndSend::FinalizeL |
|
520 // Updates progress bar. |
|
521 // (other items were commented in a header). |
|
522 // --------------------------------------------------------- |
|
523 // |
|
524 void CMDUCreateAndSend::FinalizeL() |
|
525 { |
|
526 iMessageCount++; |
|
527 |
|
528 iSendAsMessage.Close(); |
|
529 iMessageCreated = EFalse; |
|
530 |
|
531 // Update progress note text |
|
532 if ( iMessageCount < iAttachments->Count() ) |
|
533 { |
|
534 // Delete the temporary file from RAM |
|
535 if ( iImageCompressed ) |
|
536 { |
|
537 iCompressedImage.Close(); |
|
538 iFs.Delete( iCompressedImagePath ); |
|
539 iImageCompressed = EFalse; |
|
540 } |
|
541 UpdateProgressTextL( iAttachments->Count() ); |
|
542 iState = EStateCreateMessage; |
|
543 } |
|
544 else |
|
545 { |
|
546 iProgressDialog->ProcessFinishedL(); |
|
547 iState = EStateReady; |
|
548 } |
|
549 |
|
550 CompleteSelf(); |
|
551 } |
|
552 |
|
553 // --------------------------------------------------------- |
|
554 // CMDUCreateAndSend::CreateTempFileL |
|
555 // Creates temp file to EDefaultRam:\system\temp\mmsupload. Original filename is used. |
|
556 // Note: handle to created file is left open. |
|
557 // (other items were commented in a header). |
|
558 // --------------------------------------------------------- |
|
559 // |
|
560 void CMDUCreateAndSend::CreateTempFileL( |
|
561 RFile& aSourceFile, |
|
562 RFile& aTargetFile ) |
|
563 { |
|
564 // Construct target path |
|
565 TInt drive; |
|
566 #ifdef RD_MULTIPLE_DRIVE |
|
567 User::LeaveIfError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, drive ) ); |
|
568 #else |
|
569 drive = EDriveD; |
|
570 #endif |
|
571 |
|
572 iCompressedImagePath.Zero(); |
|
573 TChar driveLetter = TChar('A'); |
|
574 driveLetter += drive ; |
|
575 iCompressedImagePath.Append( driveLetter ); |
|
576 iCompressedImagePath.Append( KTempFilePath ); |
|
577 |
|
578 // Create temp directory if needed |
|
579 TInt err = iFs.MkDirAll( iCompressedImagePath ); |
|
580 |
|
581 if ( err != KErrNone && err != KErrAlreadyExists ) |
|
582 { |
|
583 User::Leave( err ); |
|
584 } |
|
585 |
|
586 TFileName sourceName; |
|
587 aSourceFile.Name( sourceName ); |
|
588 |
|
589 iCompressedImagePath.Append( sourceName ); |
|
590 |
|
591 // Create and open new file |
|
592 User::LeaveIfError( aTargetFile.Replace( |
|
593 iFs, |
|
594 iCompressedImagePath, |
|
595 EFileWrite | EFileShareAny ) ); |
|
596 } |
|
597 |
|
598 // --------------------------------------------------------- |
|
599 // CMDUCreateAndSend::CreateProgressNoteL |
|
600 // Creates progress bar. |
|
601 // (other items were commented in a header). |
|
602 // --------------------------------------------------------- |
|
603 // |
|
604 void CMDUCreateAndSend::CreateProgressNoteL( TInt aFinalValue ) |
|
605 { |
|
606 iProgressDialog = new (ELeave) CAknProgressDialog( |
|
607 reinterpret_cast< CEikDialog** > (&iProgressDialog) ); |
|
608 |
|
609 iProgressDialog->PrepareLC( R_MMS_DIRECT_UPLOAD_PROGRESS_NOTE ); |
|
610 iProgressDialog->SetTone( CAknNoteDialog::ENoTone ); |
|
611 iProgressInfo = iProgressDialog->GetProgressInfoL(); |
|
612 iProgressInfo->SetFinalValue( aFinalValue ); |
|
613 |
|
614 iProgressCount = 1; |
|
615 UpdateProgressTextL( aFinalValue ); |
|
616 |
|
617 // Register for cancel event and execute the note |
|
618 iProgressDialog->SetCallback( this ); |
|
619 iProgressDialog->RunLD(); |
|
620 } |
|
621 |
|
622 // --------------------------------------------------------- |
|
623 // CMDUCreateAndSend::UpdateProgressTextL |
|
624 // Updates progress bar text. |
|
625 // (other items were commented in a header). |
|
626 // --------------------------------------------------------- |
|
627 // |
|
628 void CMDUCreateAndSend::UpdateProgressTextL( TInt aFinalValue ) |
|
629 { |
|
630 CArrayFixFlat< TInt >* numbers = new( ELeave ) CArrayFixFlat< TInt > (2); |
|
631 CleanupStack::PushL( numbers ); |
|
632 |
|
633 numbers->AppendL( iProgressCount ); |
|
634 numbers->AppendL( aFinalValue ); |
|
635 |
|
636 HBufC* progressText = StringLoader::LoadLC( |
|
637 R_MMS_DIRECT_UPLOAD_PROGRESS, *numbers, &iCoeEnv ); |
|
638 |
|
639 if ( iProgressDialog ) |
|
640 { |
|
641 iProgressDialog->SetTextL( *progressText ); |
|
642 iProgressInfo->IncrementAndDraw( KProgressIncrement ); |
|
643 iProgressCount++; |
|
644 } |
|
645 |
|
646 CleanupStack::PopAndDestroy( 2, numbers ); // progressText, numbers |
|
647 } |
|
648 |
|
649 // --------------------------------------------------------- |
|
650 // CMDUCreateAndSend::DialogDismissedL |
|
651 // Callback method for progress dialog to inform us when dialog is dismissed. |
|
652 // This function is called when cancel button of the progress bar was pressed. |
|
653 // (other items were commented in a header). |
|
654 // --------------------------------------------------------- |
|
655 // |
|
656 void CMDUCreateAndSend::DialogDismissedL( TInt aButtonId ) |
|
657 { |
|
658 // Check if cancel button was pressed. |
|
659 if ( aButtonId == EAknSoftkeyCancel ) |
|
660 { |
|
661 DoCancel(); |
|
662 |
|
663 iState = EStateReady; |
|
664 } |
|
665 } |
|
666 |
|
667 // ----------------------------------------------------------------------------- |
|
668 // CMDUCreateAndSend::CheckMmsServiceAvailabilityL |
|
669 // Checks that MMS service is available. |
|
670 // (other items were commented in a header). |
|
671 // ----------------------------------------------------------------------------- |
|
672 // |
|
673 TBool CMDUCreateAndSend::CheckMmsServiceAvailabilityL() |
|
674 { |
|
675 CBaseMtm* mtm = iSingleton.ClientMtmRegistryL().NewMtmL( KSenduiMtmMmsUid ); |
|
676 CleanupStack::PushL( mtm ); |
|
677 |
|
678 CBaseMtmUi* mtmUi = iSingleton.MtmUiRegistryL().NewMtmUiL( *mtm ); |
|
679 CleanupStack::PushL( mtmUi ); |
|
680 |
|
681 TPckgBuf<TBool> paramPack( ETrue ); |
|
682 |
|
683 // This is not actually used. |
|
684 CMsvEntrySelection* dummySelection = new ( ELeave ) CMsvEntrySelection; |
|
685 CleanupStack::PushL( dummySelection ); |
|
686 |
|
687 mtmUi->InvokeSyncFunctionL( KMtmUiFunctionValidateService, |
|
688 *dummySelection, |
|
689 paramPack ); |
|
690 |
|
691 CleanupStack::PopAndDestroy( 3, mtm ); |
|
692 return ( KErrNone == paramPack() ); |
|
693 } |
|
694 |
|
695 |
|
696 // --------------------------------------------------------- |
|
697 // CMDUCreateAndSend::ImageProcessingReady |
|
698 // Callback function called when compression is ready. |
|
699 // (other items were commented in a header). |
|
700 // --------------------------------------------------------- |
|
701 // |
|
702 void CMDUCreateAndSend::ImageProcessingReady( TSize /*aBitmapSize*/, TInt aFileSize, TBool /*aCompressed*/ ) |
|
703 { |
|
704 iAttachmentSize = aFileSize; |
|
705 |
|
706 TInt error = iCompressor->Error(); |
|
707 |
|
708 if ( error == KErrNone ) |
|
709 { |
|
710 iCompressionOk++; |
|
711 iState = EStateAddAttachment; |
|
712 } |
|
713 else |
|
714 { |
|
715 iCompressionFail++; |
|
716 iState = EStateFinalize; |
|
717 } |
|
718 |
|
719 iImageCompressed = ETrue; |
|
720 |
|
721 CompleteSelf(); |
|
722 } |
|
723 |
|
724 // End of File |
|
725 |