Index: autotests/clipboardupdatertest.cpp =================================================================== --- autotests/clipboardupdatertest.cpp +++ autotests/clipboardupdatertest.cpp @@ -123,7 +123,7 @@ const QString pasteDir = dir.path() + QLatin1String("/pastedir"); createTestDirectory(pasteDir, NoSymlink); - KIO::Job *job = KIO::pasteClipboard(QUrl::fromLocalFile(pasteDir), 0); + KIO::Job *job = KIO::pasteClipboard(QUrl::fromLocalFile(pasteDir), nullptr); QVERIFY(job->exec()); QCOMPARE(job->error(), 0); } @@ -145,7 +145,7 @@ const QString pasteDir = dir.path() + QLatin1String("/pastedir"); createTestDirectory(pasteDir, NoSymlink); - KIO::Job *job = KIO::pasteClipboard(QUrl::fromLocalFile(pasteDir), 0); + KIO::Job *job = KIO::pasteClipboard(QUrl::fromLocalFile(pasteDir), nullptr); QVERIFY(!job); } @@ -166,7 +166,7 @@ const QString pasteDir = dir.path() + QLatin1String("/pastedir"); createTestDirectory(pasteDir, NoSymlink); - KIO::Job *job = KIO::pasteClipboard(QUrl::fromLocalFile(pasteDir), 0); + KIO::Job *job = KIO::pasteClipboard(QUrl::fromLocalFile(pasteDir), nullptr); QVERIFY(!job); } Index: autotests/deletejobtest.cpp =================================================================== --- autotests/deletejobtest.cpp +++ autotests/deletejobtest.cpp @@ -57,7 +57,7 @@ /*QBENCHMARK*/ { KIO::DeleteJob *job = KIO::del(QUrl::fromLocalFile(tempFile.fileName()), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy spy(job, SIGNAL(result(KJob*))); QVERIFY(spy.isValid()); @@ -87,7 +87,7 @@ /*QBENCHMARK*/ { KIO::DeleteJob *job = KIO::del(QUrl::fromLocalFile(tempDir.path()), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy spy(job, SIGNAL(result(KJob*))); QVERIFY(spy.isValid()); Index: autotests/dropjobtest.cpp =================================================================== --- autotests/dropjobtest.cpp +++ autotests/dropjobtest.cpp @@ -54,7 +54,7 @@ Q_OBJECT public: JobSpy(KIO::Job *job) - : QObject(0), + : QObject(nullptr), m_spy(job, SIGNAL(result(KJob*))), m_error(0) { @@ -155,7 +155,7 @@ QUrl destUrl = QUrl::fromLocalFile(desktopPath); QDropEvent dropEvent(QPoint(10, 10), Qt::CopyAction, &m_mimeData, Qt::LeftButton, Qt::NoModifier); KIO::DropJob *job = KIO::drop(&dropEvent, destUrl, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy spy(job, SIGNAL(itemCreated(QUrl))); // Then the application is run with the source file as argument @@ -213,8 +213,8 @@ m_mimeData.setUrls(QList() << QUrl::fromLocalFile(srcFile)); QDropEvent dropEvent(QPoint(10, 10), dropAction, &m_mimeData, Qt::LeftButton, modifiers); KIO::DropJob *job = KIO::drop(&dropEvent, destUrl, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); JobSpy jobSpy(job); QSignalSpy copyJobSpy(job, SIGNAL(copyJobStarted(KIO::CopyJob*))); QSignalSpy itemCreatedSpy(job, SIGNAL(itemCreated(QUrl))); @@ -265,7 +265,7 @@ m_mimeData.setUrls(QList() << QUrl::fromLocalFile(srcFile)); QDropEvent dropEvent(QPoint(10, 10), dropAction, &m_mimeData, Qt::LeftButton, modifiers); KIO::DropJob *job = KIO::drop(&dropEvent, QUrl(QStringLiteral("trash:/")), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy copyJobSpy(job, SIGNAL(copyJobStarted(KIO::CopyJob*))); QSignalSpy itemCreatedSpy(job, SIGNAL(itemCreated(QUrl))); @@ -308,7 +308,7 @@ m_mimeData.setUrls(QList() << trashUrl); QDropEvent dropEvent(QPoint(10, 10), Qt::CopyAction, &m_mimeData, Qt::LeftButton, Qt::NoModifier); KIO::DropJob *job = KIO::drop(&dropEvent, QUrl::fromLocalFile(m_srcDir), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy copyJobSpy(job, SIGNAL(copyJobStarted(KIO::CopyJob*))); QSignalSpy spy(job, SIGNAL(itemCreated(QUrl))); @@ -340,7 +340,7 @@ m_mimeData.setUrls(QList() << trashUrl); QDropEvent dropEvent(QPoint(10, 10), Qt::CopyAction, &m_mimeData, Qt::LeftButton, Qt::NoModifier); KIO::DropJob *job = KIO::drop(&dropEvent, destUrl, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy copyJobSpy(job, SIGNAL(copyJobStarted(KIO::CopyJob*))); QVERIFY2(job->exec(), qPrintable(job->errorString())); @@ -390,8 +390,8 @@ QUrl destUrl = QUrl::fromLocalFile(dest); QDropEvent dropEvent(QPoint(10, 10), Qt::CopyAction /*unused*/, &m_mimeData, Qt::LeftButton, Qt::NoModifier); KIO::DropJob *job = KIO::drop(&dropEvent, destUrl, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); // no rename dialog + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); // no rename dialog JobSpy jobSpy(job); qRegisterMetaType(); QSignalSpy spyShow(job, SIGNAL(popupMenuAboutToShow(KFileItemListProperties))); @@ -439,7 +439,7 @@ QAction appAction1(QStringLiteral("action1"), this); QAction appAction2(QStringLiteral("action2"), this); QList appActions; appActions << &appAction1 << &appAction2; - job->setUiDelegate(0); + job->setUiDelegate(nullptr); job->setApplicationActions(appActions); JobSpy jobSpy(job); Index: autotests/fileundomanagertest.cpp =================================================================== --- autotests/fileundomanagertest.cpp +++ autotests/fileundomanagertest.cpp @@ -268,7 +268,7 @@ QList lst = sourceList(); const QUrl d = QUrl::fromLocalFile(destdir); KIO::CopyJob *job = KIO::copy(lst, d, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordCopyJob(job); QSignalSpy spyUndoAvailable(FileUndoManager::self(), SIGNAL(undoAvailable(bool))); @@ -324,7 +324,7 @@ QList lst = sourceList(); const QUrl d = QUrl::fromLocalFile(destdir); KIO::CopyJob *job = KIO::move(lst, d, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordCopyJob(job); bool ok = job->exec(); @@ -367,7 +367,7 @@ QList lst; lst << QUrl::fromLocalFile(srcSubDir()); const QUrl d = QUrl::fromLocalFile(destdir); KIO::CopyJob *job = KIO::copy(lst, d, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordCopyJob(job); bool ok = job->exec(); @@ -388,7 +388,7 @@ QList lst; lst << QUrl::fromLocalFile(srcSubDir()); const QUrl d = QUrl::fromLocalFile(destdir); KIO::CopyJob *job = KIO::move(lst, d, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordCopyJob(job); bool ok = job->exec(); @@ -412,7 +412,7 @@ QSignalSpy spyUndoAvailable(FileUndoManager::self(), SIGNAL(undoAvailable(bool))); QVERIFY(spyUndoAvailable.isValid()); KIO::Job *job = KIO::moveAs(oldUrl, newUrl, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordJob(FileUndoManager::Rename, lst, newUrl, job); bool ok = job->exec(); @@ -435,7 +435,7 @@ QList lst; lst.append(oldUrl); KIO::Job *job = KIO::moveAs(oldUrl, newUrl, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordJob(FileUndoManager::Rename, lst, newUrl, job); bool ok = job->exec(); @@ -465,7 +465,7 @@ QVERIFY(QFile::exists(targetPath)); KIO::CopyJob *job = KIO::link(target, link); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordCopyJob(job); bool ok = job->exec(); QVERIFY(ok); @@ -485,7 +485,7 @@ QVERIFY(!QFile::exists(path)); KIO::SimpleJob *job = KIO::mkdir(url); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordJob(FileUndoManager::Mkdir, QList(), url, job); bool ok = job->exec(); QVERIFY(ok); @@ -515,7 +515,7 @@ const QUrl url = QUrl::fromLocalFile(path); KIO::Job *job = KIO::mkpath(url); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordJob(FileUndoManager::Mkpath, QList(), url, job); QVERIFY(job->exec()); QVERIFY(QFileInfo(path).isDir()); @@ -542,7 +542,7 @@ QList lst = sourceList(); lst.append(QUrl::fromLocalFile(srcSubDir())); KIO::Job *job = KIO::trash(lst, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordJob(FileUndoManager::Trash, lst, QUrl(QStringLiteral("trash:/")), job); bool ok = job->exec(); @@ -583,7 +583,7 @@ QList lst = sourceList(); lst.append(QUrl::fromLocalFile(srcSubDir())); KIO::Job *job = KIO::trash(lst, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QVERIFY(job->exec()); const QMap metaData = job->metaData(); @@ -598,7 +598,7 @@ // Restore from trash KIO::RestoreJob *restoreJob = KIO::restoreFromTrash(trashUrls, KIO::HideProgressInfo); - restoreJob->setUiDelegate(0); + restoreJob->setUiDelegate(nullptr); QVERIFY(restoreJob->exec()); QVERIFY(QFile::exists(srcFile())); @@ -617,7 +617,7 @@ // Put timestamp in the past so that we can check that the // copy actually preserves it. struct timeval tp; - gettimeofday(&tp, 0); + gettimeofday(&tp, nullptr); struct utimbuf utbuf; utbuf.actime = tp.tv_sec + 30; // 30 seconds in the future utbuf.modtime = tp.tv_sec + 60; // 60 second in the future @@ -633,7 +633,7 @@ QList lst; lst << QUrl::fromLocalFile(srcSubDir()); const QUrl d = QUrl::fromLocalFile(destdir); KIO::CopyJob *job = KIO::copy(lst, d, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); FileUndoManager::self()->recordCopyJob(job); bool ok = job->exec(); Index: autotests/http/httpauthenticationtest.cpp =================================================================== --- autotests/http/httpauthenticationtest.cpp +++ autotests/http/httpauthenticationtest.cpp @@ -196,7 +196,7 @@ QFETCH(QByteArray, expectedOffer); QByteArray scheme, offer; - parseAuthHeader(input, &offer, &scheme, 0); + parseAuthHeader(input, &offer, &scheme, nullptr); QCOMPARE(scheme, expectedScheme); QCOMPARE(offer, expectedOffer); } @@ -265,7 +265,7 @@ QFETCH(QByteArray, cnonce); QByteArray bestOffer; - parseAuthHeader(input, &bestOffer, 0, 0); + parseAuthHeader(input, &bestOffer, nullptr, nullptr); KAbstractHttpAuthentication *authObj = KAbstractHttpAuthentication::newAuth(bestOffer); QVERIFY(authObj); if (!cnonce.isEmpty()) { @@ -286,7 +286,7 @@ QString target("TST"); QByteArray bestOffer; - parseAuthHeader(input, &bestOffer, 0, 0); + parseAuthHeader(input, &bestOffer, nullptr, nullptr); KConfig conf; KConfigGroup confGroup = conf.group("test"); confGroup.writeEntry("EnableNTLMv2Auth", true); Index: autotests/http_jobtest.cpp =================================================================== --- autotests/http_jobtest.cpp +++ autotests/http_jobtest.cpp @@ -53,7 +53,7 @@ static const char response[] = "Hello world"; HttpServerThread server(response, HttpServerThread::Public); KIO::StoredTransferJob *job = KIO::storedGet(QUrl(server.endPoint())); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QVERIFY(job->exec()); QCOMPARE(QString::fromLatin1(job->data()), QString::fromLatin1(response)); } @@ -66,7 +66,7 @@ // First we get an error page KIO::StoredTransferJob *job = KIO::storedGet(QUrl(server.endPoint())); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QVERIFY(job->exec()); QCOMPARE(QString::fromLatin1(job->data()), QString::fromLatin1(response)); QVERIFY(job->isErrorPage()); @@ -74,7 +74,7 @@ // Second we disable error page, and get the actual job error job = KIO::storedGet(QUrl(server.endPoint())); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); job->addMetaData(QStringLiteral("errorPage"), QStringLiteral("false")); // maybe this should be a proper setter... QVERIFY(!job->exec()); QVERIFY(!job->isErrorPage()); @@ -85,7 +85,7 @@ server.setFeatures(HttpServerThread::Public); server.setContentType(""); job = KIO::storedGet(QUrl(server.endPoint())); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy mimeTypeSpy(job, SIGNAL(mimetype(KIO::Job*,QString))); QVERIFY(job->exec()); QCOMPARE(job->error(), 0); @@ -99,7 +99,7 @@ HttpServerThread server(response, HttpServerThread::Public); // Add a trailing slash to ensure kio_http doesn't confuse QMimeDatabase with it. KIO::StoredTransferJob *job = KIO::storedGet(QUrl(server.endPoint() + '/')); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy mimeTypeSpy(job, SIGNAL(mimetype(KIO::Job*,QString))); QVERIFY(job->exec()); QCOMPARE(job->error(), 0); Index: autotests/httpserver_p.h =================================================================== --- autotests/httpserver_p.h +++ autotests/httpserver_p.h @@ -142,13 +142,13 @@ { Q_OBJECT public: - BlockingHttpServer(bool ssl) : doSsl(ssl), sslSocket(0) {} + BlockingHttpServer(bool ssl) : doSsl(ssl), sslSocket(nullptr) {} ~BlockingHttpServer() {} QTcpSocket *waitForNextConnectionSocket() { if (!waitForNewConnection(20000)) { // 2000 would be enough, except in valgrind - return 0; + return nullptr; } if (doSsl) { Q_ASSERT(sslSocket); Index: autotests/jobguitest.cpp =================================================================== --- autotests/jobguitest.cpp +++ autotests/jobguitest.cpp @@ -73,8 +73,8 @@ mimeData->setUrls(QList() << fileUrl); QApplication::clipboard()->setMimeData(mimeData); - KIO::Job *job = KIO::pasteClipboard(QUrl::fromLocalFile(otherTmpDir()), static_cast(0)); - job->setUiDelegate(0); + KIO::Job *job = KIO::pasteClipboard(QUrl::fromLocalFile(otherTmpDir()), static_cast(nullptr)); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); @@ -86,7 +86,7 @@ static void delDir(const QString &pathOrUrl) { KIO::Job *job = KIO::del(QUrl::fromLocalFile(pathOrUrl), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); job->exec(); } Index: autotests/jobremotetest.cpp =================================================================== --- autotests/jobremotetest.cpp +++ autotests/jobremotetest.cpp @@ -70,14 +70,14 @@ static bool myExists(const QUrl &url) { KIO::Job *job = KIO::stat(url, KIO::StatJob::DestinationSide, 0, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); return job->exec(); } static bool myMkdir(const QUrl &url) { KIO::Job *job = KIO::mkdir(url, -1); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); return job->exec(); } @@ -108,7 +108,7 @@ static void delDir(const QUrl &pathOrUrl) { KIO::Job *job = KIO::del(pathOrUrl, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); job->exec(); } @@ -136,7 +136,7 @@ QDateTime mtime = QDateTime::currentDateTime().addSecs(-30); // 30 seconds ago mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds job->setModificationTime(mtime); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); connect(job, SIGNAL(result(KJob*)), this, SLOT(slotResult(KJob*))); connect(job, SIGNAL(dataReq(KIO::Job*,QByteArray&)), @@ -149,7 +149,7 @@ m_result = -1; KIO::StoredTransferJob *getJob = KIO::storedGet(u, KIO::NoReload, KIO::HideProgressInfo); - getJob->setUiDelegate(0); + getJob->setUiDelegate(nullptr); connect(getJob, SIGNAL(result(KJob*)), this, SLOT(slotGetResult(KJob*))); enterLoop(); @@ -197,7 +197,7 @@ u.setPath(u.path() + "openFileWriting"); fileJob = KIO::open(u, QIODevice::WriteOnly); - fileJob->setUiDelegate(0); + fileJob->setUiDelegate(nullptr); connect(fileJob, SIGNAL(result(KJob*)), this, SLOT(slotResult(KJob*))); connect(fileJob, SIGNAL(data(KIO::Job*,QByteArray)), @@ -217,7 +217,7 @@ QVERIFY(m_result == 0); // no error KIO::StoredTransferJob *getJob = KIO::storedGet(u, KIO::NoReload, KIO::HideProgressInfo); - getJob->setUiDelegate(0); + getJob->setUiDelegate(nullptr); connect(getJob, SIGNAL(result(KJob*)), this, SLOT(slotGetResult(KJob*))); enterLoop(); @@ -295,7 +295,7 @@ QDateTime mtime = QDateTime::currentDateTime().addSecs(-30); // 30 seconds ago mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds putJob->setModificationTime(mtime); - putJob->setUiDelegate(0); + putJob->setUiDelegate(nullptr); connect(putJob, SIGNAL(result(KJob*)), this, SLOT(slotResult(KJob*))); m_result = -1; @@ -307,7 +307,7 @@ fileJob = KIO::open(u, QIODevice::ReadOnly); - fileJob->setUiDelegate(0); + fileJob->setUiDelegate(nullptr); connect(fileJob, SIGNAL(result(KJob*)), this, SLOT(slotResult(KJob*))); connect(fileJob, SIGNAL(data(KIO::Job*,QByteArray)), @@ -383,7 +383,7 @@ void JobRemoteTest::slotMimetype(KIO::Job *job, const QString &type) { - QVERIFY(job != 0); + QVERIFY(job != nullptr); m_mimetype = type; } Index: autotests/jobtest.cpp =================================================================== --- autotests/jobtest.cpp +++ autotests/jobtest.cpp @@ -141,7 +141,7 @@ KIO::StoredTransferJob *job = KIO::storedGet(u, KIO::NoReload, KIO::HideProgressInfo); QSignalSpy spyPercent(job, SIGNAL(percent(KJob*,ulong))); QVERIFY(spyPercent.isValid()); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); connect(job, SIGNAL(result(KJob*)), this, SLOT(slotGetResult(KJob*))); enterLoop(); @@ -166,7 +166,7 @@ QDateTime mtime = QDateTime::currentDateTime().addSecs(-30); // 30 seconds ago mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds job->setModificationTime(mtime); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); connect(job, SIGNAL(result(KJob*)), this, SLOT(slotResult(KJob*))); connect(job, SIGNAL(dataReq(KIO::Job*,QByteArray&)), @@ -216,7 +216,7 @@ QDateTime mtime = QDateTime::currentDateTime().addSecs(-30); // 30 seconds ago mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds job->setModificationTime(mtime); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QVERIFY(job->exec()); QFileInfo fileInfo(filePath); QVERIFY(fileInfo.exists()); @@ -238,7 +238,7 @@ QDateTime mtime = QDateTime::currentDateTime().addSecs(-30); // 30 seconds ago mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds job->setModificationTime(mtime); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QVERIFY(job->exec()); QFileInfo fileInfo(filePath); QVERIFY(fileInfo.exists()); @@ -312,7 +312,7 @@ mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds job->setModificationTime(mtime); job->setTotalSize(putDataContents.size()); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); job->setAsyncDataEnabled(true); QTimer t; @@ -347,7 +347,7 @@ const int perms = 0666; // copy the file with file_copy KIO::Job *job = KIO::file_copy(u, d, perms, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); QVERIFY(QFile::exists(dest)); @@ -373,8 +373,8 @@ QFile::remove(dest); job = KIO::copy(u, d, KIO::HideProgressInfo); QSignalSpy spyCopyingDone(job, SIGNAL(copyingDone(KIO::Job*,QUrl,QUrl,QDateTime,bool,bool))); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); ok = job->exec(); QVERIFY(ok); QVERIFY(QFile::exists(dest)); @@ -396,24 +396,24 @@ // cleanup and retry with KIO::copyAs() QFile::remove(dest); job = KIO::copyAs(u, d, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); QVERIFY(job->exec()); QVERIFY(QFile::exists(dest)); QVERIFY(QFile::exists(src)); // still there // Do it again, with Overwrite. job = KIO::copyAs(u, d, KIO::Overwrite | KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); QVERIFY(job->exec()); QVERIFY(QFile::exists(dest)); QVERIFY(QFile::exists(src)); // still there // Do it again, without Overwrite (should fail). job = KIO::copyAs(u, d, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); QVERIFY(!job->exec()); // Clean up @@ -434,8 +434,8 @@ } KIO::Job *job = KIO::copy(u, d, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); bool ok = job->exec(); QVERIFY(ok); QVERIFY(QFile::exists(dest)); @@ -461,15 +461,15 @@ // Do it again, with Overwrite. // Use copyAs, we don't want a subdir inside d. job = KIO::copyAs(u, d, KIO::HideProgressInfo | KIO::Overwrite); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); ok = job->exec(); QVERIFY(ok); // Do it again, without Overwrite (should fail). job = KIO::copyAs(u, d, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); ok = job->exec(); QVERIFY(!ok); } @@ -495,8 +495,8 @@ // copy the symlink KIO::Job *job = KIO::copy(u, d, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); QVERIFY2(job->exec(), qPrintable(job->error())); QVERIFY(QT_LSTAT(QFile::encodeName(dest).constData(), &buf) == 0); // dest exists QCOMPARE(linkTarget(dest), expectedLinkTarget); @@ -598,17 +598,17 @@ KIO::CopyJob *job = KIO::copy(QUrl::fromLocalFile(src_dir), QUrl::fromLocalFile(dst_dir), KIO::HideProgressInfo); QSignalSpy spy(job, SIGNAL(warning(KJob*,QString,QString))); - job->setUiDelegate(0); // no skip dialog, thanks + job->setUiDelegate(nullptr); // no skip dialog, thanks QVERIFY(job->exec()); QFile(inaccessible).setPermissions(QFile::Permissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner)); KIO::DeleteJob *deljob1 = KIO::del(QUrl::fromLocalFile(src_dir), KIO::HideProgressInfo); - deljob1->setUiDelegate(0); // no skip dialog, thanks + deljob1->setUiDelegate(nullptr); // no skip dialog, thanks QVERIFY(deljob1->exec()); KIO::DeleteJob *deljob2 = KIO::del(QUrl::fromLocalFile(dst_dir), KIO::HideProgressInfo); - deljob2->setUiDelegate(0); // no skip dialog, thanks + deljob2->setUiDelegate(nullptr); // no skip dialog, thanks QVERIFY(deljob2->exec()); QCOMPARE(spy.count(), 1); // one warning should be emitted by the copy job @@ -624,8 +624,8 @@ const QUrl d = QUrl::fromLocalFile(dest); KIO::Job *job = KIO::file_copy(u, d, KIO::HideProgressInfo); QSignalSpy spyResult(job, SIGNAL(result(KJob*))); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); QVERIFY(job->suspend()); QVERIFY(!spyResult.wait(300)); QVERIFY(job->resume()); @@ -644,8 +644,8 @@ const QUrl d = QUrl::fromLocalFile(dest); KIO::Job *job = KIO::copy(u, d, KIO::HideProgressInfo); QSignalSpy spyResult(job, SIGNAL(result(KJob*))); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); QVERIFY(job->suspend()); QVERIFY(!spyResult.wait(300)); QVERIFY(job->resume()); @@ -662,7 +662,7 @@ // move the file with file_move KIO::Job *job = KIO::file_move(u, d, 0666, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); QVERIFY(QFile::exists(dest)); @@ -671,8 +671,8 @@ // move it back with KIO::move() job = KIO::move(d, u, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); ok = job->exec(); QVERIFY(ok); QVERIFY(!QFile::exists(dest)); @@ -688,8 +688,8 @@ // move the symlink with move, NOT with file_move KIO::Job *job = KIO::move(u, d, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); bool ok = job->exec(); if (!ok) { qWarning() << job->error(); @@ -700,8 +700,8 @@ // move it back with KIO::move() job = KIO::move(d, u, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); ok = job->exec(); QVERIFY(ok); QVERIFY(QT_LSTAT(QFile::encodeName(dest).constData(), &buf) != 0); // doesn't exist anymore @@ -721,8 +721,8 @@ QUrl d = QUrl::fromLocalFile(dest); KIO::Job *job = KIO::move(u, d, KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); bool ok = job->exec(); QVERIFY2(ok, qPrintable(job->errorString())); QVERIFY(QFile::exists(dest)); @@ -811,8 +811,8 @@ // When trying to move it const QString dest = homeTmpDir() + "dest"; KIO::CopyJob *job = KIO::move(QUrl::fromLocalFile(src), QUrl::fromLocalFile(dest), KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); // no skip dialog, thanks + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); // no skip dialog, thanks // The job should fail with "access denied" QVERIFY(!job->exec()); @@ -842,8 +842,8 @@ // When trying to move it const QString dest = homeTmpDir() + "mdnp"; KIO::CopyJob *job = KIO::move(QUrl::fromLocalFile(src), QUrl::fromLocalFile(dest), KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); // no skip dialog, thanks + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); // no skip dialog, thanks // The job should fail with "access denied" QVERIFY(!job->exec()); @@ -868,7 +868,7 @@ QVERIFY(symlinkOk); #endif KIO::ListJob *job = KIO::listRecursive(QUrl::fromLocalFile(src), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList))); bool ok = job->exec(); @@ -903,14 +903,14 @@ const QString filePath = homeTmpDir() + "fileFromHome"; createTestFile(filePath); KIO::ListJob *job = KIO::listDir(QUrl::fromLocalFile(filePath), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QVERIFY(!job->exec()); QCOMPARE(job->error(), static_cast(KIO::ERR_IS_FILE)); // And list something that doesn't exist const QString path = homeTmpDir() + "fileFromHomeDoesNotExist"; job = KIO::listDir(QUrl::fromLocalFile(path), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QVERIFY(!job->exec()); QCOMPARE(job->error(), static_cast(KIO::ERR_DOES_NOT_EXIST)); } @@ -921,10 +921,10 @@ KIO::ListJob *job = KIO::listDir(QUrl::fromLocalFile(src), KIO::HideProgressInfo); QVERIFY(job->isAutoDelete()); QPointer ptr(job); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); qApp->processEvents(); // let the job start, it's no fun otherwise job->kill(); - qApp->sendPostedEvents(0, QEvent::DeferredDelete); // process the deferred delete of the job + qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete); // process the deferred delete of the job QVERIFY(ptr.isNull()); } @@ -934,9 +934,9 @@ KIO::Job *job = KIO::stat(QUrl::fromLocalFile(src), KIO::HideProgressInfo); QVERIFY(job->isAutoDelete()); QPointer ptr(job); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); job->kill(); - qApp->sendPostedEvents(0, QEvent::DeferredDelete); // process the deferred delete of the job + qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete); // process the deferred delete of the job QVERIFY(ptr.isNull()); qApp->processEvents(); // does KIO scheduler crash here? nope. } @@ -946,7 +946,7 @@ const QString src = homeTmpDir(); KIO::Job *job = KIO::stat(QUrl::fromLocalFile(src), KIO::HideProgressInfo); QVERIFY(job->isAutoDelete()); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); delete job; qApp->processEvents(); // does KIO scheduler crash here? } @@ -958,7 +958,7 @@ const QString src = homeTmpDir(); KIO::DirectorySizeJob *job = KIO::directorySize(QUrl::fromLocalFile(src)); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); qDebug() << "totalSize: " << job->totalSize(); @@ -974,16 +974,16 @@ QVERIFY(job->totalSize() >= 325); #endif - qApp->sendPostedEvents(0, QEvent::DeferredDelete); + qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete); } void JobTest::directorySizeError() { KIO::DirectorySizeJob *job = KIO::directorySize(QUrl::fromLocalFile(QStringLiteral("/I/Dont/Exist"))); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(!ok); - qApp->sendPostedEvents(0, QEvent::DeferredDelete); + qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete); } void JobTest::slotEntries(KIO::Job *, const KIO::UDSEntryList &lst) @@ -1090,8 +1090,8 @@ QVERIFY(!url.isValid()); KIO::SimpleJob *job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo); - QVERIFY(job != 0); - job->setUiDelegate(0); + QVERIFY(job != nullptr); + job->setUiDelegate(nullptr); KIO::Scheduler::setJobPriority(job, 1); // shouldn't crash (#135456) @@ -1101,7 +1101,7 @@ void JobTest::slotMimetype(KIO::Job *job, const QString &type) { - QVERIFY(job != 0); + QVERIFY(job != nullptr); m_mimetype = type; } @@ -1110,7 +1110,7 @@ const QString dest = otherTmpDir() + "fileFromHome_copied"; createTestFile(dest); KIO::Job *job = KIO::del(QUrl::fromLocalFile(dest), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); QVERIFY(!QFile::exists(dest)); @@ -1137,7 +1137,7 @@ #endif KIO::Job *job = KIO::del(QUrl::fromLocalFile(dest), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); QVERIFY(!QFile::exists(dest)); @@ -1160,7 +1160,7 @@ QVERIFY(QFile::exists(dest)); } KIO::Job *job = KIO::del(QUrl::fromLocalFile(dest), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); QVERIFY(!QFile::exists(dest)); @@ -1193,7 +1193,7 @@ QTime dt; dt.start(); KIO::Job *job = KIO::del(dirs, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); Q_FOREACH (const QUrl &dir, dirs) { @@ -1242,7 +1242,7 @@ QVERIFY(QFile::exists(file)); //qDebug() << file; KIO::Job *job = KIO::del(url, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); QVERIFY(!QFile::exists(file)); @@ -1264,7 +1264,7 @@ //qDebug() << file; KIO::Job *job = KIO::del(urls, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); qDebug() << "Deleted" << numFiles << "files in" << dt.elapsed() << "milliseconds"; @@ -1401,7 +1401,7 @@ QVERIFY(newPerm != origPerm); KFileItemList items; items << item; KIO::Job *job = KIO::chmod(items, newPerm, S_IWGRP /*TODO: QFile::WriteGroup*/, QString(), QString(), false, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QVERIFY(job->exec()); KFileItem newItem(QUrl::fromLocalFile(filePath)); @@ -1485,8 +1485,8 @@ QList urls; urls << QUrl::fromLocalFile(file1) << QUrl::fromLocalFile(file2); KIO::CopyJob *job = KIO::move(urls, QUrl::fromLocalFile(otherTmpDir()), KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); job->setAutoSkip(true); bool ok = job->exec(); QVERIFY(ok); @@ -1546,8 +1546,8 @@ QList urls; urls << QUrl::fromLocalFile(file1) << QUrl::fromLocalFile(file2); KIO::CopyJob *job = KIO::move(urls, QUrl::fromLocalFile(destDir), KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); job->setAutoRename(true); //qDebug() << QDir(destDir).entryList(); @@ -1585,7 +1585,7 @@ createTestFile(existingDest); KIO::FileCopyJob *job = KIO::file_move(QUrl::fromLocalFile(sourceFile), QUrl::fromLocalFile(existingDest), -1, KIO::HideProgressInfo | KIO::Overwrite); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ok = job->exec(); QVERIFY(ok); QVERIFY(!QFile::exists(sourceFile)); // it was moved @@ -1596,7 +1596,7 @@ createTestSymlink(existingDest, QFile::encodeName(sourceFile)); QVERIFY(QFile::exists(existingDest)); job = KIO::file_move(QUrl::fromLocalFile(sourceFile), QUrl::fromLocalFile(existingDest), -1, KIO::HideProgressInfo | KIO::Overwrite); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); ok = job->exec(); QVERIFY(ok); QVERIFY(!QFile::exists(sourceFile)); // it was moved @@ -1607,7 +1607,7 @@ createTestSymlink(existingDest, QFile::encodeName(sourceFile + "2")); QVERIFY(QFile::exists(existingDest)); job = KIO::file_move(QUrl::fromLocalFile(sourceFile), QUrl::fromLocalFile(existingDest), -1, KIO::HideProgressInfo | KIO::Overwrite); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); ok = job->exec(); QVERIFY(ok); QVERIFY(!QFile::exists(sourceFile)); // it was moved @@ -1617,7 +1617,7 @@ createTestSymlink(existingDest); QVERIFY(!QFile::exists(existingDest)); // it exists, but it's broken... job = KIO::file_move(QUrl::fromLocalFile(sourceFile), QUrl::fromLocalFile(existingDest), -1, KIO::HideProgressInfo | KIO::Overwrite); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); ok = job->exec(); QVERIFY(ok); QVERIFY(!QFile::exists(sourceFile)); // it was moved @@ -1634,8 +1634,8 @@ QVERIFY(QFile::exists(existingDest)); KIO::CopyJob *job = KIO::move(QUrl::fromLocalFile(sourceFile), QUrl::fromLocalFile(existingDest), KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); bool ok = job->exec(); QVERIFY(!ok); QCOMPARE(job->error(), (int)KIO::ERR_FILE_ALREADY_EXIST); // and not ERR_IDENTICAL_FILES! @@ -1826,7 +1826,7 @@ QSignalSpy spyMimeType(job, SIGNAL(mimetype(long,QString))); QSignalSpy spyResultId(job, SIGNAL(result(long))); QSignalSpy spyResult(job, SIGNAL(result(KJob*))); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); for (int i = 1; i < numFiles; ++i) { const QUrl url = urls.at(i); Index: autotests/kcookiejar/kcookiejartest.cpp =================================================================== --- autotests/kcookiejar/kcookiejartest.cpp +++ autotests/kcookiejar/kcookiejartest.cpp @@ -32,7 +32,7 @@ static KCookieJar *jar; static QString *lastYear; static QString *nextYear; -static KConfig *config = 0; +static KConfig *config = nullptr; static int windowId = 1234; // random number to be used as windowId for test cookies static void FAIL(const QString &msg) @@ -152,7 +152,7 @@ QString expectedCookies = line; - QString cookies = jar->findCookies(urlStr, false, windowId, 0).trimmed(); + QString cookies = jar->findCookies(urlStr, false, windowId, nullptr).trimmed(); if (cookies != expectedCookies) FAIL(urlStr + QStringLiteral("\nGot '%1' expected '%2'") .arg(cookies, expectedCookies)); Index: autotests/kdirlistertest.cpp =================================================================== --- autotests/kdirlistertest.cpp +++ autotests/kdirlistertest.cpp @@ -46,7 +46,7 @@ // To avoid a runtime dependency on klauncher qputenv("KDE_FORK_SLAVES", "yes"); - KIO::setDefaultJobUiDelegateExtension(0); // no "skip" dialogs + KIO::setDefaultJobUiDelegateExtension(nullptr); // no "skip" dialogs m_exitCount = 1; @@ -75,7 +75,7 @@ void KDirListerTest::cleanup() { m_dirLister.clearSpies(); - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); } void KDirListerTest::testOpenUrl() @@ -113,7 +113,7 @@ //qDebug() << "In dir" << QDir(path).entryList( QDir::AllEntries | QDir::NoDotAndDotDot); QCOMPARE(m_items.count(), fileCount()); QVERIFY(m_dirLister.isFinished()); - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); const QString fileName = QStringLiteral("toplevelfile_3"); const QUrl itemUrl = QUrl::fromLocalFile(path + fileName); @@ -175,7 +175,7 @@ QVERIFY(secondDirLister.isFinished()); } - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); } // This test assumes testOpenUrl was run before. So m_dirLister is holding the items already. @@ -329,7 +329,7 @@ } // TODO: test file update. - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); QFile::remove(symPath); } @@ -480,7 +480,7 @@ QVERIFY(m_dirLister.isFinished()); QCOMPARE(m_items.count(), origItemCount - 1); - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); QCOMPARE(fileCount(), m_items.count()); } @@ -505,7 +505,7 @@ QCOMPARE(entry.first.mimetype(), QString("application/octet-stream")); QCOMPARE(entry.second.url().toLocalFile(), newPath); QCOMPARE(entry.second.mimetype(), QString("text/html")); - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); // Let's see what KDirLister has in cache now KFileItem cachedItem = m_dirLister.findByUrl(QUrl::fromLocalFile(newPath)); @@ -553,7 +553,7 @@ QPair entry = m_refreshedItems.first(); QCOMPARE(entry.first.url().toLocalFile(), newPath); QCOMPARE(entry.second.url().toLocalFile(), path); - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); // Let's see what KDirLister has in cache now KFileItem cachedItem = m_dirLister.findByUrl(QUrl::fromLocalFile(path)); @@ -633,8 +633,8 @@ QTest::qWait(1000); } - disconnect(&m_dirLister, 0, this, 0); - disconnect(&dirLister2, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); + disconnect(&dirLister2, nullptr, this, nullptr); } void KDirListerTest::testConcurrentHoldingListing() @@ -693,7 +693,7 @@ QCOMPARE(m_dirLister.spyClearQUrl.count(), 0); QVERIFY(dirLister2.isFinished()); QVERIFY(m_dirLister.isFinished()); - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); QCOMPARE(m_items.count(), origItemCount); } @@ -766,7 +766,7 @@ QCOMPARE(m_dirLister.spyClear.count(), 1); QCOMPARE(m_dirLister.spyClearQUrl.count(), 0); - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); } void KDirListerTest::testDeleteListerEarly() @@ -821,7 +821,7 @@ QCOMPARE(m_items.count(), origItemCount); } QVERIFY(secondDirLister.isFinished()); - disconnect(&secondDirLister, 0, this, 0); + disconnect(&secondDirLister, nullptr, this, nullptr); } void KDirListerTest::testOpenUrlTwiceWithKeep() @@ -859,7 +859,7 @@ QCOMPARE(secondDirLister.spyClearQUrl.count(), 1); QCOMPARE(m_items.count(), 0); QVERIFY(secondDirLister.isFinished()); - disconnect(&secondDirLister, 0, this, 0); + disconnect(&secondDirLister, nullptr, this, nullptr); QDir().remove(path); } @@ -882,7 +882,7 @@ QCOMPARE(m_dirLister.spyClearQUrl.count(), 0); QCOMPARE(m_items.count(), 0); // we had time to stop before the job even started QVERIFY(m_dirLister.isFinished()); - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); } // A bug in the decAutoUpdate/incAutoUpdate logic made KDirLister stop watching a directory for changes, @@ -974,7 +974,7 @@ // Check that the URL of the root item got updated QCOMPARE(secondDirLister.rootItem().url().toLocalFile(), newPath); - disconnect(&secondDirLister, 0, this, 0); + disconnect(&secondDirLister, nullptr, this, nullptr); QDir().rmdir(newPath); } @@ -1009,7 +1009,7 @@ connect(&m_dirLister, SIGNAL(redirection(QUrl)), this, SLOT(exitLoop())); //Enter loop to get the redirection signal. enterLoop(); - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); QDir().rmdir(newPath); } @@ -1054,7 +1054,7 @@ m_dirLister.stop(url); QVERIFY(!m_dirLister.isFinished()); - disconnect(&m_dirLister, 0, this, 0); + disconnect(&m_dirLister, nullptr, this, nullptr); } void KDirListerTest::testListEmptyDirFromCache() // #278431 @@ -1275,7 +1275,7 @@ // Move b into a KIO::Job *moveJob = KIO::move(QUrl::fromLocalFile(dirB), QUrl::fromLocalFile(dirA)); - moveJob->setUiDelegate(0); + moveJob->setUiDelegate(nullptr); QVERIFY(moveJob->exec()); QVERIFY(QFileInfo(m_tempDir.path() + "/a/b").isDir()); @@ -1285,7 +1285,7 @@ // Copy folder a elsewhere const QString dest = m_tempDir.path() + "/subdir"; KIO::Job *copyJob = KIO::copy(QUrl::fromLocalFile(dirA), QUrl::fromLocalFile(dest)); - copyJob->setUiDelegate(0); + copyJob->setUiDelegate(nullptr); QVERIFY(copyJob->exec()); QVERIFY(QFileInfo(m_tempDir.path() + "/subdir/a/b").isDir()); } Index: autotests/kdirmodeltest.cpp =================================================================== --- autotests/kdirmodeltest.cpp +++ autotests/kdirmodeltest.cpp @@ -62,10 +62,10 @@ qRegisterMetaType("KFileItemList"); - m_dirModelForExpand = 0; - m_dirModel = 0; + m_dirModelForExpand = nullptr; + m_dirModel = nullptr; s_referenceTimeStamp = QDateTime::currentDateTime().addSecs(-30); // 30 seconds ago - m_tempDir = 0; + m_tempDir = nullptr; m_topLevelFileNames << QStringLiteral("toplevelfile_1") << QStringLiteral("toplevelfile_2") << QStringLiteral("toplevelfile_3") @@ -117,9 +117,9 @@ void KDirModelTest::cleanupTestCase() { delete m_tempDir; - m_tempDir = 0; + m_tempDir = nullptr; delete m_dirModel; - m_dirModel = 0; + m_dirModel = nullptr; } void KDirModelTest::fillModel(bool reload, bool expectAllIndexes) @@ -127,7 +127,7 @@ if (!m_dirModel) { m_dirModel = new KDirModel; } - m_dirModel->dirLister()->setAutoErrorHandlingEnabled(false, 0); + m_dirModel->dirLister()->setAutoErrorHandlingEnabled(false, nullptr); const QString path = m_tempDir->path() + '/'; KDirLister *dirLister = m_dirModel->dirLister(); qDebug() << "Calling openUrl"; @@ -146,8 +146,8 @@ void KDirModelTest::cleanup() { if (m_dirModel) { - disconnect(m_dirModel, 0, &m_eventLoop, 0); - disconnect(m_dirModel->dirLister(), 0, this, 0); + disconnect(m_dirModel, nullptr, &m_eventLoop, nullptr); + disconnect(m_dirModel->dirLister(), nullptr, this, nullptr); m_dirModel->dirLister()->setNameFilter(QString()); m_dirModel->dirLister()->setMimeFilter(QStringList()); m_dirModel->dirLister()->emitChanges(); @@ -513,8 +513,8 @@ // Move qDebug() << "Moving" << srcdir << "to" << dest; KIO::CopyJob *job = KIO::move(QUrl::fromLocalFile(srcdir), QUrl::fromLocalFile(dest), KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); QVERIFY(job->exec()); // wait for kdirnotify @@ -532,8 +532,8 @@ // Move back qDebug() << "Moving" << dest + dir << "back to" << srcdir; job = KIO::move(QUrl::fromLocalFile(dest + dir), QUrl::fromLocalFile(srcdir), KIO::HideProgressInfo); - job->setUiDelegate(0); - job->setUiDelegateExtension(0); + job->setUiDelegate(nullptr); + job->setUiDelegateExtension(nullptr); QVERIFY(job->exec()); enterLoop(); @@ -620,7 +620,7 @@ // QCOMPARE(dirListerForExpand->url().toLocalFile(), path+"subdir"); delete m_dirModelForExpand; - m_dirModelForExpand = 0; + m_dirModelForExpand = nullptr; } void KDirModelTest::testRenameDirectoryInCache() // #188807 @@ -632,7 +632,7 @@ // No more dirmodel nor dirlister. delete m_dirModel; - m_dirModel = 0; + m_dirModel = nullptr; // Now let's rename a directory that is in KCoreDirListerCache const QUrl url = QUrl::fromLocalFile(path); @@ -673,7 +673,7 @@ QVERIFY(newPerm != origPerm); KFileItemList items; items << rootItem; KIO::Job *job = KIO::chmod(items, newPerm, S_IWGRP /*TODO: QFile::WriteGroup*/, QString(), QString(), false, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QVERIFY(job->exec()); // ChmodJob doesn't talk to KDirNotify, kpropertiesdialog does. // [this allows to group notifications after all the changes one can make in the dialog] @@ -1287,7 +1287,7 @@ QSignalSpy spyDataChanged(m_dirModel, SIGNAL(dataChanged(QModelIndex,QModelIndex))); KIO::Job *job = KIO::move(QUrl::fromLocalFile(dir), QUrl::fromLocalFile(file), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); PredefinedAnswerJobUiDelegate extension; extension.m_renameResult = KIO::R_OVERWRITE; job->setUiDelegateExtension(&extension); Index: autotests/kfilecopytomenutest.cpp =================================================================== --- autotests/kfilecopytomenutest.cpp +++ autotests/kfilecopytomenutest.cpp @@ -52,7 +52,7 @@ m_srcFile = m_srcDir + "/srcfile"; - KIO::setDefaultJobUiDelegateExtension(0); // no "skip" dialogs + KIO::setDefaultJobUiDelegateExtension(nullptr); // no "skip" dialogs // Set a recent dir KConfigGroup recentDirsGroup(KSharedConfig::openConfig(), "kuick-copy"); Index: autotests/kfilewidgettest.cpp =================================================================== --- autotests/kfilewidgettest.cpp +++ autotests/kfilewidgettest.cpp @@ -58,7 +58,7 @@ return label->buddy(); } Q_ASSERT(false); - return 0; + return nullptr; } void testFocusOnLocationEdit() Index: autotests/klocalsockettest.cpp =================================================================== --- autotests/klocalsockettest.cpp +++ autotests/klocalsockettest.cpp @@ -31,7 +31,7 @@ tst_KLocalSocket::tst_KLocalSocket() { - server = 0; + server = nullptr; QFile::remove(QFile::decodeName(socketpath)); } @@ -112,7 +112,7 @@ // start thread: TimedTest thr(socket2); - socket2->setParent(0); + socket2->setParent(nullptr); socket2->moveToThread(&thr); thr.start(); Index: autotests/knewfilemenutest.cpp =================================================================== --- autotests/knewfilemenutest.cpp +++ autotests/knewfilemenutest.cpp @@ -125,7 +125,7 @@ menu.checkUpToDate(); QAction *action = coll.action(QStringLiteral("the_action")); QVERIFY(action); - QAction *textAct = 0; + QAction *textAct = nullptr; Q_FOREACH (QAction *act, action->menu()->actions()) { if (act->text().contains(actionText)) { textAct = act; Index: autotests/krununittest.cpp =================================================================== --- autotests/krununittest.cpp +++ autotests/krununittest.cpp @@ -237,7 +237,7 @@ { public: KRunImpl(const QUrl &url) - : KRun(url, 0, false), m_errCode(-1) {} + : KRun(url, nullptr, false), m_errCode(-1) {} void foundMimeType(const QString &type) Q_DECL_OVERRIDE { m_mimeType = type; @@ -356,8 +356,8 @@ // When calling KRun::runService or KRun::runApplication qint64 pid = useRunApplication - ? KRun::runApplication(service, urls, 0, tempFile ? KRun::RunFlags(KRun::DeleteTemporaryFiles) : KRun::RunFlags()) - : KRun::runService(service, urls, 0, tempFile); + ? KRun::runApplication(service, urls, nullptr, tempFile ? KRun::RunFlags(KRun::DeleteTemporaryFiles) : KRun::RunFlags()) + : KRun::runService(service, urls, nullptr, tempFile); // Then the service should be executed (which copies the source file to "dest") QVERIFY(pid != 0); Index: autotests/ktcpsockettest.cpp =================================================================== --- autotests/ktcpsockettest.cpp +++ autotests/ktcpsockettest.cpp @@ -43,7 +43,7 @@ public: Server *volatile server; ServerThread() - : server(0) {} + : server(nullptr) {} ~ServerThread() { wait(100); @@ -54,7 +54,7 @@ KTcpSocketTest::KTcpSocketTest() { - server = 0; + server = nullptr; } KTcpSocketTest::~KTcpSocketTest() @@ -75,8 +75,8 @@ } Server::Server(quint16 _port) - : listener(0), - socket(0), + : listener(nullptr), + socket(nullptr), port(_port) { listener = new QTcpServer(); @@ -88,7 +88,7 @@ Q_ASSERT(socket); socket->close(); socket->deleteLater(); - socket = 0; + socket = nullptr; } void KTcpSocketTest::initTestCase() @@ -126,7 +126,7 @@ void Server::connectDisconnect() { - listener->waitForNewConnection(10000, 0); + listener->waitForNewConnection(10000, nullptr); socket = listener->nextPendingConnection(); cleanupSocket(); @@ -149,7 +149,7 @@ void Server::read() { - listener->waitForNewConnection(10000, 0); + listener->waitForNewConnection(10000, nullptr); socket = listener->nextPendingConnection(); socket->write(TESTDATA); @@ -183,7 +183,7 @@ void Server::write() { - listener->waitForNewConnection(10000, 0); + listener->waitForNewConnection(10000, nullptr); socket = listener->nextPendingConnection(); socket->waitForReadyRead(40); @@ -372,7 +372,7 @@ void Server::states() { - listener->waitForNewConnection(10000, 0); + listener->waitForNewConnection(10000, nullptr); socket = listener->nextPendingConnection(); socket->waitForReadyRead(40); @@ -389,7 +389,7 @@ void Server::errors() { - listener->waitForNewConnection(10000, 0); + listener->waitForNewConnection(10000, nullptr); socket = listener->nextPendingConnection(); cleanupSocket(); Index: autotests/kurifiltersearchprovideractionstest.cpp =================================================================== --- autotests/kurifiltersearchprovideractionstest.cpp +++ autotests/kurifiltersearchprovideractionstest.cpp @@ -40,7 +40,7 @@ void KUriFilterSearchProviderActionsTest::shouldAddActionToMenu() { KIO::KUriFilterSearchProviderActions shortcutManager; - QMenu *menu = new QMenu(0); + QMenu *menu = new QMenu(nullptr); shortcutManager.addWebShortcutsToMenu(menu); //Empty when we don't have selected text QVERIFY(menu->actions().isEmpty()); Index: autotests/kurifiltertest.cpp =================================================================== --- autotests/kurifiltertest.cpp +++ autotests/kurifiltertest.cpp @@ -50,7 +50,7 @@ QTest::newRow(input) << input << expectedResult << expectedUriType << list << absPath << checkForExecutables; } -static void runFilterTest(const QString &a, const QString &expectedResult = 0, int expectedUriType = -1, const QStringList &list = QStringList(), const QString &absPath = 0, bool checkForExecutables = true) +static void runFilterTest(const QString &a, const QString &expectedResult = nullptr, int expectedUriType = -1, const QStringList &list = QStringList(), const QString &absPath = nullptr, bool checkForExecutables = true) { KUriFilterData *filterData = new KUriFilterData; filterData->setData(a); @@ -238,8 +238,8 @@ addRow("~/.bashrc", QDir::homePath() + QStringLiteral("/.bashrc"), KUriFilterData::LocalFile, QStringList(QStringLiteral("kshorturifilter"))); } addRow("~", QDir::homePath().toLocal8Bit(), KUriFilterData::LocalDir, QStringList(QStringLiteral("kshorturifilter")), QStringLiteral("/tmp")); - addRow("~bin", 0, KUriFilterData::LocalDir, QStringList(QStringLiteral("kshorturifilter"))); - addRow("~does_not_exist", 0, KUriFilterData::Error, QStringList(QStringLiteral("kshorturifilter"))); + addRow("~bin", nullptr, KUriFilterData::LocalDir, QStringList(QStringLiteral("kshorturifilter"))); + addRow("~does_not_exist", nullptr, KUriFilterData::Error, QStringList(QStringLiteral("kshorturifilter"))); // Absolute Path tests for kshorturifilter const QStringList kshorturifilter(QStringLiteral("kshorturifilter")); @@ -357,8 +357,8 @@ addRow("kbuildsycoca5", QStringLiteral("kbuildsycoca5"), KUriFilterData::Executable, minicliFilters); addRow("KDE", QStringLiteral("KDE"), NO_FILTERING, minicliFilters); addRow("I/dont/exist", QStringLiteral("I/dont/exist"), NO_FILTERING, minicliFilters); //krazy:exclude=spelling - addRow("/I/dont/exist", 0, KUriFilterData::Error, minicliFilters); //krazy:exclude=spelling - addRow("/I/dont/exist#a", 0, KUriFilterData::Error, minicliFilters); //krazy:exclude=spelling + addRow("/I/dont/exist", nullptr, KUriFilterData::Error, minicliFilters); //krazy:exclude=spelling + addRow("/I/dont/exist#a", nullptr, KUriFilterData::Error, minicliFilters); //krazy:exclude=spelling addRow("kbuildsycoca5 --help", QStringLiteral("kbuildsycoca5 --help"), KUriFilterData::Executable, minicliFilters); // the args are in argsAndOptions() addRow("/bin/sh", QStringLiteral("/bin/sh"), KUriFilterData::Executable, minicliFilters); addRow("/bin/sh -q -option arg1", QStringLiteral("/bin/sh -q -option arg1"), KUriFilterData::Executable, minicliFilters); // the args are in argsAndOptions() @@ -367,7 +367,7 @@ // a search using the default search engine // 'ls' is a bit of a special case though, due to the toplevel domain called 'ls' addRow("cp", QStringLiteral("https://www.google.com/search?q=cp&ie=UTF-8"), KUriFilterData::NetProtocol, - QStringList(), 0, false /* don't check for executables, see konq_misc.cc */); + QStringList(), nullptr, false /* don't check for executables, see konq_misc.cc */); } void KUriFilterTest::executables() @@ -382,7 +382,7 @@ qputenv("SOMEVAR", "/somevar"); qputenv("ETC", "/etc"); - addRow("$SOMEVAR/kdelibs/kio", 0, KUriFilterData::Error); // note: this dir doesn't exist... + addRow("$SOMEVAR/kdelibs/kio", nullptr, KUriFilterData::Error); // note: this dir doesn't exist... addRow("$ETC/passwd", QStringLiteral("/etc/passwd"), KUriFilterData::LocalFile); QString qtdocPath = qtdir + QStringLiteral("/doc/html/functions.html"); if (QFile::exists(qtdocPath)) { @@ -412,7 +412,7 @@ QDir().mkpath(datahome + QStringLiteral("/Dir[Bracket")); addRow("$DATAHOME/Dir[Bracket", datahome + QStringLiteral("/Dir[Bracket"), KUriFilterData::LocalDir); - addRow("$HOME/$KDEDIR/kdebase/kcontrol/ebrowsing", 0, KUriFilterData::Error); + addRow("$HOME/$KDEDIR/kdebase/kcontrol/ebrowsing", nullptr, KUriFilterData::Error); addRow("$1/$2/$3", QStringLiteral("https://www.google.com/search?q=%241%2F%242%2F%243&ie=UTF-8"), KUriFilterData::NetProtocol); // can be used as bogus or valid test. Currently triggers default search, i.e. google addRow("$$$$", QStringLiteral("https://www.google.com/search?q=%24%24%24%24&ie=UTF-8"), KUriFilterData::NetProtocol); // worst case scenarios. @@ -436,7 +436,7 @@ addRow(sc.sprintf("gg%cC++", s_delimiter).toUtf8(), QStringLiteral("https://www.google.com/search?q=C%2B%2B&ie=UTF-8"), KUriFilterData::NetProtocol); addRow(sc.sprintf("gg%cC#", s_delimiter).toUtf8(), QStringLiteral("https://www.google.com/search?q=C%23&ie=UTF-8"), KUriFilterData::NetProtocol); - addRow(sc.sprintf("ya%cfoo bar was here", s_delimiter).toUtf8(), 0, -1); // this triggers default search, i.e. google + addRow(sc.sprintf("ya%cfoo bar was here", s_delimiter).toUtf8(), nullptr, -1); // this triggers default search, i.e. google addRow(sc.sprintf("gg%cwww.kde.org", s_delimiter).toUtf8(), QStringLiteral("https://www.google.com/search?q=www.kde.org&ie=UTF-8"), KUriFilterData::NetProtocol); addRow(QStringLiteral("gg%1é").arg(s_delimiter).toUtf8() /*eaccent in utf8*/, QStringLiteral("https://www.google.com/search?q=%C3%A9&ie=UTF-8"), KUriFilterData::NetProtocol); addRow(QStringLiteral("gg%1прйвет").arg(s_delimiter).toUtf8() /* greetings in russian utf-8*/, QStringLiteral("https://www.google.com/search?q=%D0%BF%D1%80%D0%B9%D0%B2%D0%B5%D1%82&ie=UTF-8"), KUriFilterData::NetProtocol); @@ -452,7 +452,7 @@ const QString host = QHostInfo::localHostName(); if (host.isEmpty()) { const QString expected = QLatin1String("http://") + host; - runFilterTest(host, expected, KUriFilterData::NetProtocol, QStringList() << QStringLiteral("localdomainurifilter"), 0, false); + runFilterTest(host, expected, KUriFilterData::NetProtocol, QStringList() << QStringLiteral("localdomainurifilter"), nullptr, false); } } Index: autotests/kurlcompletiontest.cpp =================================================================== --- autotests/kurlcompletiontest.cpp +++ autotests/kurlcompletiontest.cpp @@ -103,11 +103,11 @@ void KUrlCompletionTest::teardown() { delete m_completion; - m_completion = 0; + m_completion = nullptr; delete m_tempDir; - m_tempDir = 0; + m_tempDir = nullptr; delete m_completionEmptyCwd; - m_completionEmptyCwd = 0; + m_completionEmptyCwd = nullptr; } void KUrlCompletionTest::waitForCompletion(KUrlCompletion *completion) @@ -117,7 +117,7 @@ QTest::qWait(5); } // The thread emitted a signal, process it. - qApp->sendPostedEvents(0, QEvent::MetaCall); + qApp->sendPostedEvents(nullptr, QEvent::MetaCall); } void KUrlCompletionTest::testLocalRelativePath() Index: autotests/kurlnavigatortest.cpp =================================================================== --- autotests/kurlnavigatortest.cpp +++ autotests/kurlnavigatortest.cpp @@ -29,13 +29,13 @@ void KUrlNavigatorTest::initTestCase() { - m_navigator = new KUrlNavigator(0, QUrl(QStringLiteral("A")), 0); + m_navigator = new KUrlNavigator(nullptr, QUrl(QStringLiteral("A")), nullptr); } void KUrlNavigatorTest::cleanupTestCase() { delete m_navigator; - m_navigator = 0; + m_navigator = nullptr; } void KUrlNavigatorTest::testHistorySizeAndIndex() @@ -257,7 +257,7 @@ void KUrlNavigatorTest::testInitWithRedundantPathSeparators() { - KUrlNavigator temp_nav(0, QUrl::fromLocalFile(QStringLiteral("/home/foo///test")), 0); + KUrlNavigator temp_nav(nullptr, QUrl::fromLocalFile(QStringLiteral("/home/foo///test")), nullptr); const QUrl buttonUrl = temp_nav.url(3); Index: autotests/listdirtest.cpp =================================================================== --- autotests/listdirtest.cpp +++ autotests/listdirtest.cpp @@ -53,7 +53,7 @@ /*QBENCHMARK*/ { m_receivedEntryCount = -2; // We start at -2 for . and .. slotResult will just increment this value KIO::ListJob *job = KIO::listDir(QUrl::fromLocalFile(tempDir.path()), KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), this, SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList))); QSignalSpy spy(job, SIGNAL(result(KJob*))); Index: autotests/mkpathjobtest.cpp =================================================================== --- autotests/mkpathjobtest.cpp +++ autotests/mkpathjobtest.cpp @@ -50,7 +50,7 @@ QVERIFY(QFile::exists(m_dir)); const QStringList oldEntries = QDir(m_dir).entryList(); KIO::Job *job = KIO::mkpath(QUrl::fromLocalFile(m_dir)); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy spy(job, SIGNAL(directoryCreated(QUrl))); QVERIFY2(job->exec(), qPrintable(job->errorString())); QVERIFY(QFile::exists(m_dir)); @@ -63,7 +63,7 @@ QUrl url = QUrl::fromLocalFile(m_dir); url.setPath(url.path() + "/subdir1"); KIO::Job *job = KIO::mkpath(url); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy spy(job, SIGNAL(directoryCreated(QUrl))); QVERIFY2(job->exec(), qPrintable(job->errorString())); QCOMPARE(spy.count(), 1); @@ -75,7 +75,7 @@ QUrl url = QUrl::fromLocalFile(m_dir); url.setPath(url.path() + "/subdir2/subsubdir"); KIO::Job *job = KIO::mkpath(url); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy spy(job, SIGNAL(directoryCreated(QUrl))); QVERIFY2(job->exec(), qPrintable(job->errorString())); QCOMPARE(spy.count(), 2); @@ -87,7 +87,7 @@ const QStringList oldEntries = QDir(m_dir).entryList(); QUrl url = QUrl::fromLocalFile(m_dir); KIO::Job *job = KIO::mkpath(url, url); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy spy(job, SIGNAL(directoryCreated(QUrl))); QVERIFY2(job->exec(), qPrintable(job->errorString())); QCOMPARE(job->totalAmount(KJob::Directories), 0ULL); @@ -102,7 +102,7 @@ const QUrl baseUrl = url; url.setPath(url.path() + "/subdir3"); KIO::Job *job = KIO::mkpath(url, baseUrl); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy spy(job, SIGNAL(directoryCreated(QUrl))); QVERIFY2(job->exec(), qPrintable(job->errorString())); QCOMPARE(spy.count(), 1); @@ -116,7 +116,7 @@ const QUrl baseUrl = url; url.setPath(url.path() + "/subdir4/subsubdir"); KIO::Job *job = KIO::mkpath(url, baseUrl); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy spy(job, SIGNAL(directoryCreated(QUrl))); QVERIFY2(job->exec(), qPrintable(job->errorString())); QCOMPARE(spy.count(), 2); @@ -130,7 +130,7 @@ const QUrl baseUrl = url; url.setPath(url.path() + "/subdir5/subsubdir"); KIO::Job *job = KIO::mkpath(url, QUrl::fromLocalFile(QStringLiteral("/does/not/exist"))); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); QSignalSpy spy(job, SIGNAL(directoryCreated(QUrl))); QVERIFY2(job->exec(), qPrintable(job->errorString())); QCOMPARE(spy.count(), 2); Index: autotests/pastetest.cpp =================================================================== --- autotests/pastetest.cpp +++ autotests/pastetest.cpp @@ -203,7 +203,7 @@ KIO::Job *job = KIO::paste(&mimeData, QUrl::fromLocalFile(destDir), KIO::HideProgressInfo); QSignalSpy spy(job, SIGNAL(itemCreated(QUrl))); QVERIFY(spy.isValid()); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); const bool expectedSuccess = !expectedFileName.isEmpty(); QCOMPARE(job->exec(), expectedSuccess); if (expectedSuccess) { Index: autotests/threadtest.cpp =================================================================== --- autotests/threadtest.cpp +++ autotests/threadtest.cpp @@ -73,7 +73,7 @@ // copy the file with file_copy KIO::Job *job = KIO::file_copy(u, d, -1, KIO::HideProgressInfo); //qDebug() << job << u << d; - job->setUiDelegate(0); + job->setUiDelegate(nullptr); bool ret = job->exec(); //qDebug() << job << "done"; return ret; Index: src/core/authinfo.cpp =================================================================== --- src/core/authinfo.cpp +++ src/core/authinfo.cpp @@ -270,7 +270,7 @@ int index; }; -NetRC *NetRC::instance = 0L; +NetRC *NetRC::instance = nullptr; NetRC::NetRC() : d(new NetRCPrivate) @@ -280,7 +280,7 @@ NetRC::~NetRC() { delete instance; - instance = 0L; + instance = nullptr; delete d; } Index: src/core/chmodjob.cpp =================================================================== --- src/core/chmodjob.cpp +++ src/core/chmodjob.cpp @@ -98,6 +98,7 @@ ChmodJob::ChmodJob(ChmodJobPrivate &dd) : KIO::Job(dd) { + int i = 0; QMetaObject::invokeMethod(this, "_k_processList", Qt::QueuedConnection); } Index: src/core/connection.cpp =================================================================== --- src/core/connection.cpp +++ src/core/connection.cpp @@ -111,7 +111,7 @@ if (d->backend) { d->backend->disconnect(this); d->backend->deleteLater(); - d->backend = 0; + d->backend = nullptr; } d->outgoingTasks.clear(); d->incomingTasks.clear(); @@ -151,7 +151,7 @@ if (!d->backend->connectToRemote(address)) { //kWarning(7017) << "could not connect to" << address << "using scheme" << scheme ; delete d->backend; - d->backend = 0; + d->backend = nullptr; return; } Index: src/core/connection_p.h =================================================================== --- src/core/connection_p.h +++ src/core/connection_p.h @@ -37,7 +37,7 @@ { public: inline ConnectionPrivate() - : backend(0), q(0), suspended(false) + : backend(nullptr), q(nullptr), suspended(false) { } void dequeue(); @@ -70,7 +70,7 @@ * Creates a new connection. * @see connectToRemote, listenForRemote */ - explicit Connection(QObject *parent = 0); + explicit Connection(QObject *parent = nullptr); virtual ~Connection(); /** Index: src/core/connectionbackend.cpp =================================================================== --- src/core/connectionbackend.cpp +++ src/core/connectionbackend.cpp @@ -38,13 +38,13 @@ ConnectionBackend::ConnectionBackend(Mode m, QObject *parent) : QObject(parent), state(Idle), - socket(0), + socket(nullptr), len(-1), cmd(0), signalEmitted(false), mode(m) { - localServer = 0; + localServer = nullptr; } ConnectionBackend::~ConnectionBackend() @@ -155,7 +155,7 @@ if (!localServer->listen(sockname, KLocalSocket::UnixSocket)) { errorString = localServer->errorString(); delete localServer; - localServer = 0; + localServer = nullptr; return false; } @@ -166,7 +166,7 @@ if (!tcpServer->isListening()) { errorString = tcpServer->errorString(); delete tcpServer; - tcpServer = 0; + tcpServer = nullptr; return false; } @@ -252,7 +252,7 @@ } if (!newSocket) { - return 0; // there was no connection... + return nullptr; // there was no connection... } ConnectionBackend *result = new ConnectionBackend(Mode(mode)); @@ -292,13 +292,13 @@ while (*p == ' ') { p++; } - len = strtol(p, 0L, 16); + len = strtol(p, nullptr, 16); p = buffer + 7; while (*p == ' ') { p++; } - cmd = strtol(p, 0L, 16); + cmd = strtol(p, nullptr, 16); //qCDebug(KIO_CORE) << this << "Beginning of command" << hex << cmd << "of size" << len; } Index: src/core/connectionbackend_p.h =================================================================== --- src/core/connectionbackend_p.h +++ src/core/connectionbackend_p.h @@ -66,7 +66,7 @@ void newConnection(); public: - explicit ConnectionBackend(Mode m, QObject *parent = 0); + explicit ConnectionBackend(Mode m, QObject *parent = nullptr); ~ConnectionBackend(); void setSuspended(bool enable); Index: src/core/connectionserver.h =================================================================== --- src/core/connectionserver.h +++ src/core/connectionserver.h @@ -44,7 +44,7 @@ { Q_OBJECT public: - ConnectionServer(QObject *parent = 0); + ConnectionServer(QObject *parent = nullptr); ~ConnectionServer(); /** Index: src/core/connectionserver.cpp =================================================================== --- src/core/connectionserver.cpp +++ src/core/connectionserver.cpp @@ -28,7 +28,7 @@ { public: inline ConnectionServerPrivate() - : backend(0) + : backend(nullptr) { } ConnectionServer *q; @@ -55,7 +55,7 @@ #endif if (!d->backend->listenForRemote()) { delete d->backend; - d->backend = 0; + d->backend = nullptr; return; } @@ -79,18 +79,18 @@ void ConnectionServer::close() { delete d->backend; - d->backend = 0; + d->backend = nullptr; } Connection *ConnectionServer::nextPendingConnection() { if (!isListening()) { - return 0; + return nullptr; } ConnectionBackend *newBackend = d->backend->nextPendingConnection(); if (!newBackend) { - return 0; // no new backend... + return nullptr; // no new backend... } Connection *result = new Connection; Index: src/core/copyjob.cpp =================================================================== --- src/core/copyjob.cpp +++ src/core/copyjob.cpp @@ -154,7 +154,7 @@ , m_bOverwriteAllFiles(false) , m_bOverwriteAllDirs(false) , m_conflictError(0) - , m_reportTimer(0) + , m_reportTimer(nullptr) { } @@ -1545,20 +1545,20 @@ m_processedFiles++; //emit processedAmount( this, KJob::Files, m_processedFiles ); copyNextFile(); - return 0; + return nullptr; } else { qCDebug(KIO_COPYJOB_DEBUG) << "ERR_CANNOT_OPEN_FOR_WRITING"; q->setError(ERR_CANNOT_OPEN_FOR_WRITING); q->setErrorText(uDest.toLocalFile()); q->emitResult(); - return 0; + return nullptr; } } else { // Todo: not show "link" on remote dirs if the src urls are not from the same protocol+host+... q->setError(ERR_CANNOT_SYMLINK); q->setErrorText(uDest.toDisplayString()); q->emitResult(); - return 0; + return nullptr; } } } @@ -1613,7 +1613,7 @@ const JobFlags flags = bOverwrite ? Overwrite : DefaultFlags; m_bCurrentOperationIsLink = false; - KIO::Job *newjob = 0; + KIO::Job *newjob = nullptr; if (m_mode == CopyJob::Link) { // User requested that a symlink be made newjob = linkNextFile(uSource, uDest, flags); Index: src/core/dataprotocol.cpp =================================================================== --- src/core/dataprotocol.cpp +++ src/core/dataprotocol.cpp @@ -278,7 +278,7 @@ outData = QByteArray::fromBase64(url_data); } else { QTextCodec *codec = QTextCodec::codecForName(hdr.attributes[QStringLiteral("charset")].toLatin1()); - if (codec != 0) { + if (codec != nullptr) { outData = codec->toUnicode(url_data).toUtf8(); } else { outData = url_data; Index: src/core/deletejob.cpp =================================================================== --- src/core/deletejob.cpp +++ src/core/deletejob.cpp @@ -75,7 +75,7 @@ , m_totalFilesDirs(0) , m_srcList(src) , m_currentStat(m_srcList.begin()) - , m_reportTimer(0) + , m_reportTimer(nullptr) { } DeleteJobState state; @@ -292,7 +292,7 @@ // If local file, try do it directly if ((*it).isLocalFile() && QFile::remove((*it).toLocalFile())) { //kdDebug(7007) << "DeleteJob deleted" << (*it).toLocalFile(); - job = 0; + job = nullptr; m_processedFiles++; if (m_processedFiles % 300 == 1 || m_totalFilesDirs < 300) { // update progress info every 300 files m_currentURL = *it; @@ -361,7 +361,7 @@ //qDebug() << "KDirNotify'ing FilesRemoved" << m_srcList; org::kde::KDirNotify::emitFilesRemoved(m_srcList); } - if (m_reportTimer != 0) { + if (m_reportTimer != nullptr) { m_reportTimer->stop(); } q->emitResult(); Index: src/core/filecopyjob.cpp =================================================================== --- src/core/filecopyjob.cpp +++ src/core/filecopyjob.cpp @@ -39,8 +39,8 @@ public: FileCopyJobPrivate(const QUrl &src, const QUrl &dest, int permissions, bool move, JobFlags flags) - : m_sourceSize(filesize_t(-1)), m_src(src), m_dest(dest), m_moveJob(0), m_copyJob(0), m_delJob(0), - m_chmodJob(0), m_getJob(0), m_putJob(0), m_permissions(permissions), + : m_sourceSize(filesize_t(-1)), m_src(src), m_dest(dest), m_moveJob(nullptr), m_copyJob(nullptr), m_delJob(nullptr), + m_chmodJob(nullptr), m_getJob(nullptr), m_putJob(nullptr), m_permissions(permissions), m_move(move), m_mustChmod(0), m_flags(flags) { } @@ -330,7 +330,7 @@ m_canResume = false; m_resumeAnswerSent = false; - m_getJob = 0L; // for now + m_getJob = nullptr; // for now m_putJob = put(m_dest, m_permissions, (m_flags | HideProgressInfo) /* no GUI */); //qDebug() << "m_putJob=" << m_putJob << "m_dest=" << m_dest; if (m_modificationTime.isValid()) { @@ -372,11 +372,11 @@ if (job == m_putJob) { m_putJob->kill(FileCopyJob::Quietly); q->removeSubjob(m_putJob); - m_putJob = 0; + m_putJob = nullptr; } else { m_copyJob->kill(FileCopyJob::Quietly); q->removeSubjob(m_copyJob); - m_copyJob = 0; + m_copyJob = nullptr; } q->setError(ERR_USER_CANCELED); q->emitResult(); @@ -458,7 +458,7 @@ q->setErrorText(QStringLiteral("'Put' job did not send canResume or 'Get' job did not send data!")); m_putJob->kill(FileCopyJob::Quietly); q->removeSubjob(m_putJob); - m_putJob = 0; + m_putJob = nullptr; q->emitResult(); return; } @@ -484,21 +484,21 @@ // Did job have an error ? if (job->error()) { if ((job == d->m_moveJob) && (job->error() == ERR_UNSUPPORTED_ACTION)) { - d->m_moveJob = 0; + d->m_moveJob = nullptr; d->startBestCopyMethod(); return; } else if ((job == d->m_copyJob) && (job->error() == ERR_UNSUPPORTED_ACTION)) { - d->m_copyJob = 0; + d->m_copyJob = nullptr; d->startDataPump(); return; } else if (job == d->m_getJob) { - d->m_getJob = 0L; + d->m_getJob = nullptr; if (d->m_putJob) { d->m_putJob->kill(Quietly); removeSubjob(d->m_putJob); } } else if (job == d->m_putJob) { - d->m_putJob = 0L; + d->m_putJob = nullptr; if (d->m_getJob) { d->m_getJob->kill(Quietly); removeSubjob(d->m_getJob); @@ -520,11 +520,11 @@ } if (job == d->m_moveJob) { - d->m_moveJob = 0; // Finished + d->m_moveJob = nullptr; // Finished } if (job == d->m_copyJob) { - d->m_copyJob = 0; + d->m_copyJob = nullptr; if (d->m_move) { d->m_delJob = file_delete(d->m_src, HideProgressInfo/*no GUI*/); // Delete source addSubjob(d->m_delJob); @@ -533,7 +533,7 @@ if (job == d->m_getJob) { //qDebug() << "m_getJob finished"; - d->m_getJob = 0; // No action required + d->m_getJob = nullptr; // No action required if (d->m_putJob) { d->m_putJob->d_func()->internalResume(); } @@ -541,7 +541,7 @@ if (job == d->m_putJob) { //qDebug() << "m_putJob finished"; - d->m_putJob = 0; + d->m_putJob = nullptr; if (d->m_getJob) { // The get job is still running, probably after emitting data(QByteArray()) // and before we receive its finished(). @@ -554,11 +554,11 @@ } if (job == d->m_delJob) { - d->m_delJob = 0; // Finished + d->m_delJob = nullptr; // Finished } if (job == d->m_chmodJob) { - d->m_chmodJob = 0; // Finished + d->m_chmodJob = nullptr; // Finished } if (!hasSubjobs()) { Index: src/core/forwardingslavebase.cpp =================================================================== --- src/core/forwardingslavebase.cpp +++ src/core/forwardingslavebase.cpp @@ -356,7 +356,7 @@ { // We will forward the warning message, no need to let the job // display it itself - job->setUiDelegate(0); + job->setUiDelegate(nullptr); // Forward metadata (e.g. modification time for put()) job->setMetaData(q->allMetaData()); @@ -418,7 +418,7 @@ q->error(job->error(), job->errorText()); } else { KIO::StatJob *stat_job = qobject_cast(job); - if (stat_job != 0L) { + if (stat_job != nullptr) { KIO::UDSEntry entry = stat_job->statResult(); q->prepareUDSEntry(entry); q->statEntry(entry); Index: src/core/hostinfo.cpp =================================================================== --- src/core/hostinfo.cpp +++ src/core/hostinfo.cpp @@ -205,7 +205,7 @@ { Q_OBJECT public: - NameLookUpThread() : m_worker(0) + NameLookUpThread() : m_worker(nullptr) { qRegisterMetaType< QSharedPointer > (); start(); @@ -300,7 +300,7 @@ void HostInfo::prefetchHost(const QString &hostName) { - hostInfoAgentPrivate()->lookupHost(hostName, 0, 0); + hostInfoAgentPrivate()->lookupHost(hostName, nullptr, nullptr); } void HostInfo::setCacheSize(int s) Index: src/core/job.h =================================================================== --- src/core/job.h +++ src/core/job.h @@ -47,7 +47,7 @@ * @return the created error string */ KIOCORE_EXPORT QString buildHTMLErrorString(int errorCode, const QString &errorText, - const QUrl *reqUrl = 0, int method = -1); + const QUrl *reqUrl = nullptr, int method = -1); /** * Returns translated error details for @p errorCode using the @@ -66,7 +66,7 @@ * @li QStringList solutions - a liso of solutions for the error */ KIOCORE_EXPORT QByteArray rawErrorDetail(int errorCode, const QString &errorText, - const QUrl *reqUrl = 0, int method = -1); + const QUrl *reqUrl = nullptr, int method = -1); } // kio/job.h is what apps include to get all jobs -> we include jobclasses.h to preserve SC Index: src/core/job.cpp =================================================================== --- src/core/job.cpp +++ src/core/job.cpp @@ -36,14 +36,14 @@ using namespace KIO; -Job::Job() : KCompositeJob(0) +Job::Job() : KCompositeJob(nullptr) , d_ptr(new JobPrivate) { d_ptr->q_ptr = this; setCapabilities(KJob::Killable | KJob::Suspendable); } -Job::Job(JobPrivate &dd) : KCompositeJob(0) +Job::Job(JobPrivate &dd) : KCompositeJob(nullptr) , d_ptr(&dd) { d_ptr->q_ptr = this; @@ -200,7 +200,7 @@ void Job::setParentJob(Job *job) { Q_D(Job); - Q_ASSERT(d->m_parentJob == 0L); + Q_ASSERT(d->m_parentJob == nullptr); Q_ASSERT(job); d->m_parentJob = job; } Index: src/core/job_base.h =================================================================== --- src/core/job_base.h +++ src/core/job_base.h @@ -132,7 +132,7 @@ * @return the following strings: caption, error + description, * causes+solutions */ - QStringList detailedErrorStrings(const QUrl *reqUrl = 0L, + QStringList detailedErrorStrings(const QUrl *reqUrl = nullptr, int method = -1) const; /** Index: src/core/job_error.cpp =================================================================== --- src/core/job_error.cpp +++ src/core/job_error.cpp @@ -1082,7 +1082,7 @@ QFile::Permissions KIO::convertPermissions(int permissions) { - QFile::Permissions qPermissions(0); + QFile::Permissions qPermissions(nullptr); if (permissions > 0) { if (permissions & S_IRUSR) { Index: src/core/job_p.h =================================================================== --- src/core/job_p.h +++ src/core/job_p.h @@ -46,7 +46,7 @@ { public: JobPrivate() - : m_parentJob(0L), m_extraFlags(0), + : m_parentJob(nullptr), m_extraFlags(0), m_uiDelegateExtension(KIO::defaultJobUiDelegateExtension()) { } @@ -98,7 +98,7 @@ * @param packedArgs the arguments */ SimpleJobPrivate(const QUrl &url, int command, const QByteArray &packedArgs) - : m_slave(0), m_packedArgs(packedArgs), m_url(url), m_command(command), + : m_slave(nullptr), m_packedArgs(packedArgs), m_url(url), m_command(command), m_checkOnHold(false), m_schedSerial(0), m_redirectionHandlingEnabled(true) { #if 0 @@ -235,14 +235,14 @@ const QByteArray &_staticData) : SimpleJobPrivate(url, command, packedArgs), m_internalSuspended(false), m_errorPage(false), - staticData(_staticData), m_isMimetypeEmitted(false), m_subJob(0) + staticData(_staticData), m_isMimetypeEmitted(false), m_subJob(nullptr) { } inline TransferJobPrivate(const QUrl &url, int command, const QByteArray &packedArgs, QIODevice *ioDevice) : SimpleJobPrivate(url, command, packedArgs), m_internalSuspended(false), m_errorPage(false), - m_isMimetypeEmitted(false), m_subJob(0), + m_isMimetypeEmitted(false), m_subJob(nullptr), m_outgoingDataSource(QPointer(ioDevice)) { } Index: src/core/jobtracker.cpp =================================================================== --- src/core/jobtracker.cpp +++ src/core/jobtracker.cpp @@ -19,7 +19,7 @@ #include "jobtracker.h" #include -static KJobTrackerInterface *s_tracker = 0; +static KJobTrackerInterface *s_tracker = nullptr; Q_GLOBAL_STATIC(KJobTrackerInterface, globalDummyTracker) KJobTrackerInterface *KIO::getJobTracker() Index: src/core/jobuidelegateextension.cpp =================================================================== --- src/core/jobuidelegateextension.cpp +++ src/core/jobuidelegateextension.cpp @@ -22,7 +22,7 @@ using namespace KIO; JobUiDelegateExtension::JobUiDelegateExtension() - : d(0) + : d(nullptr) { } @@ -32,14 +32,14 @@ ClipboardUpdater *KIO::JobUiDelegateExtension::createClipboardUpdater(Job *, ClipboardUpdaterMode) { - return NULL; + return nullptr; } void KIO::JobUiDelegateExtension::updateUrlInClipboard(const QUrl &, const QUrl &) { } -static JobUiDelegateExtension *s_extension = 0; +static JobUiDelegateExtension *s_extension = nullptr; JobUiDelegateExtension *KIO::defaultJobUiDelegateExtension() { Index: src/core/jobuidelegatefactory.cpp =================================================================== --- src/core/jobuidelegatefactory.cpp +++ src/core/jobuidelegatefactory.cpp @@ -22,7 +22,7 @@ using namespace KIO; JobUiDelegateFactory::JobUiDelegateFactory() - : d(0) + : d(nullptr) { } @@ -30,11 +30,11 @@ { } -static JobUiDelegateFactory *s_factory = 0; +static JobUiDelegateFactory *s_factory = nullptr; KJobUiDelegate *KIO::createDefaultJobUiDelegate() { - return s_factory ? s_factory->createDelegate() : NULL; + return s_factory ? s_factory->createDelegate() : nullptr; } JobUiDelegateFactory *KIO::defaultJobUiDelegateFactory() Index: src/core/kacl.cpp =================================================================== --- src/core/kacl.cpp +++ src/core/kacl.cpp @@ -41,7 +41,7 @@ class KACL::KACLPrivate { public: - KACLPrivate() : m_acl(0) {} + KACLPrivate() : m_acl(nullptr) {} #if HAVE_POSIX_ACL KACLPrivate(acl_t acl) : m_acl(acl) {} @@ -139,7 +139,7 @@ bool KACL::isExtended() const { #if HAVE_POSIX_ACL - return (acl_equiv_mode(d->m_acl, NULL) != 0); + return (acl_equiv_mode(d->m_acl, nullptr) != 0); #else return false; #endif @@ -158,12 +158,12 @@ } ret = acl_get_entry(acl, ACL_NEXT_ENTRY, &entry); } - return 0; + return nullptr; } static unsigned short entryToPermissions(acl_entry_t entry) { - if (entry == 0) { + if (entry == nullptr) { return 0; } acl_permset_t permset; @@ -177,7 +177,7 @@ static void permissionsToEntry(acl_entry_t entry, unsigned short v) { - if (entry == 0) { + if (entry == nullptr) { return; } acl_permset_t permset; @@ -326,7 +326,7 @@ exists = true; #if HAVE_POSIX_ACL acl_entry_t entry = entryForTag(d->m_acl, ACL_MASK); - if (entry == 0) { + if (entry == nullptr) { exists = false; return 0; } @@ -340,7 +340,7 @@ bool KACL::KACLPrivate::setMaskPermissions(unsigned short v) { acl_entry_t entry = entryForTag(m_acl, ACL_MASK); - if (entry == 0) { + if (entry == nullptr) { acl_create_entry(&m_acl, &entry); acl_set_tag_type(entry, ACL_MASK); } @@ -433,7 +433,7 @@ // 23.1.1 of 1003.1e states that as soon as there is a named user or // named group entry, there needs to be a mask entry as well, so add // one, if the user hasn't explicitly set one. - if (entryForTag(newACL, ACL_MASK) == 0) { + if (entryForTag(newACL, ACL_MASK) == nullptr) { acl_calc_mask(&newACL); } } @@ -532,7 +532,7 @@ // 23.1.1 of 1003.1e states that as soon as there is a named user or // named group entry, there needs to be a mask entry as well, so add // one, if the user hasn't explicitly set one. - if (entryForTag(newACL, ACL_MASK) == 0) { + if (entryForTag(newACL, ACL_MASK) == nullptr) { acl_calc_mask(&newACL); } } Index: src/core/kcoredirlister.h =================================================================== --- src/core/kcoredirlister.h +++ src/core/kcoredirlister.h @@ -90,7 +90,7 @@ /** * Create a directory lister. */ - KCoreDirLister(QObject *parent = 0); + KCoreDirLister(QObject *parent = nullptr); /** * Destroy the directory lister. Index: src/core/kcoredirlister.cpp =================================================================== --- src/core/kcoredirlister.cpp +++ src/core/kcoredirlister.cpp @@ -185,7 +185,7 @@ dirData.listersCurrentlyListing.append(lister); - DirItem *itemFromCache = 0; + DirItem *itemFromCache = nullptr; if (itemU || (!_reload && (itemFromCache = itemsCached.take(urlStr)))) { if (itemU) { qCDebug(KIO_CORE_DIRLISTER) << "Entry already in use:" << _url; @@ -294,7 +294,7 @@ return job; } } - return 0; + return nullptr; } KCoreDirLister::Private::CachedItemsJob::CachedItemsJob(KCoreDirLister *lister, const QUrl &url, bool reload) @@ -329,7 +329,7 @@ emit m_lister->canceled(m_url); emit m_lister->canceled(); } - m_lister = 0; + m_lister = nullptr; return true; } @@ -639,7 +639,7 @@ } } else { delete item; - item = 0; + item = nullptr; } } @@ -660,7 +660,7 @@ const QUrl dir = _dir.adjusted(QUrl::StripTrailingSlash); if (!checkUpdate(dir)) { - if (dir.isLocalFile() && findByUrl(0, dir)) { + if (dir.isLocalFile() && findByUrl(nullptr, dir)) { pendingUpdates.insert(dir.toLocalFile()); if (!pendingUpdateTimer.isActive()) { pendingUpdateTimer.start(500); @@ -769,7 +769,7 @@ KFileItem KCoreDirListerCache::itemForUrl(const QUrl &url) const { - KFileItem *item = findByUrl(0, url); + KFileItem *item = findByUrl(nullptr, url); if (item) { return *item; } else { @@ -790,7 +790,7 @@ NonMovableFileItemList *KCoreDirListerCache::itemsForDir(const QUrl &dir) const { DirItem *item = dirItemForUrl(dir); - return item ? &item->lstItems : 0; + return item ? &item->lstItems : nullptr; } KFileItem KCoreDirListerCache::findByName(const KCoreDirLister *lister, const QString &_name) const @@ -841,7 +841,7 @@ } } - return 0; + return nullptr; } void KCoreDirListerCache::slotFilesAdded(const QString &dir /*url*/) // from KDirNotify signals @@ -926,7 +926,7 @@ QStringList::const_iterator it = fileList.begin(); for (; it != fileList.end(); ++it) { QUrl url(*it); - KFileItem *fileitem = findByUrl(0, url); + KFileItem *fileitem = findByUrl(nullptr, url); if (!fileitem) { qCDebug(KIO_CORE_DIRLISTER) << "item not found for" << url; continue; @@ -964,7 +964,7 @@ #endif QUrl oldurl = src.adjusted(QUrl::StripTrailingSlash); - KFileItem *fileitem = findByUrl(0, oldurl); + KFileItem *fileitem = findByUrl(nullptr, oldurl); if (!fileitem) { qCDebug(KIO_CORE_DIRLISTER) << "Item not found:" << oldurl; return; @@ -976,7 +976,7 @@ // We better emit it as deleted -before- doing the renaming, otherwise // the "update" mechanism will emit the old one as deleted and // kdirmodel will delete the new (renamed) one! - KFileItem *existingDestItem = findByUrl(0, dst); + KFileItem *existingDestItem = findByUrl(nullptr, dst); if (existingDestItem) { qCDebug(KIO_CORE_DIRLISTER) << dst << "already existed, let's delete it"; slotFilesRemoved(QList() << dst); @@ -993,7 +993,7 @@ renameDir(oldurl, dst); // #172945 - if the fileitem was the root item of a DirItem that was just removed from the cache, // then it's a dangling pointer now... - fileitem = findByUrl(0, oldurl); + fileitem = findByUrl(nullptr, oldurl); if (!fileitem) { //deleted from cache altogether, #188807 return; } @@ -1145,7 +1145,7 @@ void KCoreDirListerCache::handleFileDirty(const QUrl &url) { // A file: do we know about it already? - KFileItem *existingItem = findByUrl(0, url); + KFileItem *existingItem = findByUrl(nullptr, url); const QUrl dir = url.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); QString filePath = url.toLocalFile(); if (!existingItem) { @@ -1759,7 +1759,7 @@ return; } - DirItem *dir = itemsInUse.value(jobUrlStr, 0); + DirItem *dir = itemsInUse.value(jobUrlStr, nullptr); if (!dir) { qCWarning(KIO_CORE) << "Internal error: itemsInUse did not contain" << jobUrlStr; #ifndef NDEBUG @@ -1908,7 +1908,7 @@ } ++it; } - return 0; + return nullptr; } const QUrl &KCoreDirListerCache::joburl(KIO::ListJob *job) @@ -2038,7 +2038,7 @@ foreach (const QString &file, pendingUpdates) { // always a local path qCDebug(KIO_CORE_DIRLISTER) << file; QUrl u = QUrl::fromLocalFile(file); - KFileItem *item = findByUrl(0, u); // search all items + KFileItem *item = findByUrl(nullptr, u); // search all items if (item) { // we need to refresh the item, because e.g. the permissions can have changed. KFileItem oldItem = *item; @@ -2557,16 +2557,16 @@ void KCoreDirLister::Private::emitItems() { NewItemsHash *tmpNew = lstNewItems; - lstNewItems = 0; + lstNewItems = nullptr; KFileItemList *tmpMime = lstMimeFilteredItems; - lstMimeFilteredItems = 0; + lstMimeFilteredItems = nullptr; QList > *tmpRefresh = lstRefreshItems; - lstRefreshItems = 0; + lstRefreshItems = nullptr; KFileItemList *tmpRemove = lstRemoveItems; - lstRemoveItems = 0; + lstRemoveItems = nullptr; if (tmpNew) { QHashIterator it(*tmpNew); Index: src/core/kcoredirlister_p.h =================================================================== --- src/core/kcoredirlister_p.h +++ src/core/kcoredirlister_p.h @@ -112,10 +112,10 @@ rootFileItem = KFileItem(); - lstNewItems = 0; - lstRefreshItems = 0; - lstMimeFilteredItems = 0; - lstRemoveItems = 0; + lstNewItems = nullptr; + lstRefreshItems = nullptr; + lstMimeFilteredItems = nullptr; + lstRemoveItems = nullptr; hasPendingChanges = false; } @@ -315,7 +315,7 @@ void stopListJob(const QString &url, bool silent); - KIO::ListJob *jobForUrl(const QString &url, KIO::ListJob *not_job = 0); + KIO::ListJob *jobForUrl(const QString &url, KIO::ListJob *not_job = nullptr); const QUrl &joburl(KIO::ListJob *job); void killJob(KIO::ListJob *job); Index: src/core/kdirnotify.h =================================================================== --- src/core/kdirnotify.h +++ src/core/kdirnotify.h @@ -77,7 +77,7 @@ * \param connection Typically QDBusConnection::sessionBus(). * \param parent The parent QObject. */ - OrgKdeKDirNotifyInterface(const QString &service, const QString &path, const QDBusConnection &connection = QDBusConnection::sessionBus(), QObject *parent = 0); + OrgKdeKDirNotifyInterface(const QString &service, const QString &path, const QDBusConnection &connection = QDBusConnection::sessionBus(), QObject *parent = nullptr); /** * Destructor. Index: src/core/kfileitem.h =================================================================== --- src/core/kfileitem.h +++ src/core/kfileitem.h @@ -489,7 +489,7 @@ * The given boolean indicates if the returned url is local or not. * \since 4.6 */ - QUrl mostLocalUrl(bool *local = 0) const; + QUrl mostLocalUrl(bool *local = nullptr) const; /** * @deprecated since 5.0 add '&' in front of your boolean argument Index: src/core/kfileitem.cpp =================================================================== --- src/core/kfileitem.cpp +++ src/core/kfileitem.cpp @@ -450,7 +450,7 @@ /////// KFileItem::KFileItem() - : d(0) + : d(nullptr) { } @@ -1335,7 +1335,7 @@ } if (url.isEmpty()) { - a.d = 0; + a.d = nullptr; return s; } @@ -1494,7 +1494,7 @@ bool KFileItem::isNull() const { - return d == 0; + return d == nullptr; } KFileItemList::KFileItemList() Index: src/core/klocalsocket.h =================================================================== --- src/core/klocalsocket.h +++ src/core/klocalsocket.h @@ -69,7 +69,7 @@ * * @param parent the parent object */ - explicit KLocalSocket(QObject *parent = 0); + explicit KLocalSocket(QObject *parent = nullptr); /** * Destroys the KLocalSocket object and frees up any resources * associated. If the socket is open, it will be closed. @@ -183,7 +183,7 @@ * * @param parent the parent object */ - explicit KLocalSocketServer(QObject *parent = 0); + explicit KLocalSocketServer(QObject *parent = nullptr); /** * Destroys the KLocalSocketServer object and frees up any * resource associated. If the socket is still listening, it's @@ -286,7 +286,7 @@ * @returns true if a new connection has been accepted or false if * an error occurred or if the operation timed out. */ - bool waitForNewConnection(int msec = 0, bool *timedOut = 0); + bool waitForNewConnection(int msec = 0, bool *timedOut = nullptr); /** * Returns true if a new socket can be received with Index: src/core/klocalsocket.cpp =================================================================== --- src/core/klocalsocket.cpp +++ src/core/klocalsocket.cpp @@ -114,7 +114,7 @@ state(QAbstractSocket::UnconnectedState), error(QAbstractSocket::UnknownSocketError), type(KLocalSocket::UnknownLocalSocketType), - readNotifier(0) + readNotifier(nullptr) { } @@ -199,7 +199,7 @@ d->readNotifier->setEnabled((d->pendingConnections.size() - 1) < d->maxPendingConnections); return d->pendingConnections.dequeue(); } - return 0; + return nullptr; } void KLocalSocketServer::incomingConnection(int descriptor) Index: src/core/klocalsocket_unix.cpp =================================================================== --- src/core/klocalsocket_unix.cpp +++ src/core/klocalsocket_unix.cpp @@ -337,7 +337,7 @@ descriptor = -1; delete readNotifier; - readNotifier = 0; + readNotifier = nullptr; if (type == KLocalSocket::UnixSocket) { QFile::remove(localPath); @@ -361,7 +361,7 @@ FD_SET(descriptor, &readset); while (descriptor != -1) { - int code = ::select(descriptor + 1, &readset, 0, 0, &tv); + int code = ::select(descriptor + 1, &readset, nullptr, nullptr, &tv); if (code == -1 && errno == EINTR) { // interrupted continue; Index: src/core/kmountpoint.cpp =================================================================== --- src/core/kmountpoint.cpp +++ src/core/kmountpoint.cpp @@ -214,7 +214,7 @@ #if HAVE_SETMNTENT STRUCT_SETMNTENT fstab; - if ((fstab = SETMNTENT(FSTAB, "r")) == 0) { + if ((fstab = SETMNTENT(FSTAB, "r")) == nullptr) { return result; } @@ -416,7 +416,7 @@ #else STRUCT_SETMNTENT mnttab; - if ((mnttab = SETMNTENT(MNTTAB, "r")) == 0) { + if ((mnttab = SETMNTENT(MNTTAB, "r")) == nullptr) { return result; } Index: src/core/kprotocolmanager.cpp =================================================================== --- src/core/kprotocolmanager.cpp +++ src/core/kprotocolmanager.cpp @@ -76,7 +76,7 @@ */ static bool revmatch(const char *host, const char *nplist) { - if (host == 0) { + if (host == nullptr) { return false; } @@ -218,7 +218,7 @@ // If the hostname does not contain a dot, check if // is part of noProxy. - if (!isMatch && !host.isEmpty() && (strchr(host, '.') == NULL)) { + if (!isMatch && !host.isEmpty() && (strchr(host, '.') == nullptr)) { isMatch = revmatch("", no_proxy); } } Index: src/core/krecentdocument.cpp =================================================================== --- src/core/krecentdocument.cpp +++ src/core/krecentdocument.cpp @@ -123,7 +123,7 @@ if (tmp.desktopGroup().readPathEntry("URL", QString()) == url.toDisplayString() && tmp.desktopGroup().readEntry("X-KDE-LastOpenedWith") == desktopEntryName) { // Set access and modification time to current time - ::utime(QFile::encodeName(ddesktop).constData(), NULL); + ::utime(QFile::encodeName(ddesktop).constData(), nullptr); return; } // if not append a (num) to it Index: src/core/kremoteencoding.h =================================================================== --- src/core/kremoteencoding.h +++ src/core/kremoteencoding.h @@ -49,7 +49,7 @@ * Constructs this object to use the given encoding name. * If @p name is a null pointer, the standard encoding will be used. */ - explicit KRemoteEncoding(const char *name = 0); + explicit KRemoteEncoding(const char *name = nullptr); /** * Destructor Index: src/core/kremoteencoding.cpp =================================================================== --- src/core/kremoteencoding.cpp +++ src/core/kremoteencoding.cpp @@ -26,7 +26,7 @@ { public: KRemoteEncodingPrivate() - : m_codec(0) + : m_codec(nullptr) { } @@ -110,11 +110,11 @@ d->m_codec = QTextCodec::codecForName(name); } - if (d->m_codec == 0) { + if (d->m_codec == nullptr) { d->m_codec = QTextCodec::codecForMib(106); // fallback to UTF-8 } - if (d->m_codec == 0) { + if (d->m_codec == nullptr) { d->m_codec = QTextCodec::codecForMib(4 /* latin-1 */); } Index: src/core/ksambashare.cpp =================================================================== --- src/core/ksambashare.cpp +++ src/core/ksambashare.cpp @@ -431,7 +431,7 @@ } KSambaShare::KSambaShare() - : QObject(0) + : QObject(nullptr) , d_ptr(new KSambaSharePrivate(this)) { Q_D(const KSambaShare); Index: src/core/ksslcertificatemanager.cpp =================================================================== --- src/core/ksslcertificatemanager.cpp +++ src/core/ksslcertificatemanager.cpp @@ -209,7 +209,7 @@ KSslCertificateManagerPrivate::~KSslCertificateManagerPrivate() { delete iface; - iface = 0; + iface = nullptr; } void KSslCertificateManagerPrivate::loadDefaultCaCertificates() Index: src/core/kssld_interface.h =================================================================== --- src/core/kssld_interface.h +++ src/core/kssld_interface.h @@ -48,7 +48,7 @@ public: OrgKdeKSSLDInterface(const QString &service, const QString &path, const QDBusConnection &connection, - QObject *parent = 0) + QObject *parent = nullptr) : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) { registerMetaTypesForKSSLD(); Index: src/core/ktcpsocket.h =================================================================== --- src/core/ktcpsocket.h +++ src/core/ktcpsocket.h @@ -223,7 +223,7 @@ ManualProxy }; - KTcpSocket(QObject *parent = 0); + KTcpSocket(QObject *parent = nullptr); ~KTcpSocket(); //from QIODevice Index: src/core/scheduler.cpp =================================================================== --- src/core/scheduler.cpp +++ src/core/scheduler.cpp @@ -63,7 +63,7 @@ // here be uglies // forward declaration to break cross-dependency of SlaveKeeper and SchedulerPrivate static void setupSlave(KIO::Slave *slave, const QUrl &url, const QString &protocol, - const QStringList &proxyList, bool newSlave, const KIO::MetaData *config = 0); + const QStringList &proxyList, bool newSlave, const KIO::MetaData *config = nullptr); // same reason as above static Scheduler *scheduler(); static Slave *heldSlaveForJob(SimpleJob *job); @@ -109,7 +109,7 @@ it = m_idleSlaves.begin(); } if (it == m_idleSlaves.end()) { - return 0; + return nullptr; } slave = it.value(); m_idleSlaves.erase(it); @@ -258,7 +258,7 @@ const bool removedRunning = jobs.runningJob == job; const bool removedWaiting = jobs.waitingList.removeAll(job) != 0; if (removedRunning) { - jobs.runningJob = 0; + jobs.runningJob = nullptr; Q_ASSERT(!removedWaiting); } const bool removedTheJob = removedRunning || removedWaiting; @@ -314,7 +314,7 @@ if (it == m_connectedSlaves.end()) { return false; } - return it.value().runningJob == 0; + return it.value().runningJob == nullptr; } //private slot @@ -650,7 +650,7 @@ public: SchedulerPrivate() : q(new Scheduler()), - m_slaveOnHold(0), + m_slaveOnHold(nullptr), m_checkOnHold(true), // !! Always check with KLauncher for the first request m_ignoreConfigReparse(false) { @@ -659,7 +659,7 @@ ~SchedulerPrivate() { delete q; - q = 0; + q = nullptr; Q_FOREACH (ProtoQueue *p, m_protocols) { Q_FOREACH (Slave *slave, p->allSlaves()) { slave->kill(); @@ -696,7 +696,7 @@ MetaData metaDataFor(const QString &protocol, const QStringList &proxyList, const QUrl &url); void setupSlave(KIO::Slave *slave, const QUrl &url, const QString &protocol, - const QStringList &proxyList, bool newSlave, const KIO::MetaData *config = 0); + const QStringList &proxyList, bool newSlave, const KIO::MetaData *config = nullptr); void slotSlaveDied(KIO::Slave *slave); void slotSlaveStatus(qint64 pid, const QByteArray &protocol, @@ -710,7 +710,7 @@ ProtoQueue *protoQ(const QString &protocol, const QString &host) { - ProtoQueue *pq = m_protocols.value(protocol, 0); + ProtoQueue *pq = m_protocols.value(protocol, nullptr); if (!pq) { //qDebug() << "creating ProtoQueue instance for" << protocol; @@ -1025,11 +1025,11 @@ } } } - slave->setJob(0); + slave->setJob(nullptr); slave->disconnect(job); } jobPriv->m_schedSerial = 0; // this marks the job as unscheduled again - jobPriv->m_slave = 0; + jobPriv->m_slave = nullptr; // Clear the values in the internal metadata container since they have // already been taken care of above... jobPriv->m_internalMetaData.clear(); @@ -1120,7 +1120,7 @@ pq->removeSlave(slave); } if (slave == m_slaveOnHold) { - m_slaveOnHold = 0; + m_slaveOnHold = nullptr; m_urlOnHold.clear(); } slave->deref(); // Delete slave @@ -1133,8 +1133,8 @@ slave->disconnect(job); // prevent the fake death of the slave from trying to kill the job again; // cf. Slave::hold(const QUrl &url) called in SchedulerPrivate::publishSlaveOnHold(). - slave->setJob(0); - SimpleJobPrivate::get(job)->m_slave = 0; + slave->setJob(nullptr); + SimpleJobPrivate::get(job)->m_slave = nullptr; if (m_slaveOnHold) { m_slaveOnHold->kill(); @@ -1166,7 +1166,7 @@ Slave *SchedulerPrivate::heldSlaveForJob(SimpleJob *job) { - Slave *slave = 0; + Slave *slave = nullptr; KIO::SimpleJobPrivate *const jobPriv = SimpleJobPrivate::get(job); if (jobPriv->m_checkOnHold) { @@ -1197,7 +1197,7 @@ //qDebug() << "HOLD: Discarding held slave (" << m_slaveOnHold << ")"; m_slaveOnHold->kill(); } - m_slaveOnHold = 0; + m_slaveOnHold = nullptr; m_urlOnHold.clear(); } } else if (slave) { @@ -1213,7 +1213,7 @@ if (m_slaveOnHold) { m_slaveOnHold->kill(); } - m_slaveOnHold = 0; + m_slaveOnHold = nullptr; m_urlOnHold.clear(); } @@ -1223,7 +1223,7 @@ const QString protocol = KProtocolManager::slaveProtocol(url, proxyList); ProtoQueue *pq = protoQ(protocol, url.host()); - Slave *slave = pq->createSlave(protocol, /* job */0, url); + Slave *slave = pq->createSlave(protocol, /* job */nullptr, url); if (slave) { setupSlave(slave, url, protocol, proxyList, true, &config); pq->m_connectedSlaveQueue.addSlave(slave); Index: src/core/scheduler_p.h =================================================================== --- src/core/scheduler_p.h +++ src/core/scheduler_p.h @@ -89,7 +89,7 @@ }; struct PerSlaveQueue { - PerSlaveQueue() : runningJob(0) {} + PerSlaveQueue() : runningJob(nullptr) {} QList waitingList; SimpleJob *runningJob; }; Index: src/core/simplejob.cpp =================================================================== --- src/core/simplejob.cpp +++ src/core/simplejob.cpp @@ -169,7 +169,7 @@ m_outgoingMetaData.insert(QStringLiteral("user-timestamp"), QString::number(userTimestampProp.toULongLong())); } - if (q->uiDelegate() == 0) { // not interactive + if (q->uiDelegate() == nullptr) { // not interactive m_outgoingMetaData.insert(QStringLiteral("no-auth-prompt"), QStringLiteral("true")); } Index: src/core/slave.h =================================================================== --- src/core/slave.h +++ src/core/slave.h @@ -54,7 +54,7 @@ { Q_OBJECT public: - explicit Slave(const QString &protocol, QObject *parent = 0); + explicit Slave(const QString &protocol, QObject *parent = nullptr); virtual ~Slave(); Index: src/core/slave.cpp =================================================================== --- src/core/slave.cpp +++ src/core/slave.cpp @@ -127,7 +127,7 @@ m_protocol(protocol), m_slaveProtocol(protocol), slaveconnserver(new KIO::ConnectionServer), - m_job(0), + m_job(nullptr), m_pid(0), m_port(0), contacted(false), @@ -168,7 +168,7 @@ Q_D(Slave); d->slaveconnserver->setNextPendingConnection(d->connection); d->slaveconnserver->deleteLater(); - d->slaveconnserver = 0; + d->slaveconnserver = nullptr; connect(d->connection, SIGNAL(readyRead()), SLOT(gotInput())); } @@ -470,7 +470,7 @@ error_text = i18n("Can not create socket for launching io-slave for protocol '%1'.", protocol); error = KIO::ERR_CANNOT_CREATE_SLAVE; delete slave; - return 0; + return nullptr; } if (forkSlaves() == 1) { @@ -479,7 +479,7 @@ error_text = i18n("Unknown protocol '%1'.", protocol); error = KIO::ERR_CANNOT_CREATE_SLAVE; delete slave; - return 0; + return nullptr; } // find the kioslave using KPluginLoader; kioslave would do this // anyway, but if it doesn't exist, we want to be able to return @@ -489,7 +489,7 @@ error_text = i18n("Can not find io-slave for protocol '%1'.", protocol); error = KIO::ERR_CANNOT_CREATE_SLAVE; delete slave; - return 0; + return nullptr; } const QStringList args = QStringList() << lib_path << protocol << QLatin1String("") << slaveAddress.toString(); @@ -505,7 +505,7 @@ error_text = i18n("Can not find 'kioslave' executable at '%1'", searchPaths.join(QStringLiteral(", "))); error = KIO::ERR_CANNOT_CREATE_SLAVE; delete slave; - return 0; + return nullptr; } QProcess::startDetached(kioslaveExecutable, args); @@ -519,14 +519,14 @@ error_text = i18n("Cannot talk to klauncher: %1", klauncher()->lastError().message()); error = KIO::ERR_CANNOT_CREATE_SLAVE; delete slave; - return 0; + return nullptr; } qint64 pid = reply; if (!pid) { error_text = i18n("klauncher said: %1", errorStr); error = KIO::ERR_CANNOT_CREATE_SLAVE; delete slave; - return 0; + return nullptr; } slave->setPID(pid); QTimer::singleShot(1000 * SLAVE_CONNECTION_TIMEOUT_MIN, slave, SLOT(timeout())); @@ -538,11 +538,11 @@ //qDebug() << "holdSlave" << protocol << "for" << url; // Firstly take into account all special slaves if (protocol == QLatin1String("data")) { - return 0; + return nullptr; } if (forkSlaves()) { - return 0; + return nullptr; } Slave *slave = new Slave(protocol); @@ -550,12 +550,12 @@ QDBusReply reply = klauncher()->requestHoldSlave(url.toString(), slaveAddress.toString()); if (!reply.isValid()) { delete slave; - return 0; + return nullptr; } qint64 pid = reply; if (!pid) { delete slave; - return 0; + return nullptr; } slave->setPID(pid); QTimer::singleShot(1000 * SLAVE_CONNECTION_TIMEOUT_MIN, slave, SLOT(timeout())); Index: src/core/slavebase.h =================================================================== --- src/core/slavebase.h +++ src/core/slavebase.h @@ -891,7 +891,7 @@ * Wait for an answer to our request, until we get @p expected1 or @p expected2 * @return the result from readData, as well as the cmd in *pCmd if set, and the data in @p data */ - int waitForAnswer(int expected1, int expected2, QByteArray &data, int *pCmd = 0); + int waitForAnswer(int expected1, int expected2, QByteArray &data, int *pCmd = nullptr); /** * Internal function to transmit meta data to the application. Index: src/core/slavebase.cpp =================================================================== --- src/core/slavebase.cpp +++ src/core/slavebase.cpp @@ -80,7 +80,7 @@ { public: SlaveBase *q; - SlaveBasePrivate(SlaveBase *owner): q(owner), m_passwdServerClient(0) + SlaveBasePrivate(SlaveBase *owner): q(owner), m_passwdServerClient(nullptr) { if (!qEnvironmentVariableIsEmpty("KIOSLAVE_ENABLE_TESTMODE")) { QStandardPaths::enableTestMode(true); @@ -180,7 +180,7 @@ //qDebug()<<"kioslave : exiting due to signal "<setKillFlag(); } ::signal(SIGALRM, SIG_DFL); @@ -231,7 +231,7 @@ act.sa_handler = sigpipe_handler; sigemptyset(&act.sa_mask); act.sa_flags = 0; - sigaction(SIGPIPE, &act, 0); + sigaction(SIGPIPE, &act, nullptr); ::signal(SIGINT, &genericsig_handler); ::signal(SIGQUIT, &genericsig_handler); @@ -256,7 +256,7 @@ d->totalSize = 0; connectSlave(QFile::decodeName(app_socket)); - d->remotefile = 0; + d->remotefile = nullptr; d->inOpenLoop = false; d->exit_loop = false; } @@ -324,11 +324,11 @@ } // execute deferred deletes - QCoreApplication::sendPostedEvents(NULL, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); } // execute deferred deletes - QCoreApplication::sendPostedEvents(NULL, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); } void SlaveBase::connectSlave(const QString &address) @@ -928,7 +928,7 @@ void SlaveBase::reparseConfiguration() { delete d->remotefile; - d->remotefile = 0; + d->remotefile = nullptr; } bool SlaveBase::openPasswordDialog(AuthInfo &info, const QString &errorMsg) @@ -1096,7 +1096,7 @@ disconnectSlave(); d->isConnectedToApp = true; connectSlave(app_socket); - virtual_hook(AppConnectionMade, 0); + virtual_hook(AppConnectionMade, nullptr); } break; case CMD_SLAVE_HOLD: { QUrl url; @@ -1119,7 +1119,7 @@ stream >> d->configData; d->rebuildConfig(); delete d->remotefile; - d->remotefile = 0; + d->remotefile = nullptr; } break; case CMD_GET: { stream >> url; Index: src/core/slaveconfig.cpp =================================================================== --- src/core/slaveconfig.cpp +++ src/core/slaveconfig.cpp @@ -75,7 +75,7 @@ SlaveConfigProtocol *SlaveConfigPrivate::readProtocolConfig(const QString &_protocol) { - SlaveConfigProtocol *scp = protocol.value(_protocol, 0); + SlaveConfigProtocol *scp = protocol.value(_protocol, nullptr); if (!scp) { QString filename = KProtocolInfo::config(_protocol); scp = new SlaveConfigProtocol; @@ -89,7 +89,7 @@ SlaveConfigProtocol *SlaveConfigPrivate::findProtocolConfig(const QString &_protocol) { - SlaveConfigProtocol *scp = protocol.value(_protocol, 0); + SlaveConfigProtocol *scp = protocol.value(_protocol, nullptr); if (!scp) { scp = readProtocolConfig(_protocol); } Index: src/core/slaveinterface.h =================================================================== --- src/core/slaveinterface.h +++ src/core/slaveinterface.h @@ -100,7 +100,7 @@ Q_OBJECT protected: - SlaveInterface(SlaveInterfacePrivate &dd, QObject *parent = 0); + SlaveInterface(SlaveInterfacePrivate &dd, QObject *parent = nullptr); public: virtual ~SlaveInterface(); Index: src/core/slaveinterface_p.h =================================================================== --- src/core/slaveinterface_p.h +++ src/core/slaveinterface_p.h @@ -38,7 +38,7 @@ { public: SlaveInterfacePrivate() - : connection(0), filesize(0), offset(0), last_time(0), start_time(0), + : connection(nullptr), filesize(0), offset(0), last_time(0), start_time(0), nums(0), slave_calcs_speed(false) { } Index: src/core/storedtransferjob.cpp =================================================================== --- src/core/storedtransferjob.cpp +++ src/core/storedtransferjob.cpp @@ -271,7 +271,7 @@ if (_error) { static bool override_loaded = false; - static QList< int > *overriden_ports = NULL; + static QList< int > *overriden_ports = nullptr; if (!override_loaded) { KConfig cfg(QStringLiteral("kio_httprc")); overriden_ports = new QList< int >; @@ -315,7 +315,7 @@ } // all is ok, return 0 - return 0; + return nullptr; } static KIO::PostErrorJob *precheckHttpPost(const QUrl &url, const QByteArray &postData, JobFlags flags) @@ -334,7 +334,7 @@ } // all is ok, return 0 - return 0; + return nullptr; } TransferJob *KIO::http_post(const QUrl &url, const QByteArray &postData, JobFlags flags) Index: src/core/tcpslavebase.h =================================================================== --- src/core/tcpslavebase.h +++ src/core/tcpslavebase.h @@ -128,7 +128,7 @@ * * @since 4.7.2 */ - int connectToHost(const QString &host, quint16 port, QString *errorString = 0); + int connectToHost(const QString &host, quint16 port, QString *errorString = nullptr); /** * the current port for this service Index: src/core/transferjob.cpp =================================================================== --- src/core/transferjob.cpp +++ src/core/transferjob.cpp @@ -459,7 +459,7 @@ SimpleJob::slotResult(job); if (!error() && job == d->m_subJob) { - d->m_subJob = 0; // No action required + d->m_subJob = nullptr; // No action required d->internalResume(); // Make sure we get the remaining data. } } Index: src/core/usernotificationhandler.cpp =================================================================== --- src/core/usernotificationhandler.cpp +++ src/core/usernotificationhandler.cpp @@ -79,7 +79,7 @@ if (m_cachedResults.contains(key)) { result = *(m_cachedResults[key]); } else { - JobUiDelegateExtension *delegateExtension = 0; + JobUiDelegateExtension *delegateExtension = nullptr; if (r->slave->job()) delegateExtension = SimpleJobPrivate::get(r->slave->job())->m_uiDelegateExtension; if (!delegateExtension) Index: src/core/usernotificationhandler_p.h =================================================================== --- src/core/usernotificationhandler_p.h +++ src/core/usernotificationhandler_p.h @@ -56,7 +56,7 @@ QHash data; }; - UserNotificationHandler(QObject *parent = 0); + UserNotificationHandler(QObject *parent = nullptr); virtual ~UserNotificationHandler(); void requestMessageBox(SlaveInterface *iface, int type, const QHash &data); Index: src/filewidgets/kdiroperator.h =================================================================== --- src/filewidgets/kdiroperator.h +++ src/filewidgets/kdiroperator.h @@ -122,7 +122,7 @@ * This constructor doesn't start loading the url, setView will do it. */ explicit KDirOperator(const QUrl &urlName = QUrl(), - QWidget *parent = 0); + QWidget *parent = nullptr); /** * Destroys the KDirOperator. */ @@ -506,7 +506,7 @@ * @param ask specifies whether a confirmation dialog should be shown * @param showProgress passed to the DeleteJob to show a progress dialog */ - virtual KIO::DeleteJob *del(const KFileItemList &items, QWidget *parent = 0, + virtual KIO::DeleteJob *del(const KFileItemList &items, QWidget *parent = nullptr, bool ask = true, bool showProgress = true); /** Index: src/filewidgets/kdiroperator.cpp =================================================================== --- src/filewidgets/kdiroperator.cpp +++ src/filewidgets/kdiroperator.cpp @@ -75,7 +75,7 @@ { Q_OBJECT public: - KDirOperatorIconView(KDirOperator *dirOperator, QWidget *parent = 0); + KDirOperatorIconView(KDirOperator *dirOperator, QWidget *parent = nullptr); virtual ~KDirOperatorIconView(); protected: @@ -292,30 +292,30 @@ KDirOperator::Private::Private(KDirOperator *_parent) : parent(_parent), - dirLister(0), + dirLister(nullptr), decorationPosition(QStyleOptionViewItem::Left), - splitter(0), - itemView(0), - dirModel(0), - proxyModel(0), - progressBar(0), - preview(0), + splitter(nullptr), + itemView(nullptr), + dirModel(nullptr), + proxyModel(nullptr), + progressBar(nullptr), + preview(nullptr), previewUrl(), previewWidth(0), dirHighlighting(false), onlyDoubleClickSelectsFiles(!qApp->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)), - progressDelayTimer(0), + progressDelayTimer(nullptr), dropOptions(0), - actionMenu(0), - actionCollection(0), - newFileMenu(0), - configGroup(0), - previewGenerator(0), + actionMenu(nullptr), + actionCollection(nullptr), + newFileMenu(nullptr), + configGroup(nullptr), + previewGenerator(nullptr), showPreviews(false), iconsZoom(0), isSaving(false), - decorationMenu(0), - leftAction(0), + decorationMenu(nullptr), + leftAction(nullptr), shouldFetchForItems(false), inlinePreviewState(NotForced) { @@ -324,7 +324,7 @@ KDirOperator::Private::~Private() { delete itemView; - itemView = 0; + itemView = nullptr; // TODO: // if (configGroup) { @@ -334,18 +334,18 @@ qDeleteAll(backStack); qDeleteAll(forwardStack); delete preview; - preview = 0; + preview = nullptr; delete proxyModel; - proxyModel = 0; + proxyModel = nullptr; delete dirModel; - dirModel = 0; - dirLister = 0; // deleted by KDirModel + dirModel = nullptr; + dirLister = nullptr; // deleted by KDirModel delete configGroup; - configGroup = 0; + configGroup = nullptr; delete progressDelayTimer; - progressDelayTimer = 0; + progressDelayTimer = nullptr; } KDirOperator::KDirOperator(const QUrl &_url, QWidget *parent) : @@ -357,7 +357,7 @@ connect(d->splitter, SIGNAL(splitterMoved(int,int)), this, SLOT(_k_slotSplitterMoved(int,int))); - d->preview = 0; + d->preview = nullptr; d->mode = KFile::File; d->viewKind = KFile::Simple; @@ -409,7 +409,7 @@ KDirOperator::~KDirOperator() { resetCursor(); - disconnect(d->dirLister, 0, this, 0); + disconnect(d->dirLister, nullptr, this, nullptr); delete d; } @@ -483,7 +483,7 @@ void KDirOperator::toggleIgnoreCase() { - if (d->proxyModel != 0) { + if (d->proxyModel != nullptr) { Qt::CaseSensitivity cs = d->proxyModel->sortCaseSensitivity(); cs = (cs == Qt::CaseSensitive) ? Qt::CaseInsensitive : Qt::CaseSensitive; d->proxyModel->setSortCaseSensitivity(cs); @@ -492,7 +492,7 @@ void KDirOperator::updateSelectionDependentActions() { - const bool hasSelection = (d->itemView != 0) && + const bool hasSelection = (d->itemView != nullptr) && d->itemView->selectionModel()->hasSelection(); d->actionCollection->action(QStringLiteral("trash"))->setEnabled(hasSelection); d->actionCollection->action(QStringLiteral("delete"))->setEnabled(hasSelection); @@ -501,7 +501,7 @@ void KDirOperator::setPreviewWidget(KPreviewWidgetBase *w) { - const bool showPreview = (w != 0); + const bool showPreview = (w != nullptr); if (showPreview) { d->viewKind = (d->viewKind | KFile::PreviewContents); } else { @@ -524,7 +524,7 @@ KFileItemList KDirOperator::selectedItems() const { KFileItemList itemList; - if (d->itemView == 0) { + if (d->itemView == nullptr) { return itemList; } @@ -543,7 +543,7 @@ bool KDirOperator::isSelected(const KFileItem &item) const { - if ((item.isNull()) || (d->itemView == 0)) { + if ((item.isNull()) || (d->itemView == nullptr)) { return false; } @@ -554,12 +554,12 @@ int KDirOperator::numDirs() const { - return (d->dirLister == 0) ? 0 : d->dirLister->directories().count(); + return (d->dirLister == nullptr) ? 0 : d->dirLister->directories().count(); } int KDirOperator::numFiles() const { - return (d->dirLister == 0) ? 0 : d->dirLister->items().count() - numDirs(); + return (d->dirLister == nullptr) ? 0 : d->dirLister->items().count() - numDirs(); } KCompletion *KDirOperator::completionObject() const @@ -617,7 +617,7 @@ { if (on) { viewKind = viewKind | KFile::PreviewContents; - if (preview == 0) { + if (preview == nullptr) { preview = new KFileMetaPreview(parent); actionCollection->action(QStringLiteral("preview"))->setChecked(true); splitter->addWidget(preview); @@ -626,13 +626,13 @@ preview->show(); QMetaObject::invokeMethod(parent, "_k_assureVisibleSelection", Qt::QueuedConnection); - if (itemView != 0) { + if (itemView != nullptr) { const QModelIndex index = itemView->selectionModel()->currentIndex(); if (index.isValid()) { _k_triggerPreview(index); } } - } else if (preview != 0) { + } else if (preview != nullptr) { viewKind = viewKind & ~KFile::PreviewContents; preview->hide(); } @@ -769,10 +769,10 @@ KMessageBox::information(parent, i18n("You did not select a file to delete."), i18n("Nothing to Delete")); - return 0L; + return nullptr; } - if (parent == 0) { + if (parent == nullptr) { parent = this; } @@ -793,7 +793,7 @@ return job; } - return 0L; + return nullptr; } void KDirOperator::deleteSelected() @@ -812,7 +812,7 @@ KMessageBox::information(parent, i18n("You did not select a file to trash."), i18n("Nothing to Trash")); - return 0L; + return nullptr; } const QList urls = items.urlList(); @@ -832,7 +832,7 @@ return job; } - return 0L; + return nullptr; } KFilePreviewGenerator *KDirOperator::previewGenerator() const @@ -867,7 +867,7 @@ void KDirOperator::trashSelected() { - if (d->itemView == 0) { + if (d->itemView == nullptr) { return; } @@ -1116,7 +1116,7 @@ // - connect KDirOperatorDetailView() with this signal and update the // header internally QTreeView *treeView = qobject_cast(itemView); - if (treeView != 0) { + if (treeView != nullptr) { QHeaderView *headerView = treeView->header(); headerView->blockSignals(true); headerView->setSortIndicator(sortColumn(), sortOrder()); @@ -1129,7 +1129,7 @@ // Protected void KDirOperator::pathChanged() { - if (d->itemView == 0) { + if (d->itemView == nullptr) { return; } @@ -1316,7 +1316,7 @@ } break; case QEvent::MouseButtonRelease: { - if (d->preview != 0 && !d->preview->isHidden()) { + if (d->preview != nullptr && !d->preview->isHidden()) { const QModelIndex hoveredIndex = d->itemView->indexAt(d->itemView->viewport()->mapFromGlobal(QCursor::pos())); const QModelIndex focusedIndex = d->itemView->selectionModel() ? d->itemView->selectionModel()->currentIndex() : QModelIndex(); @@ -1424,7 +1424,7 @@ QAbstractItemView *KDirOperator::createView(QWidget *parent, KFile::FileView viewKind) { - QAbstractItemView *itemView = 0; + QAbstractItemView *itemView = nullptr; if (KFile::isDetailView(viewKind) || KFile::isTreeView(viewKind) || KFile::isDetailTreeView(viewKind)) { KDirOperatorDetailView *detailView = new KDirOperatorDetailView(parent); detailView->setViewMode(viewKind); @@ -1507,7 +1507,7 @@ d->dirLister->setDirOnlyMode(dirOnlyMode()); // reset the view with the different mode - if (d->itemView != 0) { + if (d->itemView != nullptr) { setView(static_cast(d->viewKind)); } } @@ -1520,7 +1520,7 @@ // TODO: do a real timer and restart it after that d->pendingMimeTypes.clear(); - const bool listDir = (d->itemView == 0); + const bool listDir = (d->itemView == nullptr); if (d->mode & KFile::Files) { view->setSelectionMode(QAbstractItemView::ExtendedSelection); @@ -1528,8 +1528,8 @@ view->setSelectionMode(QAbstractItemView::SingleSelection); } - QItemSelectionModel *selectionModel = 0; - if ((d->itemView != 0) && d->itemView->selectionModel()->hasSelection()) { + QItemSelectionModel *selectionModel = nullptr; + if ((d->itemView != nullptr) && d->itemView->selectionModel()->hasSelection()) { // remember the selection of the current item view and apply this selection // to the new view later const QItemSelection selection = d->itemView->selectionModel()->selection(); @@ -1537,7 +1537,7 @@ selectionModel->select(selection, QItemSelectionModel::Select); } - setFocusProxy(0); + setFocusProxy(nullptr); delete d->itemView; d->itemView = view; d->itemView->setModel(d->proxyModel); @@ -1579,7 +1579,7 @@ d->openUrl(d->currUrl); } - if (selectionModel != 0) { + if (selectionModel != nullptr) { d->itemView->setSelectionModel(selectionModel); QMetaObject::invokeMethod(this, "_k_assureVisibleSelection", Qt::QueuedConnection); } @@ -1629,10 +1629,10 @@ } delete d->dirModel; - d->dirModel = 0; + d->dirModel = nullptr; delete d->proxyModel; - d->proxyModel = 0; + d->proxyModel = nullptr; //delete d->dirLister; // deleted by KDirModel already, which took ownership d->dirLister = lister; @@ -1684,7 +1684,7 @@ void KDirOperator::highlightFile(const KFileItem &item) { - if ((d->preview != 0 && !d->preview->isHidden()) && !item.isNull()) { + if ((d->preview != nullptr && !d->preview->isHidden()) && !item.isNull()) { d->preview->showPreview(item.url()); } @@ -1750,7 +1750,7 @@ { // qDebug(); - if (d->itemView == 0) { + if (d->itemView == nullptr) { return; } @@ -1795,7 +1795,7 @@ void KDirOperator::prepareCompletionObjects() { - if (d->itemView == 0) { + if (d->itemView == nullptr) { return; } @@ -2153,7 +2153,7 @@ bool appSpecificPreview = false; if (d->preview) { KFileMetaPreview *tmp = dynamic_cast(d->preview); - appSpecificPreview = (tmp == 0); + appSpecificPreview = (tmp == nullptr); } if (!appSpecificPreview) { @@ -2322,7 +2322,7 @@ void KDirOperator::Private::_k_slotProperties() { - if (itemView == 0) { + if (itemView == nullptr) { return; } @@ -2352,7 +2352,7 @@ void KDirOperator::Private::_k_slotSelectionChanged() { - if (itemView == 0) { + if (itemView == nullptr) { return; } @@ -2385,7 +2385,7 @@ void KDirOperator::Private::_k_triggerPreview(const QModelIndex &index) { - if ((preview != 0 && !preview->isHidden()) && index.isValid() && (index.column() == KDirModel::Name)) { + if ((preview != nullptr && !preview->isHidden()) && index.isValid() && (index.column() == KDirModel::Name)) { const QModelIndex dirIndex = proxyModel->mapToSource(index); const KFileItem item = dirModel->itemForIndex(dirIndex); @@ -2404,7 +2404,7 @@ void KDirOperator::Private::_k_showPreview() { - if (preview != 0) { + if (preview != nullptr) { preview->showPreview(previewUrl); } } @@ -2420,7 +2420,7 @@ void KDirOperator::Private::_k_assureVisibleSelection() { - if (itemView == 0) { + if (itemView == nullptr) { return; } Index: src/filewidgets/kdiroperatordetailview_p.h =================================================================== --- src/filewidgets/kdiroperatordetailview_p.h +++ src/filewidgets/kdiroperatordetailview_p.h @@ -34,7 +34,7 @@ Q_OBJECT public: - KDirOperatorDetailView(QWidget *parent = 0); + KDirOperatorDetailView(QWidget *parent = nullptr); virtual ~KDirOperatorDetailView(); void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE; Index: src/filewidgets/kdirsortfilterproxymodel.h =================================================================== --- src/filewidgets/kdirsortfilterproxymodel.h +++ src/filewidgets/kdirsortfilterproxymodel.h @@ -53,7 +53,7 @@ Q_OBJECT public: - KDirSortFilterProxyModel(QObject *parent = 0); + KDirSortFilterProxyModel(QObject *parent = nullptr); virtual ~KDirSortFilterProxyModel(); /** Reimplemented from QAbstractItemModel. Returns true for directories. */ Index: src/filewidgets/kencodingfiledialog.h =================================================================== --- src/filewidgets/kencodingfiledialog.h +++ src/filewidgets/kencodingfiledialog.h @@ -78,7 +78,7 @@ static KIOFILEWIDGETS_EXPORT Result getOpenFileNameAndEncoding(const QString &encoding = QString(), const QUrl &startDir = QUrl(), const QString &filter = QString(), - QWidget *parent = 0, + QWidget *parent = nullptr, const QString &caption = QString()); /** @@ -110,7 +110,7 @@ static KIOFILEWIDGETS_EXPORT Result getOpenFileNamesAndEncoding(const QString &encoding = QString(), const QUrl &startDir = QUrl(), const QString &filter = QString(), - QWidget *parent = 0, + QWidget *parent = nullptr, const QString &caption = QString()); /** @@ -142,7 +142,7 @@ static KIOFILEWIDGETS_EXPORT Result getOpenUrlAndEncoding(const QString &encoding = QString(), const QUrl &startDir = QUrl(), const QString &filter = QString(), - QWidget *parent = 0, + QWidget *parent = nullptr, const QString &caption = QString()); /** @@ -174,7 +174,7 @@ static KIOFILEWIDGETS_EXPORT Result getOpenUrlsAndEncoding(const QString &encoding = QString(), const QUrl &startDir = QUrl(), const QString &filter = QString(), - QWidget *parent = 0, + QWidget *parent = nullptr, const QString &caption = QString()); /** @@ -208,7 +208,7 @@ static KIOFILEWIDGETS_EXPORT Result getSaveFileNameAndEncoding(const QString &encoding = QString(), const QUrl &startDir = QUrl(), const QString &filter = QString(), - QWidget *parent = 0, + QWidget *parent = nullptr, const QString &caption = QString()); /** @@ -242,7 +242,7 @@ static KIOFILEWIDGETS_EXPORT Result getSaveUrlAndEncoding(const QString &encoding = QString(), const QUrl &startDir = QUrl(), const QString &filter = QString(), - QWidget *parent = 0, + QWidget *parent = nullptr, const QString &caption = QString()); QSize sizeHint() const Q_DECL_OVERRIDE; @@ -292,7 +292,7 @@ const QString &filter = QString(), const QString &caption = QString(), QFileDialog::AcceptMode type = QFileDialog::AcceptOpen, - QWidget *parent = 0); + QWidget *parent = nullptr); /** * Destructs the file dialog. */ Index: src/filewidgets/kfilecopytomenu.cpp =================================================================== --- src/filewidgets/kfilecopytomenu.cpp +++ src/filewidgets/kfilecopytomenu.cpp @@ -94,7 +94,7 @@ KFileCopyToMainMenu::KFileCopyToMainMenu(QMenu *parent, KFileCopyToMenuPrivate *_d, MenuType menuType) : QMenu(parent), m_menuType(menuType), - m_actionGroup(static_cast(0)), + m_actionGroup(static_cast(nullptr)), d(_d), m_recentDirsGroup(KSharedConfig::openConfig(), m_menuType == Copy ? "kuick-copy" : "kuick-move") { Index: src/filewidgets/kfilefiltercombo.h =================================================================== --- src/filewidgets/kfilefiltercombo.h +++ src/filewidgets/kfilefiltercombo.h @@ -36,7 +36,7 @@ * * @param parent The parent widget. */ - KFileFilterCombo(QWidget *parent = 0); + KFileFilterCombo(QWidget *parent = nullptr); /** * Destroys the filter combo box. Index: src/filewidgets/kfilemetapreview.cpp =================================================================== --- src/filewidgets/kfilemetapreview.cpp +++ src/filewidgets/kfilemetapreview.cpp @@ -84,7 +84,7 @@ } } - return 0; + return nullptr; } KPreviewWidgetBase *KFileMetaPreview::previewProviderFor(const QString &mimeType) @@ -96,7 +96,7 @@ // often the first highlighted item, where we can be sure, there is no plugin // (this "folders reflect icons" is a konq-specific thing, right?) if (mimeInfo.inherits(QStringLiteral("inode/directory"))) { - return 0L; + return nullptr; } KPreviewWidgetBase *provider = findExistingProvider(mimeType, mimeInfo); @@ -135,7 +135,7 @@ // The logic in this code duplicates the logic in PreviewJob. // But why do we need multiple KPreviewWidgetBase instances anyway? - return 0L; + return nullptr; } void KFileMetaPreview::showPreview(const QUrl &url) @@ -189,7 +189,7 @@ if (!factory) { qWarning() << "Couldn't load kfileaudiopreview" << loader.errorString(); s_tryAudioPreview = false; - return 0L; + return nullptr; } KPreviewWidgetBase *w = factory->create(parent); if (w) { Index: src/filewidgets/kfileplaceeditdialog.h =================================================================== --- src/filewidgets/kfileplaceeditdialog.h +++ src/filewidgets/kfileplaceeditdialog.h @@ -68,7 +68,7 @@ QString &label, QString &icon, bool isAddingNewPlace, bool &appLocal, int iconSize, - QWidget *parent = 0); + QWidget *parent = nullptr); /** * Constructs a KFilePlaceEditDialog. @@ -92,7 +92,7 @@ bool isAddingNewPlace, bool appLocal = true, int iconSize = KIconLoader::SizeMedium, - QWidget *parent = 0); + QWidget *parent = nullptr); /** * Destroys the dialog. */ Index: src/filewidgets/kfileplaceeditdialog.cpp =================================================================== --- src/filewidgets/kfileplaceeditdialog.cpp +++ src/filewidgets/kfileplaceeditdialog.cpp @@ -147,7 +147,7 @@ appName)); box->addWidget(m_appLocal); } else { - m_appLocal = 0L; + m_appLocal = nullptr; } connect(m_urlEdit->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(urlChanged(QString))); if (!label.isEmpty()) { Index: src/filewidgets/kfileplacesitem.cpp =================================================================== --- src/filewidgets/kfileplacesitem.cpp +++ src/filewidgets/kfileplacesitem.cpp @@ -120,10 +120,10 @@ m_disc = m_device.as(); m_mtp = m_device.as(); } else { - m_access = 0; - m_volume = 0; - m_disc = 0; - m_mtp = 0; + m_access = nullptr; + m_volume = nullptr; + m_disc = nullptr; + m_mtp = nullptr; } } return m_device; @@ -209,13 +209,13 @@ } case KFilePlacesModel::FixedDeviceRole: { - Solid::StorageDrive *drive = 0; + Solid::StorageDrive *drive = nullptr; Solid::Device parentDevice = m_device; while (parentDevice.isValid() && !drive) { drive = parentDevice.as(); parentDevice = parentDevice.parent(); } - if (drive != 0) { + if (drive != nullptr) { return !drive->isHotpluggable() && !drive->isRemovable(); } return true; Index: src/filewidgets/kfileplacesitem_p.h =================================================================== --- src/filewidgets/kfileplacesitem_p.h +++ src/filewidgets/kfileplacesitem_p.h @@ -58,7 +58,7 @@ const QString &label, const QUrl &url, const QString &iconName, - KFilePlacesItem *after = 0); + KFilePlacesItem *after = nullptr); static KBookmark createSystemBookmark(KBookmarkManager *manager, const QString &untranslatedLabel, const QString &translatedLabel, Index: src/filewidgets/kfileplacesmodel.h =================================================================== --- src/filewidgets/kfileplacesmodel.h +++ src/filewidgets/kfileplacesmodel.h @@ -48,7 +48,7 @@ CapacityBarRecommendedRole = 0x1548C5C4 }; - KFilePlacesModel(QObject *parent = 0); + KFilePlacesModel(QObject *parent = nullptr); ~KFilePlacesModel(); QUrl url(const QModelIndex &index) const; Index: src/filewidgets/kfileplacesmodel.cpp =================================================================== --- src/filewidgets/kfileplacesmodel.cpp +++ src/filewidgets/kfileplacesmodel.cpp @@ -59,7 +59,7 @@ class KFilePlacesModel::Private { public: - Private(KFilePlacesModel *self) : q(self), bookmarkManager(0) {} + Private(KFilePlacesModel *self) : q(self), bookmarkManager(nullptr) {} ~Private() { qDeleteAll(items); @@ -768,14 +768,14 @@ Solid::StorageDrive *drive = device.as(); - if (drive == 0) { + if (drive == nullptr) { drive = device.parent().as(); } bool hotpluggable = false; bool removable = false; - if (drive != 0) { + if (drive != nullptr) { hotpluggable = drive->isHotpluggable(); removable = drive->isRemovable(); } @@ -795,13 +795,13 @@ } if (!iconName.isEmpty()) { - return new QAction(QIcon::fromTheme(iconName), text, 0); + return new QAction(QIcon::fromTheme(iconName), text, nullptr); } else { - return new QAction(text, 0); + return new QAction(text, nullptr); } } - return 0; + return nullptr; } QAction *KFilePlacesModel::ejectActionForIndex(const QModelIndex &index) const @@ -813,10 +813,10 @@ QString label = data(index, Qt::DisplayRole).toString().replace('&', QLatin1String("&&")); QString text = i18n("&Eject '%1'", label); - return new QAction(QIcon::fromTheme(QStringLiteral("media-eject")), text, 0); + return new QAction(QIcon::fromTheme(QStringLiteral("media-eject")), text, nullptr); } - return 0; + return nullptr; } void KFilePlacesModel::requestTeardown(const QModelIndex &index) @@ -824,7 +824,7 @@ Solid::Device device = deviceForIndex(index); Solid::StorageAccess *access = device.as(); - if (access != 0) { + if (access != nullptr) { connect(access, SIGNAL(teardownDone(Solid::ErrorType,QVariant,QString)), this, SLOT(_k_storageTeardownDone(Solid::ErrorType,QVariant))); @@ -838,7 +838,7 @@ Solid::OpticalDrive *drive = device.parent().as(); - if (drive != 0) { + if (drive != nullptr) { connect(drive, SIGNAL(ejectDone(Solid::ErrorType,QVariant,QString)), this, SLOT(_k_storageTeardownDone(Solid::ErrorType,QVariant))); Index: src/filewidgets/kfileplacesview.h =================================================================== --- src/filewidgets/kfileplacesview.h +++ src/filewidgets/kfileplacesview.h @@ -35,7 +35,7 @@ { Q_OBJECT public: - KFilePlacesView(QWidget *parent = 0); + KFilePlacesView(QWidget *parent = nullptr); ~KFilePlacesView(); /** Index: src/filewidgets/kfileplacesview.cpp =================================================================== --- src/filewidgets/kfileplacesview.cpp +++ src/filewidgets/kfileplacesview.cpp @@ -283,7 +283,7 @@ void KFilePlacesViewDelegate::removeFadeAnimation(const QModelIndex &index) { - QTimeLine *timeLine = m_timeLineMap.value(index, 0); + QTimeLine *timeLine = m_timeLineMap.value(index, nullptr); m_timeLineMap.remove(index); m_timeLineInverseMap.remove(timeLine); } @@ -295,7 +295,7 @@ QTimeLine *KFilePlacesViewDelegate::fadeAnimationForIndex(const QModelIndex &index) const { - return m_timeLineMap.value(index, 0); + return m_timeLineMap.value(index, nullptr); } qreal KFilePlacesViewDelegate::contentsOpacity(const QModelIndex &index) const @@ -369,7 +369,7 @@ d->dropOnPlace = false; d->autoResizeItems = true; d->dragging = false; - d->lastClickedStorage = 0; + d->lastClickedStorage = nullptr; d->pollingRequestCount = 0; d->delegate = new KFilePlacesViewDelegate(this); @@ -461,7 +461,7 @@ QUrl oldUrl = d->currentUrl; KFilePlacesModel *placesModel = qobject_cast(model()); - if (placesModel == 0) { + if (placesModel == nullptr) { return; } @@ -507,7 +507,7 @@ { KFilePlacesModel *placesModel = qobject_cast(model()); - if (placesModel == 0) { + if (placesModel == nullptr) { return; } @@ -560,7 +560,7 @@ KFilePlacesModel *placesModel = qobject_cast(model()); KFilePlacesViewDelegate *delegate = dynamic_cast(itemDelegate()); - if (placesModel == 0) { + if (placesModel == nullptr) { return; } @@ -569,13 +569,13 @@ QMenu menu; - QAction *edit = 0; - QAction *hide = 0; - QAction *emptyTrash = 0; - QAction *eject = 0; - QAction *teardown = 0; - QAction *add = 0; - QAction *mainSeparator = 0; + QAction *edit = nullptr; + QAction *hide = nullptr; + QAction *emptyTrash = nullptr; + QAction *eject = nullptr; + QAction *teardown = nullptr; + QAction *add = nullptr; + QAction *mainSeparator = nullptr; if (index.isValid()) { if (!placesModel->isDevice(index)) { @@ -590,22 +590,22 @@ edit = menu.addAction(QIcon::fromTheme(QStringLiteral("document-properties")), i18n("&Edit Entry '%1'...", label)); } else { eject = placesModel->ejectActionForIndex(index); - if (eject != 0) { + if (eject != nullptr) { eject->setParent(&menu); menu.addAction(eject); } teardown = placesModel->teardownActionForIndex(index); - if (teardown != 0) { + if (teardown != nullptr) { teardown->setParent(&menu); menu.addAction(teardown); } - if (teardown != 0 || eject != 0) { + if (teardown != nullptr || eject != nullptr) { mainSeparator = menu.addSeparator(); } } - if (add == 0) { + if (add == nullptr) { add = menu.addAction(QIcon::fromTheme(QStringLiteral("document-new")), i18n("Add Entry...")); } @@ -616,18 +616,18 @@ add = menu.addAction(QIcon::fromTheme(QStringLiteral("document-new")), i18n("Add Entry...")); } - QAction *showAll = 0; + QAction *showAll = nullptr; if (placesModel->hiddenCount() > 0) { showAll = new QAction(i18n("&Show All Entries"), &menu); showAll->setCheckable(true); showAll->setChecked(d->showAll); - if (mainSeparator == 0) { + if (mainSeparator == nullptr) { mainSeparator = menu.addSeparator(); } menu.insertAction(mainSeparator, showAll); } - QAction *remove = 0; + QAction *remove = nullptr; if (index.isValid() && !placesModel->isDevice(index)) { remove = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("&Remove Entry '%1'", label)); } @@ -640,7 +640,7 @@ QAction *result = menu.exec(event->globalPos()); - if (emptyTrash != 0 && result == emptyTrash) { + if (emptyTrash != nullptr && result == emptyTrash) { KIO::JobUiDelegate uiDelegate; uiDelegate.setWindow(window()); @@ -649,7 +649,7 @@ KJobWidgets::setWindow(job, window()); job->ui()->setAutoErrorHandlingEnabled(true); } - } else if (edit != 0 && result == edit) { + } else if (edit != nullptr && result == edit) { KBookmark bookmark = placesModel->bookmarkForIndex(index); QUrl url = bookmark.url(); QString label = bookmark.text(); @@ -666,9 +666,9 @@ placesModel->editPlace(index, label, url, iconName, appName); } - } else if (remove != 0 && result == remove) { + } else if (remove != nullptr && result == remove) { placesModel->removePlace(index); - } else if (hide != 0 && result == hide) { + } else if (hide != nullptr && result == hide) { placesModel->setPlaceHidden(index, hide->isChecked()); QModelIndex current = placesModel->closestItem(d->currentUrl); @@ -680,13 +680,13 @@ d->itemDisappearTimeline.start(); } } - } else if (showAll != 0 && result == showAll) { + } else if (showAll != nullptr && result == showAll) { setShowAll(showAll->isChecked()); - } else if (teardown != 0 && result == teardown) { + } else if (teardown != nullptr && result == teardown) { placesModel->requestTeardown(index); - } else if (eject != 0 && result == eject) { + } else if (eject != nullptr && result == eject) { placesModel->requestEject(index); - } else if (add != 0 && result == add) { + } else if (add != nullptr && result == add) { QUrl url = d->currentUrl; QString label; QString iconName = QStringLiteral("folder"); @@ -782,7 +782,7 @@ const QRect rect = visualRect(index); if (!d->insertAbove(rect, pos) && !d->insertBelow(rect, pos)) { KFilePlacesModel *placesModel = qobject_cast(model()); - Q_ASSERT(placesModel != 0); + Q_ASSERT(placesModel != nullptr); emit urlsDropped(placesModel->url(index), event, this); event->acceptProposedAction(); } @@ -899,7 +899,7 @@ { KFilePlacesModel *placesModel = qobject_cast(q->model()); - if (placesModel == 0) { + if (placesModel == nullptr) { return; } @@ -933,7 +933,7 @@ KFilePlacesModel *placesModel = qobject_cast(q->model()); - if (placesModel == 0) { + if (placesModel == nullptr) { return; } @@ -966,7 +966,7 @@ } } - const int margin = q->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, q) + 1; + const int margin = q->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, q) + 1; const int maxWidth = q->viewport()->width() - textWidth - 4 * margin - 1; const int maxHeight = ((q->height() - (fm.height() / 2) * rowCount) / rowCount) - 1; @@ -1001,7 +1001,7 @@ { KFilePlacesModel *placesModel = qobject_cast(q->model()); - if (placesModel == 0) { + if (placesModel == nullptr) { return; } @@ -1074,7 +1074,7 @@ { KFilePlacesModel *placesModel = qobject_cast(q->model()); - if (placesModel == 0) { + if (placesModel == nullptr) { return; } Index: src/filewidgets/kfileplacesview_p.h =================================================================== --- src/filewidgets/kfileplacesview_p.h +++ src/filewidgets/kfileplacesview_p.h @@ -28,7 +28,7 @@ Q_OBJECT public: - KFilePlacesEventWatcher(QObject *parent = 0) + KFilePlacesEventWatcher(QObject *parent = nullptr) : QObject(parent) {} const QModelIndex &hoveredIndex() const Index: src/filewidgets/kfilepreviewgenerator.cpp =================================================================== --- src/filewidgets/kfilepreviewgenerator.cpp +++ src/filewidgets/kfilepreviewgenerator.cpp @@ -82,7 +82,7 @@ m_uniformSizes(false), m_view(qobject_cast(view)) { - if (m_view != 0) { + if (m_view != nullptr) { m_uniformSizes = m_view->uniformItemSizes(); m_view->setUniformItemSizes(true); } @@ -90,7 +90,7 @@ ~LayoutBlocker() { - if (m_view != 0) { + if (m_view != nullptr) { m_view->setUniformItemSizes(m_uniformSizes); } } @@ -419,21 +419,21 @@ m_internalDataChange(0), m_pendingVisibleIconUpdates(0), m_viewAdapter(viewAdapter), - m_itemView(0), - m_iconUpdateTimer(0), - m_scrollAreaTimer(0), + m_itemView(nullptr), + m_iconUpdateTimer(nullptr), + m_scrollAreaTimer(nullptr), m_previewJobs(), - m_proxyModel(0), + m_proxyModel(nullptr), m_cutItemsCache(), m_previews(), m_sequenceIndices(), m_changedItems(), - m_changedItemsTimer(0), + m_changedItemsTimer(nullptr), m_pendingItems(), m_dispatchedItems(), m_resolvedMimeTypes(), m_enabledPlugins(), - m_tileSet(0), + m_tileSet(nullptr), q(parent) { if (!m_viewAdapter->iconSize().isValid()) { @@ -441,7 +441,7 @@ } m_proxyModel = qobject_cast(model); - m_dirModel = (m_proxyModel == 0) ? + m_dirModel = (m_proxyModel == nullptr) ? qobject_cast(model) : qobject_cast(m_proxyModel->sourceModel()); if (!m_dirModel) { @@ -606,8 +606,8 @@ void KFilePreviewGenerator::Private::addToPreviewQueue(const KFileItem &item, const QPixmap &pixmap) { KIO::PreviewJob *senderJob = qobject_cast(q->sender()); - Q_ASSERT(senderJob != 0); - if (senderJob != 0) { + Q_ASSERT(senderJob != nullptr); + if (senderJob != nullptr) { QMap::iterator it = m_sequenceIndices.find(item.url()); if (senderJob->sequenceIndex() && (it == m_sequenceIndices.end() || *it != senderJob->sequenceIndex())) { return; // the sequence index does not match the one we want @@ -794,7 +794,7 @@ { m_iconUpdatesPaused = true; foreach (KJob *job, m_previewJobs) { - Q_ASSERT(job != 0); + Q_ASSERT(job != nullptr); job->suspend(); } m_scrollAreaTimer->start(); @@ -958,7 +958,7 @@ maxSize.height() - TileSet::TopMargin - TileSet::BottomMargin); limitToSize(icon, size); - if (m_tileSet == 0) { + if (m_tileSet == nullptr) { m_tileSet = new TileSet(); } @@ -1082,7 +1082,7 @@ void KFilePreviewGenerator::Private::killPreviewJobs() { foreach (KJob *job, m_previewJobs) { - Q_ASSERT(job != 0); + Q_ASSERT(job != nullptr); job->kill(); } m_previewJobs.clear(); @@ -1102,7 +1102,7 @@ // Order the items in a way that the preview for the visible items // is generated first, as this improves the feeled performance a lot. - const bool hasProxy = (m_proxyModel != 0); + const bool hasProxy = (m_proxyModel != nullptr); const int itemCount = items.count(); const QRect visibleArea = m_viewAdapter->visibleArea(); Index: src/filewidgets/kfilewidget.h =================================================================== --- src/filewidgets/kfilewidget.h +++ src/filewidgets/kfilewidget.h @@ -86,7 +86,7 @@ * @param parent The parent widget of this widget * */ - explicit KFileWidget(const QUrl &startDir, QWidget *parent = 0); + explicit KFileWidget(const QUrl &startDir, QWidget *parent = nullptr); /** * Destructor Index: src/filewidgets/kfilewidget.cpp =================================================================== --- src/filewidgets/kfilewidget.cpp +++ src/filewidgets/kfilewidget.cpp @@ -81,20 +81,20 @@ public: KFileWidgetPrivate(KFileWidget *widget) : q(widget), - boxLayout(0), - placesDock(0), - placesView(0), - placesViewSplitter(0), + boxLayout(nullptr), + placesDock(nullptr), + placesView(nullptr), + placesViewSplitter(nullptr), placesViewWidth(-1), - labeledCustomWidget(0), - bottomCustomWidget(0), - autoSelectExtCheckBox(0), + labeledCustomWidget(nullptr), + bottomCustomWidget(nullptr), + autoSelectExtCheckBox(nullptr), operationMode(KFileWidget::Opening), - bookmarkHandler(0), - toolbar(0), - locationEdit(0), - ops(0), - filterWidget(0), + bookmarkHandler(nullptr), + toolbar(nullptr), + locationEdit(nullptr), + ops(nullptr), + filterWidget(nullptr), autoSelectExtChecked(false), keepLocation(false), hasView(false), @@ -103,7 +103,7 @@ dummyAdded(false), confirmOverwrite(false), differentHierarchyLevelItemsEntered(false), - iconSizeSlider(0) + iconSizeSlider(nullptr) { } @@ -867,7 +867,7 @@ QList urlList; // one time is always enough. int start = 0; QUrl topMostUrl; - KIO::StatJob *statJob = 0; + KIO::StatJob *statJob = nullptr; bool res = false; // we need to check for a valid first url, so in theory we only iterate one time over @@ -1955,7 +1955,7 @@ tmpGroup.writeEntry(SpeedbarWidth, sizes[0]); } - tmpGroup.writeEntry(ShowBookmarks, bookmarkHandler != 0); + tmpGroup.writeEntry(ShowBookmarks, bookmarkHandler != nullptr); tmpGroup.writeEntry(AutoSelectExtChecked, autoSelectExtChecked); tmpGroup.writeEntry(BreadcrumbNavigation, !urlNavigator->isUrlEditable()); tmpGroup.writeEntry(ShowFullPath, urlNavigator->showFullPath()); @@ -2605,9 +2605,9 @@ toolbar->addAction(bookmarkButton); } else if (bookmarkHandler) { delete bookmarkHandler; - bookmarkHandler = 0; + bookmarkHandler = nullptr; delete bookmarkButton; - bookmarkButton = 0; + bookmarkButton = nullptr; } static_cast(q->actionCollection()->action(QStringLiteral("toggleBookmarks")))->setChecked(show); Index: src/filewidgets/kimagefilepreview.h =================================================================== --- src/filewidgets/kimagefilepreview.h +++ src/filewidgets/kimagefilepreview.h @@ -36,7 +36,7 @@ * * @param parent The parent widget. */ - explicit KImageFilePreview(QWidget *parent = 0); + explicit KImageFilePreview(QWidget *parent = nullptr); /** * Destroys the image file preview. Index: src/filewidgets/kimagefilepreview.cpp =================================================================== --- src/filewidgets/kimagefilepreview.cpp +++ src/filewidgets/kimagefilepreview.cpp @@ -33,7 +33,7 @@ { public: KImageFilePreviewPrivate() - : m_job(0) + : m_job(nullptr) , clear(true) { m_timeLine = new QTimeLine(150); @@ -173,14 +173,14 @@ previewJob->setScaleType(KIO::PreviewJob::Scaled); return previewJob; } else { - return 0; + return nullptr; } } void KImageFilePreview::gotPreview(const KFileItem &item, const QPixmap &pm) { if (item.url() == d->currentURL) { // should always be the case - if (style()->styleHint(QStyle::SH_Widget_Animate, 0, this)) { + if (style()->styleHint(QStyle::SH_Widget_Animate, nullptr, this)) { if (d->m_timeLine->state() == QTimeLine::Running) { d->m_timeLine->setCurrentTime(0); } @@ -208,7 +208,7 @@ void KImageFilePreview::KImageFilePreviewPrivate::_k_slotResult(KJob *job) { if (job == m_job) { - m_job = 0L; + m_job = nullptr; } } @@ -256,14 +256,14 @@ { if (d->m_job) { d->m_job->kill(); - d->m_job = 0L; + d->m_job = nullptr; } if (d->clear || d->m_timeLine->state() == QTimeLine::Running) { return; } - if (style()->styleHint(QStyle::SH_Widget_Animate, 0, this)) { + if (style()->styleHint(QStyle::SH_Widget_Animate, nullptr, this)) { d->m_pmTransition = QPixmap(); //If we add a previous preview then we run the animation if (!d->m_pmCurrent.isNull()) { Index: src/filewidgets/knewfilemenu.cpp =================================================================== --- src/filewidgets/knewfilemenu.cpp +++ src/filewidgets/knewfilemenu.cpp @@ -78,9 +78,9 @@ { public: KNewFileMenuSingleton() - : dirWatch(0), + : dirWatch(nullptr), filesParsed(false), - templatesList(0), + templatesList(nullptr), templatesVersion(0) { } @@ -391,7 +391,7 @@ KMessageBox::createKMessageBox(dialog, buttonBox, QMessageBox::Warning, i18n("The template file %1 does not exist.", src), - QStringList(), QString(), 0, KMessageBox::NoExec, + QStringList(), QString(), nullptr, KMessageBox::NoExec, QString()); dialog->show(); @@ -427,7 +427,7 @@ i18n("The name \"%1\" starts with a dot, so the directory will be hidden by default.", name), QStringList(), i18n("Do not ask again"), - 0, + nullptr, KMessageBox::NoExec, QString()); @@ -635,13 +635,13 @@ QMenu *menu = q->menu(); menu->clear(); m_menuDev->menu()->clear(); - m_newDirAction = 0; + m_newDirAction = nullptr; QSet seenTexts; // these shall be put at special positions - QAction *linkURL = 0; - QAction *linkApp = 0; - QAction *linkPath = 0; + QAction *linkURL = nullptr; + QAction *linkApp = nullptr; + QAction *linkPath = nullptr; KNewFileMenuSingleton *s = kNewMenuGlobals(); int i = 1; @@ -1075,7 +1075,7 @@ connect(d->m_newMenuGroup, SIGNAL(triggered(QAction*)), this, SLOT(_k_slotActionTriggered(QAction*))); d->m_actionCollection = collection; d->m_parentWidget = qobject_cast(parent); - d->m_newDirAction = 0; + d->m_newDirAction = nullptr; if (d->m_actionCollection) { d->m_actionCollection->addAction(name, this); @@ -1237,7 +1237,7 @@ const QUrl localUrl = d->mostLocalUrl(destUrl); if (localUrl.isLocalFile()) { // Normal (local) file. Need to "touch" it, kio_file copied the mtime. - (void) ::utime(QFile::encodeName(localUrl.toLocalFile()).constData(), 0); + (void) ::utime(QFile::encodeName(localUrl.toLocalFile()).constData(), nullptr); } emit fileCreated(destUrl); } else if (KIO::SimpleJob *simpleJob = ::qobject_cast(job)) { Index: src/filewidgets/kurlnavigator.h =================================================================== --- src/filewidgets/kurlnavigator.h +++ src/filewidgets/kurlnavigator.h @@ -78,7 +78,7 @@ public: /** @since 4.5 */ - KUrlNavigator(QWidget *parent = 0); + KUrlNavigator(QWidget *parent = nullptr); /** * @param placesModel Model for the places which are selectable inside a Index: src/filewidgets/kurlnavigator.cpp =================================================================== --- src/filewidgets/kurlnavigator.cpp +++ src/filewidgets/kurlnavigator.cpp @@ -195,16 +195,16 @@ KUrlNavigator::Private::Private(KUrlNavigator *q, KFilePlacesModel *placesModel) : m_editable(false), m_active(true), - m_showPlacesSelector(placesModel != 0), + m_showPlacesSelector(placesModel != nullptr), m_showFullPath(false), m_historyIndex(0), m_layout(new QHBoxLayout), - m_placesSelector(0), - m_pathBox(0), - m_protocols(0), - m_dropDownButton(0), + m_placesSelector(nullptr), + m_pathBox(nullptr), + m_protocols(nullptr), + m_dropDownButton(nullptr), m_navButtons(), - m_toggleEditableMode(0), + m_toggleEditableMode(nullptr), m_homeUrl(), m_customProtocols(QStringList()), q(q) @@ -215,7 +215,7 @@ // initialize the places selector q->setAutoFillBackground(false); - if (placesModel != 0) { + if (placesModel != nullptr) { m_placesSelector = new KUrlNavigatorPlacesSelector(q, placesModel); connect(m_placesSelector, SIGNAL(placeActivated(QUrl)), q, SLOT(setLocationUrl(QUrl))); @@ -264,7 +264,7 @@ connect(m_toggleEditableMode, SIGNAL(clicked()), q, SLOT(slotToggleEditableButtonPressed())); - if (m_placesSelector != 0) { + if (m_placesSelector != nullptr) { m_layout->addWidget(m_placesSelector); } m_layout->addWidget(m_protocols); @@ -389,7 +389,7 @@ const QPoint pos = q->mapToGlobal(m_dropDownButton->geometry().bottomRight()); const QAction *activatedAction = popup->exec(pos); - if (activatedAction != 0) { + if (activatedAction != nullptr) { const QUrl url(activatedAction->data().toString()); q->setLocationUrl(url); } @@ -515,7 +515,7 @@ void KUrlNavigator::Private::updateContent() { const QUrl currentUrl = q->locationUrl(); - if (m_placesSelector != 0) { + if (m_placesSelector != nullptr) { m_placesSelector->updateSelection(currentUrl); } @@ -540,7 +540,7 @@ // Calculate the start index for the directories that should be shown as buttons // and create the buttons QUrl placeUrl; - if ((m_placesSelector != 0) && !m_showFullPath) { + if ((m_placesSelector != nullptr) && !m_showFullPath) { placeUrl = m_placesSelector->selectedPlaceUrl(); } @@ -575,7 +575,7 @@ const QString dirName = path.section(QLatin1Char('/'), idx, idx); hasNext = isFirstButton || !dirName.isEmpty(); if (hasNext) { - KUrlNavigatorButton *button = 0; + KUrlNavigatorButton *button = nullptr; if (createButton) { button = new KUrlNavigatorButton(buttonUrl(idx), q); button->installEventFilter(q); @@ -644,11 +644,11 @@ // Subtract all widgets from the available width, that must be shown anyway int availableWidth = q->width() - m_toggleEditableMode->minimumWidth(); - if ((m_placesSelector != 0) && m_placesSelector->isVisible()) { + if ((m_placesSelector != nullptr) && m_placesSelector->isVisible()) { availableWidth -= m_placesSelector->width(); } - if ((m_protocols != 0) && m_protocols->isVisible()) { + if ((m_protocols != nullptr) && m_protocols->isVisible()) { availableWidth -= m_protocols->width(); } @@ -712,7 +712,7 @@ // The first URL navigator button should get the name of the // place instead of the directory name - if ((m_placesSelector != 0) && !m_showFullPath) { + if ((m_placesSelector != nullptr) && !m_showFullPath) { text = m_placesSelector->selectedPlaceText(); } @@ -824,7 +824,7 @@ KUrlNavigator::KUrlNavigator(QWidget *parent) : QWidget(parent), - d(new Private(this, 0)) + d(new Private(this, nullptr)) { d->initialize(QUrl()); } @@ -979,7 +979,7 @@ return; } - if (visible && (d->m_placesSelector == 0)) { + if (visible && (d->m_placesSelector == nullptr)) { // the places selector cannot get visible as no // places model is available return; Index: src/filewidgets/kurlnavigatorbutton.cpp =================================================================== --- src/filewidgets/kurlnavigatorbutton.cpp +++ src/filewidgets/kurlnavigatorbutton.cpp @@ -49,8 +49,8 @@ m_wheelSteps(0), m_url(url), m_subDir(), - m_openSubDirsTimer(0), - m_subDirsJob(0) + m_openSubDirsTimer(nullptr), + m_subDirsJob(nullptr) { setAcceptDrops(true); setUrl(url); @@ -317,12 +317,12 @@ m_hoverArrow = true; update(); - if (m_subDirsMenu == 0) { + if (m_subDirsMenu == nullptr) { requestSubDirs(); } else if (m_subDirsMenu->parent() != this) { m_subDirsMenu->close(); m_subDirsMenu->deleteLater(); - m_subDirsMenu = 0; + m_subDirsMenu = nullptr; requestSubDirs(); } @@ -331,7 +331,7 @@ cancelSubDirsRequest(); } delete m_subDirsMenu; - m_subDirsMenu = 0; + m_subDirsMenu = nullptr; m_hoverArrow = false; update(); } @@ -390,14 +390,14 @@ void KUrlNavigatorButton::requestSubDirs() { - if (!m_openSubDirsTimer->isActive() && (m_subDirsJob == 0)) { + if (!m_openSubDirsTimer->isActive() && (m_subDirsJob == nullptr)) { m_openSubDirsTimer->start(); } } void KUrlNavigatorButton::startSubDirsJob() { - if (m_subDirsJob != 0) { + if (m_subDirsJob != nullptr) { return; } @@ -490,7 +490,7 @@ void KUrlNavigatorButton::openSubDirsMenu(KJob *job) { Q_ASSERT(job == m_subDirsJob); - m_subDirsJob = 0; + m_subDirsJob = nullptr; if (job->error() || m_subDirs.isEmpty()) { // clear listing @@ -502,10 +502,10 @@ setDisplayHintEnabled(PopupActiveHint, true); update(); // ensure the button is drawn highlighted - if (m_subDirsMenu != 0) { + if (m_subDirsMenu != nullptr) { m_subDirsMenu->close(); m_subDirsMenu->deleteLater(); - m_subDirsMenu = 0; + m_subDirsMenu = nullptr; } m_subDirsMenu = new KUrlNavigatorMenu(this); @@ -527,7 +527,7 @@ m_subDirs.clear(); delete m_subDirsMenu; - m_subDirsMenu = 0; + m_subDirsMenu = nullptr; setDisplayHintEnabled(PopupActiveHint, false); } @@ -535,7 +535,7 @@ void KUrlNavigatorButton::replaceButton(KJob *job) { Q_ASSERT(job == m_subDirsJob); - m_subDirsJob = 0; + m_subDirsJob = nullptr; m_replaceButton = false; if (job->error() || m_subDirs.isEmpty()) { @@ -575,9 +575,9 @@ void KUrlNavigatorButton::cancelSubDirsRequest() { m_openSubDirsTimer->stop(); - if (m_subDirsJob != 0) { + if (m_subDirsJob != nullptr) { m_subDirsJob->kill(); - m_subDirsJob = 0; + m_subDirsJob = nullptr; } } Index: src/filewidgets/kurlnavigatormenu.cpp =================================================================== --- src/filewidgets/kurlnavigatormenu.cpp +++ src/filewidgets/kurlnavigatormenu.cpp @@ -53,7 +53,7 @@ void KUrlNavigatorMenu::dropEvent(QDropEvent *event) { QAction *action = actionAt(event->pos()); - if (action != 0) { + if (action != nullptr) { emit urlsDropped(action, event); } } @@ -61,7 +61,7 @@ void KUrlNavigatorMenu::mouseReleaseEvent(QMouseEvent *event) { QAction *action = actionAt(event->pos()); - if (action != 0) { + if (action != nullptr) { Qt::MouseButton btn = event->button(); emit mouseButtonClicked(action, btn); } Index: src/filewidgets/kurlnavigatorplacesselector.cpp =================================================================== --- src/filewidgets/kurlnavigatorplacesselector.cpp +++ src/filewidgets/kurlnavigatorplacesselector.cpp @@ -103,7 +103,7 @@ const QModelIndex index = m_placesModel->index(m_selectedItem, 0); QAction *teardown = m_placesModel->teardownActionForIndex(index); - if (teardown != 0) { + if (teardown != nullptr) { teardown->setParent(m_placesMenu); teardown->setData("teardownAction"); @@ -192,7 +192,7 @@ void KUrlNavigatorPlacesSelector::activatePlace(QAction *action) { - Q_ASSERT(action != 0); + Q_ASSERT(action != nullptr); if (action->data().toString() == QLatin1String("teardownAction")) { QModelIndex index = m_placesModel->index(m_selectedItem, 0); m_placesModel->requestTeardown(index); Index: src/filewidgets/kurlnavigatorprotocolcombo.cpp =================================================================== --- src/filewidgets/kurlnavigatorprotocolcombo.cpp +++ src/filewidgets/kurlnavigatorprotocolcombo.cpp @@ -41,7 +41,7 @@ KUrlNavigatorProtocolCombo::KUrlNavigatorProtocolCombo(const QString &protocol, QWidget *parent) : KUrlNavigatorButtonBase(parent), - m_menu(0), + m_menu(nullptr), m_protocols(), m_categories() { Index: src/filewidgets/kurlnavigatorprotocolcombo_p.h =================================================================== --- src/filewidgets/kurlnavigatorprotocolcombo_p.h +++ src/filewidgets/kurlnavigatorprotocolcombo_p.h @@ -43,7 +43,7 @@ Q_OBJECT public: - explicit KUrlNavigatorProtocolCombo(const QString &protocol, QWidget *parent = 0); + explicit KUrlNavigatorProtocolCombo(const QString &protocol, QWidget *parent = nullptr); QString currentProtocol() const; Index: src/ioslaves/file/file.cpp =================================================================== --- src/ioslaves/file/file.cpp +++ src/ioslaves/file/file.cpp @@ -154,7 +154,7 @@ } FileProtocol::FileProtocol(const QByteArray &pool, const QByteArray &app) - : SlaveBase(QByteArrayLiteral("file"), pool, app), mFile(0) + : SlaveBase(QByteArrayLiteral("file"), pool, app), mFile(nullptr) { } @@ -182,7 +182,7 @@ const QString defaultACLString = metaData(QStringLiteral("DEFAULT_ACL_STRING")); // Empty strings mean leave as is if (!ACLString.isEmpty()) { - acl_t acl = 0; + acl_t acl = nullptr; if (ACLString == QLatin1String("ACL_DELETE")) { // user told us to delete the extended ACL, so let's write only // the minimal (UNIX permission bits) part @@ -526,7 +526,7 @@ Q_ASSERT(mFile); delete mFile; - mFile = 0; + mFile = nullptr; finished(); } @@ -1248,7 +1248,7 @@ bool FileProtocol::isExtendedACL(acl_t acl) { - return (acl_equiv_mode(acl, 0) != 0); + return (acl_equiv_mode(acl, nullptr) != 0); } static void appendACLAtoms(const QByteArray &path, UDSEntry &entry, mode_t type) @@ -1258,8 +1258,8 @@ return; } - acl_t acl = 0; - acl_t defaultAcl = 0; + acl_t acl = nullptr; + acl_t defaultAcl = nullptr; bool isDir = (type & QT_STAT_MASK) == QT_STAT_DIR; // do we have an acl for the file, and/or a default acl for the dir, if it is one? acl = acl_get_file(path.data(), ACL_TYPE_ACCESS); @@ -1269,7 +1269,7 @@ if (acl) { if (!FileProtocol::isExtendedACL(acl)) { acl_free(acl); - acl = 0; + acl = nullptr; } } defaultAcl = acl_get_file(path.data(), ACL_TYPE_DEFAULT); Index: src/ioslaves/file/file_unix.cpp =================================================================== --- src/ioslaves/file/file_unix.cpp +++ src/ioslaves/file/file_unix.cpp @@ -153,7 +153,7 @@ if (acl && !isExtendedACL(acl)) { // qDebug() << _dest.data() << " doesn't have extended ACL"; acl_free(acl); - acl = NULL; + acl = nullptr; } #endif totalSize(buff_src.st_size); @@ -312,7 +312,7 @@ const QString path(url.toLocalFile()); const QByteArray _path(QFile::encodeName(path)); DIR *dp = opendir(_path.data()); - if (dp == 0) { + if (dp == nullptr) { switch (errno) { case ENOENT: error(KIO::ERR_DOES_NOT_EXIST, path); @@ -356,7 +356,7 @@ QT_STATBUF st; #endif QT_DIRENT *ep; - while ((ep = QT_READDIR(dp)) != 0) { + while ((ep = QT_READDIR(dp)) != nullptr) { entry.clear(); const QString filename = QFile::decodeName(ep->d_name); Index: src/ioslaves/ftp/ftp.h =================================================================== --- src/ioslaves/ftp/ftp.h +++ src/ioslaves/ftp/ftp.h @@ -141,7 +141,7 @@ * was changed during login. * @return true on success. */ - bool ftpLogin(bool *userChanged = 0); + bool ftpLogin(bool *userChanged = nullptr); /** * ftpSendCmd - send a command (@p cmd) and read response Index: src/ioslaves/ftp/ftp.cpp =================================================================== --- src/ioslaves/ftp/ftp.cpp +++ src/ioslaves/ftp/ftp.cpp @@ -207,7 +207,7 @@ // init other members m_port = 0; - m_socketProxyAuth = 0; + m_socketProxyAuth = nullptr; } Ftp::~Ftp() @@ -257,7 +257,7 @@ m_iRespCode = 0; if (!pTxt) { - return 0; // avoid using a NULL when calling atoi. + return nullptr; // avoid using a NULL when calling atoi. } // If the server sends a multiline response starting with @@ -1634,19 +1634,19 @@ // we should always get the following 5 fields ... const char *p_access, *p_junk, *p_owner, *p_group, *p_size; - if ((p_access = strtok((char *)buffer, " ")) == 0) { + if ((p_access = strtok((char *)buffer, " ")) == nullptr) { continue; } - if ((p_junk = strtok(NULL, " ")) == 0) { + if ((p_junk = strtok(nullptr, " ")) == nullptr) { continue; } - if ((p_owner = strtok(NULL, " ")) == 0) { + if ((p_owner = strtok(nullptr, " ")) == nullptr) { continue; } - if ((p_group = strtok(NULL, " ")) == 0) { + if ((p_group = strtok(nullptr, " ")) == nullptr) { continue; } - if ((p_size = strtok(NULL, " ")) == 0) { + if ((p_size = strtok(nullptr, " ")) == nullptr) { continue; } @@ -1662,9 +1662,9 @@ // A special hack for "/dev". A listing may look like this: // crw-rw-rw- 1 root root 1, 5 Jun 29 1997 zero // So we just ignore the number in front of the ",". Ok, it is a hack :-) - if (strchr(p_size, ',') != 0L) { + if (strchr(p_size, ',') != nullptr) { qCDebug(KIO_FTP) << "Size contains a ',' -> reading size again (/dev hack)"; - if ((p_size = strtok(NULL, " ")) == 0) { + if ((p_size = strtok(nullptr, " ")) == nullptr) { continue; } } @@ -1676,17 +1676,17 @@ if (!isdigit(*p_size)) { p_date_1 = p_size; p_size = p_group; - p_group = 0; + p_group = nullptr; qCDebug(KIO_FTP) << "Size didn't have a digit -> size=" << p_size << " date_1=" << p_date_1; } else { - p_date_1 = strtok(NULL, " "); + p_date_1 = strtok(nullptr, " "); qCDebug(KIO_FTP) << "Size has a digit -> ok. p_date_1=" << p_date_1; } - if (p_date_1 != 0 && - (p_date_2 = strtok(NULL, " ")) != 0 && - (p_date_3 = strtok(NULL, " ")) != 0 && - (p_name = strtok(NULL, "\r\n")) != 0) { + if (p_date_1 != nullptr && + (p_date_2 = strtok(nullptr, " ")) != nullptr && + (p_date_3 = strtok(nullptr, " ")) != nullptr && + (p_name = strtok(nullptr, "\r\n")) != nullptr) { { QByteArray tmp(p_name); if (p_access[0] == 'l') { @@ -2279,7 +2279,7 @@ // skip leading "213 " (response code) const char *psz = ftpResponse(4); - return psz != 0; + return psz != nullptr; } // Today the differences between ASCII and BINARY are limited to @@ -2638,7 +2638,7 @@ cacheAuthentication(a); } delete m_socketProxyAuth; - m_socketProxyAuth = 0; + m_socketProxyAuth = nullptr; } void Ftp::fixupEntryName(FtpEntry *e) Index: src/ioslaves/help/kio_help.cpp =================================================================== --- src/ioslaves/help/kio_help.cpp +++ src/ioslaves/help/kio_help.cpp @@ -145,7 +145,7 @@ } -HelpProtocol *slave = 0; +HelpProtocol *slave = nullptr; HelpProtocol::HelpProtocol(bool ghelp, const QByteArray &pool, const QByteArray &app) : SlaveBase(ghelp ? "ghelp" : "help", pool, app), mGhelp(ghelp) Index: src/ioslaves/http/http.h =================================================================== --- src/ioslaves/http/http.h +++ src/ioslaves/http/http.h @@ -85,7 +85,7 @@ useCache = false; ioMode = NoCache; bytesCached = 0; - file = 0; + file = nullptr; } enum CachePlan { Index: src/ioslaves/http/http.cpp =================================================================== --- src/ioslaves/http/http.cpp +++ src/ioslaves/http/http.cpp @@ -278,7 +278,7 @@ } if (!device->open(QIODevice::ReadWrite)) { - return 0; + return nullptr; } return device; @@ -371,16 +371,16 @@ , m_iSize(NO_SIZE) , m_iPostDataSize(NO_SIZE) , m_isBusy(false) - , m_POSTbuf(0) + , m_POSTbuf(nullptr) , m_maxCacheAge(DEFAULT_MAX_CACHE_AGE) , m_maxCacheSize(DEFAULT_MAX_CACHE_SIZE) , m_protocol(protocol) - , m_wwwAuth(0) + , m_wwwAuth(nullptr) , m_triedWwwCredentials(NoCredentials) - , m_proxyAuth(0) + , m_proxyAuth(nullptr) , m_triedProxyCredentials(NoCredentials) - , m_socketProxyAuth(0) - , m_networkConfig(0) + , m_socketProxyAuth(nullptr) + , m_networkConfig(nullptr) , m_kioError(0) , m_isLoadingErrorPage(false) , m_remoteRespTimeout(DEFAULT_RESPONSE_TIMEOUT) @@ -403,8 +403,8 @@ delete m_proxyAuth; delete m_wwwAuth; - m_proxyAuth = 0; - m_wwwAuth = 0; + m_proxyAuth = nullptr; + m_wwwAuth = nullptr; m_request.proxyUrl.clear(); //TODO revisit m_request.proxyUrls.clear(); @@ -535,9 +535,9 @@ m_request.prevResponseCode = 0; delete m_wwwAuth; - m_wwwAuth = 0; + m_wwwAuth = nullptr; delete m_socketProxyAuth; - m_socketProxyAuth = 0; + m_socketProxyAuth = nullptr; m_blacklistedWwwAuthMethods.clear(); m_triedWwwCredentials = NoCredentials; m_blacklistedProxyAuthMethods.clear(); @@ -1308,7 +1308,7 @@ // force re-authentication... delete m_wwwAuth; - m_wwwAuth = 0; + m_wwwAuth = nullptr; } } @@ -1388,7 +1388,7 @@ m_request.cacheTag.policy = CC_Reload; // force re-authentication... delete m_wwwAuth; - m_wwwAuth = 0; + m_wwwAuth = nullptr; proceedUntilResponseHeader(); } @@ -3178,7 +3178,7 @@ // get the size of our data tIt = tokenizer.iterator("content-length"); if (tIt.hasNext()) { - m_iSize = STRTOLL(tIt.next().constData(), 0, 10); + m_iSize = STRTOLL(tIt.next().constData(), nullptr, 10); } tIt = tokenizer.iterator("content-location"); @@ -4131,7 +4131,7 @@ } Q_ASSERT(bufPos > 2); - long long nextChunkSize = STRTOLL(m_receiveBuf.data(), 0, 16); + long long nextChunkSize = STRTOLL(m_receiveBuf.data(), nullptr, 16); if (nextChunkSize < 0) { qCDebug(KIO_HTTP) << "Negative chunk size"; return -1; @@ -4416,7 +4416,7 @@ // any transfer-encoding applied to the message-body. If the message is // received with a transfer-encoding, that encoding MUST be removed // prior to checking the Content-MD5 value against the received entity. - HTTPFilterMD5 *md5Filter = 0; + HTTPFilterMD5 *md5Filter = nullptr; if (useMD5) { md5Filter = new HTTPFilterMD5; chain.addFilter(md5Filter); @@ -4879,7 +4879,7 @@ qCDebug(KIO_HTTP) << "deleting expired cache entry and recreating."; file->remove(); delete file; - file = 0; + file = nullptr; } // note that QTemporaryFile will automatically append random chars to filename @@ -4954,7 +4954,7 @@ // on windows open files can't be renamed tempFile->setAutoRemove(false); delete tempFile; - file = 0; + file = nullptr; if (!QFile::rename(oldName, newName)) { // ### currently this hides a minor bug when force-reloading a resource. We @@ -4972,7 +4972,7 @@ ccCommand = makeCacheCleanerCommand(m_request.cacheTag, UpdateFileCommand); } delete file; - file = 0; + file = nullptr; if (!ccCommand.isEmpty()) { sendCacheCleanerCommand(ccCommand); @@ -5092,7 +5092,7 @@ } delete m_POSTbuf; - m_POSTbuf = 0; + m_POSTbuf = nullptr; } bool HTTPProtocol::retrieveAllData() @@ -5233,7 +5233,7 @@ info.verifyPath = info.realmValue.isEmpty(); const bool haveCachedCredentials = checkCachedAuthentication(info); - const bool retryAuth = (m_socketProxyAuth != 0); + const bool retryAuth = (m_socketProxyAuth != nullptr); // if m_socketProxyAuth is a valid pointer then authentication has been attempted before, // and it was not successful. see below and saveProxyAuthenticationForSocket(). @@ -5257,7 +5257,7 @@ qCDebug(KIO_HTTP) << "proxy auth cancelled by user, or communication error"; error(errorCode, QString()); delete m_proxyAuth; - m_proxyAuth = 0; + m_proxyAuth = nullptr; return; } } @@ -5294,14 +5294,14 @@ cacheAuthentication(a); } delete m_socketProxyAuth; - m_socketProxyAuth = 0; + m_socketProxyAuth = nullptr; } void HTTPProtocol::saveAuthenticationData() { KIO::AuthInfo authinfo; bool alreadyCached = false; - KAbstractHttpAuthentication *auth = 0; + KAbstractHttpAuthentication *auth = nullptr; switch (m_request.prevResponseCode) { case 401: auth = m_wwwAuth; @@ -5406,7 +5406,7 @@ blacklistedAuthTokens->append(scheme); } delete *auth; - *auth = 0; + *auth = nullptr; } else { // Create authentication header // WORKAROUND: The following piece of code prevents brain dead IIS // servers that send back multiple "WWW-Authenticate" headers from @@ -5445,7 +5445,7 @@ if (qstrnicmp(authScheme.constData(), bestOffer.constData(), authScheme.length()) != 0) { // huh, the strongest authentication scheme offered has changed. delete *auth; - *auth = 0; + *auth = nullptr; } } @@ -5497,7 +5497,7 @@ } qCDebug(KIO_HTTP) << "looks like the user canceled the authentication dialog"; delete *auth; - *auth = 0; + *auth = nullptr; } *triedCredentials = UserInputCredentials; } else { @@ -5614,7 +5614,7 @@ // force re-authentication... delete m_wwwAuth; - m_wwwAuth = 0; + m_wwwAuth = nullptr; return true; } Index: src/ioslaves/http/http_cache_cleaner.cpp =================================================================== --- src/ioslaves/http/http_cache_cleaner.cpp +++ src/ioslaves/http/http_cache_cleaner.cpp @@ -617,7 +617,7 @@ // Delete some of the files that need to be deleted. Return true when done, false otherwise. // This makes interleaved cleaning / serving ioslaves possible. - bool processSlice(Scoreboard *scoreboard = 0) + bool processSlice(Scoreboard *scoreboard = nullptr) { QTime t; t.start(); @@ -790,7 +790,7 @@ qint64 newBytesCounter = LLONG_MAX; // force cleaner run on startup Scoreboard scoreboard; - CacheCleaner *cleaner = 0; + CacheCleaner *cleaner = nullptr; while (true) { g_currentDate = QDateTime::currentDateTime(); if (cleaner) { @@ -838,7 +838,7 @@ if (cleaner->processSlice(&scoreboard)) { // that was the last slice, done delete cleaner; - cleaner = 0; + cleaner = nullptr; } } else if (newBytesCounter > (g_maxCacheSize / 8)) { cacheDir.refresh(); Index: src/ioslaves/http/httpauthentication.h =================================================================== --- src/ioslaves/http/httpauthentication.h +++ src/ioslaves/http/httpauthentication.h @@ -40,7 +40,7 @@ class KAbstractHttpAuthentication { public: - KAbstractHttpAuthentication(KConfigGroup *config = 0); + KAbstractHttpAuthentication(KConfigGroup *config = nullptr); virtual ~KAbstractHttpAuthentication(); /** @@ -57,7 +57,7 @@ * @param offer the header from which an authentication object is created. * @param config the config object to read stored authentication information. */ - static KAbstractHttpAuthentication *newAuth(const QByteArray &offer, KConfigGroup *config = 0); + static KAbstractHttpAuthentication *newAuth(const QByteArray &offer, KConfigGroup *config = nullptr); /** * Split all headers containing multiple authentication offers. @@ -225,7 +225,7 @@ } private: friend class KAbstractHttpAuthentication; - KHttpBasicAuthentication(KConfigGroup *config = 0) + KHttpBasicAuthentication(KConfigGroup *config = nullptr) : KAbstractHttpAuthentication(config) {} }; @@ -251,7 +251,7 @@ } private: friend class KAbstractHttpAuthentication; - KHttpDigestAuthentication(KConfigGroup *config = 0) + KHttpDigestAuthentication(KConfigGroup *config = nullptr) : KAbstractHttpAuthentication(config) {} #ifdef ENABLE_HTTP_AUTH_NONCE_SETTER QByteArray m_nonce; @@ -267,7 +267,7 @@ void generateResponse(const QString &user, const QString &password) Q_DECL_OVERRIDE; private: friend class KAbstractHttpAuthentication; - KHttpNtlmAuthentication(KConfigGroup *config = 0) + KHttpNtlmAuthentication(KConfigGroup *config = nullptr) : KAbstractHttpAuthentication(config), m_stage1State(Init) {} enum Stage1State { Init = 0, @@ -287,7 +287,7 @@ void generateResponse(const QString &user, const QString &password) Q_DECL_OVERRIDE; private: friend class KAbstractHttpAuthentication; - KHttpNegotiateAuthentication(KConfigGroup *config = 0) + KHttpNegotiateAuthentication(KConfigGroup *config = nullptr) : KAbstractHttpAuthentication(config) {} }; #endif // HAVE_LIBGSSAPI Index: src/ioslaves/http/httpauthentication.cpp =================================================================== --- src/ioslaves/http/httpauthentication.cpp +++ src/ioslaves/http/httpauthentication.cpp @@ -75,7 +75,7 @@ // keys on even indexes, values on odd indexes. Reduces code expansion for the templated // alternatives. // If "ba" starts with empty content it will be removed from ba to simplify later calls -static QList parseChallenge(QByteArray &ba, QByteArray *scheme, QByteArray *nextAuth = 0) +static QList parseChallenge(QByteArray &ba, QByteArray *scheme, QByteArray *nextAuth = nullptr) { QList values; const char *b = ba.constData(); @@ -275,7 +275,7 @@ } else if (scheme == "basic") { // krazy:exclude=strings return new KHttpBasicAuthentication(); } - return 0; + return nullptr; } QList< QByteArray > KAbstractHttpAuthentication::splitOffers(const QList< QByteArray > &offers) @@ -876,7 +876,7 @@ major_status = gss_import_name(&minor_status, &input_token, GSS_C_NT_HOSTBASED_SERVICE, &server); - input_token.value = NULL; + input_token.value = nullptr; input_token.length = 0; if (GSS_ERROR(major_status)) { @@ -897,8 +897,8 @@ &ctx, server, mech_oid, req_flags, GSS_C_INDEFINITE, GSS_C_NO_CHANNEL_BINDINGS, - GSS_C_NO_BUFFER, NULL, &output_token, - NULL, NULL); + GSS_C_NO_BUFFER, nullptr, &output_token, + nullptr, nullptr); if (GSS_ERROR(major_status) || (output_token.length == 0)) { qCDebug(KIO_HTTP_AUTH) << "gss_init_sec_context failed:" << gssError(major_status, minor_status); Index: src/ioslaves/http/httpfilter.cpp =================================================================== --- src/ioslaves/http/httpfilter.cpp +++ src/ioslaves/http/httpfilter.cpp @@ -41,7 +41,7 @@ */ HTTPFilterBase::HTTPFilterBase() - : last(0) + : last(nullptr) { } @@ -59,7 +59,7 @@ } HTTPFilterChain::HTTPFilterChain() - : first(0) + : first(nullptr) { } @@ -69,7 +69,7 @@ if (!last) { first = filter; } else { - disconnect(last, SIGNAL(output(QByteArray)), 0, 0); + disconnect(last, SIGNAL(output(QByteArray)), nullptr, nullptr); filter->chain(last); } last = filter; Index: src/ioslaves/http/kcookiejar/kcookiejar.h =================================================================== --- src/ioslaves/http/kcookiejar/kcookiejar.h +++ src/ioslaves/http/kcookiejar/kcookiejar.h @@ -242,7 +242,7 @@ * approved yet by the user but that will be included in the result * none the less. */ - QString findCookies(const QString &_url, bool useDOMFormat, WId windowId, KHttpCookieList *pendingCookies = 0); + QString findCookies(const QString &_url, bool useDOMFormat, WId windowId, KHttpCookieList *pendingCookies = nullptr); /** * This function parses cookie_headers and returns a linked list of @@ -406,7 +406,7 @@ /** * Parses _url and returns the FQDN (_fqdn) and path (_path). */ - static bool parseUrl(const QString &_url, QString &_fqdn, QString &_path, int *port = 0); + static bool parseUrl(const QString &_url, QString &_fqdn, QString &_path, int *port = nullptr); /** * Returns a list of domains in @p _domainList relevant for this host. Index: src/ioslaves/http/kcookiejar/kcookiejar.cpp =================================================================== --- src/ioslaves/http/kcookiejar/kcookiejar.cpp +++ src/ioslaves/http/kcookiejar/kcookiejar.cpp @@ -108,7 +108,7 @@ "dd-MMM-yyyy HH:mm:ss 'GMT'", /* cookies.test: Y2K38 problem: 06-Dec-2039 00:30:42 GMT */ "MMM dd HH:mm:ss yyyy 'GMT'", /* cookies.test: Non-standard expiration dates: Sep 12 07:00:00 2020 GMT */ "MMM dd yyyy HH:mm:ss 'GMT'", /* cookies.test: Non-standard expiration dates: Sep 12 2020 07:00:00 GMT */ - 0 + nullptr }; for (int i = 0; date_formats[i]; ++i) { @@ -377,10 +377,10 @@ KHttpCookieList allCookies; for (QStringList::ConstIterator it = domains.constBegin(), itEnd = domains.constEnd();; ++it) { - KHttpCookieList *cookieList = 0; + KHttpCookieList *cookieList = nullptr; if (it == itEnd) { cookieList = pendingCookies; // Add pending cookies - pendingCookies = 0; + pendingCookies = nullptr; if (!cookieList) { break; } @@ -1389,7 +1389,7 @@ return result; } -static QString extractHostAndPorts(const QString &str, QList *ports = 0) +static QString extractHostAndPorts(const QString &str, QList *ports = nullptr) { if (str.isEmpty()) { return str; @@ -1477,7 +1477,7 @@ bool secure = false; bool httpOnly = false; bool explicitPath = false; - const char *value = 0; + const char *value = nullptr; if ((version == 2) || (protVer >= 200)) { if (protVer >= 200) { protVer -= 200; Index: src/ioslaves/http/kcookiejar/kcookieserver.h =================================================================== --- src/ioslaves/http/kcookiejar/kcookieserver.h +++ src/ioslaves/http/kcookiejar/kcookieserver.h @@ -81,7 +81,7 @@ void shutdown(); public: - bool cookiesPending(const QString &url, KHttpCookieList *cookieList = 0); + bool cookiesPending(const QString &url, KHttpCookieList *cookieList = nullptr); void addCookies(const QString &url, const QByteArray &cookieHeader, qlonglong windowId, bool useDOMFormat); void checkCookies(KHttpCookieList *cookieList); Index: src/ioslaves/http/kcookiejar/kcookieserver.cpp =================================================================== --- src/ioslaves/http/kcookiejar/kcookieserver.cpp +++ src/ioslaves/http/kcookiejar/kcookieserver.cpp @@ -175,7 +175,7 @@ if (!mAdvicePending) { mAdvicePending = true; while (!mPendingCookies->isEmpty()) { - checkCookies(0, windowId); + checkCookies(nullptr, windowId); } mAdvicePending = false; } @@ -234,7 +234,7 @@ } //qDebug() << shownCookies; - KCookieWin *kw = new KCookieWin(0L, currentList, + KCookieWin *kw = new KCookieWin(nullptr, currentList, mCookieJar->preferredDefaultPolicy(), mCookieJar->showCookieDetails()); if (windowId > 0) { Index: src/ioslaves/http/kcookiejar/kcookiewin.h =================================================================== --- src/ioslaves/http/kcookiejar/kcookiewin.h +++ src/ioslaves/http/kcookiejar/kcookiewin.h @@ -39,7 +39,7 @@ Q_OBJECT public: - KCookieDetail(KHttpCookieList cookieList, int cookieCount, QWidget *parent = 0); + KCookieDetail(KHttpCookieList cookieList, int cookieCount, QWidget *parent = nullptr); ~KCookieDetail(); private Q_SLOTS: Index: src/ioslaves/telnet/ktelnetservice.cpp =================================================================== --- src/ioslaves/telnet/ktelnetservice.cpp +++ src/ioslaves/telnet/ktelnetservice.cpp @@ -64,7 +64,7 @@ } if (!KAuthorized::authorize(QStringLiteral("shell_access"))) { - QMessageBox::critical(0, i18n("Access denied"), + QMessageBox::critical(nullptr, i18n("Access denied"), i18n("You do not have permission to access the %1 protocol.", url.scheme())); return 3; } Index: src/ioslaves/trash/kcmtrash.cpp =================================================================== --- src/ioslaves/trash/kcmtrash.cpp +++ src/ioslaves/trash/kcmtrash.cpp @@ -314,7 +314,7 @@ mLimitReachedAction->setWhatsThis(xi18nc("@info:whatsthis", "When the size limit is reached, it will prefer to delete the type of files that you specify, first. " "If this is set to warn you, it will do so instead of automatically deleting files.")); - sizeWidgetLayout->addRow(0, mLimitReachedAction); + sizeWidgetLayout->addRow(nullptr, mLimitReachedAction); layout->addStretch(); } Index: src/ioslaves/trash/kio_trash.cpp =================================================================== --- src/ioslaves/trash/kio_trash.cpp +++ src/ioslaves/trash/kio_trash.cpp @@ -53,7 +53,7 @@ // necessary to use other kio slaves QCoreApplication app(argc, argv); - KIO::setDefaultJobUiDelegateExtension(0); + KIO::setDefaultJobUiDelegateExtension(nullptr); // start the slave TrashProtocol slave(argv[1], argv[2], argv[3]); slave.dispatchLoop(); Index: src/ioslaves/trash/tests/testtrash.cpp =================================================================== --- src/ioslaves/trash/tests/testtrash.cpp +++ src/ioslaves/trash/tests/testtrash.cpp @@ -465,7 +465,7 @@ } KIO::CopyJob *job = KIO::move(u, QUrl(QStringLiteral("trash:/")), KIO::HideProgressInfo); - job->setUiDelegate(0); // no skip dialog, thanks + job->setUiDelegate(nullptr); // no skip dialog, thanks bool ok = job->exec(); QVERIFY(!ok); QMap metaData = job->metaData(); @@ -974,7 +974,7 @@ } KIO::CopyJob *job = KIO::move(u, QUrl(QStringLiteral("trash:/")), KIO::HideProgressInfo); - job->setUiDelegate(0); // no skip dialog, thanks + job->setUiDelegate(nullptr); // no skip dialog, thanks bool ok = job->exec(); QVERIFY(!ok); QMap metaData = job->metaData(); Index: src/ioslaves/trash/trashimpl.cpp =================================================================== --- src/ioslaves/trash/trashimpl.cpp +++ src/ioslaves/trash/trashimpl.cpp @@ -478,7 +478,7 @@ //qCDebug(KIO_TRASH) << urlSrc << "->" << urlDest; KIO::CopyJob *job = KIO::moveAs(urlSrc, urlDest, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); connect(job, SIGNAL(result(KJob*)), this, SLOT(jobFinished(KJob*))); enterLoop(); @@ -538,7 +538,7 @@ QUrl urlDest = QUrl::fromLocalFile(dest); //qCDebug(KIO_TRASH) << "copying" << src << "to" << dest; KIO::CopyJob *job = KIO::copyAs(urlSrc, urlDest, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); connect(job, SIGNAL(result(KJob*)), this, SLOT(jobFinished(KJob*))); enterLoop(); @@ -871,7 +871,7 @@ ep = readdir(dp); // ignore '.' and '..' dirent ep = readdir(dp); // look for third file closedir(dp); - if (ep != 0) { + if (ep != nullptr) { //qCDebug(KIO_TRASH) << ep->d_name << "in" << infoPath << "-> not empty"; return false; // not empty } Index: src/kcms/kio/kcookiesmain.cpp =================================================================== --- src/kcms/kio/kcookiesmain.cpp +++ src/kcms/kio/kcookiesmain.cpp @@ -29,7 +29,7 @@ KCookiesMain::KCookiesMain (QWidget* parent, const QVariantList&) : KCModule (/*KioConfigFactory::componentData(),*/ parent) { - management = 0; + management = nullptr; bool managerOK = true; QVBoxLayout* layout = new QVBoxLayout (this); Index: src/kcms/kio/kcookiesmanagement.cpp =================================================================== --- src/kcms/kio/kcookiesmanagement.cpp +++ src/kcms/kio/kcookiesmanagement.cpp @@ -59,7 +59,7 @@ CookieListViewItem::CookieListViewItem(QTreeWidget *parent, const QString &dom) :QTreeWidgetItem(parent) { - init( 0, dom ); + init( nullptr, dom ); } CookieListViewItem::CookieListViewItem(QTreeWidgetItem *parent, CookieProp *cookie) @@ -102,7 +102,7 @@ CookieProp* CookieListViewItem::leaveCookie() { CookieProp *ret = mCookie; - mCookie = 0; + mCookie = nullptr; return ret; } @@ -342,7 +342,7 @@ { if (item) { CookieListViewItem* cookieItem = static_cast(item); - CookieProp *cookie = (cookieItem ? cookieItem->cookie() : 0); + CookieProp *cookie = (cookieItem ? cookieItem->cookie() : nullptr); if (cookie) { if (cookie->allLoaded || cookieDetails(cookie)) { Index: src/kcms/kio/kcookiespolicies.cpp =================================================================== --- src/kcms/kio/kcookiespolicies.cpp +++ src/kcms/kio/kcookiespolicies.cpp @@ -216,7 +216,7 @@ bool KCookiesPolicies::handleDuplicate (const QString& domain, int advice) { QTreeWidgetItem* item = mUi.policyTreeWidget->topLevelItem (0); - while (item != 0) { + while (item != nullptr) { if (item->text (0) == domain) { const int res = KMessageBox::warningContinueCancel (this, i18n ("A policy already exists for" @@ -240,7 +240,7 @@ void KCookiesPolicies::deletePressed() { - QTreeWidgetItem* nextItem = 0L; + QTreeWidgetItem* nextItem = nullptr; Q_FOREACH (QTreeWidgetItem * item, mUi.policyTreeWidget->selectedItems()) { nextItem = mUi.policyTreeWidget->itemBelow (item); @@ -388,7 +388,7 @@ QDBusInterface kded (QStringLiteral("org.kde.kcookiejar5"), QStringLiteral("/modules/kcookiejar"), QStringLiteral("org.kde.KCookieServer"), QDBusConnection::sessionBus()); QDBusReply reply = kded.call (QStringLiteral("reloadPolicy")); if (!reply.isValid()) - KMessageBox::sorry (0, i18n ("Unable to communicate with the cookie handler service.\n" + KMessageBox::sorry (nullptr, i18n ("Unable to communicate with the cookie handler service.\n" "Any changes you made will not take effect until the service " "is restarted.")); } Index: src/kcms/kio/kcookiespolicyselectiondlg.h =================================================================== --- src/kcms/kio/kcookiespolicyselectiondlg.h +++ src/kcms/kio/kcookiespolicyselectiondlg.h @@ -69,7 +69,7 @@ Q_OBJECT public: - explicit KCookiesPolicySelectionDlg (QWidget* parent = 0, Qt::WindowFlags f = 0); + explicit KCookiesPolicySelectionDlg (QWidget* parent = nullptr, Qt::WindowFlags f = nullptr); ~KCookiesPolicySelectionDlg () {} int advice() const; Index: src/kcms/kio/kcookiespolicyselectiondlg.cpp =================================================================== --- src/kcms/kio/kcookiespolicyselectiondlg.cpp +++ src/kcms/kio/kcookiespolicyselectiondlg.cpp @@ -63,7 +63,7 @@ KCookiesPolicySelectionDlg::KCookiesPolicySelectionDlg (QWidget* parent, Qt::WindowFlags flags) : QDialog (parent, flags) , mOldPolicy(-1) - , mButtonBox(0) + , mButtonBox(nullptr) { QWidget *mainWidget = new QWidget(this); QVBoxLayout *mainLayout = new QVBoxLayout; Index: src/kcms/kio/kproxydlg.cpp =================================================================== --- src/kcms/kio/kproxydlg.cpp +++ src/kcms/kio/kproxydlg.cpp @@ -296,7 +296,7 @@ setProxyInformation(mProxyMap.value(QStringLiteral("HttpsProxy")), proxyType, mUi.manualProxyHttpsEdit, mUi.systemProxyHttpsEdit, mUi.manualProxyHttpsSpinBox, QStringLiteral("http"), HideHttpsUrlScheme); setProxyInformation(mProxyMap.value(QStringLiteral("FtpProxy")), proxyType, mUi.manualProxyFtpEdit, mUi.systemProxyFtpEdit, mUi.manualProxyFtpSpinBox, QStringLiteral("ftp"), HideFtpUrlScheme); setProxyInformation(mProxyMap.value(QStringLiteral("SocksProxy")), proxyType, mUi.manualProxySocksEdit, mUi.systemProxySocksEdit, mUi.manualProxySocksSpinBox, QStringLiteral("socks"), HideSocksUrlScheme); - setProxyInformation(mProxyMap.value(QStringLiteral("NoProxy")), proxyType, mUi.manualNoProxyEdit, mUi.systemNoProxyEdit, 0, QString(), HideNone); + setProxyInformation(mProxyMap.value(QStringLiteral("NoProxy")), proxyType, mUi.manualNoProxyEdit, mUi.systemNoProxyEdit, nullptr, QString(), HideNone); // Check the "Use this proxy server for all protocols" if all the proxy URLs are the same... const QString httpProxy(mUi.manualProxyHttpEdit->text()); Index: src/kcms/kio/ksaveioconfig.h =================================================================== --- src/kcms/kio/ksaveioconfig.h +++ src/kcms/kio/ksaveioconfig.h @@ -73,10 +73,10 @@ void setAutoResume (bool); /** Update all running io-slaves */ -void updateRunningIOSlaves (QWidget* parent = 0L); +void updateRunningIOSlaves (QWidget* parent = nullptr); /** Update proxy scout */ -void updateProxyScout (QWidget* parent = 0L); +void updateProxyScout (QWidget* parent = nullptr); } #endif Index: src/kcms/kio/ksaveioconfig.cpp =================================================================== --- src/kcms/kio/ksaveioconfig.cpp +++ src/kcms/kio/ksaveioconfig.cpp @@ -42,7 +42,7 @@ Q_GLOBAL_STATIC(KSaveIOConfigPrivate, d) KSaveIOConfigPrivate::KSaveIOConfigPrivate () - : config(0), http_config(0) + : config(nullptr), http_config(nullptr) { } @@ -84,9 +84,9 @@ void KSaveIOConfig::reparseConfiguration () { delete d->config; - d->config = 0; + d->config = nullptr; delete d->http_config; - d->http_config = 0; + d->http_config = nullptr; } void KSaveIOConfig::setReadTimeout( int _timeout ) Index: src/kcms/kio/useragentdlg.cpp =================================================================== --- src/kcms/kio/useragentdlg.cpp +++ src/kcms/kio/useragentdlg.cpp @@ -54,8 +54,8 @@ UserAgentDlg::UserAgentDlg (QWidget* parent, const QVariantList&) : KCModule (/*ioConfigFactory::componentData(),*/ parent), - m_userAgentInfo (0), - m_config (0) + m_userAgentInfo (nullptr), + m_config (nullptr) { ui.setupUi (this); ui.newButton->setIcon (QIcon::fromTheme(QStringLiteral("list-add"))); Index: src/kcms/kio/useragentselectordlg.h =================================================================== --- src/kcms/kio/useragentselectordlg.h +++ src/kcms/kio/useragentselectordlg.h @@ -33,7 +33,7 @@ Q_OBJECT public: - explicit UserAgentSelectorDlg (UserAgentInfo* info, QWidget* parent = 0, Qt::WindowFlags f = 0); + explicit UserAgentSelectorDlg (UserAgentInfo* info, QWidget* parent = nullptr, Qt::WindowFlags f = nullptr); ~UserAgentSelectorDlg(); void setSiteName (const QString&); Index: src/kcms/kio/useragentselectordlg.cpp =================================================================== --- src/kcms/kio/useragentselectordlg.cpp +++ src/kcms/kio/useragentselectordlg.cpp @@ -69,7 +69,7 @@ UserAgentSelectorDlg::UserAgentSelectorDlg (UserAgentInfo* info, QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f), mUserAgentInfo (info), - mButtonBox(0) + mButtonBox(nullptr) { QWidget *mainWidget = new QWidget(this); QVBoxLayout *mainLayout = new QVBoxLayout; Index: src/kcms/webshortcuts/main.cpp =================================================================== --- src/kcms/webshortcuts/main.cpp +++ src/kcms/webshortcuts/main.cpp @@ -36,7 +36,7 @@ KURIFilterModule::KURIFilterModule(QWidget *parent, const QVariantList &args) : KCModule(parent, args), - m_widget(0) + m_widget(nullptr) { KAboutData *about = new KAboutData(QStringLiteral("kcm_webshortcuts"), i18n("Web Shortcuts"), QStringLiteral("0.1"), i18n("Configure enhanced browsing features"), @@ -64,7 +64,7 @@ for (; it != end; ++it) { KUriFilterPlugin *plugin = (*it)->createInstance(this); if (plugin) { - KCModule *module = plugin->configModule(this, 0); + KCModule *module = plugin->configModule(this, nullptr); if (module) { modules.append(module); helper.insert(plugin->configName(), module); Index: src/kiod/kiod_main.cpp =================================================================== --- src/kiod/kiod_main.cpp +++ src/kiod/kiod_main.cpp @@ -48,7 +48,7 @@ // Make sure this method is only called with valid module names. Q_ASSERT(name.indexOf('/') == -1); - KDEDModule *module = m_modules.value(name, 0); + KDEDModule *module = m_modules.value(name, nullptr); if (module) { return; } Index: src/kpac/proxyscout.cpp =================================================================== --- src/kpac/proxyscout.cpp +++ src/kpac/proxyscout.cpp @@ -82,10 +82,10 @@ ProxyScout::ProxyScout(QObject *parent, const QList &) : KDEDModule(parent), m_componentName(QStringLiteral("proxyscout")), - m_downloader(0), - m_script(0), + m_downloader(nullptr), + m_script(nullptr), m_suspendTime(0), - m_watcher(0), + m_watcher(nullptr), m_networkConfig(new QNetworkConfigurationManager(this)) { connect(m_networkConfig, SIGNAL(configurationChanged(QNetworkConfiguration)), SLOT(disconnectNetwork(QNetworkConfiguration))); @@ -101,7 +101,7 @@ QUrl url(checkUrl); if (m_suspendTime) { - if (std::time(0) - m_suspendTime < 300) { + if (std::time(nullptr) - m_suspendTime < 300) { return QStringList(QStringLiteral("DIRECT")); } m_suspendTime = 0; @@ -130,7 +130,7 @@ QUrl url(checkUrl); if (m_suspendTime) { - if (std::time(0) - m_suspendTime < 300) { + if (std::time(nullptr) - m_suspendTime < 300) { return QStringLiteral("DIRECT"); } m_suspendTime = 0; @@ -156,17 +156,17 @@ void ProxyScout::blackListProxy(const QString &proxy) { - m_blackList[ proxy ] = std::time(0); + m_blackList[ proxy ] = std::time(nullptr); } void ProxyScout::reset() { delete m_script; - m_script = 0; + m_script = nullptr; delete m_downloader; - m_downloader = 0; + m_downloader = nullptr; delete m_watcher; - m_watcher = 0; + m_watcher = nullptr; m_blackList.clear(); m_suspendTime = 0; KProtocolManager::reparseConfiguration(); @@ -178,7 +178,7 @@ case KProtocolManager::WPADProxy: if (m_downloader && !qobject_cast(m_downloader)) { delete m_downloader; - m_downloader = 0; + m_downloader = nullptr; } if (!m_downloader) { m_downloader = new Discovery(this); @@ -188,7 +188,7 @@ case KProtocolManager::PACProxy: { if (m_downloader && !qobject_cast(m_downloader)) { delete m_downloader; - m_downloader = 0; + m_downloader = nullptr; } if (!m_downloader) { m_downloader = new Downloader(this); @@ -204,7 +204,7 @@ proxyScriptFileChanged(url.path()); } else { delete m_watcher; - m_watcher = 0; + m_watcher = nullptr; m_downloader->download(url); } break; @@ -272,7 +272,7 @@ // Suppress further attempts for 5 minutes if (!success) { - m_suspendTime = std::time(0); + m_suspendTime = std::time(nullptr); } } @@ -334,7 +334,7 @@ if (type == Direct || !m_blackList.contains(address)) { proxyList << address; - } else if (std::time(0) - m_blackList[address] > 1800) { // 30 minutes + } else if (std::time(nullptr) - m_blackList[address] > 1800) { // 30 minutes // black listing expired m_blackList.remove(address); proxyList << address; Index: src/kpac/script.cpp =================================================================== --- src/kpac/script.cpp +++ src/kpac/script.cpp @@ -370,7 +370,7 @@ return engine->undefinedValue(); } - static const char *const days[] = { "sun", "mon", "tue", "wed", "thu", "fri", "sat", 0 }; + static const char *const days[] = { "sun", "mon", "tue", "wed", "thu", "fri", "sat", nullptr }; const int d1 = findString(context->argument(0).toString(), days); if (d1 == -1) { @@ -409,7 +409,7 @@ } static const char *const months[] = { "jan", "feb", "mar", "apr", "may", "jun", - "jul", "aug", "sep", "oct", "nov", "dec", 0 + "jul", "aug", "sep", "oct", "nov", "dec", nullptr }; QVector values; Index: src/kpasswdserver/kpasswdserver.cpp =================================================================== --- src/kpasswdserver/kpasswdserver.cpp +++ src/kpasswdserver/kpasswdserver.cpp @@ -73,7 +73,7 @@ KIO::AuthInfo::registerMetaTypes(); m_seqNr = 0; - m_wallet = 0; + m_wallet = nullptr; m_walletDisabled = false; KPasswdServerAdaptor *adaptor = new KPasswdServerAdaptor(this); @@ -503,12 +503,12 @@ { if ( m_wallet && !m_wallet->isOpen() ) { // forced closed delete m_wallet; - m_wallet = 0; + m_wallet = nullptr; } if ( !m_wallet ) m_wallet = KWallet::Wallet::openWallet( KWallet::Wallet::NetworkWallet(), (WId)(windowId)); - return m_wallet != 0; + return m_wallet != nullptr; } #endif @@ -577,7 +577,7 @@ buttonBox->button(QDialogButtonBox::Yes)->setText(i18nc("@action:button filter-continue", "Retry")); KMessageBox::createKMessageBox(dlg, buttonBox, QMessageBox::Warning, prompt, - QStringList(), QString(), 0, + QStringList(), QString(), nullptr, (KMessageBox::Notify | KMessageBox::NoExec)); #ifndef Q_WS_WIN @@ -655,7 +655,7 @@ Q_FOREACH(AuthInfoContainer *current, *authList) { if (current->expire == AuthInfoContainer::expTime && - static_cast(time(0)) > current->expireTime) + static_cast(time(nullptr)) > current->expireTime) { authList->removeOne(current); delete current; @@ -677,7 +677,7 @@ } } } - return 0; + return nullptr; } void @@ -718,7 +718,7 @@ authList = new AuthInfoContainerList; m_authDict.insert(key, authList); } - AuthInfoContainer *authItem = 0; + AuthInfoContainer *authItem = nullptr; Q_FOREACH(AuthInfoContainer* current, *authList) { if (current->info.realmValue == info.realmValue) @@ -768,7 +768,7 @@ } else if (current->expire == AuthInfoContainer::expTime) { - current->expireTime = time(0) + 10; + current->expireTime = time(nullptr) + 10; } // Update mWindowIdList @@ -863,7 +863,7 @@ qCDebug(category) << "Widget for" << request->windowId << QWidget::find((HWND)request->windowId); #endif - KPasswordDialog* dlg = new KPasswordDialog(0, dialogFlags); + KPasswordDialog* dlg = new KPasswordDialog(nullptr, dialogFlags); connect(dlg, SIGNAL(finished(int)), this, SLOT(passwordDialogDone(int))); connect(this, SIGNAL(destroyed(QObject*)), dlg, SLOT(deleteLater())); Index: src/urifilters/ikws/ikwsopts.h =================================================================== --- src/urifilters/ikws/ikwsopts.h +++ src/urifilters/ikws/ikwsopts.h @@ -37,7 +37,7 @@ Q_OBJECT public: - explicit FilterOptions(const KAboutData* about, QWidget *parent = 0); + explicit FilterOptions(const KAboutData* about, QWidget *parent = nullptr); void load() Q_DECL_OVERRIDE; void save() Q_DECL_OVERRIDE; Index: src/urifilters/ikws/ikwsopts.cpp =================================================================== --- src/urifilters/ikws/ikwsopts.cpp +++ src/urifilters/ikws/ikwsopts.cpp @@ -417,7 +417,7 @@ void FilterOptions::addSearchProvider() { QList providers = m_providersModel->providers(); - QPointer dlg = new SearchProviderDialog(0, providers, this); + QPointer dlg = new SearchProviderDialog(nullptr, providers, this); if (dlg->exec()) { m_providersModel->addProvider(dlg->provider()); Index: src/urifilters/ikws/ikwsopts_p.h =================================================================== --- src/urifilters/ikws/ikwsopts_p.h +++ src/urifilters/ikws/ikwsopts_p.h @@ -28,7 +28,7 @@ Q_OBJECT public: enum {Name,Shortcuts,Preferred,ColumnCount}; - explicit ProvidersModel(QObject* parent = 0): QAbstractTableModel(parent){} + explicit ProvidersModel(QObject* parent = nullptr): QAbstractTableModel(parent){} ~ProvidersModel(); Qt::ItemFlags flags(const QModelIndex& index) const Q_DECL_OVERRIDE; @@ -69,7 +69,7 @@ enum{ShortNameRole = Qt::UserRole}; private: - explicit ProvidersListModel(QList& providers, QObject* parent = 0) ; + explicit ProvidersListModel(QList& providers, QObject* parent = nullptr) ; public: QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; Index: src/urifilters/ikws/kuriikwsfilter.h =================================================================== --- src/urifilters/ikws/kuriikwsfilter.h +++ src/urifilters/ikws/kuriikwsfilter.h @@ -29,7 +29,7 @@ { Q_OBJECT public: - explicit KAutoWebSearch(QObject *parent = 0, const QVariantList &args = QVariantList() ); + explicit KAutoWebSearch(QObject *parent = nullptr, const QVariantList &args = QVariantList() ); ~KAutoWebSearch(); bool filterUri( KUriFilterData& ) const Q_DECL_OVERRIDE; Index: src/urifilters/ikws/kuriikwsfiltereng.cpp =================================================================== --- src/urifilters/ikws/kuriikwsfiltereng.cpp +++ src/urifilters/ikws/kuriikwsfiltereng.cpp @@ -56,7 +56,7 @@ SearchProvider* KURISearchFilterEngine::webShortcutQuery(const QString& typedString, QString &searchTerm) const { - SearchProvider *provider = 0; + SearchProvider *provider = nullptr; if (m_bWebShortcutsEnabled) { @@ -80,7 +80,7 @@ qCDebug(category) << "found provider" << provider->desktopEntryName() << "searchTerm=" << searchTerm; } else { delete provider; - provider = 0; + provider = nullptr; } } } @@ -92,7 +92,7 @@ SearchProvider* KURISearchFilterEngine::autoWebSearchQuery(const QString& typedString, const QString &defaultShortcut) const { - SearchProvider *provider = 0; + SearchProvider *provider = nullptr; const QString defaultSearchProvider = (m_defaultWebShortcut.isEmpty() ? defaultShortcut : m_defaultWebShortcut); if (m_bWebShortcutsEnabled && !defaultSearchProvider.isEmpty()) @@ -435,7 +435,7 @@ m_preferredWebShortcuts = group.readEntry("PreferredWebShortcuts", defaultPreferredShortcuts); // Use either a white space or a : as the keyword delimiter... - if (strchr (" :", m_cKeywordDelimiter) == 0) + if (strchr (" :", m_cKeywordDelimiter) == nullptr) m_cKeywordDelimiter = ':'; qCDebug(category) << "Web Shortcuts Enabled: " << m_bWebShortcutsEnabled; Index: src/urifilters/ikws/kurisearchfilter.h =================================================================== --- src/urifilters/ikws/kurisearchfilter.h +++ src/urifilters/ikws/kurisearchfilter.h @@ -28,11 +28,11 @@ { Q_OBJECT public: - explicit KUriSearchFilter(QObject *parent = 0, const QVariantList &args = QVariantList() ); + explicit KUriSearchFilter(QObject *parent = nullptr, const QVariantList &args = QVariantList() ); ~KUriSearchFilter(); bool filterUri( KUriFilterData& ) const Q_DECL_OVERRIDE; - KCModule *configModule(QWidget *parent = 0, const char *name = 0) const Q_DECL_OVERRIDE; + KCModule *configModule(QWidget *parent = nullptr, const char *name = nullptr) const Q_DECL_OVERRIDE; QString configName() const Q_DECL_OVERRIDE; public Q_SLOTS: Index: src/urifilters/ikws/searchprovider.cpp =================================================================== --- src/urifilters/ikws/searchprovider.cpp +++ src/urifilters/ikws/searchprovider.cpp @@ -120,14 +120,14 @@ { KService::Ptr service = KService::serviceByDesktopPath(QStringLiteral("searchproviders/%1.desktop").arg(name)); - return service ? new SearchProvider(service) : 0; + return service ? new SearchProvider(service) : nullptr; } SearchProvider *SearchProvider::findByKey(const QString &key) { KService::List providers = KServiceTypeTrader::self()->query(QStringLiteral("SearchProvider"), QStringLiteral("'%1' in Keys").arg(key)); - return providers.count() ? new SearchProvider(providers[0]) : 0; + return providers.count() ? new SearchProvider(providers[0]) : nullptr; } QList SearchProvider::findAll() Index: src/urifilters/ikws/searchproviderdlg.h =================================================================== --- src/urifilters/ikws/searchproviderdlg.h +++ src/urifilters/ikws/searchproviderdlg.h @@ -32,7 +32,7 @@ Q_OBJECT public: - explicit SearchProviderDialog(SearchProvider *provider, QList &providers, QWidget *parent = 0); + explicit SearchProviderDialog(SearchProvider *provider, QList &providers, QWidget *parent = nullptr); SearchProvider *provider() { return m_provider; } Index: src/urifilters/ikws/searchproviderdlg.cpp =================================================================== --- src/urifilters/ikws/searchproviderdlg.cpp +++ src/urifilters/ikws/searchproviderdlg.cpp @@ -142,7 +142,7 @@ void SearchProviderDialog::accept() { if ((m_dlg.leQuery->text().indexOf(QStringLiteral("\\{")) == -1) - && KMessageBox::warningContinueCancel(0, + && KMessageBox::warningContinueCancel(nullptr, i18n("The Shortcut URL does not contain a \\{...} placeholder for the user query.\n" "This means that the same page is always going to be visited, " "regardless of the text typed in with the shortcut."), Index: src/urifilters/shorturi/kshorturifilter.h =================================================================== --- src/urifilters/shorturi/kshorturifilter.h +++ src/urifilters/shorturi/kshorturifilter.h @@ -49,7 +49,7 @@ * @param parent the parent of this class. * @param name the internal name for this object. */ - explicit KShortUriFilter( QObject *parent = 0, const QVariantList &args = QVariantList() ); + explicit KShortUriFilter( QObject *parent = nullptr, const QVariantList &args = QVariantList() ); /** * Destructor Index: src/urifilters/shorturi/kshorturifilter.cpp =================================================================== --- src/urifilters/shorturi/kshorturifilter.cpp +++ src/urifilters/shorturi/kshorturifilter.cpp @@ -535,7 +535,7 @@ KCModule* KShortUriFilter::configModule( QWidget*, const char* ) const { - return 0; //new KShortUriOptions( parent, name ); + return nullptr; //new KShortUriOptions( parent, name ); } QString KShortUriFilter::configName() const Index: src/widgets/accessmanager.h =================================================================== --- src/widgets/accessmanager.h +++ src/widgets/accessmanager.h @@ -228,7 +228,7 @@ * @see QNetworkAccessManager::createRequest * @internal */ - QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0) Q_DECL_OVERRIDE; + QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = nullptr) Q_DECL_OVERRIDE; private: class AccessManagerPrivate; @@ -286,7 +286,7 @@ /** * Constructs a KNetworkCookieJar with parent @p parent. */ - explicit CookieJar(QObject *parent = 0); + explicit CookieJar(QObject *parent = nullptr); /** * Destroys the KNetworkCookieJar. Index: src/widgets/accessmanager.cpp =================================================================== --- src/widgets/accessmanager.cpp +++ src/widgets/accessmanager.cpp @@ -72,7 +72,7 @@ AccessManagerPrivate() : externalContentAllowed(true), emitReadyReadOnMetaDataChange(false), - window(0) + window(nullptr) {} void setMetaDataForRequest(QNetworkRequest request, KIO::MetaData &metaData); @@ -224,7 +224,7 @@ KIO::MetaData metaData; d->setMetaDataForRequest(req, metaData); - KIO::SimpleJob *kioJob = 0; + KIO::SimpleJob *kioJob = nullptr; switch (op) { case HeadOperation: { Index: src/widgets/accessmanagerreply_p.h =================================================================== --- src/widgets/accessmanagerreply_p.h +++ src/widgets/accessmanagerreply_p.h @@ -54,20 +54,20 @@ const QNetworkRequest &request, KIO::SimpleJob *kioJob, bool emitReadyReadOnMetaDataChange = false, - QObject *parent = 0); + QObject *parent = nullptr); explicit AccessManagerReply(const QNetworkAccessManager::Operation op, const QNetworkRequest &request, const QByteArray &data, const QUrl &url, const KIO::MetaData &metaData, - QObject *parent = 0); + QObject *parent = nullptr); explicit AccessManagerReply(const QNetworkAccessManager::Operation op, const QNetworkRequest &request, QNetworkReply::NetworkError errorCode, const QString &errorMessage, - QObject *parent = 0); + QObject *parent = nullptr); virtual ~AccessManagerReply(); qint64 bytesAvailable() const Q_DECL_OVERRIDE; Index: src/widgets/delegateanimationhandler.cpp =================================================================== --- src/widgets/delegateanimationhandler.cpp +++ src/widgets/delegateanimationhandler.cpp @@ -86,7 +86,7 @@ AnimationState::AnimationState(const QModelIndex &index) : index(index), direction(QTimeLine::Forward), animating(false), jobAnimation(false), progress(0.0), m_fadeProgress(1.0), - m_jobAnimationAngle(0.0), renderCache(NULL), fadeFromRenderCache(NULL) + m_jobAnimationAngle(0.0), renderCache(nullptr), fadeFromRenderCache(nullptr) { creationTime.start(); } @@ -116,7 +116,7 @@ m_fadeProgress = qMin(qreal(1.0), m_fadeProgress + delta); animating |= (m_fadeProgress < 1.0); if (m_fadeProgress == 1) { - setCachedRenderingFadeFrom(0); + setCachedRenderingFadeFrom(nullptr); } } @@ -262,7 +262,7 @@ // item will be drawn in two locations at the same time and hovered in one and // not the other. We can't tell them apart because they both have the same index. if (!view || static_cast(view)->draggingState()) { - return NULL; + return nullptr; } AnimationState *state = findAnimationState(view, index); @@ -337,7 +337,7 @@ } } - return NULL; + return nullptr; } void DelegateAnimationHandler::addAnimationState(AnimationState *state, const QAbstractItemView *view) Index: src/widgets/delegateanimationhandler_p.h =================================================================== --- src/widgets/delegateanimationhandler_p.h +++ src/widgets/delegateanimationhandler_p.h @@ -88,7 +88,7 @@ CachedRendering *takeCachedRendering() { CachedRendering *ret = renderCache; - renderCache = 0; + renderCache = nullptr; return ret; } @@ -136,7 +136,7 @@ typedef QMutableMapIterator MutableAnimationListsIterator; public: - DelegateAnimationHandler(QObject *parent = 0); + DelegateAnimationHandler(QObject *parent = nullptr); ~DelegateAnimationHandler(); AnimationState *animationState(const QStyleOption &option, const QModelIndex &index, const QAbstractItemView *view); Index: src/widgets/dropjob.cpp =================================================================== --- src/widgets/dropjob.cpp +++ src/widgets/dropjob.cpp @@ -382,7 +382,7 @@ void DropJobPrivate::doCopyToDirectory() { Q_Q(DropJob); - KIO::CopyJob * job = 0; + KIO::CopyJob * job = nullptr; switch (m_dropAction) { case Qt::MoveAction: job = KIO::move(m_urls, m_destUrl, m_flags); Index: src/widgets/executablefileopendialog_p.h =================================================================== --- src/widgets/executablefileopendialog_p.h +++ src/widgets/executablefileopendialog_p.h @@ -36,7 +36,7 @@ OpenFile = 42, ExecuteFile }; - explicit ExecutableFileOpenDialog(QWidget* parent = 0); + explicit ExecutableFileOpenDialog(QWidget* parent = nullptr); bool isDontAskAgainChecked() const; Index: src/widgets/fileundomanager.cpp =================================================================== --- src/widgets/fileundomanager.cpp +++ src/widgets/fileundomanager.cpp @@ -236,7 +236,7 @@ // order of the undo items. FileUndoManagerPrivate::FileUndoManagerPrivate(FileUndoManager *qq) : m_uiInterface(new FileUndoManager::UiInterface()), - m_undoJob(0), m_nextCommandIndex(1000), q(qq) + m_undoJob(nullptr), m_nextCommandIndex(1000), q(qq) { (void) new KIOFileUndoManagerAdaptor(this); const QString dbusPath = QStringLiteral("/FileUndoManager"); @@ -254,7 +254,7 @@ { d = new FileUndoManagerPrivate(this); d->m_lock = false; - d->m_currentJob = 0; + d->m_currentJob = nullptr; } FileUndoManager::~FileUndoManager() @@ -429,13 +429,13 @@ m_dirCleanupStack.clear(); m_fileCleanupStack.clear(); m_undoState = REMOVINGDIRS; - m_undoJob = 0; + m_undoJob = nullptr; if (m_currentJob) { m_currentJob->kill(); } - m_currentJob = 0; + m_currentJob = nullptr; if (step) { undoStep(); @@ -444,7 +444,7 @@ void FileUndoManagerPrivate::slotResult(KJob *job) { - m_currentJob = 0; + m_currentJob = nullptr; if (job->error()) { m_uiInterface->jobError(static_cast(job)); delete m_undoJob; @@ -476,7 +476,7 @@ void FileUndoManagerPrivate::undoStep() { - m_currentJob = 0; + m_currentJob = nullptr; if (m_undoState == MAKINGDIRS) { stepMakingDirectories(); @@ -599,11 +599,11 @@ addDirToUpdate(dir); } else { m_current.m_valid = false; - m_currentJob = 0; + m_currentJob = nullptr; if (m_undoJob) { //qDebug() << "deleting undojob"; m_undoJob->emitResult(); - m_undoJob = 0; + m_undoJob = nullptr; } QList::ConstIterator it = m_dirsToUpdate.constBegin(); for (; it != m_dirsToUpdate.constEnd(); ++it) { @@ -677,7 +677,7 @@ { public: UiInterfacePrivate() - : m_parentWidget(0), m_showProgressInfo(true) + : m_parentWidget(nullptr), m_showProgressInfo(true) {} QWidget *m_parentWidget; bool m_showProgressInfo; Index: src/widgets/jobuidelegate.cpp =================================================================== --- src/widgets/jobuidelegate.cpp +++ src/widgets/jobuidelegate.cpp @@ -76,7 +76,7 @@ while (w && w->parentWidget()) { w = w->parentWidget(); } - return (w ? w->window() : 0); + return (w ? w->window() : nullptr); } class JobUiDelegateStatic : public QObject @@ -355,7 +355,7 @@ result = 0; break; } - KMessageBox::setDontShowAgainConfig(0); + KMessageBox::setDontShowAgainConfig(nullptr); return result; } Index: src/widgets/joburlcache.cpp =================================================================== --- src/widgets/joburlcache.cpp +++ src/widgets/joburlcache.cpp @@ -33,7 +33,7 @@ return s_jobUrlCache()->instance; } -JobUrlCache::JobUrlCache() : QObject(0) +JobUrlCache::JobUrlCache() : QObject(nullptr) { org::kde::kuiserver *interface = new org::kde::kuiserver(QStringLiteral("org.kde.kuiserver"), QStringLiteral("/JobViewServer"), QDBusConnection::sessionBus(), this); Index: src/widgets/kacleditwidget.h =================================================================== --- src/widgets/kacleditwidget.h +++ src/widgets/kacleditwidget.h @@ -33,7 +33,7 @@ { Q_OBJECT public: - explicit KACLEditWidget(QWidget *parent = 0); + explicit KACLEditWidget(QWidget *parent = nullptr); ~KACLEditWidget(); KACL getACL() const; KACL getDefaultACL() const; Index: src/widgets/kacleditwidget.cpp =================================================================== --- src/widgets/kacleditwidget.cpp +++ src/widgets/kacleditwidget.cpp @@ -57,12 +57,12 @@ const char *pixmapName; QPixmap *pixmap; } s_itemAttributes[] = { - { I18N_NOOP("Owner"), "user-grey", 0 }, - { I18N_NOOP("Owning Group"), "group-grey", 0 }, - { I18N_NOOP("Others"), "others-grey", 0 }, - { I18N_NOOP("Mask"), "mask", 0 }, - { I18N_NOOP("Named User"), "user", 0 }, - { I18N_NOOP("Named Group"), "group", 0 }, + { I18N_NOOP("Owner"), "user-grey", nullptr }, + { I18N_NOOP("Owning Group"), "group-grey", nullptr }, + { I18N_NOOP("Others"), "others-grey", nullptr }, + { I18N_NOOP("Mask"), "mask", nullptr }, + { I18N_NOOP("Named User"), "user", nullptr }, + { I18N_NOOP("Named Group"), "group", nullptr }, }; class KACLEditWidget::KACLEditWidgetPrivate @@ -423,7 +423,7 @@ m_listView(listView), m_item(item), m_users(users), m_groups(groups), m_defaultUsers(defaultUsers), m_defaultGroups(defaultGroups), m_allowedTypes(allowedTypes), m_allowedDefaultTypes(allowedDefaultTypes), - m_defaultCB(0) + m_defaultCB(nullptr) { setObjectName(QStringLiteral("edit_entry_dialog")); setModal(true); @@ -664,16 +664,16 @@ m_yesPartialPixmap = new QPixmap(QStringLiteral(":/images/yespartial.png")); // fill the lists of all legal users and groups - struct passwd *user = 0; + struct passwd *user = nullptr; setpwent(); - while ((user = getpwent()) != 0) { + while ((user = getpwent()) != nullptr) { m_allUsers << QString::fromLatin1(user->pw_name); } endpwent(); - struct group *gr = 0; + struct group *gr = nullptr; setgrent(); - while ((gr = getgrent()) != 0) { + while ((gr = getgrent()) != nullptr) { m_allGroups << QString::fromLatin1(gr->gr_name); } endgrent(); @@ -943,7 +943,7 @@ { QTreeWidgetItemIterator it(this); KACLListViewItem *pItem; - while ((pItem = dynamic_cast(*it)) != 0) { + while ((pItem = dynamic_cast(*it)) != nullptr) { ++it; pItem->calcEffectiveRights(); } @@ -1000,7 +1000,7 @@ return item; } } - return 0; + return nullptr; } unsigned short KACLListView::calculateMaskValue(bool defaults) const @@ -1023,7 +1023,7 @@ if (!hasDefaultEntries()) { allowedDefaultTypes |= User | Group; } - EditACLEntryDialog dlg(this, 0, + EditACLEntryDialog dlg(this, nullptr, allowedUsers(false), allowedGroups(false), allowedUsers(true), allowedGroups(true), allowedTypes, allowedDefaultTypes, m_allowDefaults); Index: src/widgets/kacleditwidget_p.h =================================================================== --- src/widgets/kacleditwidget_p.h +++ src/widgets/kacleditwidget_p.h @@ -68,7 +68,7 @@ AllTypes = 63 }; - KACLListView(QWidget *parent = 0); + KACLListView(QWidget *parent = nullptr); ~KACLListView(); bool hasMaskEntry() const @@ -98,8 +98,8 @@ unsigned short calculateMaskValue(bool defaults) const; void calculateEffectiveRights(); - QStringList allowedUsers(bool defaults, KACLListViewItem *allowedItem = 0); - QStringList allowedGroups(bool defaults, KACLListViewItem *allowedItem = 0); + QStringList allowedUsers(bool defaults, KACLListViewItem *allowedItem = nullptr); + QStringList allowedGroups(bool defaults, KACLListViewItem *allowedItem = nullptr); KACL getACL(); KACL getDefaultACL(); Index: src/widgets/kautomount.cpp =================================================================== --- src/widgets/kautomount.cpp +++ src/widgets/kautomount.cpp @@ -87,7 +87,7 @@ const QUrl url = QUrl::fromLocalFile(mp->mountPoint()); //qDebug() << "KAutoMount: m_strDevice=" << m_strDevice << " -> mountpoint=" << mountpoint; if (m_bShowFilemanagerWindow) { - KRun::runUrl(url, QStringLiteral("inode/directory"), 0 /*TODO - window*/); + KRun::runUrl(url, QStringLiteral("inode/directory"), nullptr /*TODO - window*/); } // Notify about the new stuff in that dir, in case of opened windows showing it org::kde::KDirNotify::emitFilesAdded(url); Index: src/widgets/kdesktopfileactions.cpp =================================================================== --- src/widgets/kdesktopfileactions.cpp +++ src/widgets/kdesktopfileactions.cpp @@ -72,14 +72,14 @@ if (u.fileName() == QLatin1String(".directory")) { // We cannot execute a .directory file. Open with a text editor instead. - return KRun::runUrl(u, QStringLiteral("text/plain"), 0, false /*tempFile*/, false /*runExecutables*/, QString(), asn); + return KRun::runUrl(u, QStringLiteral("text/plain"), nullptr, false /*tempFile*/, false /*runExecutables*/, QString(), asn); } KDesktopFile cfg(u.toLocalFile()); if (!cfg.desktopGroup().hasKey("Type")) { QString tmp = i18n("The desktop entry file %1 " "has no Type=... entry.", u.toLocalFile()); - KMessageBox::error(0, tmp); + KMessageBox::error(nullptr, tmp); return false; } @@ -95,7 +95,7 @@ } QString tmp = i18n("The desktop entry of type\n%1\nis unknown.", cfg.readType()); - KMessageBox::error(0, tmp); + KMessageBox::error(nullptr, tmp); return false; } @@ -108,7 +108,7 @@ if (dev.isEmpty()) { QString tmp = i18n("The desktop entry file\n%1\nis of type FSDevice but has no Dev=... entry.", _url.toLocalFile()); - KMessageBox::error(0, tmp); + KMessageBox::error(nullptr, tmp); return retval; } @@ -117,7 +117,7 @@ if (mp) { const QUrl mpURL = QUrl::fromLocalFile(mp->mountPoint()); // Open a new window - retval = KRun::runUrl(mpURL, QStringLiteral("inode/directory"), 0 /*TODO - window*/, false, true, QString(), asn); + retval = KRun::runUrl(mpURL, QStringLiteral("inode/directory"), nullptr /*TODO - window*/, false, true, QString(), asn); } else { KConfigGroup cg = cfg.desktopGroup(); bool ro = cg.readEntry("ReadOnly", false); @@ -141,12 +141,12 @@ if (!s.isValid()) { QString tmp = i18n("The desktop entry file\n%1\nis not valid.", _url.toString()); - KMessageBox::error(0, tmp); + KMessageBox::error(nullptr, tmp); return false; } QList lst; - return KRun::runService(s, lst, 0 /*TODO - window*/, false, QString(), asn); + return KRun::runService(s, lst, nullptr /*TODO - window*/, false, QString(), asn); } static bool runLink(const QUrl &_url, const KDesktopFile &cfg, const QByteArray &asn) @@ -154,12 +154,12 @@ QString u = cfg.readUrl(); if (u.isEmpty()) { QString tmp = i18n("The desktop entry file\n%1\nis of type Link but has no URL=... entry.", _url.toString()); - KMessageBox::error(0, tmp); + KMessageBox::error(nullptr, tmp); return false; } QUrl url = QUrl::fromUserInput(u); - KRun *run = new KRun(url, (QWidget *)0, true, asn); + KRun *run = new KRun(url, (QWidget *)nullptr, true, asn); // X-KDE-LastOpenedWith holds the service desktop entry name that // was should be preferred for opening this URL if possible. @@ -188,7 +188,7 @@ const QString dev = cfg.readDevice(); if (dev.isEmpty()) { QString tmp = i18n("The desktop entry file\n%1\nis of type FSDevice but has no Dev=... entry.", _url.toLocalFile()); - KMessageBox::error(0, tmp); + KMessageBox::error(nullptr, tmp); return result; } @@ -321,7 +321,7 @@ const QString dev = cfg.readDevice(); if (dev.isEmpty()) { QString tmp = i18n("The desktop entry file\n%1\nis of type FSDevice but has no Dev=... entry.", path); - KMessageBox::error(0, tmp); + KMessageBox::error(nullptr, tmp); return; } KMountPoint::Ptr mp = KMountPoint::currentMountPoints().findByDevice(dev); @@ -387,7 +387,7 @@ #endif } else { //qDebug() << action.name() << "first url's path=" << urls.first().toLocalFile() << "exec=" << action.exec(); - KRun::run(action.exec(), urls, 0, action.text(), action.icon()); + KRun::run(action.exec(), urls, nullptr, action.text(), action.icon()); // The action may update the desktop file. Example: eject unmounts (#5129). org::kde::KDirNotify::emitFilesChanged(urls); } Index: src/widgets/kdirlister.h =================================================================== --- src/widgets/kdirlister.h +++ src/widgets/kdirlister.h @@ -38,7 +38,7 @@ /** * Create a directory lister. */ - KDirLister(QObject *parent = 0); + KDirLister(QObject *parent = nullptr); /** * Destroy the directory lister. Index: src/widgets/kdirlister.cpp =================================================================== --- src/widgets/kdirlister.cpp +++ src/widgets/kdirlister.cpp @@ -32,8 +32,8 @@ { public: Private() - : errorParent(NULL), - window(NULL), + : errorParent(nullptr), + window(nullptr), autoErrorHandling(false) {} @@ -46,7 +46,7 @@ KDirLister::KDirLister(QObject *parent) : KCoreDirLister(parent), d(new Private) { - setAutoErrorHandlingEnabled(true, 0); + setAutoErrorHandlingEnabled(true, nullptr); } KDirLister::~KDirLister() Index: src/widgets/kdirmodel.h =================================================================== --- src/widgets/kdirmodel.h +++ src/widgets/kdirmodel.h @@ -53,7 +53,7 @@ /** * @param parent parent qobject */ - explicit KDirModel(QObject *parent = 0); + explicit KDirModel(QObject *parent = nullptr); ~KDirModel(); /** Index: src/widgets/kdirmodel.cpp =================================================================== --- src/widgets/kdirmodel.cpp +++ src/widgets/kdirmodel.cpp @@ -175,8 +175,8 @@ { public: KDirModelPrivate(KDirModel *model) - : q(model), m_dirLister(0), - m_rootNode(new KDirModelDirNode(0, KFileItem())), + : q(model), m_dirLister(nullptr), + m_rootNode(new KDirModelDirNode(nullptr, KFileItem())), m_dropsAllowed(KDirModel::NoDrops), m_jobTransfersVisible(false) { } @@ -195,7 +195,7 @@ void clear() { delete m_rootNode; - m_rootNode = new KDirModelDirNode(0, KFileItem()); + m_rootNode = new KDirModelDirNode(nullptr, KFileItem()); } // Emit expand for each parent and then return the // last known parent if there is no node for this url @@ -276,14 +276,14 @@ // Protocol mismatch? Don't even start comparing paths then. #171721 if (url.scheme() != nodeUrl.scheme()) { - return 0; + return nullptr; } const QString pathStr = url.path(); // no trailing slash KDirModelDirNode *dirNode = m_rootNode; if (!pathStr.startsWith(nodeUrl.path())) { - return 0; + return nullptr; } for (;;) { @@ -294,7 +294,7 @@ if (!pathStr.startsWith(nodePath)) { qCWarning(KIO_WIDGETS) << "The kioslave for" << url.scheme() << "violates the hierarchy structure:" << "I arrived at node" << nodePath << ", but" << pathStr << "does not start with that path."; - return 0; + return nullptr; } // E.g. pathStr is /a/b/c and nodePath is /a/. We want to find the node with url /a/b @@ -560,7 +560,7 @@ } rowNumbers.setBit(node->rowNumber(), 1); // O(n) removeFromNodeHash(node, url); - node = 0; + node = nullptr; } int start = -1; @@ -695,7 +695,7 @@ { const int numRows = dirNode->m_childNodes.count(); if (numRows > 0) { - KDirModelNode *lastNode = 0; + KDirModelNode *lastNode = nullptr; for (KDirModelNode *node : dirNode->m_childNodes) { node->setPreview(QIcon()); //node->setPreview(QIcon::fromTheme(node->item().iconName())); @@ -825,7 +825,7 @@ DIR *dir = QT_OPENDIR(QFile::encodeName(path)); if (dir) { count = 0; - QT_DIRENT *dirEntry = 0; + QT_DIRENT *dirEntry = nullptr; while ((dirEntry = QT_READDIR(dir))) { if (dirEntry->d_name[0] == '.') { if (dirEntry->d_name[1] == '\0') { // skip "." Index: src/widgets/kdynamicjobtracker.cpp =================================================================== --- src/widgets/kdynamicjobtracker.cpp +++ src/widgets/kdynamicjobtracker.cpp @@ -40,8 +40,8 @@ class KDynamicJobTracker::Private { public: - Private() : kuiserverTracker(0), - widgetTracker(0) + Private() : kuiserverTracker(nullptr), + widgetTracker(nullptr) { } Index: src/widgets/kdynamicjobtracker_p.h =================================================================== --- src/widgets/kdynamicjobtracker_p.h +++ src/widgets/kdynamicjobtracker_p.h @@ -38,7 +38,7 @@ * * @param parent the parent of this object. */ - KDynamicJobTracker(QObject *parent = 0); + KDynamicJobTracker(QObject *parent = nullptr); /** * Destroys this KDynamicJobTracker Index: src/widgets/kfileitemactions.h =================================================================== --- src/widgets/kfileitemactions.h +++ src/widgets/kfileitemactions.h @@ -61,7 +61,7 @@ * Note that this instance must stay alive for at least as long as the popupmenu; * it has the slots for the actions created by addOpenWithActionsTo/addServiceActionsTo. */ - KFileItemActions(QObject *parent = 0); + KFileItemActions(QObject *parent = nullptr); /** * Destructor Index: src/widgets/kfileitemactions.cpp =================================================================== --- src/widgets/kfileitemactions.cpp +++ src/widgets/kfileitemactions.cpp @@ -76,7 +76,7 @@ } const int iSlashPos = i.indexOf('/'); - Q_ASSERT(i > 0); + Q_ASSERT(i > nullptr); const QStringRef iSubType = i.midRef(iSlashPos+1); if (iSubType == "*") { @@ -135,9 +135,9 @@ KFileItemActionsPrivate::KFileItemActionsPrivate(KFileItemActions *qq) : QObject(), q(qq), - m_executeServiceActionGroup(static_cast(0)), - m_runApplicationActionGroup(static_cast(0)), - m_parentWidget(0), + m_executeServiceActionGroup(static_cast(nullptr)), + m_runApplicationActionGroup(static_cast(nullptr)), + m_parentWidget(nullptr), m_config(QStringLiteral("kservicemenurc"), KConfig::NoGlobals) { QObject::connect(&m_executeServiceActionGroup, SIGNAL(triggered(QAction*)), @@ -779,7 +779,7 @@ { const KService::List offers = associatedApplications(d->m_mimeTypeList, traderConstraint); if (offers.isEmpty()) { - return 0; + return nullptr; } return d->createAppAction(offers.first(), true); } Index: src/widgets/kfileitemdelegate.h =================================================================== --- src/widgets/kfileitemdelegate.h +++ src/widgets/kfileitemdelegate.h @@ -180,7 +180,7 @@ * * @param parent The parent object for the delegate. */ - explicit KFileItemDelegate(QObject *parent = 0); + explicit KFileItemDelegate(QObject *parent = nullptr); /** * Destroys the item delegate. Index: src/widgets/kfileitemdelegate.cpp =================================================================== --- src/widgets/kfileitemdelegate.cpp +++ src/widgets/kfileitemdelegate.cpp @@ -134,7 +134,7 @@ KFileItemDelegate::Private::Private(KFileItemDelegate *parent) : shadowColor(Qt::transparent), shadowOffset(1, 1), shadowBlur(2), maximumSize(0, 0), showToolTipWhenElided(true), wrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere), jobTransfersVisible(false), - animationHandler(new KIO::DelegateAnimationHandler(parent)), activeMargins(0) + animationHandler(new KIO::DelegateAnimationHandler(parent)), activeMargins(nullptr) { } @@ -172,28 +172,28 @@ QRect KFileItemDelegate::Private::addMargin(const QRect &rect, MarginType type) const { - Q_ASSERT(activeMargins != 0); + Q_ASSERT(activeMargins != nullptr); const Margin &m = activeMargins[type]; return rect.adjusted(-m.left, -m.top, m.right, m.bottom); } QRect KFileItemDelegate::Private::subtractMargin(const QRect &rect, MarginType type) const { - Q_ASSERT(activeMargins != 0); + Q_ASSERT(activeMargins != nullptr); const Margin &m = activeMargins[type]; return rect.adjusted(m.left, m.top, -m.right, -m.bottom); } QSize KFileItemDelegate::Private::addMargin(const QSize &size, MarginType type) const { - Q_ASSERT(activeMargins != 0); + Q_ASSERT(activeMargins != nullptr); const Margin &m = activeMargins[type]; return QSize(size.width() + m.left + m.right, size.height() + m.top + m.bottom); } QSize KFileItemDelegate::Private::subtractMargin(const QSize &size, MarginType type) const { - Q_ASSERT(activeMargins != 0); + Q_ASSERT(activeMargins != nullptr); const Margin &m = activeMargins[type]; return QSize(size.width() - m.left - m.right, size.height() - m.top - m.bottom); } @@ -568,15 +568,15 @@ const QModelIndex &index, const QAbstractItemView *view) const { - if (!option.widget->style()->styleHint(QStyle::SH_Widget_Animate, 0, option.widget)) { - return NULL; + if (!option.widget->style()->styleHint(QStyle::SH_Widget_Animate, nullptr, option.widget)) { + return nullptr; } if (index.column() == KDirModel::Name) { return animationHandler->animationState(option, index, view); } - return NULL; + return nullptr; } QPixmap KFileItemDelegate::Private::transition(const QPixmap &from, const QPixmap &to, qreal amount) const @@ -1211,7 +1211,7 @@ // Check if the item is being animated // ======================================================================== KIO::AnimationState *state = d->animationState(opt, index, view); - KIO::CachedRendering *cache = 0; + KIO::CachedRendering *cache = nullptr; qreal progress = ((opt.state & QStyle::State_MouseOver) && index.column() == KDirModel::Name) ? 1.0 : 0.0; const QPoint iconPos = d->iconPosition(opt); @@ -1256,7 +1256,7 @@ } if (!cache->checkValidity(opt.state)) { - if (opt.widget->style()->styleHint(QStyle::SH_Widget_Animate, 0, opt.widget)) { + if (opt.widget->style()->styleHint(QStyle::SH_Widget_Animate, nullptr, opt.widget)) { // Fade over from the old icon to the new one // Only start a new fade if the previous one is ready // Else we may start racing when checkValidity() always returns false @@ -1267,7 +1267,7 @@ d->gotNewIcon(index); } // If it wasn't valid, delete it - state->setCachedRendering(0); + state->setCachedRendering(nullptr); } else { // The cache may have been discarded, but the animation handler still needs to know about new icons d->gotNewIcon(index); @@ -1408,7 +1408,7 @@ void KFileItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { QTextEdit *textedit = qobject_cast(editor); - Q_ASSERT(textedit != 0); + Q_ASSERT(textedit != nullptr); //Do not update existing text that the user may already have edited. //The models will call setEditorData(..) whenever the icon has changed, @@ -1439,7 +1439,7 @@ void KFileItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { QTextEdit *textedit = qobject_cast(editor); - Q_ASSERT(textedit != 0); + Q_ASSERT(textedit != nullptr); model->setData(index, textedit->toPlainText(), Qt::EditRole); } @@ -1473,7 +1473,7 @@ } QTextEdit *textedit = qobject_cast(editor); - Q_ASSERT(textedit != 0); + Q_ASSERT(textedit != nullptr); const int frame = textedit->frameWidth(); r.adjust(-frame, -frame, frame, frame); Index: src/widgets/kopenwithdialog.h =================================================================== --- src/widgets/kopenwithdialog.h +++ src/widgets/kopenwithdialog.h @@ -53,7 +53,7 @@ * if the dialog is used to choose an application but not for some particular URLs. * @param parent parent widget */ - explicit KOpenWithDialog(const QList &urls, QWidget *parent = 0); + explicit KOpenWithDialog(const QList &urls, QWidget *parent = nullptr); /** * Create a dialog that asks for a application to open a given @@ -65,7 +65,7 @@ * @param parent parent widget */ KOpenWithDialog(const QList &urls, const QString &text, const QString &value, - QWidget *parent = 0); + QWidget *parent = nullptr); /** * Create a dialog to select a service for a given mimetype. @@ -76,7 +76,7 @@ * @param parent parent widget */ KOpenWithDialog(const QString &mimeType, const QString &value, - QWidget *parent = 0); + QWidget *parent = nullptr); /** * Create a dialog to select an application @@ -84,7 +84,7 @@ * * @param parent parent widget */ - KOpenWithDialog(QWidget *parent = 0); + KOpenWithDialog(QWidget *parent = nullptr); /** * Destructor Index: src/widgets/kopenwithdialog.cpp =================================================================== --- src/widgets/kopenwithdialog.cpp +++ src/widgets/kopenwithdialog.cpp @@ -70,7 +70,7 @@ { public: AppNode() - : isDir(false), parent(0), fetched(false) + : isDir(false), parent(nullptr), fetched(false) { } ~AppNode() @@ -356,7 +356,7 @@ { public: KApplicationViewPrivate() - : appModel(0) + : appModel(nullptr) { } @@ -580,9 +580,9 @@ { bool bReadOnly = !KAuthorized::authorize(QStringLiteral("shell_access")); m_terminaldirty = false; - view = 0; - m_pService = 0; - curService = 0; + view = nullptr; + m_pService = nullptr; + curService = nullptr; QBoxLayout *topLayout = new QVBoxLayout; q->setLayout(topLayout); @@ -688,7 +688,7 @@ // remember->setChecked(true); topLayout->addWidget(remember); } else { - remember = 0L; + remember = nullptr; } buttonBox = new QDialogButtonBox(q); @@ -741,7 +741,7 @@ void KOpenWithDialog::slotTextChanged() { // Forget about the service - d->curService = 0L; + d->curService = nullptr; d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!d->edit->text().isEmpty()); } @@ -906,7 +906,7 @@ // qDebug() << "Setting m_command to" << m_command; } if (m_pService && terminal->isChecked() != m_pService->terminal()) { - m_pService = 0; // It's not exactly this service we're running + m_pService = nullptr; // It's not exactly this service we're running } const bool bRemember = remember && remember->isChecked(); Index: src/widgets/kopenwithdialog_p.h =================================================================== --- src/widgets/kopenwithdialog_p.h +++ src/widgets/kopenwithdialog_p.h @@ -34,7 +34,7 @@ Q_OBJECT public: - KApplicationModel(QObject *parent = 0); + KApplicationModel(QObject *parent = nullptr); virtual ~KApplicationModel(); bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE; int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; @@ -68,7 +68,7 @@ Q_OBJECT public: - KApplicationView(QWidget *parent = 0); + KApplicationView(QWidget *parent = nullptr); ~KApplicationView(); void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE; Index: src/widgets/kpropertiesdialog.h =================================================================== --- src/widgets/kpropertiesdialog.h +++ src/widgets/kpropertiesdialog.h @@ -85,7 +85,7 @@ * @param name is the internal name. */ explicit KPropertiesDialog(const KFileItem &item, - QWidget *parent = 0); + QWidget *parent = nullptr); /** * \overload @@ -100,7 +100,7 @@ * @param name is the internal name. */ explicit KPropertiesDialog(const KFileItemList &_items, - QWidget *parent = 0); + QWidget *parent = nullptr); /** * Brings up a Properties dialog. Convenience constructor for @@ -115,7 +115,7 @@ * and pass it to the other constructor. */ explicit KPropertiesDialog(const QUrl &url, - QWidget *parent = 0); + QWidget *parent = nullptr); /** * Brings up a Properties dialog. Convenience constructor for @@ -149,7 +149,7 @@ */ KPropertiesDialog(const QUrl &_tempUrl, const QUrl &_currentDir, const QString &_defaultName, - QWidget *parent = 0); + QWidget *parent = nullptr); /** * Creates an empty properties dialog (for applications that want use @@ -161,7 +161,7 @@ * @param modal tells the dialog whether it should be modal. */ explicit KPropertiesDialog(const QString &title, - QWidget *parent = 0); + QWidget *parent = nullptr); /** * Cleans up the properties dialog and frees any associated resources, @@ -178,7 +178,7 @@ * * @return true on successful dialog displaying (can be false on win32). */ - static bool showDialog(const KFileItem &item, QWidget *parent = 0, + static bool showDialog(const KFileItem &item, QWidget *parent = nullptr, bool modal = true); /** @@ -189,7 +189,7 @@ * * @return true on successful dialog displaying (can be false on win32). */ - static bool showDialog(const QUrl &_url, QWidget *parent = 0, + static bool showDialog(const QUrl &_url, QWidget *parent = nullptr, bool modal = true); /** @@ -201,7 +201,7 @@ * * @return true on successful dialog displaying (can be false on win32). */ - static bool showDialog(const KFileItemList &_items, QWidget *parent = 0, + static bool showDialog(const KFileItemList &_items, QWidget *parent = nullptr, bool modal = true); /** Index: src/widgets/kpropertiesdialog.cpp =================================================================== --- src/widgets/kpropertiesdialog.cpp +++ src/widgets/kpropertiesdialog.cpp @@ -174,7 +174,7 @@ { q = qq; m_aborted = false; - fileSharePage = 0; + fileSharePage = nullptr; } ~KPropertiesDialogPrivate() { @@ -750,11 +750,11 @@ public: KFilePropsPluginPrivate() { - dirSizeJob = 0L; - dirSizeUpdateTimer = 0L; - m_lined = 0; - m_capacityBar = 0; - m_linkTargetLineEdit = 0; + dirSizeJob = nullptr; + dirSizeUpdateTimer = nullptr; + m_lined = nullptr; + m_capacityBar = nullptr; + m_linkTargetLineEdit = nullptr; } ~KFilePropsPluginPrivate() { @@ -1089,8 +1089,8 @@ if (!hasDirs) { // Only files [and symlinks] d->m_sizeLabel->setText(QStringLiteral("%1 (%2)").arg(KIO::convertSize(totalSize), QLocale().toString(totalSize))); - d->m_sizeDetermineButton = 0L; - d->m_sizeStopButton = 0L; + d->m_sizeDetermineButton = nullptr; + d->m_sizeStopButton = nullptr; } else { // Directory QHBoxLayout *sizelay = new QHBoxLayout(); grid->addLayout(sizelay, curRow++, 2); @@ -1307,9 +1307,9 @@ // just in case you change something and try again :) d->m_sizeDetermineButton->setText(i18n("Refresh")); d->m_sizeDetermineButton->setEnabled(true); - d->dirSizeJob = 0; + d->dirSizeJob = nullptr; delete d->dirSizeUpdateTimer; - d->dirSizeUpdateTimer = 0; + d->dirSizeUpdateTimer = nullptr; } void KFilePropsPlugin::slotSizeDetermine() @@ -1342,7 +1342,7 @@ d->m_sizeLabel->setText(i18n("At least %1", KIO::convertSize(totalSize))); d->dirSizeJob->kill(); - d->dirSizeJob = 0; + d->dirSizeJob = nullptr; } if (d->dirSizeUpdateTimer) { d->dirSizeUpdateTimer->stop(); @@ -1386,7 +1386,7 @@ // qDebug() << "oldname = " << d->oldName; // qDebug() << "newname = " << n; if (d->oldName != n || d->m_bFromTemplate) { // true for any from-template file - KIO::Job *job = 0L; + KIO::Job *job = nullptr; QUrl oldurl = properties->url(); QString newFileName = KIO::encodeFileName(n); @@ -1432,7 +1432,7 @@ } // No job, keep going - slotCopyFinished(0L); + slotCopyFinished(nullptr); } void KFilePropsPlugin::slotCopyFinished(KJob *job) @@ -1560,7 +1560,7 @@ cfg.reparseConfiguration(); if (cfg.desktopGroup().readEntry("Icon") != sIcon) { - KMessageBox::sorry(0, i18n("Could not save properties. You do not " + KMessageBox::sorry(nullptr, i18n("Could not save properties. You do not " "have sufficient access to write to %1.", path)); } } @@ -1639,29 +1639,29 @@ I18N_NOOP("Forbidden"), I18N_NOOP("Can Read"), I18N_NOOP("Can Read & Write"), - 0 + nullptr }, { I18N_NOOP("Forbidden"), I18N_NOOP("Can View Content"), I18N_NOOP("Can View & Modify Content"), - 0 + nullptr }, - { 0, 0, 0, 0}, // no texts for links + { nullptr, nullptr, nullptr, nullptr}, // no texts for links { I18N_NOOP("Forbidden"), I18N_NOOP("Can View Content & Read"), I18N_NOOP("Can View/Read & Modify/Write"), - 0 + nullptr } }; KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin(KPropertiesDialog *_props) : KPropertiesDialogPlugin(_props), d(new KFilePermissionsPropsPluginPrivate) { - d->cbRecursive = 0L; - d->grpCombo = 0L; d->grpEdit = 0; - d->usrEdit = 0L; + d->cbRecursive = nullptr; + d->grpCombo = nullptr; d->grpEdit = nullptr; + d->usrEdit = nullptr; QString path = properties->url().path(); QString fname = properties->url().fileName(); bool isLocal = properties->url().isLocalFile(); @@ -1757,7 +1757,7 @@ QLabel *lbl; QGroupBox *gb; QGridLayout *gl; - QPushButton *pbAdvancedPerm = 0; + QPushButton *pbAdvancedPerm = nullptr; /* Group: Access Permissions */ gb = new QGroupBox(i18n("Access Permissions"), d->m_frame); @@ -1823,7 +1823,7 @@ gl->addWidget(pbAdvancedPerm, 6, 0, 1, 2, Qt::AlignRight); connect(pbAdvancedPerm, SIGNAL(clicked()), this, SLOT(slotShowAdvancedPermissions())); } else { - d->extraCheckbox = 0; + d->extraCheckbox = nullptr; } /**** Group: Ownership ****/ @@ -1942,7 +1942,7 @@ fileSystemSupportsACLs = (statfs(path.data(), &buf) == 0) && (buf.f_flags & MNT_ACLS); #else fileSystemSupportsACLs = - getxattr(path.data(), "system.posix_acl_access", NULL, 0) >= 0 || errno == ENODATA; + getxattr(path.data(), "system.posix_acl_access", nullptr, 0) >= 0 || errno == ENODATA; #endif return fileSystemSupportsACLs; } @@ -2140,7 +2140,7 @@ gl->setColumnStretch(6, 10); #if HAVE_POSIX_ACL - KACLEditWidget *extendedACLs = 0; + KACLEditWidget *extendedACLs = nullptr; // FIXME make it work with partial entries if (properties->items().count() == 1) { @@ -3101,7 +3101,7 @@ QString path = url.toLocalFile(); QFile f(path); if (!f.open(QIODevice::ReadWrite)) { - KMessageBox::sorry(0, i18n("Could not save properties. You do not have " + KMessageBox::sorry(nullptr, i18n("Could not save properties. You do not have " "sufficient access to write to %1.", path)); return; } @@ -3402,7 +3402,7 @@ const QString path = url.toLocalFile(); QFile f(path); if (!f.open(QIODevice::ReadWrite)) { - KMessageBox::sorry(0, i18n("Could not save properties. You do not have sufficient " + KMessageBox::sorry(nullptr, i18n("Could not save properties. You do not have sufficient " "access to write to %1.", path)); return; } @@ -3668,7 +3668,7 @@ const QUrl url = job->mostLocalUrl(); if (!url.isLocalFile()) { - KMessageBox::sorry(0, i18n("Could not save properties. Only entries on local file systems are supported.")); + KMessageBox::sorry(nullptr, i18n("Could not save properties. Only entries on local file systems are supported.")); return; } @@ -3676,7 +3676,7 @@ QFile f(path); if (!f.open(QIODevice::ReadWrite)) { - KMessageBox::sorry(0, i18n("Could not save properties. You do not have " + KMessageBox::sorry(nullptr, i18n("Could not save properties. You do not have " "sufficient access to write to %1.", path)); return; } Index: src/widgets/krun.cpp =================================================================== --- src/widgets/krun.cpp +++ src/widgets/krun.cpp @@ -503,7 +503,7 @@ { Q_OBJECT public: - SecureMessageDialog(QWidget *parent) : QDialog(parent), m_textEdit(0) + SecureMessageDialog(QWidget *parent) : QDialog(parent), m_textEdit(nullptr) { } @@ -809,7 +809,7 @@ } int i = KToolInvocation::startServiceByDesktopPath( - _service.entryPath(), QUrl::toStringList(urls), &error, 0L, &pid, myasn + _service.entryPath(), QUrl::toStringList(urls), &error, nullptr, &pid, myasn ); if (i != 0) { @@ -886,7 +886,7 @@ m_bAutoDelete = true; m_bProgressInfo = showProgressInfo; m_bFinished = false; - m_job = 0L; + m_job = nullptr; m_strURL = url; m_bScanFile = false; m_bIsDirectory = false; @@ -1180,7 +1180,7 @@ void KRun::slotStatResult(KJob *job) { - d->m_job = 0L; + d->m_job = nullptr; const int errCode = job->error(); if (errCode) { // ERR_NO_CONTENT is not an error, but an indication no further @@ -1241,12 +1241,12 @@ qCWarning(KIO_WIDGETS) << "get() didn't emit a mimetype! Probably a kioslave bug, please check the implementation of" << url().scheme(); } mimeTypeDetermined(mimetype); - d->m_job = 0; + d->m_job = nullptr; } void KRun::slotScanFinished(KJob *job) { - d->m_job = 0; + d->m_job = nullptr; const int errCode = job->error(); if (errCode) { // ERR_NO_CONTENT is not an error, but an indication no further @@ -1292,7 +1292,7 @@ job->putOnHold(); KIO::Scheduler::publishSlaveOnHold(); - d->m_job = 0; + d->m_job = nullptr; } Q_ASSERT(!d->m_bFinished); @@ -1334,7 +1334,7 @@ if (d->m_job) { //qDebug() << this << "m_job=" << d->m_job; d->m_job->kill(); - d->m_job = 0L; + d->m_job = nullptr; } } @@ -1587,7 +1587,7 @@ // (or with a full path, if m_executable is absolute), and then in the PATH. if (!QFile(m_executable).exists() && QStandardPaths::findExecutable(m_executable).isEmpty()) { QEventLoopLocker locker; - KMessageBox::sorry(0L, i18n("Could not find the program '%1'", m_executable)); + KMessageBox::sorry(nullptr, i18n("Could not find the program '%1'", m_executable)); } else { //qDebug() << process->readAllStandardError(); } Index: src/widgets/ksslcertificatebox.h =================================================================== --- src/widgets/ksslcertificatebox.h +++ src/widgets/ksslcertificatebox.h @@ -38,7 +38,7 @@ Issuer }; - explicit KSslCertificateBox(QWidget *parent = 0); + explicit KSslCertificateBox(QWidget *parent = nullptr); ~KSslCertificateBox(); void setCertificate(const QSslCertificate &cert, CertificateParty party); Index: src/widgets/ksslinfodialog.h =================================================================== --- src/widgets/ksslinfodialog.h +++ src/widgets/ksslinfodialog.h @@ -49,7 +49,7 @@ * * @param parent the parent widget */ - explicit KSslInfoDialog(QWidget *parent = 0); + explicit KSslInfoDialog(QWidget *parent = nullptr); /** * Destroy this dialog Index: src/widgets/kurifilter.h =================================================================== --- src/widgets/kurifilter.h +++ src/widgets/kurifilter.h @@ -655,7 +655,7 @@ * @param parent the parent object, or 0 for no parent * @param name the name of the plugin, mandatory */ - explicit KUriFilterPlugin(const QString &name, QObject *parent = 0); + explicit KUriFilterPlugin(const QString &name, QObject *parent = nullptr); /** * Filters a URI. Index: src/widgets/kurifilter.cpp =================================================================== --- src/widgets/kurifilter.cpp +++ src/widgets/kurifilter.cpp @@ -474,14 +474,14 @@ /************************* KUriFilterPlugin ******************************/ KUriFilterPlugin::KUriFilterPlugin(const QString &name, QObject *parent) - : QObject(parent), d(0) + : QObject(parent), d(nullptr) { setObjectName(name); } KCModule *KUriFilterPlugin::configModule(QWidget *, const char *) const { - return 0; + return nullptr; } QString KUriFilterPlugin::configName() const Index: src/widgets/kurlcombobox.h =================================================================== --- src/widgets/kurlcombobox.h +++ src/widgets/kurlcombobox.h @@ -79,8 +79,8 @@ * @li Both Don't mess with anything, just show the url as given. * @param parent The parent object of this widget. */ - explicit KUrlComboBox(Mode mode, QWidget *parent = 0); - KUrlComboBox(Mode mode, bool rw, QWidget *parent = 0); + explicit KUrlComboBox(Mode mode, QWidget *parent = nullptr); + KUrlComboBox(Mode mode, bool rw, QWidget *parent = nullptr); /** * Destructs the combo box. */ Index: src/widgets/kurlcombobox.cpp =================================================================== --- src/widgets/kurlcombobox.cpp +++ src/widgets/kurlcombobox.cpp @@ -217,7 +217,7 @@ it = urls.constBegin(); - KUrlComboBoxPrivate::KUrlComboItem *item = 0L; + KUrlComboBoxPrivate::KUrlComboItem *item = nullptr; while (it != urls.constEnd()) { if ((*it).isEmpty()) { Index: src/widgets/kurlcompletion.cpp =================================================================== --- src/widgets/kurlcompletion.cpp +++ src/widgets/kurlcompletion.cpp @@ -115,8 +115,8 @@ KUrlCompletionPrivate(KUrlCompletion *parent) : q(parent), url_auto_completion(true), - userListThread(0), - dirListThread(0) + userListThread(nullptr), + dirListThread(nullptr) { } @@ -547,7 +547,7 @@ replace_env = true; last_no_hidden = false; last_compl_type = CTNone; - list_job = 0L; + list_job = nullptr; mode = KUrlCompletion::FileCompletion; // Read settings @@ -716,19 +716,19 @@ { if (d->list_job) { d->list_job->kill(); - d->list_job = 0L; + d->list_job = nullptr; } if (d->dirListThread) { d->dirListThread->requestTermination(); delete d->dirListThread; - d->dirListThread = 0; + d->dirListThread = nullptr; } if (d->userListThread) { d->userListThread->requestTermination(); delete d->userListThread; - d->userListThread = 0; + d->userListThread = nullptr; } } @@ -1159,7 +1159,7 @@ bool no_hidden) { assert(list_urls.isEmpty()); - assert(list_job == 0L); + assert(list_job == nullptr); list_urls = urls; list_urls_filter = filter; @@ -1173,7 +1173,7 @@ // This will start a new list job as long as there // are urls in d->list_urls // - _k_slotIOFinished(0); + _k_slotIOFinished(nullptr); } /* @@ -1260,7 +1260,7 @@ if (list_urls.isEmpty()) { - list_job = 0L; + list_job = nullptr; finished(); // will call KCompletion::makeCompletion() @@ -1364,13 +1364,13 @@ if (userListThread == thread) { thread->wait(); delete thread; - userListThread = 0; + userListThread = nullptr; } if (dirListThread == thread) { thread->wait(); delete thread; - dirListThread = 0; + dirListThread = nullptr; } finished(); // will call KCompletion::makeCompletion() } Index: src/widgets/kurlpixmapprovider.cpp =================================================================== --- src/widgets/kurlpixmapprovider.cpp +++ src/widgets/kurlpixmapprovider.cpp @@ -24,7 +24,7 @@ #include KUrlPixmapProvider::KUrlPixmapProvider() - : d(0) + : d(nullptr) { } Index: src/widgets/kurlrequester.h =================================================================== --- src/widgets/kurlrequester.h +++ src/widgets/kurlrequester.h @@ -72,12 +72,12 @@ /** * Constructs a KUrlRequester widget. */ - explicit KUrlRequester(QWidget *parent = 0); + explicit KUrlRequester(QWidget *parent = nullptr); /** * Constructs a KUrlRequester widget with the initial URL @p url. */ - explicit KUrlRequester(const QUrl &url, QWidget *parent = 0); + explicit KUrlRequester(const QUrl &url, QWidget *parent = nullptr); /** * Special constructor, which creates a KUrlRequester widget with a custom @@ -346,7 +346,7 @@ /** * Constructs a KUrlRequester widget with a combobox. */ - explicit KUrlComboRequester(QWidget *parent = 0); + explicit KUrlComboRequester(QWidget *parent = nullptr); private: class Private; Index: src/widgets/kurlrequester.cpp =================================================================== --- src/widgets/kurlrequester.cpp +++ src/widgets/kurlrequester.cpp @@ -65,7 +65,7 @@ QDrag *dragObject() Q_DECL_OVERRIDE { if (m_button->m_urls.isEmpty()) { - return 0; + return nullptr; } QDrag *drag = new QDrag(m_button); @@ -87,8 +87,8 @@ public: KUrlRequesterPrivate(KUrlRequester *parent) : m_parent(parent), - edit(0), - combo(0), + edit(nullptr), + combo(nullptr), fileDialogMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly) { } @@ -290,7 +290,7 @@ void KUrlRequester::KUrlRequesterPrivate::init() { - myFileDialog = 0L; + myFileDialog = nullptr; fileDialogModality = Qt::ApplicationModal; if (!combo && !edit) { @@ -618,7 +618,7 @@ } KUrlComboRequester::KUrlComboRequester(QWidget *parent) - : KUrlRequester(new KComboBox(false), parent), d(0) + : KUrlRequester(new KComboBox(false), parent), d(nullptr) { } Index: src/widgets/kurlrequesterdialog.h =================================================================== --- src/widgets/kurlrequesterdialog.h +++ src/widgets/kurlrequesterdialog.h @@ -48,7 +48,7 @@ * directory where a file has been selected. * @param parent The parent object of this widget. */ - explicit KUrlRequesterDialog(const QUrl &url, QWidget *parent = 0); + explicit KUrlRequesterDialog(const QUrl &url, QWidget *parent = nullptr); /** * Constructs a KUrlRequesterDialog. @@ -79,7 +79,7 @@ * @param caption The caption to use for the dialog. */ static QUrl getUrl(const QUrl &url = QUrl(), - QWidget *parent = 0, const QString &caption = QString()); + QWidget *parent = nullptr, const QString &caption = QString()); /** * Returns a pointer to the file dialog used by the KUrlRequester. Index: src/widgets/paste.cpp =================================================================== --- src/widgets/paste.cpp +++ src/widgets/paste.cpp @@ -61,7 +61,7 @@ const QList urls = KUrlMimeData::urlsFromMimeData(mimeData, KUrlMimeData::PreferLocalUrls); if (!urls.isEmpty()) { const bool move = KIO::isClipboardDataCut(mimeData); - KIO::Job *job = 0; + KIO::Job *job = nullptr; if (move) { job = KIO::move(urls, destDir, flags); } else { @@ -69,7 +69,7 @@ } return job; } - return 0; + return nullptr; } static QUrl getNewFileName(const QUrl &u, const QString &text, const QString &suggestedFileName, QWidget *widget) @@ -227,24 +227,24 @@ } else { const QStringList formats = extractFormats(mimeData); if (formats.isEmpty()) { - return 0; + return nullptr; } else if (formats.size() > 1) { QUrl newUrl; ba = chooseFormatAndUrl(destUrl, mimeData, formats, dialogText, suggestedFilename, widget, clipboard, &newUrl); if (ba.isEmpty()) { - return 0; + return nullptr; } return putDataAsyncTo(newUrl, ba, widget, KIO::Overwrite); } ba = mimeData->data(formats.first()); } if (ba.isEmpty()) { - return 0; + return nullptr; } const QUrl newUrl = getNewFileName(destUrl, dialogText, suggestedFilename, widget); if (newUrl.isEmpty()) { - return 0; + return nullptr; } return putDataAsyncTo(newUrl, ba, widget, KIO::Overwrite); @@ -258,7 +258,7 @@ if (!destUrl.isValid()) { KMessageBox::error(widget, i18n("Malformed URL\n%1", destUrl.errorString())); qCWarning(KIO_WIDGETS) << destUrl.errorString(); - return 0; + return nullptr; } // TODO: if we passed mimeData as argument, we could write unittests that don't Index: src/widgets/pastejob.cpp =================================================================== --- src/widgets/pastejob.cpp +++ src/widgets/pastejob.cpp @@ -53,7 +53,7 @@ { Q_Q(PasteJob); const bool move = KIO::isClipboardDataCut(m_mimeData); - KIO::Job *job = 0; + KIO::Job *job = nullptr; if (m_mimeData->hasUrls()) { const QList urls = KUrlMimeData::urlsFromMimeData(m_mimeData, KUrlMimeData::PreferLocalUrls); if (!urls.isEmpty()) { Index: src/widgets/pixmaploader.h =================================================================== --- src/widgets/pixmaploader.h +++ src/widgets/pixmaploader.h @@ -45,7 +45,7 @@ * @return the pixmap of the URL, can be a default icon if not found */ KIOWIDGETS_EXPORT QPixmap pixmapForUrl(const QUrl &url, int dummy = 0, KIconLoader::Group group = KIconLoader::Desktop, - int force_size = 0, int state = 0, QString *path = 0); + int force_size = 0, int state = 0, QString *path = nullptr); } Index: src/widgets/previewjob.h =================================================================== --- src/widgets/previewjob.h +++ src/widgets/previewjob.h @@ -100,7 +100,7 @@ */ PreviewJob(const KFileItemList &items, const QSize &size, - const QStringList *enabledPlugins = 0); + const QStringList *enabledPlugins = nullptr); virtual ~PreviewJob(); @@ -258,7 +258,7 @@ * with the setter-methods instead. Note that the semantics of * \p enabledPlugins has been slightly changed. */ -KIOWIDGETS_DEPRECATED_EXPORT PreviewJob *filePreview(const KFileItemList &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = 0); // KDE5: use enums instead of bool scale + bool save +KIOWIDGETS_DEPRECATED_EXPORT PreviewJob *filePreview(const KFileItemList &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = nullptr); // KDE5: use enums instead of bool scale + bool save /** * Creates a PreviewJob to generate or retrieve a preview image @@ -283,7 +283,7 @@ * with the setter-methods instead. Note that the semantics of * \p enabledPlugins has been slightly changed. */ -KIOWIDGETS_DEPRECATED_EXPORT PreviewJob *filePreview(const QList &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = 0); +KIOWIDGETS_DEPRECATED_EXPORT PreviewJob *filePreview(const QList &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = nullptr); #endif /** @@ -296,7 +296,7 @@ * KConfigGroup "PreviewSettings" are used. * @since 4.7 */ -KIOWIDGETS_EXPORT PreviewJob *filePreview(const KFileItemList &items, const QSize &size, const QStringList *enabledPlugins = 0); +KIOWIDGETS_EXPORT PreviewJob *filePreview(const KFileItemList &items, const QSize &size, const QStringList *enabledPlugins = nullptr); } #endif Index: src/widgets/previewjob.cpp =================================================================== --- src/widgets/previewjob.cpp +++ src/widgets/previewjob.cpp @@ -80,7 +80,7 @@ iconSize(0), iconAlpha(70), shmid(-1), - shmaddr(0) + shmaddr(nullptr) { // http://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html#DIRECTORY thumbRoot = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1String("/thumbnails/"); @@ -195,7 +195,7 @@ Q_D(PreviewJob); if (d->shmaddr) { shmdt((char *)d->shmaddr); - shmctl(d->shmid, IPC_RMID, 0); + shmctl(d->shmid, IPC_RMID, nullptr); } #endif } @@ -299,7 +299,7 @@ PreviewItem item; item.item = *kit; const QString mimeType = item.item.mimetype(); - KService::Ptr plugin(0); + KService::Ptr plugin(nullptr); // look for protocol-specific thumbnail plugins first QHash >::const_iterator it = protocolMap.constFind(item.item.url().scheme()); @@ -627,18 +627,18 @@ if (shmid == -1) { if (shmaddr) { shmdt((char *)shmaddr); - shmctl(shmid, IPC_RMID, 0); + shmctl(shmid, IPC_RMID, nullptr); } shmid = shmget(IPC_PRIVATE, cacheWidth * cacheHeight * 4, IPC_CREAT | 0600); if (shmid != -1) { - shmaddr = (uchar *)(shmat(shmid, 0, SHM_RDONLY)); + shmaddr = (uchar *)(shmat(shmid, nullptr, SHM_RDONLY)); if (shmaddr == (uchar *) - 1) { - shmctl(shmid, IPC_RMID, 0); - shmaddr = 0; + shmctl(shmid, IPC_RMID, nullptr); + shmaddr = nullptr; shmid = -1; } } else { - shmaddr = 0; + shmaddr = nullptr; } } if (shmid != -1) { Index: src/widgets/renamedialog.cpp =================================================================== --- src/widgets/renamedialog.cpp +++ src/widgets/renamedialog.cpp @@ -97,15 +97,15 @@ public: RenameDialogPrivate() { - bCancel = 0; - bRename = bSkip = bOverwrite = 0; - bResume = bSuggestNewName = 0; - bApplyAll = 0; - m_pLineEdit = 0; + bCancel = nullptr; + bRename = bSkip = bOverwrite = nullptr; + bResume = bSuggestNewName = nullptr; + bApplyAll = nullptr; + m_pLineEdit = nullptr; m_srcPendingPreview = false; m_destPendingPreview = false; - m_srcPreview = 0; - m_destPreview = 0; + m_srcPreview = nullptr; + m_destPreview = nullptr; m_srcArea = Q_NULLPTR; m_destArea = Q_NULLPTR; } Index: src/widgets/skipdialog.cpp =================================================================== --- src/widgets/skipdialog.cpp +++ src/widgets/skipdialog.cpp @@ -33,7 +33,7 @@ using namespace KIO; SkipDialog::SkipDialog(QWidget *parent, KIO::SkipDialog_Options options, const QString &_error_text) - : QDialog(parent), d(0) + : QDialog(parent), d(nullptr) { setWindowTitle(i18n("Information")); Index: src/widgets/sslui.cpp =================================================================== --- src/widgets/sslui.cpp +++ src/widgets/sslui.cpp @@ -46,7 +46,7 @@ } if (ud->certificateChain.isEmpty()) { // SSL without certificates is quite useless and should never happen - KMessageBox::sorry(0, i18n("The remote host did not send any SSL certificates.\n" + KMessageBox::sorry(nullptr, i18n("The remote host did not send any SSL certificates.\n" "Aborting because the identity of the host cannot be established.")); return false; } @@ -74,7 +74,7 @@ int msgResult; do { - msgResult = KMessageBox::warningYesNoCancel(0, message, i18n("Server Authentication"), + msgResult = KMessageBox::warningYesNoCancel(nullptr, message, i18n("Server Authentication"), KGuiItem(i18n("&Details"), QStringLiteral("help-about")), KGuiItem(i18n("Co&ntinue"), QStringLiteral("arrow-right"))); if (msgResult == KMessageBox::Yes) { @@ -106,7 +106,7 @@ if (storedRules & StoreRules) { //Save the user's choice to ignore the SSL errors. - msgResult = KMessageBox::warningYesNo(0, + msgResult = KMessageBox::warningYesNo(nullptr, i18n("Would you like to accept this " "certificate forever without " "being prompted?"), Index: src/widgets/thumbcreator.cpp =================================================================== --- src/widgets/thumbcreator.cpp +++ src/widgets/thumbcreator.cpp @@ -36,7 +36,7 @@ QWidget *ThumbCreator::createConfigurationWidget() { - return 0; + return nullptr; } void ThumbCreator::writeConfiguration(const QWidget *configurationWidget) Index: tests/kdirlistertest_gui.h =================================================================== --- tests/kdirlistertest_gui.h +++ tests/kdirlistertest_gui.h @@ -124,7 +124,7 @@ { Q_OBJECT public: - KDirListerTest(QWidget *parent = 0); + KDirListerTest(QWidget *parent = nullptr); ~KDirListerTest(); public Q_SLOTS: Index: tests/kdirlistertest_gui.cpp =================================================================== --- tests/kdirlistertest_gui.cpp +++ tests/kdirlistertest_gui.cpp @@ -157,7 +157,7 @@ QApplication::setApplicationName(QStringLiteral("kdirlistertest")); QApplication app(argc, argv); - KDirListerTest *test = new KDirListerTest(0); + KDirListerTest *test = new KDirListerTest(nullptr); test->show(); return app.exec(); } Index: tests/kdirmodeltest_gui.cpp =================================================================== --- tests/kdirmodeltest_gui.cpp +++ tests/kdirmodeltest_gui.cpp @@ -60,11 +60,11 @@ QApplication a(argc, argv); - KDirModel *dirmodel = new KDirModel(0); + KDirModel *dirmodel = new KDirModel(nullptr); dirmodel->dirLister()->setDelayedMimeTypes(true); #if 1 - QTreeView *treeView = new QTreeView(0); + QTreeView *treeView = new QTreeView(nullptr); treeView->setModel(dirmodel); treeView->setUniformRowHeights(true); // makes visualRect() much faster treeView->resize(500, 500); @@ -81,7 +81,7 @@ #endif #if 1 - QListView *iconView = new QListView(0); + QListView *iconView = new QListView(nullptr); iconView->setModel(dirmodel); iconView->setSelectionMode(QListView::ExtendedSelection); iconView->setViewMode(QListView::IconMode); Index: tests/kioslavetest.cpp =================================================================== --- tests/kioslavetest.cpp +++ tests/kioslavetest.cpp @@ -36,10 +36,10 @@ using namespace KIO; KioslaveTest::KioslaveTest(QString src, QString dest, uint op, uint pr) - : KMainWindow(0) + : KMainWindow(nullptr) { - job = 0L; + job = nullptr; main_widget = new QWidget(this); QBoxLayout *topLayout = new QVBoxLayout(main_widget); @@ -172,7 +172,7 @@ main_widget->setMinimumSize(main_widget->sizeHint()); setCentralWidget(main_widget); - slave = 0; + slave = nullptr; // slave = KIO::Scheduler::getConnectedSlave(QUrl("ftp://ftp.kde.org")); KIO::Scheduler::connect(SIGNAL(slaveConnected(KIO::Slave*)), this, SLOT(slotSlaveConnected())); @@ -234,7 +234,7 @@ observe = HideProgressInfo; } - SimpleJob *myJob = 0; + SimpleJob *myJob = nullptr; switch (selectedOperation) { case List: @@ -323,7 +323,7 @@ } if (job == _job) { - job = 0L; + job = nullptr; } pbStart->setEnabled(true); @@ -340,7 +340,7 @@ void KioslaveTest::slotSlaveError() { qDebug() << "Error connected."; - slave = 0; + slave = nullptr; } void KioslaveTest::printUDSEntry(const KIO::UDSEntry &entry) @@ -439,7 +439,7 @@ "BIG3\n", "BIG4\n", "BIG5\n", - 0 + nullptr }; const char *fileData = fileDataArray[putBuffer++]; @@ -460,7 +460,7 @@ { qDebug() << "KioslaveTest::stopJob()"; job->kill(); - job = 0L; + job = nullptr; pbStop->setEnabled(false); pbStart->setEnabled(true); Index: tests/kopenwithtest.cpp =================================================================== --- tests/kopenwithtest.cpp +++ tests/kopenwithtest.cpp @@ -45,7 +45,7 @@ // Test with two URLs list += QUrl(QStringLiteral("http://www.kde.org/index.html")); - dlg = new KOpenWithDialog(list, QString(), QString(), 0); + dlg = new KOpenWithDialog(list, QString(), QString(), nullptr); if (dlg->exec()) { qDebug() << "Dialog ended successfully\ntext: " << dlg->text(); } else { @@ -55,7 +55,7 @@ // Test with a mimetype QString mimetype = QStringLiteral("text/plain"); - dlg = new KOpenWithDialog(mimetype, QStringLiteral("kedit"), 0); + dlg = new KOpenWithDialog(mimetype, QStringLiteral("kedit"), nullptr); if (dlg->exec()) { qDebug() << "Dialog ended successfully\ntext: " << dlg->text(); } else { Index: tests/kruntest.cpp =================================================================== --- tests/kruntest.cpp +++ tests/kruntest.cpp @@ -48,13 +48,13 @@ const char *exec; const char *url; } s_tests[] = { - { "run(kwrite, no url)", "should work normally", "kwrite", 0 }, + { "run(kwrite, no url)", "should work normally", "kwrite", nullptr }, { "run(kwrite, file url)", "should work normally", "kwrite", testFile }, { "run(kwrite, remote url)", "should work normally", "kwrite", "http://www.kde.org" }, - { "run(doesnotexit, no url)", "should show error message", "doesnotexist", 0 }, + { "run(doesnotexit, no url)", "should show error message", "doesnotexist", nullptr }, { "run(doesnotexit, file url)", "should show error message", "doesnotexist", testFile }, { "run(doesnotexit, remote url)", "should use kioexec and show error message", "doesnotexist", "http://www.kde.org" }, - { "run(missing lib, no url)", "should show error message (remove libqca.so.2 for this, e.g. by editing LD_LIBRARY_PATH if qca is in its own prefix)", "qcatool", 0 }, + { "run(missing lib, no url)", "should show error message (remove libqca.so.2 for this, e.g. by editing LD_LIBRARY_PATH if qca is in its own prefix)", "qcatool", nullptr }, { "run(missing lib, file url)", "should show error message (remove libqca.so.2 for this, e.g. by editing LD_LIBRARY_PATH if qca is in its own prefix)", "qcatool", testFile }, { "run(missing lib, remote url)", "should show error message (remove libqca.so.2 for this, e.g. by editing LD_LIBRARY_PATH if qca is in its own prefix)", "qcatool", "http://www.kde.org" }, { "runCommand(empty)", "should error", "", "" }, // #186036 Index: tests/ksycocaupdatetest.cpp =================================================================== --- tests/ksycocaupdatetest.cpp +++ tests/ksycocaupdatetest.cpp @@ -7,6 +7,6 @@ QApplication::setApplicationName(QStringLiteral("whatever")); QApplication k(argc, argv); - KBuildSycocaProgressDialog::rebuildKSycoca(0); + KBuildSycocaProgressDialog::rebuildKSycoca(nullptr); return 0; } Index: tests/kurlnavigatortest_gui.cpp =================================================================== --- tests/kurlnavigatortest_gui.cpp +++ tests/kurlnavigatortest_gui.cpp @@ -31,7 +31,7 @@ QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); QApplication app(argc, argv); - KUrlNavigator urlNavigator(new KFilePlacesModel, QUrl::fromLocalFile(QDir::homePath()), 0); + KUrlNavigator urlNavigator(new KFilePlacesModel, QUrl::fromLocalFile(QDir::homePath()), nullptr); urlNavigator.show(); return app.exec(); Index: tests/listjobtest.cpp =================================================================== --- tests/listjobtest.cpp +++ tests/listjobtest.cpp @@ -61,7 +61,7 @@ timer.start(); KIO::ListJob *job = KIO::listDir(url, KIO::HideProgressInfo); - job->setUiDelegate(0); + job->setUiDelegate(nullptr); job->addMetaData(QStringLiteral("details"), QStringLiteral("2")); // Default is 2 which means all details. 0 means just a few essential fields (KIO::UDSEntry::UDS_NAME, KIO::UDSEntry::UDS_FILE_TYPE and KIO::UDSEntry::UDS_LINK_DEST if it is a symbolic link. Not provided otherwise. QObject::connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), &testObject, SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList))); Index: tests/listrecursivetest.cpp =================================================================== --- tests/listrecursivetest.cpp +++ tests/listrecursivetest.cpp @@ -47,7 +47,7 @@ using namespace KIO; SpeedTest::SpeedTest(const QUrl &url) - : QObject(0) + : QObject(nullptr) { Job *job = listRecursive(url); connect(job, SIGNAL(result(KJob*)),