@@ -152,7 +152,7 @@ void ContainerPage::clear()
152152{
153153 ui->leftPane ->clear ();
154154 ui->rightPane ->clear ();
155- canDecrypt = false ;
155+ isSupported = false ;
156156}
157157
158158void ContainerPage::clearPopups ()
@@ -305,7 +305,9 @@ void ContainerPage::showMainAction(const QList<Actions> &actions)
305305
306306void ContainerPage::showSigningButton ()
307307{
308- if (cardInReader.isEmpty ())
308+ if (!isSupported)
309+ hideMainAction ();
310+ else if (cardInReader.isEmpty ())
309311 showMainAction ({ SignatureMobile, SignatureSmartID });
310312 else if (isSeal)
311313 showMainAction ({ SignatureToken, SignatureMobile, SignatureSmartID });
@@ -316,7 +318,7 @@ void ContainerPage::showSigningButton()
316318void ContainerPage::transition (CryptoDoc* container, bool canDecrypt)
317319{
318320 clear ();
319- this -> canDecrypt = canDecrypt;
321+ isSupported = canDecrypt;
320322 ContainerState state = container->state ();
321323 ui->leftPane ->stateChange (state);
322324 ui->rightPane ->stateChange (state);
@@ -348,17 +350,16 @@ void ContainerPage::transition(DigiDoc* container)
348350
349351 for (const DigiDocSignature &c: container->timestamps ())
350352 {
351- SignatureItem *item = new SignatureItem (c, state, false , ui->rightPane );
353+ SignatureItem *item = new SignatureItem (c, state, ui->rightPane );
352354 if (item->isInvalid ())
353355 addError (item, errors);
354356 ui->rightPane ->addHeaderWidget (item);
355357 }
356358 }
357359
358- bool enableSigning = container->isSupported ();
359360 for (const DigiDocSignature &c: container->signatures ())
360361 {
361- SignatureItem *item = new SignatureItem (c, state, enableSigning, ui->rightPane );
362+ SignatureItem *item = new SignatureItem (c, state, ui->rightPane );
362363 if (item->isInvalid ())
363364 addError (item, errors);
364365 ui->rightPane ->addWidget (item);
@@ -373,18 +374,16 @@ void ContainerPage::transition(DigiDoc* container)
373374 if (container->fileName ().endsWith (QStringLiteral (" ddoc" ), Qt::CaseInsensitive))
374375 emit warning (UnsupportedDDocWarning);
375376
376- if (enableSigning || container->isService ())
377- showSigningButton ();
378- else
379- hideMainAction ();
377+ isSupported = container->isSupported () || container->isService ();
378+ showSigningButton ();
380379
381380 ui->leftPane ->setModel (container->documentModel ());
382381 updatePanes (state);
383382}
384383
385384void ContainerPage::update (bool canDecrypt, CryptoDoc* container)
386385{
387- this -> canDecrypt = canDecrypt;
386+ isSupported = canDecrypt;
388387 if (ui->leftPane ->getState () & EncryptedContainer)
389388 updateDecryptionButton ();
390389
@@ -400,7 +399,7 @@ void ContainerPage::update(bool canDecrypt, CryptoDoc* container)
400399
401400void ContainerPage::updateDecryptionButton ()
402401{
403- if (!canDecrypt || cardInReader.isEmpty ())
402+ if (!isSupported || cardInReader.isEmpty ())
404403 hideMainAction ();
405404 else if (isSeal)
406405 showMainAction ({ DecryptToken });
0 commit comments