diff --git a/src/config/configurepagefilesystemcolors.ui b/src/config/configurepagefilesystemcolors.ui index 0491469..850fbb2 100644 --- a/src/config/configurepagefilesystemcolors.ui +++ b/src/config/configurepagefilesystemcolors.ui @@ -648,6 +648,22 @@ + + + + udf: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + diff --git a/src/gui/createvolumegroupdialog.cpp b/src/gui/createvolumegroupdialog.cpp index e9b5294..815d88d 100644 --- a/src/gui/createvolumegroupdialog.cpp +++ b/src/gui/createvolumegroupdialog.cpp @@ -30,7 +30,7 @@ #include #include -CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgName, std::vector& partList, qint32& peSize, QList devices) +CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QVector& partList, qint32& peSize, QList devices) : VolumeGroupDialog(parent, vgName, partList) , m_PESize(peSize) , m_Devices(devices) @@ -66,7 +66,7 @@ void CreateVolumeGroupDialog::accept() QString& tname = targetName(); tname = dialogWidget().vgName().text(); - targetPVList().insert(targetPVList().end(), dialogWidget().listPV().checkedItems().begin(), dialogWidget().listPV().checkedItems().end()); + targetPVList().append(dialogWidget().listPV().checkedItems()); qint32& pesize = peSize(); pesize = dialogWidget().spinPESize().value(); diff --git a/src/gui/createvolumegroupdialog.h b/src/gui/createvolumegroupdialog.h index 495aac0..6186771 100644 --- a/src/gui/createvolumegroupdialog.h +++ b/src/gui/createvolumegroupdialog.h @@ -31,7 +31,7 @@ class CreateVolumeGroupDialog : public VolumeGroupDialog Q_DISABLE_COPY(CreateVolumeGroupDialog) public: - CreateVolumeGroupDialog(QWidget* parent, QString& vgName, std::vector& pvList, qint32& peSize, QList devices); + CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QVector& pvList, qint32& peSize, QList devices); protected: void accept() override; diff --git a/src/gui/listphysicalvolumes.cpp b/src/gui/listphysicalvolumes.cpp index 57a6e61..8b4d8bb 100644 --- a/src/gui/listphysicalvolumes.cpp +++ b/src/gui/listphysicalvolumes.cpp @@ -35,9 +35,9 @@ void ListPhysicalVolumes::addPartition(const Partition& p, bool checked) listPhysicalVolumes().addItem(item); } -std::vector ListPhysicalVolumes::checkedItems() +QVector ListPhysicalVolumes::checkedItems() { - std::vector partitionList; + QVector partitionList; for (int i = 0; i < listPhysicalVolumes().count(); i++) { ListPhysicalVolumeWidgetItem* item = dynamic_cast(listPhysicalVolumes().item(i)); if(item && item->checkState() == Qt::Checked) diff --git a/src/gui/listphysicalvolumes.h b/src/gui/listphysicalvolumes.h index 96c6905..a97466d 100644 --- a/src/gui/listphysicalvolumes.h +++ b/src/gui/listphysicalvolumes.h @@ -23,7 +23,7 @@ #include -#include +#include #include @@ -50,7 +50,7 @@ public: void addPartition(const Partition& p, bool checked); - std::vector checkedItems(); + QVector checkedItems(); QListWidget& listPhysicalVolumes() { Q_ASSERT(m_ListPhysicalVolumes); diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 8336c98..f14373b 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -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")); @@ -1101,12 +1101,12 @@ void MainWindow::onExportPartitionTable() void MainWindow::onCreateNewVolumeGroup() { QString vgName; - std::vector pvList; + QVector pvList; qint32 peSize = 4; // *NOTE*: vgName & pvList will be modified and validated by the dialog QPointer dlg = new CreateVolumeGroupDialog(this, vgName, pvList, peSize, operationStack().previewDevices()); if (dlg->exec() == QDialog::Accepted) - operationStack().push(new CreateVolumeGroupOperation(vgName, QList::fromVector(QVector::fromStdVector(pvList)), peSize)); + operationStack().push(new CreateVolumeGroupOperation(vgName, pvList, peSize)); delete dlg; } @@ -1116,12 +1116,12 @@ void MainWindow::onResizeVolumeGroup() if (pmWidget().selectedDevice()->type() == Device::LVM_Device) { LvmDevice* d = dynamic_cast(pmWidget().selectedDevice()); - std::vector pvList; + QVector pvList; // *NOTE*: pvList will be modified and validated by the dialog QPointer dlg = new ResizeVolumeGroupDialog(this, d, pvList); if (dlg->exec() == QDialog::Accepted) - operationStack().push(new ResizeVolumeGroupOperation(*d, QList::fromVector(QVector::fromStdVector(pvList)))); + operationStack().push(new ResizeVolumeGroupOperation(*d, pvList)); delete dlg; } diff --git a/src/gui/newdialog.cpp b/src/gui/newdialog.cpp index 85b93e4..d7b67c7 100644 --- a/src/gui/newdialog.cpp +++ b/src/gui/newdialog.cpp @@ -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,8 +227,9 @@ 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()); + dialogWidget().m_EditLabel->setValidator(fs->labelValidator(dialogWidget().m_EditLabel)); updateSpinCapacity(partition().length()); dialogWidget().partResizerWidget().update(); @@ -272,7 +275,10 @@ void NewDialog::onLVNameChanged(const QString& newName) void NewDialog::updateHideAndShow() { // this is mostly copy'n'pasted from PartPropsDialog::updateHideAndShow() - if (partition().roles().has(PartitionRole::Extended) || partition().fileSystem().supportSetLabel() == FileSystem::cmdSupportNone) { + if (partition().roles().has(PartitionRole::Extended) || + (partition().fileSystem().supportSetLabel() == FileSystem::cmdSupportNone && + partition().fileSystem().supportCreateWithLabel() == FileSystem::cmdSupportNone) ) + { dialogWidget().label().setReadOnly(true); dialogWidget().noSetLabel().setVisible(true); dialogWidget().noSetLabel().setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); diff --git a/src/gui/partpropsdialog.cpp b/src/gui/partpropsdialog.cpp index a880034..e266adb 100644 --- a/src/gui/partpropsdialog.cpp +++ b/src/gui/partpropsdialog.cpp @@ -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,14 @@ 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()); + dialogWidget().m_EditLabel->setValidator(fs->labelValidator(dialogWidget().m_EditLabel)); } 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,8 +343,9 @@ 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()); + dialogWidget().m_EditLabel->setValidator(fs->labelValidator(dialogWidget().m_EditLabel)); } else { dialogWidget().fileSystem().disconnect(this); setupFileSystemComboBox(); diff --git a/src/gui/partpropsdialog.h b/src/gui/partpropsdialog.h index c6a2e22..862264f 100644 --- a/src/gui/partpropsdialog.h +++ b/src/gui/partpropsdialog.h @@ -128,7 +128,6 @@ private: QPushButton* okButton; QPushButton* cancelButton; QVBoxLayout *mainLayout; - }; #endif diff --git a/src/gui/resizevolumegroupdialog.cpp b/src/gui/resizevolumegroupdialog.cpp index 1f6662b..7326c13 100644 --- a/src/gui/resizevolumegroupdialog.cpp +++ b/src/gui/resizevolumegroupdialog.cpp @@ -35,7 +35,7 @@ @param parent pointer to the parent widget @param d the Device to show properties for */ -ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice* d, std::vector& partList) +ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice* d, QVector& partList) : VolumeGroupDialog(parent, d->name(), partList) , m_Device(d) { @@ -83,6 +83,6 @@ void ResizeVolumeGroupDialog::setupConstraints() void ResizeVolumeGroupDialog::accept() { - targetPVList().insert(targetPVList().end(), dialogWidget().listPV().checkedItems().begin(), dialogWidget().listPV().checkedItems().end()); + targetPVList().append(dialogWidget().listPV().checkedItems()); QDialog::accept(); } diff --git a/src/gui/resizevolumegroupdialog.h b/src/gui/resizevolumegroupdialog.h index cb01ba7..15e0a3f 100644 --- a/src/gui/resizevolumegroupdialog.h +++ b/src/gui/resizevolumegroupdialog.h @@ -31,7 +31,7 @@ class ResizeVolumeGroupDialog : public VolumeGroupDialog Q_DISABLE_COPY(ResizeVolumeGroupDialog) public: - ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice *d, std::vector& partList); + ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice *d, QVector& partList); protected: void accept() override; diff --git a/src/gui/sizedialogbase.cpp b/src/gui/sizedialogbase.cpp index 066555e..c4c02b0 100644 --- a/src/gui/sizedialogbase.cpp +++ b/src/gui/sizedialogbase.cpp @@ -32,6 +32,8 @@ #include +#include + #include #include @@ -234,7 +236,7 @@ void SizeDialogBase::onSpinCapacityChanged(double newCapacity) } } - tmp = qMin(delta, partition().firstSector() - minimumFirstSector()); + tmp = std::min(delta, partition().firstSector() - minimumFirstSector()); delta -= tmp; if (tmp != 0) { diff --git a/src/gui/volumegroupdialog.cpp b/src/gui/volumegroupdialog.cpp index 7f8d72b..b5edf84 100644 --- a/src/gui/volumegroupdialog.cpp +++ b/src/gui/volumegroupdialog.cpp @@ -31,13 +31,14 @@ #include #include +#include /** Creates a new VolumeGroupDialog @param parent pointer to the parent widget @param vgName Volume Group name @param pvList List of LVM Physical Volumes used to create Volume Group */ -VolumeGroupDialog::VolumeGroupDialog(QWidget* parent, QString& vgName, std::vector& pvList) : +VolumeGroupDialog::VolumeGroupDialog(QWidget* parent, QString& vgName, QVector& pvList) : QDialog(parent), m_DialogWidget(new VolumeGroupWidget(this)), m_TargetName(vgName), @@ -74,8 +75,8 @@ VolumeGroupDialog::~VolumeGroupDialog() void VolumeGroupDialog::setupDialog() { - QRegExp re(QStringLiteral("[\\w-.+]+")); - QRegExpValidator *validator = new QRegExpValidator(re, this); + QRegularExpression re(QStringLiteral("[\\w-.+]+")); + QRegularExpressionValidator *validator = new QRegularExpressionValidator(re, this); dialogWidget().vgName().setValidator(validator); dialogWidget().vgName().setText(targetName()); @@ -131,7 +132,7 @@ void VolumeGroupDialog::updateSectorInfos() void VolumeGroupDialog::updateSizeInfos() { - const std::vector checkedPartitions = dialogWidget().listPV().checkedItems(); + const QVector checkedPartitions = dialogWidget().listPV().checkedItems(); m_TotalSize = 0; for (const auto &p : checkedPartitions) m_TotalSize += p->capacity() - p->capacity() % (dialogWidget().spinPESize().value() * Capacity::unitFactor(Capacity::Byte, Capacity::MiB)); // subtract space which is too small to hold PE diff --git a/src/gui/volumegroupdialog.h b/src/gui/volumegroupdialog.h index 7431175..5fec912 100644 --- a/src/gui/volumegroupdialog.h +++ b/src/gui/volumegroupdialog.h @@ -20,7 +20,7 @@ #define VOLUMEGROUPDIALOG__H -#include +#include #include #include @@ -35,7 +35,7 @@ class VolumeGroupDialog : public QDialog Q_DISABLE_COPY(VolumeGroupDialog) public: - VolumeGroupDialog(QWidget* parent, QString& vgName, std::vector& pvList); + VolumeGroupDialog(QWidget* parent, QString& vgName, QVector& pvList); ~VolumeGroupDialog(); protected: @@ -67,11 +67,11 @@ protected: return m_TargetName; } - std::vector& targetPVList() { + QVector& targetPVList() { return m_TargetPVList; } - const std::vector& targetPVList() const { + const QVector& targetPVList() const { return m_TargetPVList; } @@ -89,7 +89,7 @@ protected: protected: VolumeGroupWidget* m_DialogWidget; QString& m_TargetName; - std::vector& m_TargetPVList; + QVector& m_TargetPVList; bool m_IsValidSize; bool m_IsValidName; diff --git a/src/partitionmanager.kcfg b/src/partitionmanager.kcfg index 4835262..97d9764 100644 --- a/src/partitionmanager.kcfg +++ b/src/partitionmanager.kcfg @@ -60,7 +60,7 @@ - + 220,205,175 187,249,207 @@ -88,6 +88,7 @@ 242,155,104 160,210,180 255,170,0 + 170,120,255 diff --git a/src/util/guihelpers.cpp b/src/util/guihelpers.cpp index 2ec00c2..53e224a 100644 --- a/src/util/guihelpers.cpp +++ b/src/util/guihelpers.cpp @@ -101,6 +101,7 @@ bool checkPermissions() argList += QCoreApplication::arguments().join(QStringLiteral(" ")) + QStringLiteral(" --dontsu"); + qDebug() << "Executing: " << suCmd << argList; if (QProcess::execute(suCmd, QStringList(argList)) == 0) return false; }