summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-05-18 13:29:05 +0200
committerMontel Laurent <[email protected]>2017-05-18 13:29:05 +0200
commit63016b4e9d52c0779eb03da169e6519bcc758bc8 (patch)
tree3ca3c781989edfa2e3b317d5a3c13ab41585cdc0
parent48bb4fc6d99f31849b56b7999720ceb808747978 (diff)
Allow to specify range
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/widgets/selectdatewidget.cpp21
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/widgets/sievedatespinbox.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/widgets/sievedatespinbox.h2
3 files changed, 19 insertions, 11 deletions
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/widgets/selectdatewidget.cpp b/src/ksieveui/autocreatescripts/sieveconditions/widgets/selectdatewidget.cpp
index 765d198..b30bf4c 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/widgets/selectdatewidget.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/widgets/selectdatewidget.cpp
@@ -168,13 +168,6 @@ QString SelectDateWidget::dateValue(SelectDateWidget::DateType type) const
case Day:
str = QStringLiteral("%1").arg(mDateValue->value(), 2, 10, QLatin1Char('0'));
break;
- case Date:
- str = QLocale::c().toString(mDateEdit->date());
- break;
- case Julian:
- //TODO
- str = QLocale::c().toString(mDateEdit->date());
- break;
case Hour:
str = QStringLiteral("%1").arg(mDateValue->value(), 2, 10, QLatin1Char('0'));
break;
@@ -184,6 +177,16 @@ QString SelectDateWidget::dateValue(SelectDateWidget::DateType type) const
case Second:
str = QStringLiteral("%1").arg(mDateValue->value(), 2, 10, QLatin1Char('0'));
break;
+ case Weekday:
+ str = QStringLiteral("%1").arg(mDateValue->value());
+ break;
+ case Date:
+ str = QLocale::c().toString(mDateEdit->date());
+ break;
+ case Julian:
+ //TODO
+ str = QLocale::c().toString(mDateEdit->date());
+ break;
case Time:
str = QLocale::c().toString(mTimeEdit->time());
break;
@@ -196,9 +199,6 @@ QString SelectDateWidget::dateValue(SelectDateWidget::DateType type) const
case Zone:
str = QLocale::c().toString(mDateEdit->date());
break;
- case Weekday:
- str = QStringLiteral("%1").arg(mDateValue->value());
- break;
}
return str;
}
@@ -308,7 +308,6 @@ void SelectDateWidget::setCode(const QString &type, const QString &value)
case Weekday:
case Year:
mStackWidget->setCurrentWidget(mDateValue);
- qDebug() << "value "<<value;
mDateValue->setValue(value.toInt());
break;
case Date:
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/widgets/sievedatespinbox.cpp b/src/ksieveui/autocreatescripts/sieveconditions/widgets/sievedatespinbox.cpp
index 6741500..f82fa28 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/widgets/sievedatespinbox.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/widgets/sievedatespinbox.cpp
@@ -33,6 +33,13 @@ SieveDateSpinBox::~SieveDateSpinBox()
}
+void SieveDateSpinBox::setRange(int minValue, int maxValue)
+{
+ //We need to define specialValueText => we set minimum to minimum - 1
+ setMaximum(maxValue);
+ setMinimum(minValue - 1);
+}
+
void SieveDateSpinBox::setType(KSieveUi::SelectDateWidget::DateType type)
{
mType = type;
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/widgets/sievedatespinbox.h b/src/ksieveui/autocreatescripts/sieveconditions/widgets/sievedatespinbox.h
index f4ff429..44ce79a 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/widgets/sievedatespinbox.h
+++ b/src/ksieveui/autocreatescripts/sieveconditions/widgets/sievedatespinbox.h
@@ -33,6 +33,8 @@ public:
~SieveDateSpinBox();
void setType(KSieveUi::SelectDateWidget::DateType type);
+ void setRange(int minValue, int maxValue);
+
void setCode(const QString &value);
QString code() const;