logsui/logsengine/src/logscontact.cpp
changeset 21 2f0af9ba7665
parent 17 90fe74753f71
equal deleted inserted replaced
18:acd4e87b24b4 21:2f0af9ba7665
    27 //SYSTEM
    27 //SYSTEM
    28 #include <QVariant>
    28 #include <QVariant>
    29 #include <qcontactmanager.h>
    29 #include <qcontactmanager.h>
    30 #include <qcontactonlineaccount.h>
    30 #include <qcontactonlineaccount.h>
    31 #include <qcontactphonenumber.h>
    31 #include <qcontactphonenumber.h>
       
    32 #include <xqaiwdecl.h>
    32 #include <xqappmgr.h>
    33 #include <xqappmgr.h>
    33 #include <cntservicescontact.h>
    34 #include <cntservicescontact.h>
    34 
    35 
    35 // -----------------------------------------------------------------------------
    36 // -----------------------------------------------------------------------------
    36 //
    37 //
   123     LOGS_QDEBUG( "logs [ENG] -> LogsContact::open()")
   124     LOGS_QDEBUG( "logs [ENG] -> LogsContact::open()")
   124     bool ret = false;
   125     bool ret = false;
   125     LogsContact::RequestType type = allowedRequestType();
   126     LogsContact::RequestType type = allowedRequestType();
   126     if ( type == TypeLogsContactOpen || type == TypeLogsContactOpenGroup) {
   127     if ( type == TypeLogsContactOpen || type == TypeLogsContactOpenGroup) {
   127         mCurrentRequest = type;
   128         mCurrentRequest = type;
   128         QString interface("com.nokia.symbian.IContactsView");
   129         QString operation(XQOP_CONTACTS_VIEW_CONTACT_CARD);
   129         QString operation("openContactCard(int)");
       
   130         if (type == TypeLogsContactOpenGroup) {
   130         if (type == TypeLogsContactOpenGroup) {
   131             operation = "openGroup(int)";
   131             operation = XQOP_CONTACTS_VIEW_GROUP;
   132         }
   132         }
   133         QList<QVariant> arguments;
   133         QList<QVariant> arguments;
   134         arguments.append( QVariant(mContactId) );
   134         arguments.append( QVariant(mContactId) );
   135         ret = requestPhonebookService( interface, operation, arguments );
   135         ret = requestPhonebookService( XQI_CONTACTS_VIEW, operation, arguments );
   136     }
   136     }
   137     
   137     
   138     LOGS_QDEBUG_2( "logs [ENG] <- LogsContact::open(): ", ret )
   138     LOGS_QDEBUG_2( "logs [ENG] <- LogsContact::open(): ", ret )
   139     return ret;
   139     return ret;
   140 }
   140 }
   145 //
   145 //
   146 bool LogsContact::addNew()
   146 bool LogsContact::addNew()
   147 {
   147 {
   148     LOGS_QDEBUG( "logs [ENG] -> LogsContact::save()" )
   148     LOGS_QDEBUG( "logs [ENG] -> LogsContact::save()" )
   149             
   149             
   150     bool ret = save("editCreateNew(QString,QString)");
   150     bool ret = save(XQOP_CONTACTS_EDIT_CREATE_NEW);
   151     
   151     
   152     LOGS_QDEBUG_2( "logs [ENG] <- LogsContact::save(): ", ret )
   152     LOGS_QDEBUG_2( "logs [ENG] <- LogsContact::save(): ", ret )
   153     return ret;
   153     return ret;
   154 }
   154 }
   155 
   155 
   159 //
   159 //
   160 bool LogsContact::updateExisting()
   160 bool LogsContact::updateExisting()
   161 {
   161 {
   162     LOGS_QDEBUG( "logs [ENG] -> LogsContact::updateExisting()" )
   162     LOGS_QDEBUG( "logs [ENG] -> LogsContact::updateExisting()" )
   163     
   163     
   164     bool ret = save("editUpdateExisting(QString,QString)");
   164     bool ret = save(XQOP_CONTACTS_EDIT_UPDATE_EXISTING);
   165     
   165     
   166     LOGS_QDEBUG( "logs [ENG] <- LogsContact::updateExisting()" )
   166     LOGS_QDEBUG( "logs [ENG] <- LogsContact::updateExisting()" )
   167     return ret;
   167     return ret;
   168 }
   168 }
   169 
   169 
   213     
   213     
   214     bool ret(false);
   214     bool ret(false);
   215     
   215     
   216     if ( arguments.count() == 2 ) {
   216     if ( arguments.count() == 2 ) {
   217         mCurrentRequest = TypeLogsContactSave;
   217         mCurrentRequest = TypeLogsContactSave;
   218         QString interface("com.nokia.symbian.IContactsEdit");
   218         ret = requestPhonebookService( XQI_CONTACTS_EDIT, operation, arguments );        
   219         ret = requestPhonebookService( interface, operation, arguments );        
       
   220     } else {
   219     } else {
   221         LOGS_QDEBUG( "logs [ENG]  !No Caller ID, not saving the contact..")
   220         LOGS_QDEBUG( "logs [ENG]  !No Caller ID, not saving the contact..")
   222     }
   221     }
   223     
   222     
   224     return ret;
   223     return ret;
   255 //
   254 //
   256 void LogsContact::handleError(int errorCode, const QString& errorMessage)
   255 void LogsContact::handleError(int errorCode, const QString& errorMessage)
   257 {
   256 {
   258     LOGS_QDEBUG_4( "logs [ENG] <-> LogsContact::handleError(): ", errorCode,
   257     LOGS_QDEBUG_4( "logs [ENG] <-> LogsContact::handleError(): ", errorCode,
   259             " ,msg: ", errorMessage)
   258             " ,msg: ", errorMessage)
       
   259     Q_UNUSED(errorCode)
       
   260     Q_UNUSED(errorMessage)
   260     cancelServiceRequest();
   261     cancelServiceRequest();
   261 }
   262 }
   262 
   263 
   263 // ----------------------------------------------------------------------------
   264 // ----------------------------------------------------------------------------
   264 // Phonebookservices define following return values:
   265 // Phonebookservices define following return values:
   268 // KCntServicesTerminated = -2;
   269 // KCntServicesTerminated = -2;
   269 // ----------------------------------------------------------------------------
   270 // ----------------------------------------------------------------------------
   270 //
   271 //
   271 void LogsContact::handleRequestCompleted(const QVariant& result)
   272 void LogsContact::handleRequestCompleted(const QVariant& result)
   272 {
   273 {
   273     delete mAiwRequest;
   274     cancelServiceRequest();
   274     mAiwRequest = 0;
       
   275     bool retValOk = false;
   275     bool retValOk = false;
   276     int serviceRetVal = result.toInt(&retValOk);
   276     int serviceRetVal = result.toInt(&retValOk);
   277     LOGS_QDEBUG_3( "logs [ENG] -> LogsContact::handleRequestCompleted(), (retval, is_ok)", 
   277     LOGS_QDEBUG_3( "logs [ENG] -> LogsContact::handleRequestCompleted(), (retval, is_ok)", 
   278                    serviceRetVal, retValOk )
   278                    serviceRetVal, retValOk )
   279     
   279