summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-20 20:13:59 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-21 15:50:41 -0400
commite6298f93523139a18d4dfc18cca32f0e4cc4deb2 (patch)
treea32785a42967c79634705743a3d27809ebc6adb5
parent158a2ec1591598973dbde0cedd80a4494f34045a (diff)
downloadsubsurface-e6298f93523139a18d4dfc18cca32f0e4cc4deb2.tar.gz
Mobile: allow editing dive number
No checks regarding duplicate numbers - we trust the user knows what they are doing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--CHANGELOG.md1
-rw-r--r--mobile-widgets/qml/DiveDetailsEdit.qml19
-rw-r--r--mobile-widgets/qmlmanager.cpp6
-rw-r--r--mobile-widgets/qmlmanager.h2
4 files changed, 20 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 49d4654bf..c021ab59d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+Mobile: add support for editing the dive number of a dive
Export: when exporting dive sites in dive site mode, export selected dive sites [#2275]
Mobile: fix several bugs in the handling of incorrect or unverified cloud credentials
Mobile: try to adjust the UI for cases with large default font relative to screen size
diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml
index 7e0e7f766..67aad6386 100644
--- a/mobile-widgets/qml/DiveDetailsEdit.qml
+++ b/mobile-widgets/qml/DiveDetailsEdit.qml
@@ -9,7 +9,7 @@ import org.kde.kirigami 2.4 as Kirigami
Item {
id: detailsEdit
property int dive_id
- property int number
+ property alias number: txtNumber.text
property alias dateText: txtDate.text
property alias locationText: locationBox.editText
property alias locationIndex: locationBox.currentIndex
@@ -108,7 +108,7 @@ Item {
}
// apply the changes to the dive_table
- manager.commitChanges(dive_id, detailsEdit.dateText, locationBox.editText, detailsEdit.gpsText, detailsEdit.durationText,
+ manager.commitChanges(dive_id, detailsEdit.number, detailsEdit.dateText, locationBox.editText, detailsEdit.gpsText, detailsEdit.durationText,
detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText,
suitBox.editText, buddyBox.editText, divemasterBox.editText,
detailsEdit.weightText, detailsEdit.notesText, startpressure,
@@ -152,11 +152,18 @@ Item {
id: editorDetails
width: parent.width
columns: 2
-
- Kirigami.Heading {
- Layout.columnSpan: 2
- text: qsTr("Dive %1").arg(number)
+ Controls.Label {
+ Layout.alignment: Qt.AlignRight
+ text: qsTr("Dive number:")
+ font.pointSize: subsurfaceTheme.smallPointSize
+ color: subsurfaceTheme.textColor
}
+ SsrfTextField {
+ id: txtNumber;
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
+
Controls.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Date:")
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index aab3f1d08..42bb24f70 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -1060,7 +1060,7 @@ bool QMLManager::checkDepth(const DiveObjectHelper &myDive, dive *d, QString dep
}
// update the dive and return the notes field, stripped of the HTML junk
-void QMLManager::commitChanges(QString diveId, QString date, QString location, QString gps, QString duration, QString depth,
+void QMLManager::commitChanges(QString diveId, QString number, QString date, QString location, QString gps, QString duration, QString depth,
QString airtemp, QString watertemp, QString suit, QString buddy, QString diveMaster, QString weight, QString notes,
QStringList startpressure, QStringList endpressure, QStringList gasmix, QStringList usedCylinder, int rating, int visibility, QString state)
{
@@ -1089,6 +1089,10 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
diveChanged |= checkDepth(myDive, d, depth);
+ if (QString::number(myDive.number) != number) {
+ diveChanged = true;
+ d->number = number.toInt();
+ }
if (myDive.airTemp != airtemp) {
diveChanged = true;
d->airtemp.mkelvin = parseTemperatureToMkelvin(airtemp);
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index b2c118848..782cc6d22 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -155,7 +155,7 @@ public slots:
void retrieveUserid();
void loadDivesWithValidCredentials();
void provideAuth(QNetworkReply *reply, QAuthenticator *auth);
- void commitChanges(QString diveId, QString date, QString location, QString gps,
+ void commitChanges(QString diveId, QString number, QString date, QString location, QString gps,
QString duration, QString depth, QString airtemp,
QString watertemp, QString suit, QString buddy,
QString diveMaster, QString weight, QString notes, QStringList startpressure,