2929#include < QtWidgets/QPushButton>
3030#include < QSvgWidget>
3131
32- PinPopup::PinPopup (PinFlags flags, const SslCertificate &c, TokenFlags count, QWidget *parent)
33- : PinPopup(flags, c.toString(c.showCN() ? QStringLiteral(" CN, serialNumber" ) : QStringLiteral(" GN SN, serialNumber" )), count, parent)
34- {
35- if (c.type () & SslCertificate::TempelType)
36- {
37- regexp->setRegularExpression (QRegularExpression (QStringLiteral (" ^.{4,}$" )));
38- ui->pin ->setMaxLength (32767 );
39- }
40- }
41-
42- PinPopup::PinPopup (PinFlags flags, const QString &title, TokenFlags count, QWidget *parent, QString text)
32+ PinPopup::PinPopup (QSmartCardData::PinType type, TokenFlags flags, const SslCertificate &c, QWidget *parent, QString text)
4333 : QDialog(parent)
4434 , ui(new Ui::PinPopup)
4535{
@@ -60,7 +50,7 @@ PinPopup::PinPopup(PinFlags flags, const QString &title, TokenFlags count, QWidg
6050
6151 if (!text.isEmpty ())
6252 ui->labelPin ->hide ();
63- else if ( flags & Pin2Type )
53+ else if (type == QSmartCardData:: Pin2Type)
6454 {
6555 text = tr (" Selected action requires sign certificate." );
6656 ui->labelPin ->setText (flags & PinpadFlag ?
@@ -76,12 +66,12 @@ PinPopup::PinPopup(PinFlags flags, const QString &title, TokenFlags count, QWidg
7666 tr (" For using authentication certificate enter PIN1" ));
7767 setPinLen (4 );
7868 }
79- ui->label ->setText (title );
69+ ui->label ->setText (c. toString (c. showCN () ? QStringLiteral ( " CN, serialNumber " ) : QStringLiteral ( " GN SN, serialNumber " )) );
8070 ui->text ->setText (text);
81- if (count & PinFinalTry)
82- ui->errorPin ->setText (tr (" PIN will be locked next failed attempt" ));
83- else if (count & PinCountLow)
84- ui->errorPin ->setText (tr (" PIN has been entered incorrectly at least once" ));
71+ if (flags & PinFinalTry)
72+ ui->errorPin ->setText (tr (" %1 will be locked next failed attempt" ). arg ( QSmartCardData::typeString (type) ));
73+ else if (flags & PinCountLow)
74+ ui->errorPin ->setText (tr (" %1 has been entered incorrectly at least once" ). arg ( QSmartCardData::typeString (type) ));
8575 else
8676 ui->errorPin ->hide ();
8777
@@ -90,12 +80,13 @@ PinPopup::PinPopup(PinFlags flags, const QString &title, TokenFlags count, QWidg
9080 ui->pin ->hide ();
9181 ui->ok ->hide ();
9282 ui->cancel ->hide ();
83+ ui->errorPin ->setAlignment (Qt::AlignCenter);
9384 auto *movie = new QSvgWidget (QStringLiteral (" :/images/wait.svg" ), this );
9485 movie->setFixedSize (ui->pin ->size ().height (), ui->pin ->size ().height ());
9586 movie->show ();
9687 ui->layoutContent ->addWidget (movie, 0 , Qt::AlignCenter);
9788 }
98- if ( flags & PinpadFlag )
89+ else if (flags & PinpadFlag)
9990 {
10091 ui->pin ->hide ();
10192 ui->ok ->hide ();
@@ -123,6 +114,11 @@ PinPopup::PinPopup(PinFlags flags, const QString &title, TokenFlags count, QWidg
123114 ui->text ->setBuddy ( ui->pin );
124115 ui->ok ->setDisabled (true );
125116 }
117+ if (c.type () & SslCertificate::TempelType)
118+ {
119+ regexp->setRegularExpression (QRegularExpression (QStringLiteral (" ^.{4,}$" )));
120+ ui->pin ->setMaxLength (32767 );
121+ }
126122}
127123
128124PinPopup::~PinPopup ()
0 commit comments