Commit 9034c1d0 authored by Laurent Montel's avatar Laurent Montel 😁

Fix crash when server doesn't support "date"

(cherry picked from commit 05ed22b4)
parent 9bf6d23d
...@@ -123,7 +123,7 @@ void VacationPageWidget::slotGetResult(const QString &serverName, const QStringL ...@@ -123,7 +123,7 @@ void VacationPageWidget::slotGetResult(const QString &serverName, const QStringL
mUrl.setPath(mUrl.path() + scriptName); mUrl.setPath(mUrl.path() + scriptName);
// Whether the server supports the "date" extension // Whether the server supports the "date" extension
const bool supportsSieveDate = mUrl.scheme() == QStringLiteral("sieve") && sieveCapabilities.contains(QStringLiteral("date")); mHasDateSupport = mUrl.scheme() == QStringLiteral("sieve") && sieveCapabilities.contains(QStringLiteral("date"));
KSieveUi::VacationUtils::Vacation vacation = KSieveUi::VacationUtils::parseScript(script); KSieveUi::VacationUtils::Vacation vacation = KSieveUi::VacationUtils::parseScript(script);
...@@ -143,8 +143,9 @@ void VacationPageWidget::slotGetResult(const QString &serverName, const QStringL ...@@ -143,8 +143,9 @@ void VacationPageWidget::slotGetResult(const QString &serverName, const QStringL
mVacationEditWidget->setDomainName(vacation.excludeDomain); mVacationEditWidget->setDomainName(vacation.excludeDomain);
mVacationEditWidget->enableDomainAndSendForSpam(!VacationSettings::allowOutOfOfficeUploadButNoSettings()); mVacationEditWidget->enableDomainAndSendForSpam(!VacationSettings::allowOutOfOfficeUploadButNoSettings());
mVacationEditWidget->enableDates(supportsSieveDate); mVacationEditWidget->enableDates(mHasDateSupport);
if (supportsSieveDate) { qDebug()<<" supportsSieveDate *****************"<<mHasDateSupport;
if (mHasDateSupport) {
mVacationEditWidget->setStartDate(vacation.startDate); mVacationEditWidget->setStartDate(vacation.startDate);
mVacationEditWidget->setStartTime(vacation.startTime); mVacationEditWidget->setStartTime(vacation.startTime);
mVacationEditWidget->setEndDate(vacation.endDate); mVacationEditWidget->setEndDate(vacation.endDate);
...@@ -170,10 +171,17 @@ KSieveUi::VacationCreateScriptJob *VacationPageWidget::writeScript() ...@@ -170,10 +171,17 @@ KSieveUi::VacationCreateScriptJob *VacationPageWidget::writeScript()
vacation.aliases = mVacationEditWidget->mailAliases(); vacation.aliases = mVacationEditWidget->mailAliases();
vacation.sendForSpam = mVacationEditWidget->sendForSpam(); vacation.sendForSpam = mVacationEditWidget->sendForSpam();
vacation.excludeDomain = mVacationEditWidget->domainName(); vacation.excludeDomain = mVacationEditWidget->domainName();
vacation.startDate = mVacationEditWidget->startDate(); if (mHasDateSupport) {
vacation.startTime = mVacationEditWidget->startTime(); vacation.startDate = mVacationEditWidget->startDate();
vacation.endDate = mVacationEditWidget->endDate(); vacation.startTime = mVacationEditWidget->startTime();
vacation.endTime = mVacationEditWidget->endTime(); vacation.endDate = mVacationEditWidget->endDate();
vacation.endTime = mVacationEditWidget->endTime();
} else {
vacation.startDate = QDate();
vacation.startTime = QTime();
vacation.endDate = QDate();
vacation.endTime = QTime();
}
const QString script = VacationUtils::composeScript(vacation); const QString script = VacationUtils::composeScript(vacation);
createJob->setStatus(active, mWasActive); createJob->setStatus(active, mWasActive);
createJob->setScript(script); createJob->setScript(script);
......
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