00001 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 00002 // All rights reserved. 00003 // This component and the accompanying materials are made available 00004 // under the terms of "Eclipse Public License v1.0" 00005 // which accompanies this distribution, and is available 00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". 00007 // 00008 // Initial Contributors: 00009 // Nokia Corporation - initial contribution. 00010 // 00011 // Contributors: 00012 // 00013 // Description: 00014 // 00015 00016 #ifndef SEARCHSORTEXAMPLE_H 00017 #define SEARCHSORTEXAMPLE_H 00018 00019 #include <mtclreg.h> 00020 #include "pop3set.h" 00021 #include "popcmtm.h" 00022 #include <mtclbase.h> 00023 #include <e32std.h> 00024 00025 #include <msvsearchsortquery.h> 00026 #include <msvsearchsortoperation.h> 00027 #include <msvstd.h> 00028 #include <msvids.h> 00029 #include <msvuids.h> 00030 #include <msvapi.h> 00031 00032 #include <iapprefs.h> 00033 #include <cemailaccounts.h> 00034 00035 #include <es_sock.h> 00036 #include <commdb.h> 00037 #include <cdbpreftable.h> 00038 #include <commdbconnpref.h> 00039 #include <commsdattypesv1_1.h> 00040 #include <commsdat.h> 00041 using namespace CommsDat; 00042 00043 _LIT(LDD_NAME,"ECOMM"); 00044 00045 #if defined (__WINS__) 00046 _LIT(PDD_NAME,"ECDRV"); 00047 #else 00048 _LIT(PDD_NAME,"ECUART1"); 00049 #endif 00050 00051 #define KMaxEntryCount 5 00052 #define KPortValue 110 00053 #define KSmtpPortValue 25 00054 #define KSize 100 00055 00056 _LIT(KPopServer, "nokia.com"); 00057 _LIT8(KPopPassword,"ban-User1"); 00058 _LIT8(KPopLoginName,"ban-User1"); 00059 _LIT(KTxtAccountName, "PopAccount"); 00060 _LIT(KSmtpServerAddress, "nokia.com"); 00061 _LIT(KEmailAlias, "Messaging example"); 00062 00063 _LIT(KSmtpEmailAddress, "exampleUser1@nokia.com"); 00064 00065 _LIT8(KFrom1, "exampleUser0@nokia.com"); 00066 _LIT(KTo1, "exampleUser1@nokia.com"); 00067 _LIT(KSubject1, "SimpleEmail"); 00068 00069 _LIT(KBodyContents, "This is a very simple mail"); 00070 00071 _LIT8(KFrom2, "exampleUser2@nokia.com"); 00072 _LIT(KTo2, "exampleUser3@nokia.com"); 00073 _LIT(KSubject2, "FunEmail"); 00074 00075 _LIT8(KFrom3, "exampleUser4@nokia.com"); 00076 _LIT(KTo3, "exampleUser5@nokia.com"); 00077 _LIT(KSubject3, "SimpleEmail"); 00078 00079 _LIT8(KFrom4, "exampleUser6@nokia.com"); 00080 _LIT(KTo4, "exampleUser7@nokia.com"); 00081 _LIT(KSubject4, "TestingMail"); 00082 00083 _LIT8(KFrom5, "exampleUser8@nokia.com"); 00084 _LIT(KTo5, "exampleUser9@nokia.com"); 00085 _LIT(KSubject5, "GoodEmail"); 00086 00087 _LIT(KSubjectSearch,"GoodEmail"); 00088 00089 _LIT(KFormat1,"%D%M%Y%/0%1%/1%2%/2%3%/3"); 00090 _LIT(KFormat2,"%-B%:0%J%:1%T%:3%+B"); 00091 _LIT(KUserPanic,"Failed to complete"); 00092 00097 typedef struct TQueryTable 00098 { 00099 TInt iQueryId; 00100 TMsvSearchSortResultType iResultType; 00101 }TQueryTable; 00102 00103 00107 typedef struct TResultSummary 00108 { 00109 TBuf<30> iToText; 00110 TBuf<30> iSubjectText; 00111 TBuf<30> iDatestring; 00112 TBuf<30> iTimestring; 00113 TInt iSize; 00114 }TResultSummary; 00115 00120 class CSearchsortExample : public CBase,public MMsvSessionObserver 00121 { 00122 public: 00123 static CSearchsortExample* NewL(); 00124 00125 // Destructor. 00126 ~CSearchsortExample(); 00127 00128 // Creating client registry. 00129 void CreateClientRegistryL(); 00130 00131 //Creating pop and Smtp accounts and doing various server settings. 00132 void CreatePopAndSmtpAccountL(); 00133 00134 // Creating Smtp messages. 00135 void CreateSmtpMessageL(TInt aindex,TDes& aFrominfo,TDes& aToinfo,TDes& aSubjectinfo); 00136 00137 // Function for search-sort using non-iterative mechanism. 00138 void SearchSortRequestWithoutIteratorL(TDes& aSender,TBool aCaseSensitivity,TBool aWholeWordSearch,TBool aCombinedSearch,TInt& aResultCount); 00139 00140 // Function for search-sort using iterative mechanism. 00141 void SearchSortRequestWithIteratorL(TInt& aResultCount); 00142 00143 // Function for search-sort by QueryID. 00144 void SearchSortRequestByQueryIdL(TInt& aResultCount); 00145 00146 // Overriden function of session event. 00147 void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); 00148 00149 //Function for Smtp message entries deletion. 00150 void DeleteSmtpMessageL(); 00151 00152 //Function for email account deletion. 00153 void DeleteAccountsL() ; 00154 private: 00155 00156 // Constructor. 00157 CSearchsortExample(); 00158 00159 // 2nd phase construction. 00160 void ConstructL(); 00161 public: 00162 00163 //Array for storing the search result. 00164 RArray<TResultSummary> iTResultSummary; 00165 private: 00166 00167 // Pointer to the Client-side MTM registry. 00168 CClientMtmRegistry* iClientRegistry; 00169 // Pointer to the channel of communication between a client thread and the Message Server thread. 00170 CMsvSession* iSession; 00171 // ointer to the CBase MTM. 00172 CBaseMtm* iMtm; 00173 // ID of the entry to access. 00174 TMsvId iPopServiceId; 00175 // POP account Name. 00176 TPopAccount iPopAccount; 00177 // SMTP account Name. 00178 TSmtpAccount iSmtpAccount; 00179 // Variable for storing the QueryID. 00180 TInt iQueryId; 00181 // Pointer to search sort operation. 00182 CMsvSearchSortOperation* iSearch; 00183 00184 // TQueryTable member variable. 00185 TQueryTable iExampleTQueryTable; 00186 //Array for storing Query information. 00187 RArray<TQueryTable> iQueryIdTable; 00188 00189 }; 00190 00191 #endif // SEARCHSORTEXAMPLE_H
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.