filemanager/Engine/inc/CFileManagerActiveBase.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 00:03:31 +0200
changeset 1 d1daf54a55b5
parent 0 6a9f87576119
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 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:  Wraps wait note and real work thread
*
*/



#ifndef CFILEMANAGERACTIVEBASE_H
#define CFILEMANAGERACTIVEBASE_H

// INCLUDES
#include <e32std.h>
#include <AknWaitNoteWrapper.h>
#include "MFileManagerThreadFunction.h"

// FORWARD DECLARATIONS
class CFileManagerThreadWrapper;

// CLASS DECLARATION
/**
* Class wraps wait note and real work thread to avoid long running steps 
* in the main thread that freezes the UI.
*
*  @lib FileManagerEngine.lib
*  @since 3.2
*/
NONSHARABLE_CLASS(CFileManagerActiveBase) : public CBase,
                              public MAknBackgroundProcess,
                              public MFileManagerThreadFunction
    {
    public:
        /**
        * Constructor for subclasses.
        */
        void BaseConstructL();

        /**
        * Destructor.
        */
        ~CFileManagerActiveBase();

        TInt Result() const;

    private: // From MAknBackgroundProcess
        void StepL();

        TBool IsProcessDone() const;

        void DialogDismissedL( TInt aButtonId );

    private: // From MFileManagerThreadFunction
        void ThreadStepL();

        TBool IsThreadDone();

        void NotifyThreadClientL( TNotifyType aType, TInt aValue );

    protected:
        /**
        * For subclasses to handle all processing in work thread
        */
        virtual void ThreadFunctionL( const TBool& aCanceled ) = 0;

        /**
        * For subclasses to request cancel in work thread
        */
        virtual void CancelThreadFunction();

    protected:
        /**
        * C++ default constructor.
        */
        CFileManagerActiveBase();

    private: // Data
        // Wraps work thread control. Own.
        CFileManagerThreadWrapper* iThreadWrapper;

        // Indicates if background process is done or not
        TBool iDone;

        // Indicates if thread is canceled
        TBool iCanceled;

        // Indicates the result
        TInt iResult;

    };

#endif      // CFILEMANAGERACTIVEBASE_H
            
// End of File