summaryrefslogtreecommitdiffstats
path: root/qt-ui/locationinformation.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-08-25 21:03:20 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-25 18:00:15 -0700
commitfc6d819616b69f7c69dc8743bc25aa8ad51708a4 (patch)
tree04df3ed15e35816c95f4190e01a9f2e827b8bfa4 /qt-ui/locationinformation.cpp
parent0ba832ef12382939ef93bb5d7f81b63c9deb7e5d (diff)
downloadsubsurface-fc6d819616b69f7c69dc8743bc25aa8ad51708a4.tar.gz
Create a new dive site and edit it automatically
If the user clicks on the first or second option of the drop down list, subsurface will move him to the dive site edit panel automatically, since it's a new dive site and there's no information about it yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/locationinformation.cpp')
-rw-r--r--qt-ui/locationinformation.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index 2a52d6d7f..71d582e09 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -235,11 +235,19 @@ void LocationManagementEditHelper::handleActivation(const QModelIndex& activated
activated.row(), LocationInformationModel::UUID);
last_uuid = uuidIdx.data().toInt();
- // Special case: first two options: add dive site.
- if (activated.row() < 2) {
- qDebug() << "Setting to " << activated.data().toString();
- emit setLineEditText(activated.data().toString());
+ /* if we are in 'recently added divesite mode, create a new divesite,
+ * and go to dive site edit edit mode. */
+ if (last_uuid == RECENTLY_ADDED_DIVESITE) {
+ uint32_t ds_uuid = create_dive_site(qPrintable(activated.data().toString()), current_dive->when);
+ qDebug() << "ds_uuid" << ds_uuid;
+ struct dive_site *ds = get_dive_site_by_uuid(ds_uuid);
+ copy_dive_site(ds, &displayed_dive_site);
+ displayed_dive.dive_site_uuid = ds->uuid;
+ last_uuid = ds->uuid;
+ // Move this out of here later.
+ MainWindow::instance()->startDiveSiteEdit();
}
+
qDebug() << "Selected dive_site: " << last_uuid;
}
@@ -254,7 +262,7 @@ uint32_t LocationManagementEditHelper::diveSiteUuid() const {
void LocationInformationWidget::reverseGeocode()
{
- qDebug() << "Chamou";
+ qDebug() << "Chamou aqui";
ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
geoLookup->lookup(&displayed_dive_site);
updateLabels();