Merge branch 'luks-decorator'

This commit is contained in:
Andrius Štikonas 2015-09-15 23:15:53 +01:00
commit 54ce33b472
6 changed files with 181 additions and 83 deletions

View File

@ -23,8 +23,8 @@ set(KDE_INSTALL_USE_QT_SYS_PATHS ON CACHE BOOL "Install mkspecs files, Plugins a
set(QT_MIN_VERSION "5.4.1")
set(VERSION_MAJOR "1")
set(VERSION_MINOR "2")
set(VERSION_RELEASE "1")
set(VERSION_MINOR "9")
set(VERSION_RELEASE "50")
set(VERSION_SUFFIX "")
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}${VERSION_SUFFIX})
add_definitions(-D'VERSION="${VERSION}"') #"

View File

@ -1,5 +1,6 @@
/*************************************************************************
* Copyright (C) 2009, 2010 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2015 by Teo Mrnjavac <teo@kde.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -27,6 +28,8 @@
#include <KConfigGroup>
#include <KSharedConfig>
#include <QDialogButtonBox>
EditMountPointDialog::EditMountPointDialog(QWidget* parent, Partition& p) :
QDialog(parent),
m_Partition(p),
@ -39,6 +42,15 @@ EditMountPointDialog::EditMountPointDialog(QWidget* parent, Partition& p) :
KConfigGroup kcg(KSharedConfig::openConfig(), "editMountPointDialog");
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
QDialogButtonBox* dbb = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal,
this );
mainLayout->addWidget(dbb);
connect(dbb, &QDialogButtonBox::accepted,
this, &EditMountPointDialog::accept);
connect(dbb, &QDialogButtonBox::rejected,
this, &EditMountPointDialog::reject);
}
/** Destroys an EditMOuntOptionsDialog instance */

View File

@ -1,5 +1,6 @@
/*************************************************************************
* Copyright (C) 2008, 2009, 2010, 2012 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2015 by Teo Mrnjavac <teo@kde.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -46,6 +47,7 @@
#include <kpmcore/fs/filesystem.h>
#include <kpmcore/fs/filesystemfactory.h>
#include <kpmcore/fs/luks.h>
#include <kpmcore/util/helpers.h>
#include "util/guihelpers.h"
@ -154,14 +156,14 @@ void MainWindow::closeEvent(QCloseEvent* event)
void MainWindow::changeEvent(QEvent* event)
{
if ((event->type() == QEvent::ActivationChange || event->type() == QEvent::WindowStateChange) && event->spontaneous() && isActiveWindow()) {
QWidget* w = NULL;
QWidget* w = nullptr;
if (applyProgressDialog().isVisible())
w = &applyProgressDialog();
else if (scanProgressDialog().isVisible())
w = &scanProgressDialog();
if (w != NULL) {
if (w != nullptr) {
w->activateWindow();
w->raise();
w->setFocus();
@ -303,6 +305,12 @@ void MainWindow::setupActions()
mountPartition->setToolTip(i18nc("@info:tooltip", "Mount or unmount partition"));
mountPartition->setStatusTip(i18nc("@info:status", "Mount or unmount a partition."));
QAction* decryptPartition = actionCollection()->addAction(QStringLiteral("decryptPartition"), &pmWidget(), SLOT(onDecryptPartition()));
decryptPartition->setEnabled(false);
decryptPartition->setText(i18nc("@action:inmenu", "Unlock"));
decryptPartition->setToolTip(i18nc("@info:tooltip", "Unlock or lock encrypted partition"));
decryptPartition->setStatusTip(i18nc("@info:status", "Unlock or lock encrypted partition."));
QAction* checkPartition = actionCollection()->addAction(QStringLiteral("checkPartition"), &pmWidget(), SLOT(onCheckPartition()));
checkPartition->setEnabled(false);
checkPartition->setText(i18nc("@action:inmenu", "Check"));
@ -387,41 +395,87 @@ void MainWindow::saveConfig() const
void MainWindow::enableActions()
{
actionCollection()->action(QStringLiteral("createNewPartitionTable"))->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice()));
actionCollection()->action(QStringLiteral("exportPartitionTable"))->setEnabled(pmWidget().selectedDevice() && pmWidget().selectedDevice()->partitionTable() && operationStack().size() == 0);
actionCollection()->action(QStringLiteral("importPartitionTable"))->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice()));
actionCollection()->action(QStringLiteral("smartStatusDevice"))->setEnabled(pmWidget().selectedDevice() != NULL && pmWidget().selectedDevice()->smartStatus().isValid());
actionCollection()->action(QStringLiteral("propertiesDevice"))->setEnabled(pmWidget().selectedDevice() != NULL);
actionCollection()->action(QStringLiteral("createNewPartitionTable"))
->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice()));
actionCollection()->action(QStringLiteral("exportPartitionTable"))
->setEnabled(pmWidget().selectedDevice() &&
pmWidget().selectedDevice()->partitionTable() &&
operationStack().size() == 0);
actionCollection()->action(QStringLiteral("importPartitionTable"))
->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice()));
actionCollection()->action(QStringLiteral("smartStatusDevice"))
->setEnabled(pmWidget().selectedDevice() != nullptr &&
pmWidget().selectedDevice()->smartStatus().isValid());
actionCollection()->action(QStringLiteral("propertiesDevice"))
->setEnabled(pmWidget().selectedDevice() != nullptr);
actionCollection()->action(QStringLiteral("undoOperation"))->setEnabled(operationStack().size() > 0);
actionCollection()->action(QStringLiteral("clearAllOperations"))->setEnabled(operationStack().size() > 0);
actionCollection()->action(QStringLiteral("applyAllOperations"))->setEnabled(operationStack().size() > 0 && (geteuid() == 0 || Config::allowApplyOperationsAsNonRoot()));
actionCollection()->action(QStringLiteral("undoOperation"))
->setEnabled(operationStack().size() > 0);
actionCollection()->action(QStringLiteral("clearAllOperations"))
->setEnabled(operationStack().size() > 0);
actionCollection()->action(QStringLiteral("applyAllOperations"))
->setEnabled(operationStack().size() > 0 && (geteuid() == 0 ||
Config::allowApplyOperationsAsNonRoot()));
const bool readOnly = pmWidget().selectedDevice() == NULL ||
pmWidget().selectedDevice()->partitionTable() == NULL ||
const bool readOnly = pmWidget().selectedDevice() == nullptr ||
pmWidget().selectedDevice()->partitionTable() == nullptr ||
pmWidget().selectedDevice()->partitionTable()->isReadOnly();
const Partition* part = pmWidget().selectedPartition();
actionCollection()->action(QStringLiteral("newPartition"))->setEnabled(!readOnly && NewOperation::canCreateNew(part));
const bool canResize = ResizeOperation::canGrow(part) || ResizeOperation::canShrink(part) || ResizeOperation::canMove(part);
actionCollection()->action(QStringLiteral("resizePartition"))->setEnabled(!readOnly && canResize);
actionCollection()->action(QStringLiteral("copyPartition"))->setEnabled(CopyOperation::canCopy(part));
actionCollection()->action(QStringLiteral("deletePartition"))->setEnabled(!readOnly && DeleteOperation::canDelete(part));
actionCollection()->action(QStringLiteral("shredPartition"))->setEnabled(!readOnly && DeleteOperation::canDelete(part));
actionCollection()->action(QStringLiteral("pastePartition"))->setEnabled(!readOnly && CopyOperation::canPaste(part, pmWidget().clipboardPartition()));
actionCollection()->action(QStringLiteral("propertiesPartition"))->setEnabled(part != NULL);
actionCollection()->action(QStringLiteral("newPartition"))
->setEnabled(!readOnly && NewOperation::canCreateNew(part));
actionCollection()->action(QStringLiteral("editMountPoint"))->setEnabled(part && !part->isMounted());
actionCollection()->action(QStringLiteral("mountPartition"))->setEnabled(part && (part->canMount() || part->canUnmount()));
const bool canResize = ResizeOperation::canGrow(part) ||
ResizeOperation::canShrink(part) ||
ResizeOperation::canMove(part);
actionCollection()->action(QStringLiteral("resizePartition"))
->setEnabled(!readOnly && canResize);
if (part != NULL)
actionCollection()->action(QStringLiteral("mountPartition"))->setText(part->isMounted() ? part->fileSystem().unmountTitle() : part->fileSystem().mountTitle());
actionCollection()->action(QStringLiteral("copyPartition"))
->setEnabled(CopyOperation::canCopy(part));
actionCollection()->action(QStringLiteral("deletePartition"))
->setEnabled(!readOnly && DeleteOperation::canDelete(part));
actionCollection()->action(QStringLiteral("shredPartition"))
->setEnabled(!readOnly && DeleteOperation::canDelete(part));
actionCollection()->action(QStringLiteral("pastePartition"))
->setEnabled(!readOnly && CopyOperation::canPaste(part, pmWidget().clipboardPartition()));
actionCollection()->action(QStringLiteral("propertiesPartition"))
->setEnabled(part != nullptr);
actionCollection()->action(QStringLiteral("checkPartition"))->setEnabled(!readOnly && CheckOperation::canCheck(part));
actionCollection()->action(QStringLiteral("editMountPoint"))
->setEnabled(part && !part->isMounted());
actionCollection()->action(QStringLiteral("backupPartition"))->setEnabled(BackupOperation::canBackup(part));
actionCollection()->action(QStringLiteral("restorePartition"))->setEnabled(RestoreOperation::canRestore(part));
actionCollection()->action(QStringLiteral("mountPartition"))
->setEnabled(part &&
(part->canMount() || part->canUnmount()));
if (part != nullptr)
actionCollection()->action(QStringLiteral("mountPartition"))
->setText(part->isMounted() ?
part->fileSystem().unmountTitle() :
part->fileSystem().mountTitle());
actionCollection()->action(QStringLiteral("decryptPartition"))
->setEnabled(part &&
(part->fileSystem().type() == FileSystem::Luks) &&
(dynamic_cast<const FS::luks&>(part->fileSystem()).canCryptOpen(part->partitionPath()) ||
dynamic_cast<const FS::luks&>(part->fileSystem()).canCryptClose(part->partitionPath())));
if (part && part->fileSystem().type() == FileSystem::Luks)
{
const FS::luks& luksFs = dynamic_cast<const FS::luks&>(part->fileSystem());
actionCollection()->action(QStringLiteral("decryptPartition"))
->setText(luksFs.isCryptOpen() ?
luksFs.cryptCloseTitle() :
luksFs.cryptOpenTitle());
}
actionCollection()->action(QStringLiteral("checkPartition"))
->setEnabled(!readOnly && CheckOperation::canCheck(part));
actionCollection()->action(QStringLiteral("backupPartition"))
->setEnabled(BackupOperation::canBackup(part));
actionCollection()->action(QStringLiteral("restorePartition"))
->setEnabled(RestoreOperation::canRestore(part));
}
void MainWindow::on_m_ApplyProgressDialog_finished()
@ -496,10 +550,10 @@ void MainWindow::on_m_ListDevices_contextMenuRequested(const QPoint& pos)
void MainWindow::on_m_PartitionManagerWidget_contextMenuRequested(const QPoint& pos)
{
QMenu* menu = NULL;
QMenu* menu = nullptr;
if (pmWidget().selectedPartition() == NULL) {
if (pmWidget().selectedDevice() != NULL)
if (pmWidget().selectedPartition() == nullptr) {
if (pmWidget().selectedDevice() != nullptr)
menu = static_cast<QMenu*>(guiFactory()->container(QStringLiteral("device"), this));
} else
menu = static_cast<QMenu*>(guiFactory()->container(QStringLiteral("partition"), this));
@ -603,7 +657,7 @@ void MainWindow::onSelectedDeviceMenuTriggered(bool)
QAction* action = qobject_cast<QAction*>(sender());
QMenu* devicesMenu = static_cast<QMenu*>(guiFactory()->container(QStringLiteral("selectedDevice"), this));
if (action == NULL || action->parent() != devicesMenu)
if (action == nullptr || action->parent() != devicesMenu)
return;
foreach(QAction * entry, devicesMenu->findChildren<QAction*>())
@ -678,8 +732,8 @@ void MainWindow::onUndoOperation()
// it's possible the undo killed the partition in the clipboard. if there's a partition in the clipboard, try
// to find a device for it (OperationStack::findDeviceForPartition() only compares pointers, so an invalid
// pointer is not a problem). if no device is found, the pointer must be dangling, so clear the clipboard.
if (pmWidget().clipboardPartition() != NULL && operationStack().findDeviceForPartition(pmWidget().clipboardPartition()) == NULL)
pmWidget().setClipboardPartition(NULL);
if (pmWidget().clipboardPartition() != nullptr && operationStack().findDeviceForPartition(pmWidget().clipboardPartition()) == nullptr)
pmWidget().setClipboardPartition(nullptr);
pmWidget().updatePartitions();
enableActions();
@ -704,7 +758,7 @@ void MainWindow::onCreateNewPartitionTable()
{
Q_ASSERT(pmWidget().selectedDevice());
if (pmWidget().selectedDevice() == NULL) {
if (pmWidget().selectedDevice() == nullptr) {
qWarning() << "selected device is null.";
return;
}
@ -751,7 +805,7 @@ void MainWindow::onImportPartitionTable()
QRegExp rxMagic(QStringLiteral("^##|v(\\d+)|##"));
quint32 lineNo = 0;
bool haveMagic = false;
PartitionTable* ptable = NULL;
PartitionTable* ptable = nullptr;
PartitionTable::TableType tableType = PartitionTable::unknownTableType;
while (!(line = file.readLine()).isEmpty()) {
@ -771,7 +825,7 @@ void MainWindow::onImportPartitionTable()
continue;
if (rxType.indexIn(QString::fromUtf8(line.constData())) != -1) {
if (ptable != NULL) {
if (ptable != nullptr) {
KMessageBox::error(this, i18nc("@info", "Found more than one partition table type in import file (line %1).", lineNo), i18nc("@title:window", "Error While Importing Partition Table"));
return;
}
@ -793,7 +847,7 @@ void MainWindow::onImportPartitionTable()
} else if (rxAlign.indexIn(QString::fromUtf8(line.constData())) != -1) {
// currently ignored
} else if (rxPartition.indexIn(QString::fromUtf8(line.constData())) != -1) {
if (ptable == NULL) {
if (ptable == nullptr) {
KMessageBox::error(this, i18nc("@info", "Found partition but no partition table type (line %1).", lineNo), i18nc("@title:window", "Error While Importing Partition Table"));
return;
}
@ -835,7 +889,7 @@ void MainWindow::onImportPartitionTable()
return;
}
if (parent == NULL) {
if (parent == nullptr) {
KMessageBox::error(this, i18nc("@info the partition is NOT a device path, just a number", "No parent partition or partition table found for partition %1 (line %2).", num, lineNo), i18nc("@title:window", "Error While Importing Partition Table"));
return;
}
@ -847,7 +901,7 @@ void MainWindow::onImportPartitionTable()
FileSystem* fs = FileSystemFactory::create(FileSystem::typeForName(fsName), firstSector, lastSector);
if (fs == NULL) {
if (fs == nullptr) {
KMessageBox::error(this, i18nc("@info the partition is NOT a device path, just a number", "Could not create file system \"%1\" for partition %2 (line %3).", fsName, num, lineNo), i18nc("@title:window", "Error While Importing Partition Table"));
return;
}
@ -977,7 +1031,7 @@ void MainWindow::onPropertiesDevice(const QString&)
static QStringList checkSupportInNode(const PartitionNode* parent)
{
if (parent == NULL)
if (parent == nullptr)
return QStringList();
QStringList rval;
@ -985,7 +1039,7 @@ static QStringList checkSupportInNode(const PartitionNode* parent)
foreach(const PartitionNode * node, parent->children()) {
const Partition* p = dynamic_cast<const Partition*>(node);
if (p == NULL)
if (p == nullptr)
continue;
if (node->children().size() > 0)

View File

@ -62,6 +62,7 @@
<separator/>
<Action name="editMountPoint"/>
<Action name="mountPartition"/>
<Action name="decryptPartition"/>
<separator/>
<Action name="checkPartition"/>
<separator/>

View File

@ -1,5 +1,6 @@
/*************************************************************************
* Copyright (C) 2008-2010 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2015 by Teo Mrnjavac <teo@kde.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -29,6 +30,7 @@
#include <kpmcore/core/partitiontable.h>
#include <kpmcore/fs/filesystemfactory.h>
#include <kpmcore/fs/luks.h>
#include <kpmcore/gui/partwidget.h>
@ -81,9 +83,9 @@ private:
PartitionManagerWidget::PartitionManagerWidget(QWidget* parent) :
QWidget(parent),
Ui::PartitionManagerWidgetBase(),
m_OperationStack(NULL),
m_SelectedDevice(NULL),
m_ClipboardPartition(NULL)
m_OperationStack(nullptr),
m_SelectedDevice(nullptr),
m_ClipboardPartition(nullptr)
{
setupUi(this);
@ -152,17 +154,17 @@ void PartitionManagerWidget::setupConnections()
void PartitionManagerWidget::clear()
{
setSelectedDevice(NULL);
setClipboardPartition(NULL);
setSelectedDevice(nullptr);
setClipboardPartition(nullptr);
treePartitions().clear();
partTableWidget().clear();
}
void PartitionManagerWidget::setSelectedPartition(const Partition* p)
{
if (p == NULL) {
treePartitions().setCurrentItem(NULL);
emit selectedPartitionChanged(NULL);
if (p == nullptr) {
treePartitions().setCurrentItem(nullptr);
emit selectedPartitionChanged(nullptr);
updatePartitions();
} else
partTableWidget().setActivePartition(p);
@ -170,8 +172,8 @@ void PartitionManagerWidget::setSelectedPartition(const Partition* p)
Partition* PartitionManagerWidget::selectedPartition()
{
if (selectedDevice() == NULL || selectedDevice()->partitionTable() == NULL || partTableWidget().activeWidget() == NULL)
return NULL;
if (selectedDevice() == nullptr || selectedDevice()->partitionTable() == nullptr || partTableWidget().activeWidget() == nullptr)
return nullptr;
// The active partition we get from the part table widget is const; we need non-const.
// So take the first sector and find the partition in the selected device's
@ -190,13 +192,13 @@ void PartitionManagerWidget::setSelectedDevice(const QString& device_node)
return;
}
setSelectedDevice(NULL);
setSelectedDevice(nullptr);
}
void PartitionManagerWidget::setSelectedDevice(Device* d)
{
m_SelectedDevice = d;
setSelectedPartition(NULL);
setSelectedPartition(nullptr);
}
static QTreeWidgetItem* createTreeWidgetItem(const Partition& p)
@ -234,7 +236,7 @@ static QTreeWidgetItem* createTreeWidgetItem(const Partition& p)
void PartitionManagerWidget::updatePartitions()
{
if (selectedDevice() == NULL)
if (selectedDevice() == nullptr)
return;
treePartitions().clear();
@ -256,7 +258,7 @@ void PartitionManagerWidget::updatePartitions()
treePartitions().addTopLevelItem(deviceItem);
if (selectedDevice()->partitionTable() != NULL) {
if (selectedDevice()->partitionTable() != nullptr) {
foreach(const Partition * p, selectedDevice()->partitionTable()->children()) {
QTreeWidgetItem* item = createTreeWidgetItem(*p);
@ -281,18 +283,18 @@ void PartitionManagerWidget::on_m_TreePartitions_currentItemChanged(QTreeWidgetI
{
if (current) {
const PartitionTreeWidgetItem* ptwItem = dynamic_cast<PartitionTreeWidgetItem*>(current);
partTableWidget().setActivePartition(ptwItem ? ptwItem->partition() : NULL);
partTableWidget().setActivePartition(ptwItem ? ptwItem->partition() : nullptr);
} else
partTableWidget().setActiveWidget(NULL);
partTableWidget().setActiveWidget(nullptr);
}
void PartitionManagerWidget::on_m_TreePartitions_itemDoubleClicked(QTreeWidgetItem* item, int)
{
if (item == treePartitions().topLevelItem(0)) {
if (selectedDevice() != NULL)
if (selectedDevice() != nullptr)
emit deviceDoubleClicked(selectedDevice());
} else {
if (selectedPartition() != NULL)
if (selectedPartition() != nullptr)
emit partitionDoubleClicked(selectedPartition());
}
}
@ -304,9 +306,9 @@ void PartitionManagerWidget::onHeaderContextMenu(const QPoint& p)
void PartitionManagerWidget::on_m_PartTableWidget_itemSelectionChanged(PartWidget* item)
{
if (item == NULL) {
treePartitions().setCurrentItem(NULL);
emit selectedPartitionChanged(NULL);
if (item == nullptr) {
treePartitions().setCurrentItem(nullptr);
emit selectedPartitionChanged(nullptr);
return;
}
@ -376,12 +378,12 @@ void PartitionManagerWidget::onMountPartition()
Q_ASSERT(p);
if (p == NULL) {
if (p == nullptr) {
qWarning() << "no partition selected";
return;
}
Report report(NULL);
Report report(nullptr);
if (p->canMount()) {
if (!p->mount(report))
@ -396,7 +398,7 @@ void PartitionManagerWidget::onMountPartition()
Q_ASSERT(parent);
if (parent != NULL)
if (parent != nullptr)
parent->checkChildrenMounted();
else
qWarning() << "parent is null";
@ -405,13 +407,40 @@ void PartitionManagerWidget::onMountPartition()
updatePartitions();
}
void PartitionManagerWidget::onDecryptPartition()
{
Partition* p = selectedPartition();
Q_ASSERT(p);
if (p == nullptr) {
qWarning() << "no partition selected";
return;
}
if (p->fileSystem().type() != FileSystem::Luks)
return;
FS::luks& luksFs = dynamic_cast<FS::luks&>(p->fileSystem());
if (luksFs.canCryptOpen(p->partitionPath())) {
if (!luksFs.cryptOpen(p->partitionPath()))
KMessageBox::detailedSorry(this, xi18nc("@info", "The encrypted file system on partition <filename>%1</filename> could not be unlocked.", p->deviceNode()), QString(), i18nc("@title:window", "Could Not Unlock Encrypted File System."));
} else if (luksFs.canCryptClose(p->partitionPath())) {
if (!luksFs.cryptClose(p->partitionPath()))
KMessageBox::detailedSorry(this, xi18nc("@info", "The encrypted file system on partition <filename>%1</filename> could not be locked.", p->deviceNode()), QString(), i18nc("@title:window", "Could Not Lock Encrypted File System."));
}
updatePartitions();
}
void PartitionManagerWidget::onEditMountPoint()
{
Partition* p = selectedPartition();
Q_ASSERT(p);
if (p == NULL)
if (p == nullptr)
return;
QPointer<EditMountPointDialog> dlg = new EditMountPointDialog(this, *p);
@ -444,14 +473,14 @@ void PartitionManagerWidget::onNewPartition()
Q_ASSERT(selectedDevice());
Q_ASSERT(selectedPartition());
if (selectedDevice() == NULL || selectedPartition() == NULL) {
if (selectedDevice() == nullptr || selectedPartition() == nullptr) {
qWarning() << "selected device: " << selectedDevice() << ", selected partition: " << selectedPartition();
return;
}
Q_ASSERT(selectedDevice()->partitionTable());
if (selectedDevice()->partitionTable() == NULL) {
if (selectedDevice()->partitionTable() == nullptr) {
qWarning() << "partition table on selected device is null";
return;
}
@ -475,7 +504,7 @@ void PartitionManagerWidget::onDeletePartition(bool shred)
Q_ASSERT(selectedDevice());
Q_ASSERT(selectedPartition());
if (selectedDevice() == NULL || selectedPartition() == NULL) {
if (selectedDevice() == nullptr || selectedPartition() == nullptr) {
qWarning() << "selected device: " << selectedDevice() << ", selected partition: " << selectedPartition();
return;
}
@ -483,7 +512,7 @@ void PartitionManagerWidget::onDeletePartition(bool shred)
if (selectedPartition()->roles().has(PartitionRole::Logical)) {
Q_ASSERT(selectedPartition()->parent());
if (selectedPartition()->parent() == NULL) {
if (selectedPartition()->parent() == nullptr) {
qWarning() << "parent of selected partition is null.";
return;
}
@ -510,7 +539,7 @@ void PartitionManagerWidget::onDeletePartition(bool shred)
KStandardGuiItem::cancel(), QStringLiteral("reallyDeleteClipboardPartition")) == KMessageBox::Cancel)
return;
setClipboardPartition(NULL);
setClipboardPartition(nullptr);
}
if (shred && Config::shredSource() == Config::EnumShredSource::random)
@ -531,14 +560,14 @@ void PartitionManagerWidget::onResizePartition()
Q_ASSERT(selectedDevice());
Q_ASSERT(selectedPartition());
if (selectedDevice() == NULL || selectedPartition() == NULL) {
if (selectedDevice() == nullptr || selectedPartition() == nullptr) {
qWarning() << "selected device: " << selectedDevice() << ", selected partition: " << selectedPartition();
return;
}
Q_ASSERT(selectedDevice()->partitionTable());
if (selectedDevice()->partitionTable() == NULL) {
if (selectedDevice()->partitionTable() == nullptr) {
qWarning() << "partition table on selected device is null";
return;
}
@ -576,7 +605,7 @@ void PartitionManagerWidget::onCopyPartition()
{
Q_ASSERT(selectedPartition());
if (selectedPartition() == NULL) {
if (selectedPartition() == nullptr) {
qWarning() << "selected partition: " << selectedPartition();
return;
}
@ -590,12 +619,12 @@ void PartitionManagerWidget::onPastePartition()
Q_ASSERT(selectedDevice());
Q_ASSERT(selectedPartition());
if (selectedDevice() == NULL || selectedPartition() == NULL) {
if (selectedDevice() == nullptr || selectedPartition() == nullptr) {
qWarning() << "selected device: " << selectedDevice() << ", selected partition: " << selectedPartition();
return;
}
if (clipboardPartition() == NULL) {
if (clipboardPartition() == nullptr) {
qWarning() << "no partition in the clipboard.";
return;
}
@ -607,7 +636,7 @@ void PartitionManagerWidget::onPastePartition()
Q_ASSERT(dSource);
if (dSource == NULL) {
if (dSource == nullptr) {
qWarning() << "source partition is null.";
return;
}
@ -625,7 +654,7 @@ bool PartitionManagerWidget::showInsertDialog(Partition& insertedPartition, qint
Q_ASSERT(selectedDevice());
Q_ASSERT(selectedPartition());
if (selectedDevice() == NULL || selectedPartition() == NULL) {
if (selectedDevice() == nullptr || selectedPartition() == nullptr) {
qWarning() << "selected device: " << selectedDevice() << ", selected partition: " << selectedPartition();
return false;
}
@ -681,7 +710,7 @@ void PartitionManagerWidget::onCheckPartition()
Q_ASSERT(selectedDevice());
Q_ASSERT(selectedPartition());
if (selectedDevice() == NULL || selectedPartition() == NULL) {
if (selectedDevice() == nullptr || selectedPartition() == nullptr) {
qWarning() << "selected device: " << selectedDevice() << ", selected partition: " << selectedPartition();
return;
}
@ -694,7 +723,7 @@ void PartitionManagerWidget::onBackupPartition()
Q_ASSERT(selectedDevice());
Q_ASSERT(selectedPartition());
if (selectedDevice() == NULL || selectedPartition() == NULL) {
if (selectedDevice() == nullptr || selectedPartition() == nullptr) {
qWarning() << "selected device: " << selectedDevice() << ", selected partition: " << selectedPartition();
return;
}
@ -714,7 +743,7 @@ void PartitionManagerWidget::onRestorePartition()
Q_ASSERT(selectedDevice());
Q_ASSERT(selectedPartition());
if (selectedDevice() == NULL || selectedPartition() == NULL) {
if (selectedDevice() == nullptr || selectedPartition() == nullptr) {
qWarning() << "selected device: " << selectedDevice() << ", selected partition: " << selectedPartition();
return;
}

View File

@ -1,5 +1,6 @@
/*************************************************************************
* Copyright (C) 2008-2010 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2015 by Teo Mrnjavac <teo@kde.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -69,6 +70,7 @@ public Q_SLOTS:
void onEditMountPoint();
void onMountPartition();
void onDecryptPartition();
void onCheckPartition();