Move createvolumegroup operation and job parameter to QStringList
This commit is contained in:
parent
5b92f1b411
commit
ccd4cd7e4e
|
@ -27,7 +27,7 @@
|
||||||
@param vgname
|
@param vgname
|
||||||
@parem pvList
|
@parem pvList
|
||||||
*/
|
*/
|
||||||
CreateVolumeGroupJob::CreateVolumeGroupJob(const QString& vgname, const QList<Partition*> pvlist) :
|
CreateVolumeGroupJob::CreateVolumeGroupJob(const QString& vgname, const QStringList& pvlist) :
|
||||||
Job(),
|
Job(),
|
||||||
m_vgName(vgname),
|
m_vgName(vgname),
|
||||||
m_pvList(pvlist)
|
m_pvList(pvlist)
|
||||||
|
@ -49,5 +49,9 @@ bool CreateVolumeGroupJob::run(Report& parent)
|
||||||
|
|
||||||
QString CreateVolumeGroupJob::description() const
|
QString CreateVolumeGroupJob::description() const
|
||||||
{
|
{
|
||||||
return xi18nc("@info/plain", "Create new Volume Group named <filename>%1</filename>", vgName());
|
QString tmp = QString();
|
||||||
|
foreach(QString name, pvList()) {
|
||||||
|
tmp += QStringLiteral("\n") + name;
|
||||||
|
}
|
||||||
|
return xi18nc("@info/plain", "Create new Volume Group: <filename>%1</filename> with PV: %2", vgName(), tmp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class QString;
|
||||||
class CreateVolumeGroupJob : public Job
|
class CreateVolumeGroupJob : public Job
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CreateVolumeGroupJob(const QString& vgname, const QList<Partition*> pvlist);
|
CreateVolumeGroupJob(const QString& vgname, const QStringList& pvlist);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool run(Report& parent) override;
|
bool run(Report& parent) override;
|
||||||
|
@ -43,16 +43,16 @@ protected:
|
||||||
const QString vgName() const {
|
const QString vgName() const {
|
||||||
return m_vgName;
|
return m_vgName;
|
||||||
}
|
}
|
||||||
QList<Partition*> pvList() {
|
QStringList pvList() {
|
||||||
return m_pvList;
|
return m_pvList;
|
||||||
}
|
}
|
||||||
const QList<Partition*> pvList() const {
|
const QStringList pvList() const {
|
||||||
return m_pvList;
|
return m_pvList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_vgName;
|
QString m_vgName;
|
||||||
QList<Partition*> m_pvList;
|
QStringList m_pvList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "ops/createvolumegroupoperation.h"
|
#include "ops/createvolumegroupoperation.h"
|
||||||
|
|
||||||
#include "core/lvmdevice.h"
|
#include "core/lvmdevice.h"
|
||||||
|
#include "fs/lvm2_pv.h"
|
||||||
|
|
||||||
#include "jobs/createvolumegroupjob.h"
|
#include "jobs/createvolumegroupjob.h"
|
||||||
|
|
||||||
|
@ -29,32 +30,21 @@
|
||||||
@param d the Device to create the new PartitionTable on
|
@param d the Device to create the new PartitionTable on
|
||||||
@param t the type for the new PartitionTable
|
@param t the type for the new PartitionTable
|
||||||
*/
|
*/
|
||||||
CreateVolumeGroupOperation::CreateVolumeGroupOperation(const QString& vgname, const QList<Partition*> pvlist) :
|
CreateVolumeGroupOperation::CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist) :
|
||||||
Operation(),
|
Operation(),
|
||||||
m_CreateVolumeGroupJob(new CreateVolumeGroupJob(vgname, pvlist))
|
m_CreateVolumeGroupJob(new CreateVolumeGroupJob(vgname, pvlist))
|
||||||
{
|
{
|
||||||
addJob(createVolumeGroupJob());
|
addJob(createVolumeGroupJob());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreateVolumeGroupOperation::canCreate()
|
|
||||||
{
|
|
||||||
//TODO: return true if there is any free PV
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CreateVolumeGroupOperation::description() const
|
QString CreateVolumeGroupOperation::description() const
|
||||||
{
|
{
|
||||||
return xi18nc("@info/plain", "Create a new LVM volume group.");
|
return xi18nc("@info/plain", "Create a new LVM volume group.");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreateVolumeGroupOperation::targets(const Device&) const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CreateVolumeGroupOperation::targets(const Partition& part) const
|
bool CreateVolumeGroupOperation::targets(const Partition& part) const
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateVolumeGroupOperation::preview()
|
void CreateVolumeGroupOperation::preview()
|
||||||
|
@ -64,3 +54,8 @@ void CreateVolumeGroupOperation::preview()
|
||||||
void CreateVolumeGroupOperation::undo()
|
void CreateVolumeGroupOperation::undo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CreateVolumeGroupOperation::canCreate()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LIBKPMCORE_EXPORT CreateVolumeGroupOperation : public Operation
|
||||||
friend class OperationStack;
|
friend class OperationStack;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CreateVolumeGroupOperation(const QString& vgname, const QList<Partition*> pvlist);
|
CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString iconName() const override {
|
QString iconName() const override {
|
||||||
|
@ -46,7 +46,9 @@ public:
|
||||||
|
|
||||||
QString description() const override;
|
QString description() const override;
|
||||||
|
|
||||||
virtual bool targets(const Device&) const override;
|
virtual bool targets(const Device&) const override {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
virtual bool targets(const Partition&) const override;
|
virtual bool targets(const Partition&) const override;
|
||||||
|
|
||||||
virtual void preview() override;
|
virtual void preview() override;
|
||||||
|
|
Loading…
Reference in New Issue