22 #include <hblabel.h> |
22 #include <hblabel.h> |
23 #include <hbcheckbox.h> |
23 #include <hbcheckbox.h> |
24 #include <hbgroupbox.h> |
24 #include <hbgroupbox.h> |
25 #include <hbtextedit.h> |
25 #include <hbtextedit.h> |
26 #include <QGraphicsLinearLayout> |
26 #include <QGraphicsLinearLayout> |
27 #include <QTextStream> |
|
28 |
27 |
29 const int KUnknownError = -5; // KErrNotSupported |
28 const int KUnknownError = -5; // KErrNotSupported |
30 |
29 |
31 |
30 |
32 // ======== MEMBER FUNCTIONS ======== |
31 // ======== MEMBER FUNCTIONS ======== |
69 QString text = descriptionText().arg(mServerName); |
68 QString text = descriptionText().arg(mServerName); |
70 mProblemDescription = new HbLabel(text); |
69 mProblemDescription = new HbLabel(text); |
71 mProblemDescription->setTextWrapping(Hb::TextWordWrap); |
70 mProblemDescription->setTextWrapping(Hb::TextWordWrap); |
72 mMainLayout->addItem(mProblemDescription); |
71 mMainLayout->addItem(mProblemDescription); |
73 |
72 |
74 if (mIsSavingServerNamePossible && mCertificateInfo->isPermanentAcceptAllowed()) { |
73 if (isPermanentAcceptAllowed()) { |
75 Q_ASSERT(mAcceptPermanently == 0); |
74 Q_ASSERT(mAcceptPermanently == 0); |
76 // TODO: localised UI string needed |
75 // TODO: localised UI string needed |
77 mAcceptPermanently = new HbCheckBox(tr("Accept permanently")); |
76 mAcceptPermanently = new HbCheckBox(tr("Accept permanently")); |
78 mMainLayout->addItem(mAcceptPermanently); |
77 mMainLayout->addItem(mAcceptPermanently); |
79 } |
78 } |
83 // TODO: localized UI string needed |
82 // TODO: localized UI string needed |
84 mCertificateDetailsGroupBox->setHeading(tr("Details")); |
83 mCertificateDetailsGroupBox->setHeading(tr("Details")); |
85 |
84 |
86 Q_ASSERT(mCertificateDetailsText == 0); |
85 Q_ASSERT(mCertificateDetailsText == 0); |
87 mCertificateDetailsText = new HbTextEdit; |
86 mCertificateDetailsText = new HbTextEdit; |
88 QString certificateDetails; |
87 QString certificateDetails = mCertificateInfo->certificateDetails(mServerName); |
89 QTextStream stream(&certificateDetails); |
|
90 // TODO: localized UI string needed |
|
91 stream << tr("Service:\n%1\n").arg(mServerName); |
|
92 stream << endl; |
|
93 stream << mCertificateInfo->certificateDetails(); |
|
94 mCertificateDetailsText->setPlainText(certificateDetails); |
88 mCertificateDetailsText->setPlainText(certificateDetails); |
95 mCertificateDetailsText->setReadOnly(true); |
89 mCertificateDetailsText->setReadOnly(true); |
96 |
90 |
97 mCertificateDetailsGroupBox->setContentWidget(mCertificateDetailsText); |
91 mCertificateDetailsGroupBox->setContentWidget(mCertificateDetailsText); |
|
92 mCertificateDetailsGroupBox->setCollapsed(true); |
98 mMainLayout->addItem(mCertificateDetailsGroupBox); |
93 mMainLayout->addItem(mCertificateDetailsGroupBox); |
99 |
94 |
100 setLayout(mMainLayout); |
95 setLayout(mMainLayout); |
101 } |
96 } |
102 |
97 |
109 { |
104 { |
110 processParameters(parameters); |
105 processParameters(parameters); |
111 } |
106 } |
112 |
107 |
113 // ---------------------------------------------------------------------------- |
108 // ---------------------------------------------------------------------------- |
|
109 // UntrustedCertificateWidget::isPermanentAcceptAllowed() |
|
110 // ---------------------------------------------------------------------------- |
|
111 // |
|
112 bool UntrustedCertificateWidget::isPermanentAcceptAllowed() const |
|
113 { |
|
114 return (mCertificateInfo->isDateValid() && (mServerName.length() > 0) && |
|
115 mIsSavingServerNamePossible); |
|
116 } |
|
117 |
|
118 // ---------------------------------------------------------------------------- |
114 // UntrustedCertificateWidget::isPermanentAcceptChecked() |
119 // UntrustedCertificateWidget::isPermanentAcceptChecked() |
115 // ---------------------------------------------------------------------------- |
120 // ---------------------------------------------------------------------------- |
116 // |
121 // |
117 bool UntrustedCertificateWidget::isPermanentAcceptChecked() const |
122 bool UntrustedCertificateWidget::isPermanentAcceptChecked() const |
118 { |
123 { |
119 if (mAcceptPermanently) { |
124 if (mAcceptPermanently) { |
120 return (mAcceptPermanently->checkState() == Qt::Checked); |
125 return (mAcceptPermanently->checkState() == Qt::Checked); |
121 } |
126 } |
122 return false; |
127 return false; |
|
128 } |
|
129 |
|
130 // ---------------------------------------------------------------------------- |
|
131 // UntrustedCertificateWidget::serverName() |
|
132 // ---------------------------------------------------------------------------- |
|
133 // |
|
134 QString UntrustedCertificateWidget::serverName() const |
|
135 { |
|
136 return mServerName; |
123 } |
137 } |
124 |
138 |
125 // ---------------------------------------------------------------------------- |
139 // ---------------------------------------------------------------------------- |
126 // UntrustedCertificateWidget::processParameters() |
140 // UntrustedCertificateWidget::processParameters() |
127 // ---------------------------------------------------------------------------- |
141 // ---------------------------------------------------------------------------- |