phonebookui/Phonebook2/ServerApplication/inc/CPbk2PrepareSingleAssignPhase.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
child 85 38bb213f60ba
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookui/Phonebook2/ServerApplication/inc/CPbk2PrepareSingleAssignPhase.h	Wed Sep 01 12:29:52 2010 +0100
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Phonebook 2 server app prepare single assign phase.
+*
+*/
+
+
+#ifndef CPBK2PREPARESINGLEASSIGNPHASE_H
+#define CPBK2PREPARESINGLEASSIGNPHASE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <MPbk2ContactRelocatorObserver.h>
+#include <CPbk2ContactRelocator.h>
+#include <MPbk2KeyEventHandler.h>
+#include "MPbk2ServicePhase.h"
+
+// FORWARD DECLARATIONS
+class CVPbkContactLinkArray;
+class MPbk2ServicePhaseObserver;
+class MVPbkContactLinkArray;
+class MPbk2SelectFieldProperty;
+class MVPbkStoreContact;
+class CPbk2KeyEventDealer;
+class CEikonEnv;
+
+// CLASS DECLARATION
+
+/**
+ * Phonebook 2 server app prepare single assign phase.
+ * Responsible for preparing contact for assign.
+ */
+class CPbk2PrepareSingleAssignPhase :
+                public CActive,
+                public MPbk2ServicePhase,
+                private MPbk2ContactRelocatorObserver,
+                private MPbk2KeyEventHandler
+    {
+    public: // Construction
+
+        /**
+         * Creates a new instance of this class.
+         *
+         * @param aObserver             Observer.
+         * @param aStoreContact         Contact to operate with,
+         *                              ownership is taken.
+         * @param aSelectFieldProperty  Select field property.
+         * @param aSelectFieldResult    Result from the select field dialog.
+         * @param aFieldIndex           Index of the field to assign data to.
+         * @param aNoteFlags            Information note flags.
+         * @param aRelocationFlags      Relocation flags.
+         * @return  A new instance of this class.
+         */
+        static CPbk2PrepareSingleAssignPhase* NewL(
+                MPbk2ServicePhaseObserver& aObserver,
+                MVPbkStoreContact* aStoreContact,
+                MPbk2SelectFieldProperty* aSelectFieldProperty,
+                TInt aSelectFieldResult,
+                TInt& aFieldIndex,
+                TUint& aNoteFlags,
+                TUint aRelocationFlags );
+
+        /**
+         * Destructor.
+         */
+        ~CPbk2PrepareSingleAssignPhase();
+
+    public: // From MPbk2ServicePhase
+        void LaunchServicePhaseL();
+        void CancelServicePhase();
+        void RequestCancelL(
+                TInt aExitCommandId );
+        void AcceptDelayedL(
+                const TDesC8& aContactLinkBuffer );
+        void DenyDelayedL(
+                const TDesC8& aContactLinkBuffer );
+        MVPbkContactLinkArray* Results() const;
+        TInt ExtraResultData() const;
+        MVPbkStoreContact* TakeStoreContact();
+        HBufC* FieldContent() const;
+
+    private: // From CActive
+        void RunL();
+        void DoCancel();
+        TInt RunError(
+                TInt aError );
+
+    private: // From MPbk2ContactRelocatorObserver
+        void ContactRelocatedL(
+                MVPbkStoreContact* aRelocatedContact );
+        void ContactRelocationFailed(
+                TInt aReason,
+                MVPbkStoreContact* aContact );
+        void ContactsRelocationFailed(
+                TInt aReason,
+                CVPbkContactLinkArray* aContacts );
+        void RelocationProcessComplete();
+
+    private: // From MPbk2KeyEventHandler
+        TBool Pbk2ProcessKeyEventL(
+                const TKeyEvent& aKeyEvent,
+                TEventCode aType );
+
+    private: // Implementation
+        CPbk2PrepareSingleAssignPhase(
+                MPbk2ServicePhaseObserver& aObserver,
+                MVPbkStoreContact* aStoreContact,
+                MPbk2SelectFieldProperty* aSelectFieldProperty,
+                TInt aSelectFieldResult,
+                TInt& aFieldIndex,
+                TUint& aNoteFlags,
+                TUint aRelocationFlags );
+        void ConstructL();
+        TBool RelocateContactL(
+                Pbk2ContactRelocator::TPbk2ContactRelocationQueryPolicy aPolicy,
+                TBool& aThisDestroyed );
+        TInt QueryForDataReplaceL();
+        TInt QueryForRelocationL();
+        void PrepareForAssignL();
+        TBool IsContactFromPhoneMemoryL(
+                const MVPbkStoreContact& aStoreContact );
+        void AppendResultL(
+                const MVPbkStoreContact* aStoreContact );
+        void IssueRequest();
+
+    private: // Data
+        /// Ref: Observer
+        MPbk2ServicePhaseObserver& iObserver;
+        /// Own: Store contact
+        MVPbkStoreContact* iStoreContact;
+        /// Own: Select field dialog result
+        TInt iSelectFieldResult;
+        /// Ref: Select field property
+        MPbk2SelectFieldProperty* iSelectFieldProperty;
+        /// Ref: Index of the field to assign data to
+        TInt& iFieldIndex;
+        /// Ref: Information note flags
+        TUint& iNoteFlags;
+        /// Own: Contact relocator
+        CPbk2ContactRelocator* iContactRelocator;
+        /// Own: Indicates is this destroyed
+        TBool* iDestroyedPtr;
+        /// Own: Relocation flags
+        TUint iRelocationFlags;
+        /// Own: Results
+        CVPbkContactLinkArray* iResults;
+        /// Own: Key event dealer
+        CPbk2KeyEventDealer* iDealer;
+        /// Ref: Eikon enviroment
+        CEikonEnv* iEikEnv;
+    };
+
+#endif // CPBK2PREPARESINGLEASSIGNPHASE_H
+
+// End of File