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=3D0 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(QLat=
in1String("GRUB_SAVEDEFAULT"))).compare(QLatin1String("true")) =3D=3D 0);
=
bool ok;
- if (!m_settings.value(QLatin1String("GRUB_HIDDEN_TIMEOUT")).isEmpty())=
{
- int grubHiddenTimeout =3D unquoteWord(m_settings.value(QLatin1Stri=
ng("GRUB_HIDDEN_TIMEOUT"))).toInt(&ok);
+ QString grubHiddenTimeoutRaw =3D unquoteWord(m_settings.value(QLatin1S=
tring("GRUB_HIDDEN_TIMEOUT")));
+ if (grubHiddenTimeoutRaw.isEmpty()) {
+ ui->checkBox_hiddenTimeout->setChecked(false);
+ } else {
+ int grubHiddenTimeout =3D grubHiddenTimeoutRaw.toInt(&ok);
if (ok && grubHiddenTimeout >=3D 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(QLatin1=
String("true")) !=3D 0);
} else {
kWarning() << "Invalid GRUB_HIDDEN_TIMEOUT value";
}
}
- ui->checkBox_hiddenTimeoutShowTimer->setChecked(unquoteWord(m_settings=
.value(QLatin1String("GRUB_HIDDEN_TIMEOUT_QUIET"))).compare(QLatin1String("=
true")) !=3D 0);
int grubTimeout =3D (m_settings.value(QLatin1String("GRUB_TIMEOUT")).i=
sEmpty() ? 5 : unquoteWord(m_settings.value(QLatin1String("GRUB_TIMEOUT")))=
.toInt(&ok));
if (ok && grubTimeout >=3D -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 @@
s
-
- 1
-