|
1 /* |
|
2 * Copyright (c) 2010 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: Security module detail view in advanced security settings |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "advsecsettingssecuritymoduledetailview.h" |
|
19 #include "advsecsettingssecuritymodulemodel.h" |
|
20 #include <QGraphicsLinearLayout> |
|
21 #include <HbGroupBox> |
|
22 #include <HbScrollArea> |
|
23 #include <HbMenu> |
|
24 #include <HbAction> |
|
25 #include <HbLabel> |
|
26 |
|
27 |
|
28 // ======== MEMBER FUNCTIONS ======== |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // AdvSecSettingsSecurityModuleDetailView::AdvSecSettingsSecurityModuleDetailView() |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 AdvSecSettingsSecurityModuleDetailView::AdvSecSettingsSecurityModuleDetailView( |
|
35 AdvSecSettingsSecurityModuleModel &model, QGraphicsItem *parent) : |
|
36 AdvSecSettingsViewBase(0, parent), mModel(model), mModuleIndex(0), |
|
37 mViewLabel(0), mDetailsText(0) |
|
38 { |
|
39 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
|
40 |
|
41 mViewLabel = new HbGroupBox; |
|
42 layout->addItem(mViewLabel); |
|
43 |
|
44 HbScrollArea *scrollArea = new HbScrollArea; |
|
45 mDetailsText = new HbLabel; |
|
46 mDetailsText->setTextWrapping(Hb::TextWordWrap); |
|
47 scrollArea->setContentWidget(mDetailsText); |
|
48 scrollArea->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOn); |
|
49 layout->addItem(scrollArea); |
|
50 |
|
51 setLayout(layout); |
|
52 |
|
53 connect(&mModel, SIGNAL(detailsCompleted(QMap<int,QString>)), |
|
54 this, SLOT(detailsCompleted(QMap<int,QString>))); |
|
55 connect(&mModel, SIGNAL(deleteCompleted()), |
|
56 this, SLOT(displayPreviousView())); |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // AdvSecSettingsSecurityModuleDetailView::~AdvSecSettingsSecurityModuleDetailView() |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 AdvSecSettingsSecurityModuleDetailView::~AdvSecSettingsSecurityModuleDetailView() |
|
64 { |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // AdvSecSettingsSecurityModuleDetailView::setSecurityModule() |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 void AdvSecSettingsSecurityModuleDetailView::setSecurityModule(int index) |
|
72 { |
|
73 mModuleIndex = index; |
|
74 // TODO: remove |
|
75 mDetailsText->setPlainText(tr("TODO: Add info for module %1").arg(index)); |
|
76 |
|
77 menu()->clearActions(); |
|
78 if (mModel.isDeletable(index)) { |
|
79 HbAction *deleteAction = new HbAction(hbTrId("txt_common_menu_delete")); |
|
80 connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteSecurityModule())); |
|
81 menu()->addAction(deleteAction); |
|
82 } |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // AdvSecSettingsSecurityModuleDetailView::detailsCompleted() |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 void AdvSecSettingsSecurityModuleDetailView::detailsCompleted(QMap<int,QString> /*details*/) |
|
90 { |
|
91 // TODO: implement |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // AdvSecSettingsSecurityModuleDetailView::deleteSecurityModule() |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void AdvSecSettingsSecurityModuleDetailView::deleteSecurityModule() |
|
99 { |
|
100 Q_ASSERT(mViewLabel != 0); |
|
101 // TODO: localized UI string needed |
|
102 QString confirmText(tr("Delete %1?").arg(mViewLabel->heading())); |
|
103 displayQuestionNote(confirmText, this, SLOT(deleteConfirmationAccepted())); |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // AdvSecSettingsSecurityModuleDetailView::deleteConfirmationAccepted() |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 void AdvSecSettingsSecurityModuleDetailView::deleteConfirmationAccepted() |
|
111 { |
|
112 mModel.deleteModule(mModuleIndex); |
|
113 } |
|
114 |