diff --git a/src/gui/TotpDialog.cpp b/src/gui/TotpDialog.cpp index 521ddbafe..058210870 100644 --- a/src/gui/TotpDialog.cpp +++ b/src/gui/TotpDialog.cpp @@ -67,7 +67,7 @@ void TotpDialog::copyToClipboard() void TotpDialog::updateProgressBar() { if (uCounter < 100) { - m_ui->progressBar->setValue(100 - uCounter); + m_ui->progressBar->setValue(static_cast(100 - uCounter)); m_ui->progressBar->update(); uCounter++; } else { @@ -85,7 +85,10 @@ void TotpDialog::updateSeconds() void TotpDialog::updateTotp() { - m_ui->totpLabel->setText(m_entry->totp()); + QString totpCode = m_entry->totp(); + QString firstHalf = totpCode.left(totpCode.size()/2); + QString secondHalf = totpCode.right(totpCode.size()/2); + m_ui->totpLabel->setText(firstHalf + " " + secondHalf); } double TotpDialog::resetCounter() diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 5a4142660..b1cc02462 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -489,7 +489,7 @@ void TestGui::testTotp() TotpDialog* totpDialog = m_dbWidget->findChild("TotpDialog"); QLabel* totpLabel = totpDialog->findChild("totpLabel"); - QCOMPARE(totpLabel->text(), entry->totp()); + QCOMPARE(totpLabel->text().replace(" ", ""), entry->totp()); } void TestGui::testSearch()