[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [digikam] core/app/date: polish
From:       Maik Qualmann <null () kde ! org>
Date:       2018-09-16 7:08:30
Message-ID: E1g1RAU-0001F5-H2 () code ! kde ! org
[Download RAW message or body]

Git commit 0003da46120fc0cfe32add95d8fd21400127955f by Maik Qualmann.
Committed on 16/09/2018 at 07:08.
Pushed by mqualmann into branch 'master'.

polish

M  +10   -8    core/app/date/ddatepicker.cpp

https://commits.kde.org/digikam/0003da46120fc0cfe32add95d8fd21400127955f

diff --git a/core/app/date/ddatepicker.cpp b/core/app/date/ddatepicker.cpp
index f72e3cd0fb..811caea33f 100644
--- a/core/app/date/ddatepicker.cpp
+++ b/core/app/date/ddatepicker.cpp
@@ -230,14 +230,15 @@ void DDatePicker::resizeEvent(QResizeEvent* e)
 
 void DDatePicker::dateChangedSlot(const QDate& dt)
 {
-    QString format = locale().dateFormat(QLocale::ShortFormat);
+    QString dateFormat = locale().dateFormat(QLocale::ShortFormat);
 
-    if (format.count(QLatin1Char('y')) == 2)
+    if (!dateFormat.contains(QLatin1String("yyyy")))
     {
-        format.replace(QLatin1String("yy"), QLatin1String("yyyy"));
+        dateFormat.replace(QLatin1String("yy"),
+                           QLatin1String("yyyy"));
     }
 
-    d->line->setText(dt.toString(format));
+    d->line->setText(dt.toString(dateFormat));
     d->selectMonth->setText(locale().standaloneMonthName(dt.month(), QLocale::LongFormat));
     d->fillWeeksCombo();
 
@@ -434,14 +435,15 @@ DDateTable *DDatePicker::dateTable() const
 
 void DDatePicker::lineEnterPressed()
 {
-    QString format = locale().dateFormat(QLocale::ShortFormat);
+    QString dateFormat = locale().dateFormat(QLocale::ShortFormat);
 
-    if (format.count(QLatin1Char('y')) == 2)
+    if (!dateFormat.contains(QLatin1String("yyyy")))
     {
-        format.replace(QLatin1String("yy"), QLatin1String("yyyy"));
+        dateFormat.replace(QLatin1String("yy"),
+                           QLatin1String("yyyy"));
     }
 
-    QDate newDate = QDate::fromString(d->line->text(), format);
+    QDate newDate = QDate::fromString(d->line->text(), dateFormat);
 
     if (newDate.isValid())
     {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic