Make filesystem label length depend on file system.
svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1330603
This commit is contained in:
parent
0889e6a4ee
commit
084c604c3c
|
@ -100,6 +100,11 @@ namespace FS
|
|||
return Capacity::unitFactor(Capacity::Byte, Capacity::EiB);
|
||||
}
|
||||
|
||||
qint64 btrfs::maxLabelLength() const
|
||||
{
|
||||
return 255;
|
||||
}
|
||||
|
||||
qint64 btrfs::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("btrfs-debug-tree", QStringList() << deviceNode);
|
||||
|
|
|
@ -66,6 +66,7 @@ namespace FS
|
|||
|
||||
virtual qint64 minCapacity() const;
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -89,6 +89,11 @@ namespace FS
|
|||
return Capacity::unitFactor(Capacity::Byte, Capacity::EiB);
|
||||
}
|
||||
|
||||
qint64 exfat::maxLabelLength() const
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
bool exfat::check(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd(report, "exfatfsck", QStringList() << deviceNode);
|
||||
|
|
|
@ -66,6 +66,7 @@ namespace FS
|
|||
|
||||
// virtual qint64 minCapacity() const;
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -88,6 +88,11 @@ namespace FS
|
|||
return 32 * Capacity::unitFactor(Capacity::Byte, Capacity::TiB);
|
||||
}
|
||||
|
||||
qint64 ext2::maxLabelLength() const
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
qint64 ext2::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("dumpe2fs", QStringList() << "-h" << deviceNode);
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace FS
|
|||
virtual CommandSupportType supportGetUUID() const { return m_GetUUID; }
|
||||
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -101,6 +101,11 @@ namespace FS
|
|||
return 4 * Capacity::unitFactor(Capacity::Byte, Capacity::GiB);
|
||||
}
|
||||
|
||||
qint64 fat16::maxLabelLength() const
|
||||
{
|
||||
return 11;
|
||||
}
|
||||
|
||||
qint64 fat16::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("fsck.msdos", QStringList() << "-n" << "-v" << deviceNode);
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace FS
|
|||
|
||||
virtual qint64 minCapacity() const;
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -252,6 +252,12 @@ qint64 FileSystem::maxCapacity() const
|
|||
return Capacity::unitFactor(Capacity::Byte, Capacity::EiB);
|
||||
}
|
||||
|
||||
/** @return the maximum label length valid for this FileSystem */
|
||||
qint64 FileSystem::maxLabelLength() const
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
/** @return this FileSystem's type as printable name */
|
||||
QString FileSystem::name() const
|
||||
{
|
||||
|
|
|
@ -132,6 +132,7 @@ class FileSystem
|
|||
|
||||
virtual qint64 minCapacity() const;
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
|
|
@ -78,6 +78,11 @@ namespace FS
|
|||
return 2 * Capacity::unitFactor(Capacity::Byte, Capacity::TiB);
|
||||
}
|
||||
|
||||
qint64 hfs::maxLabelLength() const
|
||||
{
|
||||
return 27;
|
||||
}
|
||||
|
||||
bool hfs::check(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd(report, "hfsck", QStringList() << "-v" << deviceNode);
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace FS
|
|||
virtual CommandSupportType supportBackup() const { return m_Backup; }
|
||||
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -73,6 +73,11 @@ namespace FS
|
|||
return 8 * Capacity::unitFactor(Capacity::Byte, Capacity::EiB);
|
||||
}
|
||||
|
||||
qint64 hfsplus::maxLabelLength() const
|
||||
{
|
||||
return 63;
|
||||
}
|
||||
|
||||
bool hfsplus::check(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd(report, "hpfsck", QStringList() << "-v" << deviceNode);
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace FS
|
|||
virtual CommandSupportType supportBackup() const { return m_Backup; }
|
||||
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -91,6 +91,11 @@ namespace FS
|
|||
return 32 * Capacity::unitFactor(Capacity::Byte, Capacity::PiB);
|
||||
}
|
||||
|
||||
qint64 jfs::maxLabelLength() const
|
||||
{
|
||||
return 11;
|
||||
}
|
||||
|
||||
qint64 jfs::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("jfs_debugfs", QStringList() << deviceNode);
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace FS
|
|||
|
||||
virtual qint64 minCapacity() const;
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -71,6 +71,11 @@ namespace FS
|
|||
return SupportTool("util-linux", KUrl("http://www.kernel.org/pub/linux/utils/util-linux-ng/"));
|
||||
}
|
||||
|
||||
qint64 linuxswap::maxLabelLength() const
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
bool linuxswap::create(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd(report, "mkswap", QStringList() << deviceNode);
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace FS
|
|||
virtual CommandSupportType supportUpdateUUID() const { return m_UpdateUUID; }
|
||||
virtual CommandSupportType supportGetUUID() const { return m_GetUUID; }
|
||||
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -103,6 +103,11 @@ namespace FS
|
|||
return Capacity::unitFactor(Capacity::Byte, Capacity::EiB);
|
||||
}
|
||||
|
||||
qint64 nilfs2::maxLabelLength() const
|
||||
{
|
||||
return 80;
|
||||
}
|
||||
|
||||
bool nilfs2::check(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd(report, "fsck.nilfs2", QStringList() << deviceNode);
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace FS
|
|||
|
||||
virtual qint64 minCapacity() const;
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -95,6 +95,11 @@ namespace FS
|
|||
return 256 * Capacity::unitFactor(Capacity::Byte, Capacity::TiB);
|
||||
}
|
||||
|
||||
qint64 ntfs::maxLabelLength() const
|
||||
{
|
||||
return 128;
|
||||
}
|
||||
|
||||
qint64 ntfs::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("ntfsresize", QStringList() << "--info" << "--force" << "--no-progress-bar" << deviceNode);
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace FS
|
|||
virtual CommandSupportType supportGetUUID() const { return m_GetUUID; }
|
||||
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -79,6 +79,11 @@ namespace FS
|
|||
return Capacity::unitFactor(Capacity::Byte, Capacity::EiB);
|
||||
}
|
||||
|
||||
qint64 reiser4::maxLabelLength() const
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
qint64 reiser4::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("debugfs.reiser4", QStringList() << deviceNode);
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace FS
|
|||
virtual CommandSupportType supportBackup() const { return m_Backup; }
|
||||
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -94,6 +94,11 @@ namespace FS
|
|||
return 16 * Capacity::unitFactor(Capacity::Byte, Capacity::TiB);
|
||||
}
|
||||
|
||||
qint64 reiserfs::maxLabelLength() const
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
qint64 reiserfs::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("debugreiserfs", QStringList() << deviceNode);
|
||||
|
|
|
@ -68,6 +68,7 @@ namespace FS
|
|||
|
||||
virtual qint64 minCapacity() const;
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -95,6 +95,11 @@ namespace FS
|
|||
return Capacity::unitFactor(Capacity::Byte, Capacity::EiB);
|
||||
}
|
||||
|
||||
qint64 xfs::maxLabelLength() const
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
qint64 xfs::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("xfs_db", QStringList() << "-c" << "sb 0" << "-c" << "print" << deviceNode);
|
||||
|
|
|
@ -63,6 +63,7 @@ namespace FS
|
|||
|
||||
virtual qint64 minCapacity() const;
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
|
@ -156,6 +156,9 @@ void NewDialog::onFilesystemChanged(int idx)
|
|||
|
||||
setupConstraints();
|
||||
|
||||
const FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(dialogWidget().comboFileSystem().currentText()), -1, -1, -1, "");
|
||||
dialogWidget().m_EditLabel->setMaxLength(fs->maxLabelLength());
|
||||
|
||||
updateSpinCapacity(partition().length());
|
||||
dialogWidget().partResizerWidget().update();
|
||||
|
||||
|
|
|
@ -308,6 +308,9 @@ void PartPropsDialog::setupFileSystemComboBox()
|
|||
dialogWidget().fileSystem().addItem(createFileSystemColor(FileSystem::typeForName(fsName), 8), fsName);
|
||||
|
||||
dialogWidget().fileSystem().setCurrentIndex(dialogWidget().fileSystem().findText(selected));
|
||||
|
||||
const FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(dialogWidget().fileSystem().currentText()), -1, -1, -1, "");
|
||||
dialogWidget().m_EditLabel->setMaxLength(fs->maxLabelLength());
|
||||
}
|
||||
|
||||
void PartPropsDialog::updatePartitionFileSystem()
|
||||
|
@ -331,6 +334,9 @@ void PartPropsDialog::onFilesystemChanged(int)
|
|||
updateHideAndShow();
|
||||
setWarnFileSystemChange();
|
||||
updatePartitionFileSystem();
|
||||
|
||||
const FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(dialogWidget().fileSystem().currentText()), -1, -1, -1, "");
|
||||
dialogWidget().m_EditLabel->setMaxLength(fs->maxLabelLength());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -74,9 +74,6 @@
|
|||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="KLineEdit" name="m_EditLabel">
|
||||
<property name="maxLength">
|
||||
<number>16</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
|
|
|
@ -50,7 +50,7 @@ class SizeDialogWidget : public QWidget, public Ui::SizeDialogWidgetBase
|
|||
QRadioButton& radioExtended() { Q_ASSERT(m_RadioExtended); return *m_RadioExtended; }
|
||||
QRadioButton& radioLogical() { Q_ASSERT(m_RadioLogical); return *m_RadioLogical; }
|
||||
|
||||
QComboBox& comboFileSystem() { Q_ASSERT(m_ComboFileSystem); return *m_ComboFileSystem; }
|
||||
KComboBox& 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; }
|
||||
|
|
|
@ -126,9 +126,6 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="KLineEdit" name="m_EditLabel">
|
||||
<property name="maxLength">
|
||||
<number>16</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
Loading…
Reference in New Issue