#include <KPixmapSequence>
#include <KPixmapSequenceWidget>
#include <KUnitConversion>
-#include <KMessageBox>
#include "weatherlocation.h"
#include "weathervalidator.h"
void setSource(int index)
{
+ // do not emit the signals when searching, valid source may not even be found
+ if (!searchLocation.isEmpty()) {
+ return;
+ }
+
QString text = ui.locationCombo->itemData(index).toString();
if (!text.isEmpty()) {
source = text;
emit q->settingsChanged();
+ emit q->configValueChanged();
}
}
void changePressed()
{
+ if (!validator) {
+ kWarning() << "No validator";
+ return;
+ }
+
QString text = ui.locationCombo->currentText();
if (text.isEmpty()) {
d->ui.visibilityComboBox->addItem(KLength::unitDescription(unit), unit);
}
+ d->ui.locationMessage->hide();
+ d->ui.locationMessage->setMessageType(KMessageWidget::Error);
+
connect(d->ui.locationCombo, SIGNAL(returnPressed()), this, SLOT(changePressed()));
connect(d->ui.changeButton, SIGNAL(clicked()), this, SLOT(changePressed()));
this, SIGNAL(settingsChanged()));
connect(d->ui.locationCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(setSource(int)));
-
- connect(d->ui.locationCombo, SIGNAL(currentIndexChanged(int)) , this , SIGNAL(configValueChanged()));
+
connect(d->ui.pressureComboBox, SIGNAL(currentIndexChanged(int)) , this , SIGNAL(configValueChanged()));
connect(d->ui.updateIntervalSpinBox, SIGNAL(valueChanged(int)) , this , SIGNAL(configValueChanged()));
connect(d->ui.temperatureComboBox, SIGNAL(currentIndexChanged(int)) , this , SIGNAL(configValueChanged()));
busyWidget = nullptr;
kDebug() << ui.locationCombo->count();
if (ui.locationCombo->count() == 0) {
- KMessageBox::information(
- q,
- i18n("No weather stations found for '%1'", searchLocation),
- i18n("No weather stations found"),
- QString::fromLatin1("WeatherConfig")
- );
+ ui.locationMessage->setText(i18n("No weather stations found for '%1'", searchLocation));
+ ui.locationMessage->animatedShow();
} else {
ui.locationCombo->showPopup();
}
+ searchLocation.clear();
}
void WeatherConfig::setUpdateInterval(int interval)
<property name="margin">
<number>0</number>
</property>
- <item row="0" column="0">
+ <item row="0" column="0" colspan="2">
+ <widget class="KMessageWidget" name="locationMessage">
+ </widget>
+ </item>
+ <item row="1" column="0">
<widget class="QLabel" name="locationLabel">
<property name="font">
<font>
</property>
</widget>
</item>
- <item row="1" column="0">
+ <item row="2" column="0">
<widget class="QLabel" name="cityLabel">
<property name="minimumSize">
<size>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<layout class="QHBoxLayout" name="locationlayout">
<property name="spacing">
<number>0</number>
</item>
</layout>
</item>
- <item row="2" column="1">
+ <item row="3" column="1">
<layout class="QHBoxLayout" name="locationSearchLayout">
<property name="spacing">
<number>0</number>
</item>
</layout>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="intervalLabel">
<property name="minimumSize">
<size>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>0</number>
</item>
</layout>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="unitsLabel">
<property name="font">
<font>
</property>
</widget>
</item>
- <item row="5" column="1">
+ <item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>0</number>
</item>
</layout>
</item>
- <item row="5" column="0">
+ <item row="6" column="0">
<widget class="QLabel" name="temperatureLabel">
<property name="minimumSize">
<size>
</property>
</widget>
</item>
- <item row="6" column="0">
+ <item row="7" column="0">
<widget class="QLabel" name="pressureLabel">
<property name="minimumSize">
<size>
</property>
</widget>
</item>
- <item row="6" column="1">
+ <item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>0</number>
</item>
</layout>
</item>
- <item row="7" column="0">
+ <item row="8" column="0">
<widget class="QLabel" name="speedLabel">
<property name="minimumSize">
<size>
</property>
</widget>
</item>
- <item row="7" column="1">
+ <item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="spacing">
<number>0</number>
</item>
</layout>
</item>
- <item row="8" column="0">
+ <item row="9" column="0">
<widget class="QLabel" name="visibilityLabel">
<property name="minimumSize">
<size>
</property>
</widget>
</item>
- <item row="8" column="1">
+ <item row="9" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="spacing">
<number>0</number>
</item>
</layout>
</item>
- <item row="9" column="0">
+ <item row="10" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</widget>
<customwidgets>
<customwidget>
+ <class>KMessageWidget</class>
+ <extends>QFrame</extends>
+ <header>kmessagewidget.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>