Store the list of LVM Physical Volumes in operationStack.
This commit is contained in:
parent
95ca21f4e2
commit
280ba106e8
|
@ -19,7 +19,6 @@
|
|||
#include "gui/volumegroupwidget.h"
|
||||
|
||||
#include <core/lvmdevice.h>
|
||||
#include <fs/lvm2_pv.h>
|
||||
|
||||
#include <util/capacity.h>
|
||||
#include <util/helpers.h>
|
||||
|
@ -28,11 +27,11 @@
|
|||
#include <KLocalizedString>
|
||||
#include <KSharedConfig>
|
||||
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, const QList<Device*>& devices, QString& vgName, QStringList& pvList, qint32& peSize) :
|
||||
VolumeGroupDialog(parent, vgName, pvList),
|
||||
m_PESize(peSize),
|
||||
m_Devices(devices),
|
||||
m_SystemVGList(LvmDevice::getVGs())
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, FS::lvm2_pv::PhysicalVolumes physicalVolumes, QString& vgName, QStringList& pvList, qint32& peSize)
|
||||
: VolumeGroupDialog(parent, vgName, pvList)
|
||||
, m_PESize(peSize)
|
||||
, m_SystemVGList(LvmDevice::getVGs())
|
||||
, m_PhysicalVolumes(physicalVolumes)
|
||||
{
|
||||
setWindowTitle(xi18nc("@title:window", "Create new Volume Group"));
|
||||
|
||||
|
@ -49,9 +48,9 @@ CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, const QList<De
|
|||
|
||||
void CreateVolumeGroupDialog::setupDialog()
|
||||
{
|
||||
for (const auto &p : FS::lvm2_pv::getPVs(m_Devices)) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(p->deviceNode())) {
|
||||
dialogWidget().listPV().addPartition(p->deviceNode(), false);
|
||||
for (const auto &p : m_PhysicalVolumes) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(p.second->deviceNode())) {
|
||||
dialogWidget().listPV().addPartition(p.second->deviceNode(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#define CREATEVOLUMEGROUPDIALOG__H
|
||||
|
||||
#include <fs/lvm2_pv.h>
|
||||
|
||||
#include "gui/volumegroupdialog.h"
|
||||
|
||||
class Device;
|
||||
|
@ -28,7 +30,7 @@ class CreateVolumeGroupDialog : public VolumeGroupDialog
|
|||
Q_DISABLE_COPY(CreateVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
CreateVolumeGroupDialog(QWidget* parent, const QList<Device*>& devices, QString& vgName, QStringList& pvList, qint32& peSize);
|
||||
CreateVolumeGroupDialog(QWidget* parent, FS::lvm2_pv::PhysicalVolumes physicalVolumes, QString& vgName, QStringList& pvList, qint32& peSize);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
@ -44,10 +46,10 @@ protected:
|
|||
}
|
||||
|
||||
qint32& m_PESize;
|
||||
const QList<Device*>& m_Devices; // List of all devices found on the system
|
||||
|
||||
private:
|
||||
QStringList m_SystemVGList;
|
||||
FS::lvm2_pv::PhysicalVolumes m_PhysicalVolumes; // List of all devices found on the system
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1106,7 +1106,7 @@ void MainWindow::onCreateNewVolumeGroup()
|
|||
QStringList* pvlist = new QStringList();
|
||||
qint32 pesize = 4;
|
||||
// *NOTE*: vgname & pvlist will be modified and validated by the dialog
|
||||
QPointer<CreateVolumeGroupDialog> dlg = new CreateVolumeGroupDialog(this, operationStack().previewDevices(), *vgname, *pvlist, pesize);
|
||||
QPointer<CreateVolumeGroupDialog> dlg = new CreateVolumeGroupDialog(this, operationStack().physicalVolumes(), *vgname, *pvlist, pesize);
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
operationStack().push(new CreateVolumeGroupOperation(*vgname, *pvlist, pesize));
|
||||
}
|
||||
|
@ -1153,7 +1153,7 @@ void MainWindow::onResizeVolumeGroup()
|
|||
QStringList* pvList = new QStringList();
|
||||
// *NOTE*: pvList will be modified and validated by the dialog
|
||||
|
||||
QPointer<ResizeVolumeGroupDialog> dlg = new ResizeVolumeGroupDialog(this, operationStack().previewDevices(), *vgName, *pvList, *tmpDev);
|
||||
QPointer<ResizeVolumeGroupDialog> dlg = new ResizeVolumeGroupDialog(this, operationStack().physicalVolumes(), *vgName, *pvList, *tmpDev);
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
operationStack().push(new ResizeVolumeGroupOperation(*tmpDev, *pvList));
|
||||
}
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
@param parent pointer to the parent widget
|
||||
@param d the Device to show properties for
|
||||
*/
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, const QList<Device*>& devices, QString& vgName, QStringList& partList, VolumeManagerDevice& d) :
|
||||
VolumeGroupDialog(parent, vgName, partList),
|
||||
m_Devices(devices),
|
||||
m_Device(d)
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, FS::lvm2_pv::PhysicalVolumes physicalVolumes, QString& vgName, QStringList& partList, VolumeManagerDevice& d)
|
||||
: VolumeGroupDialog(parent, vgName, partList)
|
||||
, m_Device(d)
|
||||
, m_PhysicalVolumes(physicalVolumes)
|
||||
{
|
||||
setWindowTitle(xi18nc("@title:window", "Resize Volume Group"));
|
||||
|
||||
|
@ -52,9 +52,9 @@ void ResizeVolumeGroupDialog::setupDialog()
|
|||
{
|
||||
if (dialogWidget().volumeType().currentText() == QStringLiteral("LVM")) {
|
||||
dialogWidget().listPV().addPartitionList(device().deviceNodes(), true);
|
||||
for (const auto &p : FS::lvm2_pv::getPVs(m_Devices)) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(p->deviceNode())) {
|
||||
dialogWidget().listPV().addPartition(p->deviceNode(), false);
|
||||
for (const auto &p : m_PhysicalVolumes) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(p.second->deviceNode())) {
|
||||
dialogWidget().listPV().addPartition(p.second->deviceNode(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#define RESIZEVOLUMEGROUPDIALOG__H
|
||||
|
||||
#include <fs/lvm2_pv.h>
|
||||
|
||||
#include "gui/volumegroupdialog.h"
|
||||
|
||||
class Device;
|
||||
|
@ -29,7 +31,7 @@ class ResizeVolumeGroupDialog : public VolumeGroupDialog
|
|||
Q_DISABLE_COPY(ResizeVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
ResizeVolumeGroupDialog(QWidget* parent, const QList<Device*>& devices, QString& vgName, QStringList& partList, VolumeManagerDevice& d);
|
||||
ResizeVolumeGroupDialog(QWidget* parent, FS::lvm2_pv::PhysicalVolumes physicalVolumes, QString& vgName, QStringList& partList, VolumeManagerDevice& d);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
@ -41,8 +43,8 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
const QList<Device*>& m_Devices; // List of all devices found on the system
|
||||
VolumeManagerDevice& m_Device;
|
||||
FS::lvm2_pv::PhysicalVolumes m_PhysicalVolumes; // List of all devices found on the system
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue