phonebookui/Phonebook2/inc/CPbk2MemoryEntryDefaultsDlg.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 16:00:21 +0300
branchRCL_3
changeset 32 2828b4d142c0
parent 23 5586b4d2ec3e
child 64 c1e8ba0c2b16
permissions -rw-r--r--
Revision: 201017 Kit: 201019

/*
* 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 memory entry defaults dialog.
*
*/


#ifndef CPBK2MEMORYENTRYDEFAULTSDLG_H
#define CPBK2MEMORYENTRYDEFAULTSDLG_H

// INCLUDES
#include <aknPopup.h>                       // CAknPopupList
#include <MPbk2DefaultAttributeProcessObserver.h>
#include <VPbkFieldTypeSelectorFactory.h>
#include <spdefinitions.h>

// FORWARD DECLARATIONS
class CEikColumnListBox;
class CPbk2PresentationContact;
class CVPbkContactManager;
class CPbk2DefaultAttributeProcess;
class MVPbkStoreContactField;
class CFbsBitmap;

// CLASS DECLARATION

/**
 * Phonebook 2 memory entry defaults dialog.
 * This is a custom popup for Phonebook 2 application's
 * contacts' default settings.
 *
 * Responsible for:
 * - populating the list box with correct content, this
 *   is difficult since supported defaults are heavily variated
 * - setting or removing the default attributes to/from the contact
 *   by driving default attribute processor
 */
class CPbk2MemoryEntryDefaultsDlg :
            public CAknPopupList,
            public MPbk2DefaultAttributeProcessObserver
    {
    public: // Construction and destruction

        /**
         * Creates a new instance of this class.
         *
         * @param aContact  Contact whose defaults are chosen.
         * @param aManager  Virtual Phonebook contact manager.
         * @return  A new instance of this class.
         */
        IMPORT_C static CPbk2MemoryEntryDefaultsDlg* NewL(
                CPbk2PresentationContact& aContact,
                CVPbkContactManager& aManager );

        /**
         * Destructor.
         * Also cancels and dismisses this popup list, in other words makes
         * ExecuteLD return as if cancel was pressed.
         */
        ~CPbk2MemoryEntryDefaultsDlg();

    public: // Interface

        /**
         * Runs the dialog.
         */
        IMPORT_C void ExecuteLD();

    private: // From CAknPopupList
        void ProcessCommandL(
                TInt aCommandId );
        void HandleListBoxEventL(
                CEikListBox* aListBox,
                TListBoxEvent aEventType );

    private: // From MPbk2DefaultAttributeProcessObserver
        void AttributeProcessCompleted();
        void AttributeProcessFailed(
                TInt aErrorCode );

    private: // Implementation
        CPbk2MemoryEntryDefaultsDlg(
                CPbk2PresentationContact& aContact,
                CVPbkContactManager& aManager );
        void ConstructL();
        void CreateLinesL() const;
        TBool DefaultsAssignPopupL(
                VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID );
        void FixIndex(
                TInt& aIndex ) const;
        TBool IsSupported(
                const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID ) const;
        TBool HasMailboxAccountsL() const;
        TBool IsAvailableL(
                const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID ) const;
        void SetDefaultL(
                const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID,
                MVPbkStoreContactField& aField );
        void RemoveDefaultL(
                const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID );
        void CreateTableOfDefaultsL();
        void ReadDefaultsFromRepositoryL();      
        TInt SupportedVOIPServicesL( TServiceId& aServiceId );
        void LoadVoipServiceInfoL( 
                    TServiceId aServiceId,
                    CFbsBitmap*& aBitmap, CFbsBitmap*& aMask );
        
    private: // Data
        /// Ref: The contact
        CPbk2PresentationContact& iContact;
        /// Ref: Virtual Phonebook contact manager
        CVPbkContactManager& iManager;
        /// Own: Default selection listbox
        CEikFormattedCellListBox* iListBox;
        /// Ref: Referred TBool is set ETrue in destructor
        TBool* iDestroyedPtr;
        /// Own: Contact field the default is assigned to
        MVPbkStoreContactField* iField;
        /// Own: Attribute set/remove process
        CPbk2DefaultAttributeProcess* iAttributeProcess;
        /// Own: Local variation flags
        TInt iLVFlags;
        /// Own: Table of used Defaults item
        CArrayFixFlat<VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector>* iDefaultsTable;
        /// Own: Indicates if focus has been dragged around the list, helps with single tap launching
        TBool iHasBeenDragged;
        /// Voip service name
        HBufC* iServiceName;
    };

#endif // CPBK2MEMORYENTRYDEFAULTSDLG_H

// End of File