Record sector size in FileSystem class.

This commit is contained in:
Andrius Štikonas 2017-09-03 16:01:48 +01:00
parent 4c46d7ad0b
commit ff45763427
3 changed files with 11 additions and 9 deletions

View File

@ -1046,7 +1046,7 @@ void MainWindow::onImportPartitionTable()
return;
}
FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(fsName), firstSector, lastSector);
FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(fsName), firstSector, lastSector, device.logicalSize());
if (fs == nullptr) {
KMessageBox::error(this, xi18nc("@info the partition is NOT a device path, just a number", "Could not create file system \"%1\" for partition %2 (line %3).", fsName, num, lineNo), xi18nc("@title:window", "Error While Importing Partition Table"));

View File

@ -157,7 +157,8 @@ void NewDialog::accept()
partition().deleteFileSystem();
partition().setFileSystem(FileSystemFactory::create(FileSystem::Extended,
partition().firstSector(),
partition().lastSector()));
partition().lastSector(),
partition().sectorSize()));
}
else if (partition().roles().has(PartitionRole::Luks)) {
FileSystem::Type innerFsType = partition().fileSystem().type();
@ -165,7 +166,8 @@ void NewDialog::accept()
FS::luks* luksFs = dynamic_cast< FS::luks* >(
FileSystemFactory::create(FileSystem::Luks,
partition().firstSector(),
partition().lastSector()));
partition().lastSector(),
partition().sectorSize()));
luksFs->createInnerFileSystem(innerFsType);
luksFs->setPassphrase(dialogWidget().editPassphrase().password());
partition().setFileSystem(luksFs);
@ -215,7 +217,7 @@ void NewDialog::onRoleChanged(bool)
void NewDialog::updateFileSystem(FileSystem::Type t)
{
partition().deleteFileSystem();
partition().setFileSystem(FileSystemFactory::create(t, partition().firstSector(), partition().lastSector()));
partition().setFileSystem(FileSystemFactory::create(t, partition().firstSector(), partition().lastSector(), partition().sectorSize()));
}
void NewDialog::onFilesystemChanged(int idx)
@ -225,7 +227,7 @@ void NewDialog::onFilesystemChanged(int idx)
setupConstraints();
updateOkButtonStatus();
const FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(dialogWidget().comboFileSystem().currentText()), -1, -1, -1, QString());
const FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(dialogWidget().comboFileSystem().currentText()), -1, -1, -1, -1, QString());
dialogWidget().m_EditLabel->setMaxLength(fs->maxLabelLength());
updateSpinCapacity(partition().length());

View File

@ -187,7 +187,7 @@ void PartPropsDialog::setupFlagsList()
void PartPropsDialog::updateHideAndShow()
{
// create a temporary fs for some checks
const FileSystem* fs = FileSystemFactory::create(newFileSystemType(), -1, -1, -1, QString());
const FileSystem* fs = FileSystemFactory::create(newFileSystemType(), -1, -1, -1, -1, QString());
if (fs == nullptr || fs->supportSetLabel() == FileSystem::cmdSupportNone) {
dialogWidget().label().setReadOnly(true);
@ -317,13 +317,13 @@ void PartPropsDialog::setupFileSystemComboBox()
dialogWidget().fileSystem().setCurrentIndex(dialogWidget().fileSystem().findText(selected));
const FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(dialogWidget().fileSystem().currentText()), -1, -1, -1, QString());
const FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(dialogWidget().fileSystem().currentText()), -1, -1, -1, -1, QString());
dialogWidget().m_EditLabel->setMaxLength(fs->maxLabelLength());
}
void PartPropsDialog::updatePartitionFileSystem()
{
FileSystem* fs = FileSystemFactory::create(newFileSystemType(), partition().firstSector(), partition().lastSector());
FileSystem* fs = FileSystemFactory::create(newFileSystemType(), partition().firstSector(), partition().lastSector(), partition().sectorSize());
partition().deleteFileSystem();
partition().setFileSystem(fs);
dialogWidget().partWidget().update();
@ -342,7 +342,7 @@ void PartPropsDialog::onFilesystemChanged(int)
setWarnFileSystemChange();
updatePartitionFileSystem();
const FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(dialogWidget().fileSystem().currentText()), -1, -1, -1, QString());
const FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(dialogWidget().fileSystem().currentText()), -1, -1, -1, -1, QString());
dialogWidget().m_EditLabel->setMaxLength(fs->maxLabelLength());
} else {
dialogWidget().fileSystem().disconnect(this);