Commit 53ba3001 authored by Laurent Montel's avatar Laurent Montel 😁

Don't show date/time widget when server doesn't support it

parent 590264ba
......@@ -67,6 +67,10 @@ void VacationEditWidgetTest::shouldHaveDefaultValue()
QVERIFY(mStartDate);
QVERIFY(mStartDate->isEnabled());
KTimeComboBox *mStartTime = w.findChild<KTimeComboBox *>(QStringLiteral("mStartTime"));
QVERIFY(mStartTime);
QCheckBox *mStartTimeActive = w.findChild<QCheckBox *>(QStringLiteral("mStartTimeActive"));
QVERIFY(mStartTimeActive);
QVERIFY(!mStartTimeActive->isChecked());
......@@ -224,4 +228,31 @@ void VacationEditWidgetTest::shouldGetValues()
}
void VacationEditWidgetTest::shouldHideDateTime()
{
KSieveUi::VacationEditWidget w;
w.show();
KDateComboBox *mStartDate = w.findChild<KDateComboBox *>(QStringLiteral("mStartDate"));
QCheckBox *mStartTimeActive = w.findChild<QCheckBox *>(QStringLiteral("mStartTimeActive"));
KDateComboBox *mEndDate = w.findChild<KDateComboBox *>(QStringLiteral("mEndDate"));
KTimeComboBox *mEndTime = w.findChild<KTimeComboBox *>(QStringLiteral("mEndTime"));
QCheckBox *mEndTimeActive = w.findChild<QCheckBox *>(QStringLiteral("mEndTimeActive"));
KTimeComboBox *mStartTime = w.findChild<KTimeComboBox *>(QStringLiteral("mStartTime"));
w.enableDates(true);
QVERIFY(mStartDate->isVisible());
QVERIFY(mStartTimeActive->isVisible());
QVERIFY(mEndDate->isVisible());
QVERIFY(mEndTime->isVisible());
QVERIFY(mEndTimeActive->isVisible());
QVERIFY(mStartTime->isVisible());
w.enableDates(false);
QVERIFY(!mStartDate->isVisible());
QVERIFY(!mStartTimeActive->isVisible());
QVERIFY(!mEndDate->isVisible());
QVERIFY(!mEndTime->isVisible());
QVERIFY(!mEndTimeActive->isVisible());
QVERIFY(!mStartTime->isVisible());
}
QTEST_MAIN(VacationEditWidgetTest)
......@@ -32,6 +32,7 @@ public:
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldGetValues();
void shouldHideDateTime();
};
#endif // VACATIONEDITWIDGETTEST_H
......@@ -402,6 +402,11 @@ void VacationEditWidget::enableDates(bool enable)
mStartDateLabel->setVisible(enable);
mEndDate->setVisible(enable);
mEndDateLabel->setVisible(enable);
mStartTime->setVisible(enable);
mStartTimeActive->setVisible(enable);
mEndTime->setVisible(enable);
mEndTimeActive->setVisible(enable);
}
void VacationEditWidget::mailActionChanged(int action)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment