@@ -93,6 +93,15 @@ void Controller::run()
9393
9494 commandHandler = getCommandHandler (*command);
9595
96+ // When the command handler run thread retrieves certificates successfully, call
97+ // onCertificatesLoaded() that starts card event monitoring while user enters the PIN.
98+ connect (commandHandler.get (), &CommandHandler::singleCertificateReady, this ,
99+ &Controller::onCertificatesLoaded);
100+ connect (commandHandler.get (), &CommandHandler::multipleCertificatesReady, this ,
101+ &Controller::onCertificatesLoaded);
102+ connect (commandHandler.get (), &CommandHandler::verifyPinFailed, this ,
103+ &Controller::onCertificatesLoaded);
104+
96105 startCommandExecution ();
97106
98107 } catch (const std::exception& error) {
@@ -160,25 +169,14 @@ void Controller::onCardsAvailable(
160169 }
161170}
162171
163- void Controller::runCommandHandler (const std::vector<ElectronicID::ptr>& availableEids)
164- {
165- try {
166- auto * commandHandlerRunThread =
167- new CommandHandlerRunThread (this , *commandHandler, availableEids);
168- connectRetry (commandHandlerRunThread);
169-
170- // When the command handler run thread retrieves certificates successfully, call
171- // onCertificatesLoaded() that starts card event monitoring while user enters the PIN.
172- connect (commandHandler.get (), &CommandHandler::singleCertificateReady, this ,
173- &Controller::onCertificatesLoaded);
174- connect (commandHandler.get (), &CommandHandler::multipleCertificatesReady, this ,
175- &Controller::onCertificatesLoaded);
176-
177- commandHandlerRunThread->start ();
178-
179- } catch (const std::exception& error) {
180- onCriticalFailure (error.what ());
181- }
172+ void Controller::runCommandHandler (std::vector<ElectronicID::ptr> availableEids) noexcept
173+ try {
174+ auto * commandHandlerRunThread =
175+ new CommandHandlerRunThread (this , *commandHandler, std::move (availableEids));
176+ connectRetry (commandHandlerRunThread);
177+ commandHandlerRunThread->start ();
178+ } catch (const std::exception& error) {
179+ onCriticalFailure (error.what ());
182180}
183181
184182void Controller::onCertificatesLoaded ()
@@ -202,22 +200,20 @@ void Controller::disposeUI()
202200 }
203201}
204202
205- void Controller::onConfirmCommandHandler (const EidCertificateAndPinInfo& certAndPinInfo)
206- {
203+ void Controller::onConfirmCommandHandler (const EidCertificateAndPinInfo& certAndPinInfo) noexcept
204+ try {
207205 emit stopCardEventMonitorThread ();
208206
209- try {
210- auto * commandHandlerConfirmThread =
211- new CommandHandlerConfirmThread (this , *commandHandler, window, certAndPinInfo);
212- connect (commandHandlerConfirmThread, &CommandHandlerConfirmThread::completed, this ,
213- &Controller::onCommandHandlerConfirmCompleted);
214- connectRetry (commandHandlerConfirmThread);
207+ auto * commandHandlerConfirmThread =
208+ new CommandHandlerConfirmThread (this , *commandHandler, window, certAndPinInfo);
209+ connect (commandHandlerConfirmThread, &CommandHandlerConfirmThread::completed, this ,
210+ &Controller::onCommandHandlerConfirmCompleted);
211+ connectRetry (commandHandlerConfirmThread);
215212
216- commandHandlerConfirmThread->start ();
213+ commandHandlerConfirmThread->start ();
217214
218- } catch (const std::exception& error) {
219- onCriticalFailure (error.what ());
220- }
215+ } catch (const std::exception& error) {
216+ onCriticalFailure (error.what ());
221217}
222218
223219void Controller::onCommandHandlerConfirmCompleted (const QVariantMap& res)
@@ -258,7 +254,7 @@ void Controller::onRetry()
258254 }
259255}
260256
261- void Controller::connectRetry (const ControllerChildThread* childThread)
257+ void Controller::connectRetry (const ControllerChildThread* childThread) const
262258{
263259 REQUIRE_NON_NULL (childThread)
264260 connect (childThread, &ControllerChildThread::failure, this , &Controller::onCriticalFailure);
0 commit comments