@@ -48,7 +48,7 @@ VerifyCert::VerifyCert(QWidget *parent)
4848 CertificateDetails::showCertificate (c, this ,
4949 pinType == QSmartCardData::Pin1Type ? QStringLiteral (" -auth" ) : QStringLiteral (" -sign" ));
5050 });
51- connect (ui->checkCert , &QToolButton::clicked, this , [this ]{
51+ connect (ui->checkCert , &QToolButton::clicked, this , [this ] {
5252 auto *dlg = WarningDialog::create (this );
5353 QString readMore = tr (" Read more <a href=\" https://www.id.ee/en/article/validity-of-id-card-certificates/\" >here</a>." );
5454 switch (c.validateOnline ())
@@ -118,17 +118,18 @@ void VerifyCert::update(QSmartCardData::PinType type, const QSmartCardData &data
118118 update ();
119119}
120120
121- void VerifyCert::update (QSmartCardData::PinType type, const SslCertificate & cert)
121+ void VerifyCert::update (QSmartCardData::PinType type, SslCertificate cert)
122122{
123123 pinType = type;
124- c = cert;
124+ c = std::move ( cert) ;
125125 update ();
126126}
127127
128128void VerifyCert::update ()
129129{
130130 if (cardData.isNull () && c.isNull ())
131131 return clear ();
132+ bool isLockedCard = !cardData.isNull () && cardData.pinLocked (QSmartCardData::Pin1Type);
132133 bool isLockedPin = !cardData.isNull () && pinType == QSmartCardData::Pin2Type && cardData.pinLocked (pinType);
133134 bool isBlockedPin = !cardData.isNull () && cardData.retryCount (pinType) == 0 ;
134135 bool isBlockedPuk = !cardData.isNull () && cardData.retryCount (QSmartCardData::PukType) == 0 ;
@@ -183,6 +184,9 @@ void VerifyCert::update()
183184 {
184185 ui->validUntil ->setText (tr (" Certificate has expired!" ));
185186 ui->validUntil ->setLabel (QStringLiteral (" error" ));
187+ icon = QStringLiteral (" :/images/icon_alert_large_error.svg" );
188+ ui->info ->setLabel (QStringLiteral (" error" ));
189+ ui->info ->setText (tr (" PIN%1 can not be used because the certificate has expired." ).arg (pinType));
186190 }
187191 else if (qint64 leftDays = std::max<qint64>(0 , QDateTime::currentDateTime ().daysTo (c.expiryDate ().toLocalTime ())); leftDays <= 105 && !c.isNull ())
188192 {
@@ -194,18 +198,20 @@ void VerifyCert::update()
194198
195199 ui->changePIN ->setText (tr (" Change PIN%1" ).arg (pinType));
196200 ui->forgotPinLink ->setText (tr (" Change with PUK code" ));
197- ui->changePIN ->setHidden ((isBlockedPin && isBlockedPuk) || isTempelType);
201+ ui->changePIN ->setHidden (isLockedCard || (isBlockedPin && isBlockedPuk) || isTempelType);
198202
199203 if (isTempelType)
200204 {
201205 ui->info ->setLabel ({});
202206 ui->info ->setText (tr (" PIN can be changed only using eToken utility" ));
203207 }
204- else if (isInvalidCert )
208+ else if (isLockedCard )
205209 {
206- icon = QStringLiteral (" :/images/icon_alert_large_error.svg" );
207- ui->info ->setLabel (QStringLiteral (" error" ));
208- ui->info ->setText (tr (" PIN%1 can not be used because the certificate has expired." ).arg (pinType));
210+ icon = QStringLiteral (" :/images/icon_alert_large_warning.svg" );
211+ ui->info ->setLabel (QStringLiteral (" warning" ));
212+ ui->info ->setText (pinType == QSmartCardData::Pin1Type ?
213+ tr (" The ID-card must be activated in order to authenticate" ) :
214+ tr (" The ID-card must be activated in order to sign" ));
209215 }
210216 else if (isBlockedPin)
211217 {
@@ -234,9 +240,9 @@ void VerifyCert::update()
234240 if (!icon.isEmpty ())
235241 ui->nameIcon ->load (icon);
236242
237- ui->links ->setHidden (pinType == QSmartCardData::PukType && (isBlockedPuk || !isPUKReplacable )); // Keep visible in PUK to align fields equaly
243+ ui->links ->setHidden (pinType == QSmartCardData::PukType && ui-> changePIN -> isHidden ( ));
238244 ui->details ->setHidden (pinType == QSmartCardData::PukType);
239- ui->forgotPinLink ->setHidden (pinType == QSmartCardData::PukType || isBlockedPin || isBlockedPuk || isTempelType);
245+ ui->forgotPinLink ->setHidden (pinType == QSmartCardData::PukType || isLockedCard || isBlockedPin || isBlockedPuk || isTempelType);
240246 ui->checkCert ->setHidden (pinType == QSmartCardData::PukType || isInvalidCert);
241247}
242248
0 commit comments