87
|
1 |
/*
|
85
|
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 |
|
86
|
18 |
#include <QDir>
|
|
19 |
#include <HbIcon>
|
|
20 |
|
85
|
21 |
|
|
22 |
#include "caobjectadapter.h"
|
|
23 |
#include "caentry.h"
|
|
24 |
#include "caicondescription.h"
|
86
|
25 |
#include <cadefs.h>
|
85
|
26 |
|
98
|
27 |
/*!
|
|
28 |
* Create an icon.
|
|
29 |
* \param entry a CaEntry instance.
|
|
30 |
* \param size a size of the icon
|
|
31 |
* \retval a HbIcon instance.
|
|
32 |
*/
|
86
|
33 |
HbIcon CaObjectAdapter::makeIcon(const CaEntry &entry, const QSize &size)
|
85
|
34 |
{
|
86
|
35 |
HbIcon icon;
|
|
36 |
QString filename(entry.iconDescription().filename());
|
87
|
37 |
if (!filename.isEmpty()) {
|
86
|
38 |
icon = HbIcon(filename);
|
92
|
39 |
//icon.addBadge( Qt::AlignTop | Qt::AlignRight, HbIcon("qtg_small_hs_widget"));
|
85
|
40 |
}
|
86
|
41 |
if (icon.isNull() || !(icon.size().isValid())) {
|
92
|
42 |
icon = HbIcon("qtg_large_application");
|
85
|
43 |
}
|
|
44 |
return icon;
|
|
45 |
}
|
|
46 |
|
86
|
47 |
|
98
|
48 |
/*!
|
|
49 |
* Set entry id.
|
|
50 |
* \param entry entry.
|
|
51 |
* \param id entry id.
|
|
52 |
*/
|
|
53 |
void CaObjectAdapter::setId(CaEntry &entry, int id)
|
85
|
54 |
{
|
|
55 |
entry.setId(id);
|
|
56 |
}
|
|
57 |
|
98
|
58 |
/*!
|
|
59 |
* Set icon description id.
|
|
60 |
* \param iconDescription icon description.
|
|
61 |
* \param id icon description id.
|
|
62 |
*/
|
|
63 |
void CaObjectAdapter::setId(CaIconDescription &iconDescription, int id)
|
85
|
64 |
{
|
|
65 |
iconDescription.setId(id);
|
|
66 |
}
|
|
67 |
|
98
|
68 |
/**
|
|
69 |
* Convert Symbian error code to error code (used in QT code).
|
|
70 |
* \param internalErrorCode Symbian error code.
|
|
71 |
* \retval converted error code (ErrorCode enum).
|
|
72 |
*/
|
96
|
73 |
ErrorCode CaObjectAdapter::convertErrorCode(int internalErrorCode)
|
|
74 |
{
|
|
75 |
ErrorCode error(NoErrorCode);
|
|
76 |
switch (internalErrorCode) {
|
|
77 |
case 0:
|
|
78 |
error = NoErrorCode;
|
|
79 |
break;
|
|
80 |
default:
|
|
81 |
error = UnknownErrorCode;
|
|
82 |
break;
|
|
83 |
}
|
|
84 |
return error;
|
|
85 |
}
|
|
86 |
|