From 5f093b22feccab507dc996fdea298e5f5d23fb51 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE <0xfeedc0de64@gmail.com> Date: Sun, 11 Mar 2018 14:55:29 +0100 Subject: [PATCH] Implemented WeatherSettingsWidget::isValid --- plugins/weatherplugin/weathersettingswidget.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/weatherplugin/weathersettingswidget.cpp b/plugins/weatherplugin/weathersettingswidget.cpp index bbc1ae8..d48c4e2 100644 --- a/plugins/weatherplugin/weathersettingswidget.cpp +++ b/plugins/weatherplugin/weathersettingswidget.cpp @@ -19,13 +19,15 @@ WeatherSettingsWidget::WeatherSettingsWidget(ZeiterfassungSettings &settings, QW bool WeatherSettingsWidget::isValid(QString &message) const { - Q_UNUSED(message) + auto valid = QUrl::fromUserInput(m_lineEdit->text()).isValid(); - qDebug() << "called"; - return true; + if(!valid) + message = tr("The weather api url is invalid!"); + + return valid; } void WeatherSettingsWidget::apply() { - qDebug() << "called"; + m_settings.setUrl(QUrl::fromUserInput(m_lineEdit->text())); }