Skip to content

Commit

Permalink
Revert change f2374c2
Browse files Browse the repository at this point in the history
WE2-797

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored and mrts committed Aug 2, 2024
1 parent 757f9cd commit 41606c2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 37 deletions.
39 changes: 6 additions & 33 deletions src/ui/dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<height>510</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>550</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string notr="true">Web eID</string>
</property>
Expand Down Expand Up @@ -193,9 +199,6 @@ height: 24px;
<property name="spacing">
<number>30</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>20</number>
</property>
Expand Down Expand Up @@ -232,12 +235,6 @@ height: 24px;
</property>
<item>
<widget class="QLabel" name="waitingPageTitleLabel">
<property name="minimumSize">
<size>
<width>510</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
Expand Down Expand Up @@ -309,12 +306,6 @@ height: 24px;
</property>
<item>
<widget class="QLabel" name="messagePageTitleLabel">
<property name="minimumSize">
<size>
<width>510</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
Expand Down Expand Up @@ -450,12 +441,6 @@ height: 24px;
</property>
<item>
<widget class="QLabel" name="selectCertificatePageTitleLabel">
<property name="minimumSize">
<size>
<width>510</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
Expand Down Expand Up @@ -538,12 +523,6 @@ height: 24px;
</property>
<item>
<widget class="QLabel" name="pinInputPageTitleLabel">
<property name="minimumSize">
<size>
<width>510</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
Expand Down Expand Up @@ -794,12 +773,6 @@ height: 24px;
</item>
<item>
<widget class="QWidget" name="aboutContent" native="true">
<property name="minimumSize">
<size>
<width>510</width>
<height>0</height>
</size>
</property>
<layout class="QGridLayout" name="aboutContentLayout">
<property name="horizontalSpacing">
<number>10</number>
Expand Down
20 changes: 16 additions & 4 deletions src/ui/webeiddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private)
ui->fatalHelp->hide();
ui->selectAnotherCertificate->hide();

connect(ui->pageStack, &QStackedWidget::currentChanged, this, [this] {
ui->pageStack->setFixedHeight(ui->pageStack->currentWidget()->sizeHint().height());
});
connect(ui->pageStack, &QStackedWidget::currentChanged, this, &WebEidDialog::resizeHeight);
connect(ui->selectionGroup, qOverload<QAbstractButton*>(&QButtonGroup::buttonClicked), this,
[this] {
ui->okButton->setEnabled(true);
Expand Down Expand Up @@ -245,12 +243,16 @@ void WebEidDialog::showAboutPage()
if (app->isSafariExtensionContainingApp()) {
d->setupOK([app] { app->showSafariSettings(); }, QT_TR_NOOP("Open Safari settings..."),
true);
connect(app, &Application::safariExtensionEnabled, d->ui->aboutAlert, &QWidget::setHidden);
connect(app, &Application::safariExtensionEnabled, d, [d](bool value) {
d->ui->aboutAlert->setHidden(value);
d->resizeHeight();
});
app->requestSafariExtensionState();
} else {
d->ui->okButton->hide();
}
d->ui->pageStack->setCurrentIndex(int(Page::ABOUT));
d->resizeHeight();
d->open();
connect(d, &WebEidDialog::finished, qApp, &QApplication::quit);
}
Expand All @@ -267,6 +269,7 @@ void WebEidDialog::showFatalErrorPage()
d->ui->cancelButton->show();
d->ui->okButton->hide();
d->ui->pageStack->setCurrentIndex(int(Page::ALERT));
d->resizeHeight();
d->exec();
}

Expand Down Expand Up @@ -454,6 +457,7 @@ void WebEidDialog::onVerifyPinFailed(const VerifyPinFailed::Status status, const
break;
case Status::PIN_BLOCKED:
displayPinBlockedError();
resizeHeight();
return;
case Status::INVALID_PIN_LENGTH:
message = [] { return tr("Invalid PIN length"); };
Expand Down Expand Up @@ -481,6 +485,7 @@ void WebEidDialog::onVerifyPinFailed(const VerifyPinFailed::Status status, const
ui->pinTitleLabel->show();
ui->okButton->setDisabled(true);
ui->cancelButton->setEnabled(true);
resizeHeight();
}
}

Expand All @@ -497,6 +502,7 @@ bool WebEidDialog::event(QEvent* event)
case QEvent::LanguageChange:
ui->retranslateUi(this);
emit languageChange();
resizeHeight();
break;
case QEvent::MouseButtonRelease:
if (auto* w = findChild<QWidget*>(QStringLiteral("langMenu"))) {
Expand Down Expand Up @@ -685,6 +691,12 @@ void WebEidDialog::showPinInputWarning(bool show)
style()->polish(ui->pinInput);
}

void WebEidDialog::resizeHeight()
{
ui->pageStack->setFixedHeight(ui->pageStack->currentWidget()->sizeHint().height());
adjustSize();
}

QPixmap WebEidDialog::pixmap(QLatin1String name)
{
return {QStringLiteral(":/images/%1%2.svg")
Expand Down
1 change: 1 addition & 0 deletions src/ui/webeiddialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class WebEidDialog final : public WebEidUI
void displayPinBlockedError();

void showPinInputWarning(bool show);
void resizeHeight();

static QPixmap pixmap(QLatin1String name);
constexpr static std::tuple<const char*, const char*, QLatin1String>
Expand Down

0 comments on commit 41606c2

Please sign in to comment.