contentstorage/cahandler/tapp/src/catapphandler.cpp
changeset 61 8e5041d13c84
child 66 32469d7d46ff
equal deleted inserted replaced
60:f62f87b200ec 61:8e5041d13c84
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  Default implementation of the home screen runtime.
       
    15  *
       
    16  */
       
    17 
       
    18 #include <qservicemanager.h>
       
    19 #include <qservicefilter.h>
       
    20 #include <qserviceinterfacedescriptor.h>
       
    21 
       
    22 #include <xqappmgr.h>
       
    23 
       
    24 #include "caentry.h"
       
    25 #include "catapphandler.h"
       
    26 
       
    27 QTM_USE_NAMESPACE
       
    28 
       
    29 /*!
       
    30     \class CaTappHandler
       
    31     \ingroup
       
    32     \brief Implementation of templated application command handler.
       
    33 */
       
    34 
       
    35 /*!
       
    36  Constructor.
       
    37  \param parent Parent object of this object.
       
    38  */
       
    39 CaTappHandler::CaTappHandler(QObject *parent)
       
    40 {
       
    41 	Q_UNUSED(parent);
       
    42     mAiwMgr = new XQApplicationManager();
       
    43 }
       
    44 
       
    45 /*!
       
    46  Destructor.
       
    47  */
       
    48 CaTappHandler::~CaTappHandler()
       
    49 {
       
    50     delete mAiwMgr;
       
    51 }
       
    52 
       
    53 /*!
       
    54  Executes \a command by default "open" on template application represented by \a entry.
       
    55  Uses XQApplicationManager
       
    56  \param entry Subject of the \a command.
       
    57  \param command Description of the command.
       
    58  \return Error code described in QSERVICEMANAGER.H
       
    59  */
       
    60 int CaTappHandler::execute(const CaEntry& entry, const QString& command)
       
    61 {
       
    62     int error = 0; // this returns Error enum from QSERVICEMANAGER.H
       
    63     if (command == caCmdOpen) {
       
    64         QUrl url(entry.attribute(hsitemLaunchUri)); // f.e. QUrl url ("application://101F7AE7?");       
       
    65         QScopedPointer<XQAiwRequest> request(mAiwMgr->create(url, true));
       
    66         if (!request.isNull()) {
       
    67             bool res = request->send();
       
    68             if (!res) {
       
    69                 error = request->lastError();
       
    70             }
       
    71         }
       
    72     }
       
    73     return error;
       
    74 }