From 239370ee076e81f392ae124e9543d74dd0500b58 Mon Sep 17 00:00:00 2001
From: ConfuSomu
Date: Thu, 6 May 2021 09:53:02 -0400
Subject: Add cancel option to date/time setting menu

This allows to not save the settings, to avoid time drift, when just
looking at them.
---
 apps/settings/main.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'apps')

diff --git a/apps/settings/main.cpp b/apps/settings/main.cpp
index d701d52..36e6cf0 100644
--- a/apps/settings/main.cpp
+++ b/apps/settings/main.cpp
@@ -31,7 +31,7 @@ namespace app_settings {
 
     // Set time
     void set0_menu(Api *app_api) {
-        static const char *choices[16] = {"Hour", "Minute", "Second", "Year", "Month", "Day", "Day of week", "Apply and close"};
+        static const char *choices[9] = {"Hour", "Minute", "Second", "Year", "Month", "Day", "Day of week", "Apply and close", "Quit without saving"};
         uint max_value;
         uint min_value;
         uint default_value;
@@ -40,7 +40,7 @@ namespace app_settings {
 
         int choice = 0;
         while (true) {
-            choice = app_api->gui_popup_strchoice(SET0_NAME, SET0_DESC, choices, 8, 0, -1, choice);
+            choice = app_api->gui_popup_strchoice(SET0_NAME, SET0_DESC, choices, 9, 0, -1, choice);
 
             min_value = 0;
             switch (choice) {
@@ -68,6 +68,8 @@ namespace app_settings {
                 case 7: // Apply and exit
                     app_api->datetime_set(&datetime);
                     return;
+                case 8: // Quit without saving
+                    return;
             }
 
             // Display popup for editing value
-- 
cgit v1.2.3-54-g00ecf