|
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: caentry.h |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CAENTRY_H |
|
19 #define CAENTRY_H |
|
20 |
|
21 #include <HbIcon> |
|
22 #include <QMap> |
|
23 #include <QSharedDataPointer> |
|
24 #include <QSize> |
|
25 #include <cadefs.h> |
|
26 |
|
27 #include "caicondescription.h" |
|
28 class HbIcon; |
|
29 |
|
30 class CaEntry |
|
31 { |
|
32 |
|
33 public: |
|
34 mutable EntryRole mCaEntryRole; |
|
35 mutable int mIdResult; |
|
36 mutable QString mTextResult; |
|
37 mutable CaIconDescription mSetCaIconDescription; |
|
38 mutable EntryFlags mFlagsResult; |
|
39 mutable QString mEntryTypeNameResult; |
|
40 mutable QMap<QString, QString> mAttributes; |
|
41 mutable QSizeF mMakeIconSize; |
|
42 mutable HbIcon mMakeIconResult; |
|
43 explicit CaEntry(EntryRole entryRole = ItemEntryRole): |
|
44 mCaEntryRole(entryRole), |
|
45 mIdResult(0) |
|
46 { |
|
47 mCaEntryRole = entryRole; |
|
48 } |
|
49 |
|
50 int id() const |
|
51 { |
|
52 return mIdResult; |
|
53 } |
|
54 |
|
55 QString text() const |
|
56 { |
|
57 return mTextResult; |
|
58 } |
|
59 |
|
60 void setText(const QString &text) |
|
61 { |
|
62 mTextResult = text; |
|
63 } |
|
64 |
|
65 void setIconDescription(const CaIconDescription &iconDescription) |
|
66 { |
|
67 mSetCaIconDescription = iconDescription; |
|
68 } |
|
69 EntryFlags flags() const |
|
70 { |
|
71 return mFlagsResult; |
|
72 } |
|
73 void setFlags(EntryFlags flags) |
|
74 { |
|
75 mFlagsResult = flags; |
|
76 } |
|
77 |
|
78 QString entryTypeName() const |
|
79 { |
|
80 return mEntryTypeNameResult; |
|
81 } |
|
82 |
|
83 void setEntryTypeName(const QString &entryTypeName) |
|
84 { |
|
85 mEntryTypeNameResult = entryTypeName; |
|
86 } |
|
87 |
|
88 void setAttribute(const QString &name, const QString &value) |
|
89 { |
|
90 mAttributes.insert(name, value); |
|
91 } |
|
92 QString attribute(const QString &name) const |
|
93 { |
|
94 return mAttributes[name]; |
|
95 } |
|
96 |
|
97 HbIcon makeIcon(const QSizeF &size = QSize(70, 70)) const |
|
98 { |
|
99 mMakeIconSize = size; |
|
100 return mMakeIconResult; |
|
101 } |
|
102 |
|
103 EntryRole role() const |
|
104 { |
|
105 return mCaEntryRole; |
|
106 } |
|
107 |
|
108 // test helper, not belonging to ContentStorage CaEntry |
|
109 void clear() |
|
110 { |
|
111 mCaEntryRole = ItemEntryRole; |
|
112 mIdResult = 0; |
|
113 mTextResult.clear(); |
|
114 mSetCaIconDescription.clear(); |
|
115 mFlagsResult = 0; |
|
116 mEntryTypeNameResult.clear(); |
|
117 mAttributes.clear(); |
|
118 mMakeIconSize.setHeight(-1); |
|
119 mMakeIconSize.setWidth(-1); |
|
120 } |
|
121 }; |
|
122 |
|
123 #endif // CAENTRY_H |