39 #include <hbabstractviewitem.h> |
39 #include <hbabstractviewitem.h> |
40 #include <HbMessageBox> |
40 #include <HbMessageBox> |
41 |
41 |
42 #include <memory> |
42 #include <memory> |
43 |
43 |
|
44 #include <../../inc/cpsecplugins.h> |
|
45 |
44 #include "cpsecurityview.h" |
46 #include "cpsecurityview.h" |
45 #include "cpsecmodview.h" |
47 #include "cpsecmodview.h" |
46 #include "cpcertview.h" |
48 #include "cpcertview.h" |
47 #include "cpsecmodmodel.h" |
49 #include "cpsecmodmodel.h" |
48 #include "cpsecmoduleinfoview.h" |
50 #include "cpsecmoduleinfoview.h" |
85 |
88 |
86 connect(listCertView, SIGNAL(released(QModelIndex)), this, SLOT(displayCert(QModelIndex))); |
89 connect(listCertView, SIGNAL(released(QModelIndex)), this, SLOT(displayCert(QModelIndex))); |
87 |
90 |
88 HbListWidget* listSecView = q_check_ptr(new HbListWidget(this)); |
91 HbListWidget* listSecView = q_check_ptr(new HbListWidget(this)); |
89 QMap<QString,QString> keystoreLabels; |
92 QMap<QString,QString> keystoreLabels; |
90 |
93 RDEBUG("0", 0); |
91 try |
94 try |
92 { |
95 { |
93 QT_TRAP_THROWING( |
96 QT_TRAP_THROWING( |
94 mSecModUIModel = CSecModUIModel::NewL(); |
97 mSecModUIModel = CSecModUIModel::NewL(); |
95 keystoreLabels = mSecModUIModel->LoadTokenLabelsL(); ) |
98 keystoreLabels = mSecModUIModel->LoadTokenLabelsL(); ) |
121 std::auto_ptr<HbListWidgetItem> emptyWidget(q_check_ptr(new HbListWidgetItem())); |
124 std::auto_ptr<HbListWidgetItem> emptyWidget(q_check_ptr(new HbListWidgetItem())); |
122 emptyWidget->setText("(no security modules)"); |
125 emptyWidget->setText("(no security modules)"); |
123 listSecView->addItem(emptyWidget.get()); |
126 listSecView->addItem(emptyWidget.get()); |
124 emptyWidget.release(); |
127 emptyWidget.release(); |
125 } |
128 } |
126 |
129 RDEBUG("0", 0); |
127 std::auto_ptr<HbGroupBox> certificatesList(q_check_ptr(new HbGroupBox())); |
130 std::auto_ptr<HbGroupBox> certificatesList(q_check_ptr(new HbGroupBox())); |
128 certificatesList->setHeading(hbTrId("txt_certificate_manager_setlabel_certificates")); |
131 certificatesList->setHeading(hbTrId("txt_certificate_manager_setlabel_certificates")); |
129 certificatesList->setContentWidget(listCertView); |
132 certificatesList->setContentWidget(listCertView); |
130 certificatesList->setCollapsed(true); |
133 certificatesList->setCollapsed(true); |
131 layout->addItem(certificatesList.get()); |
134 layout->addItem(certificatesList.get()); |
142 securityModuleList->setContentWidget(listSecView); |
145 securityModuleList->setContentWidget(listSecView); |
143 securityModuleList->setCollapsed(true); |
146 securityModuleList->setCollapsed(true); |
144 layout->addItem(securityModuleList.get()); |
147 layout->addItem(securityModuleList.get()); |
145 securityModuleList.release(); |
148 securityModuleList.release(); |
146 |
149 |
|
150 mContextMenu = q_check_ptr(new HbMenu()); |
|
151 |
147 setLayout(layout.get()); |
152 setLayout(layout.get()); |
148 layout.release(); |
153 layout.release(); |
149 } |
154 } |
150 |
155 |
151 |
156 |
172 } |
177 } |
173 |
178 |
174 delete mSecModUIModel; |
179 delete mSecModUIModel; |
175 |
180 |
176 delete mNote; |
181 delete mNote; |
|
182 delete mContextMenu; |
177 } |
183 } |
178 |
184 |
179 void CpSecurityView::showCodeView() |
185 void CpSecurityView::showCodeView() |
180 { |
186 { |
|
187 RDEBUG("0", 0); |
181 try |
188 try |
182 { |
189 { |
183 mSecModView = q_check_ptr(new CpSecModView(mPos, *mSecModUIModel)); |
190 mSecModView = q_check_ptr(new CpSecModView(mPos, *mSecModUIModel)); |
184 QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); |
191 QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); |
185 mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView |
192 mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView |
198 showCodeView(); |
205 showCodeView(); |
199 } |
206 } |
200 |
207 |
201 void CpSecurityView::showWIMview() |
208 void CpSecurityView::showWIMview() |
202 { |
209 { |
|
210 RDEBUG("0", 0); |
203 try |
211 try |
204 { |
212 { |
205 QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); |
213 QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); |
206 mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView |
214 mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView |
207 mainWindow()->addView(mSecModView); |
215 mainWindow()->addView(mSecModView); |
228 } |
236 } |
229 } |
237 } |
230 |
238 |
231 void CpSecurityView::displayCert(const QModelIndex& modelIndex) |
239 void CpSecurityView::displayCert(const QModelIndex& modelIndex) |
232 { |
240 { |
|
241 RDEBUG("0", 0); |
233 try |
242 try |
234 { |
243 { |
235 mCertView = q_check_ptr(new CpCertView(modelIndex)); |
244 mCertView = q_check_ptr(new CpCertView(modelIndex)); |
236 connect(mCertView , SIGNAL(aboutToClose()), this, SLOT(displayPrevious())); |
245 connect(mCertView , SIGNAL(aboutToClose()), this, SLOT(displayPrevious())); |
237 mPreView = mainWindow()->currentView(); |
246 mPreView = mainWindow()->currentView(); |
259 } |
269 } |
260 } |
270 } |
261 |
271 |
262 void CpSecurityView::indicateLongPress(HbAbstractViewItem *item,QPointF coords) |
272 void CpSecurityView::indicateLongPress(HbAbstractViewItem *item,QPointF coords) |
263 { |
273 { |
264 try |
274 RDEBUG("0", 0); |
265 { |
275 try |
266 std::auto_ptr<HbMenu> contextMenu(q_check_ptr(new HbMenu())); |
276 { |
|
277 mContextMenu->clearActions(); |
267 mPos = item->modelIndex().row(); |
278 mPos = item->modelIndex().row(); |
268 |
279 |
269 std::auto_ptr<HbAction> openModule(q_check_ptr(new HbAction("Open"))); |
280 std::auto_ptr<HbAction> openModule(q_check_ptr(new HbAction("Open"))); |
270 connect(openModule.get(), SIGNAL(triggered()), this, SLOT( showCodeView())); |
281 connect(openModule.get(), SIGNAL(triggered()), this, SLOT( showCodeView())); |
271 contextMenu->addAction(openModule.get()); |
282 mContextMenu->addAction(openModule.get()); |
272 openModule.release(); |
283 openModule.release(); |
273 |
284 |
274 if(mSecModUIModel->IsTokenDeletable(mPos)) |
285 if(mSecModUIModel->IsTokenDeletable(mPos)) |
275 { |
286 { |
276 std::auto_ptr<HbAction> deleteModule(q_check_ptr(new HbAction("Delete"))); |
287 std::auto_ptr<HbAction> deleteModule(q_check_ptr(new HbAction("Delete"))); |
277 connect(deleteModule.get(), SIGNAL(triggered()), this, SLOT( deleteModule())); |
288 connect(deleteModule.get(), SIGNAL(triggered()), this, SLOT( deleteModule())); |
278 contextMenu->addAction(deleteModule.get()); |
289 mContextMenu->addAction(deleteModule.get()); |
279 deleteModule.release(); |
290 deleteModule.release(); |
280 } |
291 } |
281 |
292 |
282 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"))); |
283 connect(moduleInfo.get(), SIGNAL(triggered()), this, SLOT( moduleDetails())); |
294 connect(moduleInfo.get(), SIGNAL(triggered()), this, SLOT( moduleDetails())); |
284 contextMenu->addAction(moduleInfo.get()); |
295 mContextMenu->addAction(moduleInfo.get()); |
285 moduleInfo.release(); |
296 moduleInfo.release(); |
286 |
297 |
287 contextMenu->open(); |
298 mContextMenu->setPreferredPos(coords); |
288 contextMenu->setPreferredPos(coords); |
299 mContextMenu->open(); |
289 } |
300 } |
290 catch(const std::exception& exception) |
301 catch(const std::exception& exception) |
291 { |
302 { |
292 HbMessageBox::information(exception.what()); |
303 HbMessageBox::information(exception.what()); |
293 } |
304 } |
294 } |
305 } |
295 |
306 |
296 void CpSecurityView::deleteModule() |
307 void CpSecurityView::deleteModule() |
297 { |
308 { |
|
309 RDEBUG("0", 0); |
298 try |
310 try |
299 { |
311 { |
300 |
312 |
301 delete mNote; |
313 delete mNote; |
302 mNote = NULL; |
314 mNote = NULL; |