|
1 // Copyright (c) 2005-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 "csendastesteditutils.h" |
|
17 #include "csendastestedittimer.h" |
|
18 |
|
19 #include <ecom/implementationproxy.h> |
|
20 #include <msvids.h> |
|
21 |
|
22 // local constants |
|
23 const TInt KSendAsTestEditWaitTime = 5000000; // time in ms |
|
24 |
|
25 const TImplementationProxy ImplementationTable[] = |
|
26 { |
|
27 IMPLEMENTATION_PROXY_ENTRY(0x1020D464, CSendAsTestEditUtils::NewL) |
|
28 }; |
|
29 |
|
30 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
31 { |
|
32 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
33 |
|
34 return ImplementationTable; |
|
35 } |
|
36 |
|
37 |
|
38 CSendAsTestEditUtils* CSendAsTestEditUtils::NewL() |
|
39 { |
|
40 CSendAsTestEditUtils* self=new (ELeave) CSendAsTestEditUtils(); |
|
41 CleanupStack::PushL(self); |
|
42 self->ConstructL(); |
|
43 CleanupStack::Pop(self); |
|
44 return self; |
|
45 } |
|
46 |
|
47 CSendAsTestEditUtils::CSendAsTestEditUtils() |
|
48 : CSendAsEditUtils() |
|
49 { |
|
50 } |
|
51 |
|
52 CSendAsTestEditUtils::~CSendAsTestEditUtils() |
|
53 { |
|
54 delete iEditTimer; |
|
55 } |
|
56 |
|
57 void CSendAsTestEditUtils::ConstructL() |
|
58 { |
|
59 iEditTimer = CSendAsTestEditTimer::NewL(*this); |
|
60 } |
|
61 |
|
62 // methods from CSendAsEditUtils |
|
63 void CSendAsTestEditUtils::LaunchEditorL(TMsvId /*aId*/, TRequestStatus& aStatus) |
|
64 { |
|
65 |
|
66 CDummyObserver* ob1 = new(ELeave) CDummyObserver; |
|
67 CleanupStack::PushL(ob1); |
|
68 |
|
69 CMsvSession* session = CMsvSession::OpenSyncL(*ob1); |
|
70 CleanupStack::PushL(session); |
|
71 |
|
72 CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, |
|
73 TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue)); |
|
74 CleanupStack::PushL(cEntry); |
|
75 |
|
76 CMsvEntrySelection* selection = cEntry->ChildrenL(); |
|
77 CleanupStack::PushL(selection); |
|
78 |
|
79 CMsvEntry* cEntry2 = session->GetEntryL(selection->At(0)); |
|
80 CleanupStack::PushL(cEntry2); |
|
81 |
|
82 TMsvEntry entry = cEntry2->Entry(); |
|
83 entry.SetMtmData3(234567890); // Show we've been called by touching the TMsvEntry. |
|
84 cEntry2->ChangeL(entry); |
|
85 |
|
86 CleanupStack::PopAndDestroy(5, ob1); // cEntry2, selection, cEntry, session, ob1 |
|
87 |
|
88 iUserStatus = &aStatus; |
|
89 aStatus = KRequestPending; |
|
90 // wait a few seconds before completing |
|
91 iEditTimer->After(KSendAsTestEditWaitTime); |
|
92 } |
|
93 |
|
94 void CSendAsTestEditUtils::LaunchEditorAndWaitL(TMsvId /*aId*/) |
|
95 { |
|
96 } |
|
97 |
|
98 void CSendAsTestEditUtils::Cancel() |
|
99 { |
|
100 iEditTimer->Cancel(); |
|
101 } |
|
102 |
|
103 void CSendAsTestEditUtils::TimerDone() |
|
104 { |
|
105 // complete the request (simulates editor closing) |
|
106 User::RequestComplete(iUserStatus, KErrNone); |
|
107 } |
|
108 |