88
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
96
|
18 |
#include <QDesktopServices>
|
|
19 |
#include <QUrl>
|
|
20 |
|
|
21 |
#include <caentry.h>
|
88
|
22 |
|
|
23 |
#include "caurlhandler.h"
|
|
24 |
|
96
|
25 |
static const QString caAttrUrl("url");
|
88
|
26 |
|
98
|
27 |
/*!
|
|
28 |
* Constructor.
|
|
29 |
*/
|
96
|
30 |
CaUrlHandler::CaUrlHandler(QObject *parent)
|
|
31 |
{
|
|
32 |
Q_UNUSED(parent);
|
|
33 |
}
|
88
|
34 |
|
98
|
35 |
/*!
|
|
36 |
* Destructor.
|
|
37 |
*/
|
96
|
38 |
CaUrlHandler::~CaUrlHandler()
|
|
39 |
{
|
|
40 |
}
|
88
|
41 |
|
98
|
42 |
/*!
|
|
43 |
* Execute a given command.
|
|
44 |
* \param entry a reference to CaEntry instance.
|
|
45 |
* \param command a given command.
|
116
|
46 |
* \param receiver a QObject class with slot to invoke.
|
|
47 |
* \param member a slot to invoke.
|
98
|
48 |
* \retval an error code.
|
|
49 |
*/
|
116
|
50 |
int CaUrlHandler::execute(const CaEntry &entry, const QString &command,
|
|
51 |
QObject* receiver, const char* member)
|
96
|
52 |
{
|
116
|
53 |
Q_UNUSED(receiver);
|
|
54 |
Q_UNUSED(member);
|
|
55 |
|
96
|
56 |
int err(KErrGeneral);
|
|
57 |
if (command == caCmdOpen) {
|
|
58 |
QString attribute = entry.attribute(caAttrUrl);
|
|
59 |
if (!attribute.isNull() &&
|
|
60 |
QDesktopServices::openUrl(QUrl(attribute))) {
|
|
61 |
err = KErrNone;
|
88
|
62 |
}
|
|
63 |
}
|
96
|
64 |
return err;
|
|
65 |
}
|