Use date format from system locale

Instead of hard coding a American date format, let qt use whatever the
locale suggests.

Fixes #248

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2013-11-17 12:31:09 +01:00 committed by Dirk Hohndel
parent 612c5713b4
commit 2b1c75a584
2 changed files with 3 additions and 6 deletions

View file

@ -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("");

View file

@ -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>