changeset 30 | cc1cea6aabaf |
parent 26 | aad866c37519 |
26:aad866c37519 | 30:cc1cea6aabaf |
---|---|
39 #include <hbdataformmodelitem.h> |
39 #include <hbdataformmodelitem.h> |
40 #include <hbmainwindow.h> |
40 #include <hbmainwindow.h> |
41 #include <hbabstractviewitem.h> |
41 #include <hbabstractviewitem.h> |
42 |
42 |
43 #include <memory> |
43 #include <memory> |
44 |
44 #include <../../inc/cpsecplugins.h> |
45 #include "cpmoduleview.h" |
45 #include "cpmoduleview.h" |
46 #include "cpsecmodmodel.h" |
46 #include "cpsecmodmodel.h" |
47 #include "cpsecmodview.h" |
47 #include "cpsecmodview.h" |
48 |
48 |
49 CpModuleView::CpModuleView( CpSecModView::TSecModViews currentView, |
49 CpModuleView::CpModuleView( CpSecModView::TSecModViews currentView, |
51 QGraphicsItem *parent /*= 0*/ ) |
51 QGraphicsItem *parent /*= 0*/ ) |
52 : CpBaseSettingView(0,parent), |
52 : CpBaseSettingView(0,parent), |
53 mCurrentView(currentView), |
53 mCurrentView(currentView), |
54 mSecModUIModel(secModUIModel) |
54 mSecModUIModel(secModUIModel) |
55 { |
55 { |
56 RDEBUG("0", 0); |
|
56 QString title = mSecModUIModel.TokenLabelForTitle(); |
57 QString title = mSecModUIModel.TokenLabelForTitle(); |
57 setTitle(title); |
58 setTitle(title); |
59 |
|
60 mContextMenu = (q_check_ptr(new HbMenu())); |
|
58 |
61 |
59 if(currentView == CpSecModView::EAccessView) |
62 if(currentView == CpSecModView::EAccessView) |
60 { |
63 { |
61 showAccessView(); |
64 showAccessView(); |
62 } |
65 } |
69 CpModuleView::~CpModuleView() |
72 CpModuleView::~CpModuleView() |
70 {} |
73 {} |
71 |
74 |
72 void CpModuleView::showAccessView() |
75 void CpModuleView::showAccessView() |
73 { |
76 { |
77 RDEBUG("0", 0); |
|
74 HbMenu* menu = this->menu(); |
78 HbMenu* menu = this->menu(); |
75 std::auto_ptr<HbAction> endAction(q_check_ptr(new HbAction("Module Info"))); |
79 std::auto_ptr<HbAction> endAction(q_check_ptr(new HbAction("Module Info"))); |
76 connect(endAction.get(), SIGNAL(triggered()), this, SLOT(saveProv())); |
80 connect(endAction.get(), SIGNAL(triggered()), this, SLOT(saveProv())); |
77 |
81 |
78 menu->addAction(endAction.get()); |
82 menu->addAction(endAction.get()); |
93 else |
97 else |
94 { |
98 { |
95 const TDesC& label = mSecModUIModel.AuthObj(KPinGSettIndex).Label(); |
99 const TDesC& label = mSecModUIModel.AuthObj(KPinGSettIndex).Label(); |
96 titleName = QString((QChar*)label.Ptr(), label.Length()); |
100 titleName = QString((QChar*)label.Ptr(), label.Length()); |
97 } |
101 } |
98 |
102 RDEBUG("0", 0); |
99 HbListWidget* accessDetails = q_check_ptr(new HbListWidget(this)); |
103 HbListWidget* accessDetails = q_check_ptr(new HbListWidget(this)); |
100 |
104 |
101 std::auto_ptr<HbListWidgetItem> codeLabel(q_check_ptr(new HbListWidgetItem())); |
105 std::auto_ptr<HbListWidgetItem> codeLabel(q_check_ptr(new HbListWidgetItem())); |
102 codeLabel->setText(titleName); |
106 codeLabel->setText(titleName); |
103 accessDetails->addItem(codeLabel.get()); |
107 accessDetails->addItem(codeLabel.get()); |
120 { |
124 { |
121 requestText->setText("On"); |
125 requestText->setText("On"); |
122 } |
126 } |
123 accessDetails->addItem(requestText.get()); |
127 accessDetails->addItem(requestText.get()); |
124 requestText.release(); |
128 requestText.release(); |
125 |
129 RDEBUG("0", 0); |
126 std::auto_ptr<HbListWidgetItem> statusLabel(q_check_ptr(new HbListWidgetItem())); |
130 std::auto_ptr<HbListWidgetItem> statusLabel(q_check_ptr(new HbListWidgetItem())); |
127 statusLabel->setText("Status"); |
131 statusLabel->setText("Status"); |
128 accessDetails->addItem(statusLabel.get()); |
132 accessDetails->addItem(statusLabel.get()); |
129 statusLabel.release(); |
133 statusLabel.release(); |
130 |
134 |
140 layout->addItem(accessDetails); |
144 layout->addItem(accessDetails); |
141 layout->addItem(form.get()); |
145 layout->addItem(form.get()); |
142 form.release(); |
146 form.release(); |
143 setLayout(layout.get()); |
147 setLayout(layout.get()); |
144 layout.release(); |
148 layout.release(); |
149 RDEBUG("0", 0); |
|
145 } |
150 } |
146 |
151 |
147 void CpModuleView::showSignatureView(TBool showBlockedNote) |
152 void CpModuleView::showSignatureView(TBool showBlockedNote) |
148 { |
153 { |
154 RDEBUG("0", 0); |
|
149 mCurrentView = CpSecModView::ESignatureView; |
155 mCurrentView = CpSecModView::ESignatureView; |
150 std::auto_ptr<QGraphicsLinearLayout> layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); |
156 std::auto_ptr<QGraphicsLinearLayout> layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); |
151 std::auto_ptr<HbDataForm> form(q_check_ptr(new HbDataForm())); |
157 std::auto_ptr<HbDataForm> form(q_check_ptr(new HbDataForm())); |
152 std::auto_ptr<HbDataFormModel> formModel(q_check_ptr(new HbDataFormModel())); |
158 std::auto_ptr<HbDataFormModel> formModel(q_check_ptr(new HbDataFormModel())); |
153 |
159 |
156 |
162 |
157 HbListWidget* accessDetails = q_check_ptr(new HbListWidget(this)); |
163 HbListWidget* accessDetails = q_check_ptr(new HbListWidget(this)); |
158 |
164 |
159 while(authDetailsIter.hasNext()) |
165 while(authDetailsIter.hasNext()) |
160 { |
166 { |
161 authDetailsIter.next(); |
167 QPair<QString, TUint32> pair = authDetailsIter.next(); |
162 QPair<QString, TUint32> pair; |
|
163 QString label = pair.first; |
168 QString label = pair.first; |
164 TUint32 status = pair.second; |
169 TUint32 status = pair.second; |
165 QString blockedDetails = NULL; |
170 QString blockedDetails = NULL; |
166 if ( status & EAuthObjectBlocked) |
171 if ( status & EAuthObjectBlocked) |
167 { |
172 { |
174 } |
179 } |
175 totalBlocked.prepend(label); |
180 totalBlocked.prepend(label); |
176 HbMessageBox::information(totalBlocked); |
181 HbMessageBox::information(totalBlocked); |
177 } |
182 } |
178 blockedDetails = label.append(" Blocked"); |
183 blockedDetails = label.append(" Blocked"); |
179 |
184 RDEBUG("0", 0); |
180 std::auto_ptr<HbListWidgetItem> statusLabel(q_check_ptr(new HbListWidgetItem())); |
185 std::auto_ptr<HbListWidgetItem> statusLabel(q_check_ptr(new HbListWidgetItem())); |
181 statusLabel->setText(tr("Status")); |
186 statusLabel->setText(tr("Status")); |
182 accessDetails->addItem(statusLabel.get()); |
187 accessDetails->addItem(statusLabel.get()); |
183 statusLabel.release(); |
188 statusLabel.release(); |
184 |
189 |
210 |
215 |
211 layout->addItem(form.get()); |
216 layout->addItem(form.get()); |
212 form.release(); |
217 form.release(); |
213 setLayout(layout.get()); |
218 setLayout(layout.get()); |
214 layout.release(); |
219 layout.release(); |
220 RDEBUG("0", 0); |
|
215 } |
221 } |
216 |
222 |
217 void CpModuleView::indicateLongPress(HbAbstractViewItem *item,QPointF coords) |
223 void CpModuleView::indicateLongPress(HbAbstractViewItem *item,QPointF coords) |
218 { |
224 { |
219 try |
225 RDEBUG("0", 0); |
220 { |
226 try |
221 std::auto_ptr<HbMenu> contextMenu(q_check_ptr(new HbMenu())); |
227 { |
228 mContextMenu->clearActions(); |
|
222 mPos = item->modelIndex().row(); |
229 mPos = item->modelIndex().row(); |
223 |
230 |
224 if(mCurrentView == CpSecModView::EAccessView) |
231 if(mCurrentView == CpSecModView::EAccessView) |
225 { |
232 { |
226 if( mPos == EIndexCodeLabel && mSecModUIModel.PinChangeable(KPinGSettIndex) |
233 if( mPos == EIndexCodeLabel && mSecModUIModel.PinChangeable(KPinGSettIndex) |
227 || mPos == EIndexCodeRequest && mSecModUIModel.PinRequestChangeable(KPinGSettIndex) |
234 || mPos == EIndexCodeRequest && mSecModUIModel.PinRequestChangeable(KPinGSettIndex) |
228 || mPos == EIndexCodeStatus ) |
235 || mPos == EIndexCodeStatus ) |
229 { |
236 { |
230 std::auto_ptr<HbAction> changePIN(q_check_ptr(new HbAction("Change"))); |
237 std::auto_ptr<HbAction> changePIN(q_check_ptr(new HbAction("Change"))); |
231 connect(changePIN.get(), SIGNAL(triggered()), this, SLOT( handleAccessView())); |
238 connect(changePIN.get(), SIGNAL(triggered()), this, SLOT( handleAccessView())); |
232 contextMenu->addAction(changePIN.get()); |
239 mContextMenu->addAction(changePIN.get()); |
233 changePIN.release(); |
240 changePIN.release(); |
234 } |
241 } |
235 if( mSecModUIModel.PinUnblockable(KPinGSettIndex) ) |
242 if( mSecModUIModel.PinUnblockable(KPinGSettIndex) ) |
236 { |
243 { |
237 std::auto_ptr<HbAction> unblockPIN(q_check_ptr(new HbAction("Unblock"))); |
244 std::auto_ptr<HbAction> unblockPIN(q_check_ptr(new HbAction("Unblock"))); |
238 connect(unblockPIN.get(), SIGNAL(triggered()), this, SLOT( handleAccessView())); |
245 connect(unblockPIN.get(), SIGNAL(triggered()), this, SLOT( handleAccessView())); |
239 contextMenu->addAction(unblockPIN.get()); |
246 mContextMenu->addAction(unblockPIN.get()); |
240 unblockPIN.release(); |
247 unblockPIN.release(); |
241 } |
248 } |
242 if( mSecModUIModel.PinOpen(KPinGSettIndex) ) |
249 if( mSecModUIModel.PinOpen(KPinGSettIndex) ) |
243 { |
250 { |
244 std::auto_ptr<HbAction> closePIN(q_check_ptr(new HbAction("Close"))); |
251 std::auto_ptr<HbAction> closePIN(q_check_ptr(new HbAction("Close"))); |
245 connect(closePIN.get(), SIGNAL(triggered()), this, SLOT( handleAccessView())); |
252 connect(closePIN.get(), SIGNAL(triggered()), this, SLOT( handleAccessView())); |
246 contextMenu->addAction(closePIN.get()); |
253 mContextMenu->addAction(closePIN.get()); |
247 closePIN.release(); |
254 closePIN.release(); |
248 } |
255 } |
249 } |
256 } |
250 else if(mCurrentView == CpSecModView::ESignatureView) |
257 else if(mCurrentView == CpSecModView::ESignatureView) |
251 { |
258 { |
252 if (mSecModUIModel.PinChangeable(KPinNrSettIndex)) |
259 if (mSecModUIModel.PinChangeable(KPinNrSettIndex)) |
253 { |
260 { |
254 std::auto_ptr<HbAction> changePIN(q_check_ptr(new HbAction("Change"))); |
261 std::auto_ptr<HbAction> changePIN(q_check_ptr(new HbAction("Change"))); |
255 connect(changePIN.get(), SIGNAL(triggered()), this, SLOT( handleSigViewCommand())); |
262 connect(changePIN.get(), SIGNAL(triggered()), this, SLOT( handleSigViewCommand())); |
256 contextMenu->addAction(changePIN.get()); |
263 mContextMenu->addAction(changePIN.get()); |
257 changePIN.release(); |
264 changePIN.release(); |
258 } |
265 } |
259 if (mSecModUIModel.PinUnblockable(KPinNrSettIndex)) |
266 if (mSecModUIModel.PinUnblockable(KPinNrSettIndex)) |
260 { |
267 { |
261 std::auto_ptr<HbAction> unblockPIN(q_check_ptr(new HbAction("Unblock"))); |
268 std::auto_ptr<HbAction> unblockPIN(q_check_ptr(new HbAction("Unblock"))); |
262 connect(unblockPIN.get(), SIGNAL(triggered()), this, SLOT( handleSigViewCommand())); |
269 connect(unblockPIN.get(), SIGNAL(triggered()), this, SLOT( handleSigViewCommand())); |
263 contextMenu->addAction(unblockPIN.get()); |
270 mContextMenu->addAction(unblockPIN.get()); |
264 unblockPIN.release(); |
271 unblockPIN.release(); |
265 } |
272 } |
266 } |
273 } |
267 |
274 |
268 contextMenu->open(); |
275 mContextMenu->setPreferredPos(coords); |
269 contextMenu->setPreferredPos(coords); |
276 mContextMenu->open(); |
270 } |
277 } |
271 catch(const std::exception& exception) |
278 catch(const std::exception& exception) |
272 { |
279 { |
273 HbMessageBox::information(exception.what()); |
280 HbMessageBox::information(exception.what()); |
274 } |
281 } |
282 RDEBUG("0", 0); |
|
275 } |
283 } |
276 |
284 |
277 void CpModuleView::handleAccessView( const QModelIndex& modelIndex ) |
285 void CpModuleView::handleAccessView( const QModelIndex& modelIndex ) |
278 { |
286 { |
287 RDEBUG("0", 0); |
|
279 try |
288 try |
280 { |
289 { |
281 mPos = modelIndex.row(); |
290 mPos = modelIndex.row(); |
282 handleAccessView(); |
291 handleAccessView(); |
283 } |
292 } |
287 } |
296 } |
288 } |
297 } |
289 |
298 |
290 void CpModuleView::handleAccessView() |
299 void CpModuleView::handleAccessView() |
291 { |
300 { |
301 RDEBUG("0", 0); |
|
292 try |
302 try |
293 { |
303 { |
294 if(mPos == EIndexCodeLabel) |
304 if(mPos == EIndexCodeLabel) |
295 { |
305 { |
296 QT_TRAP_THROWING(mSecModUIModel.ChangeOrUnblockPinL(KPinGSettIndex)); |
306 QT_TRAP_THROWING(mSecModUIModel.ChangeOrUnblockPinL(KPinGSettIndex)); |
314 } |
324 } |
315 } |
325 } |
316 |
326 |
317 void CpModuleView::handleSigView() |
327 void CpModuleView::handleSigView() |
318 { |
328 { |
329 RDEBUG("0", 0); |
|
319 try |
330 try |
320 { |
331 { |
321 QT_TRAP_THROWING(mSecModUIModel.ChangeOrUnblockPinL(KPinNrSettIndex)); |
332 QT_TRAP_THROWING(mSecModUIModel.ChangeOrUnblockPinL(KPinNrSettIndex)); |
322 showSignatureView(EFalse); |
333 showSignatureView(EFalse); |
323 } |
334 } |
327 } |
338 } |
328 } |
339 } |
329 |
340 |
330 void CpModuleView::handleSigViewCommand() |
341 void CpModuleView::handleSigViewCommand() |
331 { |
342 { |
343 RDEBUG("0", 0); |
|
332 try |
344 try |
333 { |
345 { |
334 switch(mPos) |
346 switch(mPos) |
335 { |
347 { |
336 case ESecModUICmdChange: |
348 case ESecModUICmdChange: |