mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	mobile/divelist: add UI to toggle dive invalid flag
This reuses the corresponding undo command. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									c77cc93eec
								
							
						
					
					
						commit
						30e6102886
					
				
					 3 changed files with 18 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -276,6 +276,12 @@ Kirigami.ScrollablePage {
 | 
			
		|||
			manager.addDiveToTrip(currentItem.myData.id, currentItem.myData.tripBelow)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	property QtObject toggleInvalidAction: Kirigami.Action {
 | 
			
		||||
		text: currentItem && currentItem.myData && currentItem.myData.isInvalid ? qsTr("Mark dive as valid") : qsTr("Mark dive as invalid")
 | 
			
		||||
		// icon: { name: "TBD" }
 | 
			
		||||
		visible: currentItem && currentItem.myData && !currentItem.myData.isTrip
 | 
			
		||||
		onTriggered: manager.toggleDiveInvalid(currentItem.myData.id)
 | 
			
		||||
	}
 | 
			
		||||
	property QtObject deleteAction: Kirigami.Action {
 | 
			
		||||
		text: qsTr("Delete dive")
 | 
			
		||||
		icon { name: ":/icons/trash-empty.svg" }
 | 
			
		||||
| 
						 | 
				
			
			@ -315,7 +321,7 @@ Kirigami.ScrollablePage {
 | 
			
		|||
		enabled: manager.redoText !== ""
 | 
			
		||||
		onTriggered: manager.redo()
 | 
			
		||||
	}
 | 
			
		||||
	property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, deleteAction, mapAction, tripDetailsEdit, undoAction, redoAction ]
 | 
			
		||||
	property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, toggleInvalidAction, deleteAction, mapAction, tripDetailsEdit, undoAction, redoAction ]
 | 
			
		||||
 | 
			
		||||
	function setupActions() {
 | 
			
		||||
		if (Backend.cloud_verification_status === Enums.CS_VERIFIED || Backend.cloud_verification_status === Enums.CS_NOCLOUD) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1404,6 +1404,16 @@ void QMLManager::deleteDive(int id)
 | 
			
		|||
	changesNeedSaving();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QMLManager::toggleDiveInvalid(int id)
 | 
			
		||||
{
 | 
			
		||||
	struct dive *d = get_dive_by_uniq_id(id);
 | 
			
		||||
	if (!d) {
 | 
			
		||||
		appendTextToLog("trying to toggle invalid flag of non-existing dive");
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	Command::editInvalid(!d->invalid, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool QMLManager::toggleDiveSite(bool toggle)
 | 
			
		||||
{
 | 
			
		||||
	if (toggle)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -185,6 +185,7 @@ public slots:
 | 
			
		|||
	void saveChangesCloud(bool forceRemoteSync);
 | 
			
		||||
	void selectDive(int id);
 | 
			
		||||
	void deleteDive(int id);
 | 
			
		||||
	void toggleDiveInvalid(int id);
 | 
			
		||||
	void copyDiveData(int id);
 | 
			
		||||
	void pasteDiveData(int id);
 | 
			
		||||
	bool toggleDiveSite(bool toggle);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue