diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-27 06:50:20 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-27 06:53:11 -0700 |
commit | 485df96cf66132ae7f7d386331945fa2f5883120 (patch) | |
tree | 65275b02e3bb8991679c8684eb2a2ab78297ac17 | |
parent | 5a61c81cc21e6f18b83b3b6962d5d18c777fcb73 (diff) | |
download | subsurface-485df96cf66132ae7f7d386331945fa2f5883120.tar.gz |
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 <dirk@hohndel.org>
-rw-r--r-- | qt-ui/maintab.cpp | 15 | ||||
-rw-r--r-- | qt-ui/maintab.h | 1 |
2 files changed, 16 insertions, 0 deletions
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); |