Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit b14d87a3 authored by Michael Reeves's avatar Michael Reeves

resolve some implicit bool convertions

parent 1ef6d978
......@@ -46,29 +46,29 @@ MergeFileInfos::~MergeFileInfos()
QString MergeFileInfos::subPath() const
{
if(m_pFileInfoA && m_pFileInfoA->exists())
if(m_pFileInfoA != nullptr && m_pFileInfoA->exists())
return m_pFileInfoA->fileRelPath();
else if(m_pFileInfoB && m_pFileInfoB->exists())
else if(m_pFileInfoB != nullptr && m_pFileInfoB->exists())
return m_pFileInfoB->fileRelPath();
else if(m_pFileInfoC && m_pFileInfoC->exists())
else if(m_pFileInfoC != nullptr && m_pFileInfoC->exists())
return m_pFileInfoC->fileRelPath();
return QString("");
}
QString MergeFileInfos::fileName() const
{
if(m_pFileInfoA && m_pFileInfoA->exists())
if(m_pFileInfoA != nullptr && m_pFileInfoA->exists())
return m_pFileInfoA->fileName();
else if(m_pFileInfoB && m_pFileInfoB->exists())
else if(m_pFileInfoB != nullptr && m_pFileInfoB->exists())
return m_pFileInfoB->fileName();
else if(m_pFileInfoC && m_pFileInfoC->exists())
else if(m_pFileInfoC != nullptr && m_pFileInfoC->exists())
return m_pFileInfoC->fileName();
return QString("");
}
bool MergeFileInfos::conflictingFileTypes()
{
if((m_pFileInfoA && !m_pFileInfoA->isNormal()) || (m_pFileInfoB && !m_pFileInfoB->isNormal()) || (m_pFileInfoC && !m_pFileInfoC->isNormal()))
if((m_pFileInfoA != nullptr && !m_pFileInfoA->isNormal()) || (m_pFileInfoB != nullptr && !m_pFileInfoB->isNormal()) || (m_pFileInfoC != nullptr && !m_pFileInfoC->isNormal()))
return true;
// Now check if file/dir-types fit.
if(isLinkA() || isLinkB() || isLinkC())
......
......@@ -77,14 +77,14 @@ class MergeFileInfos
QString subPath() const;
QString fileName() const;
bool isDirA() const { return m_pFileInfoA ? m_pFileInfoA->isDir() : false; }
bool isDirB() const { return m_pFileInfoB ? m_pFileInfoB->isDir() : false; }
bool isDirC() const { return m_pFileInfoC ? m_pFileInfoC->isDir() : false; }
bool isDirA() const { return m_pFileInfoA != nullptr ? m_pFileInfoA->isDir() : false; }
bool isDirB() const { return m_pFileInfoB != nullptr ? m_pFileInfoB->isDir() : false; }
bool isDirC() const { return m_pFileInfoC != nullptr ? m_pFileInfoC->isDir() : false; }
bool hasDir() const { return isDirA() || isDirB() || isDirC(); }
bool isLinkA() const { return m_pFileInfoA ? m_pFileInfoA->isSymLink() : false; }
bool isLinkB() const { return m_pFileInfoB ? m_pFileInfoB->isSymLink() : false; }
bool isLinkC() const { return m_pFileInfoC ? m_pFileInfoC->isSymLink() : false; }
bool isLinkA() const { return m_pFileInfoA != nullptr ? m_pFileInfoA->isSymLink() : false; }
bool isLinkB() const { return m_pFileInfoB != nullptr ? m_pFileInfoB->isSymLink() : false; }
bool isLinkC() const { return m_pFileInfoC != nullptr ? m_pFileInfoC->isSymLink() : false; }
bool hasLink() const { return isLinkA() || isLinkB() || isLinkC(); }
bool existsInA() const { return m_pFileInfoA != nullptr; }
......
......@@ -430,7 +430,7 @@ int getBestFirstLine(int line, int nofLines, int firstLine, int visibleLines);
extern bool g_bIgnoreWhiteSpace;
extern bool g_bIgnoreTrivialMatches;
extern int g_bAutoSolve;
extern bool g_bAutoSolve;
// Cursor conversions that consider g_tabSize.
int convertToPosInText(const QString& s, int posOnScreen, int tabSize);
......
......@@ -837,7 +837,7 @@ bool FileAccessJobHandler::stat(int detail, bool bWantToWrite)
void FileAccessJobHandler::slotStatResult(KJob* pJob)
{
if(pJob->error())
if(pJob->error() != KJob::NoError)
{
//pJob->uiDelegate()->showErrorMessage();
m_pFileAccess->doError();
......@@ -880,7 +880,7 @@ bool FileAccessJobHandler::get(void* pDestBuffer, long maxLength)
void FileAccessJobHandler::slotGetData(KJob* pJob, const QByteArray& newData)
{
if(pJob->error())
if(pJob->error() != KJob::NoError)
{
pJob->uiDelegate()->showErrorMessage();
}
......@@ -918,7 +918,7 @@ bool FileAccessJobHandler::put(const void* pSrcBuffer, long maxLength, bool bOve
void FileAccessJobHandler::slotPutData(KIO::Job* pJob, QByteArray& data)
{
if(pJob->error())
if(pJob->error() != KJob::NoError)
{
pJob->uiDelegate()->showErrorMessage();
}
......@@ -951,7 +951,7 @@ void FileAccessJobHandler::slotPutData(KIO::Job* pJob, QByteArray& data)
void FileAccessJobHandler::slotPutJobResult(KJob* pJob)
{
if(pJob->error())
if(pJob->error() != KJob::NoError)
{
pJob->uiDelegate()->showErrorMessage();
}
......@@ -1061,7 +1061,7 @@ bool FileAccessJobHandler::rename(const FileAccess& destFile)
void FileAccessJobHandler::slotSimpleJobResult(KJob* pJob)
{
if(pJob->error())
if(pJob->error() != KJob::NoError)
{
pJob->uiDelegate()->showErrorMessage();
}
......
......@@ -154,7 +154,7 @@ KDiff3App::KDiff3App(QWidget* pParent, const QString& name, KDiff3Part* pKDiff3P
m_bLoadFiles = false;
// Needed before any file operations via FileAccess happen.
if(!g_pProgressDialog)
if(g_pProgressDialog == nullptr)
{
g_pProgressDialog = new ProgressDialog(this, statusBar());
g_pProgressDialog->setStayHidden(true);
......@@ -468,7 +468,7 @@ void KDiff3App::completeInit(const QString& fn1, const QString& fn2, const QStri
}
m_bAutoMode = false;
if(m_pKDiff3Shell)
if(m_pKDiff3Shell != nullptr)
{
if(m_pOptions->m_bMaximised)
//We want showMaximized here as the window has never been shown.
......@@ -827,10 +827,10 @@ void KDiff3App::slotFilePrint()
m_pDiffTextWindow1->getSelectionRange(&firstSelectionD3LIdx, &lastSelectionD3LIdx, eD3LLineCoords);
if(firstSelectionD3LIdx < 0 && m_pDiffTextWindow2) {
if(firstSelectionD3LIdx < 0 && m_pDiffTextWindow2 != nullptr) {
m_pDiffTextWindow2->getSelectionRange(&firstSelectionD3LIdx, &lastSelectionD3LIdx, eD3LLineCoords);
}
if(firstSelectionD3LIdx < 0 && m_pDiffTextWindow3) {
if(firstSelectionD3LIdx < 0 && m_pDiffTextWindow3 != nullptr) {
m_pDiffTextWindow3->getSelectionRange(&firstSelectionD3LIdx, &lastSelectionD3LIdx, eD3LLineCoords);
}
......@@ -894,7 +894,7 @@ void KDiff3App::slotFilePrint()
}
LineCount totalNofLines = std::max(m_pDiffTextWindow1->getNofLines(), m_pDiffTextWindow2->getNofLines());
if(m_bTripleDiff && m_pDiffTextWindow3)
if(m_bTripleDiff && m_pDiffTextWindow3 != nullptr)
totalNofLines = std::max(totalNofLines, m_pDiffTextWindow3->getNofLines());
QList<int> pageList; // = printer.pageList();
......@@ -985,7 +985,7 @@ void KDiff3App::slotFilePrint()
QString headerText2 = m_sd2.getAliasName() + ", " + topLineText + ": " + QString::number(m_pDiffTextWindow2->calcTopLineInFile(line) + 1);
printDiffTextWindow(painter, view2, headerText2, m_pDiffTextWindow2, line, linesPerPage, m_pOptions->m_fgColor);
if(m_bTripleDiff && m_pDiffTextWindow3)
if(m_bTripleDiff && m_pDiffTextWindow3 != nullptr)
{
painter.setPen(m_pOptions->m_colorC);
QString headerText3 = m_sd3.getAliasName() + ", " + topLineText + ": " + QString::number(m_pDiffTextWindow3->calcTopLineInFile(line) + 1);
......
......@@ -71,7 +71,7 @@ class ReversibleScrollBar : public QScrollBar
void setValue(int i)
{
if(m_pbRightToLeftLanguage && *m_pbRightToLeftLanguage)
if(m_pbRightToLeftLanguage != nullptr && *m_pbRightToLeftLanguage)
QScrollBar::setValue(maximum() - (i - minimum()));
else
QScrollBar::setValue(i);
......@@ -85,7 +85,7 @@ class ReversibleScrollBar : public QScrollBar
void slotValueChanged(int i)
{
m_realVal = i;
if(m_pbRightToLeftLanguage && *m_pbRightToLeftLanguage)
if(m_pbRightToLeftLanguage != nullptr && *m_pbRightToLeftLanguage)
m_realVal = maximum() - (i - minimum());
emit valueChanged2(m_realVal);
}
......
......@@ -51,7 +51,7 @@
#include <KMessageBox>
#include <KToggleAction>
int g_bAutoSolve = true;
bool g_bAutoSolve = true;
#undef leftInfoWidth
......@@ -84,7 +84,7 @@ MergeResultWindow::MergeResultWindow(
m_pDiff3LineList = nullptr;
m_pTotalDiffStatus = nullptr;
m_pStatusBar = pStatusBar;
if(m_pStatusBar)
if(m_pStatusBar != nullptr)
connect(m_pStatusBar, &QStatusBar::messageChanged, this, &MergeResultWindow::slotStatusMessageChanged);
m_pOptions = pOptions;
......@@ -167,7 +167,7 @@ void MergeResultWindow::initActions(KActionCollection* ac)
void MergeResultWindow::showUnsolvedConflictsStatusMessage()
{
if(m_pStatusBar)
if(m_pStatusBar != nullptr)
{
int wsc;
int nofUnsolved = getNrOfUnsolvedConflicts(&wsc);
......@@ -3217,11 +3217,11 @@ void WindowTitleWidget::setEncodings(QTextCodec* pCodecForA, QTextCodec* pCodecF
names[QLatin1String(c->name())] = c;
}
if(pCodecForA)
if(pCodecForA != nullptr)
m_pEncodingSelector->addItem(i18n("Codec from A: %1", QLatin1String(pCodecForA->name())), QVariant::fromValue((void*)pCodecForA));
if(pCodecForB)
if(pCodecForB != nullptr)
m_pEncodingSelector->addItem(i18n("Codec from B: %1", QLatin1String(pCodecForB->name())), QVariant::fromValue((void*)pCodecForB));
if(pCodecForC)
if(pCodecForC != nullptr)
m_pEncodingSelector->addItem(i18n("Codec from C: %1", QLatin1String(pCodecForC->name())), QVariant::fromValue((void*)pCodecForC));
std::map<QString, QTextCodec*>::iterator it;
......@@ -3231,7 +3231,7 @@ void WindowTitleWidget::setEncodings(QTextCodec* pCodecForA, QTextCodec* pCodecF
}
m_pEncodingSelector->setMinimumSize(m_pEncodingSelector->sizeHint());
if(pCodecForC && pCodecForB && pCodecForA)
if(pCodecForC != nullptr && pCodecForB != nullptr && pCodecForA != nullptr)
{
if(pCodecForA == pCodecForB)
m_pEncodingSelector->setCurrentIndex(2); // C
......@@ -3240,7 +3240,7 @@ void WindowTitleWidget::setEncodings(QTextCodec* pCodecForA, QTextCodec* pCodecF
else
m_pEncodingSelector->setCurrentIndex(2); // C
}
else if(pCodecForA && pCodecForB)
else if(pCodecForA != nullptr && pCodecForB != nullptr)
m_pEncodingSelector->setCurrentIndex(1); // B
else
m_pEncodingSelector->setCurrentIndex(0);
......
......@@ -61,7 +61,7 @@ ProgressDialog::ProgressDialog(QWidget* pParent, QStatusBar* pStatusBar)
m_pAbortButton = new QPushButton(i18n("&Cancel"), this);
hlayout->addWidget(m_pAbortButton);
connect(m_pAbortButton, &QPushButton::clicked, this, &ProgressDialog::slotAbort);
if(m_pStatusBar)
if(m_pStatusBar != nullptr)
{
m_pStatusBarWidget = new QWidget;
QHBoxLayout* pStatusBarLayout = new QHBoxLayout(m_pStatusBarWidget);
......@@ -100,7 +100,7 @@ void ProgressDialog::setStayHidden(bool bStayHidden)
if(m_bStayHidden != bStayHidden)
{
m_bStayHidden = bStayHidden;
if(m_pStatusBarWidget)
if(m_pStatusBarWidget != nullptr)
{
if(m_bStayHidden)
{
......@@ -164,7 +164,7 @@ void ProgressDialog::setInformation(const QString& info, int current, bool bRedr
{
m_pInformation->setText(info);
m_pSubInformation->setText("");
if(m_pStatusBar && m_bStayHidden)
if(m_pStatusBar != nullptr && m_bStayHidden)
m_pStatusBar->showMessage(info);
}
else if(level == 2)
......@@ -401,7 +401,7 @@ void ProgressDialog::delayedHideStatusBarWidget()
if(m_progressDelayTimer)
killTimer(m_progressDelayTimer);
m_progressDelayTimer = 0;
if(m_pStatusBarWidget)
if(m_pStatusBarWidget != nullptr)
{
m_pStatusBarWidget->hide();
m_pStatusProgressBar->setValue(0);
......
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