[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kcm-grub2] /: Allow zero GRUB_HIDDEN_TIMEOUT.
From:       Konstantinos Smanis <konstantinos.smanis () gmail ! com>
Date:       2014-04-03 20:53:12
Message-ID: E1WVodM-0007Vf-4l () scm ! kde ! org
[Download RAW message or body]

Git commit 8a60f1a1f75cc012ec7deca85e6783037ed6fccd by Konstantinos Smanis.
Committed on 03/04/2014 at 20:42.
Pushed by ksmanis into branch 'master'.

Allow zero GRUB_HIDDEN_TIMEOUT.

Seems like the Kubuntu scripts treat GRUB_HIDDEN_TIMEOUT=0 as a special
case where they completely bypass GRUB_TIMEOUT and boot without showing
the menu at all. I think this happens when you have only one OS
installed but I didn't bother to do extended testing.

Allowing a zero timeout value may seem a bit counterintuitive to the
user, but it's a valid value after all, let's allow it.

Also improved the common-case scenario in unquoteWord() for empty
strings.

BUG: 332262

M  +4    -0    src/common.cpp
M  +7    -4    src/kcm_grub2.cpp
M  +0    -3    ui/kcm_grub2.ui

http://commits.kde.org/kcm-grub2/8a60f1a1f75cc012ec7deca85e6783037ed6fccd

diff --git a/src/common.cpp b/src/common.cpp
index 475dec4..55e3ad1 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -31,6 +31,10 @@ QString quoteWord(const QString &word)
 }
 QString unquoteWord(const QString &word)
 {
+    if (word.isEmpty()) {
+        return QString();
+    }
+
     KProcess echo;
     echo.setShellCommand(QString(QLatin1String("echo -n %1")).arg(word));
     echo.setOutputChannelMode(KProcess::OnlyStdoutChannel);
diff --git a/src/kcm_grub2.cpp b/src/kcm_grub2.cpp
index 0e99f13..0f44efb 100644
--- a/src/kcm_grub2.cpp
+++ b/src/kcm_grub2.cpp
@@ -165,16 +165,19 @@ void KCMGRUB2::load()
     ui->checkBox_savedefault->setChecked(unquoteWord(m_settings.value(QLatin1String("GRUB_SAVEDEFAULT"))).compare(QLatin1String("true")) \
== 0);  
     bool ok;
-    if (!m_settings.value(QLatin1String("GRUB_HIDDEN_TIMEOUT")).isEmpty()) {
-        int grubHiddenTimeout = \
unquoteWord(m_settings.value(QLatin1String("GRUB_HIDDEN_TIMEOUT"))).toInt(&ok); +    \
QString grubHiddenTimeoutRaw = \
unquoteWord(m_settings.value(QLatin1String("GRUB_HIDDEN_TIMEOUT"))); +    if \
(grubHiddenTimeoutRaw.isEmpty()) { +        \
ui->checkBox_hiddenTimeout->setChecked(false); +    } else {
+        int grubHiddenTimeout = grubHiddenTimeoutRaw.toInt(&ok);
         if (ok && grubHiddenTimeout >= 0) {
-            ui->checkBox_hiddenTimeout->setChecked(grubHiddenTimeout > 0);
+            ui->checkBox_hiddenTimeout->setChecked(true);
             ui->spinBox_hiddenTimeout->setValue(grubHiddenTimeout);
+            ui->checkBox_hiddenTimeoutShowTimer->setChecked(unquoteWord(m_settings.value(QLatin1String("GRUB_HIDDEN_TIMEOUT_QUIET"))).compare(QLatin1String("true")) \
!= 0);  } else {
             kWarning() << "Invalid GRUB_HIDDEN_TIMEOUT value";
         }
     }
-    ui->checkBox_hiddenTimeoutShowTimer->setChecked(unquoteWord(m_settings.value(QLatin1String("GRUB_HIDDEN_TIMEOUT_QUIET"))).compare(QLatin1String("true")) \
                != 0);
     int grubTimeout = (m_settings.value(QLatin1String("GRUB_TIMEOUT")).isEmpty() ? 5 \
: unquoteWord(m_settings.value(QLatin1String("GRUB_TIMEOUT"))).toInt(&ok));  if (ok \
&& grubTimeout >= -1) {  ui->checkBox_timeout->setChecked(grubTimeout > -1);
diff --git a/ui/kcm_grub2.ui b/ui/kcm_grub2.ui
index 1c3238a..af1ac06 100644
--- a/ui/kcm_grub2.ui
+++ b/ui/kcm_grub2.ui
@@ -85,9 +85,6 @@
               <property name="suffix">
                <string comment="@label:spinbox seconds (suffix)">s</string>
               </property>
-              <property name="minimum">
-               <number>1</number>
-              </property>
              </widget>
             </item>
            </layout>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic