logsui/logsengine/src/logscall.cpp
changeset 21 2f0af9ba7665
parent 15 76d2cf7a585e
equal deleted inserted replaced
18:acd4e87b24b4 21:2f0af9ba7665
    22 #include "logslogger.h"
    22 #include "logslogger.h"
    23 #include "logseventdata.h"
    23 #include "logseventdata.h"
    24 
    24 
    25 //SYSTEM
    25 //SYSTEM
    26 #include <QVariant>
    26 #include <QVariant>
    27 #include <xqservicerequest.h>
       
    28 #include <xqrequestinfo.h>
    27 #include <xqrequestinfo.h>
       
    28 #include <xqaiwdeclplat.h>
       
    29 #include <xqappmgr.h>
    29 #include <hbnotificationdialog.h>
    30 #include <hbnotificationdialog.h>
    30 
    31 
    31 // -----------------------------------------------------------------------------
    32 // -----------------------------------------------------------------------------
    32 //
    33 //
    33 // -----------------------------------------------------------------------------
    34 // -----------------------------------------------------------------------------
   131 //
   132 //
   132 void LogsCall::callToNumber(LogsCall::CallType callType, const QString& number,
   133 void LogsCall::callToNumber(LogsCall::CallType callType, const QString& number,
   133         unsigned int serviceId, unsigned int contactId)
   134         unsigned int serviceId, unsigned int contactId)
   134 {
   135 {
   135     LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::callToNumber(), type", callType )
   136     LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::callToNumber(), type", callType )
   136     QString service("phoneui.com.nokia.symbian.ICallDial");
       
   137         
   137         
   138     if ( number.isEmpty() || callType == TypeLogsCallNotAvailable ){
   138     if ( number.isEmpty() || callType == TypeLogsCallNotAvailable ){
   139         LOGS_QDEBUG( "logs [ENG]    Calling not possible!" )
   139         LOGS_QDEBUG( "logs [ENG]    Calling not possible!" )
   140         if ( contactId ){
   140         if ( contactId ){
   141             HbNotificationDialog::launchDialog(
   141             HbNotificationDialog::launchDialog(
   142                 hbTrId("txt_dial_dpopinfo_no_saved_number_for_this_contact"));    
   142                 hbTrId("txt_dial_dpopinfo_no_saved_number_for_this_contact"));    
   143         } else {
   143         } else {
   144             // Will fail but intention is to get error notification from phone
   144             // Will fail but intention is to get error notification from phone
   145             createcall(service, "dial(QString)", number, false);
   145             createcall(XQI_CALL_DIAL, "dial(QString)", number, false);
   146         }
   146         }
   147     } else if (callType == TypeLogsVoiceCall) {
   147     } else if (callType == TypeLogsVoiceCall) {
   148         createcall(service, "dial(QString)", number, false);
   148         createcall(XQI_CALL_DIAL, "dial(QString)", number, false);
   149     } else if (callType == TypeLogsVideoCall) {
   149     } else if (callType == TypeLogsVideoCall) {
   150         createcall(service, "dialVideo(QString)", number, false);
   150         createcall(XQI_CALL_DIAL, "dialVideo(QString)", number, false);
   151     } else if (callType == TypeLogsVoIPCall){
   151     } else if (callType == TypeLogsVoIPCall){
   152         if ( serviceId ){
   152         if ( serviceId ){
   153         
   153         
   154             // Service id should(?) be used with every call type. If logs entry
   154             // Service id should(?) be used with every call type. If logs entry
   155             // is from xsp with video call support, then the executed
   155             // is from xsp with video call support, then the executed
   156             // video call should be mapped to the right xsp?
   156             // video call should be mapped to the right xsp?
   157             // also contact must be passed if available if change service is
   157             // also contact must be passed if available if change service is
   158             // provided (no point change service and try to call service specific
   158             // provided (no point change service and try to call service specific
   159             // uri with another service)?
   159             // uri with another service)?
   160             createCallWithService(service, 
   160             createCallWithService(XQI_CALL_DIAL, 
   161                 "dialVoipService(QString,int)", number, false, serviceId);
   161                 "dialVoipService(QString,int)", number, false, serviceId);
   162         }
   162         }
   163         else {
   163         else {
   164             // This is likely to fail as long as telephony does not
   164             // This is likely to fail as long as telephony does not
   165             // offer any kind of service selection. Normally voip call
   165             // offer any kind of service selection. Normally voip call
   166             // should always have service id set but if it's missing
   166             // should always have service id set but if it's missing
   167             // for some reason, then this provides call failure UI.
   167             // for some reason, then this provides call failure UI.
   168             createcall(service, "dialVoip(QString)", number, false);
   168             createcall(XQI_CALL_DIAL, "dialVoip(QString)", number, false);
   169         }
   169         }
   170     }
   170     }
   171     LOGS_QDEBUG( "logs [ENG] <- LogsCall::callToNumber()" )
   171     LOGS_QDEBUG( "logs [ENG] <- LogsCall::callToNumber()" )
   172 }
   172 }
   173 
   173 
   199 
   199 
   200 // ----------------------------------------------------------------------------
   200 // ----------------------------------------------------------------------------
   201 // LogsCall::createcall
   201 // LogsCall::createcall
   202 // ----------------------------------------------------------------------------
   202 // ----------------------------------------------------------------------------
   203 //
   203 //
   204 void LogsCall::createcall(QString service, QString type, QString num, bool sync)
   204 void LogsCall::createcall(QString interface, QString operation, QString num, bool sync)
   205 {
   205 {
   206     LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createcall(), num", num )
   206     LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createcall(), XQApplicationManager: num", num )
   207     LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createcall(), service", service )
   207     LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createcall(), interface", interface )
   208     XQServiceRequest snd(service, type, sync);
   208     XQApplicationManager appMgr;
   209     snd << num;
   209     XQAiwRequest* request = appMgr.create(interface, operation, false);
   210     // Start call at bg, call UI will bring itself to foreground when ever
   210     if (request) {
   211     // it thinks it is good time to do it.
   211         LOGS_QDEBUG_2( "logs [ENG] -> request->isSynchronous():", request->isSynchronous() )
   212     XQRequestInfo info;
   212         
   213     info.setBackground(true);
   213         QList<QVariant> arglist;
   214     snd.setInfo(info);
   214         arglist.append(QVariant(num));
   215     QVariant retValue;
   215         request->setArguments(arglist);
   216     snd.send(retValue);
   216         XQRequestInfo info;
       
   217         info.setBackground(true);
       
   218         request->setInfo(info);
       
   219         request->setSynchronous(sync);
       
   220         QVariant ret(QVariant::Int);        
       
   221         request->send(ret);
       
   222         delete request;
       
   223     }
   217     LOGS_QDEBUG( "logs [ENG] <- LogsCall::createcall()" )
   224     LOGS_QDEBUG( "logs [ENG] <- LogsCall::createcall()" )
   218 }
   225 }
   219 
   226 
   220 // ----------------------------------------------------------------------------
   227 // ----------------------------------------------------------------------------
   221 // LogsCall::createCallWithService
   228 // LogsCall::createCallWithService
   222 // ----------------------------------------------------------------------------
   229 // ----------------------------------------------------------------------------
   223 //
   230 //
   224 void LogsCall::createCallWithService(QString service, QString type, QString num, 
   231 void LogsCall::createCallWithService(QString interface, QString operation,  
   225         bool sync, unsigned int serviceId )
   232         QString num, bool sync, unsigned int serviceId )
   226 {
   233 {
   227     LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createCallWithService(), num", num )
   234     LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createCallWithService(), num", num )
   228     LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createCallWithService(), num", serviceId )
   235     LOGS_QDEBUG_2( "logs [ENG] -> LogsCall::createCallWithService(), num", serviceId )
   229     XQServiceRequest snd(service, type, sync);
   236     XQApplicationManager appMgr;
   230     snd << num << serviceId;
   237     XQAiwRequest* request = appMgr.create(interface, operation, false);
   231     // Start call at bg, call UI will bring itself to foreground when ever
   238     if (request) {
   232     // it thinks it is good time to do it.
   239         QList<QVariant> arglist;
   233     XQRequestInfo info;
   240         arglist.append(QVariant(num));
   234     info.setBackground(true);
   241         arglist.append(QVariant(serviceId));
   235     snd.setInfo(info);
   242         request->setArguments(arglist);
   236     QVariant retValue;
   243         XQRequestInfo info;
   237     snd.send(retValue);
   244         info.setBackground(true);
       
   245         request->setInfo(info);
       
   246         request->setSynchronous(sync);
       
   247         QVariant ret(QVariant::Int);        
       
   248         request->send(ret);
       
   249         delete request;
       
   250     }   
   238     LOGS_QDEBUG( "logs [ENG] <- LogsCall::createCallWithService()" )
   251     LOGS_QDEBUG( "logs [ENG] <- LogsCall::createCallWithService()" )
   239 }
   252 }
   240 
   253 
   241 // End of file
   254 // End of file
   242 
   255