allow changing the msdos partition alignment from the device properties
svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1095438
This commit is contained in:
parent
6dba1bbbd1
commit
bd1f7b8c5d
|
@ -43,6 +43,7 @@ DevicePropsDialog::DevicePropsDialog(QWidget* parent, Device& d) :
|
|||
setCaption(i18nc("@title:window", "Device properties: <filename>%1</filename>", device().deviceNode()));
|
||||
|
||||
setupDialog();
|
||||
setupConnections();
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "devicePropsDialog"));
|
||||
}
|
||||
|
@ -81,6 +82,35 @@ void DevicePropsDialog::setupDialog()
|
|||
|
||||
dialogWidget().type().setText(type);
|
||||
|
||||
if (device().partitionTable()->type() == PartitionTable::msdos)
|
||||
dialogWidget().radioLegacy().setChecked(true);
|
||||
else if (device().partitionTable()->type() == PartitionTable::msdos_vista)
|
||||
dialogWidget().radioVista().setChecked(true);
|
||||
else
|
||||
dialogWidget().hideTypeRadioButtons();
|
||||
|
||||
setMinimumSize(dialogWidget().size());
|
||||
resize(dialogWidget().size());
|
||||
}
|
||||
|
||||
void DevicePropsDialog::setupConnections()
|
||||
{
|
||||
connect(&dialogWidget().radioVista(), SIGNAL(toggled(bool)), SLOT(setDirty(bool)));
|
||||
connect(&dialogWidget().radioLegacy(), SIGNAL(toggled(bool)), SLOT(setDirty(bool)));
|
||||
}
|
||||
|
||||
void DevicePropsDialog::setDirty(bool)
|
||||
{
|
||||
setDefaultButton(KDialog::Ok);
|
||||
enableButtonOk(true);
|
||||
}
|
||||
|
||||
bool DevicePropsDialog::legacyAlignment() const
|
||||
{
|
||||
return dialogWidget().radioLegacy().isChecked();
|
||||
}
|
||||
|
||||
bool DevicePropsDialog::vistaAlignment() const
|
||||
{
|
||||
return dialogWidget().radioVista().isChecked();
|
||||
}
|
||||
|
|
|
@ -44,8 +44,13 @@ class DevicePropsDialog : public KDialog
|
|||
DevicePropsDialog(QWidget* parent, Device& d);
|
||||
~DevicePropsDialog();
|
||||
|
||||
public:
|
||||
bool legacyAlignment() const;
|
||||
bool vistaAlignment() const;
|
||||
|
||||
protected:
|
||||
void setupDialog();
|
||||
void setupConnections();
|
||||
|
||||
Device& device() { return m_Device; }
|
||||
const Device& device() const { return m_Device; }
|
||||
|
@ -53,6 +58,9 @@ class DevicePropsDialog : public KDialog
|
|||
DevicePropsWidget& dialogWidget() { Q_ASSERT(m_DialogWidget); return *m_DialogWidget; }
|
||||
const DevicePropsWidget& dialogWidget() const { Q_ASSERT(m_DialogWidget); return *m_DialogWidget; }
|
||||
|
||||
protected slots:
|
||||
void setDirty(bool);
|
||||
|
||||
private:
|
||||
Device& m_Device;
|
||||
DevicePropsWidget* m_DialogWidget;
|
||||
|
|
|
@ -43,6 +43,20 @@ class DevicePropsWidget : public QWidget, public Ui::DevicePropsWidgetBase
|
|||
QLabel& sectorSize() { Q_ASSERT(m_LabelSectorSize); return *m_LabelSectorSize; }
|
||||
QLabel& totalSectors() { Q_ASSERT(m_LabelTotalSectors); return *m_LabelTotalSectors; }
|
||||
QLabel& type() { Q_ASSERT(m_LabelType); return *m_LabelType; }
|
||||
|
||||
QRadioButton& radioLegacy() { Q_ASSERT(m_RadioLegacy); return *m_RadioLegacy; }
|
||||
const QRadioButton& radioLegacy() const { Q_ASSERT(m_RadioLegacy); return *m_RadioLegacy; }
|
||||
|
||||
QRadioButton& radioVista() { Q_ASSERT(m_RadioVista); return *m_RadioVista; }
|
||||
const QRadioButton& radioVista() const { Q_ASSERT(m_RadioVista); return *m_RadioVista; }
|
||||
|
||||
QSpacerItem& spacerType() { Q_ASSERT(m_SpacerType); return *m_SpacerType; }
|
||||
|
||||
void hideTypeRadioButtons()
|
||||
{
|
||||
radioVista().setVisible(false);
|
||||
radioLegacy().setVisible(false);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,15 +6,56 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>406</width>
|
||||
<height>283</height>
|
||||
<width>609</width>
|
||||
<height>397</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="PartTableWidget" name="m_PartTableWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextType">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
|
@ -24,7 +65,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="m_LabelType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
|
@ -37,6 +78,54 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="m_TypeLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioLegacy">
|
||||
<property name="text">
|
||||
<string>Legacy Alignment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioVista">
|
||||
<property name="text">
|
||||
<string>Vista Compatible Alignment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="m_SpacerType">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextCapacity">
|
||||
<property name="text">
|
||||
<string>Capacity:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="m_LabelCapacity">
|
||||
<property name="sizePolicy">
|
||||
|
@ -73,6 +162,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextCHS">
|
||||
<property name="text">
|
||||
|
@ -142,6 +238,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextPrimariesMax">
|
||||
<property name="text">
|
||||
|
@ -165,16 +268,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextCapacity">
|
||||
<property name="text">
|
||||
<string>Capacity:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
|
@ -191,68 +284,6 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="PartTableWidget" name="m_PartTableWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
|
|
@ -683,8 +683,19 @@ void MainWindow::onPropertiesDevice(const QString&)
|
|||
|
||||
if (pmWidget().selectedDevice())
|
||||
{
|
||||
QPointer<DevicePropsDialog> dlg = new DevicePropsDialog(this, *pmWidget().selectedDevice());
|
||||
dlg->exec();
|
||||
Device& d = *pmWidget().selectedDevice();
|
||||
|
||||
QPointer<DevicePropsDialog> dlg = new DevicePropsDialog(this, d);
|
||||
if (dlg->exec() == KDialog::Accepted)
|
||||
{
|
||||
if (d.partitionTable()->type() == PartitionTable::msdos && dlg->vistaAlignment())
|
||||
d.partitionTable()->setType(d, PartitionTable::msdos_vista);
|
||||
else if (d.partitionTable()->type() == PartitionTable::msdos_vista && dlg->legacyAlignment())
|
||||
d.partitionTable()->setType(d, PartitionTable::msdos);
|
||||
|
||||
on_m_OperationStack_devicesChanged();
|
||||
}
|
||||
|
||||
delete dlg;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue