check if device has more than 2^32 sectors if user wants to create an msdos
partition table on it and show a warning in that case. also make the default GPT. svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1113771
This commit is contained in:
parent
cf9ecebd1f
commit
2f822dd21b
3
TODO
3
TODO
|
@ -1,8 +1,5 @@
|
|||
Plans and ideas for 1.1:
|
||||
|
||||
* Check if no of sectors fits in an unsigned 32 bit int for msdos partition
|
||||
tables.
|
||||
|
||||
* offer a) no alignment of partition boundaries at all or b) legacy cylinder
|
||||
alignment or c) sector based alignment (the name is misleading, though)
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "core/partitiontable.h"
|
||||
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
@ -35,6 +36,8 @@ CreatePartitionTableDialog::CreatePartitionTableDialog(QWidget* parent, const De
|
|||
setMainWidget(&widget());
|
||||
setCaption(i18nc("@title:window", "Create a New Partition Table on <filename>%1</filename>", device().deviceNode()));
|
||||
setButtonText(KDialog::Ok, i18nc("@action:button", "&Create New Partition Table"));
|
||||
|
||||
connect(&widget().radioMSDOS(), SIGNAL(toggled(bool)), SLOT(onMSDOSToggled(bool)));
|
||||
}
|
||||
|
||||
PartitionTable::TableType CreatePartitionTableDialog::type() const
|
||||
|
@ -47,3 +50,20 @@ PartitionTable::TableType CreatePartitionTableDialog::type() const
|
|||
|
||||
return PartitionTable::msdos_sectorbased;
|
||||
}
|
||||
|
||||
void CreatePartitionTableDialog::onMSDOSToggled(bool on)
|
||||
{
|
||||
if (on && device().totalSectors() > 0xffffffff)
|
||||
{
|
||||
if (KMessageBox::warningContinueCancel(this,
|
||||
i18nc("@info",
|
||||
"<para>Do you really want to create an MS-Dos partition table on <filename>%1</filename>?</para>"
|
||||
"<para>This device has more than 2^32 sectors. That is the most the MS-Dos partition table type supports, so you will not be able to use the whole device.</para>", device().deviceNode()),
|
||||
i18nc("@title:window", "Really Create MS-Dos Partition Table Type?"),
|
||||
KGuiItem(i18nc("@action:button", "Create MS-Dos Type"), "arrow-right"),
|
||||
KStandardGuiItem::cancel(), "reallyCreateMSDOSOnLargeDevice") == KMessageBox::Cancel)
|
||||
{
|
||||
widget().radioGPT().setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,6 +44,9 @@ class CreatePartitionTableDialog : public KDialog
|
|||
const CreatePartitionTableWidget& widget() const { return *m_DialogWidget; }
|
||||
const Device& device() const { return m_Device; }
|
||||
|
||||
protected slots:
|
||||
void onMSDOSToggled(bool on);
|
||||
|
||||
private:
|
||||
CreatePartitionTableWidget* m_DialogWidget;
|
||||
const Device& m_Device;
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioMSDOS">
|
||||
<widget class="QRadioButton" name="m_RadioGPT">
|
||||
<property name="text">
|
||||
<string>MS-Dos</string>
|
||||
<string>GPT</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
|
@ -34,9 +34,12 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioGPT">
|
||||
<widget class="QRadioButton" name="m_RadioMSDOS">
|
||||
<property name="text">
|
||||
<string>GPT</string>
|
||||
<string>MS-Dos</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue