mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									158a2ec159
								
							
						
					
					
						commit
						e6298f9352
					
				
					 4 changed files with 20 additions and 8 deletions
				
			
		|  | @ -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] | 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: 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 | Mobile: try to adjust the UI for cases with large default font relative to screen size | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ import org.kde.kirigami 2.4 as Kirigami | ||||||
| Item { | Item { | ||||||
| 	id: detailsEdit | 	id: detailsEdit | ||||||
| 	property int dive_id | 	property int dive_id | ||||||
| 	property int number | 	property alias number: txtNumber.text | ||||||
| 	property alias dateText: txtDate.text | 	property alias dateText: txtDate.text | ||||||
| 	property alias locationText: locationBox.editText | 	property alias locationText: locationBox.editText | ||||||
| 	property alias locationIndex: locationBox.currentIndex | 	property alias locationIndex: locationBox.currentIndex | ||||||
|  | @ -108,7 +108,7 @@ Item { | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// apply the changes to the dive_table | 		// 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, | 				      detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, | ||||||
| 				      suitBox.editText, buddyBox.editText, divemasterBox.editText, | 				      suitBox.editText, buddyBox.editText, divemasterBox.editText, | ||||||
| 				      detailsEdit.weightText, detailsEdit.notesText, startpressure, | 				      detailsEdit.weightText, detailsEdit.notesText, startpressure, | ||||||
|  | @ -152,11 +152,18 @@ Item { | ||||||
| 			id: editorDetails | 			id: editorDetails | ||||||
| 			width: parent.width | 			width: parent.width | ||||||
| 			columns: 2 | 			columns: 2 | ||||||
| 
 | 			Controls.Label { | ||||||
| 			Kirigami.Heading { | 				Layout.alignment: Qt.AlignRight | ||||||
| 				Layout.columnSpan: 2 | 				text: qsTr("Dive number:") | ||||||
| 				text: qsTr("Dive %1").arg(number) | 				font.pointSize: subsurfaceTheme.smallPointSize | ||||||
|  | 				color: subsurfaceTheme.textColor | ||||||
| 			} | 			} | ||||||
|  | 			SsrfTextField { | ||||||
|  | 				id: txtNumber; | ||||||
|  | 				Layout.fillWidth: true | ||||||
|  | 				flickable: detailsEditFlickable | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
| 			Controls.Label { | 			Controls.Label { | ||||||
| 				Layout.alignment: Qt.AlignRight | 				Layout.alignment: Qt.AlignRight | ||||||
| 				text: qsTr("Date:") | 				text: qsTr("Date:") | ||||||
|  |  | ||||||
|  | @ -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
 | // 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, | 			       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) | 			       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); | 	diveChanged |= checkDepth(myDive, d, depth); | ||||||
| 
 | 
 | ||||||
|  | 	if (QString::number(myDive.number) != number) { | ||||||
|  | 		diveChanged = true; | ||||||
|  | 		d->number = number.toInt(); | ||||||
|  | 	} | ||||||
| 	if (myDive.airTemp != airtemp) { | 	if (myDive.airTemp != airtemp) { | ||||||
| 		diveChanged = true; | 		diveChanged = true; | ||||||
| 		d->airtemp.mkelvin = parseTemperatureToMkelvin(airtemp); | 		d->airtemp.mkelvin = parseTemperatureToMkelvin(airtemp); | ||||||
|  |  | ||||||
|  | @ -155,7 +155,7 @@ public slots: | ||||||
| 	void retrieveUserid(); | 	void retrieveUserid(); | ||||||
| 	void loadDivesWithValidCredentials(); | 	void loadDivesWithValidCredentials(); | ||||||
| 	void provideAuth(QNetworkReply *reply, QAuthenticator *auth); | 	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 duration, QString depth, QString airtemp, | ||||||
| 			   QString watertemp, QString suit, QString buddy, | 			   QString watertemp, QString suit, QString buddy, | ||||||
| 			   QString diveMaster, QString weight, QString notes, QStringList startpressure, | 			   QString diveMaster, QString weight, QString notes, QStringList startpressure, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue