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