Dirk,

I didn't managed to fix the bug where the same dive site would appear with
different ids ( having the same gps coords and name ), but I fixed a theora
of other bugs.

:)

Tomaz
From 4510efa2a83b35c53ac80118eca7929de7a0243f Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 25 Aug 2015 18:12:02 -0300
Subject: [PATCH 1/7] Disable Profile when in DiveSite edit mode

I didn't have time to create / finish the photos widget, so
I'm adding back the profile view while in dive site edit mode,
but disabling it.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/mainwindow.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 7593caf..0307b08 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -132,14 +132,14 @@ MainWindow::MainWindow() : QMainWindow(),
 	registerApplicationState("EditDive", mainTab, profileContainer, diveListView, globeGps );
 	registerApplicationState("PlanDive", plannerWidget, profileContainer, plannerSettings, plannerDetails );
 	registerApplicationState("EditPlannedDive", plannerWidget, profileContainer, diveListView, globeGps );
-	registerApplicationState("EditDiveSite", diveSiteEdit, diveSitePictures, diveListView, globeGps);
+	registerApplicationState("EditDiveSite", diveSiteEdit, profileContainer, diveListView, globeGps);
 
 	setStateProperties("Default", enabledList, enabledList, enabledList,enabledList);
 	setStateProperties("AddDive", enabledList, enabledList, enabledList,enabledList);
 	setStateProperties("EditDive", enabledList, enabledList, enabledList,enabledList);
 	setStateProperties("PlanDive", enabledList, enabledList, enabledList,enabledList);
 	setStateProperties("EditPlannedDive", enabledList, enabledList, enabledList,enabledList);
-	setStateProperties("EditDiveSite", enabledList, enabledList, disabledList, enabledList);
+	setStateProperties("EditDiveSite", enabledList, disabledList, disabledList, enabledList);
 
 	setApplicationState("Default");
 
-- 
2.5.0

From a51e92de23381e8e83827f5ccdc11964a0297701 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 25 Aug 2015 18:27:19 -0300
Subject: [PATCH 2/7] s/Get Taxonomy/Manage Dive Site on the maintab.

Change the Get Taxonomy button on the maintab to manage
dive site, the get taxonomy will be inside the manage
dive site interface.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/maintab.cpp    |  4 ++--
 qt-ui/maintab.ui     | 20 ++++++++++----------
 qt-ui/mainwindow.cpp |  3 +++
 qt-ui/mainwindow.h   |  3 +++
 4 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index c200b36..dc9ec94 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -76,7 +76,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
 		locationManagementEditHelper, &LocationManagementEditHelper::handleActivation);
 
 	ui.location->setCompleter(completer);
-	connect(ui.geocodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
+	connect(ui.editDiveSiteButton, SIGNAL(clicked()), MainWindow::instance(), SIGNAL(startDiveSiteEdit()));
 
 	QAction *action = new QAction(tr("Apply changes"), this);
 	connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges()));
@@ -520,7 +520,7 @@ void MainTab::updateDiveInfo(bool clear)
 			if (ds)
 				copy_dive_site(ds, &displayed_dive_site);
 		}
-		ui.geocodeButton->setVisible(ds && dive_site_has_gps_location(ds));
+		ui.editDiveSiteButton->setVisible(ds && dive_site_has_gps_location(ds));
 		if (ds) {
 			// construct the location tags
 			QString locationTag;
diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui
index 4390d04..fb4180d 100644
--- a/qt-ui/maintab.ui
+++ b/qt-ui/maintab.ui
@@ -55,8 +55,8 @@
         <rect>
          <x>0</x>
          <y>0</y>
-         <width>449</width>
-         <height>758</height>
+         <width>445</width>
+         <height>760</height>
         </rect>
        </property>
        <layout class="QVBoxLayout" name="verticalLayout_3">
@@ -209,13 +209,13 @@
              <widget class="QLineEdit" name="location"/>
             </item>
             <item>
-             <widget class="QToolButton" name="geocodeButton">
-              <property name="text">
-               <string>...</string>
-              </property>
+             <widget class="QToolButton" name="editDiveSiteButton">
               <property name="toolTip">
                <string>Perform a location lookup based on GPS information (country, city, body of water, etc.)</string>
               </property>
+              <property name="text">
+               <string>...</string>
+              </property>
               <property name="icon">
                <iconset resource="../subsurface.qrc">
                 <normaloff>:/geocode</normaloff>:/geocode</iconset>
@@ -650,8 +650,8 @@
         <rect>
          <x>0</x>
          <y>0</y>
-         <width>317</width>
-         <height>365</height>
+         <width>287</width>
+         <height>320</height>
         </rect>
        </property>
        <layout class="QGridLayout" name="diveInfoScrollAreaLayout">
@@ -991,8 +991,8 @@
         <rect>
          <x>0</x>
          <y>0</y>
-         <width>331</width>
-         <height>220</height>
+         <width>297</width>
+         <height>187</height>
         </rect>
        </property>
        <layout class="QHBoxLayout" name="horizontalLayout">
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 0307b08..99be842 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -165,6 +165,8 @@ MainWindow::MainWindow() : QMainWindow(),
 	connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated()));
 	connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
 	connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
+	connect(this, SIGNAL(startDiveSiteEdit()), this, SLOT(on_actionDiveSiteEdit_triggered()));
+
 #ifndef NO_MARBLE
 	connect(information(), SIGNAL(diveSiteChanged(struct dive_site *)), globeGps, SLOT(centerOnDiveSite(struct dive_site *)));
 #endif
@@ -234,6 +236,7 @@ void MainWindow::setStateProperties(const QByteArray& state, const PropertyList&
 }
 
 void MainWindow::on_actionDiveSiteEdit_triggered() {
+	qDebug() << "Chamou";
 	setApplicationState("EditDiveSite");
 }
 
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 7591321..713ab9d 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -178,6 +178,9 @@ slots:
 protected:
 	void closeEvent(QCloseEvent *);
 
+signals:
+	void startDiveSiteEdit();
+
 public
 slots:
 	void turnOffNdlTts();
-- 
2.5.0

From d943e386a7d3d40e51b1caf2c3bf56de4792b1db Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 25 Aug 2015 18:45:29 -0300
Subject: [PATCH 3/7] Get Taxonomy from edit dive site widget

Moved the get taxonomy button from the maintab to the
edit dive site widget.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/locationInformation.ui  | 53 +++++++++++++++++++++++++++----------------
 qt-ui/locationinformation.cpp | 11 +++++++++
 qt-ui/locationinformation.h   |  1 +
 qt-ui/maintab.cpp             |  7 ------
 qt-ui/maintab.h               |  1 -
 5 files changed, 45 insertions(+), 28 deletions(-)

diff --git a/qt-ui/locationInformation.ui b/qt-ui/locationInformation.ui
index ad33b2a..56e8b0e 100644
--- a/qt-ui/locationInformation.ui
+++ b/qt-ui/locationInformation.ui
@@ -18,24 +18,11 @@
   </property>
   <layout class="QGridLayout" name="gridLayout">
    <property name="horizontalSpacing">
-    <number>-1</number>
+    <number>6</number>
    </property>
    <property name="verticalSpacing">
     <number>4</number>
    </property>
-   <item row="0" column="0" colspan="2">
-    <widget class="KMessageWidget" name="diveSiteMessage" native="true">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="1">
-    <widget class="QLineEdit" name="diveSiteName"/>
-   </item>
    <item row="1" column="0">
     <widget class="QLabel" name="label">
      <property name="text">
@@ -70,6 +57,9 @@
      </property>
     </widget>
    </item>
+   <item row="2" column="1">
+    <widget class="QLineEdit" name="diveSiteCoordinates"/>
+   </item>
    <item row="2" column="0">
     <widget class="QLabel" name="label_2">
      <property name="text">
@@ -77,15 +67,36 @@
      </property>
     </widget>
    </item>
-   <item row="4" column="1" rowspan="2">
-    <widget class="QPlainTextEdit" name="diveSiteNotes"/>
+   <item row="2" column="2">
+    <widget class="QToolButton" name="geoCodeButton">
+     <property name="text">
+      <string>...</string>
+     </property>
+     <property name="icon">
+      <iconset resource="../subsurface.qrc">
+       <normaloff>:/satellite</normaloff>:/satellite</iconset>
+     </property>
+    </widget>
    </item>
-   <item row="2" column="1">
-    <widget class="QLineEdit" name="diveSiteCoordinates"/>
+   <item row="1" column="1" colspan="2">
+    <widget class="QLineEdit" name="diveSiteName"/>
    </item>
-   <item row="3" column="1">
+   <item row="3" column="1" colspan="2">
     <widget class="QLineEdit" name="diveSiteDescription"/>
    </item>
+   <item row="4" column="1" rowspan="2" colspan="2">
+    <widget class="QPlainTextEdit" name="diveSiteNotes"/>
+   </item>
+   <item row="0" column="0" colspan="3">
+    <widget class="KMessageWidget" name="diveSiteMessage" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <customwidgets>
@@ -96,6 +107,8 @@
    <container>1</container>
   </customwidget>
  </customwidgets>
- <resources/>
+ <resources>
+  <include location="../subsurface.qrc"/>
+ </resources>
  <connections/>
 </ui>
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index d8d027a..2a52d6d 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -6,6 +6,8 @@
 #include "globe.h"
 #include "filtermodels.h"
 #include "divelocationmodel.h"
+#include "divesitehelpers.h"
+
 #include <QDebug>
 #include <QShowEvent>
 
@@ -26,6 +28,7 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
 
 	connect(this, SIGNAL(startFilterDiveSite(uint32_t)), MultiFilterSortModel::instance(), SLOT(startFilterDiveSite(uint32_t)));
 	connect(this, SIGNAL(stopFilterDiveSite()), MultiFilterSortModel::instance(), SLOT(stopFilterDiveSite()));
+	connect(ui.geoCodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
 
 #ifndef NO_MARBLE
 	// Globe Management Code.
@@ -248,3 +251,11 @@ void LocationManagementEditHelper::resetDiveSiteUuid() {
 uint32_t LocationManagementEditHelper::diveSiteUuid() const {
 	return last_uuid;
 }
+
+void LocationInformationWidget::reverseGeocode()
+{
+	qDebug() << "Chamou";
+	ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
+	geoLookup->lookup(&displayed_dive_site);
+	updateLabels();
+}
diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h
index 0a2f662..445fd87 100644
--- a/qt-ui/locationinformation.h
+++ b/qt-ui/locationinformation.h
@@ -24,6 +24,7 @@ public slots:
 	void on_diveSiteDescription_textChanged(const QString& text);
 	void on_diveSiteName_textChanged(const QString& text);
 	void on_diveSiteNotes_textChanged();
+	void reverseGeocode();
 private slots:
 	void updateLabels();
 signals:
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index dc9ec94..ec25fe3 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -1656,10 +1656,3 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what)
 		weightModel->changed = true;
 	}
 }
-
-void MainTab::reverseGeocode()
-{
-	ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
-	geoLookup->lookup(&displayed_dive_site);
-	updateDiveInfo();
-}
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 4c64b0b..3322859 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -99,7 +99,6 @@ slots:
 	void enableGeoLookupEdition();
 	void disableGeoLookupEdition();
 	void setCurrentLocationIndex();
-	void reverseGeocode();
 private:
 	Ui::MainTab ui;
 	WeightModel *weightModel;
-- 
2.5.0

From 6040f5782bb55e0cd10ac83252f2fd0238b2bf97 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 25 Aug 2015 18:47:53 -0300
Subject: [PATCH 4/7] Remove edit dive site from the menubar.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/mainwindow.ui | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index 4b64cb0..8ecdc13 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -62,7 +62,7 @@
      <x>0</x>
      <y>0</y>
      <width>861</width>
-     <height>22</height>
+     <height>29</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">
@@ -118,7 +118,6 @@
     <addaction name="actionViewGlobe"/>
     <addaction name="separator"/>
     <addaction name="actionYearlyStatistics"/>
-    <addaction name="actionDiveSiteEdit"/>
     <addaction name="actionPreviousDC"/>
     <addaction name="actionNextDC"/>
     <addaction name="separator"/>
@@ -718,12 +717,12 @@
   </action>
   <action name="actionCloudstorageopen">
    <property name="text">
-    <string>Open cloud storage</string>
+    <string>Open c&amp;loud storage</string>
    </property>
   </action>
   <action name="actionCloudstoragesave">
    <property name="text">
-    <string>Save to cloud storage</string>
+    <string>Save to clo&amp;ud storage</string>
    </property>
   </action>
   <action name="actionManage_dive_sites">
@@ -733,7 +732,7 @@
   </action>
   <action name="actionDiveSiteEdit">
    <property name="text">
-    <string>Dive Site Edit</string>
+    <string>Dive Site &amp;Edit</string>
    </property>
   </action>
  </widget>
-- 
2.5.0

From 559d110b4602ffc0ab34379c466b1aa189828021 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 25 Aug 2015 20:26:45 -0300
Subject: [PATCH 5/7] Move Dive Site List to it's correct position

When we are in display dive mode, and then edit the
location text edit, going to edit dive mode, the location
text edit will be moved a bit below of it's original position
but the Dive Site List would be already opened, and stuck
on it's original position, covering the dive list.
This patch fixes that.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/maintab.cpp | 26 ++++++++++++++++++++++++++
 qt-ui/maintab.h   |  1 +
 2 files changed, 27 insertions(+)

diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index ec25fe3..960b7ed 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -226,6 +226,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
 	connect(ReverseGeoLookupThread::instance(), &QThread::finished,
 			this, &MainTab::setCurrentLocationIndex);
 
+	ui.location->installEventFilter(this);
 	acceptingEdit = false;
 }
 
@@ -240,6 +241,31 @@ MainTab::~MainTab()
 	}
 }
 
+bool MainTab::eventFilter(QObject *obj, QEvent *ev)
+{
+	QMoveEvent *mEv;
+	QResizeEvent *rEv;
+	QLineEdit *line = qobject_cast<QLineEdit*>(obj);
+
+	if (ev->type() == QEvent::MouseMove || ev->type() == QEvent::HoverMove || ev->type() == QEvent::Paint)
+		return false;
+
+	if (line) {
+		if (ev->type() == QEvent::Resize) {
+			if (line->completer()->popup()->isVisible()) {
+				QListView *choices = qobject_cast<QListView*>(line->completer()->popup());
+				QPoint p = ui.location->mapToGlobal(ui.location->pos());
+				choices->setGeometry(
+				choices->geometry().x(),
+				p.y() + 3,
+				choices->geometry().width(),
+				choices->geometry().height());
+			}
+		}
+	}
+	return false;
+}
+
 void MainTab::setCurrentLocationIndex()
 {
 	if (current_dive) {
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 3322859..6a55580 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -54,6 +54,7 @@ public:
 	void updateCoordinatesText(qreal lat, qreal lon);
 	void nextInputField(QKeyEvent *event);
 	void showAndTriggerEditSelective(struct dive_components what);
+	virtual bool eventFilter(QObject*, QEvent*);
 
 signals:
 	void addDiveFinished();
-- 
2.5.0

From b8f5dd4f38d0d80447fa848712e2d42955aff172 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 25 Aug 2015 21:03:20 -0300
Subject: [PATCH 6/7] 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 <[email protected]>
---
 qt-models/divelocationmodel.cpp |  4 ++--
 qt-models/divelocationmodel.h   |  2 ++
 qt-ui/locationinformation.cpp   | 18 +++++++++++++-----
 qt-ui/maintab.cpp               |  2 +-
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index 30b3f82..fca322d 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -53,7 +53,7 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons
 	// Special case to handle the 'create dive site' with name.
 	if (index.row() < 2) {
 		if (index.column() == UUID)
-			return 0;
+			return RECENTLY_ADDED_DIVESITE;
 		switch(role) {
 			case Qt::DisplayRole : {
 				if (index.row() == 1) {
@@ -92,7 +92,7 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons
 	case Qt::DisplayRole :
 		switch(index.column()) {
 		case UUID: return ds->uuid;
-		case NAME: return ds->name;
+		case NAME: return QString("%1, id:%2").arg(ds->name).arg(ds->uuid);
 		case LATITUDE: return ds->latitude.udeg;
 		case LONGITUDE: return ds->longitude.udeg;
 		case COORDS: return "TODO";
diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h
index 77dbb7b..3bf7161 100644
--- a/qt-models/divelocationmodel.h
+++ b/qt-models/divelocationmodel.h
@@ -7,6 +7,8 @@
 
 class QLineEdit;
 
+#define RECENTLY_ADDED_DIVESITE 1
+
 class LocationInformationModel : public QAbstractTableModel {
 Q_OBJECT
 public:
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index 2a52d6d..71d582e 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();
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 960b7ed..82ab7c7 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -868,7 +868,7 @@ void MainTab::updateDisplayedDiveSite()
 	if(orig_uuid) {
 		if (new_uuid && orig_uuid != new_uuid) {
 			// the user picked a different site
-			qDebug() << "copy the dive site we picked into the displayed dive site";
+			qDebug() << "copy the dive site we picked into the displayed dive site, id: " << new_uuid;
 			displayed_dive.dive_site_uuid = new_uuid;
 			copy_dive_site(get_dive_site_by_uuid(displayed_dive.dive_site_uuid), &displayed_dive_site);
 		} else if (!new_name.isEmpty() && orig_name != new_name) {
-- 
2.5.0

From 6d557f9cc41112a9df394de4f3328a20d924c528 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 25 Aug 2015 21:08:05 -0300
Subject: [PATCH 7/7] Keep the dive list disabled if editing a dive

When, in a dive edit mode user entered a dive site
and went to dive site edit mode then finished the ds
edit, the app would lose the disabled property of the
dive list, making it possible to select a new dive
when we where editing another one, complete mess.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/maintab.cpp    | 5 +++++
 qt-ui/maintab.h      | 1 +
 qt-ui/mainwindow.cpp | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 82ab7c7..3885cd5 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -851,6 +851,11 @@ void MainTab::reload()
 		mydive->what = copy_string(displayed_dive.what); \
 	}
 
+MainTab::EditMode MainTab::getEditMode() const
+{
+	return editMode;
+}
+
 #define EDIT_VALUE(what)                             \
 	if (mydive->what == cd->what || copyPaste) { \
 		mydive->what = displayed_dive.what;  \
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 6a55580..eeb19a7 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -100,6 +100,7 @@ slots:
 	void enableGeoLookupEdition();
 	void disableGeoLookupEdition();
 	void setCurrentLocationIndex();
+	EditMode getEditMode() const;
 private:
 	Ui::MainTab ui;
 	WeightModel *weightModel;
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 99be842..23c36ad 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -258,6 +258,9 @@ PlannerSettingsWidget *MainWindow::divePlannerSettingsWidget() {
 
 void MainWindow::setDefaultState() {
 	setApplicationState("Default");
+	if (information()->getEditMode() != MainTab::NONE) {
+		ui.bottomLeft->currentWidget()->setEnabled(false);
+	}
 }
 
 void MainWindow::setLoadedWithFiles(bool f)
-- 
2.5.0

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to