31
|
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 |
#include "cpsettingformentryitemdata.h"
|
36
|
18 |
#include "cpsettingformentryitemdata_p.h"
|
31
|
19 |
#include "cpviewlauncher.h"
|
|
20 |
#include <cpbasesettingview.h>
|
|
21 |
|
|
22 |
|
|
23 |
/*!
|
|
24 |
\class CpSettingFormEntryItemData
|
|
25 |
\brief The CpSettingFormEntryItemData can be used to control panel plugin which appears as a setting item. And after clicking
|
|
26 |
it, a new setting view will open.
|
|
27 |
*/
|
|
28 |
|
|
29 |
/*
|
|
30 |
\fn CpSettingFormEntryItemData::createSettingView
|
|
31 |
|
|
32 |
Create a new setting view.
|
|
33 |
|
|
34 |
createSettingView will be called automatically when user click a setting item represented by a CpSettingFormEntryItemData.
|
|
35 |
|
|
36 |
In most cases, you do not need to write a derived class from CpSettingFormEntryItemData, instead, you can simply use template class CpSettingFormEntryItemDataImpl.
|
|
37 |
*/
|
|
38 |
|
|
39 |
|
|
40 |
/*!
|
|
41 |
Construct a new CpSettingFormEntryItemData with the given parent.
|
|
42 |
*/
|
|
43 |
CpSettingFormEntryItemData::CpSettingFormEntryItemData(const HbDataFormModelItem *parent /* = 0*/)
|
36
|
44 |
: CpSettingFormItemData(parent), d_ptr(new CpSettingFormEntryItemDataPrivate())
|
31
|
45 |
{
|
36
|
46 |
d_ptr->init(this);
|
31
|
47 |
}
|
|
48 |
|
|
49 |
|
|
50 |
/*!
|
|
51 |
Construct a new CpSettingFormEntryItemData with the given text,description and parent.
|
|
52 |
*/
|
|
53 |
|
|
54 |
CpSettingFormEntryItemData::CpSettingFormEntryItemData(CpItemDataHelper &itemDataHelper,
|
|
55 |
const QString &text /* = QString()*/,
|
|
56 |
const QString &description /* = QString()*/,
|
|
57 |
const HbIcon &icon,
|
|
58 |
const HbDataFormModelItem *parent /*= 0*/) :
|
36
|
59 |
CpSettingFormItemData(HbDataFormModelItem::CustomItemBase,QString(),parent),
|
|
60 |
d_ptr(new CpSettingFormEntryItemDataPrivate(&itemDataHelper))
|
31
|
61 |
{
|
36
|
62 |
setType ( static_cast<HbDataFormModelItem::DataItemType> (CpSettingFormEntryItemData::ListEntryItem) );
|
|
63 |
|
|
64 |
d_ptr->init(this);
|
|
65 |
|
|
66 |
setText(text);
|
|
67 |
setDescription(description);
|
|
68 |
setIcon(icon.iconName());
|
31
|
69 |
}
|
|
70 |
|
|
71 |
/*!
|
|
72 |
Construct a new CpSettingFormEntryItemData with the given text,description and parent.
|
|
73 |
*/
|
|
74 |
|
|
75 |
CpSettingFormEntryItemData::CpSettingFormEntryItemData(HbDataForm *dataForm,
|
36
|
76 |
const QString &text /*= QString()*/,
|
|
77 |
const QString &description /*= QString()*/,
|
|
78 |
const HbIcon &icon /*= HbIcon()*/,
|
|
79 |
const HbDataFormModelItem *parent/* = 0*/) :
|
|
80 |
CpSettingFormItemData(HbDataFormModelItem::CustomItemBase,QString(),parent),
|
|
81 |
d_ptr(new CpSettingFormEntryItemDataPrivate(dataForm))
|
|
82 |
{
|
|
83 |
setType ( static_cast<HbDataFormModelItem::DataItemType> (CpSettingFormEntryItemData::ListEntryItem) );
|
|
84 |
|
|
85 |
d_ptr->init(this);
|
|
86 |
|
|
87 |
setText(text);
|
|
88 |
setDescription(description);
|
|
89 |
setIcon(icon.iconName());
|
|
90 |
}
|
|
91 |
|
55
|
92 |
/*!
|
|
93 |
Construct a new CpSettingFormEntryItemData with the given type, text, description, icon name, and parent.
|
|
94 |
*/
|
36
|
95 |
CpSettingFormEntryItemData::CpSettingFormEntryItemData(
|
|
96 |
EntryItemType type,
|
|
97 |
CpItemDataHelper &itemDataHelper,
|
|
98 |
const QString &text /*= QString()*/,
|
|
99 |
const QString &description /*= QString()*/,
|
|
100 |
const QString &iconName /*= QString()*/,
|
|
101 |
const HbDataFormModelItem *parent /*= 0*/) :
|
|
102 |
CpSettingFormItemData(HbDataFormModelItem::CustomItemBase,QString(),parent),
|
|
103 |
d_ptr(new CpSettingFormEntryItemDataPrivate(&itemDataHelper))
|
31
|
104 |
{
|
36
|
105 |
setType ( static_cast<HbDataFormModelItem::DataItemType> (type) );
|
|
106 |
|
|
107 |
d_ptr->init(this);
|
|
108 |
|
|
109 |
setText(text);
|
|
110 |
setDescription(description);
|
|
111 |
setIcon(iconName);
|
|
112 |
}
|
|
113 |
|
55
|
114 |
/*!
|
|
115 |
Construct a new CpSettingFormEntryItemData with the given type, text, description, icon name, and parent.
|
|
116 |
*/
|
36
|
117 |
CpSettingFormEntryItemData::CpSettingFormEntryItemData(
|
|
118 |
EntryItemType type,
|
|
119 |
HbDataForm *dataForm,
|
|
120 |
const QString &text /*= QString()*/,
|
|
121 |
const QString &description /*= QString()*/,
|
|
122 |
const QString &iconName /*= QString()*/,
|
|
123 |
const HbDataFormModelItem *parent /*= 0*/) :
|
|
124 |
CpSettingFormItemData(HbDataFormModelItem::CustomItemBase,QString(),parent),
|
|
125 |
d_ptr(new CpSettingFormEntryItemDataPrivate(dataForm))
|
|
126 |
{
|
|
127 |
setType ( static_cast<HbDataFormModelItem::DataItemType> (type) );
|
|
128 |
|
|
129 |
d_ptr->init(this);
|
|
130 |
|
|
131 |
setText(text);
|
|
132 |
setDescription(description);
|
|
133 |
setIcon(iconName);
|
31
|
134 |
}
|
|
135 |
|
|
136 |
|
|
137 |
/*!
|
|
138 |
Destructor.
|
|
139 |
*/
|
|
140 |
CpSettingFormEntryItemData::~CpSettingFormEntryItemData()
|
|
141 |
{
|
36
|
142 |
delete d_ptr;
|
31
|
143 |
}
|
|
144 |
|
|
145 |
|
|
146 |
/*!
|
|
147 |
Get the text string of the entry item.
|
|
148 |
*/
|
|
149 |
QString CpSettingFormEntryItemData::text() const
|
|
150 |
{
|
36
|
151 |
return d_ptr->text();
|
31
|
152 |
}
|
|
153 |
|
|
154 |
/*!
|
|
155 |
Set the text string of the entry item.
|
|
156 |
*/
|
|
157 |
void CpSettingFormEntryItemData::setText(const QString &text)
|
|
158 |
{
|
36
|
159 |
d_ptr->setText(text);
|
31
|
160 |
}
|
|
161 |
|
|
162 |
/*!
|
|
163 |
Get the description string of the entry item.
|
|
164 |
*/
|
|
165 |
QString CpSettingFormEntryItemData::description() const
|
|
166 |
{
|
36
|
167 |
return d_ptr->description();
|
31
|
168 |
}
|
|
169 |
|
|
170 |
/*!
|
|
171 |
Set the description string of the entry item.
|
|
172 |
*/
|
|
173 |
void CpSettingFormEntryItemData::setDescription(const QString &description)
|
|
174 |
{
|
36
|
175 |
d_ptr->setDescription(description);
|
|
176 |
}
|
|
177 |
|
55
|
178 |
/*!
|
|
179 |
Get the icon name of the entry item.
|
|
180 |
*/
|
36
|
181 |
QString CpSettingFormEntryItemData::iconName() const
|
|
182 |
{
|
|
183 |
return d_ptr->iconName();
|
|
184 |
}
|
|
185 |
|
55
|
186 |
/*!
|
|
187 |
Set the icon name of the entry item.
|
|
188 |
*/
|
36
|
189 |
void CpSettingFormEntryItemData::setIconName(const QString &icon)
|
|
190 |
{
|
|
191 |
d_ptr->setIconName(icon);
|
31
|
192 |
}
|
|
193 |
|
|
194 |
/*!
|
|
195 |
Return the icon of the entry item
|
|
196 |
*/
|
|
197 |
HbIcon CpSettingFormEntryItemData::entryItemIcon()const
|
|
198 |
{
|
36
|
199 |
return d_ptr->entryItemIcon();
|
31
|
200 |
}
|
|
201 |
|
|
202 |
/*!
|
|
203 |
Set the icon for the entry item
|
|
204 |
*/
|
|
205 |
void CpSettingFormEntryItemData::setEntryItemIcon(const HbIcon& icon)
|
|
206 |
{
|
36
|
207 |
d_ptr->setEntryItemIcon(icon);
|
31
|
208 |
}
|
|
209 |
|
55
|
210 |
/*!
|
|
211 |
Launch the setting view when user clicks the entry item.
|
|
212 |
*/
|
31
|
213 |
void CpSettingFormEntryItemData::onLaunchView()
|
|
214 |
{
|
36
|
215 |
//avoid being launched more than one times
|
|
216 |
if (d_ptr->mSettingViewPtr.isNull()) {
|
|
217 |
d_ptr->mSettingViewPtr = createSettingView();
|
|
218 |
if (!d_ptr->mSettingViewPtr.isNull()) {
|
|
219 |
CpViewLauncher::launchView(d_ptr->mSettingViewPtr.data());
|
|
220 |
}
|
|
221 |
}
|
31
|
222 |
}
|
36
|
223 |
|
|
224 |
//End of File
|