coreapplicationuis/SysAp/Src/memorycard/sysapdriveejecthandler.h
author fimarlaht2 <>
Mon, 18 Oct 2010 15:01:14 +0300
branchRCL_3
changeset 85 32f887d619a0
parent 0 2e3d3ce01487
permissions -rw-r--r--
Bug 3556 - Not possible to restore factory settings

/*
* Copyright (c) 2007-2009 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:  Drive eject handler implementation
 *
*/


#ifndef SYSAPDRIVEEJECTHANDLER_H
#define SYSAPDRIVEEJECTHANDLER_H

// INCLUDES
#include <e32std.h>
#include <disknotifyhandler.h>

// FORWARD DECLARATIONS
class CSysApDriveList;
class CSysApAppUi;

// CLASS DECLARATION
class CSysApDriveEjectHandler : public CBase,
                                public MDiskNotifyHandlerCallback
{
public:
    /**
     * Two-phased constructor.
     */
    static CSysApDriveEjectHandler* NewL(
        CSysApDriveList& aSysApDriveList,
        CSysApAppUi& aSysApAppUi,
		RFs& aFs );

    /**
     * Destructor
     */
    ~CSysApDriveEjectHandler();

public: // New methods

    /**
     * Starts eject if not already ongoing
     */
    void StartEject();

    /**
     * Completes drive's dismount.
     * Note that this must be called when the dialog launched from 
     * CSysApAppUi::ShowMMCDismountedDialogL has been closed.
     *
     * @param aDrive Drive to be dismounted
     * @return ETrue if drives left waiting to be dismounted, otherwise EFalse.
     */
    TBool CompleteDismount( TInt aDrive );

private:
    /**
    * Constructors.
    */
    CSysApDriveEjectHandler(
        CSysApDriveList& aSysApDriveList,
        CSysApAppUi& aSysApAppUi );

    void ConstructL( RFs& aFs );

    /**
    * Starts eject.
    */
    TBool DoStartEjectL();

    /**
    *  Stops eject.
    */
    void StopEject( TInt aError );

private: // From MDiskNotifyHandlerCallback
    void HandleNotifyDismountFinished(
        TInt aError,
        const TDismountFinishedEvent& aEvent );

private: // Data
    // Reference to the drive list
    CSysApDriveList& iSysApDriveList;

    // Reference to the app ui
    CSysApAppUi& iSysApAppUi;

    // Current drive to be ejected
    TInt iDriveToEject;

    // For controlled dismount with timeout. Owned.
    CDiskNotifyHandler* iDiskNotifyHandler;

};

#endif // SYSAPDRIVEEJECTHANDLER_H

// End of File