Always use because it is type safe.

This commit is contained in:
Andrius Štikonas 2016-04-14 19:18:36 +01:00
parent 293949ebf2
commit cf891183cb
Signed by: andrius
GPG Key ID: C86115C8091792EC
21 changed files with 119 additions and 119 deletions

View File

@ -50,7 +50,7 @@ ConfigureOptionsDialog::ConfigureOptionsDialog(QWidget* parent, const OperationS
{
setFaceType(List);
KPageWidgetItem* item = NULL;
KPageWidgetItem* item = nullptr;
item = addPage(&generalPageWidget(), i18nc("@title:tab general application settings", "General"), QString(), i18n("General Settings"));
item->setIcon(QIcon::fromTheme(QStringLiteral("partitionmanager")).pixmap(IconSize(KIconLoader::Desktop)));

View File

@ -69,12 +69,12 @@ ApplyProgressDialog::ApplyProgressDialog(QWidget* parent, OperationRunner& orunn
m_ProgressDialogWidget(new ApplyProgressDialogWidget(this)),
m_ProgressDetailsWidget(new ApplyProgressDetailsWidget(this)),
m_OperationRunner(orunner),
m_Report(NULL),
m_Report(nullptr),
m_SavedParentTitle(mainWindow(this)->windowTitle()),
m_Timer(this),
m_Time(),
m_CurrentOpItem(NULL),
m_CurrentJobItem(NULL),
m_CurrentOpItem(nullptr),
m_CurrentJobItem(nullptr),
m_LastReportUpdate(0)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
@ -158,7 +158,7 @@ void ApplyProgressDialog::show()
void ApplyProgressDialog::resetReport()
{
delete m_Report;
m_Report = new Report(NULL);
m_Report = new Report(nullptr);
detailsWidget().editReport().clear();
detailsWidget().editReport().setCursorWidth(0);
@ -286,7 +286,7 @@ void ApplyProgressDialog::onJobStarted(Job* job, Operation* op)
for (qint32 i = 0; i < dialogWidget().treeTasks().topLevelItemCount(); i++) {
QTreeWidgetItem* item = dialogWidget().treeTasks().topLevelItem(i);
if (item == NULL || reinterpret_cast<const Operation*>(item->data(0, Qt::UserRole).toULongLong()) != op)
if (item == nullptr || reinterpret_cast<const Operation*>(item->data(0, Qt::UserRole).toULongLong()) != op)
continue;
QTreeWidgetItem* child = new QTreeWidgetItem();
@ -305,7 +305,7 @@ void ApplyProgressDialog::onJobFinished(Job* job, Operation* op)
if (currentJobItem())
currentJobItem()->setIcon(0, job->statusIcon());
setCurrentJobItem(NULL);
setCurrentJobItem(nullptr);
const int current = dialogWidget().progressTotal().value();
dialogWidget().progressTotal().setValue(current + 1);
@ -321,7 +321,7 @@ void ApplyProgressDialog::onOpFinished(int num, Operation* op)
currentOpItem()->setIcon(0, op->statusIcon());
}
setCurrentOpItem(NULL);
setCurrentOpItem(nullptr);
setStatus(op->description());

View File

@ -82,7 +82,7 @@ void DevicePropsDialog::setupDialog()
QString type = QStringLiteral("---");
QString maxPrimaries = QStringLiteral("---");
if (device().partitionTable() != NULL) {
if (device().partitionTable() != nullptr) {
type = (device().partitionTable()->isReadOnly())
? i18nc("@label device", "%1 (read only)", device().partitionTable()->typeName())
: device().partitionTable()->typeName();

View File

@ -43,7 +43,7 @@ static QString findBlkIdDevice(const QString& token, const QString& value)
blkid_cache cache;
QString rval;
if (blkid_get_cache(&cache, NULL) == 0) {
if (blkid_get_cache(&cache, nullptr) == 0) {
if (char* c = blkid_evaluate_tag(token.toLocal8Bit().constData(), value.toLocal8Bit().constData(), &cache)) {
rval = QString::fromLocal8Bit(c);
free(c);
@ -167,16 +167,16 @@ bool EditMountPointDialogWidget::readMountpoints(const QString& filename)
{
FILE* fp = setmntent(filename.toLocal8Bit().constData(), "r");
if (fp == NULL) {
if (fp == nullptr) {
KMessageBox::sorry(this,
xi18nc("@info", "Could not open mount point file <filename>%1</filename>.", filename),
i18nc("@title:window", "Error while reading mount points"));
return false;
}
struct mntent* mnt = NULL;
struct mntent* mnt = nullptr;
while ((mnt = getmntent(fp)) != NULL) {
while ((mnt = getmntent(fp)) != nullptr) {
QString device = QString::fromUtf8(mnt->mnt_fsname);
MountEntry::IdentifyType type = MountEntry::deviceNode;
@ -204,7 +204,7 @@ static void writeEntry(QFile& output, const MountEntry* entry)
{
Q_ASSERT(entry);
if (entry == NULL)
if (entry == nullptr)
return;
if (entry->path.isEmpty())
@ -222,7 +222,7 @@ static void writeEntry(QFile& output, const MountEntry* entry)
bool EditMountPointDialogWidget::acceptChanges()
{
MountEntry* entry = NULL;
MountEntry* entry = nullptr;
if (mountPoints().find(labelName().text()) == mountPoints().end()) {
qWarning() << "could not find device " << labelName().text() << " in mount points.";

View File

@ -24,7 +24,7 @@
class FormattedSpinBox : public QDoubleSpinBox
{
public:
FormattedSpinBox(QWidget* parent = NULL) : QDoubleSpinBox(parent) {}
FormattedSpinBox(QWidget* parent = nullptr) : QDoubleSpinBox(parent) {}
public:
virtual QString textFromValue(double value) const;

View File

@ -150,7 +150,7 @@ void InfoPane::showDevice(Qt::DockWidgetArea area, const Device& d)
QString type = QStringLiteral("---");
QString maxPrimaries = QStringLiteral("---");
if (d.partitionTable() != NULL) {
if (d.partitionTable() != nullptr) {
type = (d.partitionTable()->isReadOnly())
? i18nc("@label device", "%1 (read only)", d.partitionTable()->typeName())
: d.partitionTable()->typeName();

View File

@ -39,7 +39,7 @@ class InfoPane : public QWidget
Q_DISABLE_COPY(InfoPane)
public:
InfoPane(QWidget* parent = NULL);
InfoPane(QWidget* parent = nullptr);
public:
void showPartition(Qt::DockWidgetArea area, const Partition& p);

View File

@ -44,7 +44,7 @@ public:
ListDevices::ListDevices(QWidget* parent) :
QWidget(parent),
Ui::ListDevicesBase(),
m_ActionCollection(NULL)
m_ActionCollection(nullptr)
{
setupUi(this);
}
@ -62,7 +62,7 @@ void ListDevices::on_m_ListDevices_itemSelectionChanged()
if (listDevices().selectedItems().size() == 1) {
ListDeviceWidgetItem* item = dynamic_cast<ListDeviceWidgetItem*>(listDevices().selectedItems()[0]);
if (item != NULL)
if (item != nullptr)
emit selectionChanged(item->deviceNode);
}
}
@ -76,7 +76,7 @@ void ListDevices::on_m_ListDevices_itemDoubleClicked(QListWidgetItem* list_item)
{
ListDeviceWidgetItem* item = dynamic_cast<ListDeviceWidgetItem*>(list_item);
if (item != NULL)
if (item != nullptr)
emit deviceDoubleClicked(item->deviceNode);
}

View File

@ -38,7 +38,7 @@ class ListDevices : public QWidget, public Ui::ListDevicesBase
Q_DISABLE_COPY(ListDevices)
public:
ListDevices(QWidget* parent = NULL);
ListDevices(QWidget* parent = nullptr);
Q_SIGNALS:
void selectionChanged(const QString& device_node);

View File

@ -31,7 +31,7 @@
ListOperations::ListOperations(QWidget* parent) :
QWidget(parent),
Ui::ListOperationsBase(),
m_ActionCollection(NULL)
m_ActionCollection(nullptr)
{
setupUi(this);
}

View File

@ -39,7 +39,7 @@ class ListOperations : public QWidget, public Ui::ListOperationsBase
Q_DISABLE_COPY(ListOperations)
public:
ListOperations(QWidget* parent = NULL);
ListOperations(QWidget* parent = nullptr);
Q_SIGNALS:
void contextMenuRequested(const QPoint&);

View File

@ -155,14 +155,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();
@ -391,15 +391,15 @@ 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("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()));
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();
@ -411,12 +411,12 @@ void MainWindow::enableActions()
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("propertiesPartition"))->setEnabled(part != nullptr);
actionCollection()->action(QStringLiteral("editMountPoint"))->setEnabled(part && !part->isMounted());
actionCollection()->action(QStringLiteral("mountPartition"))->setEnabled(part && (part->canMount() || part->canUnmount()));
if (part != NULL)
if (part != nullptr)
actionCollection()->action(QStringLiteral("mountPartition"))->setText(part->isMounted() ? part->fileSystem().unmountTitle() : part->fileSystem().mountTitle());
actionCollection()->action(QStringLiteral("checkPartition"))->setEnabled(!readOnly && CheckOperation::canCheck(part));
@ -497,10 +497,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));
@ -604,7 +604,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*>())
@ -679,8 +679,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();
@ -705,7 +705,7 @@ void MainWindow::onCreateNewPartitionTable()
{
Q_ASSERT(pmWidget().selectedDevice());
if (pmWidget().selectedDevice() == NULL) {
if (pmWidget().selectedDevice() == nullptr) {
qWarning() << "selected device is null.";
return;
}
@ -752,7 +752,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()) {
@ -772,7 +772,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;
}
@ -794,7 +794,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;
}
@ -836,7 +836,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;
}
@ -848,7 +848,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;
}
@ -978,7 +978,7 @@ void MainWindow::onPropertiesDevice(const QString&)
static KLocalizedString checkSupportInNode(const PartitionNode* parent)
{
if (parent == NULL)
if (parent == nullptr)
return KLocalizedString();
KLocalizedString rval;
@ -986,7 +986,7 @@ static KLocalizedString 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

@ -51,7 +51,7 @@ class MainWindow : public KXmlGuiWindow, public Ui::MainWindowBase
Q_DISABLE_COPY(MainWindow)
public:
explicit MainWindow(QWidget* parent = NULL);
explicit MainWindow(QWidget* parent = nullptr);
Q_SIGNALS:
void settingsChanged();

View File

@ -82,9 +82,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);
@ -153,17 +153,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);
@ -171,8 +171,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
@ -191,13 +191,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)
@ -235,7 +235,7 @@ static QTreeWidgetItem* createTreeWidgetItem(const Partition& p)
void PartitionManagerWidget::updatePartitions()
{
if (selectedDevice() == NULL)
if (selectedDevice() == nullptr)
return;
treePartitions().clear();
@ -257,7 +257,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);
@ -282,18 +282,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());
}
}
@ -305,9 +305,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;
}
@ -377,12 +377,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))
@ -397,7 +397,7 @@ void PartitionManagerWidget::onMountPartition()
Q_ASSERT(parent);
if (parent != NULL)
if (parent != nullptr)
parent->checkChildrenMounted();
else
qWarning() << "parent is null";
@ -412,7 +412,7 @@ void PartitionManagerWidget::onEditMountPoint()
Q_ASSERT(p);
if (p == NULL)
if (p == nullptr)
return;
QPointer<EditMountPointDialog> dlg = new EditMountPointDialog(this, *p);
@ -445,14 +445,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;
}
@ -476,7 +476,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;
}
@ -484,7 +484,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;
}
@ -511,7 +511,7 @@ void PartitionManagerWidget::onDeletePartition(bool shred)
KStandardGuiItem::cancel(), QStringLiteral("reallyDeleteClipboardPartition")) == KMessageBox::Cancel)
return;
setClipboardPartition(NULL);
setClipboardPartition(nullptr);
}
if (shred && Config::shredSource() == Config::EnumShredSource::random)
@ -532,14 +532,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;
}
@ -577,7 +577,7 @@ void PartitionManagerWidget::onCopyPartition()
{
Q_ASSERT(selectedPartition());
if (selectedPartition() == NULL) {
if (selectedPartition() == nullptr) {
qWarning() << "selected partition: " << selectedPartition();
return;
}
@ -591,12 +591,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;
}
@ -608,7 +608,7 @@ void PartitionManagerWidget::onPastePartition()
Q_ASSERT(dSource);
if (dSource == NULL) {
if (dSource == nullptr) {
qWarning() << "source partition is null.";
return;
}
@ -626,7 +626,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;
}
@ -682,7 +682,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;
}
@ -695,7 +695,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;
}
@ -715,7 +715,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

@ -44,7 +44,7 @@ class PartitionManagerWidget : public QWidget, Ui::PartitionManagerWidgetBase
Q_DISABLE_COPY(PartitionManagerWidget)
public:
PartitionManagerWidget(QWidget* parent = NULL);
PartitionManagerWidget(QWidget* parent = nullptr);
virtual ~PartitionManagerWidget();
Q_SIGNALS:

View File

@ -189,7 +189,7 @@ void PartPropsDialog::updateHideAndShow()
// create a temporary fs for some checks
const FileSystem* fs = FileSystemFactory::create(newFileSystemType(), -1, -1, -1, QString());
if (fs == NULL || fs->supportSetLabel() == FileSystem::cmdSupportNone) {
if (fs == nullptr || fs->supportSetLabel() == FileSystem::cmdSupportNone) {
dialogWidget().label().setReadOnly(true);
dialogWidget().noSetLabel().setVisible(true);
dialogWidget().noSetLabel().setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
@ -207,7 +207,7 @@ void PartPropsDialog::updateHideAndShow()
// when do we show the uuid?
const bool showUuid =
partition().state() != Partition::StateNew && // not for new partitions
!(fs == NULL || fs->supportGetUUID() == FileSystem::cmdSupportNone); // not if the FS doesn't support it
!(fs == nullptr || fs->supportGetUUID() == FileSystem::cmdSupportNone); // not if the FS doesn't support it
dialogWidget().showUuid(showUuid);

View File

@ -34,7 +34,7 @@
*/
PartTableWidget::PartTableWidget(QWidget* parent) :
PartWidgetBase(parent),
m_PartitionTable(NULL),
m_PartitionTable(nullptr),
m_LabelEmpty(i18nc("@info", "Please select a device."), this),
m_ReadOnly(false)
{
@ -42,7 +42,7 @@ PartTableWidget::PartTableWidget(QWidget* parent) :
}
/** Sets the PartitionTable this widget shows.
@param ptable pointer to the PartitionTable to show. Must not be NULL.
@param ptable pointer to the PartitionTable to show. Must not be nullptr.
*/
void PartTableWidget::setPartitionTable(const PartitionTable* ptable)
{
@ -50,7 +50,7 @@ void PartTableWidget::setPartitionTable(const PartitionTable* ptable)
m_PartitionTable = ptable;
if (partitionTable() != NULL) {
if (partitionTable() != nullptr) {
foreach(const Partition * p, partitionTable()->children()) {
PartWidget* w = new PartWidget(this, p);
w->setVisible(true);
@ -76,7 +76,7 @@ PartWidget* PartTableWidget::activeWidget()
if (pw->isActive())
return pw;
return NULL;
return nullptr;
}
const PartWidget* PartTableWidget::activeWidget() const
@ -85,11 +85,11 @@ const PartWidget* PartTableWidget::activeWidget() const
if (pw->isActive())
return pw;
return NULL;
return nullptr;
}
/** Sets a widget active.
@param p pointer to the PartWidget to set active. May be NULL.
@param p pointer to the PartWidget to set active. May be nullptr.
*/
void PartTableWidget::setActiveWidget(PartWidget* p)
{
@ -99,7 +99,7 @@ void PartTableWidget::setActiveWidget(PartWidget* p)
if (activeWidget())
activeWidget()->setActive(false);
if (p != NULL)
if (p != nullptr)
p->setActive(true);
emit itemSelectionChanged(p);
@ -108,7 +108,7 @@ void PartTableWidget::setActiveWidget(PartWidget* p)
}
/** Sets a widget for the given Partition active.
@param p pointer to the Partition whose widget is to be set active. May be NULL.
@param p pointer to the Partition whose widget is to be set active. May be nullptr.
*/
void PartTableWidget::setActivePartition(const Partition* p)
{
@ -121,15 +121,15 @@ void PartTableWidget::setActivePartition(const Partition* p)
return;
}
setActiveWidget(NULL);
setActiveWidget(nullptr);
}
/** Clears the PartTableWidget.
*/
void PartTableWidget::clear()
{
setActiveWidget(NULL);
m_PartitionTable = NULL;
setActiveWidget(nullptr);
m_PartitionTable = nullptr;
// we might have been invoked indirectly via a widget's context menu, so
// that its event handler is currently running. therefore, do not delete
@ -138,7 +138,7 @@ void PartTableWidget::clear()
foreach(PartWidget * p, childWidgets()) {
p->setVisible(false);
p->deleteLater();
p->setParent(NULL);
p->setParent(nullptr);
}
update();
@ -146,7 +146,7 @@ void PartTableWidget::clear()
void PartTableWidget::resizeEvent(QResizeEvent*)
{
if (partitionTable() == NULL || childWidgets().isEmpty())
if (partitionTable() == nullptr || childWidgets().isEmpty())
labelEmpty().resize(size());
else
positionChildren(this, partitionTable()->children(), childWidgets());
@ -171,6 +171,6 @@ void PartTableWidget::mouseDoubleClickEvent(QMouseEvent* event)
const PartWidget* child = static_cast<PartWidget*>(childAt(event->pos()));
if (child != NULL)
if (child != nullptr)
emit itemDoubleClicked(child);
}

View File

@ -50,8 +50,8 @@ public:
public:
void setPartitionTable(const PartitionTable* ptable);
PartWidget* activeWidget(); /**< @return the active widget or NULL if none */
const PartWidget* activeWidget() const; /**< @return the active widget or NULL if none */
PartWidget* activeWidget(); /**< @return the active widget or nullptr if none */
const PartWidget* activeWidget() const; /**< @return the active widget or nullptr if none */
void setActiveWidget(PartWidget* partWidget);
void setActivePartition(const Partition* p);

View File

@ -100,27 +100,27 @@ public:
void hideRole() {
delete m_LabelRole;
m_LabelRole = NULL;
m_LabelRole = nullptr;
delete m_RadioPrimary;
m_RadioPrimary = NULL;
m_RadioPrimary = nullptr;
delete m_RadioExtended;
m_RadioExtended = NULL;
m_RadioExtended = nullptr;
delete m_RadioLogical;
m_RadioLogical = NULL;
m_RadioLogical = nullptr;
}
void hideFileSystem() {
delete m_LabelFileSystem;
m_LabelFileSystem = NULL;
m_LabelFileSystem = nullptr;
delete m_ComboFileSystem;
m_ComboFileSystem = NULL;
m_ComboFileSystem = nullptr;
}
void hideLabel() {
delete m_LabelTextLabel;
m_LabelTextLabel = NULL;
m_LabelTextLabel = nullptr;
delete m_EditLabel;
m_EditLabel = NULL;
m_EditLabel = nullptr;
delete m_LabelTextNoSetLabel;
m_LabelTextNoSetLabel = NULL;
m_LabelTextNoSetLabel = nullptr;
}
};

View File

@ -36,7 +36,7 @@ class TreeLog: public QWidget, public Ui::TreeLogBase
Q_DISABLE_COPY(TreeLog)
public:
TreeLog(QWidget* parent = NULL);
TreeLog(QWidget* parent = nullptr);
~TreeLog();
Q_SIGNALS:

View File

@ -72,7 +72,7 @@ bool checkPermissions()
return false;
}
return KMessageBox::warningContinueCancel(NULL, xi18nc("@info",
return KMessageBox::warningContinueCancel(nullptr, xi18nc("@info",
"<para><warning>You do not have administrative privileges.</warning></para>"
"<para>It is possible to run <application>%1</application> without these privileges. "
"You will, however, <emphasis>not</emphasis> be allowed to apply operations.</para>"
@ -91,14 +91,14 @@ bool loadBackend()
{
if (CoreBackendManager::self()->load(Config::backend()) == false) {
if (CoreBackendManager::self()->load(CoreBackendManager::defaultBackendName())) {
KMessageBox::sorry(NULL,
KMessageBox::sorry(nullptr,
xi18nc("@info", "<para>The configured backend plugin \"%1\" could not be loaded.</para>"
"<para>Loading the default backend plugin \"%2\" instead.</para>",
Config::backend(), CoreBackendManager::defaultBackendName()),
i18nc("@title:window", "Error: Could Not Load Backend Plugin"));
Config::setBackend(CoreBackendManager::defaultBackendName());
} else {
KMessageBox::error(NULL,
KMessageBox::error(nullptr,
xi18nc("@info", "<para>Neither the configured (\"%1\") nor the default (\"%2\") backend "
"plugin could be loaded.</para><para>Please check your installation.</para>",
Config::backend(), CoreBackendManager::defaultBackendName()),