From 485df96cf66132ae7f7d386331945fa2f5883120 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 27 Jun 2015 06:50:20 -0700 Subject: Dive site rewrite: mark location field as soon as editing starts Don't wait until the user switches focus to a different part of the tab to mark the location field. Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 15 +++++++++++++++ qt-ui/maintab.h | 1 + 2 files changed, 16 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 2dbc662b6..f44d850c6 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1304,6 +1304,21 @@ void MainTab::on_tagWidget_textChanged() markChangedWidget(ui.tagWidget); } +void MainTab::on_location_textChanged() +{ + if (editMode == IGNORE) + return; + + // we don't want to act on the edit until editing is finished, + // but we want to mark the field so it's obvious it is being edited + QString currentLocation; + struct dive_site *ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid); + if (ds) + currentLocation = ds->name; + if (ui.location->text() != currentLocation) + markChangedWidget(ui.location); +} + void MainTab::on_location_editingFinished() { if (editMode == IGNORE || acceptingEdit == true) diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index 6193abaf7..844710954 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -65,6 +65,7 @@ slots: void acceptChanges(); void rejectChanges(); void on_location_editingFinished(); + void on_location_textChanged(); void on_divemaster_textChanged(); void on_buddy_textChanged(); void on_suit_textChanged(const QString &text); -- cgit v1.2.3-70-g09d2