55 mSecModView(NULL), |
55 mSecModView(NULL), |
56 mPreView(NULL), |
56 mPreView(NULL), |
57 mCertView(NULL), |
57 mCertView(NULL), |
58 mCurrentView(NULL), |
58 mCurrentView(NULL), |
59 mPos(0), |
59 mPos(0), |
60 mNote(NULL) |
60 mNote(NULL), mOkAction(NULL) |
61 { |
61 { |
62 RDEBUG("0", 0); |
62 RDEBUG("0", 0); |
63 setTitle(hbTrId("txt_certificate_manager_setlabel_advanced_security")); |
63 setTitle(hbTrId("txt_certificate_manager_setlabel_advanced_security")); |
64 |
64 |
65 std::auto_ptr<QGraphicsLinearLayout> layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); |
65 std::auto_ptr<QGraphicsLinearLayout> layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); |
66 HbListWidget* listCertView = q_check_ptr(new HbListWidget(this)); |
66 HbListWidget* listCertView = q_check_ptr(new HbListWidget(this)); |
67 |
67 |
68 std::auto_ptr<HbListWidgetItem> authcert(q_check_ptr(new HbListWidgetItem())); |
68 std::auto_ptr<HbListWidgetItem> authcert(q_check_ptr(new HbListWidgetItem())); |
69 authcert->setText(hbTrId("txt_certificate_manager_list_authority_certificate")); |
69 authcert->setText(hbTrId("txt_certificate_manager_list_authority_certificate")); |
70 |
70 |
71 std::auto_ptr<HbListWidgetItem> trustedsitecert(q_check_ptr(new HbListWidgetItem())); |
71 std::auto_ptr<HbListWidgetItem> trustedsitecert(q_check_ptr(new HbListWidgetItem())); |
72 trustedsitecert->setText(hbTrId("txt_certificate_manager_list_trusted_site_certific")); |
72 trustedsitecert->setText(hbTrId("txt_certificate_manager_list_trusted_site_certific")); |
73 |
73 |
74 std::auto_ptr<HbListWidgetItem> personalcert(q_check_ptr(new HbListWidgetItem())); |
74 std::auto_ptr<HbListWidgetItem> personalcert(q_check_ptr(new HbListWidgetItem())); |
75 personalcert->setText(hbTrId("txt_certificate_manager_list_personal_certificates")); |
75 personalcert->setText(hbTrId("txt_certificate_manager_list_personal_certificates")); |
76 |
76 |
77 std::auto_ptr<HbListWidgetItem> devicecert(q_check_ptr(new HbListWidgetItem())); |
77 std::auto_ptr<HbListWidgetItem> devicecert(q_check_ptr(new HbListWidgetItem())); |
78 devicecert->setText(hbTrId("txt_certificate_manager_list_device_certificates")); |
78 devicecert->setText(hbTrId("txt_certificate_manager_list_device_certificates")); |
79 |
79 |
80 listCertView->addItem(authcert.get()); |
80 listCertView->addItem(authcert.get()); |
81 authcert.release(); |
81 authcert.release(); |
82 listCertView->addItem(trustedsitecert.get()); |
82 listCertView->addItem(trustedsitecert.get()); |
83 trustedsitecert.release(); |
83 trustedsitecert.release(); |
85 personalcert.release(); |
85 personalcert.release(); |
86 listCertView->addItem(devicecert.get()); |
86 listCertView->addItem(devicecert.get()); |
87 devicecert.release(); |
87 devicecert.release(); |
88 |
88 |
89 connect(listCertView, SIGNAL(released(QModelIndex)), this, SLOT(displayCert(QModelIndex))); |
89 connect(listCertView, SIGNAL(released(QModelIndex)), this, SLOT(displayCert(QModelIndex))); |
90 |
90 |
91 HbListWidget* listSecView = q_check_ptr(new HbListWidget(this)); |
91 HbListWidget* listSecView = q_check_ptr(new HbListWidget(this)); |
92 QMap<QString,QString> keystoreLabels; |
92 QMap<QString,QString> keystoreLabels; |
93 RDEBUG("0", 0); |
93 RDEBUG("0", 0); |
94 try |
94 try |
95 { |
95 { |
96 QT_TRAP_THROWING( |
96 QT_TRAP_THROWING( |
114 widget->setText(labelIter.key()); |
114 widget->setText(labelIter.key()); |
115 widget->setSecondaryText(labelIter.value()); |
115 widget->setSecondaryText(labelIter.value()); |
116 listSecView->addItem(widget.get()); |
116 listSecView->addItem(widget.get()); |
117 widget.release(); |
117 widget.release(); |
118 } |
118 } |
119 connect(listSecView, SIGNAL(activated(QModelIndex)), this, SLOT(showCodeView(QModelIndex))); |
119 connect(listSecView, SIGNAL(activated(QModelIndex)), this, SLOT(showCodeView(QModelIndex))); |
120 connect(listSecView, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); |
120 connect(listSecView, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); |
121 } |
121 } |
122 else |
122 else |
123 { |
123 { |
124 std::auto_ptr<HbListWidgetItem> emptyWidget(q_check_ptr(new HbListWidgetItem())); |
124 std::auto_ptr<HbListWidgetItem> emptyWidget(q_check_ptr(new HbListWidgetItem())); |
125 emptyWidget->setText("(no security modules)"); |
125 emptyWidget->setText("(no security modules)"); |
131 certificatesList->setHeading(hbTrId("txt_certificate_manager_setlabel_certificates")); |
131 certificatesList->setHeading(hbTrId("txt_certificate_manager_setlabel_certificates")); |
132 certificatesList->setContentWidget(listCertView); |
132 certificatesList->setContentWidget(listCertView); |
133 certificatesList->setCollapsed(true); |
133 certificatesList->setCollapsed(true); |
134 layout->addItem(certificatesList.get()); |
134 layout->addItem(certificatesList.get()); |
135 certificatesList.release(); |
135 certificatesList.release(); |
136 |
136 |
137 std::auto_ptr<HbGroupBox> protectedContentList(q_check_ptr(new HbGroupBox())); |
137 std::auto_ptr<HbGroupBox> protectedContentList(q_check_ptr(new HbGroupBox())); |
138 protectedContentList->setHeading("Protected Content"); |
138 protectedContentList->setHeading("Protected Content"); |
139 protectedContentList->setCollapsed(true); |
139 protectedContentList->setCollapsed(true); |
140 layout->addItem(protectedContentList.get()); |
140 layout->addItem(protectedContentList.get()); |
141 protectedContentList.release(); |
141 protectedContentList.release(); |
142 |
142 |
143 std::auto_ptr<HbGroupBox> securityModuleList(q_check_ptr(new HbGroupBox())); |
143 std::auto_ptr<HbGroupBox> securityModuleList(q_check_ptr(new HbGroupBox())); |
144 securityModuleList->setHeading("Security Module"); |
144 securityModuleList->setHeading("Security Module"); |
145 securityModuleList->setContentWidget(listSecView); |
145 securityModuleList->setContentWidget(listSecView); |
146 securityModuleList->setCollapsed(true); |
146 securityModuleList->setCollapsed(true); |
147 layout->addItem(securityModuleList.get()); |
147 layout->addItem(securityModuleList.get()); |
148 securityModuleList.release(); |
148 securityModuleList.release(); |
149 |
149 |
150 mContextMenu = q_check_ptr(new HbMenu()); |
150 mContextMenu = q_check_ptr(new HbMenu()); |
151 |
151 |
152 setLayout(layout.get()); |
152 setLayout(layout.get()); |
153 layout.release(); |
153 layout.release(); |
154 } |
154 } |
155 |
155 |
156 |
156 |
157 CpSecurityView::~CpSecurityView() |
157 CpSecurityView::~CpSecurityView() |
158 { |
158 { |
159 if(mSecModView) |
159 if(mSecModView) |
160 { |
160 { |
161 mSecModView->deleteLater(); |
161 mSecModView->deleteLater(); |
162 } |
162 } |
163 |
163 |
164 if(mPreView) |
164 if(mPreView) |
165 { |
165 { |
166 mPreView->deleteLater(); |
166 mPreView->deleteLater(); |
167 } |
167 } |
168 |
168 |
169 if(mCertView) |
169 if(mCertView) |
170 { |
170 { |
171 mCertView->deleteLater(); |
171 mCertView->deleteLater(); |
172 } |
172 } |
173 |
173 |
174 if(mCurrentView) |
174 if(mCurrentView) |
175 { |
175 { |
176 mCurrentView->deleteLater(); |
176 mCurrentView->deleteLater(); |
177 } |
177 } |
178 |
178 |
179 delete mSecModUIModel; |
179 delete mSecModUIModel; |
180 |
180 |
181 delete mNote; |
181 delete mNote; |
182 delete mContextMenu; |
182 delete mContextMenu; |
183 } |
183 } |
184 |
184 |
185 void CpSecurityView::showCodeView() |
185 void CpSecurityView::showCodeView() |
186 { |
186 { |
187 RDEBUG("0", 0); |
187 RDEBUG("0", 0); |
188 try |
188 try |
189 { |
189 { |
190 mSecModView = q_check_ptr(new CpSecModView(mPos, *mSecModUIModel)); |
190 mSecModView = q_check_ptr(new CpSecModView(mPos, *mSecModUIModel)); |
191 QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); |
191 QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); |
192 mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView |
192 mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView |
193 mainWindow()->addView(mSecModView); |
193 mainWindow()->addView(mSecModView); |
194 mainWindow()->setCurrentView(mSecModView); |
194 mainWindow()->setCurrentView(mSecModView); |
195 } |
195 } |
200 } |
200 } |
201 |
201 |
202 void CpSecurityView::showCodeView( const QModelIndex& aModelIndex) |
202 void CpSecurityView::showCodeView( const QModelIndex& aModelIndex) |
203 { |
203 { |
204 mPos = aModelIndex.row(); |
204 mPos = aModelIndex.row(); |
205 showCodeView(); |
205 showCodeView(); |
206 } |
206 } |
207 |
207 |
208 void CpSecurityView::showWIMview() |
208 void CpSecurityView::showWIMview() |
209 { |
209 { |
210 RDEBUG("0", 0); |
210 RDEBUG("0", 0); |
211 try |
211 try |
212 { |
212 { |
213 QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); |
213 QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); |
214 mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView |
214 mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView |
215 mainWindow()->addView(mSecModView); |
215 mainWindow()->addView(mSecModView); |
216 mainWindow()->setCurrentView(mSecModView); |
216 mainWindow()->setCurrentView(mSecModView); |
217 } |
217 } |
218 catch(const std::exception& exception) |
218 catch(const std::exception& exception) |
219 { |
219 { |
220 HbMessageBox::information(exception.what()); |
220 HbMessageBox::information(exception.what()); |
221 } |
221 } |
222 } |
222 } |
223 |
223 |
224 void CpSecurityView::viewDone() |
224 void CpSecurityView::viewDone() |
225 { |
225 { |
226 try |
226 try |
227 { |
227 { |
228 mainWindow()->removeView(mSecModView); |
228 mainWindow()->removeView(mSecModView); |
229 mSecModView->deleteLater(); |
229 mSecModView->deleteLater(); |
230 mSecModView= NULL; |
230 mSecModView= NULL; |
231 mainWindow()->setCurrentView(mPreView); |
231 mainWindow()->setCurrentView(mPreView); |
232 } |
232 } |
233 catch(const std::exception& exception) |
233 catch(const std::exception& exception) |
239 void CpSecurityView::displayCert(const QModelIndex& modelIndex) |
239 void CpSecurityView::displayCert(const QModelIndex& modelIndex) |
240 { |
240 { |
241 RDEBUG("0", 0); |
241 RDEBUG("0", 0); |
242 try |
242 try |
243 { |
243 { |
244 mCertView = q_check_ptr(new CpCertView(modelIndex)); |
244 mCertView = q_check_ptr(new CpCertView(modelIndex)); |
245 connect(mCertView , SIGNAL(aboutToClose()), this, SLOT(displayPrevious())); |
245 connect(mCertView , SIGNAL(aboutToClose()), this, SLOT(displayPrevious())); |
246 mPreView = mainWindow()->currentView(); |
246 mPreView = mainWindow()->currentView(); |
247 mainWindow()->addView(mCertView); |
247 mainWindow()->addView(mCertView); |
248 mainWindow()->setCurrentView(mCertView); |
248 mainWindow()->setCurrentView(mCertView); |
249 } |
249 } |
250 catch(const std::exception& exception) |
250 catch(const std::exception& exception) |
251 { |
251 { |
252 HbMessageBox::information(exception.what()); |
252 HbMessageBox::information(exception.what()); |
253 } |
253 } |
254 } |
254 } |
255 |
255 |
256 void CpSecurityView::displayPrevious() |
256 void CpSecurityView::displayPrevious() |
257 { |
257 { |
258 RDEBUG("0", 0); |
258 RDEBUG("0", 0); |
259 try |
259 try |
260 { |
260 { |
261 mainWindow()->removeView(mCertView); |
261 mainWindow()->removeView(mCertView); |
262 mCertView->deleteLater(); |
262 mCertView->deleteLater(); |
263 mCertView= NULL; |
263 mCertView= NULL; |
264 mainWindow()->setCurrentView(mPreView); |
264 mainWindow()->setCurrentView(mPreView); |
265 } |
265 } |
266 catch(const std::exception& exception) |
266 catch(const std::exception& exception) |
273 { |
273 { |
274 RDEBUG("0", 0); |
274 RDEBUG("0", 0); |
275 try |
275 try |
276 { |
276 { |
277 mContextMenu->clearActions(); |
277 mContextMenu->clearActions(); |
278 mPos = item->modelIndex().row(); |
278 mPos = item->modelIndex().row(); |
279 |
279 |
280 std::auto_ptr<HbAction> openModule(q_check_ptr(new HbAction("Open"))); |
280 std::auto_ptr<HbAction> openModule(q_check_ptr(new HbAction("Open"))); |
281 connect(openModule.get(), SIGNAL(triggered()), this, SLOT( showCodeView())); |
281 connect(openModule.get(), SIGNAL(triggered()), this, SLOT( showCodeView())); |
282 mContextMenu->addAction(openModule.get()); |
282 mContextMenu->addAction(openModule.get()); |
283 openModule.release(); |
283 openModule.release(); |
284 |
284 |
285 if(mSecModUIModel->IsTokenDeletable(mPos)) |
285 if(mSecModUIModel->IsTokenDeletable(mPos)) |
286 { |
286 { |
287 std::auto_ptr<HbAction> deleteModule(q_check_ptr(new HbAction("Delete"))); |
287 std::auto_ptr<HbAction> deleteModule(q_check_ptr(new HbAction("Delete"))); |
288 connect(deleteModule.get(), SIGNAL(triggered()), this, SLOT( deleteModule())); |
288 connect(deleteModule.get(), SIGNAL(triggered()), this, SLOT( deleteModule())); |
289 mContextMenu->addAction(deleteModule.get()); |
289 mContextMenu->addAction(deleteModule.get()); |
290 deleteModule.release(); |
290 deleteModule.release(); |
291 } |
291 } |
292 |
292 |
293 std::auto_ptr<HbAction> moduleInfo(q_check_ptr(new HbAction("Module Info"))); |
293 std::auto_ptr<HbAction> moduleInfo(q_check_ptr(new HbAction("Module Info"))); |
294 connect(moduleInfo.get(), SIGNAL(triggered()), this, SLOT( moduleDetails())); |
294 connect(moduleInfo.get(), SIGNAL(triggered()), this, SLOT( moduleDetails())); |
295 mContextMenu->addAction(moduleInfo.get()); |
295 mContextMenu->addAction(moduleInfo.get()); |
296 moduleInfo.release(); |
296 moduleInfo.release(); |
297 |
297 |
298 mContextMenu->setPreferredPos(coords); |
298 mContextMenu->setPreferredPos(coords); |
299 mContextMenu->open(); |
299 mContextMenu->open(); |
300 } |
300 } |
301 catch(const std::exception& exception) |
301 catch(const std::exception& exception) |
302 { |
302 { |
307 void CpSecurityView::deleteModule() |
307 void CpSecurityView::deleteModule() |
308 { |
308 { |
309 RDEBUG("0", 0); |
309 RDEBUG("0", 0); |
310 try |
310 try |
311 { |
311 { |
312 |
312 |
313 delete mNote; |
313 delete mNote; |
314 mNote = NULL; |
314 mNote = NULL; |
315 |
315 |
316 mNote = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
316 mNote = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
317 mNote->setHeadingWidget(q_check_ptr(new HbLabel(tr("Delete...")))); |
317 mNote->setHeadingWidget(q_check_ptr(new HbLabel(tr("Delete...")))); |
318 mNote->setText("Delete keystore and password?"); |
318 mNote->setText("Delete keystore and password?"); |
319 mNote->setPrimaryAction(q_check_ptr(new HbAction("Yes"))); |
319 mNote->clearActions(); |
320 mNote->setSecondaryAction(q_check_ptr(new HbAction("No"))); |
320 mOkAction = q_check_ptr(new HbAction("Yes")); |
|
321 mNote->addAction(mOkAction); |
|
322 HbAction* cancelAction = q_check_ptr(new HbAction("No")); |
|
323 mNote->addAction(cancelAction); |
321 mNote->setTimeout(HbPopup::NoTimeout); |
324 mNote->setTimeout(HbPopup::NoTimeout); |
322 mNote->setIconVisible (EFalse); |
325 mNote->setIconVisible (EFalse); |
323 mNote->open(this,SLOT(dialogClosed(HbAction*))); |
326 mNote->open(this,SLOT(dialogClosed(HbAction*))); |
324 } |
327 } |
325 catch(const std::exception& exception) |
328 catch(const std::exception& exception) |
326 { |
329 { |
327 HbMessageBox *box = new HbMessageBox(exception.what()); |
330 HbMessageBox *box = new HbMessageBox(exception.what()); |
328 box->setAttribute(Qt::WA_DeleteOnClose); |
331 box->setAttribute(Qt::WA_DeleteOnClose); |
329 box->open(); |
332 box->open(); |
330 } |
333 } |
331 |
334 |
332 } |
335 } |
333 void CpSecurityView::dialogClosed(HbAction* action) |
336 void CpSecurityView::dialogClosed(HbAction* action) |
334 { |
337 { |
335 RDEBUG("0", 0); |
338 RDEBUG("0", 0); |
336 if (action != mNote->primaryAction()) |
339 if (action != mOkAction) |
337 { |
340 { |
338 return; |
341 return; |
339 } |
342 } |
340 |
343 |
341 try |
344 try |
342 { |
345 { |
343 QT_TRAP_THROWING(mSecModUIModel->DeleteKeysL(mPos)); |
346 QT_TRAP_THROWING(mSecModUIModel->DeleteKeysL(mPos)); |
344 } |
347 } |
345 catch(const std::exception& exception) |
348 catch(const std::exception& exception) |
346 { |
349 { |
347 HbMessageBox *box = new HbMessageBox(exception.what()); |
350 HbMessageBox *box = new HbMessageBox(exception.what()); |
348 box->setAttribute(Qt::WA_DeleteOnClose); |
351 box->setAttribute(Qt::WA_DeleteOnClose); |
349 box->open(); |
352 box->open(); |
356 try |
359 try |
357 { |
360 { |
358 QVector< QPair<QString,QString> > securityDetails; |
361 QVector< QPair<QString,QString> > securityDetails; |
359 QT_TRAP_THROWING(securityDetails = mSecModUIModel->SecModDetailsL(mPos)); |
362 QT_TRAP_THROWING(securityDetails = mSecModUIModel->SecModDetailsL(mPos)); |
360 mModuleinfoView = q_check_ptr(new CpSecmoduleInfoView(securityDetails)); |
363 mModuleinfoView = q_check_ptr(new CpSecmoduleInfoView(securityDetails)); |
361 |
364 |
362 connect(mModuleinfoView , SIGNAL(aboutToClose()), this, SLOT(displayPreviousFromModInfo())); |
365 connect(mModuleinfoView , SIGNAL(aboutToClose()), this, SLOT(displayPreviousFromModInfo())); |
363 mPreView = mainWindow()->currentView(); |
366 mPreView = mainWindow()->currentView(); |
364 mainWindow()->addView(mModuleinfoView); |
367 mainWindow()->addView(mModuleinfoView); |
365 mainWindow()->setCurrentView(mModuleinfoView); |
368 mainWindow()->setCurrentView(mModuleinfoView); |
366 } |
369 } |
367 catch(const std::exception& exception) |
370 catch(const std::exception& exception) |
368 { |
371 { |
369 HbMessageBox::information(exception.what()); |
372 HbMessageBox::information(exception.what()); |
370 } |
373 } |
371 } |
374 } |
372 |
375 |
373 void CpSecurityView::displayPreviousFromModInfo() |
376 void CpSecurityView::displayPreviousFromModInfo() |
374 { |
377 { |
375 RDEBUG("0", 0); |
378 RDEBUG("0", 0); |
376 try |
379 try |
377 { |
380 { |
378 mainWindow()->removeView(mModuleinfoView); |
381 mainWindow()->removeView(mModuleinfoView); |
379 mCertView->deleteLater(); |
382 mCertView->deleteLater(); |
380 mCertView= NULL; |
383 mCertView= NULL; |
381 mainWindow()->setCurrentView(mPreView); |
384 mainWindow()->setCurrentView(mPreView); |
382 } |
385 } |
383 catch(const std::exception& exception) |
386 catch(const std::exception& exception) |