summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2017-10-02 17:51:20 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-10-02 09:52:54 -0700
commit516527e1bd4af1591abf212deb75bc26cbfa132b (patch)
treeb48c06b2b5ae80e1083115db6c4139e049f55b02 /desktop-widgets
parente1bd006cd624ab203f75b818d5b8bc534fe36d87 (diff)
downloadsubsurface-516527e1bd4af1591abf212deb75bc26cbfa132b.tar.gz
[Divesite] Hook location information interface for country
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/locationinformation.cpp16
-rw-r--r--desktop-widgets/locationinformation.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp
index e32222bf4..3c347b774 100644
--- a/desktop-widgets/locationinformation.cpp
+++ b/desktop-widgets/locationinformation.cpp
@@ -93,6 +93,10 @@ void LocationInformationWidget::updateLabels()
ui.diveSiteName->setText(displayed_dive_site.name);
else
ui.diveSiteName->clear();
+ if (displayed_dive_site.country)
+ ui.diveSiteCountry->setText(displayed_dive_site.country);
+ else
+ ui.diveSiteCountry->clear();
if (displayed_dive_site.description)
ui.diveSiteDescription->setText(displayed_dive_site.description);
else
@@ -147,6 +151,11 @@ void LocationInformationWidget::acceptChanges()
free(currentDs->description);
currentDs->description = copy_string(uiString);
}
+ uiString = ui.diveSiteCountry->text().toUtf8().data();
+ if (!same_string(uiString, currentDs->country)) {
+ free(currentDs->country);
+ currentDs->country = copy_string(uiString);
+ }
uiString = ui.diveSiteNotes->document()->toPlainText().toUtf8().data();
if (!same_string(uiString, currentDs->notes)) {
free(currentDs->notes);
@@ -243,6 +252,12 @@ void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString
free((void *)coords);
}
+void LocationInformationWidget::on_diveSiteCountry_textChanged(const QString& text)
+{
+ if (!same_string(qPrintable(text), displayed_dive_site.country))
+ markChangedWidget(ui.diveSiteCountry);
+}
+
void LocationInformationWidget::on_diveSiteDescription_textChanged(const QString &text)
{
if (!same_string(qPrintable(text), displayed_dive_site.description))
@@ -266,6 +281,7 @@ void LocationInformationWidget::resetPallete()
QPalette p;
ui.diveSiteCoordinates->setPalette(p);
ui.diveSiteDescription->setPalette(p);
+ ui.diveSiteCountry->setPalette(p);
ui.diveSiteName->setPalette(p);
ui.diveSiteNotes->setPalette(p);
}
diff --git a/desktop-widgets/locationinformation.h b/desktop-widgets/locationinformation.h
index 9b245fe6e..f5c11820b 100644
--- a/desktop-widgets/locationinformation.h
+++ b/desktop-widgets/locationinformation.h
@@ -24,6 +24,7 @@ public slots:
void enableEdition();
void resetState();
void resetPallete();
+ void on_diveSiteCountry_textChanged(const QString& text);
void on_diveSiteCoordinates_textChanged(const QString& text);
void on_diveSiteDescription_textChanged(const QString& text);
void on_diveSiteName_textChanged(const QString& text);