Adapt to kpmcore changes regarding LVM PV detection.
This commit is contained in:
parent
e7d2a21599
commit
da663169f7
|
@ -28,9 +28,10 @@
|
|||
#include <KLocalizedString>
|
||||
#include <KSharedConfig>
|
||||
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgname, QStringList& pvlist, qint32& pesize) :
|
||||
VolumeGroupDialog(parent, vgname, pvlist),
|
||||
m_PESize(pesize),
|
||||
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())
|
||||
{
|
||||
setWindowTitle(xi18nc("@title:window", "Create new Volume Group"));
|
||||
|
@ -48,9 +49,9 @@ CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgnam
|
|||
|
||||
void CreateVolumeGroupDialog::setupDialog()
|
||||
{
|
||||
for (const auto &pvpath : FS::lvm2_pv::getFreePV()) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(pvpath)) {
|
||||
dialogWidget().listPV().addPartition(pvpath, false);
|
||||
for (const auto &p : FS::lvm2_pv::getFreePV(m_Devices)) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(p->deviceNode())) {
|
||||
dialogWidget().listPV().addPartition(p->deviceNode(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,14 @@
|
|||
|
||||
#include "gui/volumegroupdialog.h"
|
||||
|
||||
class Device;
|
||||
|
||||
class CreateVolumeGroupDialog : public VolumeGroupDialog
|
||||
{
|
||||
Q_DISABLE_COPY(CreateVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
CreateVolumeGroupDialog(QWidget* parent, QString& vgname, QStringList& pvlist, qint32& pesize);
|
||||
CreateVolumeGroupDialog(QWidget* parent, const QList<Device*>& devices, QString& vgName, QStringList& pvList, qint32& peSize);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
@ -42,6 +44,8 @@ protected:
|
|||
}
|
||||
|
||||
qint32& m_PESize;
|
||||
const QList<Device*>& m_Devices; // List of all devices found on the system
|
||||
|
||||
private:
|
||||
QStringList m_SystemVGList;
|
||||
};
|
||||
|
|
|
@ -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, *vgname, *pvlist, pesize);
|
||||
QPointer<CreateVolumeGroupDialog> dlg = new CreateVolumeGroupDialog(this, operationStack().previewDevices(), *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, *vgName, *pvList, *tmpDev);
|
||||
QPointer<ResizeVolumeGroupDialog> dlg = new ResizeVolumeGroupDialog(this, operationStack().previewDevices(), *vgName, *pvList, *tmpDev);
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
operationStack().push(new ResizeVolumeGroupOperation(*tmpDev, *pvList));
|
||||
}
|
||||
|
@ -1253,7 +1253,7 @@ static KLocalizedString checkSupportInNode(const PartitionNode* parent)
|
|||
|
||||
KLocalizedString rval;
|
||||
|
||||
for (auto const &node : parent->children()) {
|
||||
for (const auto &node : parent->children()) {
|
||||
const Partition* p = dynamic_cast<const Partition*>(node);
|
||||
|
||||
if (p == nullptr)
|
||||
|
|
|
@ -34,9 +34,10 @@
|
|||
@param parent pointer to the parent widget
|
||||
@param dev the Device to show properties for
|
||||
*/
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, QString& vgname, QStringList& partlist, VolumeManagerDevice& dev) :
|
||||
VolumeGroupDialog(parent, vgname, partlist),
|
||||
m_Device(dev)
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, const QList<Device*>& devices, QString& vgName, QStringList& partList, VolumeManagerDevice& d) :
|
||||
VolumeGroupDialog(parent, vgName, partList),
|
||||
m_Devices(devices),
|
||||
m_Device(d)
|
||||
{
|
||||
setWindowTitle(xi18nc("@title:window", "Resize Volume Group"));
|
||||
|
||||
|
@ -51,9 +52,9 @@ void ResizeVolumeGroupDialog::setupDialog()
|
|||
{
|
||||
if (dialogWidget().volumeType().currentText() == QStringLiteral("LVM")) {
|
||||
dialogWidget().listPV().addPartitionList(device().deviceNodes(), true);
|
||||
for (const auto &pvpath : FS::lvm2_pv::getFreePV()) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(pvpath)) {
|
||||
dialogWidget().listPV().addPartition(pvpath, false);
|
||||
for (const auto &p : FS::lvm2_pv::getFreePV(m_Devices)) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(p->deviceNode())) {
|
||||
dialogWidget().listPV().addPartition(p->deviceNode(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "gui/volumegroupdialog.h"
|
||||
|
||||
class Device;
|
||||
class VolumeManagerDevice;
|
||||
|
||||
class ResizeVolumeGroupDialog : public VolumeGroupDialog
|
||||
|
@ -28,7 +29,7 @@ class ResizeVolumeGroupDialog : public VolumeGroupDialog
|
|||
Q_DISABLE_COPY(ResizeVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
ResizeVolumeGroupDialog(QWidget* parent, QString& vgname, QStringList& partlist, VolumeManagerDevice& dev);
|
||||
ResizeVolumeGroupDialog(QWidget* parent, const QList<Device*>& devices, QString& vgName, QStringList& partList, VolumeManagerDevice& d);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
@ -40,6 +41,7 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
const QList<Device*>& m_Devices; // List of all devices found on the system
|
||||
VolumeManagerDevice& m_Device;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue