85
|
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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef OBJECTADAPTER_H
|
|
19 |
#define OBJECTADAPTER_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
|
|
23 |
// CLASS DECLARATION
|
|
24 |
#include <QList>
|
|
25 |
|
|
26 |
#include <cadefs.h>
|
|
27 |
|
|
28 |
#include "cainnernotifierfilter.h"
|
|
29 |
#include "canotifier.h"
|
|
30 |
#include "canotifier_p.h"
|
|
31 |
#include "cainnerquery.h"
|
|
32 |
|
|
33 |
class CaEntry;
|
|
34 |
class CaQuery;
|
|
35 |
class CaNotifierFilter;
|
|
36 |
class CCaInnerEntry;
|
|
37 |
class CCaInnerNotifierFilter;
|
86
|
38 |
class HbIcon;
|
|
39 |
class CFbsBitmap;
|
85
|
40 |
|
|
41 |
/**
|
|
42 |
* CaObjectAdapter
|
|
43 |
*
|
|
44 |
*/
|
|
45 |
class CaObjectAdapter
|
|
46 |
{
|
|
47 |
public:
|
|
48 |
|
|
49 |
//Static convertion methods between Symbian and Qt objects
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Converts entry to inner entry.
|
|
53 |
* @param fromEntry entry to be converted
|
|
54 |
* @param toEntry inner entry resulting from conversion
|
|
55 |
*/
|
|
56 |
static void convertL(
|
|
57 |
const CaEntry& fromEntry,
|
|
58 |
CCaInnerEntry& toEntry);
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Converts inner entry to entry.
|
|
62 |
* @param fromEntry inner entry to be converted
|
|
63 |
* @param toEntry entry resulting from conversino
|
|
64 |
*/
|
|
65 |
static void convert(const CCaInnerEntry& fromEntry,
|
|
66 |
CaEntry& toEntry);
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Converts query to inner query.
|
|
70 |
* @param fromQuery query to be converted
|
|
71 |
* @param toQuery inner query resutling from conversion
|
|
72 |
*/
|
|
73 |
static void convertL(
|
|
74 |
const CaQuery& fromQuery,
|
|
75 |
CCaInnerQuery& toQuery);
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Wraps a QString internal buffer into TPtrC object.
|
|
79 |
* The returned object is valid until QString internal buffer changes
|
|
80 |
* or the object is destroyed.
|
|
81 |
* @param string QString.
|
|
82 |
* @return descriptor.
|
|
83 |
*/
|
|
84 |
static const TPtrC convertToDescriptor(const QString& string);
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Converts descriptor to QString.
|
|
88 |
* @param des descriptor.
|
|
89 |
* @return QString.
|
|
90 |
*/
|
|
91 |
static QString convertToString(const TDesC& des);
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Converts inner entry table to QList of pointers to entries.
|
|
95 |
* @param fromEntriesArray an array containing inner entries
|
|
96 |
* for conversion.
|
|
97 |
* @param toEntriesArray list of converted entries.
|
|
98 |
*/
|
|
99 |
static void convertL(
|
|
100 |
const RPointerArray<CCaInnerEntry>& fromEntriesArray,
|
|
101 |
QList<CaEntry*>& toEntriesArray);
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Converts QList of ids to RArray of TInts.
|
|
105 |
* @param fromEntryIdList list of entry id
|
|
106 |
* @param toEntryIdArray array of entry ids
|
|
107 |
*/
|
|
108 |
static void convertL(const QList<int> &fromEntryIdList,
|
|
109 |
RArray<TInt>& toEntryIdArray);
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Converts RArray of TInts to QList of ids.
|
|
113 |
* @param fromEntryIdList an array of entry ids.
|
|
114 |
* @param toEntryIdList resulgin list of entry ids.
|
|
115 |
*/
|
|
116 |
static void convertL(const RArray<TInt>& fromEntryIdList,
|
|
117 |
QList<int>& toEntryIdList);
|
|
118 |
|
|
119 |
/**
|
|
120 |
* Converts symbian error code to error code (used in QT code).
|
|
121 |
*/
|
|
122 |
static ErrorCode convertErrorCode(
|
|
123 |
TInt internalErrorCode);
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Creates icon.
|
|
127 |
* @param entry entry.
|
86
|
128 |
* @return HbIcon.
|
85
|
129 |
*/
|
86
|
130 |
static HbIcon makeIcon(const CaEntry& entry, const QSize &size);
|
85
|
131 |
|
|
132 |
/**
|
|
133 |
* Converts notifier type to inner notifier type.
|
|
134 |
* @param from notifier type.
|
|
135 |
* @param to resulting inner notifier type.
|
|
136 |
*/
|
|
137 |
static void convert(
|
|
138 |
CaNotifierPrivate::NotifierType from,
|
|
139 |
CCaInnerNotifierFilter::TNotifierType& to);
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Converts inner change type to change type.
|
|
143 |
* @param from inner change type.
|
|
144 |
* @param to resulting change type.
|
|
145 |
*/
|
|
146 |
static void convert(
|
|
147 |
TChangeType src, ChangeType& dest);
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Converts filter to inner filter.
|
|
151 |
* @param from notifier filter.
|
|
152 |
* @param to resulting notifier filter.
|
|
153 |
*/
|
|
154 |
static void convertL(
|
|
155 |
const CaNotifierFilter &from,
|
|
156 |
CCaInnerNotifierFilter &to);
|
|
157 |
|
|
158 |
/**
|
|
159 |
* @return uid attribute name
|
|
160 |
*/
|
|
161 |
static const QString& applicationUidAttributeName();
|
|
162 |
|
|
163 |
/**
|
|
164 |
* @return attribute type name
|
|
165 |
*/
|
|
166 |
static const QString& applicationEntryName();
|
|
167 |
|
|
168 |
/**
|
|
169 |
* @return widget type name
|
|
170 |
*/
|
|
171 |
static const QString& widgetEntryName();
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Set entry id.
|
|
175 |
* @param entry entry.
|
|
176 |
* @param id entry id.
|
|
177 |
*/
|
|
178 |
static void setId(CaEntry &entry,
|
|
179 |
int id);
|
|
180 |
|
|
181 |
private:
|
|
182 |
/**
|
|
183 |
* Creates icon. Leaving version.
|
|
184 |
* @param entry entry.
|
86
|
185 |
* @return HbIcon.
|
85
|
186 |
*/
|
86
|
187 |
static HbIcon makeIconL(const CaEntry& entry, const QSize &size);
|
85
|
188 |
|
|
189 |
/**
|
|
190 |
* Make bitmap copy, used to get rid of compression for extended bitmap
|
|
191 |
* @param input input bitmap.
|
|
192 |
* @return copied bitmap.
|
|
193 |
*/
|
|
194 |
static CFbsBitmap* copyBitmapLC(CFbsBitmap* input);
|
|
195 |
|
|
196 |
/**
|
|
197 |
* Maps a given sort subject and the order to be applied
|
|
198 |
* into a sort code used
|
|
199 |
* @param sortAttribute - what is to be sorted
|
|
200 |
* @param sortOrder - how it is to be sorted
|
|
201 |
* @return sort code corresponding to input parameters
|
|
202 |
*/
|
|
203 |
static CCaInnerQuery::TSortAttribute getSortCode(
|
|
204 |
SortAttribute sortAttribute,
|
|
205 |
Qt::SortOrder sortOrder);
|
|
206 |
|
|
207 |
};
|
|
208 |
|
|
209 |
#endif // OBJECTADAPTER_H
|