emailuis/nmailuiengine/inc/nmoperation.h
changeset 18 578830873419
child 20 ecc8def7944a
equal deleted inserted replaced
4:e7aa27f58ae1 18:578830873419
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef NMOPERATION_H_
       
    19 #define NMOPERATION_H_
       
    20 
       
    21 #include <QObject>
       
    22 #include "nmuienginedef.h"
       
    23 
       
    24 class QTimer;
       
    25 
       
    26 class NMUIENGINE_EXPORT NmOperation: public QObject
       
    27 {
       
    28     Q_OBJECT
       
    29 
       
    30 public:
       
    31 
       
    32     NmOperation(QObject *parent = 0);
       
    33     virtual ~NmOperation();    
       
    34     bool isRunning() const;
       
    35     
       
    36 signals:
       
    37     void operationProgressChanged(int progress);
       
    38     void operationCompleted(int result);
       
    39     void operationCancelled();
       
    40 
       
    41 public slots:
       
    42     void completeOperation(int result);
       
    43     void cancelOperation();
       
    44     void updateOperationProgress(int progress);
       
    45 
       
    46 protected slots:
       
    47     virtual void runAsyncOperation() = 0;
       
    48 
       
    49 protected:
       
    50     virtual void doCompleteOperation();
       
    51     virtual void doCancelOperation();
       
    52     virtual void doUpdateOperationProgress();
       
    53 
       
    54 private:
       
    55     QTimer *mTimer;
       
    56     int mProgress;
       
    57     bool mIsRunning;
       
    58 };
       
    59 
       
    60 #endif /* NMOPERATION_H_ */