|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <QUrl> |
|
24 #include <QList> |
|
25 #include <xqaiwdecl.h> |
|
26 |
|
27 #include "SchemeHandlerBrQtHighway_p.h" |
|
28 |
|
29 |
|
30 namespace WRT { |
|
31 |
|
32 |
|
33 QtHighwaySchemeHandlerPrivate::QtHighwaySchemeHandlerPrivate() |
|
34 { |
|
35 } |
|
36 |
|
37 QtHighwaySchemeHandlerPrivate::~QtHighwaySchemeHandlerPrivate() |
|
38 { |
|
39 } |
|
40 |
|
41 SchemeHandler::SchemeHandlerError QtHighwaySchemeHandlerPrivate::HandleScheme(const QUrl &url) |
|
42 { |
|
43 return SendStandardUriViewRequest(url); |
|
44 } |
|
45 |
|
46 |
|
47 /*! |
|
48 Creates request with "com.nokia.symbian.IUriView" interface name and |
|
49 "view(QString)" operation. QtHighway uses the \a url parameter to |
|
50 determine the service application and the service application |
|
51 uses it as data. The request is asynchronous. Application launched |
|
52 as stand-alone app, not embedded. |
|
53 */ |
|
54 SchemeHandler::SchemeHandlerError |
|
55 QtHighwaySchemeHandlerPrivate::SendStandardUriViewRequest(const QUrl& url) |
|
56 { |
|
57 SchemeHandler::SchemeHandlerError retVal = SchemeHandler::NoError; |
|
58 XQAiwRequest *request = NULL; // Application Interworking request |
|
59 bool embedded = false; // window groups not chained |
|
60 |
|
61 // Create request - Apply first implementation of url, "com.nokia.symbian.IUriView" |
|
62 // interface name and "view(QString)" operation. |
|
63 request = mAiwMgr.create(url, embedded); |
|
64 |
|
65 if (request) { |
|
66 // Debug - what service and interface are we using? |
|
67 //XQAiwInterfaceDescriptor const &desc = request->descriptor(); |
|
68 //qDebug() << "HandleTelScheme: sn=" << desc.serviceName() << "if=" << desc.interfaceName(); |
|
69 |
|
70 // Set function parameters |
|
71 QList<QVariant> args; |
|
72 args << url.toString(); |
|
73 request->setArguments(args); |
|
74 request->setEmbedded(embedded); |
|
75 request->setSynchronous(false); // asynchronous request |
|
76 |
|
77 // Send the request |
|
78 if (!request->send()) { |
|
79 // to debug get error code from request->lastError() |
|
80 // or connect to requestError() signal |
|
81 retVal = SchemeHandler::LaunchFailed; |
|
82 } |
|
83 } else { |
|
84 // failed to create request - maybe scheme is unsupported |
|
85 retVal = SchemeHandler::SchemeUnsupported; |
|
86 } |
|
87 |
|
88 // if need to get service result connect to requestOk() signal |
|
89 |
|
90 // currently not interested in requestOk() or requestError() signals so |
|
91 // OK to delete request now |
|
92 delete request; |
|
93 |
|
94 return retVal; |
|
95 } |
|
96 |
|
97 } // WRT |