Commit fd618dd7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 55936ec7
......@@ -80,13 +80,13 @@ void DetailDialog::updateDetails()
message->setText(item->logLine()->logItems().last());
if (mLogViewWidget->topLevelItem(mLogViewWidget->indexOfTopLevelItem(item) - 1) == nullptr) {
if (!mLogViewWidget->topLevelItem(mLogViewWidget->indexOfTopLevelItem(item) - 1)) {
previous->setEnabled(false);
} else {
previous->setEnabled(true);
}
if (mLogViewWidget->topLevelItem(mLogViewWidget->indexOfTopLevelItem(item) + 1) == nullptr) {
if (!mLogViewWidget->topLevelItem(mLogViewWidget->indexOfTopLevelItem(item) + 1)) {
next->setEnabled(false);
} else {
next->setEnabled(true);
......@@ -108,7 +108,7 @@ void DetailDialog::moveToItem(int direction)
// Get the current-last item selected
LogViewWidgetItem *item = mLogViewWidget->lastSelectedItem();
if (item == nullptr) {
if (!item) {
logDebug() << "No item found.";
return;
}
......
......@@ -203,7 +203,7 @@ bool FileAnalyzer::insertLine(const QString &buffer, const LogFile &originalFile
LogLine *line = parseMessage(buffer, originalFile);
// Invalid log line
if (line == nullptr) {
if (!line) {
return false;
}
......
......@@ -144,7 +144,7 @@ QIODevice *LocalLogFileReader::open()
// inputDevice = KFilterDev::deviceForFile(filePath, mimeType);
inputDevice.reset(new KCompressionDevice(filePath, KFilterDev::compressionTypeForMimeType(mimeType)));
if (inputDevice == nullptr) {
if (!inputDevice) {
const QString message(i18n("Unable to uncompress the '%2' format of '%1'.", filePath, mimeType));
Q_EMIT errorOccured(i18n("Unable to Uncompress File"), message);
Q_EMIT statusBarChanged(message);
......@@ -201,7 +201,7 @@ void LocalLogFileReader::logFileModified()
}
QIODevice *inputDevice = open();
if (inputDevice == nullptr) {
if (!inputDevice) {
logCritical() << "Could not open file " << d->logFile.url().toLocalFile();
return;
}
......
......@@ -213,7 +213,7 @@ void LogViewExport::fileSave()
QTreeWidgetItemIterator it(mLogViewWidget, QTreeWidgetItemIterator::Selected);
// No item selected
if (*it == nullptr) {
if (!(*it)) {
Q_EMIT statusBarChanged(i18n("No items selected. Please select items to be able to save them."));
return;
}
......
......@@ -212,7 +212,7 @@ void LogViewModel::insert(LogLine *line)
auto *item = new LogViewWidgetItem(mLogViewWidget, line);
// Update the oldest item
if (mOldestItem == nullptr) {
if (!mOldestItem) {
mOldestItem = item;
} else if (mOldestItem->logLine()->isNewerThan(*line)) {
mOldestItem = item;
......
......@@ -188,7 +188,7 @@ inline void LogViewSearchWidget::initIterator(QTreeWidgetItemIterator &it, Direc
QTreeWidgetItemIterator testedIterator(it);
while (true) {
++testedIterator;
if (*testedIterator == nullptr) {
if (!(*testedIterator)) {
break;
}
......
......@@ -680,7 +680,7 @@ QString AuditConvertor::convertSockOptLevel(const QString &level)
return QStringLiteral("SOL_SOCKET");
} else {
protoent *p = getprotobynumber(ival);
if (p == nullptr) {
if (!p) {
return socklevelMap.value(ival, QStringLiteral("unknown-sockopt-level(0x%1)").arg(level));
} else {
return QString::fromLatin1(p->p_name);
......
......@@ -291,7 +291,7 @@ void TabLogViewsWidget::reloadAll()
const auto tabLogManagers = mTabLogManagers;
for (TabLogManager *tabLogManager : tabLogManagers) {
// Log manager without log mode does not need to be reloaded
if (tabLogManager->logManager()->logMode() == nullptr) {
if (!tabLogManager->logManager()->logMode()) {
continue;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment