1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "csmssendmessageoperation.h" |
|
17 #include <smscmds.h> |
|
18 #include "SMUTSET.H" |
|
19 |
|
20 |
|
21 CSmsSendMessageOperation* CSmsSendMessageOperation::NewL(CMsvSession& aMsvSession, |
|
22 const CMsvEntrySelection& aSelection, |
|
23 const TDesC8& aParameter, |
|
24 TRequestStatus& aObserverRequestStatus) |
|
25 { |
|
26 CSmsSendMessageOperation* self = new(ELeave) CSmsSendMessageOperation(aMsvSession, aObserverRequestStatus); |
|
27 CleanupStack::PushL(self); |
|
28 self->ConstructL(aSelection, aParameter); |
|
29 CleanupStack::Pop(self); |
|
30 return self; |
|
31 } |
|
32 |
|
33 void CSmsSendMessageOperation::ConstructL(const CMsvEntrySelection& aSelection, const TDesC8& aParameter) |
|
34 { |
|
35 iOperation = iMsvSession.TransferCommandL(aSelection, ESmsMtmCommandScheduleCopy, (TDesC8&)aParameter, iStatus); |
|
36 // assigns iMtm, iService and sets active |
|
37 Start(iOperation); |
|
38 } |
|
39 |
|
40 CSmsSendMessageOperation::CSmsSendMessageOperation(CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus) : |
|
41 CMsvSendOperation(aMsvSession, aObserverRequestStatus) |
|
42 { |
|
43 } |
|
44 |
|
45 const TDesC8& CSmsSendMessageOperation::TranslateProgress(const TDesC8& aProgress) |
|
46 { |
|
47 TSmsProgressBuf& progress = (TSmsProgressBuf&) aProgress; |
|
48 |
|
49 // default progress |
|
50 iProgress().iProgressMax = 0; |
|
51 iProgress().iProgress = 0; |
|
52 |
|
53 // convert SMS progress into standard send progress |
|
54 switch (progress().iType) |
|
55 { |
|
56 case TSmsProgress::ESmsProgressTypeSending: |
|
57 case TSmsProgress::ESmsProgressTypeScheduling: |
|
58 iProgress().iProgressMax = progress().iMsgCount; |
|
59 iProgress().iProgress = progress().iMsgDone; |
|
60 iProgress().iState = ESendStateSending; |
|
61 break; |
|
62 default: |
|
63 iProgress().iState = ESendStateWaitingToSend; |
|
64 break; |
|
65 } |
|
66 // get error |
|
67 iProgress().iError = progress().iError; |
|
68 |
|
69 return iProgress; |
|
70 } |
|