examples/Messaging/SearchSortExample/searchsortexample.h

00001 /*
00002 Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008 � list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010 � this list of conditions and the following disclaimer in the documentation
00011 � and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013 � may be used to endorse or promote products derived from this software
00014 � without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description:� 
00028 */
00029 
00030 
00031 #ifndef SEARCHSORTEXAMPLE_H
00032 #define SEARCHSORTEXAMPLE_H
00033 
00034 #include <mtclreg.h>
00035 #include "pop3set.h"
00036 #include "popcmtm.h"
00037 #include <mtclbase.h>
00038 #include <e32std.h>
00039 
00040 #include <msvsearchsortquery.h>
00041 #include <msvsearchsortoperation.h>
00042 #include <msvstd.h>
00043 #include <msvids.h>
00044 #include <msvuids.h>
00045 #include <msvapi.h>
00046 
00047 #include <iapprefs.h>
00048 #include <cemailaccounts.h>
00049 
00050 #include <es_sock.h>
00051 #include <commdb.h>
00052 #include <cdbpreftable.h>
00053 #include <commdbconnpref.h>
00054 #include <commsdattypesv1_1.h>
00055 #include <commsdat.h>
00056 using namespace CommsDat;
00057 
00058 _LIT(LDD_NAME,"ECOMM");
00059 
00060 #if defined (__WINS__)
00061 _LIT(PDD_NAME,"ECDRV");
00062 #else
00063 _LIT(PDD_NAME,"ECUART1");
00064 #endif
00065 
00066 #define KMaxEntryCount 5
00067 #define KPortValue 110
00068 #define KSmtpPortValue 25
00069 #define KSize 100
00070 
00071 _LIT(KPopServer, "nokia.com");
00072 _LIT8(KPopPassword,"ban-User1");
00073 _LIT8(KPopLoginName,"ban-User1");
00074 _LIT(KTxtAccountName, "PopAccount");
00075 _LIT(KSmtpServerAddress, "nokia.com");
00076 _LIT(KEmailAlias, "Messaging example");
00077 
00078 _LIT(KSmtpEmailAddress, "[email protected]");
00079 
00080 _LIT8(KFrom1, "[email protected]");
00081 _LIT(KTo1, "[email protected]");
00082 _LIT(KSubject1, "SimpleEmail");
00083 
00084 _LIT(KBodyContents, "This is a very simple mail");
00085 
00086 _LIT8(KFrom2, "[email protected]");
00087 _LIT(KTo2, "[email protected]");
00088 _LIT(KSubject2, "FunEmail");
00089 
00090 _LIT8(KFrom3, "[email protected]");
00091 _LIT(KTo3, "[email protected]");
00092 _LIT(KSubject3, "SimpleEmail");
00093 
00094 _LIT8(KFrom4, "[email protected]");
00095 _LIT(KTo4, "[email protected]");
00096 _LIT(KSubject4, "TestingMail");
00097 
00098 _LIT8(KFrom5, "[email protected]");
00099 _LIT(KTo5, "[email protected]");
00100 _LIT(KSubject5, "GoodEmail");
00101 
00102 _LIT(KSubjectSearch,"GoodEmail");
00103 
00104 _LIT(KFormat1,"%D%M%Y%/0%1%/1%2%/2%3%/3");
00105 _LIT(KFormat2,"%-B%:0%J%:1%T%:3%+B");
00106 _LIT(KUserPanic,"Failed to complete");
00107 
00112 typedef struct TQueryTable
00113         {
00114         TInt iQueryId;
00115         TMsvSearchSortResultType iResultType;
00116         }TQueryTable;
00117 
00118 
00122 typedef struct TResultSummary
00123         {
00124         TBuf<30> iToText;
00125         TBuf<30> iSubjectText;
00126         TBuf<30> iDatestring;
00127         TBuf<30> iTimestring;
00128         TInt iSize;
00129         }TResultSummary;
00130 
00135 class CSearchsortExample : public  CBase,public MMsvSessionObserver
00136         {
00137 public:
00138         static CSearchsortExample* NewL();
00139 
00140         // Destructor.
00141         ~CSearchsortExample();
00142 
00143         // Creating client registry.
00144         void CreateClientRegistryL();
00145 
00146         //Creating pop and Smtp accounts and doing various server settings.
00147         void CreatePopAndSmtpAccountL();
00148 
00149         // Creating Smtp messages.
00150         void CreateSmtpMessageL(TInt aindex,TDes& aFrominfo,TDes& aToinfo,TDes& aSubjectinfo);
00151 
00152         // Function for search-sort using non-iterative mechanism.
00153         void SearchSortRequestWithoutIteratorL(TDes& aSender,TBool aCaseSensitivity,TBool aWholeWordSearch,TBool aCombinedSearch,TInt& aResultCount);
00154 
00155         // Function for search-sort using iterative mechanism.
00156         void SearchSortRequestWithIteratorL(TInt& aResultCount);
00157 
00158         // Function for search-sort by QueryID.
00159         void SearchSortRequestByQueryIdL(TInt& aResultCount);
00160 
00161         //  Overriden function of session event.
00162         void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
00163 
00164         //Function for Smtp message entries deletion.
00165         void DeleteSmtpMessageL(); 
00166         
00167         //Function for email account deletion.
00168         void DeleteAccountsL() ;
00169 private:
00170 
00171         // Constructor.
00172         CSearchsortExample();
00173 
00174         // 2nd phase construction.
00175         void ConstructL();
00176 public:
00177 
00178         //Array for storing the search result.
00179         RArray<TResultSummary> iTResultSummary;
00180 private:
00181 
00182         // Pointer to the Client-side MTM registry.
00183         CClientMtmRegistry* iClientRegistry;
00184         // Pointer to the channel of communication between a client thread and the Message Server thread.
00185         CMsvSession*            iSession;
00186         // ointer to the CBase MTM.
00187         CBaseMtm*                       iMtm;
00188         // ID of the entry to access.
00189         TMsvId                          iPopServiceId;
00190         // POP account Name.
00191         TPopAccount                     iPopAccount;
00192         // SMTP account Name.
00193         TSmtpAccount            iSmtpAccount;
00194         // Variable for storing the QueryID.
00195         TInt iQueryId;
00196         // Pointer to search sort operation.
00197         CMsvSearchSortOperation* iSearch;
00198 
00199         // TQueryTable member variable.
00200         TQueryTable iExampleTQueryTable;
00201         //Array for storing Query information.
00202         RArray<TQueryTable> iQueryIdTable;
00203         
00204         };
00205 
00206 #endif // SEARCHSORTEXAMPLE_H

Generated by  doxygen 1.6.2