Store list of physical volumes in a global variable.
This commit is contained in:
parent
97aedd1806
commit
46ae0c73a8
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <core/lvmdevice.h>
|
||||
|
||||
#include <fs/lvm2_pv.h>
|
||||
|
||||
#include <util/capacity.h>
|
||||
#include <util/helpers.h>
|
||||
|
||||
|
@ -27,10 +29,9 @@
|
|||
#include <KLocalizedString>
|
||||
#include <KSharedConfig>
|
||||
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QList<const Partition*>& pvList, qint32& peSize, QList<LvmPV> physicalVolumes, QList<Device*> devices)
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QList<const Partition*>& pvList, qint32& peSize, QList<Device*> devices)
|
||||
: VolumeGroupDialog(parent, vgName, pvList)
|
||||
, m_PESize(peSize)
|
||||
, m_PhysicalVolumes(physicalVolumes)
|
||||
, m_Devices(devices)
|
||||
{
|
||||
setWindowTitle(xi18nc("@title:window", "Create new Volume Group"));
|
||||
|
@ -48,7 +49,7 @@ CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgNam
|
|||
|
||||
void CreateVolumeGroupDialog::setupDialog()
|
||||
{
|
||||
for (const auto &p : m_PhysicalVolumes)
|
||||
for (const auto &p : LVM::pvList) // FIXME: qAsConst
|
||||
if (p.vgName() == QString() && !LvmDevice::s_DirtyPVs.contains(p.partition()))
|
||||
dialogWidget().listPV().addPartition(*p.partition(), false);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class CreateVolumeGroupDialog : public VolumeGroupDialog
|
|||
Q_DISABLE_COPY(CreateVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QList<const Partition*>& pvList, qint32& peSize, QList<LvmPV> physicalVolumes, QList<Device*> devices);
|
||||
CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QList<const Partition*>& pvList, qint32& peSize, QList<Device*> devices);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
@ -49,7 +49,6 @@ protected:
|
|||
qint32& m_PESize;
|
||||
|
||||
private:
|
||||
const QList<LvmPV> m_PhysicalVolumes; // List of all LVM Physical Volumes found on the system
|
||||
const QList<Device*> m_Devices; // List of all devices found on the system
|
||||
};
|
||||
|
||||
|
|
|
@ -1106,7 +1106,7 @@ void MainWindow::onCreateNewVolumeGroup()
|
|||
QList<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().physicalVolumes(), operationStack().previewDevices());
|
||||
QPointer<CreateVolumeGroupDialog> dlg = new CreateVolumeGroupDialog(this, vgName, pvList, peSize, operationStack().previewDevices());
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
operationStack().push(new CreateVolumeGroupOperation(vgName, pvList, peSize));
|
||||
|
||||
|
@ -1121,7 +1121,7 @@ void MainWindow::onResizeVolumeGroup()
|
|||
QList<const Partition*> pvList;
|
||||
// *NOTE*: pvList will be modified and validated by the dialog
|
||||
|
||||
QPointer<ResizeVolumeGroupDialog> dlg = new ResizeVolumeGroupDialog(this, d, pvList, operationStack().physicalVolumes());
|
||||
QPointer<ResizeVolumeGroupDialog> dlg = new ResizeVolumeGroupDialog(this, d, pvList);
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
operationStack().push(new ResizeVolumeGroupOperation(*d, pvList));
|
||||
|
||||
|
|
|
@ -34,10 +34,9 @@
|
|||
@param parent pointer to the parent widget
|
||||
@param d the Device to show properties for
|
||||
*/
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice* d, QList<const Partition*>& partList, QList<LvmPV> physicalVolumes)
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice* d, QList<const Partition*>& partList)
|
||||
: VolumeGroupDialog(parent, d->name(), partList)
|
||||
, m_Device(d)
|
||||
, m_PhysicalVolumes(physicalVolumes)
|
||||
{
|
||||
setWindowTitle(xi18nc("@title:window", "Resize Volume Group"));
|
||||
|
||||
|
@ -51,7 +50,7 @@ ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerD
|
|||
void ResizeVolumeGroupDialog::setupDialog()
|
||||
{
|
||||
if (dialogWidget().volumeType().currentText() == QStringLiteral("LVM")) {
|
||||
for (const auto &p : m_PhysicalVolumes) {
|
||||
for (const auto &p : LVM::pvList) { // FIXME: qAsConst
|
||||
if (p.vgName() == device()->name())
|
||||
dialogWidget().listPV().addPartition(*p.partition(), true);
|
||||
else if (p.vgName() == QString() && !LvmDevice::s_DirtyPVs.contains(p.partition())) // TODO: Remove LVM PVs in current VG
|
||||
|
|
|
@ -31,7 +31,7 @@ class ResizeVolumeGroupDialog : public VolumeGroupDialog
|
|||
Q_DISABLE_COPY(ResizeVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice *d, QList<const Partition*>& partList, QList<LvmPV> physicalVolumes);
|
||||
ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice *d, QList<const Partition*>& partList);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
@ -44,7 +44,6 @@ protected:
|
|||
|
||||
private:
|
||||
VolumeManagerDevice* m_Device;
|
||||
const QList<LvmPV> m_PhysicalVolumes; // List of all devices found on the system
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue