Allow setting a file system label in the NewDialog.
svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=944331
This commit is contained in:
parent
aff8493c9a
commit
8874263386
|
@ -47,6 +47,7 @@ InsertDialog::InsertDialog(QWidget* parent, Device& device, Partition& insertedP
|
||||||
|
|
||||||
dialogWidget().hideRole();
|
dialogWidget().hideRole();
|
||||||
dialogWidget().hideFileSystem();
|
dialogWidget().hideFileSystem();
|
||||||
|
dialogWidget().hideLabel();
|
||||||
|
|
||||||
setupDialog();
|
setupDialog();
|
||||||
setupConstraints();
|
setupConstraints();
|
||||||
|
|
|
@ -91,6 +91,7 @@ void NewDialog::setupConnections()
|
||||||
connect(&dialogWidget().radioExtended(), SIGNAL(toggled(bool)), SLOT(onRoleChanged(bool)));
|
connect(&dialogWidget().radioExtended(), SIGNAL(toggled(bool)), SLOT(onRoleChanged(bool)));
|
||||||
connect(&dialogWidget().radioLogical(), SIGNAL(toggled(bool)), SLOT(onRoleChanged(bool)));
|
connect(&dialogWidget().radioLogical(), SIGNAL(toggled(bool)), SLOT(onRoleChanged(bool)));
|
||||||
connect(&dialogWidget().comboFileSystem(), SIGNAL(currentIndexChanged(int)), SLOT(onFilesystemChanged(int)));
|
connect(&dialogWidget().comboFileSystem(), SIGNAL(currentIndexChanged(int)), SLOT(onFilesystemChanged(int)));
|
||||||
|
connect(&dialogWidget().label(), SIGNAL(textChanged(const QString&)), SLOT(onLabelChanged(const QString&)));
|
||||||
|
|
||||||
SizeDialogBase::setupConnections();
|
SizeDialogBase::setupConnections();
|
||||||
}
|
}
|
||||||
|
@ -120,6 +121,7 @@ void NewDialog::onRoleChanged(bool)
|
||||||
dialogWidget().comboFileSystem().setEnabled(r != PartitionRole::Extended);
|
dialogWidget().comboFileSystem().setEnabled(r != PartitionRole::Extended);
|
||||||
partition().setRoles(PartitionRole(r));
|
partition().setRoles(PartitionRole(r));
|
||||||
dialogWidget().partResizerWidget().update();
|
dialogWidget().partResizerWidget().update();
|
||||||
|
updateHideAndShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewDialog::onFilesystemChanged(int idx)
|
void NewDialog::onFilesystemChanged(int idx)
|
||||||
|
@ -132,4 +134,33 @@ void NewDialog::onFilesystemChanged(int idx)
|
||||||
setupConstraints();
|
setupConstraints();
|
||||||
|
|
||||||
dialogWidget().partResizerWidget().updateLength(partition().length());
|
dialogWidget().partResizerWidget().updateLength(partition().length());
|
||||||
|
|
||||||
|
updateHideAndShow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewDialog::onLabelChanged(const QString& newLabel)
|
||||||
|
{
|
||||||
|
partition().fileSystem().setLabel(newLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewDialog::updateHideAndShow()
|
||||||
|
{
|
||||||
|
// this is mostly copy'n'pasted from PartPropsDialog::updateHideAndShow()
|
||||||
|
if (partition().roles().has(PartitionRole::Extended) || partition().fileSystem().supportSetLabel() == FileSystem::SupportNone)
|
||||||
|
{
|
||||||
|
dialogWidget().label().setReadOnly(true);
|
||||||
|
dialogWidget().noSetLabel().setVisible(true);
|
||||||
|
dialogWidget().noSetLabel().setFont(KGlobalSettings::smallestReadableFont());
|
||||||
|
|
||||||
|
QPalette palette = dialogWidget().noSetLabel().palette();
|
||||||
|
QColor f = palette.color(QPalette::Foreground);
|
||||||
|
f.setAlpha(128);
|
||||||
|
palette.setColor(QPalette::Foreground, f);
|
||||||
|
dialogWidget().noSetLabel().setPalette(palette);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dialogWidget().label().setReadOnly(false);
|
||||||
|
dialogWidget().noSetLabel().setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,10 +45,12 @@ class NewDialog : public SizeDialogBase
|
||||||
void accept();
|
void accept();
|
||||||
void onRoleChanged(bool);
|
void onRoleChanged(bool);
|
||||||
void onFilesystemChanged(int);
|
void onFilesystemChanged(int);
|
||||||
|
void onLabelChanged(const QString& newLabel);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
void setupDialog();
|
void setupDialog();
|
||||||
|
void updateHideAndShow();
|
||||||
PartitionRole::Roles partitionRoles() const { return m_PartitionRoles; }
|
PartitionRole::Roles partitionRoles() const { return m_PartitionRoles; }
|
||||||
virtual bool canGrow() const { return true; }
|
virtual bool canGrow() const { return true; }
|
||||||
virtual bool canShrink() const { return true; }
|
virtual bool canShrink() const { return true; }
|
||||||
|
|
|
@ -43,6 +43,7 @@ ResizeDialog::ResizeDialog(QWidget* parent, Device& device, Partition& p, qint64
|
||||||
|
|
||||||
dialogWidget().hideRole();
|
dialogWidget().hideRole();
|
||||||
dialogWidget().hideFileSystem();
|
dialogWidget().hideFileSystem();
|
||||||
|
dialogWidget().hideLabel();
|
||||||
|
|
||||||
setupDialog();
|
setupDialog();
|
||||||
setupConstraints();
|
setupConstraints();
|
||||||
|
|
|
@ -52,8 +52,14 @@ class SizeDialogWidget : public QWidget, public Ui::SizeDialogWidgetBase
|
||||||
|
|
||||||
QComboBox& comboFileSystem() { Q_ASSERT(m_ComboFileSystem); return *m_ComboFileSystem; }
|
QComboBox& comboFileSystem() { Q_ASSERT(m_ComboFileSystem); return *m_ComboFileSystem; }
|
||||||
|
|
||||||
|
QLabel& textLabel() { Q_ASSERT(m_LabelTextLabel); return *m_LabelTextLabel; }
|
||||||
|
KLineEdit& label() { Q_ASSERT(m_EditLabel); return *m_EditLabel; }
|
||||||
|
const KLineEdit& label() const { Q_ASSERT(m_EditLabel); return *m_EditLabel; }
|
||||||
|
QLabel& noSetLabel() { Q_ASSERT(m_LabelTextNoSetLabel); return *m_LabelTextNoSetLabel; }
|
||||||
|
|
||||||
void hideRole() { delete m_LabelRole; m_LabelRole = NULL; delete m_RadioPrimary; m_RadioPrimary = NULL; delete m_RadioExtended; m_RadioExtended = NULL; delete m_RadioLogical; m_RadioLogical = NULL; }
|
void hideRole() { delete m_LabelRole; m_LabelRole = NULL; delete m_RadioPrimary; m_RadioPrimary = NULL; delete m_RadioExtended; m_RadioExtended = NULL; delete m_RadioLogical; m_RadioLogical = NULL; }
|
||||||
void hideFileSystem() { delete m_LabelFileSystem; m_LabelFileSystem = NULL; delete m_ComboFileSystem; m_ComboFileSystem = NULL; }
|
void hideFileSystem() { delete m_LabelFileSystem; m_LabelFileSystem = NULL; delete m_ComboFileSystem; m_ComboFileSystem = NULL; }
|
||||||
|
void hideLabel() { delete m_LabelTextLabel; m_LabelTextLabel = NULL; delete m_EditLabel; m_EditLabel = NULL; delete m_LabelTextNoSetLabel; m_LabelTextNoSetLabel = NULL; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>425</width>
|
<width>410</width>
|
||||||
<height>339</height>
|
<height>510</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||||
|
@ -32,11 +32,11 @@
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType" >
|
<property name="sizeType" >
|
||||||
<enum>QSizePolicy::Preferred</enum>
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0" >
|
<property name="sizeHint" stdset="0" >
|
||||||
<size>
|
<size>
|
||||||
<width>278</width>
|
<width>20</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -83,9 +83,16 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1" >
|
||||||
<widget class="KComboBox" name="m_ComboFileSystem" />
|
<widget class="KComboBox" name="m_ComboFileSystem" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||||
|
<horstretch>3</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="7" column="0" >
|
||||||
<widget class="QLabel" name="label_4" >
|
<widget class="QLabel" name="label_4" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||||
|
@ -101,10 +108,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" >
|
<item row="7" column="1" >
|
||||||
<widget class="QLabel" name="m_LabelMinSize" />
|
<widget class="QLabel" name="m_LabelMinSize" />
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" >
|
<item row="8" column="0" >
|
||||||
<widget class="QLabel" name="label_5" >
|
<widget class="QLabel" name="label_5" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||||
|
@ -120,10 +127,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1" >
|
<item row="8" column="1" >
|
||||||
<widget class="QLabel" name="m_LabelMaxSize" />
|
<widget class="QLabel" name="m_LabelMaxSize" />
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" >
|
<item row="10" column="0" >
|
||||||
<widget class="QLabel" name="label" >
|
<widget class="QLabel" name="label" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||||
|
@ -142,8 +149,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1" >
|
<item row="10" column="1" >
|
||||||
<widget class="QSpinBox" name="m_SpinFreeBefore" >
|
<widget class="QSpinBox" name="m_SpinFreeBefore" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||||
|
<horstretch>3</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="suffix" >
|
<property name="suffix" >
|
||||||
<string comment="@label:spinbox" > MiB</string>
|
<string comment="@label:spinbox" > MiB</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -155,7 +168,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" >
|
<item row="11" column="0" >
|
||||||
<widget class="QLabel" name="label_2" >
|
<widget class="QLabel" name="label_2" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||||
|
@ -174,8 +187,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1" >
|
<item row="11" column="1" >
|
||||||
<widget class="QSpinBox" name="m_SpinCapacity" >
|
<widget class="QSpinBox" name="m_SpinCapacity" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||||
|
<horstretch>3</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="suffix" >
|
<property name="suffix" >
|
||||||
<string comment="@label:spinbox" > MiB</string>
|
<string comment="@label:spinbox" > MiB</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -187,7 +206,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" >
|
<item row="12" column="0" >
|
||||||
<widget class="QLabel" name="label_3" >
|
<widget class="QLabel" name="label_3" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||||
|
@ -206,8 +225,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1" >
|
<item row="12" column="1" >
|
||||||
<widget class="QSpinBox" name="m_SpinFreeAfter" >
|
<widget class="QSpinBox" name="m_SpinFreeAfter" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||||
|
<horstretch>3</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="suffix" >
|
<property name="suffix" >
|
||||||
<string comment="@label:spinbox" > MiB</string>
|
<string comment="@label:spinbox" > MiB</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -244,6 +269,50 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="9" column="0" colspan="2" >
|
||||||
|
<widget class="Line" name="line_2" >
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1" >
|
||||||
|
<widget class="QLabel" name="m_LabelTextNoSetLabel" >
|
||||||
|
<property name="text" >
|
||||||
|
<string comment="@label" >This file system does not support setting a label.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" >
|
||||||
|
<widget class="QLabel" name="m_LabelTextLabel" >
|
||||||
|
<property name="text" >
|
||||||
|
<string comment="@label" >&Label:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="buddy" >
|
||||||
|
<cstring>m_EditLabel</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0" colspan="2" >
|
||||||
|
<widget class="Line" name="line" >
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" >
|
||||||
|
<widget class="KLineEdit" name="m_EditLabel" >
|
||||||
|
<property name="maxLength" >
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -252,7 +321,7 @@
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType" >
|
<property name="sizeType" >
|
||||||
<enum>QSizePolicy::Preferred</enum>
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0" >
|
<property name="sizeHint" stdset="0" >
|
||||||
<size>
|
<size>
|
||||||
|
@ -263,6 +332,8 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
<zorder>m_PartResizerWidget</zorder>
|
||||||
|
<zorder></zorder>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
@ -270,6 +341,11 @@
|
||||||
<extends>QComboBox</extends>
|
<extends>QComboBox</extends>
|
||||||
<header>kcombobox.h</header>
|
<header>kcombobox.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>KLineEdit</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header>klineedit.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>PartResizerWidget</class>
|
<class>PartResizerWidget</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
|
|
Loading…
Reference in New Issue