Merge branch 'next2'
This commit is contained in:
commit
eb80d94586
|
@ -648,6 +648,22 @@
|
|||
<item row="7" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode25"/>
|
||||
</item>
|
||||
<item row="7" column="6">
|
||||
<widget class="QLabel" name="textLabel_30">
|
||||
<property name="text">
|
||||
<string>udf:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode26"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <KLocalizedString>
|
||||
#include <KSharedConfig>
|
||||
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgName, std::vector<const Partition*>& partList, qint32& peSize, QList<Device*> devices)
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QVector<const Partition*>& partList, qint32& peSize, QList<Device*> 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();
|
||||
|
|
|
@ -31,7 +31,7 @@ class CreateVolumeGroupDialog : public VolumeGroupDialog
|
|||
Q_DISABLE_COPY(CreateVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
CreateVolumeGroupDialog(QWidget* parent, QString& vgName, std::vector<const Partition*>& pvList, qint32& peSize, QList<Device*> devices);
|
||||
CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QVector<const Partition*>& pvList, qint32& peSize, QList<Device*> devices);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
|
|
@ -35,9 +35,9 @@ void ListPhysicalVolumes::addPartition(const Partition& p, bool checked)
|
|||
listPhysicalVolumes().addItem(item);
|
||||
}
|
||||
|
||||
std::vector<const Partition *> ListPhysicalVolumes::checkedItems()
|
||||
QVector<const Partition *> ListPhysicalVolumes::checkedItems()
|
||||
{
|
||||
std::vector<const Partition *> partitionList;
|
||||
QVector<const Partition *> partitionList;
|
||||
for (int i = 0; i < listPhysicalVolumes().count(); i++) {
|
||||
ListPhysicalVolumeWidgetItem* item = dynamic_cast<ListPhysicalVolumeWidgetItem*>(listPhysicalVolumes().item(i));
|
||||
if(item && item->checkState() == Qt::Checked)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <core/partition.h>
|
||||
|
||||
#include <vector>
|
||||
#include <QVector>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
void addPartition(const Partition& p, bool checked);
|
||||
|
||||
std::vector<const Partition *> checkedItems();
|
||||
QVector<const Partition *> checkedItems();
|
||||
|
||||
QListWidget& listPhysicalVolumes() {
|
||||
Q_ASSERT(m_ListPhysicalVolumes);
|
||||
|
|
|
@ -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<const Partition*> pvList;
|
||||
QVector<const Partition*> pvList;
|
||||
qint32 peSize = 4;
|
||||
// *NOTE*: vgName & pvList will be modified and validated by the dialog
|
||||
QPointer<CreateVolumeGroupDialog> dlg = new CreateVolumeGroupDialog(this, vgName, pvList, peSize, operationStack().previewDevices());
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
operationStack().push(new CreateVolumeGroupOperation(vgName, QList<const Partition*>::fromVector(QVector<const Partition*>::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<LvmDevice*>(pmWidget().selectedDevice());
|
||||
|
||||
std::vector<const Partition*> pvList;
|
||||
QVector<const Partition*> pvList;
|
||||
// *NOTE*: pvList will be modified and validated by the dialog
|
||||
|
||||
QPointer<ResizeVolumeGroupDialog> dlg = new ResizeVolumeGroupDialog(this, d, pvList);
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
operationStack().push(new ResizeVolumeGroupOperation(*d, QList<const Partition*>::fromVector(QVector<const Partition*>::fromStdVector(pvList))));
|
||||
operationStack().push(new ResizeVolumeGroupOperation(*d, pvList));
|
||||
|
||||
delete dlg;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -128,7 +128,6 @@ private:
|
|||
QPushButton* okButton;
|
||||
QPushButton* cancelButton;
|
||||
QVBoxLayout *mainLayout;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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<const Partition*>& partList)
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice* d, QVector<const Partition*>& 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();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class ResizeVolumeGroupDialog : public VolumeGroupDialog
|
|||
Q_DISABLE_COPY(ResizeVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice *d, std::vector<const Partition*>& partList);
|
||||
ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice *d, QVector<const Partition*>& partList);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
#include <util/capacity.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QFrame>
|
||||
|
@ -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) {
|
||||
|
|
|
@ -31,13 +31,14 @@
|
|||
#include <KSharedConfig>
|
||||
|
||||
#include <QListWidgetItem>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
/** 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<const Partition*>& pvList) :
|
||||
VolumeGroupDialog::VolumeGroupDialog(QWidget* parent, QString& vgName, QVector<const Partition*>& 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<const Partition *> checkedPartitions = dialogWidget().listPV().checkedItems();
|
||||
const QVector<const Partition *> 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
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#define VOLUMEGROUPDIALOG__H
|
||||
|
||||
#include <vector>
|
||||
#include <QVector>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
|
@ -35,7 +35,7 @@ class VolumeGroupDialog : public QDialog
|
|||
Q_DISABLE_COPY(VolumeGroupDialog)
|
||||
|
||||
public:
|
||||
VolumeGroupDialog(QWidget* parent, QString& vgName, std::vector<const Partition*>& pvList);
|
||||
VolumeGroupDialog(QWidget* parent, QString& vgName, QVector<const Partition*>& pvList);
|
||||
~VolumeGroupDialog();
|
||||
|
||||
protected:
|
||||
|
@ -67,11 +67,11 @@ protected:
|
|||
return m_TargetName;
|
||||
}
|
||||
|
||||
std::vector<const Partition*>& targetPVList() {
|
||||
QVector<const Partition*>& targetPVList() {
|
||||
return m_TargetPVList;
|
||||
}
|
||||
|
||||
const std::vector<const Partition*>& targetPVList() const {
|
||||
const QVector<const Partition*>& targetPVList() const {
|
||||
return m_TargetPVList;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ protected:
|
|||
protected:
|
||||
VolumeGroupWidget* m_DialogWidget;
|
||||
QString& m_TargetName;
|
||||
std::vector<const Partition*>& m_TargetPVList;
|
||||
QVector<const Partition*>& m_TargetPVList;
|
||||
bool m_IsValidSize;
|
||||
bool m_IsValidName;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</entry>
|
||||
<entry key="fileSystemColorCode$(colorNumber)" type="Color">
|
||||
<label context="@label">File system colors</label>
|
||||
<parameter name="colorNumber" type="UInt" max="25"/>
|
||||
<parameter name="colorNumber" type="UInt" max="26"/>
|
||||
<!-- numbers correspond to the enum in kpmcore/fs/filesystem.h -->
|
||||
<default param="0">220,205,175</default> <!-- unknown -->
|
||||
<default param="1">187,249,207</default> <!-- extended -->
|
||||
|
@ -88,6 +88,7 @@
|
|||
<default param="23">242,155,104</default> <!-- nilfs2 -->
|
||||
<default param="24">160,210,180</default> <!-- lvm2 pv -->
|
||||
<default param="25">255,170,0</default> <!-- f2fs -->
|
||||
<default param="26">170,120,255</default> <!-- udf -->
|
||||
</entry>
|
||||
<entry key="showMenuBar" type="Bool">
|
||||
<label context="@label">Show the application's menu bar</label>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue