From faa39e17469f67a11bd4421932de0a4d6b51df68 Mon Sep 17 00:00:00 2001
From: Teo Mrnjavac <teo@kde.org>
Date: Mon, 22 Sep 2014 17:21:50 +0200
Subject: [PATCH] Enable resize+alongside radiobutton if osprober reports
 multiple lines.

---
 src/modules/partition/gui/ChoicePage.cpp | 42 +++++++++++++++++-------
 1 file changed, 30 insertions(+), 12 deletions(-)

diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp
index 941cbbd36a..b21577b856 100644
--- a/src/modules/partition/gui/ChoicePage.cpp
+++ b/src/modules/partition/gui/ChoicePage.cpp
@@ -170,20 +170,38 @@ ChoicePage::init( PartitionCoreModule* core, const QStringList& osproberLines )
     }
     else
     {
-        m_messageLabel->setText( tr( "This computer currently has multiple operating systems on it. "
-                                     "What would you like to do?" ) );
+        // m_osproberLines has at least 2 items.
 
-        alongsideButton->setText( tr( "<b>Install %1 alongside your current operating systems</b><br/>"
-                                      "Documents, music and other personal files will be kept. "
-                                      "You can choose which operating system you want each time the "
-                                      "computer starts up." )
-                                    .arg( "$RELEASE" ) );
+        bool atLeastOneCanBeResized = false;
 
-        eraseButton->setText( tr( "<b>Erase disk and install %1</b><br/>"
-                                  "<font color=\"red\">Warning: </font>This will delete all of your Windows 7 programs, "
-                                  "documents, photos, music, and any other files." )
-                                .arg( "$RELEASE" ) );
-        alongsideButton->hide(); //FIXME: allow this when we can
+        foreach ( QString line, m_osproberLines )
+        {
+            QStringList osLine = line.split( ':' );
+            if ( canBeResized( osLine ) )
+            {
+                atLeastOneCanBeResized = true;
+                break;
+            }
+        }
+
+        if ( atLeastOneCanBeResized )
+        {
+            m_messageLabel->setText( tr( "This computer currently has multiple operating systems on it. "
+                                         "What would you like to do?" ) );
+
+            alongsideButton->setText( tr( "<b>Install %1 alongside your current operating systems</b><br/>"
+                                          "Documents, music and other personal files will be kept. "
+                                          "You can choose which operating system you want each time the "
+                                          "computer starts up." )
+                                        .arg( "$RELEASE" ) );
+
+            eraseButton->setText( tr( "<b>Erase disk and install %1</b><br/>"
+                                      "<font color=\"red\">Warning: </font>This will delete all of your Windows 7 programs, "
+                                      "documents, photos, music, and any other files." )
+                                    .arg( "$RELEASE" ) );
+        }
+        else
+            alongsideButton->hide();
     }
 
     m_itemsLayout->addStretch();
-- 
GitLab