qtmobility/plugins/contacts/symbiansim/inc/cntabstractsimrequest.h
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    41 
    41 
    42 #ifndef CNTABSTRACTSIMREQUEST_H_
    42 #ifndef CNTABSTRACTSIMREQUEST_H_
    43 #define CNTABSTRACTSIMREQUEST_H_
    43 #define CNTABSTRACTSIMREQUEST_H_
    44 
    44 
    45 #include <QObject>
    45 #include <QObject>
       
    46 #include <qtcontacts.h>
       
    47 
       
    48 QTM_BEGIN_NAMESPACE
       
    49 class QContactAbstractRequest;
       
    50 QTM_END_NAMESPACE
       
    51 QTM_USE_NAMESPACE
    46 
    52 
    47 class CntSymbianSimEngine;
    53 class CntSymbianSimEngine;
    48 class CntSimStore;
    54 class CntSimStore;
    49 class QTimer;
    55 class QTimer;
    50 
    56 
       
    57 #ifdef SYMBIANSIM_BACKEND_USE_DELAY
       
    58 const int KRequestDelay = 10; // in ms
       
    59 #else
       
    60 const int KRequestDelay = 0;
       
    61 #endif
       
    62 const int KMaxRetryCount = 10;
       
    63 
    51 class CntAbstractSimRequest : public QObject
    64 class CntAbstractSimRequest : public QObject
    52 {
    65 {
    53 Q_OBJECT
    66 Q_OBJECT
    54 public:
    67 public:
    55     CntAbstractSimRequest(CntSymbianSimEngine *engine);
    68     CntAbstractSimRequest(CntSymbianSimEngine *engine, QContactAbstractRequest *req);
    56     virtual ~CntAbstractSimRequest() {}
       
    57     virtual bool start() = 0;
       
    58     virtual bool cancel() = 0;
       
    59     
    69     
       
    70     bool start();
       
    71 
       
    72 public Q_SLOTS:    
       
    73     virtual void run() = 0;
       
    74     virtual bool cancel();
       
    75         
    60 protected:
    76 protected:
       
    77     bool waitAndRetry();
    61     void singleShotTimer(int msec, QObject *receiver, const char *member);
    78     void singleShotTimer(int msec, QObject *receiver, const char *member);
    62     void cancelTimer();
    79     void cancelTimer();
    63     CntSymbianSimEngine *engine();
    80     CntSymbianSimEngine *engine();
    64     CntSimStore *simStore();
    81     CntSimStore *simStore();
       
    82     QContactAbstractRequest *req() { return m_request; }
       
    83 
       
    84     template<class T>
       
    85     T *req() { return static_cast<T*>(m_request); }
    65     
    86     
    66 private:
    87 private:
       
    88     QContactAbstractRequest *m_request;
    67     QTimer *m_timer;
    89     QTimer *m_timer;
       
    90     int m_retryCount;
    68 };
    91 };
    69 
    92 
    70 #endif // CNTABSTRACTSIMREQUEST_H_
    93 #endif // CNTABSTRACTSIMREQUEST_H_