[PATCH v2] Use date format from system locale
Dirk Hohndel
dirk at hohndel.org
Sun Nov 17 07:03:09 UTC 2013
I'll take this patch and then we'll see if it breaks things in weird
locales :-)
I remember there was some reason why we hardcoded it... but a quick grep
through the mailing list doesn't reveal anything. Most likely it was
just me being dumb.
Thanks
/D
On Sun, 2013-11-17 at 12:31 +0100, Anton Lundin wrote:
> Instead of hard coding a American date format, let qt use whatever the
> locale suggests.
>
> Signed-off-by: Anton Lundin <glance at acc.umu.se>
> ---
> qt-ui/maintab.cpp | 6 +++---
> qt-ui/maintab.ui | 3 ---
> 2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
> index 60b4add..6d22a8d 100644
> --- a/qt-ui/maintab.cpp
> +++ b/qt-ui/maintab.cpp
> @@ -169,7 +169,7 @@ void MainTab::enableEdition(EditMode newEditMode)
> notesBackup[mydive].coordinates = ui.coordinates->text();
> notesBackup[mydive].airtemp = get_temperature_string(mydive->airtemp, true);
> notesBackup[mydive].watertemp = get_temperature_string(mydive->watertemp, true);
> - notesBackup[mydive].datetime = QDateTime::fromTime_t(mydive->when - gettimezoneoffset()).toString(QString("M/d/yy h:mm"));
> + notesBackup[mydive].datetime = QDateTime::fromTime_t(mydive->when - gettimezoneoffset()).toString();
> char buf[1024];
> taglist_get_tagstring(mydive->tag_list, buf, 1024);
> notesBackup[mydive].tags = QString(buf);
> @@ -465,7 +465,7 @@ void MainTab::acceptChanges()
> notesBackup[curr].rating != ui.visibility->currentStars() ||
> notesBackup[curr].airtemp != ui.airtemp->text() ||
> notesBackup[curr].watertemp != ui.watertemp->text() ||
> - notesBackup[curr].datetime != ui.dateTimeEdit->dateTime().toString(QString("M/d/yy h:mm")) ||
> + notesBackup[curr].datetime != ui.dateTimeEdit->dateTime().toString() ||
> notesBackup[curr].visibility != ui.rating->currentStars() ||
> notesBackup[curr].tags != ui.tagWidget->text()) {
> mark_divelist_changed(TRUE);
> @@ -581,7 +581,7 @@ void MainTab::rejectChanges()
> ui.tagWidget->setText(notesBackup[curr].tags);
> // it's a little harder to do the right thing for the date time widget
> if (curr) {
> - ui.dateTimeEdit->setDateTime(QDateTime::fromString(notesBackup[curr].datetime, QString("M/d/y h:mm")));
> + ui.dateTimeEdit->setDateTime(QDateTime::fromString(notesBackup[curr].datetime));
> } else {
> QLineEdit *le = ui.dateTimeEdit->findChild<QLineEdit*>();
> le->setText("");
> diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui
> index 6ab9f9b..72e1e53 100644
> --- a/qt-ui/maintab.ui
> +++ b/qt-ui/maintab.ui
> @@ -76,9 +76,6 @@
> </item>
> <item row="2" column="0">
> <widget class="QDateTimeEdit" name="dateTimeEdit">
> - <property name="displayFormat">
> - <string>M/d/yy h:mm</string>
> - </property>
> <property name="calendarPopup">
> <bool>true</bool>
> </property>
More information about the subsurface
mailing list