From 3ab91021c17c2dfbc61db812bff73ebfff240204 Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Thu, 11 Mar 2010 23:33:41 +0000 Subject: [PATCH] make sure to show the right fs color even for extended partitions in the new-partition-dialog svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1102170 --- src/gui/newdialog.cpp | 17 ++++++++++++++--- src/gui/newdialog.h | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/newdialog.cpp b/src/gui/newdialog.cpp index 1aaf6be..b509389 100644 --- a/src/gui/newdialog.cpp +++ b/src/gui/newdialog.cpp @@ -124,18 +124,29 @@ void NewDialog::onRoleChanged(bool) else if (dialogWidget().radioLogical().isChecked()) r = PartitionRole::Logical; + // Make sure an extended partition gets correctly displayed: Set its file system to extended. + // Also make sure to set a primary's or logical's file system once the user goes back from + // extended to any of those. + if (r == PartitionRole::Extended) + updateFileSystem(FileSystem::Extended); + else + updateFileSystem(FileSystem::typeForName(dialogWidget().comboFileSystem().currentText())); + dialogWidget().comboFileSystem().setEnabled(r != PartitionRole::Extended); partition().setRoles(PartitionRole(r)); dialogWidget().partResizerWidget().update(); updateHideAndShow(); } -void NewDialog::onFilesystemChanged(int idx) +void NewDialog::updateFileSystem(FileSystem::Type t) { - const FileSystem::Type t = FileSystem::typeForName(dialogWidget().comboFileSystem().itemText(idx)); - partition().deleteFileSystem(); partition().setFileSystem(FileSystemFactory::create(t, partition().firstSector(), partition().lastSector())); +} + +void NewDialog::onFilesystemChanged(int idx) +{ + updateFileSystem(FileSystem::typeForName(dialogWidget().comboFileSystem().itemText(idx))); setupConstraints(); diff --git a/src/gui/newdialog.h b/src/gui/newdialog.h index ef4dab4..3353e67 100644 --- a/src/gui/newdialog.h +++ b/src/gui/newdialog.h @@ -25,6 +25,8 @@ #include "core/partition.h" +#include "fs/filesystem.h" + class Device; /** @brief Dialog to create new Partitions. @@ -51,6 +53,7 @@ class NewDialog : public SizeDialogBase void setupConnections(); void setupDialog(); void updateHideAndShow(); + void updateFileSystem(FileSystem::Type t); PartitionRole::Roles partitionRoles() const { return m_PartitionRoles; } virtual bool canGrow() const { return true; } virtual bool canShrink() const { return true; }