From 5cdba2d652d8890a7557d5c101e32e7464c29536 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 9 Aug 2018 07:39:01 -0700 Subject: [PATCH] QML UI: don't overwrite good info with bad If we don't know the vendor or product, let's not overwrite information that we may have remembered from the last time the user downloaded from this dive computer. Note that this doesn't try to associate a specific cable with the information used last time. We could be smarter here for people who have multiple dive computers, but for the most typical user with just one dive computer, this does seem like a good solution. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveList.qml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index f0e14f9b0..86d4a9c1a 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -410,9 +410,12 @@ Kirigami.ScrollablePage { stackView.push(downloadFromDc) if (vendor !== undefined && product !== undefined && connection !== undefined) { /* set up the correct values on the download page */ - downloadFromDc.vendor = vendor - downloadFromDc.product = product - downloadFromDc.connection = connection + if (vendor !== -1) + downloadFromDc.vendor = vendor + if (product !== -1) + downloadFromDc.product = product + if (connection !== -1) + downloadFromDc.connection = connection } }