88
|
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>
|
92
|
21 |
#include <XQConversions>
|
88
|
22 |
#include <xqappmgr.h>
|
|
23 |
|
|
24 |
#include "caentry.h"
|
|
25 |
#include "catapphandler.h"
|
92
|
26 |
#include "caclient_defines.h"
|
|
27 |
|
96
|
28 |
static const QString hsitemLaunchUri("item:launchuri");
|
88
|
29 |
|
|
30 |
QTM_USE_NAMESPACE
|
|
31 |
|
|
32 |
/*!
|
|
33 |
\class CaTappHandler
|
|
34 |
\ingroup
|
|
35 |
\brief Implementation of templated application command handler.
|
|
36 |
*/
|
|
37 |
|
|
38 |
/*!
|
|
39 |
Constructor.
|
|
40 |
\param parent Parent object of this object.
|
|
41 |
*/
|
|
42 |
CaTappHandler::CaTappHandler(QObject *parent)
|
|
43 |
{
|
125
|
44 |
Q_UNUSED(parent);
|
88
|
45 |
mAiwMgr = new XQApplicationManager();
|
|
46 |
}
|
|
47 |
|
|
48 |
/*!
|
|
49 |
Destructor.
|
|
50 |
*/
|
|
51 |
CaTappHandler::~CaTappHandler()
|
|
52 |
{
|
|
53 |
delete mAiwMgr;
|
|
54 |
}
|
|
55 |
|
|
56 |
/*!
|
|
57 |
Executes \a command by default "open" on template application represented by \a entry.
|
|
58 |
Uses XQApplicationManager
|
|
59 |
\param entry Subject of the \a command.
|
|
60 |
\param command Description of the command.
|
116
|
61 |
\param receiver a QObject class with slot to invoke.
|
|
62 |
\param member a slot to invoke.
|
98
|
63 |
\retval Error code described in QSERVICEMANAGER.H
|
88
|
64 |
*/
|
116
|
65 |
int CaTappHandler::execute(const CaEntry& entry, const QString& command,
|
|
66 |
QObject* receiver, const char* member)
|
88
|
67 |
{
|
116
|
68 |
Q_UNUSED(receiver);
|
|
69 |
Q_UNUSED(member);
|
96
|
70 |
// this returns Error enum from QSERVICEMANAGER.H
|
|
71 |
int error = 0;
|
88
|
72 |
if (command == caCmdOpen) {
|
96
|
73 |
QString attribute = entry.attribute(hsitemLaunchUri);
|
|
74 |
if (!attribute.isNull()) {
|
|
75 |
// e.g. QUrl("appto://101F7AE7?");
|
|
76 |
QScopedPointer<XQAiwRequest> request(mAiwMgr->create(QUrl(attribute),
|
|
77 |
false));
|
|
78 |
if (!request.isNull()) {
|
|
79 |
bool res = request->send();
|
|
80 |
if (!res) {
|
|
81 |
error = request->lastError();
|
|
82 |
}
|
88
|
83 |
}
|
|
84 |
}
|
96
|
85 |
} else {
|
98
|
86 |
// TODO: error code cleanning and an appropriate conversion (in other classes too).
|
96
|
87 |
static const int NotSupportedErrorCode = 100;
|
|
88 |
error = NotSupportedErrorCode;
|
88
|
89 |
}
|
|
90 |
return error;
|
|
91 |
}
|