[SCM] kwidgetsaddons packaging branch, master, updated. debian/5.28.0-1-6-g37ca58b

Maximiliano Curia maxy at moszumanska.debian.org
Fri Apr 7 15:37:54 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/frameworks/kwidgetsaddons.git;a=commitdiff;h=c6f26d8

The following commit has been merged in the master branch:
commit c6f26d868a04f3596c26f8c3eb8cee91e458b02e
Author: Maximiliano Curia <maxy at gnuservers.com.ar>
Date:   Fri Apr 7 16:53:45 2017 +0200

    Apply "Fix KDateComboBox checks for valid entered dates" (1550b2c)
    
    This fixes wrong or missing checks to determine whether an entered date
    is valid.
    Add upstream patch as:
     Fix-KDateComboBox-checks-for-valid-entered-dates.patch
    
    Gbp-Dch: Full
---
 ...teComboBox-checks-for-valid-entered-dates.patch | 251 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 252 insertions(+)

diff --git a/debian/patches/Fix-KDateComboBox-checks-for-valid-entered-dates.patch b/debian/patches/Fix-KDateComboBox-checks-for-valid-entered-dates.patch
new file mode 100644
index 0000000..49f2261
--- /dev/null
+++ b/debian/patches/Fix-KDateComboBox-checks-for-valid-entered-dates.patch
@@ -0,0 +1,251 @@
+From: David Jarvie <djarvie at kde.org>
+Date: Sat, 31 Dec 2016 00:01:12 +0000
+Subject: Fix KDateComboBox checks for valid entered dates
+
+This fixes wrong or missing checks to determine whether an entered
+date is valid, which fixes the following bugs:
+- When an up/down arrow or page up/down key was pressed to change the
+  date, and the minimum and maximum dates were not set, it was always
+  considered invalid and the date was not changed.
+- When the DateKeywords option was set, and the minimum and maximum
+  dates were not set, the only date which was displayed in the menu was
+  "No Date".
+- setMinimumDate() and resetMinimumDate() did nothing if no maximum
+  date was currently set.
+- setMaximumDate() and resetMaximumDate() did nothing if no minimum
+  date was currently set.
+- resetDateRange() did nothing.
+
+REVIEW: 129709
+---
+ autotests/kdatecomboboxtest.cpp | 22 +++++++++++
+ src/kdatecombobox.cpp           | 81 +++++++++++++++++++++++++++--------------
+ src/kdatecombobox.h             |  6 ++-
+ 3 files changed, 81 insertions(+), 28 deletions(-)
+
+diff --git a/autotests/kdatecomboboxtest.cpp b/autotests/kdatecomboboxtest.cpp
+index c15525a..07bb16c 100644
+--- a/autotests/kdatecomboboxtest.cpp
++++ b/autotests/kdatecomboboxtest.cpp
+@@ -95,6 +95,28 @@ void KDateComboBoxTest::testDateRange()
+     QCOMPARE(m_combo->minimumDate(), QDate(2000, 1, 1));
+     QCOMPARE(m_combo->maximumDate(), QDate(2003, 1, 1));
+ 
++    m_combo->resetDateRange();
++    QVERIFY(!m_combo->minimumDate().isValid());
++    QVERIFY(!m_combo->maximumDate().isValid());
++
++    // Check functioning when the minimum or maximum date is not already set
++
++    m_combo->setMinimumDate(QDate(2000, 1, 1));
++    QCOMPARE(m_combo->minimumDate(), QDate(2000, 1, 1));
++    QVERIFY(!m_combo->maximumDate().isValid());
++
++    m_combo->resetMinimumDate();
++    QVERIFY(!m_combo->minimumDate().isValid());
++    QVERIFY(!m_combo->maximumDate().isValid());
++
++    m_combo->setMaximumDate(QDate(2003, 1, 1));
++    QVERIFY(!m_combo->minimumDate().isValid());
++    QCOMPARE(m_combo->maximumDate(), QDate(2003, 1, 1));
++
++    m_combo->resetMaximumDate();
++    QVERIFY(!m_combo->minimumDate().isValid());
++    QVERIFY(!m_combo->maximumDate().isValid());
++
+     delete m_combo;
+ }
+ 
+diff --git a/src/kdatecombobox.cpp b/src/kdatecombobox.cpp
+index ad1d085..2df1e9d 100644
+--- a/src/kdatecombobox.cpp
++++ b/src/kdatecombobox.cpp
+@@ -51,6 +51,11 @@ public:
+     void addMenuAction(const QString &text, const QDate &date);
+     void enableMenuDates();
+     void updateDateWidget();
++    void setDateRange(const QDate &minDate,
++                      const QDate &maxDate,
++                      const QString &minWarnMsg,
++                      const QString &maxWarnMsg);
++    bool isInDateRange(const QDate &date) const;
+ 
+ // Q_PRIVATE_SLOTs
+     void clickDate();
+@@ -134,7 +139,7 @@ void KDateComboBoxPrivate::initDateWidget()
+     // If EditTime then set the line edit
+     q->lineEdit()->setReadOnly((m_options & KDateComboBox::EditDate) != KDateComboBox::EditDate);
+ 
+-    // If SelectTime then make list items visible
++    // If SelectDate then make list items visible
+     if ((m_options & KDateComboBox::SelectDate) == KDateComboBox::SelectDate ||
+             (m_options & KDateComboBox::DatePicker) == KDateComboBox::DatePicker ||
+             (m_options & KDateComboBox::DatePicker) == KDateComboBox::DateKeywords) {
+@@ -205,7 +210,7 @@ void KDateComboBoxPrivate::enableMenuDates()
+     // Hide menu dates if they are outside the date range
+     for (int i = 0; i < m_actions.count(); ++i) {
+         QDate date = m_actions[i]->data().toDate();
+-        m_actions[i]->setVisible(!date.isValid() || (date >= m_minDate && date <= m_maxDate));
++        m_actions[i]->setVisible(!date.isValid() || isInDateRange(date));
+     }
+ }
+ 
+@@ -222,16 +227,48 @@ void KDateComboBoxPrivate::updateDateWidget()
+     q->blockSignals(false);
+ }
+ 
++void KDateComboBoxPrivate::setDateRange(const QDate &minDate,
++                                        const QDate &maxDate,
++                                        const QString &minWarnMsg,
++                                        const QString &maxWarnMsg)
++{
++    if (minDate.isValid() && maxDate.isValid() && minDate > maxDate) {
++        return;
++    }
++
++    if (minDate != m_minDate || maxDate != m_maxDate ||
++            minWarnMsg != m_minWarnMsg || maxWarnMsg != m_maxWarnMsg) {
++        m_minDate = minDate;
++        m_maxDate = maxDate;
++        m_minWarnMsg = minWarnMsg;
++        m_maxWarnMsg = maxWarnMsg;
++    }
++    enableMenuDates();
++}
++
++bool KDateComboBoxPrivate::isInDateRange(const QDate &date) const
++{
++    return date.isValid() &&
++           (!m_minDate.isValid() || date >= m_minDate) &&
++           (!m_maxDate.isValid() || date <= m_maxDate);
++}
++
+ void KDateComboBoxPrivate::selectDate(QAction *action)
+ {
+     if (action->objectName() != QLatin1String("DatePicker")) {
+-        enterDate(action->data().toDate());
++        QDate date = action->data().toDate();
++        if (isInDateRange(date)) {
++            enterDate(date);
++        }
+     }
+ }
+ 
+ void KDateComboBoxPrivate::clickDate()
+ {
+-    enterDate(m_datePicker->date());
++    QDate date = m_datePicker->date();
++    if (isInDateRange(date)) {
++        enterDate(date);
++    }
+ }
+ 
+ void KDateComboBoxPrivate::editDate(const QString &text)
+@@ -341,9 +378,7 @@ void KDateComboBox::assignDate(const QDate &date)
+ bool KDateComboBox::isValid() const
+ {
+     d->parseDate();
+-    return d->m_date.isValid() &&
+-           (!d->m_minDate.isValid() || d->m_date >= d->m_minDate) &&
+-           (!d->m_maxDate.isValid() || d->m_date <= d->m_maxDate);
++    return d->isInDateRange(d->m_date);
+ }
+ 
+ bool KDateComboBox::isNull() const
+@@ -372,13 +407,14 @@ QDate KDateComboBox::minimumDate() const
+ 
+ void KDateComboBox::setMinimumDate(const QDate &minDate, const QString &minWarnMsg)
+ {
+-    setDateRange(minDate, d->m_maxDate, minWarnMsg, d->m_maxWarnMsg);
++    if (minDate.isValid()) {
++        d->setDateRange(minDate, d->m_maxDate, minWarnMsg, d->m_maxWarnMsg);
++    }
+ }
+ 
+ void KDateComboBox::resetMinimumDate()
+ {
+-    //setDateRange(d->m_minDate, d->defaultMaxDate(), d->m_minWarnMsg, QString());
+-    setDateRange(QDate(), d->m_maxDate, QString(), d->m_maxWarnMsg);
++    d->setDateRange(QDate(), d->m_maxDate, QString(), d->m_maxWarnMsg);
+ }
+ 
+ QDate KDateComboBox::maximumDate() const
+@@ -388,13 +424,14 @@ QDate KDateComboBox::maximumDate() const
+ 
+ void KDateComboBox::setMaximumDate(const QDate &maxDate, const QString &maxWarnMsg)
+ {
+-    setDateRange(d->m_minDate, maxDate, d->m_minWarnMsg, maxWarnMsg);
++    if (maxDate.isValid()) {
++        d->setDateRange(d->m_minDate, maxDate, d->m_minWarnMsg, maxWarnMsg);
++    }
+ }
+ 
+ void KDateComboBox::resetMaximumDate()
+ {
+-    //setDateRange(d->m_minDate, d->defaultMaxDate(), d->m_minWarnMsg, QString());
+-    setDateRange(d->m_minDate, QDate(), d->m_minWarnMsg, QString());
++    d->setDateRange(d->m_minDate, QDate(), d->m_minWarnMsg, QString());
+ }
+ 
+ void KDateComboBox::setDateRange(const QDate &minDate,
+@@ -402,24 +439,14 @@ void KDateComboBox::setDateRange(const QDate &minDate,
+                                  const QString &minWarnMsg,
+                                  const QString &maxWarnMsg)
+ {
+-    if (!minDate.isValid() || !maxDate.isValid() || minDate > maxDate) {
+-        return;
+-    }
+-
+-    if (minDate != d->m_minDate || maxDate != d->m_maxDate ||
+-            minWarnMsg != d->m_minWarnMsg || maxWarnMsg != d->m_maxWarnMsg) {
+-        d->m_minDate = minDate;
+-        d->m_maxDate = maxDate;
+-        d->m_minWarnMsg = minWarnMsg;
+-        d->m_maxWarnMsg = maxWarnMsg;
++    if (minDate.isValid() && maxDate.isValid()) {
++        d->setDateRange(minDate, maxDate, minWarnMsg, maxWarnMsg);
+     }
+-    d->enableMenuDates();
+ }
+ 
+ void KDateComboBox::resetDateRange()
+ {
+-    //setDateRange(d->defaultMinDate(), d->defaultMaxDate(), QString(), QString());
+-    setDateRange(QDate(), QDate(), QString(), QString());
++    d->setDateRange(QDate(), QDate(), QString(), QString());
+ }
+ 
+ QLocale::FormatType KDateComboBox::displayFormat() const
+@@ -475,7 +502,7 @@ void KDateComboBox::keyPressEvent(QKeyEvent *keyEvent)
+         QComboBox::keyPressEvent(keyEvent);
+         return;
+     }
+-    if (temp.isValid() && temp >= d->m_minDate && temp <= d->m_maxDate) {
++    if (d->isInDateRange(temp)) {
+         d->enterDate(temp);
+     }
+ }
+diff --git a/src/kdatecombobox.h b/src/kdatecombobox.h
+index d9a20ca..458c701 100644
+--- a/src/kdatecombobox.h
++++ b/src/kdatecombobox.h
+@@ -227,7 +227,9 @@ public Q_SLOTS:
+     void setMinimumDate(const QDate &minTime, const QString &minWarnMsg = QString());
+ 
+     /**
+-     * Reset the minimum date to the default
++     * Reset the minimum date to the default.
++     *
++     * The default is to have no minimum date.
+      */
+     void resetMinimumDate();
+ 
+@@ -248,6 +250,8 @@ public Q_SLOTS:
+ 
+     /**
+      * Reset the maximum date to the default
++     *
++     * The default is to have no maximum date.
+      */
+     void resetMaximumDate();
+ 
diff --git a/debian/patches/series b/debian/patches/series
index a357c1e..e0b9231 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 KMessageWidget-use-darker-red-color-when-type-is-Error.patch
+Fix-KDateComboBox-checks-for-valid-entered-dates.patch

-- 
kwidgetsaddons packaging



More information about the pkg-kde-commits mailing list