qtmobility/plugins/contacts/symbiansim/src/cntsimstore.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 14 6fbed849b4f4
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    39 **
    39 **
    40 ****************************************************************************/
    40 ****************************************************************************/
    41 
    41 
    42 #include "cntsimstore.h"
    42 #include "cntsimstore.h"
    43 #include "cntsimstoreprivate.h"
    43 #include "cntsimstoreprivate.h"
       
    44 #include "cntsymbiansimtransformerror.h"
    44 
    45 
    45 CntSimStore::CntSimStore(CntSymbianSimEngine* engine, QString storeName)
    46 CntSimStore::CntSimStore(CntSymbianSimEngine* engine, QString storeName, QContactManager::Error* error)
    46     :QObject((QObject *)engine)
    47     :QObject((QObject *)engine),
       
    48      d_ptr(0)
    47 {
    49 {
       
    50     *error = QContactManager::NoError;
       
    51     
    48     // We need to register these meta types for signals because connect() with 
    52     // We need to register these meta types for signals because connect() with 
    49     // Qt::QueuedConnection it is required.
    53     // Qt::QueuedConnection it is required.
    50     qRegisterMetaType<QContact>("QContact");
    54     qRegisterMetaType<QContact>("QContact");
    51     qRegisterMetaType<QList<QContact> >("QList<QContact>");
    55     qRegisterMetaType<QList<QContact> >("QList<QContact>");
    52     qRegisterMetaType<QContactManager::Error>("QContactManager::Error");
    56     qRegisterMetaType<QContactManager::Error>("QContactManager::Error");
    53     qRegisterMetaType<RMobilePhoneBookStore::TMobilePhoneBookInfoV5>("RMobilePhoneBookStore::TMobilePhoneBookInfoV5");
    57     qRegisterMetaType<QList<int> >("QList<int>");
    54     
    58     
    55     QT_TRAP_THROWING(d_ptr = CntSimStorePrivate::NewL(*engine, *this, storeName));
    59     TRAPD(err, d_ptr = CntSimStorePrivate::NewL(*engine, *this, storeName));
       
    60     CntSymbianSimTransformError::transformError(err, error);
    56 }
    61 }
    57 
    62 
    58 CntSimStore::~CntSimStore()
    63 CntSimStore::~CntSimStore()
    59 {
    64 {
    60     delete d_ptr;
    65     delete d_ptr;
    63 QString CntSimStore::storeName()
    68 QString CntSimStore::storeName()
    64 {
    69 {
    65     return d_ptr->storeName();
    70     return d_ptr->storeName();
    66 }
    71 }
    67 
    72 
    68 RMobilePhoneBookStore::TMobilePhoneBookInfoV5 CntSimStore::storeInfo()
    73 TSimStoreInfo CntSimStore::storeInfo()
    69 {
    74 {
    70     return d_ptr->storeInfo();
    75     return d_ptr->storeInfo();
    71 }
    76 }
    72 
    77 
    73 QContactManager::Error CntSimStore::getInfo()
    78 bool CntSimStore::read(int index, int numSlots, QContactManager::Error* error)
    74 {
    79 {
    75     return d_ptr->getInfo();
    80     return d_ptr->read(index, numSlots, error);
    76 }
    81 }
    77 
    82 
    78 QContactManager::Error CntSimStore::read(int index, int numSlots)
    83 bool CntSimStore::write(const QContact &contact, QContactManager::Error* error)
    79 {
    84 {
    80     return d_ptr->read(index, numSlots);
    85     return d_ptr->write(contact, error);
    81 }
    86 }
    82 
    87 
    83 QContactManager::Error CntSimStore::write(const QContact &contact)
    88 bool CntSimStore::remove(int index, QContactManager::Error* error)
    84 {
    89 {
    85     return d_ptr->write(contact);
    90     return d_ptr->remove(index, error);
    86 }
    91 }
    87 
    92 
    88 QContactManager::Error CntSimStore::remove(int index)
    93 bool CntSimStore::getReservedSlots(QContactManager::Error* error)
    89 {
    94 {
    90     return d_ptr->remove(index);
    95     return d_ptr->getReservedSlots(error);
    91 }
    96 }
    92 
    97 
    93 void CntSimStore::cancel()
    98 void CntSimStore::cancel()
    94 {
    99 {
    95     d_ptr->Cancel();
   100     d_ptr->Cancel();
    97 
   102 
    98 bool CntSimStore::isBusy()
   103 bool CntSimStore::isBusy()
    99 {
   104 {
   100     return d_ptr->IsActive();
   105     return d_ptr->IsActive();
   101 }
   106 }
       
   107 
       
   108 TInt CntSimStore::lastAsyncError()
       
   109 {
       
   110     return d_ptr->lastAsyncError();
       
   111 }