author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2009 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 the License "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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
#include <e32base.h> |
|
21 |
////#include <senduiconsts.h> |
|
22 |
#include "messagingservice.h" |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
23 |
#include <badesca.h> |
19 | 24 |
#include "getheader.h" |
25 |
#include <f32file.h> |
|
26 |
#include "messageheader.h" |
|
27 |
#ifdef MAIN |
|
28 |
#define getheadermms_test2 main |
|
29 |
#endif |
|
30 |
||
31 |
int getheadermms_test2(int, char**) |
|
32 |
{ |
|
33 |
||
34 |
__UHEAP_MARK; |
|
35 |
CMessagingService* test = (CMessagingService* ) CMessagingService::NewL() ; |
|
36 |
CleanupStack::PushL(test); |
|
37 |
||
38 |
CFilterParamInfo* filterParams = CFilterParamInfo::NewL(); |
|
39 |
CleanupStack::PushL(filterParams); |
|
40 |
||
41 |
_LIT(Kaddr1, "9008032761"); |
|
42 |
filterParams->AddFromL(Kaddr1); |
|
43 |
||
44 |
filterParams->SetSortType(EMsvSortByDate); |
|
45 |
||
46 |
filterParams->AddMtmL(_L("MMS")); |
|
47 |
||
48 |
_LIT(KSubject, "MMS Subject"); |
|
49 |
filterParams->SetSubjectL(KSubject); |
|
50 |
||
51 |
TDateTime start(2007,EMarch,22,0,0,0,0); |
|
52 |
TInt startyear = start.Year(); |
|
53 |
TInt startmonth = start.Month(); |
|
54 |
TInt startday = start.Day(); |
|
55 |
||
56 |
TTime startdate(start); |
|
57 |
||
58 |
filterParams->SetStartDateFilter(startdate); |
|
59 |
||
60 |
TDateTime end(2007,EJune,23,0,0,0,0); |
|
61 |
TInt endyear = end.Year(); |
|
62 |
TInt endmonth = end.Month(); |
|
63 |
TInt endday = end.Day(); |
|
64 |
||
65 |
||
66 |
TTime enddate(end) ; |
|
67 |
||
68 |
filterParams->SetEndDate(enddate); |
|
69 |
||
70 |
||
71 |
CMsvEntrySelection* entryselection = NULL ; |
|
72 |
||
73 |
||
74 |
||
75 |
TRAPD(errcode, test->GetIdListL(filterParams,0,NULL,entryselection)); |
|
76 |
||
77 |
if(errcode != KErrNone) |
|
78 |
return errcode; |
|
79 |
||
80 |
||
81 |
if(entryselection) |
|
82 |
CleanupStack::PushL(entryselection); |
|
83 |
||
84 |
||
85 |
||
86 |
TInt index = 0; |
|
87 |
TInt val = 0; |
|
88 |
TInt iter=0; |
|
89 |
for(;;) |
|
90 |
{ |
|
91 |
CMessageHeader* header = NULL; |
|
92 |
test->GetNextHeaderL(filterParams, entryselection, index, NULL, header); |
|
93 |
if(header) |
|
94 |
{ |
|
95 |
iter++; |
|
96 |
TTime temp = header->Time(); |
|
97 |
||
98 |
if((header->Mtm().FindF(_L("MMS")) != KErrNotFound ) && (header->From().FindF(_L("9008032761")) != KErrNotFound ) |
|
99 |
&& (header->Subject().FindF(_L("MMS Subject")) != KErrNotFound) && (startdate <= temp && temp <= enddate ) ) |
|
100 |
val++; |
|
101 |
||
102 |
delete header; |
|
103 |
} |
|
104 |
else |
|
105 |
break; |
|
106 |
||
107 |
} |
|
108 |
||
109 |
||
110 |
||
111 |
if(entryselection) |
|
112 |
CleanupStack::PopAndDestroy(entryselection); |
|
113 |
||
114 |
CleanupStack::PopAndDestroy(filterParams); |
|
115 |
CleanupStack::PopAndDestroy(test); |
|
116 |
__UHEAP_MARKEND; |
|
117 |
||
118 |
if(iter == val) |
|
119 |
return KErrNone; |
|
120 |
else |
|
121 |
return KErrGeneral; |
|
122 |
||
123 |
||
124 |
||
125 |
} |