pimprotocols/pbap/inc/pbapchexporter.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 // Copyright (c) 2006-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 #ifndef PBAPCHEXPORTER_H
       
    17 #define PBAPCHEXPORTER_H
       
    18 
       
    19 #include <e32base.h>
       
    20 #include "pbapoperation.h"
       
    21 #include "pbaprequest.h"
       
    22 #include "pbapexporter.h"
       
    23 #include "pbapchview.h"
       
    24 
       
    25 // forward declarations
       
    26 class CLogEvent;
       
    27 class CLogFilter;
       
    28 class CLogFilterList;
       
    29 class CPbapLogViewEvent;
       
    30 class CPbapExporterBase;
       
    31 
       
    32 
       
    33 class CPbapChExporter : public CPbapExporterBase
       
    34 	{
       
    35 public:
       
    36 	~CPbapChExporter();
       
    37 
       
    38 protected:
       
    39 	CPbapChExporter(MVirtualFolderClient& aClient, 
       
    40 					MPbapExporterCallback& aCallback,
       
    41 					CPbapChView& aViewToExport,
       
    42 					CPbapChView* aReadViewToExport = NULL, 
       
    43 					TUint aStartIndex = 0,
       
    44 					TInt aCount = 0);
       
    45 	void ConstructL();
       
    46 	
       
    47 	/** Notify that call history events are about to be fetched from the log
       
    48 	@param aNumberOfEvents number of log events which will be fetched
       
    49 	@return EFalse to abort reading*/
       
    50 	virtual TBool PrepareForFetchingL(TUint aNumberOfEvents);
       
    51 	
       
    52 	/** successfully fetched another call history event from the log
       
    53 	@return EFalse if no more events should be fetched */
       
    54 	virtual TBool EventFetchedL(const CLogEvent& aEvent, TInt aEventIndex) =0;
       
    55 	
       
    56 	/** Notify that fetching of call history events has completed*/
       
    57 	virtual void FetchingCompleteL() =0;
       
    58 		
       
    59 private: // from CActive
       
    60 	void RunL();
       
    61 	void DoCancel();
       
    62 	TInt RunError(TInt aError);
       
    63 
       
    64 private:
       
    65 	void StartExportL();
       
    66 	void FetchLogEventsL();
       
    67 	void FinaliseFetchLogEventsL();
       
    68 
       
    69 private:
       
    70 	enum TState
       
    71 		{
       
    72 		EIdle,
       
    73 		EStartExport,
       
    74 		EFetchingLogEvents
       
    75 		};
       
    76 		
       
    77 private:	
       
    78 	CPbapLogViewEvent* iLogView;
       
    79 	CPbapLogViewEvent* iReadEventView;
       
    80 	
       
    81 	TInt iCurrentEventIndex;
       
    82 	
       
    83 	TState iState;
       
    84 	
       
    85 protected:
       
    86 	TUint iStartIndex;
       
    87 	TInt iCount;
       
    88 	};
       
    89 
       
    90 
       
    91 class CPbapChListingExporter : public CPbapChExporter
       
    92 	{
       
    93 public:
       
    94 	static CPbapChListingExporter* NewL(MVirtualFolderClient& aClient, 
       
    95 										MPbapExporterCallback& aCallback, 
       
    96 										CPbapChView& aViewToExport,
       
    97 										CPbapChView* aReadViewToExport,
       
    98 										TUint aStartIndex, 
       
    99 										TInt aCount);
       
   100 
       
   101 protected:
       
   102 	// from CPbapChExporter
       
   103 	virtual TBool PrepareForFetchingL(TUint aNumberOfEvents);
       
   104 	virtual TBool EventFetchedL(const CLogEvent& aEvent, TInt aEventIndex);
       
   105 	virtual void FetchingCompleteL();
       
   106 
       
   107 private:
       
   108 	CPbapChListingExporter(MVirtualFolderClient& aClient, 
       
   109 						MPbapExporterCallback& aCallback, 
       
   110 						CPbapChView& aViewToExport,
       
   111 						CPbapChView* aReadViewToExport,
       
   112 						TUint aStartIndex, 
       
   113 						TInt aCount);
       
   114 	};
       
   115 
       
   116 
       
   117 class CPbapChItemExporter : public CPbapChExporter
       
   118 	{
       
   119 public:
       
   120 	static CPbapChItemExporter* NewL(MVirtualFolderClient& aClient, 
       
   121 									MPbapExporterCallback& aCallback, 
       
   122 									CPbapChView& aViewToExport,
       
   123 									CPbapChView* aReadViewToExport,
       
   124 									TUint aStartIndex, 
       
   125 									TInt aCount, 
       
   126 									TVCardVersion aFormat, 
       
   127 									TUint64 aFilter);
       
   128 
       
   129 protected:
       
   130 	// from CPbapChExporter
       
   131 	virtual TBool EventFetchedL(const CLogEvent& aEvent, TInt aEventIndex);
       
   132 	virtual void FetchingCompleteL();
       
   133 
       
   134 private:
       
   135 	CPbapChItemExporter(MVirtualFolderClient& aClient, 
       
   136 						MPbapExporterCallback& aCallback, 
       
   137 						CPbapChView& aViewToExport,
       
   138 						CPbapChView* aReadViewToExport,
       
   139 						TUint aStartIndex, 
       
   140 						TInt aCount, 
       
   141 						TVCardVersion aFormat, 
       
   142 						TUint64 aFilter);
       
   143 
       
   144 private:
       
   145 	TVCardVersion iFormat;
       
   146 	TUint64 iFilter;
       
   147 	};
       
   148 
       
   149 
       
   150 class CPbapChSingleItemExporter : public CPbapChExporter
       
   151 	{
       
   152 public:
       
   153 	static CPbapChSingleItemExporter* NewL(MVirtualFolderClient& aClient,
       
   154 										   MPbapExporterCallback& aCallback,
       
   155 										   CPbapChView& aViewToExport,
       
   156 										   TInt aIndex,
       
   157 										   TVCardVersion aFormat,
       
   158 										   TUint64 aFilter);
       
   159 
       
   160 protected:
       
   161 	// from CPbapChExporter
       
   162 	virtual TBool PrepareForFetchingL(TUint aNumberOfEvents);
       
   163 	virtual TBool EventFetchedL(const CLogEvent& aEvent, TInt aEventIndex);
       
   164 	virtual void FetchingCompleteL();
       
   165 
       
   166 private:
       
   167 	CPbapChSingleItemExporter(MVirtualFolderClient& aClient,
       
   168 							  MPbapExporterCallback& aCallback,
       
   169 							  CPbapChView& aViewToExport,
       
   170 							  TInt aIndex,
       
   171 							  TVCardVersion aFormat,
       
   172 							  TUint64 aFilter);
       
   173 
       
   174 private:
       
   175 	TInt iIndex;
       
   176 	TVCardVersion iFormat;
       
   177 	TUint64 iFilter;
       
   178 	};
       
   179 
       
   180 	
       
   181 class CPbapChCountExporter : public CPbapChExporter
       
   182 	{
       
   183 public:
       
   184 	static CPbapChCountExporter* NewL(MVirtualFolderClient& aClient, 
       
   185 									MPbapExporterCallback& aCallback,
       
   186 									CPbapChView& aViewToExport,
       
   187 									CPbapChView* aReadViewToExport);
       
   188 									
       
   189 
       
   190 protected:
       
   191 	// from CPbapChExporter
       
   192 	virtual TBool PrepareForFetchingL(TUint aNumberOfEvents);
       
   193 	virtual TBool EventFetchedL(const CLogEvent& aEvent, TInt aEventIndex);
       
   194 	virtual void FetchingCompleteL();
       
   195 
       
   196 private:
       
   197 	CPbapChCountExporter(MVirtualFolderClient& aClient, 
       
   198 						MPbapExporterCallback& aCallback,
       
   199 						CPbapChView& aViewToExport,
       
   200 						CPbapChView* aReadViewToExport);
       
   201 	};
       
   202 
       
   203 #endif // PBAPCHEXPORTER_H