Hide encrypt/decrypt action for non luks partitions.

This commit is contained in:
Andrius Štikonas 2016-09-06 00:34:16 +01:00
parent 29cb8f6201
commit e7d2a21599
2 changed files with 8 additions and 4 deletions

View File

@ -135,10 +135,10 @@ void InfoPane::showPartition(Qt::DockWidgetArea area, const Partition& p)
createLabels(i18nc("@label partition", "Capacity:"), Capacity::formatByteSize(p.capacity()), cols(area), x, y);
createLabels(i18nc("@label partition", "Available:"), Capacity::formatByteSize(p.available()), cols(area), x, y);
createLabels(i18nc("@label partition", "Used:"), Capacity::formatByteSize(p.used()), cols(area), x, y);
createLabels(i18nc("@label partition", "PE Size:"), Capacity::formatByteSize(lvm2PVFs->peSize()), cols(area), x, y);
createLabels(i18nc("@label partition", "PE Size:"), Capacity::formatByteSize(lvm2PVFs->peSize()), cols(area), x, y);
createLabels(i18nc("@label partition", "Total PE:"), QString::number(lvm2PVFs->getTotalPE(deviceNode)), cols(area), x, y);
createLabels(i18nc("@label partition", "Free PE:"), QString::number(lvm2PVFs->getFreePE(deviceNode)), cols(area), x, y);
createLabels(i18nc("@label partition", "Allocated PE:"), QString::number(lvm2PVFs->getAllocatedPE(deviceNode)), cols(area), x, y);
createLabels(i18nc("@label partition", "Free PE:"), QString::number(lvm2PVFs->getFreePE(deviceNode)), cols(area), x, y);
createLabels(i18nc("@label partition", "Allocated PE:"), QString::number(lvm2PVFs->getAllocatedPE(deviceNode)), cols(area), x, y);
createLabels(i18nc("@label partition", "First sector:"), QLocale().toString(p.firstSector()), cols(area), x, y);
createLabels(i18nc("@label partition", "Last sector:"), QLocale().toString(p.lastSector()), cols(area), x, y);
createLabels(i18nc("@label partition", "Number of sectors:"), QLocale().toString(p.length()), cols(area), x, y);

View File

@ -569,6 +569,8 @@ void MainWindow::enableActions()
const FileSystem& fsRef = part->fileSystem();
const FS::luks* luksFs = dynamic_cast<const FS::luks*>(&fsRef);
actionCollection()->action(QStringLiteral("decryptPartition"))
->setVisible(true);
actionCollection()->action(QStringLiteral("decryptPartition"))
->setEnabled(luksFs && !operationStack().contains(part) &&
(luksFs->canCryptOpen(part->partitionPath()) ||
@ -583,6 +585,8 @@ void MainWindow::enableActions()
else {
actionCollection()->action(QStringLiteral("decryptPartition"))
->setEnabled(false);
actionCollection()->action(QStringLiteral("decryptPartition"))
->setVisible(false);
}
@ -1116,7 +1120,7 @@ void MainWindow::onRemoveVolumeGroup()
Device* tmpDev = pmWidget().selectedDevice();
if (tmpDev->type() == Device::LVM_Device) {
LvmDevice* d = static_cast<LvmDevice*>(tmpDev);
if(!d->LVPathList()->count()) {
if(d->LVPathList()->count()) {
KMessageBox::error(this, xi18nc("@info", "Could not remove <filename>%1</filename>. There are still Logical Volumes on the Volume Group.", tmpDev->name()), i18nc("@title:window", "Error Removing Volume Group"));
} else {
operationStack().push(new RemoveVolumeGroupOperation( *(dynamic_cast<LvmDevice*>(tmpDev)) ));