contentstorage/cahandler/tapp/src/catapphandler.cpp
changeset 83 156f692b1687
parent 73 4bc7b118b3df
child 103 b99b84bcd2d1
equal deleted inserted replaced
80:397d00875918 83:156f692b1687
    21 #include <XQConversions>
    21 #include <XQConversions>
    22 #include <xqappmgr.h>
    22 #include <xqappmgr.h>
    23 
    23 
    24 #include "caentry.h"
    24 #include "caentry.h"
    25 #include "catapphandler.h"
    25 #include "catapphandler.h"
    26 #include "cainnerentry.h"
       
    27 #include "caclient_defines.h"
    26 #include "caclient_defines.h"
    28 
    27 
    29 _LIT(hsitemLaunchUri, "item:launchuri");
    28 static const QString hsitemLaunchUri("item:launchuri");
    30 
    29 
    31 QTM_USE_NAMESPACE
    30 QTM_USE_NAMESPACE
    32 
    31 
    33 /*!
    32 /*!
    34     \class CaTappHandler
    33     \class CaTappHandler
    59  Uses XQApplicationManager
    58  Uses XQApplicationManager
    60  \param entry Subject of the \a command.
    59  \param entry Subject of the \a command.
    61  \param command Description of the command.
    60  \param command Description of the command.
    62  \return Error code described in QSERVICEMANAGER.H
    61  \return Error code described in QSERVICEMANAGER.H
    63  */
    62  */
    64 int CaTappHandler::execute(CCaInnerEntry& innerEntry, const QString& command)
    63 int CaTappHandler::execute(const CaEntry& entry, const QString& command)
    65 {
    64 {
    66     int error = 0; // this returns Error enum from QSERVICEMANAGER.H
    65     // this returns Error enum from QSERVICEMANAGER.H
       
    66     int error = 0;
    67     if (command == caCmdOpen) {
    67     if (command == caCmdOpen) {
    68         TPtrC attribute;
    68         QString attribute = entry.attribute(hsitemLaunchUri);
    69         innerEntry.FindAttribute(hsitemLaunchUri, attribute);
    69         if (!attribute.isNull()) {
    70 
    70             // e.g. QUrl("appto://101F7AE7?");
    71         // e.g. QUrl url ("application://101F7AE7?");
    71             QScopedPointer<XQAiwRequest> request(mAiwMgr->create(QUrl(attribute),
    72         QUrl url(QString::fromUtf16(attribute.Ptr(), attribute.Length()));
    72                 false));
    73         QScopedPointer<XQAiwRequest> request(mAiwMgr->create(url, false));
    73             if (!request.isNull()) {
    74         if (!request.isNull()) {
    74                 bool res = request->send();
    75             bool res = request->send();
    75                 if (!res) {
    76             if (!res) {
    76                     error = request->lastError();
    77                 error = request->lastError();
    77                 }
    78             }
    78             }
    79         }
    79         }
       
    80     } else {
       
    81         // TODO: error code cleanning and appropriate conversion (in other classes too).
       
    82         static const int NotSupportedErrorCode = 100;
       
    83         error = NotSupportedErrorCode;
    80     }
    84     }
    81     return error;
    85     return error;
    82 }
    86 }