phoneapp/phoneuiqtviewadapter/src/phoneapplauncher.cpp
changeset 64 6aaf0276100e
parent 46 bc5a64e5bc3c
child 65 2a5d4ab426d3
equal deleted inserted replaced
56:5bcb308bd24d 64:6aaf0276100e
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <devicelockaccessapi.h>
    18 #include <devicelockaccessapi.h>
    19 #include <xqservicerequest.h>
    19 #include <xqservicerequest.h>
    20 #include <logsservices.h>
       
    21 #include <xqappmgr.h>
    20 #include <xqappmgr.h>
    22 #include <xqrequestinfo.h>
    21 #include <xqrequestinfo.h>
       
    22 #include <xqaiwdecl.h>
    23 
    23 
    24 #include "phoneapplauncher.h"
    24 #include "phoneapplauncher.h"
    25 #include "qtphonelog.h"
    25 #include "qtphonelog.h"
    26 
    26 
    27 /*!
    27 /*!
    56     arguments.append(QVariant(messageBody));
    56     arguments.append(QVariant(messageBody));
    57     sendServiceRequest(
    57     sendServiceRequest(
    58         "com.nokia.services.hbserviceprovider",
    58         "com.nokia.services.hbserviceprovider",
    59         "conversationview",
    59         "conversationview",
    60         "send(QString,QString,QString)",
    60         "send(QString,QString,QString)",
    61         arguments);
    61         arguments,
       
    62         true);
    62 }
    63 }
    63 
    64 
    64 /*!
    65 /*!
    65     PhoneAppLauncher::launchContacts.
    66     PhoneAppLauncher::launchContacts.
    66  */
    67  */
    69     QList<QVariant> arguments;
    70     QList<QVariant> arguments;
    70     sendServiceRequest(
    71     sendServiceRequest(
    71         "com.nokia.services.phonebookappservices",
    72         "com.nokia.services.phonebookappservices",
    72         "Launch",
    73         "Launch",
    73         "launch()",
    74         "launch()",
    74         arguments);
    75         arguments,
       
    76         true);
    75 }
    77 }
    76 
    78 
    77 /*!
    79 /*!
    78     PhoneAppLauncher::launchLogs.
    80     PhoneAppLauncher::launchLogs.
    79  */
    81  */
    81         int activatedView,
    83         int activatedView,
    82         bool showDialpad,
    84         bool showDialpad,
    83         const QString &dialpadText)
    85         const QString &dialpadText)
    84 {
    86 {
    85     QVariantMap map;
    87     QVariantMap map;
    86     map.insert("view_index", QVariant(activatedView));
    88     map.insert(XQLOGS_VIEW_INDEX, QVariant(activatedView));
    87     map.insert("show_dialpad", QVariant(showDialpad));
    89     map.insert(XQLOGS_SHOW_DIALPAD, QVariant(showDialpad));
    88     map.insert("dialpad_text", QVariant(dialpadText));
    90     map.insert(XQLOGS_DIALPAD_TEXT, QVariant(dialpadText));
    89     QList<QVariant> args;
    91     QList<QVariant> args;
    90     args.append(QVariant(map));
    92     args.append(QVariant(map));
    91     sendServiceRequest(
    93     sendServiceRequest(
    92         "logs",
    94         "logs",
    93         "com.nokia.symbian.ILogsView",
    95         XQI_LOGS_VIEW,
    94         "show(QVariantMap)",
    96         XQOP_LOGS_SHOW,
    95         args);
    97         args,
       
    98         false);
    96 }
    99 }
    97 
   100 
    98 /*!
   101 /*!
    99     PhoneAppLauncher::sendServiceRequest.
   102     PhoneAppLauncher::sendServiceRequest.
   100  */
   103  */
   101 void PhoneAppLauncher::sendServiceRequest(
   104 void PhoneAppLauncher::sendServiceRequest(
   102         const QString &service, 
   105         const QString &service, 
   103         const QString &interface,
   106         const QString &interface,
   104         const QString &operation,
   107         const QString &operation,
   105         const QList<QVariant> &arguments)
   108         const QList<QVariant> &arguments, 
       
   109         const bool foreground)
   106 {
   110 {
   107     int err = -1;
   111     int err = -1;
   108     TRAP_IGNORE(
   112     TRAP_IGNORE(
   109         // Allow application launch only when device is unlocked
   113         // Allow application launch only when device is unlocked
   110         // If locked ask devicelock query
   114         // If locked ask devicelock query
   122             appManager.create(service, interface, operation, false) );
   126             appManager.create(service, interface, operation, false) );
   123         if (request == NULL) {
   127         if (request == NULL) {
   124             PHONE_TRACE1("service not found");
   128             PHONE_TRACE1("service not found");
   125             return;
   129             return;
   126         }
   130         }
   127         XQRequestInfo info;
   131 
   128         info.setForeground(true);
   132         if (foreground) {
   129         request->setInfo(info);
   133             XQRequestInfo info;
       
   134             info.setForeground(true);
       
   135             request->setInfo(info);
       
   136         }
       
   137         
   130         request->setArguments(arguments);
   138         request->setArguments(arguments);
   131         QVariant retValue(-1);
   139         QVariant retValue(-1);
   132         if (!request->send(retValue)) {
   140         if (!request->send(retValue)) {
   133             int error = request->lastError();
   141             int error = request->lastError();
   134             PHONE_TRACE2("send failed, error %d", request->lastError());
   142             PHONE_TRACE2("send failed, error %d", request->lastError());