From kde-commits Fri Mar 31 21:56:21 2017 From: Thomas Fischer Date: Fri, 31 Mar 2017 21:56:21 +0000 To: kde-commits Subject: [kbibtex] src: Modernizing C++ code: 'nullptr' instead of 'NULL' Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=149099740815510 Git commit 2d97483a3279a9f0d8be7b2f3d6a924077743259 by Thomas Fischer. Committed on 31/03/2017 at 19:29. Pushed by thomasfischer into branch 'master'. Modernizing C++ code: 'nullptr' instead of 'NULL' Modernizing code to use 'nullptr' instead of 'NULL' or just '0'. Issues found and fixed by clang-tidy 3.9, using check 'modernize-use-nullptr'. M +2 -2 src/config/bibtexentries.cpp M +3 -3 src/config/bibtexfields.cpp M +2 -2 src/config/notificationhub.cpp M +1 -1 src/data/entry.cpp M +8 -8 src/data/models/filemodel.cpp M +2 -2 src/data/models/filemodel.h M +12 -12 src/data/value.cpp M +2 -2 src/gui/config/entrylayout.cpp M +1 -1 src/gui/delayedexecutiontimer.h M +5 -5 src/gui/element/associatedfilesui.cpp M +9 -9 src/gui/element/elementeditor.cpp M +14 -14 src/gui/element/elementwidgets.cpp M +10 -10 src/gui/element/findpdfui.cpp M +2 -2 src/gui/element/findpdfui_p.h M +2 -2 src/gui/field/colorlabelwidget.cpp M +2 -2 src/gui/field/colorlabelwidget.h M +45 -45 src/gui/field/fieldinput.cpp M +2 -2 src/gui/field/fieldinput.h M +6 -6 src/gui/field/fieldlineedit.cpp M +2 -2 src/gui/field/fieldlineedit.h M +12 -12 src/gui/field/fieldlistedit.cpp M +5 -5 src/gui/field/fieldlistedit.h M +9 -9 src/gui/file/basicfileview.cpp M +2 -2 src/gui/file/basicfileview.h M +1 -1 src/gui/file/clipboard.cpp M +2 -2 src/gui/file/filedelegate.h M +10 -10 src/gui/file/fileview.cpp M +9 -9 src/gui/file/findduplicatesui.cpp M +1 -1 src/gui/file/sortfilterfilemodel.cpp M +2 -2 src/gui/file/sortfilterfilemodel.h M +2 -2 src/gui/italictextitemmodel.h M +1 -1 src/gui/preferences/kbibtexpreferencesdialog.cpp M +1 -1 src/gui/preferences/kbibtexpreferencesdialog.h M +9 -9 src/gui/preferences/settingscolorlabelwidget.cpp M +2 -2 src/gui/preferences/settingsidsuggestionseditor.cpp M +3 -3 src/gui/preferences/settingsidsuggestionseditor.h M +3 -3 src/gui/preferences/settingsidsuggestionswidget.cpp M +4 -4 src/gui/valuelistmodel.cpp M +2 -2 src/gui/valuelistmodel.h M +4 -4 src/gui/widgets/filesettingswidget.cpp M +3 -3 src/gui/widgets/hidingtabwidget.cpp M +2 -2 src/gui/widgets/hidingtabwidget.h M +24 -24 src/gui/widgets/menulineedit.cpp M +3 -3 src/gui/widgets/starrating.h M +4 -4 src/io/encoderlatex.cpp M +5 -5 src/io/fileexporter.h M +4 -4 src/io/fileexporterbibtex.cpp M +2 -2 src/io/fileexporterbibtex.h M +3 -3 src/io/fileexporterbibtex2html.h M +3 -3 src/io/fileexporterbibtexoutput.h M +3 -3 src/io/fileexporterbibutils.h M +2 -2 src/io/fileexporterpdf.cpp M +3 -3 src/io/fileexporterpdf.h M +3 -3 src/io/fileexporterps.h M +3 -3 src/io/fileexporterris.h M +3 -3 src/io/fileexporterrtf.h M +10 -10 src/io/fileexportertoolchain.cpp M +4 -4 src/io/fileexportertoolchain.h M +5 -5 src/io/fileexporterxml.cpp M +4 -4 src/io/fileexporterxml.h M +3 -3 src/io/fileexporterxslt.h M +4 -4 src/io/fileimporter.cpp M +23 -23 src/io/fileimporterbibtex.cpp M +3 -3 src/io/fileimporterbibtex.h M +3 -3 src/io/fileimporterbibutils.cpp M +6 -6 src/io/fileimporterpdf.cpp M +5 -5 src/io/fileimporterris.cpp M +1 -1 src/io/fileinfo.cpp M +1 -1 src/io/textencoder.cpp M +4 -4 src/networking/associatedfiles.cpp M +2 -2 src/networking/findpdf.cpp M +2 -2 src/networking/findpdf.h M +10 -10 src/networking/internalnetworkaccessmanager.cpp M +3 -3 src/networking/internalnetworkaccessmanager.h M +7 -7 src/networking/onlinesearch/onlinesearchabstract.cpp M +2 -2 src/networking/onlinesearch/onlinesearchabstract.h M +1 -1 src/networking/onlinesearch/onlinesearchacmportal.cpp M +3 -3 src/networking/onlinesearch/onlinesearcharxiv.cpp M +4 -4 src/networking/onlinesearch/onlinesearchbibsonomy.cpp M +1 -1 src/networking/onlinesearch/onlinesearchbiorxiv.cpp M +4 -4 src/networking/onlinesearch/onlinesearchdoi.cpp M +1 -1 src/networking/onlinesearch/onlinesearchgooglescholar.cpp M +1 -1 src/networking/onlinesearch/onlinesearchideasrepec.cpp M +1 -1 src/networking/onlinesearch/onlinesearchieeexplore.cpp M +4 -4 src/networking/onlinesearch/onlinesearchingentaconnect.cpp M +1 -1 src/networking/onlinesearch/onlinesearchisbndb.cpp M +1 -1 src/networking/onlinesearch/onlinesearchjstor.cpp M +1 -1 src/networking/onlinesearch/onlinesearchmathscinet.cpp M +1 -1 src/networking/onlinesearch/onlinesearchmrlookup.cpp M +1 -1 src/networking/onlinesearch/onlinesearchpubmed.cpp M +1 -1 src/networking/onlinesearch/onlinesearchsciencedirect.cpp M +1 -1 src/networking/onlinesearch/onlinesearchsimplebibtexdownload= .cpp M +5 -5 src/networking/onlinesearch/onlinesearchspringerlink.cpp M +2 -2 src/networking/zotero/api.h M +2 -2 src/networking/zotero/collectionmodel.h M +2 -2 src/networking/zotero/groups.h M +1 -1 src/networking/zotero/items.cpp M +2 -2 src/networking/zotero/items.h M +2 -2 src/networking/zotero/tagmodel.h M +2 -2 src/networking/zotero/tags.h M +19 -19 src/parts/part.cpp M +2 -2 src/processing/checkbibtex.cpp M +2 -2 src/processing/findduplicates.cpp M +3 -3 src/processing/journalabbreviations.cpp M +2 -2 src/processing/lyx.cpp M +16 -16 src/program/docklets/documentpreview.cpp M +2 -2 src/program/docklets/documentpreview.h M +3 -3 src/program/docklets/elementform.cpp M +6 -6 src/program/docklets/filesettings.cpp M +5 -5 src/program/docklets/referencepreview.cpp M +17 -17 src/program/docklets/searchform.cpp M +7 -7 src/program/docklets/searchresults.cpp M +8 -8 src/program/docklets/statistics.cpp M +15 -15 src/program/docklets/valuelist.cpp M +13 -13 src/program/docklets/zoterobrowser.cpp M +9 -9 src/program/documentlist.cpp M +4 -4 src/program/documentlist.h M +16 -16 src/program/mainwindow.cpp M +2 -2 src/program/mainwindow.h M +11 -11 src/program/mdiwidget.cpp M +36 -36 src/program/openfileinfo.cpp M +1 -1 src/program/openfileinfo.h M +1 -1 src/program/program.cpp M +8 -8 src/test/kbibtexfilestest.cpp M +2 -2 src/test/kbibtextest.h https://commits.kde.org/kbibtex/2d97483a3279a9f0d8be7b2f3d6a924077743259 diff --git a/src/config/bibtexentries.cpp b/src/config/bibtexentries.cpp index ab9c22e6..886b0e43 100644 --- a/src/config/bibtexentries.cpp +++ b/src/config/bibtexentries.cpp @@ -106,7 +106,7 @@ public: = }; = -BibTeXEntries *BibTeXEntries::BibTeXEntriesPrivate::singleton =3D NULL; +BibTeXEntries *BibTeXEntries::BibTeXEntriesPrivate::singleton =3D nullptr; = = BibTeXEntries::BibTeXEntries() @@ -122,7 +122,7 @@ BibTeXEntries::~BibTeXEntries() = const BibTeXEntries *BibTeXEntries::self() { - if (BibTeXEntriesPrivate::singleton =3D=3D NULL) + if (BibTeXEntriesPrivate::singleton =3D=3D nullptr) BibTeXEntriesPrivate::singleton =3D new BibTeXEntries(); return BibTeXEntriesPrivate::singleton; } diff --git a/src/config/bibtexfields.cpp b/src/config/bibtexfields.cpp index 2093799d..b5934c0c 100644 --- a/src/config/bibtexfields.cpp +++ b/src/config/bibtexfields.cpp @@ -147,7 +147,7 @@ public: } }; = -BibTeXFields *BibTeXFields::BibTeXFieldsPrivate::singleton =3D NULL; +BibTeXFields *BibTeXFields::BibTeXFieldsPrivate::singleton =3D nullptr; = BibTeXFields::BibTeXFields() : QList(), d(new BibTeXFieldsPrivate(this)) @@ -162,7 +162,7 @@ BibTeXFields::~BibTeXFields() = const BibTeXFields *BibTeXFields::self() { - if (BibTeXFieldsPrivate::singleton =3D=3D NULL) + if (BibTeXFieldsPrivate::singleton =3D=3D nullptr) BibTeXFieldsPrivate::singleton =3D new BibTeXFields(); return BibTeXFieldsPrivate::singleton; } @@ -227,7 +227,7 @@ const FieldDescription *BibTeXFields::find(const QStrin= g &name) const return fd; } qCWarning(LOG_KBIBTEX_CONFIG) << "No field description for " << name <= < "(" << iName << ")"; - return NULL; + return nullptr; } = KBibTeX::TypeFlag BibTeXFields::typeFlagFromString(const QString &typeFlag= String) diff --git a/src/config/notificationhub.cpp b/src/config/notificationhub.cpp index 0e2219aa..3e530d5e 100644 --- a/src/config/notificationhub.cpp +++ b/src/config/notificationhub.cpp @@ -56,7 +56,7 @@ NotificationHub::~NotificationHub() = NotificationHub *NotificationHub::getHub() { - if (NotificationHub::NotificationHubPrivate::singleton =3D=3D NULL) + if (NotificationHub::NotificationHubPrivate::singleton =3D=3D nullptr) NotificationHub::NotificationHubPrivate::singleton =3D new Notific= ationHub(); return NotificationHub::NotificationHubPrivate::singleton; } @@ -103,4 +103,4 @@ void NotificationHub::publishEvent(int eventId) const int NotificationHub::EventAny =3D -1; const int NotificationHub::EventConfigurationChanged =3D 0; const int NotificationHub::EventUserDefined =3D 1024; -NotificationHub *NotificationHub::NotificationHubPrivate::singleton =3D NU= LL; +NotificationHub *NotificationHub::NotificationHubPrivate::singleton =3D nu= llptr; diff --git a/src/data/entry.cpp b/src/data/entry.cpp index a3d688cf..a601b9fa 100644 --- a/src/data/entry.cpp +++ b/src/data/entry.cpp @@ -193,7 +193,7 @@ Entry *Entry::resolveCrossref(const Entry &original, co= nst File *bibTeXfile) { Entry *result =3D new Entry(original); = - if (bibTeXfile =3D=3D NULL) + if (bibTeXfile =3D=3D nullptr) return result; = const QString crossRef =3D PlainTextValue::text(original.value(ftCross= Ref)); diff --git a/src/data/models/filemodel.cpp b/src/data/models/filemodel.cpp index fc86c714..37044af5 100644 --- a/src/data/models/filemodel.cpp +++ b/src/data/models/filemodel.cpp @@ -46,7 +46,7 @@ const bool FileModel::defaultShowMacros =3D true; = = FileModel::FileModel(QObject *parent) - : QAbstractTableModel(parent), m_file(NULL) + : QAbstractTableModel(parent), m_file(nullptr) { NotificationHub::registerNotificationListener(this, NotificationHub::E= ventConfigurationChanged); readConfiguration(); @@ -162,7 +162,7 @@ bool FileModel::hasChildren(const QModelIndex &parent) = const = int FileModel::rowCount(const QModelIndex & /*parent*/) const { - return m_file !=3D NULL ? m_file->count() : 0; + return m_file !=3D nullptr ? m_file->count() : 0; } = int FileModel::columnCount(const QModelIndex & /*parent*/) const @@ -177,7 +177,7 @@ QVariant FileModel::data(const QModelIndex &index, int = role) const return QVariant(); = /// check backend storage (File object) - if (m_file =3D=3D NULL) + if (m_file =3D=3D nullptr) return QVariant(); = /// for now, only display data (no editing or icons etc) @@ -299,7 +299,7 @@ void FileModel::clear() { = bool FileModel::removeRow(int row, const QModelIndex &parent) { - if (row < 0 || m_file =3D=3D NULL || row >=3D rowCount() || row >=3D m= _file->count()) + if (row < 0 || m_file =3D=3D nullptr || row >=3D rowCount() || row >= =3D m_file->count()) return false; if (parent !=3D QModelIndex()) return false; @@ -313,7 +313,7 @@ bool FileModel::removeRow(int row, const QModelIndex &p= arent) = bool FileModel::removeRowList(const QList &rows) { - if (m_file =3D=3D NULL) return false; + if (m_file =3D=3D nullptr) return false; = QList internalRows =3D rows; std::sort(internalRows.begin(), internalRows.end(), std::greater(= )); @@ -331,7 +331,7 @@ bool FileModel::removeRowList(const QList &rows) = bool FileModel::insertRow(QSharedPointer element, int row, const = QModelIndex &parent) { - if (m_file =3D=3D NULL || row < 0 || row > rowCount() || parent !=3D Q= ModelIndex()) + if (m_file =3D=3D nullptr || row < 0 || row > rowCount() || parent != =3D QModelIndex()) return false; = /// Check for duplicate ids or keys when inserting a new element @@ -386,14 +386,14 @@ bool FileModel::insertRow(QSharedPointer ele= ment, int row, const QModel = QSharedPointer FileModel::element(int row) const { - if (m_file =3D=3D NULL || row < 0 || row >=3D m_file->count()) return = QSharedPointer(); + if (m_file =3D=3D nullptr || row < 0 || row >=3D m_file->count()) retu= rn QSharedPointer(); = return (*m_file)[row]; } = int FileModel::row(QSharedPointer element) const { - if (m_file =3D=3D NULL) return -1; + if (m_file =3D=3D nullptr) return -1; return m_file->indexOf(element); } = diff --git a/src/data/models/filemodel.h b/src/data/models/filemodel.h index 1c39c08e..3ddbe7f1 100644 --- a/src/data/models/filemodel.h +++ b/src/data/models/filemodel.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -47,7 +47,7 @@ public: static const QString keyShowMacros; static const bool defaultShowMacros; = - explicit FileModel(QObject *parent =3D 0); + explicit FileModel(QObject *parent =3D nullptr); = File *bibliographyFile() const; virtual void setBibliographyFile(File *file); diff --git a/src/data/value.cpp b/src/data/value.cpp index fa60c08f..e712bf37 100644 --- a/src/data/value.cpp +++ b/src/data/value.cpp @@ -94,7 +94,7 @@ bool Keyword::containsPattern(const QString &pattern, Qt:= :CaseSensitivity caseSe bool Keyword::operator=3D=3D(const ValueItem &other) const { const Keyword *otherKeyword =3D dynamic_cast(&other); - if (otherKeyword !=3D NULL) { + if (otherKeyword !=3D nullptr) { return otherKeyword->text() =3D=3D text(); } else return false; @@ -160,7 +160,7 @@ bool Person::containsPattern(const QString &pattern, Qt= ::CaseSensitivity caseSen bool Person::operator=3D=3D(const ValueItem &other) const { const Person *otherPerson =3D dynamic_cast(&other); - if (otherPerson !=3D NULL) { + if (otherPerson !=3D nullptr) { return otherPerson->firstName() =3D=3D firstName() && otherPerson-= >lastName() =3D=3D lastName(); } else return false; @@ -250,7 +250,7 @@ bool MacroKey::containsPattern(const QString &pattern, = Qt::CaseSensitivity caseS bool MacroKey::operator=3D=3D(const ValueItem &other) const { const MacroKey *otherMacroKey =3D dynamic_cast(&othe= r); - if (otherMacroKey !=3D NULL) { + if (otherMacroKey !=3D nullptr) { return otherMacroKey->text() =3D=3D text(); } else return false; @@ -300,7 +300,7 @@ bool PlainText::containsPattern(const QString &pattern,= Qt::CaseSensitivity case bool PlainText::operator=3D=3D(const ValueItem &other) const { const PlainText *otherPlainText =3D dynamic_cast(&o= ther); - if (otherPlainText !=3D NULL) { + if (otherPlainText !=3D nullptr) { return otherPlainText->text() =3D=3D text(); } else return false; @@ -385,7 +385,7 @@ bool VerbatimText::containsPattern(const QString &patte= rn, Qt::CaseSensitivity c bool VerbatimText::operator=3D=3D(const ValueItem &other) const { const VerbatimText *otherVerbatimText =3D dynamic_cast(&other); - if (otherVerbatimText !=3D NULL) { + if (otherVerbatimText !=3D nullptr) { return otherVerbatimText->text() =3D=3D text(); } else return false; @@ -557,29 +557,29 @@ QString PlainTextValue::text(const ValueItem &valueIt= em, ValueItemType &vit) QString result; vit =3D VITOther; = - if (notificationListener =3D=3D NULL) + if (notificationListener =3D=3D nullptr) notificationListener =3D new PlainTextValue(); = const PlainText *plainText =3D dynamic_cast(&valueI= tem); - if (plainText !=3D NULL) { + if (plainText !=3D nullptr) { result =3D plainText->text(); } else { const MacroKey *macroKey =3D dynamic_cast(&value= Item); - if (macroKey !=3D NULL) { + if (macroKey !=3D nullptr) { result =3D macroKey->text(); // TODO Use File to resolve key t= o full text } else { const Person *person =3D dynamic_cast(&valueIt= em); - if (person !=3D NULL) { + if (person !=3D nullptr) { result =3D Person::transcribePersonName(person, personName= Formatting); vit =3D VITPerson; } else { const Keyword *keyword =3D dynamic_cast(&= valueItem); - if (keyword !=3D NULL) { + if (keyword !=3D nullptr) { result =3D keyword->text(); vit =3D VITKeyword; } else { const VerbatimText *verbatimText =3D dynamic_cast(&valueItem); - if (verbatimText !=3D NULL) { + if (verbatimText !=3D nullptr) { result =3D verbatimText->text(); } } @@ -638,4 +638,4 @@ void PlainTextValue::readConfiguration() } = QString PlainTextValue::personNameFormatting; -PlainTextValue *PlainTextValue::notificationListener =3D NULL; +PlainTextValue *PlainTextValue::notificationListener =3D nullptr; diff --git a/src/gui/config/entrylayout.cpp b/src/gui/config/entrylayout.cpp index 52ceba4d..f1f4f9a3 100644 --- a/src/gui/config/entrylayout.cpp +++ b/src/gui/config/entrylayout.cpp @@ -88,7 +88,7 @@ public: } }; = -EntryLayout *EntryLayout::EntryLayoutPrivate::singleton =3D NULL; +EntryLayout *EntryLayout::EntryLayoutPrivate::singleton =3D nullptr; = EntryLayout::EntryLayout() : QVector >(), d(new EntryLayoutPri= vate(this)) @@ -103,7 +103,7 @@ EntryLayout::~EntryLayout() = EntryLayout *EntryLayout::self() { - if (EntryLayoutPrivate::singleton =3D=3D NULL) + if (EntryLayoutPrivate::singleton =3D=3D nullptr) EntryLayoutPrivate::singleton =3D new EntryLayout(); return EntryLayoutPrivate::singleton; } diff --git a/src/gui/delayedexecutiontimer.h b/src/gui/delayedexecutiontime= r.h index 66bb26fa..caf3ee11 100644 --- a/src/gui/delayedexecutiontimer.h +++ b/src/gui/delayedexecutiontimer.h @@ -42,7 +42,7 @@ class DelayedExecutionTimer : public QObject { Q_OBJECT public: - explicit DelayedExecutionTimer(int maximumDelay =3D 1000, int minimumD= elay =3D 250, QObject *parent =3D 0); + explicit DelayedExecutionTimer(int maximumDelay =3D 1000, int minimumD= elay =3D 250, QObject *parent =3D nullptr); explicit DelayedExecutionTimer(QObject *parent); = /** diff --git a/src/gui/element/associatedfilesui.cpp b/src/gui/element/associ= atedfilesui.cpp index b34a8511..bbe81952 100644 --- a/src/gui/element/associatedfilesui.cpp +++ b/src/gui/element/associatedfilesui.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -54,7 +54,7 @@ public: const File *bibTeXfile; = Private(AssociatedFilesUI *parent) - : p(parent), entry(QSharedPointer()), bibTeXfile(NULL) { + : p(parent), entry(QSharedPointer()), bibTeXfile(nullpt= r) { setupGUI(); } = @@ -256,7 +256,7 @@ void AssociatedFilesUI::updateUIandPreview() { d->radioKeepFilename->setChecked(true); } else d->radioRenameToEntryId->setEnabled(true); - if (d->bibTeXfile =3D=3D NULL || !d->bibTeXfile->hasProperty(File::Url= )) { + if (d->bibTeXfile =3D=3D nullptr || !d->bibTeXfile->hasProperty(File::= Url)) { d->radioRelativePath->setEnabled(false); d->radioAbsolutePath->setChecked(true); d->labelMoveCopyLocation->hide(); @@ -268,8 +268,8 @@ void AssociatedFilesUI::updateUIandPreview() { d->lineMoveCopyLocation->setText(d->bibTeXfile->property(File::Url= ).toUrl().path()); } = - if (d->bibTeXfile !=3D NULL && !d->sourceUrl.isEmpty() && !entryId.isE= mpty()) { - const QUrl newUrl =3D AssociatedFiles::copyDocument(d->sourceUrl, = entryId, d->bibTeXfile, renameOperation(), moveCopyOperation(), NULL, d->li= neEditUserDefinedName->text(), true); + if (d->bibTeXfile !=3D nullptr && !d->sourceUrl.isEmpty() && !entryId.= isEmpty()) { + const QUrl newUrl =3D AssociatedFiles::copyDocument(d->sourceUrl, = entryId, d->bibTeXfile, renameOperation(), moveCopyOperation(), nullptr, d-= >lineEditUserDefinedName->text(), true); if (!newUrl.isEmpty()) preview =3D AssociatedFiles::associateDocumentURL(newUrl, d->= bibTeXfile, pathType()); } diff --git a/src/gui/element/elementeditor.cpp b/src/gui/element/elementedi= tor.cpp index 4112a04e..0ba236c2 100644 --- a/src/gui/element/elementeditor.cpp +++ b/src/gui/element/elementeditor.cpp @@ -73,7 +73,7 @@ public: bool elementChanged, elementUnapplied; = ElementEditorPrivate(bool scrollable, ElementEditor *parent) - : file(NULL), p(parent), previousWidget(NULL), config(KSharedC= onfig::openConfig(QStringLiteral("kbibtexrc"))), elementChanged(false), ele= mentUnapplied(false) { + : file(nullptr), p(parent), previousWidget(nullptr), config(KS= haredConfig::openConfig(QStringLiteral("kbibtexrc"))), elementChanged(false= ), elementUnapplied(false) { internalEntry =3D QSharedPointer(); internalMacro =3D QSharedPointer(); internalComment =3D QSharedPointer(); @@ -107,7 +107,7 @@ public: ElementWidget *widget =3D new EntryConfiguredWidget(etl, tab); connect(widget, &ElementWidget::modified, p, &ElementEditor::c= hildModified); widgets << widget; - if (previousWidget =3D=3D NULL) + if (previousWidget =3D=3D nullptr) previousWidget =3D widget; ///< memorize the first tab int index =3D tab->addTab(widget, widget->icon(), widget->labe= l()); tab->hideTab(index); @@ -245,7 +245,7 @@ public: } = bool hasDuplicateId() const { - return referenceWidget !=3D NULL && referenceWidget->isDuplicateId= (); + return referenceWidget !=3D nullptr && referenceWidget->isDuplicat= eId(); } = void apply() { @@ -285,12 +285,12 @@ public: = /// The internal element may be outdated (only updated on tab = switch), /// so apply the reference widget's data on the output element - if (referenceWidget !=3D NULL) + if (referenceWidget !=3D nullptr) referenceWidget->apply(element); /// The internal element may be outdated (only updated on tab = switch), /// so apply the current widget's data on the output element ElementWidget *currentElementWidget =3D qobject_cast(tab->currentWidget()); - if (currentElementWidget !=3D NULL) + if (currentElementWidget !=3D nullptr) currentElementWidget->apply(element); } } @@ -384,7 +384,7 @@ public: /// Interprete future widget as an ElementWidget ElementWidget *futureWidget =3D qobject_cast(futu= reTab); /// Past and future ElementWidget values are valid? - if (previousWidget !=3D NULL && futureWidget !=3D NULL) { + if (previousWidget !=3D nullptr && futureWidget !=3D nullptr) { /// Assign to temp wihch internal variable holds current state QSharedPointer temp; if (!internalEntry.isNull()) @@ -400,11 +400,11 @@ public: /// Past widget writes its state to the internal state previousWidget->apply(temp); /// Before switching to source widget, store internally refere= nce widget's state - if (isToSourceWidget && referenceWidget !=3D NULL) referenceWi= dget->apply(temp); + if (isToSourceWidget && referenceWidget !=3D nullptr) referenc= eWidget->apply(temp); /// Tell future widget to initialize itself based on internal = state futureWidget->reset(temp); /// When switchin from source widget to another widget, initia= lize reference widget - if (isFromSourceWidget && referenceWidget !=3D NULL) + if (isFromSourceWidget && referenceWidget !=3D nullptr) referenceWidget->reset(temp); } previousWidget =3D futureWidget; @@ -514,7 +514,7 @@ void ElementEditor::setElement(QSharedPointer element, const File if (!comment.isNull()) clone =3D QSharedPointer(new Comment(*comment= .data())); else - Q_ASSERT_X(element =3D=3D NULL, "ElementEditor::Elemen= tEditor(const Element *element, QWidget *parent)", "element is not NULL but= could not be cast on a valid Element sub-class"); + Q_ASSERT_X(element =3D=3D nullptr, "ElementEditor::Ele= mentEditor(const Element *element, QWidget *parent)", "element is not NULL = but could not be cast on a valid Element sub-class"); } } } diff --git a/src/gui/element/elementwidgets.cpp b/src/gui/element/elementwi= dgets.cpp index 42c5e71b..e5e660b8 100644 --- a/src/gui/element/elementwidgets.cpp +++ b/src/gui/element/elementwidgets.cpp @@ -57,7 +57,7 @@ static const unsigned int interColumnSpace =3D 16; static const char *PropertyIdSuggestion =3D "PropertyIdSuggestion"; = ElementWidget::ElementWidget(QWidget *parent) - : QWidget(parent), isReadOnly(false), m_file(NULL), m_isModified(f= alse) + : QWidget(parent), isReadOnly(false), m_file(nullptr), m_isModifie= d(false) { // nothing }; @@ -165,7 +165,7 @@ void EntryConfiguredWidget::setFile(const File *file) { for (QMap::Iterator it =3D bibtexKeyToWidget.be= gin(); it !=3D bibtexKeyToWidget.end(); ++it) { it.value()->setFile(file); - if (file !=3D NULL) { + if (file !=3D nullptr) { /// list of unique values for same field QStringList list =3D file->uniqueEntryValuesList(it.key()); /// for crossref fields, add all entries' ids @@ -202,8 +202,8 @@ void EntryConfiguredWidget::createGUI() = /// create an editing widget for this field const FieldDescription *fd =3D bf->find(sfl.bibtexLabel); - KBibTeX::TypeFlags typeFlags =3D fd =3D=3D NULL ? KBibTeX::tfSourc= e : fd->typeFlags; - KBibTeX::TypeFlag preferredTypeFlag =3D fd =3D=3D NULL ? KBibTeX::= tfSource : fd->preferredTypeFlag; + KBibTeX::TypeFlags typeFlags =3D fd =3D=3D nullptr ? KBibTeX::tfSo= urce : fd->typeFlags; + KBibTeX::TypeFlag preferredTypeFlag =3D fd =3D=3D nullptr ? KBibTe= X::tfSource : fd->preferredTypeFlag; labeledFieldInput->fieldInput =3D new FieldInput(sfl.fieldInputLay= out, preferredTypeFlag, typeFlags, this); labeledFieldInput->fieldInput->setFieldKey(sfl.bibtexLabel); bibtexKeyToWidget.insert(sfl.bibtexLabel, labeledFieldInput->field= Input); @@ -266,7 +266,7 @@ void EntryConfiguredWidget::layoutGUI(bool forceVisible= , const QString &entryTyp = const QString key =3D bibtexKeyToWidget.key(listOfLabeledFieldInpu= t[i]->fieldInput).toLower(); const FieldDescription *fd =3D bf->find(key); - bool typeIndependent =3D fd =3D=3D NULL ? false : fd->typeIndepend= ent; + bool typeIndependent =3D fd =3D=3D nullptr ? false : fd->typeIndep= endent; Value value; listOfLabeledFieldInput[i]->fieldInput->apply(value); /// Hide non-required and non-optional type-dependent fields, @@ -326,7 +326,7 @@ void EntryConfiguredWidget::layoutGUI(bool forceVisible= , const QString &entryTyp } = ReferenceWidget::ReferenceWidget(QWidget *parent) - : ElementWidget(parent), m_applyElement(NULL), m_entryIdManuallySe= t(false), m_element(QSharedPointer()) + : ElementWidget(parent), m_applyElement(nullptr), m_entryIdManuall= ySet(false), m_element(QSharedPointer()) { createGUI(); } @@ -515,7 +515,7 @@ void ReferenceWidget::prepareSuggestionsMenu() QString suggestion =3D suggestionBase; = /// Test for duplicate ids, use fallback ids with numeric suffix - if (m_file !=3D NULL && m_file->containsKey(suggestion)) { + if (m_file !=3D nullptr && m_file->containsKey(suggestion)) { int suffix =3D 2; while (m_file->containsKey(suggestion =3D suggestionBase + QCh= ar('_') + QString::number(suffix))) ++suffix; @@ -540,7 +540,7 @@ void ReferenceWidget::prepareSuggestionsMenu() void ReferenceWidget::insertSuggestionFromAction() { QAction *action =3D qobject_cast(sender()); - if (action !=3D NULL) { + if (action !=3D nullptr) { const QString suggestion =3D action->property(PropertyIdSuggestion= ).toString(); entryId->setText(suggestion); } @@ -794,7 +794,7 @@ void OtherFieldsWidget::listCurrentChanged(QTreeWidgetI= tem *item, QTreeWidgetIte { Q_UNUSED(previous) bool validUrl =3D false; - bool somethingSelected =3D item !=3D NULL; + bool somethingSelected =3D item !=3D nullptr; buttonDelete->setEnabled(somethingSelected && !isReadOnly); if (somethingSelected) { currentUrl =3D QUrl(item->text(1)); @@ -837,14 +837,14 @@ void OtherFieldsWidget::actionDelete() { if (isReadOnly) return; /// never modify anything if in read-only mode = - Q_ASSERT_X(otherFieldsList->currentItem() !=3D NULL, "OtherFieldsWidge= t::actionDelete", "otherFieldsList->currentItem() is NULL"); + Q_ASSERT_X(otherFieldsList->currentItem() !=3D nullptr, "OtherFieldsWi= dget::actionDelete", "otherFieldsList->currentItem() is NULL"); QString key =3D otherFieldsList->currentItem()->text(0); if (!deletedKeys.contains(key)) deletedKeys << key; = internalEntry->remove(key); updateList(); updateGUI(); - listCurrentChanged(otherFieldsList->currentItem(), NULL); + listCurrentChanged(otherFieldsList->currentItem(), nullptr); = gotModified(); } @@ -921,7 +921,7 @@ void OtherFieldsWidget::createGUI() void OtherFieldsWidget::updateList() { const QString selText =3D otherFieldsList->selectedItems().isEmpty() ?= QString() : otherFieldsList->selectedItems().first()->text(0); - const QString curText =3D otherFieldsList->currentItem() =3D=3D NULL ?= QString() : otherFieldsList->currentItem()->text(0); + const QString curText =3D otherFieldsList->currentItem() =3D=3D nullpt= r ? QString() : otherFieldsList->currentItem()->text(0); otherFieldsList->clear(); = for (Entry::ConstIterator it =3D internalEntry->constBegin(); it !=3D = internalEntry->constEnd(); ++it) @@ -1099,7 +1099,7 @@ protected: FileImporterBibTeX importer; FileExporterBibTeX exporter; const File *file =3D importer.fromString(event->mimeData()->text()= ); - if (file !=3D NULL && file->count() =3D=3D 1) + if (file !=3D nullptr && file->count() =3D=3D 1) document()->setPlainText(exporter.toString(file->first(), file= )); else KTextEdit::dropEvent(event); @@ -1124,7 +1124,7 @@ bool SourceWidget::apply(QSharedPointer elem= ent) const const QString text =3D sourceEdit->document()->toPlainText(); FileImporterBibTeX importer; File *file =3D importer.fromString(text); - if (file =3D=3D NULL) return false; + if (file =3D=3D nullptr) return false; = bool result =3D false; if (file->count() =3D=3D 1) { diff --git a/src/gui/element/findpdfui.cpp b/src/gui/element/findpdfui.cpp index fc07db5c..55ec9014 100644 --- a/src/gui/element/findpdfui.cpp +++ b/src/gui/element/findpdfui.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -71,7 +71,7 @@ PDFItemDelegate::PDFItemDelegate(QListView *itemView, QOb= ject *parent) void PDFItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem = &option, const QModelIndex &index) const { QStyle *style =3D QApplication::style(); - style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0= ); + style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, n= ullptr); = painter->save(); = @@ -149,7 +149,7 @@ void PDFItemDelegate::updateItemWidgets(const QList widgets, const QS if (!index.isValid()) return; = const PDFListModel *model =3D qobject_cast(index= .model()); - if (model =3D=3D NULL) { + if (model =3D=3D nullptr) { qCDebug(LOG_KBIBTEX_GUI) << "WARNING - INVALID MODEL!"; return; } @@ -167,7 +167,7 @@ void PDFItemDelegate::updateItemWidgets(const QList widgets, const QS = /// setup label which will show the PDF file's URL KSqueezedTextLabel *label =3D qobject_cast(widge= ts[posLabelUrl]); - if (label !=3D NULL) { + if (label !=3D nullptr) { const QString text =3D index.data(URLRole).toUrl().toDisplayString= (); label->setText(text); label->setToolTip(text); @@ -177,7 +177,7 @@ void PDFItemDelegate::updateItemWidgets(const QList widgets, const QS = /// setup label which will show the PDF's title or textual beginning QLabel *previewLabel =3D qobject_cast(widgets[posLabelPrevie= w]); - if (previewLabel !=3D NULL) { + if (previewLabel !=3D nullptr) { previewLabel->setText(index.data(TextualPreviewRole).toString()); previewLabel->move(margin * 2 + KIconLoader::SizeMedium, margin * = 2 + labelHeight); previewLabel->resize(labelWidth, labelHeight); @@ -185,7 +185,7 @@ void PDFItemDelegate::updateItemWidgets(const QList widgets, const QS = /// setup the view button QPushButton *viewButton =3D qobject_cast(widgets[posVie= wButton]); - if (viewButton !=3D NULL) { + if (viewButton !=3D nullptr) { const QSize hint =3D viewButton->sizeHint(); const int h =3D hint.isValid() ? qMin(buttonHeight, hint.height())= : buttonHeight; viewButton->move(margin * 2 + KIconLoader::SizeMedium, option.rect= .height() - margin - h); @@ -195,7 +195,7 @@ void PDFItemDelegate::updateItemWidgets(const QList widgets, const QS /// setup each of the three radio buttons for (int i =3D 0; i < 3; ++i) { QRadioButton *radioButton =3D qobject_cast(widgets= [posRadioNoDownload + i]); - if (radioButton !=3D NULL) { + if (radioButton !=3D nullptr) { const QSize hint =3D radioButton->sizeHint(); const int h =3D hint.isValid() ? qMin(buttonHeight, hint.heigh= t()) : buttonHeight; radioButton->move(option.rect.width() - margin - (3 - i) * (bu= ttonWidth + margin), option.rect.height() - margin - h); @@ -232,13 +232,13 @@ void PDFItemDelegate::slotViewPDF() QMimeType mimeType =3D FileInfo::mimeTypeForUrl(tempUrl); const QString mimeTypeName =3D mimeType.name(); /// Ask KDE subsystem to open url in viewer matching mime type - KRun::runUrl(tempUrl, mimeTypeName, NULL, false, false, url.to= DisplayString()); + KRun::runUrl(tempUrl, mimeTypeName, nullptr, false, false, url= .toDisplayString()); } else if (url.isValid()) { /// Guess mime type for url to open QMimeType mimeType =3D FileInfo::mimeTypeForUrl(url); const QString mimeTypeName =3D mimeType.name(); /// Ask KDE subsystem to open url in viewer matching mime type - KRun::runUrl(url, mimeTypeName, NULL, false, false); + KRun::runUrl(url, mimeTypeName, nullptr, false, false); } } } @@ -304,7 +304,7 @@ QVariant PDFListModel::data(const QModelIndex &index, i= nt role) const else if (role =3D=3D Qt::ToolTipRole) return QStringLiteral("") + m_resultList[index.row()].tex= tPreview + QStringLiteral(""); ///< 'qt' tags required for word wrap else if (role =3D=3D TempFileNameRole) { - if (m_resultList[index.row()].tempFilename !=3D NULL) + if (m_resultList[index.row()].tempFilename !=3D nullptr) return m_resultList[index.row()].tempFilename->fileName(); else return QVariant(); diff --git a/src/gui/element/findpdfui_p.h b/src/gui/element/findpdfui_p.h index eee26a3c..ef60f567 100644 --- a/src/gui/element/findpdfui_p.h +++ b/src/gui/element/findpdfui_p.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -66,7 +66,7 @@ class PDFListModel : public QAbstractListModel Q_OBJECT = public: - explicit PDFListModel(QList &resultList, QObject = *parent =3D NULL); + explicit PDFListModel(QList &resultList, QObject = *parent =3D nullptr); = int rowCount(const QModelIndex &parent =3D QModelIndex()) const; QVariant data(const QModelIndex &index, int role =3D Qt::DisplayRole) = const; diff --git a/src/gui/field/colorlabelwidget.cpp b/src/gui/field/colorlabelw= idget.cpp index 8d6d153d..0b1da09f 100644 --- a/src/gui/field/colorlabelwidget.cpp +++ b/src/gui/field/colorlabelwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -46,7 +46,7 @@ public: = KSharedConfigPtr config; = - ColorLabelComboBoxModel(QObject *p =3D NULL) + ColorLabelComboBoxModel(QObject *p =3D nullptr) : QAbstractItemModel(p), userColor(Qt::black), config(KSharedC= onfig::openConfig(QStringLiteral("kbibtexrc"))) { readConfiguration(); NotificationHub::registerNotificationListener(this, NotificationHu= b::EventConfigurationChanged); diff --git a/src/gui/field/colorlabelwidget.h b/src/gui/field/colorlabelwid= get.h index 05d1c529..cbedec10 100644 --- a/src/gui/field/colorlabelwidget.h +++ b/src/gui/field/colorlabelwidget.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -32,7 +32,7 @@ class KBIBTEXGUI_EXPORT ColorLabelWidget : public KComboB= ox Q_OBJECT = public: - explicit ColorLabelWidget(QWidget *parent =3D NULL); + explicit ColorLabelWidget(QWidget *parent =3D nullptr); ~ColorLabelWidget(); = void clear(); diff --git a/src/gui/field/fieldinput.cpp b/src/gui/field/fieldinput.cpp index d49b6207..bdcc9173 100644 --- a/src/gui/field/fieldinput.cpp +++ b/src/gui/field/fieldinput.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -52,15 +52,15 @@ public: const Element *element; = FieldInputPrivate(FieldInput *parent) - : p(parent), colorWidget(NULL), starRatingWidget(NULL), fieldL= ineEdit(NULL), fieldListEdit(NULL), fieldInputType(KBibTeX::SingleLine), pr= eferredTypeFlag(KBibTeX::tfSource), bibtexFile(NULL), element(NULL) { + : p(parent), colorWidget(nullptr), starRatingWidget(nullptr), = fieldLineEdit(nullptr), fieldListEdit(nullptr), fieldInputType(KBibTeX::Sin= gleLine), preferredTypeFlag(KBibTeX::tfSource), bibtexFile(nullptr), elemen= t(nullptr) { /// nothing } = ~FieldInputPrivate() { - if (colorWidget !=3D NULL) delete colorWidget; - else if (starRatingWidget !=3D NULL) delete starRatingWidget; - else if (fieldLineEdit !=3D NULL) delete fieldLineEdit; - else if (fieldListEdit !=3D NULL) delete fieldListEdit; + if (colorWidget !=3D nullptr) delete colorWidget; + else if (starRatingWidget !=3D nullptr) delete starRatingWidget; + else if (fieldLineEdit !=3D nullptr) delete fieldLineEdit; + else if (fieldListEdit !=3D nullptr) delete fieldListEdit; } = void createGUI() { @@ -134,13 +134,13 @@ public: = void clear() { disableModifiedSignal(); - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) fieldLineEdit->setText(QStringLiteral("")); - else if (fieldListEdit !=3D NULL) + else if (fieldListEdit !=3D nullptr) fieldListEdit->clear(); - else if (colorWidget !=3D NULL) + else if (colorWidget !=3D nullptr) colorWidget->clear(); - else if (starRatingWidget !=3D NULL) + else if (starRatingWidget !=3D nullptr) starRatingWidget->unsetValue(); enableModifiedSignal(); } @@ -151,13 +151,13 @@ public: disableModifiedSignal(); = bool result =3D false; - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) result =3D fieldLineEdit->reset(value); - else if (fieldListEdit !=3D NULL) + else if (fieldListEdit !=3D nullptr) result =3D fieldListEdit->reset(value); - else if (colorWidget !=3D NULL) + else if (colorWidget !=3D nullptr) result =3D colorWidget->reset(value); - else if (starRatingWidget !=3D NULL) + else if (starRatingWidget !=3D nullptr) result =3D starRatingWidget->reset(value); = enableModifiedSignal(); @@ -166,61 +166,61 @@ public: = bool apply(Value &value) const { bool result =3D false; - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) result =3D fieldLineEdit->apply(value); - else if (fieldListEdit !=3D NULL) + else if (fieldListEdit !=3D nullptr) result =3D fieldListEdit->apply(value); - else if (colorWidget !=3D NULL) + else if (colorWidget !=3D nullptr) result =3D colorWidget->apply(value); - else if (starRatingWidget !=3D NULL) + else if (starRatingWidget !=3D nullptr) result =3D starRatingWidget->apply(value); return result; } = void setReadOnly(bool isReadOnly) { - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) fieldLineEdit->setReadOnly(isReadOnly); - else if (fieldListEdit !=3D NULL) + else if (fieldListEdit !=3D nullptr) fieldListEdit->setReadOnly(isReadOnly); - else if (colorWidget !=3D NULL) + else if (colorWidget !=3D nullptr) colorWidget->setReadOnly(isReadOnly); - else if (starRatingWidget !=3D NULL) + else if (starRatingWidget !=3D nullptr) starRatingWidget->setReadOnly(isReadOnly); } = void setFile(const File *file) { bibtexFile =3D file; - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) fieldLineEdit->setFile(file); - if (fieldListEdit !=3D NULL) + if (fieldListEdit !=3D nullptr) fieldListEdit->setFile(file); } = void setElement(const Element *element) { this->element =3D element; - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) fieldLineEdit->setElement(element); - if (fieldListEdit !=3D NULL) + if (fieldListEdit !=3D nullptr) fieldListEdit->setElement(element); } = void setFieldKey(const QString &fieldKey) { - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) fieldLineEdit->setFieldKey(fieldKey); - if (fieldListEdit !=3D NULL) + if (fieldListEdit !=3D nullptr) fieldListEdit->setFieldKey(fieldKey); } = void setCompletionItems(const QStringList &items) { - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) fieldLineEdit->setCompletionItems(items); - if (fieldListEdit !=3D NULL) + if (fieldListEdit !=3D nullptr) fieldListEdit->setCompletionItems(items); } = bool selectCrossRef() { - Q_ASSERT_X(fieldLineEdit !=3D NULL, "void FieldInput::FieldInputPr= ivate::selectCrossRef()", "fieldLineEdit is invalid"); - if (bibtexFile =3D=3D NULL) return false; + Q_ASSERT_X(fieldLineEdit !=3D nullptr, "void FieldInput::FieldInpu= tPrivate::selectCrossRef()", "fieldLineEdit is invalid"); + if (bibtexFile =3D=3D nullptr) return false; = /// create a standard input dialog with a list of all keys (ids of= entries) bool ok =3D false; @@ -229,7 +229,7 @@ public: = /// remove own id const Entry *entry =3D dynamic_cast(element); - if (entry !=3D NULL) list.removeOne(entry->id()); + if (entry !=3D nullptr) list.removeOne(entry->id()); = QString crossRef =3D QInputDialog::getItem(p, i18n("Select Cross R= eference"), i18n("Select the cross reference to another entry:"), list, 0, = false, &ok); = @@ -244,24 +244,24 @@ public: } = void enableModifiedSignal() { - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) connect(fieldLineEdit, &FieldLineEdit::textChanged, p, &FieldI= nput::modified); - if (fieldListEdit !=3D NULL) + if (fieldListEdit !=3D nullptr) connect(fieldListEdit, &FieldListEdit::modified, p, &FieldInpu= t::modified); - if (colorWidget !=3D NULL) + if (colorWidget !=3D nullptr) connect(colorWidget, &ColorLabelWidget::modified, p, &FieldInp= ut::modified); - if (starRatingWidget !=3D NULL) + if (starRatingWidget !=3D nullptr) connect(starRatingWidget, &StarRatingFieldInput::modified, p, = &FieldInput::modified); } = void disableModifiedSignal() { - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) disconnect(fieldLineEdit, &FieldLineEdit::textChanged, p, &Fie= ldInput::modified); - if (fieldListEdit !=3D NULL) + if (fieldListEdit !=3D nullptr) disconnect(fieldListEdit, &FieldListEdit::modified, p, &FieldI= nput::modified); - if (colorWidget !=3D NULL) + if (colorWidget !=3D nullptr) disconnect(colorWidget, &ColorLabelWidget::modified, p, &Field= Input::modified); - if (starRatingWidget !=3D NULL) + if (starRatingWidget !=3D nullptr) disconnect(starRatingWidget, &StarRatingFieldInput::modified, = p, &FieldInput::modified); } }; @@ -322,14 +322,14 @@ void FieldInput::setCompletionItems(const QStringList= &items) = QWidget *FieldInput::buddy() { - if (d->fieldLineEdit !=3D NULL) + if (d->fieldLineEdit !=3D nullptr) return d->fieldLineEdit->buddy(); // TODO fieldListEdit - else if (d->colorWidget !=3D NULL) + else if (d->colorWidget !=3D nullptr) return d->colorWidget; - else if (d->starRatingWidget !=3D NULL) + else if (d->starRatingWidget !=3D nullptr) return d->starRatingWidget; - return NULL; + return nullptr; } = void FieldInput::setMonth(int month) diff --git a/src/gui/field/fieldinput.h b/src/gui/field/fieldinput.h index 25ccf358..af1e8055 100644 --- a/src/gui/field/fieldinput.h +++ b/src/gui/field/fieldinput.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -35,7 +35,7 @@ class KBIBTEXGUI_EXPORT FieldInput : public QWidget Q_OBJECT = public: - FieldInput(KBibTeX::FieldInputType fieldInputType, KBibTeX::TypeFlag p= referredTypeFlag, KBibTeX::TypeFlags typeFlags, QWidget *parent =3D NULL); + FieldInput(KBibTeX::FieldInputType fieldInputType, KBibTeX::TypeFlag p= referredTypeFlag, KBibTeX::TypeFlags typeFlags, QWidget *parent =3D nullptr= ); ~FieldInput(); = bool reset(const Value &value); diff --git a/src/gui/field/fieldlineedit.cpp b/src/gui/field/fieldlineedit.= cpp index e816121c..f3c7f40a 100644 --- a/src/gui/field/fieldlineedit.cpp +++ b/src/gui/field/fieldlineedit.cpp @@ -72,7 +72,7 @@ public: QString fieldKey; = FieldLineEditPrivate(KBibTeX::TypeFlag ptf, KBibTeX::TypeFlags tf, Fie= ldLineEdit *p) - : parent(p), preferredTypeFlag(ptf), typeFlags(tf), config(KSh= aredConfig::openConfig(QStringLiteral("kbibtexrc"))), configGroupNameGenera= l(QStringLiteral("General")), file(NULL) { + : parent(p), preferredTypeFlag(ptf), typeFlags(tf), config(KSh= aredConfig::openConfig(QStringLiteral("kbibtexrc"))), configGroupNameGenera= l(QStringLiteral("General")), file(nullptr) { menuTypes =3D new QMenu(parent); menuTypesSignalMapper =3D new QSignalMapper(parent); setupMenu(); @@ -190,7 +190,7 @@ public: = File *file =3D importer.fromString(fakeBibTeXFile); QSharedPointer entry; - if (file !=3D NULL) { + if (file !=3D nullptr) { if (!file->isEmpty() && !(entry =3D (file->first().dynamic= Cast())).isNull()) value =3D entry->value(key); delete file; @@ -388,7 +388,7 @@ public: = void updateURL(const QString &text) { QList urls; - FileInfo::urlsInText(text, FileInfo::TestExistenceYes, file !=3D N= ULL && file->property(File::Url).toUrl().isValid() ? QUrl(file->property(Fi= le::Url).toUrl()).path() : QString(), urls); + FileInfo::urlsInText(text, FileInfo::TestExistenceYes, file !=3D n= ullptr && file->property(File::Url).toUrl().isValid() ? QUrl(file->property= (File::Url).toUrl()).path() : QString(), urls); if (!urls.isEmpty() && urls.first().isValid()) urlToOpen =3D urls.first(); else @@ -484,11 +484,11 @@ void FieldLineEdit::dropEvent(QDropEvent *event) const QString clipboardText =3D event->mimeData()->text(); if (clipboardText.isEmpty()) return; = - const File *file =3D NULL; + const File *file =3D nullptr; if (!d->fieldKey.isEmpty() && clipboardText.startsWith(QStringLiteral(= "@"))) { FileImporterBibTeX importer; file =3D importer.fromString(clipboardText); - const QSharedPointer entry =3D (file !=3D NULL && file->cou= nt() =3D=3D 1) ? file->first().dynamicCast() : QSharedPointer= (); + const QSharedPointer entry =3D (file !=3D nullptr && file->= count() =3D=3D 1) ? file->first().dynamicCast() : QSharedPointer(); if (!entry.isNull() && d->fieldKey =3D=3D Entry::ftCrossRef) { /// handle drop on crossref line differently (use dropped entr= y's id) Value v; @@ -504,7 +504,7 @@ void FieldLineEdit::dropEvent(QDropEvent *event) } } = - if (file =3D=3D NULL || file->count() =3D=3D 0) { + if (file =3D=3D nullptr || file->count() =3D=3D 0) { /// fall-back case: just copy whole text into edit widget setText(clipboardText); emit textChanged(clipboardText); diff --git a/src/gui/field/fieldlineedit.h b/src/gui/field/fieldlineedit.h index 9d38a3ea..116f5ec1 100644 --- a/src/gui/field/fieldlineedit.h +++ b/src/gui/field/fieldlineedit.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -38,7 +38,7 @@ class KBIBTEXGUI_EXPORT FieldLineEdit : public MenuLineEd= it Q_OBJECT = public: - FieldLineEdit(KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags = typeFlags, bool isMultiLine =3D false, QWidget *parent =3D NULL); + FieldLineEdit(KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags = typeFlags, bool isMultiLine =3D false, QWidget *parent =3D nullptr); ~FieldLineEdit(); = bool reset(const Value &value); diff --git a/src/gui/field/fieldlistedit.cpp b/src/gui/field/fieldlistedit.= cpp index fd5c4868..5c159781 100644 --- a/src/gui/field/fieldlistedit.cpp +++ b/src/gui/field/fieldlistedit.cpp @@ -75,7 +75,7 @@ public: QStringList completionItems; = FieldListEditProtected(KBibTeX::TypeFlag ptf, KBibTeX::TypeFlags tf, F= ieldListEdit *parent) - : p(parent), innerSpacing(4), preferredTypeFlag(ptf), typeFlag= s(tf), file(NULL), m_isReadOnly(false) { + : p(parent), innerSpacing(4), preferredTypeFlag(ptf), typeFlag= s(tf), file(nullptr), m_isReadOnly(false) { smRemove =3D new QSignalMapper(parent); smGoUp =3D new QSignalMapper(parent); smGoDown =3D new QSignalMapper(parent); @@ -324,13 +324,13 @@ void FieldListEdit::dropEvent(QDropEvent *event) const QString clipboardText =3D event->mimeData()->text(); if (clipboardText.isEmpty()) return; = - const File *file =3D NULL; + const File *file =3D nullptr; if (!d->fieldKey.isEmpty() && clipboardText.startsWith(QStringLiteral(= "@"))) { FileImporterBibTeX importer; file =3D importer.fromString(clipboardText); - const QSharedPointer entry =3D (file !=3D NULL && file->cou= nt() =3D=3D 1) ? file->first().dynamicCast() : QSharedPointer= (); + const QSharedPointer entry =3D (file !=3D nullptr && file->= count() =3D=3D 1) ? file->first().dynamicCast() : QSharedPointer(); = - if (file !=3D NULL && !entry.isNull() && d->fieldKey =3D=3D QStrin= gLiteral("^external")) { + if (file !=3D nullptr && !entry.isNull() && d->fieldKey =3D=3D QSt= ringLiteral("^external")) { /// handle "external" list differently const QList urlList =3D FileInfo::entryUrls(entry.data()= , QUrl(file->property(File::Url).toUrl()), FileInfo::TestExistenceNo); Value v; @@ -348,7 +348,7 @@ void FieldListEdit::dropEvent(QDropEvent *event) } } = - if (file =3D=3D NULL || file->count() =3D=3D 0) { + if (file =3D=3D nullptr || file->count() =3D=3D 0) { /// fall-back case: single field line edit with text d->removeAllFieldLineEdits(); FieldLineEdit *fle =3D addFieldLineEdit(); @@ -361,7 +361,7 @@ void FieldListEdit::lineAdd(Value *value) { FieldLineEdit *le =3D addFieldLineEdit(); le->setCompletionItems(d->completionItems); - if (value !=3D NULL) + if (value !=3D nullptr) le->reset(*value); } = @@ -491,7 +491,7 @@ UrlListEdit::~UrlListEdit() = void UrlListEdit::slotAddReference() { - QUrl bibtexUrl(d->file !=3D NULL ? d->file->property(File::Url, QVaria= nt()).toUrl() : QUrl()); + QUrl bibtexUrl(d->file !=3D nullptr ? d->file->property(File::Url, QVa= riant()).toUrl() : QUrl()); if (!bibtexUrl.isEmpty()) { const QFileInfo fi(bibtexUrl.path()); bibtexUrl.setPath(fi.absolutePath()); @@ -510,7 +510,7 @@ void UrlListEdit::slotAddReferenceFromClipboard() = void UrlListEdit::addReference(const QUrl &url) { const Entry *entry =3D dynamic_cast(m_element); - const QString entryId =3D entry !=3D NULL ? entry->id() : QString(); + const QString entryId =3D entry !=3D nullptr ? entry->id() : QString(); const QString visibleFilename =3D AssociatedFilesUI::associateUrl(url,= entryId, d->file, this); if (!visibleFilename.isEmpty()) { Value *value =3D new Value(); @@ -533,7 +533,7 @@ void UrlListEdit::slotSaveLocally(QWidget *widget) /// Get filename from url (without any path/directory part) QString filename =3D url.fileName(); /// Build QFileInfo from current BibTeX file if available - QFileInfo bibFileinfo =3D d->file !=3D NULL ? QFileInfo(d->file->p= roperty(File::Url).toUrl().path()) : QFileInfo(); + QFileInfo bibFileinfo =3D d->file !=3D nullptr ? QFileInfo(d->file= ->property(File::Url).toUrl().path()) : QFileInfo(); /// Build proposal to a local filename for remote file filename =3D bibFileinfo.isFile() ? bibFileinfo.absolutePath() + Q= Dir::separator() + filename : filename; /// Ask user for actual local filename to save remote file to @@ -576,11 +576,11 @@ void UrlListEdit::textChanged(QWidget *widget) { /// Determine associated QPushButton "Save locally" QPushButton *buttonSaveLocally =3D qobject_cast(widget); - if (buttonSaveLocally =3D=3D NULL) return; ///< should never happen! + if (buttonSaveLocally =3D=3D nullptr) return; ///< should never happen! = /// Assume a FieldLineEdit was the sender of this signal FieldLineEdit *fieldLineEdit =3D qobject_cast(m_signa= lMapperFieldLineEditTextChanged->mapping(widget)); - if (fieldLineEdit =3D=3D NULL) return; ///< should never happen! + if (fieldLineEdit =3D=3D nullptr) return; ///< should never happen! = /// Create URL from new text to make some tests on it /// Only remote URLs are of interest, therefore no tests @@ -724,7 +724,7 @@ void KeywordListEdit::setReadOnly(bool isReadOnly) = void KeywordListEdit::setFile(const File *file) { - if (file =3D=3D NULL) + if (file =3D=3D nullptr) m_keywordsFromFile.clear(); else m_keywordsFromFile =3D file->uniqueEntryValuesSet(Entry::ftKeyword= s); diff --git a/src/gui/field/fieldlistedit.h b/src/gui/field/fieldlistedit.h index 32592f02..d9b7a989 100644 --- a/src/gui/field/fieldlistedit.h +++ b/src/gui/field/fieldlistedit.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -45,7 +45,7 @@ class FieldListEdit : public QWidget Q_OBJECT = public: - FieldListEdit(KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags = typeFlags, QWidget *parent =3D NULL); + FieldListEdit(KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags = typeFlags, QWidget *parent =3D nullptr); ~FieldListEdit(); = virtual bool reset(const Value &value); @@ -92,7 +92,7 @@ class PersonListEdit : public FieldListEdit Q_OBJECT = public: - PersonListEdit(KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags= typeFlags, QWidget *parent =3D NULL); + PersonListEdit(KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags= typeFlags, QWidget *parent =3D nullptr); = virtual bool reset(const Value &value); virtual bool apply(Value &value) const; @@ -116,7 +116,7 @@ class UrlListEdit : public FieldListEdit Q_OBJECT = public: - explicit UrlListEdit(QWidget *parent =3D NULL); + explicit UrlListEdit(QWidget *parent =3D nullptr); ~UrlListEdit(); = virtual void setReadOnly(bool isReadOnly); @@ -157,7 +157,7 @@ class KeywordListEdit : public FieldListEdit public: static const QString keyGlobalKeywordList; = - explicit KeywordListEdit(QWidget *parent =3D NULL); + explicit KeywordListEdit(QWidget *parent =3D nullptr); = virtual void setReadOnly(bool isReadOnly); virtual void setFile(const File *file); diff --git a/src/gui/file/basicfileview.cpp b/src/gui/file/basicfileview.cpp index 6cab6598..648dd3fe 100644 --- a/src/gui/file/basicfileview.cpp +++ b/src/gui/file/basicfileview.cpp @@ -64,7 +64,7 @@ public: config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))), configGroupName(QStringLiteral("BibliographyView")), configHeaderState(QStringLiteral("HeaderState_%1")), - fileModel(NULL), sortFilterProxyModel(NULL) { + fileModel(nullptr), sortFilterProxyModel(nullptr) { /// Allocate memory for headerProperty structure headerProperty =3D (struct HeaderProperty *)calloc(1, sizeof(struc= t HeaderProperty)); headerProperty->columnCount =3D BibTeXFields::self()->count(); @@ -186,7 +186,7 @@ public: headerProperty->sumWidths +=3D headerProperty->columns[col= ].width; ++col; } - if (headerProperty->sumWidths <=3D 0){ + if (headerProperty->sumWidths <=3D 0) { qCWarning(LOG_KBIBTEX_GUI) << "Sum of column widths over visib= le columns is zero, resetting configuration"; resetHeaderProperties(); } @@ -318,14 +318,14 @@ BasicFileView::~BasicFileView() = void BasicFileView::setModel(QAbstractItemModel *model) { - d->sortFilterProxyModel =3D NULL; + d->sortFilterProxyModel =3D nullptr; d->fileModel =3D dynamic_cast(model); - if (d->fileModel =3D=3D NULL) { + if (d->fileModel =3D=3D nullptr) { d->sortFilterProxyModel =3D qobject_cast(= model); - Q_ASSERT_X(d->sortFilterProxyModel !=3D NULL, "BasicFileView::setM= odel(QAbstractItemModel *model)", "d->sortFilterProxyModel is NULL"); + Q_ASSERT_X(d->sortFilterProxyModel !=3D nullptr, "BasicFileView::s= etModel(QAbstractItemModel *model)", "d->sortFilterProxyModel is NULL"); d->fileModel =3D dynamic_cast(d->sortFilterProxyModel= ->sourceModel()); } - if (d->fileModel =3D=3D NULL) + if (d->fileModel =3D=3D nullptr) qCWarning(LOG_KBIBTEX_GUI) << "Failed to dynamically cast model to= FileModel*"; QTreeView::setModel(model); = @@ -333,7 +333,7 @@ void BasicFileView::setModel(QAbstractItemModel *model) if (header()->isSortIndicatorShown()) sort(header()->sortIndicatorSection(), header()->sortIndicatorOrde= r()); = - Q_ASSERT_X(d->fileModel !=3D NULL, "BasicFileView::setModel(QAbstractI= temModel *model)", "d->fileModel is NULL"); + Q_ASSERT_X(d->fileModel !=3D nullptr, "BasicFileView::setModel(QAbstra= ctItemModel *model)", "d->fileModel is NULL"); } = FileModel *BasicFileView::fileModel() @@ -394,7 +394,7 @@ void BasicFileView::headerResetToDefaults() void BasicFileView::sort(int t, Qt::SortOrder s) { SortFilterFileModel *sortedModel =3D qobject_cast(model()); - if (sortedModel !=3D NULL) { + if (sortedModel !=3D nullptr) { sortedModel->sort(t, s); /// Store sorting column and order in configuration data struct d->headerProperty->sortedColumn =3D header()->sortIndicatorSection= (); @@ -405,7 +405,7 @@ void BasicFileView::sort(int t, Qt::SortOrder s) void BasicFileView::noSorting() { SortFilterFileModel *sortedModel =3D qobject_cast(model()); - if (sortedModel !=3D NULL) { + if (sortedModel !=3D nullptr) { sortedModel->sort(-1); header()->setSortIndicator(-1, Qt::AscendingOrder); /// Store sorting column and order in configuration data struct diff --git a/src/gui/file/basicfileview.h b/src/gui/file/basicfileview.h index 698465cd..a81ba132 100644 --- a/src/gui/file/basicfileview.h +++ b/src/gui/file/basicfileview.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -32,7 +32,7 @@ class KBIBTEXGUI_EXPORT BasicFileView : public QTreeView { Q_OBJECT public: - explicit BasicFileView(const QString &name, QWidget *parent =3D 0); + explicit BasicFileView(const QString &name, QWidget *parent =3D nullpt= r); ~BasicFileView(); = virtual void setModel(QAbstractItemModel *model); diff --git a/src/gui/file/clipboard.cpp b/src/gui/file/clipboard.cpp index 26d6911b..9057eabf 100644 --- a/src/gui/file/clipboard.cpp +++ b/src/gui/file/clipboard.cpp @@ -118,7 +118,7 @@ public: /// use BibTeX importer to generate representation from plain text FileImporterBibTeX importer; File *file =3D importer.fromString(text); - if (file !=3D NULL) { + if (file !=3D nullptr) { if (!file->isEmpty()) { FileModel *fileModel =3D fileView->fileModel(); QSortFilterProxyModel *sfpModel =3D fileView->sortFilterPr= oxyModel(); diff --git a/src/gui/file/filedelegate.h b/src/gui/file/filedelegate.h index f050ecc4..0d6939e4 100644 --- a/src/gui/file/filedelegate.h +++ b/src/gui/file/filedelegate.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2015 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -27,7 +27,7 @@ class KBIBTEXGUI_EXPORT FileDelegate : public QStyledItem= Delegate Q_OBJECT = public: - explicit FileDelegate(QWidget *parent =3D NULL) + explicit FileDelegate(QWidget *parent =3D nullptr) : QStyledItemDelegate(parent) { /* nothing */ } diff --git a/src/gui/file/fileview.cpp b/src/gui/file/fileview.cpp index 6e32b5cb..d7f95bd6 100644 --- a/src/gui/file/fileview.cpp +++ b/src/gui/file/fileview.cpp @@ -60,7 +60,7 @@ private: = public: ElementEditorDialog(QWidget *parent) - : QDialog(parent), elementEditor(NULL) { + : QDialog(parent), elementEditor(nullptr) { /// restore window size KSharedConfigPtr config(KSharedConfig::openConfig(QStringLiteral("= kbibtexrc"))); configGroup =3D KConfigGroup(config, configGroupNameWindowSize); @@ -100,7 +100,7 @@ private: const QString ElementEditorDialog::configGroupNameWindowSize =3D QStringLi= teral("ElementEditorDialog"); = FileView::FileView(const QString &name, QWidget *parent) - : BasicFileView(name, parent), m_isReadOnly(false), m_current(QSha= redPointer()), m_filterBar(NULL), m_lastEditorPage(NULL), m_elemen= tEditorDialog(NULL), m_elementEditor(NULL), m_dbb(NULL) + : BasicFileView(name, parent), m_isReadOnly(false), m_current(QSha= redPointer()), m_filterBar(nullptr), m_lastEditorPage(nullptr), m_= elementEditorDialog(nullptr), m_elementEditor(nullptr), m_dbb(nullptr) { connect(this, &FileView::doubleClicked, this, &FileView::itemActivated= ); } @@ -195,7 +195,7 @@ void FileView::selectionChanged(const QItemSelection &s= elected, const QItemSelec if (index.column() !=3D 0) continue; ///< consider only column-0 i= ndices to avoid duplicate elements m_selection.append(elementAt(index)); } - if (m_current =3D=3D NULL && !selectedSet.isEmpty()) + if (m_current =3D=3D nullptr && !selectedSet.isEmpty()) m_current =3D elementAt(selectedSet.first()); = const QModelIndexList deselectedSet =3D deselected.indexes(); @@ -238,14 +238,14 @@ bool FileView::isReadOnly() const ValueListModel *FileView::valueListModel(const QString &field) { FileModel *model =3D fileModel(); - if (model !=3D NULL) { + if (model !=3D nullptr) { ValueListModel *result =3D new ValueListModel(model->bibliographyF= ile(), field, this); /// Keep track of external changes through modifications in this V= alueListModel instance connect(result, &ValueListModel::dataChanged, this, &FileView::ext= ernalModification); return result; } = - return NULL; + return nullptr; } = void FileView::setFilterBar(FilterBar *filterBar) @@ -255,7 +255,7 @@ void FileView::setFilterBar(FilterBar *filterBar) = void FileView::setFilterBarFilter(const SortFilterFileModel::FilterQuery &= fq) { - if (m_filterBar !=3D NULL) + if (m_filterBar !=3D nullptr) m_filterBar->setFilter(fq); } = @@ -293,15 +293,15 @@ void FileView::prepareEditorDialog(DialogType dialogT= ype) } = /// Create both the dialog window and the editing widget only once - if (m_elementEditorDialog =3D=3D NULL) + if (m_elementEditorDialog =3D=3D nullptr) m_elementEditorDialog =3D new ElementEditorDialog(this); - if (m_elementEditor =3D=3D NULL) { + if (m_elementEditor =3D=3D nullptr) { m_elementEditor =3D new ElementEditor(false, m_elementEditorDialog= ); m_elementEditorDialog->setElementEditor(m_elementEditor); } - if (m_dbb !=3D NULL) { + if (m_dbb !=3D nullptr) { delete m_dbb; - m_dbb =3D NULL; + m_dbb =3D nullptr; } = if (dialogType =3D=3D DialogTypeView) { diff --git a/src/gui/file/findduplicatesui.cpp b/src/gui/file/findduplicate= sui.cpp index 0d57bdeb..e8eba9c2 100644 --- a/src/gui/file/findduplicatesui.cpp +++ b/src/gui/file/findduplicatesui.cpp @@ -72,7 +72,7 @@ public: enum SelectionType {SelectionTypeNone, SelectionTypeRadio, SelectionTy= peCheck}; = AlternativesItemModel(QTreeView *parent) - : QAbstractItemModel(parent), p(parent), currentClique(NULL) { + : QAbstractItemModel(parent), p(parent), currentClique(nullptr= ) { // nothing } = @@ -104,7 +104,7 @@ public: } = int rowCount(const QModelIndex &parent =3D QModelIndex()) const { - if (currentClique =3D=3D NULL) + if (currentClique =3D=3D nullptr) return 0; = if (parent =3D=3D QModelIndex()) { @@ -362,7 +362,7 @@ public: lineEdit->setStyleSheet(QStringLiteral("border: none;")); return lineEdit; } - return NULL; + return nullptr; } = virtual void setEditorData(QWidget *editor, const QModelIndex &index) = const { @@ -411,7 +411,7 @@ private: QTreeView *tv; = public: - CheckableFileModel(QList &cliqueList, QTreeView *treeVi= ew, QObject *parent =3D NULL) + CheckableFileModel(QList &cliqueList, QTreeView *treeVi= ew, QObject *parent =3D nullptr) : FileModel(parent), cl(cliqueList), currentClique(0), tv(tree= View) { // nothing } @@ -475,13 +475,13 @@ private: EntryClique *currentClique; = public: - FilterIdFileModel(QObject *parent =3D NULL) - : QSortFilterProxyModel(parent), internalModel(NULL), currentC= lique(NULL) { + FilterIdFileModel(QObject *parent =3D nullptr) + : QSortFilterProxyModel(parent), internalModel(nullptr), curre= ntClique(nullptr) { // nothing } = void setCurrentClique(EntryClique *currentClique) { - Q_ASSERT_X(internalModel !=3D NULL, "FilterIdFileModel::setCurrent= Clique(EntryClique *currentClique)", "internalModel is NULL"); + Q_ASSERT_X(internalModel !=3D nullptr, "FilterIdFileModel::setCurr= entClique(EntryClique *currentClique)", "internalModel is NULL"); internalModel->setCurrentClique(currentClique); this->currentClique =3D currentClique; invalidate(); @@ -490,13 +490,13 @@ public: void setSourceModel(QAbstractItemModel *model) { QSortFilterProxyModel::setSourceModel(model); internalModel =3D dynamic_cast(model); - Q_ASSERT_X(internalModel !=3D NULL, "FilterIdFileModel::setSourceM= odel(QAbstractItemModel *model)", "internalModel is NULL"); + Q_ASSERT_X(internalModel !=3D nullptr, "FilterIdFileModel::setSour= ceModel(QAbstractItemModel *model)", "internalModel is NULL"); } = bool filterAcceptsRow(int source_row, const QModelIndex &source_parent= ) const { Q_UNUSED(source_parent) = - if (internalModel !=3D NULL && currentClique !=3D NULL) { + if (internalModel !=3D nullptr && currentClique !=3D nullptr) { QSharedPointer entry =3D internalModel->element(source_= row).dynamicCast(); if (!entry.isNull()) { QList > entryList =3D currentClique-= >entryList(); diff --git a/src/gui/file/sortfilterfilemodel.cpp b/src/gui/file/sortfilter= filemodel.cpp index 19dfcbd3..fad845a4 100644 --- a/src/gui/file/sortfilterfilemodel.cpp +++ b/src/gui/file/sortfilterfilemodel.cpp @@ -30,7 +30,7 @@ const QString SortFilterFileModel::configGroupName =3D QStringLiteral("Use= r Interface"); = SortFilterFileModel::SortFilterFileModel(QObject *parent) - : QSortFilterProxyModel(parent), m_internalModel(NULL), config(KSh= aredConfig::openConfig(QStringLiteral("kbibtexrc"))) + : QSortFilterProxyModel(parent), m_internalModel(nullptr), config(= KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) { m_filterQuery.combination =3D AnyTerm; loadState(); diff --git a/src/gui/file/sortfilterfilemodel.h b/src/gui/file/sortfilterfi= lemodel.h index 66cafafc..917a8cf7 100644 --- a/src/gui/file/sortfilterfilemodel.h +++ b/src/gui/file/sortfilterfilemodel.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2015 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -40,7 +40,7 @@ public: bool searchPDFfiles; }; = - explicit SortFilterFileModel(QObject *parent =3D 0); + explicit SortFilterFileModel(QObject *parent =3D nullptr); = virtual void setSourceModel(QAbstractItemModel *model); FileModel *fileSourceModel() const; diff --git a/src/gui/italictextitemmodel.h b/src/gui/italictextitemmodel.h index 31f4837e..221720f8 100644 --- a/src/gui/italictextitemmodel.h +++ b/src/gui/italictextitemmodel.h @@ -1,5 +1,5 @@ /*************************************************************************= **** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * = * * This program is free software; you can redistribute it and/or modify = * @@ -42,7 +42,7 @@ public: IdentifierRole =3D Qt::UserRole + 9672 }; = - explicit ItalicTextItemModel(QObject *parent =3D NULL); + explicit ItalicTextItemModel(QObject *parent =3D nullptr); ~ItalicTextItemModel(); = /** diff --git a/src/gui/preferences/kbibtexpreferencesdialog.cpp b/src/gui/pre= ferences/kbibtexpreferencesdialog.cpp index 2d55805b..0f18fd54 100644 --- a/src/gui/preferences/kbibtexpreferencesdialog.cpp +++ b/src/gui/preferences/kbibtexpreferencesdialog.cpp @@ -119,7 +119,7 @@ public: } case KMessageBox::No: { SettingsAbstractWidget *widget =3D qobject_cast(p->currentPage()->widget()); - if (widget !=3D NULL) + if (widget !=3D nullptr) widget->resetToDefaults(); break; } diff --git a/src/gui/preferences/kbibtexpreferencesdialog.h b/src/gui/prefe= rences/kbibtexpreferencesdialog.h index c5deabf4..4cdcaceb 100644 --- a/src/gui/preferences/kbibtexpreferencesdialog.h +++ b/src/gui/preferences/kbibtexpreferencesdialog.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * diff --git a/src/gui/preferences/settingscolorlabelwidget.cpp b/src/gui/pre= ferences/settingscolorlabelwidget.cpp index c8027a85..e04b9f67 100644 --- a/src/gui/preferences/settingscolorlabelwidget.cpp +++ b/src/gui/preferences/settingscolorlabelwidget.cpp @@ -44,7 +44,7 @@ class ColorLabelSettingsDelegate : public QStyledItemDele= gate Q_OBJECT = public: - ColorLabelSettingsDelegate(QWidget *parent =3D NULL) + ColorLabelSettingsDelegate(QWidget *parent =3D nullptr) : QStyledItemDelegate(parent) { /// nothing } @@ -301,26 +301,26 @@ public: QTreeView *view; = Private(SettingsColorLabelWidget *parent) - : p(parent), delegate(NULL), config(KSharedConfig::openConfig(= QStringLiteral("kbibtexrc"))), - model(NULL), buttonRemove(NULL), view(NULL) { + : p(parent), delegate(nullptr), config(KSharedConfig::openConf= ig(QStringLiteral("kbibtexrc"))), + model(nullptr), buttonRemove(nullptr), view(nullptr) { /// nothing } = void loadState() { /// Delegate state maintenance to model - if (model !=3D NULL) + if (model !=3D nullptr) model->loadState(); } = void saveState() { /// Delegate state maintenance to model - if (model !=3D NULL) + if (model !=3D nullptr) model->saveState(); } = void resetToDefaults() { /// Delegate state maintenance to model - if (model !=3D NULL) + if (model !=3D nullptr) model->resetToDefaults(); } = @@ -365,7 +365,7 @@ SettingsColorLabelWidget::SettingsColorLabelWidget(QWid= get *parent) : SettingsAbstractWidget(parent), d(new Private(this)) { /// Seed random number generator - qsrand(time(NULL)); + qsrand(time(nullptr)); = /// Setup GUI elements d->setupGUI(); @@ -522,9 +522,9 @@ void ColorLabelContextMenu::colorActivated(const QStrin= g &colorString) /// selected item in the tree view = SortFilterFileModel *sfbfm =3D qobject_cast(d->= fileView->model()); - Q_ASSERT_X(sfbfm !=3D NULL, "ColorLabelContextMenu::colorActivated(con= st QString &colorString)", "SortFilterFileModel *sfbfm is NULL"); + Q_ASSERT_X(sfbfm !=3D nullptr, "ColorLabelContextMenu::colorActivated(= const QString &colorString)", "SortFilterFileModel *sfbfm is NULL"); FileModel *model =3D sfbfm->fileSourceModel(); - Q_ASSERT_X(model !=3D NULL, "ColorLabelContextMenu::colorActivated(con= st QString &colorString)", "FileModel *model is NULL"); + Q_ASSERT_X(model !=3D nullptr, "ColorLabelContextMenu::colorActivated(= const QString &colorString)", "FileModel *model is NULL"); = /// Apply color change to all selected rows const QModelIndexList list =3D d->fileView->selectionModel()->selected= Indexes(); diff --git a/src/gui/preferences/settingsidsuggestionseditor.cpp b/src/gui/= preferences/settingsidsuggestionseditor.cpp index 8a32c6ad..75fa71d2 100644 --- a/src/gui/preferences/settingsidsuggestionseditor.cpp +++ b/src/gui/preferences/settingsidsuggestionseditor.cpp @@ -511,7 +511,7 @@ public: } = void addManagementButtons(TokenWidget *tokenWidget) { - if (tokenWidget !=3D NULL) { + if (tokenWidget !=3D nullptr) { QPushButton *buttonUp =3D new QPushButton(QIcon::fromTheme(QSt= ringLiteral("go-up")), QStringLiteral(""), tokenWidget); QPushButton *buttonDown =3D new QPushButton(QIcon::fromTheme(Q= StringLiteral("go-down")), QStringLiteral(""), tokenWidget); QPushButton *buttonRemove =3D new QPushButton(QIcon::fromTheme= (QStringLiteral("list-remove")), QStringLiteral(""), tokenWidget); @@ -589,7 +589,7 @@ public: = const QStringList tokenList =3D formatString.split(QStringLiteral(= "|"), QString::SkipEmptyParts); for (const QString &token : tokenList) { - TokenWidget *tokenWidget =3D NULL; + TokenWidget *tokenWidget =3D nullptr; = if (token[0] =3D=3D 'a' || token[0] =3D=3D 'A' || token[0] =3D= =3D 'z') { struct IdSuggestions::IdSuggestionTokenInfo info =3D p->ev= alToken(token.mid(1)); diff --git a/src/gui/preferences/settingsidsuggestionseditor.h b/src/gui/pr= eferences/settingsidsuggestionseditor.h index 1540dd19..0a6c86b5 100644 --- a/src/gui/preferences/settingsidsuggestionseditor.h +++ b/src/gui/preferences/settingsidsuggestionseditor.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2016 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -121,7 +121,7 @@ public: = static QString editSuggestion(const Entry *previewEntry, const QString= &suggestion, QWidget *parent); protected: - explicit IdSuggestionsEditDialog(QWidget *parent =3D 0, Qt::WindowFlag= s flags =3D 0); + explicit IdSuggestionsEditDialog(QWidget *parent =3D nullptr, Qt::Wind= owFlags flags =3D 0); }; = class IdSuggestionsEditWidget : public QWidget, public IdSuggestions @@ -129,7 +129,7 @@ class IdSuggestionsEditWidget : public QWidget, public = IdSuggestions Q_OBJECT = public: - explicit IdSuggestionsEditWidget(const Entry *previewEntry, QWidget *p= arent =3D 0, Qt::WindowFlags f =3D 0); + explicit IdSuggestionsEditWidget(const Entry *previewEntry, QWidget *p= arent =3D nullptr, Qt::WindowFlags f =3D 0); virtual ~IdSuggestionsEditWidget(); = void setFormatString(const QString &formatString); diff --git a/src/gui/preferences/settingsidsuggestionswidget.cpp b/src/gui/= preferences/settingsidsuggestionswidget.cpp index 3ecef5b5..3875e951 100644 --- a/src/gui/preferences/settingsidsuggestionswidget.cpp +++ b/src/gui/preferences/settingsidsuggestionswidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -46,7 +46,7 @@ private: static QSharedPointer exampleBibTeXEntry; = public: - IdSuggestionsModel(QObject *parent =3D NULL) + IdSuggestionsModel(QObject *parent =3D nullptr) : QAbstractListModel(parent) { m_idSuggestions =3D new IdSuggestions(); m_defaultFormatStringRow =3D -1; @@ -54,7 +54,7 @@ public: if (exampleBibTeXEntry.isNull()) { static FileImporterBibTeX fileImporterBibTeX; File *file =3D fileImporterBibTeX.fromString(exampleBibTeXEntr= yString); - if (file !=3D NULL) { + if (file !=3D nullptr) { if (!file->isEmpty()) exampleBibTeXEntry =3D file->first().dynamicCast(); delete file; diff --git a/src/gui/valuelistmodel.cpp b/src/gui/valuelistmodel.cpp index b6b3ab76..c628b165 100644 --- a/src/gui/valuelistmodel.cpp +++ b/src/gui/valuelistmodel.cpp @@ -61,7 +61,7 @@ void ValueListDelegate::setEditorData(QWidget *editor, co= nst QModelIndex &index) { if (index.column() =3D=3D 0) { FieldLineEdit *fieldLineEdit =3D qobject_cast(edi= tor); - if (fieldLineEdit !=3D NULL) + if (fieldLineEdit !=3D nullptr) fieldLineEdit->reset(index.model()->data(index, Qt::EditRole).= value()); } } @@ -69,7 +69,7 @@ void ValueListDelegate::setEditorData(QWidget *editor, co= nst QModelIndex &index) void ValueListDelegate::setModelData(QWidget *editor, QAbstractItemModel *= model, const QModelIndex &index) const { FieldLineEdit *fieldLineEdit =3D qobject_cast(editor); - if (fieldLineEdit !=3D NULL) { + if (fieldLineEdit !=3D nullptr) { Value v; fieldLineEdit->apply(v); if (v.count() =3D=3D 1) /// field should contain exactly one value= item (no zero, not two or more) @@ -248,7 +248,7 @@ QVariant ValueListModel::data(const QModelIndex &index,= int role) const = bool ValueListModel::setData(const QModelIndex &index, const QVariant &val= ue, int role) { - Q_ASSERT_X(file !=3D NULL, "ValueListModel::setData", "You cannot set = data if there is no BibTeX file associated with this value list."); + Q_ASSERT_X(file !=3D nullptr, "ValueListModel::setData", "You cannot s= et data if there is no BibTeX file associated with this value list."); = /// Continue only if in edit role and first column is to be changed if (role =3D=3D Qt::EditRole && index.column() =3D=3D 0) { @@ -345,7 +345,7 @@ void ValueListModel::readConfiguration() void ValueListModel::updateValues() { values.clear(); - if (file =3D=3D NULL) return; + if (file =3D=3D nullptr) return; = for (const auto &element : const_cast(*file)) { QSharedPointer entry =3D element.dynamicCast(); diff --git a/src/gui/valuelistmodel.h b/src/gui/valuelistmodel.h index 553e963c..79f8c8dd 100644 --- a/src/gui/valuelistmodel.h +++ b/src/gui/valuelistmodel.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -36,7 +36,7 @@ private: QTreeView *m_parent; = public: - explicit ValueListDelegate(QTreeView *parent =3D NULL) + explicit ValueListDelegate(QTreeView *parent =3D nullptr) : QStyledItemDelegate(parent), m_fieldName(QString()), m_paren= t(parent) {} = QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, c= onst QModelIndex &index) const; diff --git a/src/gui/widgets/filesettingswidget.cpp b/src/gui/widgets/files= ettingswidget.cpp index 9dfcb369..f3bee0e2 100644 --- a/src/gui/widgets/filesettingswidget.cpp +++ b/src/gui/widgets/filesettingswidget.cpp @@ -33,7 +33,7 @@ #define createDelimiterString(a, b) (QString(QStringLiteral("%1%2%3")).arg= (a).arg(QChar(8230)).arg(b)) = FileSettingsWidget::FileSettingsWidget(QWidget *parent) - : QWidget(parent), dummyPerson(Person(i18n("John"), i18n("Doe"), i= 18n("Jr."))), m_file(NULL) + : QWidget(parent), dummyPerson(Person(i18n("John"), i18n("Doe"), i= 18n("Jr."))), m_file(nullptr) { setupGUI(); } @@ -46,7 +46,7 @@ void FileSettingsWidget::resetToLoadedProperties() void FileSettingsWidget::loadProperties(File *file) { m_file =3D file; - if (m_file =3D=3D NULL) return; /// Nothing to do + if (m_file =3D=3D nullptr) return; /// Nothing to do = if (file->hasProperty(File::Encoding)) { m_comboBoxEncodings->blockSignals(true); @@ -100,7 +100,7 @@ void FileSettingsWidget::applyProperties() void FileSettingsWidget::saveProperties(File *file) { m_file =3D file; - if (m_file =3D=3D NULL) return; + if (m_file =3D=3D nullptr) return; = file->setProperty(File::Encoding, m_comboBoxEncodings->currentText()); QString stringDelimiter =3D m_comboBoxStringDelimiters->currentText(); @@ -116,7 +116,7 @@ void FileSettingsWidget::saveProperties(File *file) = void FileSettingsWidget::resetToDefaults() { - if (m_file !=3D NULL) { + if (m_file !=3D nullptr) { m_file->setPropertiesToDefault(); loadProperties(m_file); } diff --git a/src/gui/widgets/hidingtabwidget.cpp b/src/gui/widgets/hidingta= bwidget.cpp index cec0c4cb..9ed91ee4 100644 --- a/src/gui/widgets/hidingtabwidget.cpp +++ b/src/gui/widgets/hidingtabwidget.cpp @@ -39,12 +39,12 @@ HidingTabWidget::HidingTabWidget(QWidget *parent) = QWidget *HidingTabWidget::hideTab(int index) { - if (index < 0 || index >=3D count()) return NULL; + if (index < 0 || index >=3D count()) return nullptr; = HiddenTabInfo hti; hti.widget =3D widget(index); - hti.leftNeighborWidget =3D index > 0 ? widget(index - 1) : NULL; - hti.rightNeighborWidget =3D index < count() - 1 ? widget(index + 1) : = NULL; + hti.leftNeighborWidget =3D index > 0 ? widget(index - 1) : nullptr; + hti.rightNeighborWidget =3D index < count() - 1 ? widget(index + 1) : = nullptr; hti.label =3D tabText(index); hti.icon =3D tabIcon(index); hti.enabled =3D isTabEnabled(index); diff --git a/src/gui/widgets/hidingtabwidget.h b/src/gui/widgets/hidingtabw= idget.h index 377f1723..bd7ef4f4 100644 --- a/src/gui/widgets/hidingtabwidget.h +++ b/src/gui/widgets/hidingtabwidget.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -37,7 +37,7 @@ public: /// Negative value to describe an invalid tab position static const int InvalidTabPosition; = - explicit HidingTabWidget(QWidget *parent =3D NULL); + explicit HidingTabWidget(QWidget *parent =3D nullptr); = /** * Hides the tab at position @param index from this stack of widgets. diff --git a/src/gui/widgets/menulineedit.cpp b/src/gui/widgets/menulineedi= t.cpp index 99649d4b..4a7f738a 100644 --- a/src/gui/widgets/menulineedit.cpp +++ b/src/gui/widgets/menulineedit.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -49,7 +49,7 @@ public: KTextEdit *m_multiLineEditText; = MenuLineEditPrivate(bool isMultiLine, MenuLineEdit *parent) - : p(parent), m_isReadOnly(false), makeInnerWidgetsTransparent(= false), m_singleLineEditText(NULL), m_multiLineEditText(NULL) { + : p(parent), m_isReadOnly(false), makeInnerWidgetsTransparent(= false), m_singleLineEditText(nullptr), m_multiLineEditText(nullptr) { this->isMultiLine =3D isMultiLine; /// listen to configuration change events specifically concerning = a MenuLineEdit widget NotificationHub::registerNotificationListener(this, MenuLineEdit::= MenuLineConfigurationChangedEvent); @@ -75,7 +75,7 @@ public: /// check each widget inside MenuLineEdit for (int i =3D hLayout->count() - 1; i >=3D 0; --i) { QWidget *w =3D hLayout->itemAt(i)->widget(); - if (w !=3D NULL && w !=3D m_singleLineEditText && w !=3D m= _multiLineEditText) { + if (w !=3D nullptr && w !=3D m_singleLineEditText && w != =3D m_multiLineEditText) { /// for all widgets except the main editing widget: ch= ange tab focus policy w->setFocusPolicy(limitKeyboardTabStops ? Qt::ClickFoc= us : Qt::StrongFocus); } @@ -135,7 +135,7 @@ public: } = void fixTabOrder() { - QWidget *cur =3D NULL; + QWidget *cur =3D nullptr; if (hLayout->count() > 0) p->setTabOrder(p, (cur =3D hLayout->itemAt(0)->widget())); for (int i =3D 1; i < hLayout->count(); ++i) { @@ -152,7 +152,7 @@ public: /// check each widget inside MenuLineEdit for (int i =3D hLayout->count() - 1; i >=3D 0; --i) { QWidget *w =3D hLayout->itemAt(i)->widget(); - if (w !=3D NULL && w !=3D m_singleLineEditText && w !=3D m_mul= tiLineEditText) { + if (w !=3D nullptr && w !=3D m_singleLineEditText && w !=3D m_= multiLineEditText) { /// for all widgets except the main editing widget: change= tab focus policy QSizePolicy sp =3D w->sizePolicy(); w->setSizePolicy(sp.horizontalPolicy(), QSizePolicy::Minim= umExpanding); @@ -164,7 +164,7 @@ public: this->makeInnerWidgetsTransparent =3D makeInnerWidgetsTransparent; for (int i =3D hLayout->count() - 1; i >=3D 0; --i) { QWidget *w =3D hLayout->itemAt(i)->widget(); - if (w !=3D NULL) + if (w !=3D nullptr) w->setStyleSheet(makeInnerWidgetsTransparent ? transparent= StyleSheet : normalStyleSheet); } } @@ -193,7 +193,7 @@ const QString MenuLineEdit::MenuLineEditPrivate::normal= StyleSheet =3D QStringLiter MenuLineEdit::MenuLineEdit(bool isMultiLine, QWidget *parent) : QFrame(parent), d(new MenuLineEditPrivate(isMultiLine, this)) { - if (d->m_singleLineEditText !=3D NULL) { + if (d->m_singleLineEditText !=3D nullptr) { /// Only for single-line variants stretch buttons vertically QTimer::singleShot(250, this, &MenuLineEdit::slotVerticallyStretch= Buttons); } @@ -216,19 +216,19 @@ void MenuLineEdit::setReadOnly(bool readOnly) = QString MenuLineEdit::text() const { - if (d->m_singleLineEditText !=3D NULL) + if (d->m_singleLineEditText !=3D nullptr) return d->m_singleLineEditText->text(); - if (d->m_multiLineEditText !=3D NULL) + if (d->m_multiLineEditText !=3D nullptr) return d->m_multiLineEditText->document()->toPlainText(); return QStringLiteral(""); } = void MenuLineEdit::setText(const QString &text) { - if (d->m_singleLineEditText !=3D NULL) { + if (d->m_singleLineEditText !=3D nullptr) { d->m_singleLineEditText->setText(text); d->m_singleLineEditText->setCursorPosition(0); - } else if (d->m_multiLineEditText !=3D NULL) { + } else if (d->m_multiLineEditText !=3D nullptr) { d->m_multiLineEditText->document()->setPlainText(text); QTextCursor tc =3D d->m_multiLineEditText->textCursor(); tc.setPosition(0); @@ -243,9 +243,9 @@ void MenuLineEdit::setIcon(const QIcon &icon) = void MenuLineEdit::setFont(const QFont &font) { - if (d->m_singleLineEditText !=3D NULL) + if (d->m_singleLineEditText !=3D nullptr) d->m_singleLineEditText->setFont(font); - if (d->m_multiLineEditText !=3D NULL) + if (d->m_multiLineEditText !=3D nullptr) d->m_multiLineEditText->document()->setDefaultFont(font); } = @@ -256,19 +256,19 @@ void MenuLineEdit::setButtonToolTip(const QString &te= xt) = void MenuLineEdit::setChildAcceptDrops(bool acceptDrops) { - if (d->m_singleLineEditText !=3D NULL) + if (d->m_singleLineEditText !=3D nullptr) d->m_singleLineEditText->setAcceptDrops(acceptDrops); - if (d->m_multiLineEditText !=3D NULL) + if (d->m_multiLineEditText !=3D nullptr) d->m_multiLineEditText->setAcceptDrops(acceptDrops); } = QWidget *MenuLineEdit::buddy() { - if (d->m_singleLineEditText !=3D NULL) + if (d->m_singleLineEditText !=3D nullptr) return d->m_singleLineEditText; - if (d->m_multiLineEditText !=3D NULL) + if (d->m_multiLineEditText !=3D nullptr) return d->m_multiLineEditText; - return NULL; + return nullptr; } = void MenuLineEdit::prependWidget(QWidget *widget) @@ -288,30 +288,30 @@ void MenuLineEdit::setInnerWidgetsTransparency(bool m= akeInnerWidgetsTransparent) = bool MenuLineEdit::isModified() const { - if (d->m_singleLineEditText !=3D NULL) + if (d->m_singleLineEditText !=3D nullptr) return d->m_singleLineEditText->isModified(); - if (d->m_multiLineEditText !=3D NULL) + if (d->m_multiLineEditText !=3D nullptr) return d->m_multiLineEditText->document()->isModified(); return false; } = void MenuLineEdit::setCompletionItems(const QStringList &items) { - if (d->m_singleLineEditText !=3D NULL) + if (d->m_singleLineEditText !=3D nullptr) d->m_singleLineEditText->completionObject()->setItems(items); } = void MenuLineEdit::focusInEvent(QFocusEvent *) { - if (d->m_singleLineEditText !=3D NULL) + if (d->m_singleLineEditText !=3D nullptr) d->m_singleLineEditText->setFocus(); - else if (d->m_multiLineEditText !=3D NULL) + else if (d->m_multiLineEditText !=3D nullptr) d->m_multiLineEditText->setFocus(); } = void MenuLineEdit::slotTextChanged() { - Q_ASSERT_X(d->m_multiLineEditText !=3D NULL, "MenuLineEdit::slotTextCh= anged", "d->m_multiLineEditText is NULL"); + Q_ASSERT_X(d->m_multiLineEditText !=3D nullptr, "MenuLineEdit::slotTex= tChanged", "d->m_multiLineEditText is NULL"); emit textChanged(d->m_multiLineEditText->toPlainText()); } = diff --git a/src/gui/widgets/starrating.h b/src/gui/widgets/starrating.h index 7a634b17..85a76071 100644 --- a/src/gui/widgets/starrating.h +++ b/src/gui/widgets/starrating.h @@ -1,5 +1,5 @@ /*************************************************************************= **** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * = * * This program is free software; you can redistribute it and/or modify = * @@ -53,7 +53,7 @@ public: * @param maxNumberOfStars number of stars (recommended value is 8) * @param parent parent widget */ - explicit StarRating(int maxNumberOfStars, QWidget *parent =3D NULL); + explicit StarRating(int maxNumberOfStars, QWidget *parent =3D nullptr); = /** * Get the current rating in percent (i.e >=3D0.0 and <=3D100.0). @@ -125,7 +125,7 @@ class KBIBTEXGUI_EXPORT StarRatingFieldInput : public S= tarRating Q_OBJECT = public: - explicit StarRatingFieldInput(int maxNumberOfStars, QWidget *parent = =3D NULL) + explicit StarRatingFieldInput(int maxNumberOfStars, QWidget *parent = =3D nullptr) : StarRating(maxNumberOfStars, parent) { /* nothing */ } diff --git a/src/io/encoderlatex.cpp b/src/io/encoderlatex.cpp index fe5e166c..e0de4278 100644 --- a/src/io/encoderlatex.cpp +++ b/src/io/encoderlatex.cpp @@ -524,7 +524,7 @@ EncoderLaTeX::EncoderLaTeX() m_trans =3D icu::Transliterator::createInstance("Any-Latin;Latin-ASCII= ", UTRANS_FORWARD, uec); = /// Initialize lookup table with NULL pointers - for (int i =3D 0; i < lookupTableNumModifiers; ++i) lookupTable[i] =3D= NULL; + for (int i =3D 0; i < lookupTableNumModifiers; ++i) lookupTable[i] =3D= nullptr; = int lookupTableCount =3D 0; /// Go through all table rows of encoderLaTeXEscapedCharacters @@ -565,10 +565,10 @@ EncoderLaTeX::~EncoderLaTeX() { /// Clean-up memory for (int i =3D lookupTableNumModifiers - 1; i >=3D 0; --i) - if (lookupTable[i] !=3D NULL) + if (lookupTable[i] !=3D nullptr) delete lookupTable[i]; = - if (m_trans !=3D NULL) + if (m_trans !=3D nullptr) delete m_trans; } = @@ -1121,7 +1121,7 @@ bool EncoderLaTeX::containsOnlyAscii(const QString &n= text) = int EncoderLaTeX::modifierInLookupTable(const char latinModifier) const { - for (int m =3D 0; m < lookupTableNumModifiers && lookupTable[m] !=3D N= ULL; ++m) + for (int m =3D 0; m < lookupTableNumModifiers && lookupTable[m] !=3D n= ullptr; ++m) if (lookupTable[m]->modifier =3D=3D latinModifier) return m; return -1; } diff --git a/src/io/fileexporter.h b/src/io/fileexporter.h index 3f52316c..eb8e1a84 100644 --- a/src/io/fileexporter.h +++ b/src/io/fileexporter.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -45,11 +45,11 @@ public: FileExporter(); ~FileExporter(); = - QString toString(const QSharedPointer element, const Fi= le *bibtexfile, QStringList *errorLog =3D NULL); - QString toString(const File *bibtexfile, QStringList *errorLog =3D NUL= L); + QString toString(const QSharedPointer element, const Fi= le *bibtexfile, QStringList *errorLog =3D nullptr); + QString toString(const File *bibtexfile, QStringList *errorLog =3D nul= lptr); = - virtual bool save(QIODevice *iodevice, const File *bibtexfile, QString= List *errorLog =3D NULL) =3D 0; - virtual bool save(QIODevice *iodevice, const QSharedPointer element, const File *bibtexfile, QStringList *errorLog =3D NULL) =3D 0; + virtual bool save(QIODevice *iodevice, const File *bibtexfile, QString= List *errorLog =3D nullptr) =3D 0; + virtual bool save(QIODevice *iodevice, const QSharedPointer element, const File *bibtexfile, QStringList *errorLog =3D nullptr) = =3D 0; = signals: void progress(int current, int total); diff --git a/src/io/fileexporterbibtex.cpp b/src/io/fileexporterbibtex.cpp index 41983b98..6275d246 100644 --- a/src/io/fileexporterbibtex.cpp +++ b/src/io/fileexporterbibtex.cpp @@ -43,7 +43,7 @@ = #define encodercheck(encoder, text) ((encoder)?(encoder)->encode((text)):(= text)) = -FileExporterBibTeX *FileExporterBibTeX::staticFileExporterBibTeX =3D NULL; +FileExporterBibTeX *FileExporterBibTeX::staticFileExporterBibTeX =3D nullp= tr; = class FileExporterBibTeX::FileExporterBibTeXPrivate { @@ -65,7 +65,7 @@ public: const QString configGroupName, configGroupNameGeneral; = FileExporterBibTeXPrivate(FileExporterBibTeX *parent) - : p(parent), keywordCasing(KBibTeX::cLowerCase), quoteComment(= Preferences::qcNone), protectCasing(Qt::PartiallyChecked), cancelFlag(false= ), destinationCodec(NULL), config(KSharedConfig::openConfig(QStringLiteral(= "kbibtexrc"))), configGroupName(QStringLiteral("FileExporterBibTeX")), conf= igGroupNameGeneral(QStringLiteral("General")) { + : p(parent), keywordCasing(KBibTeX::cLowerCase), quoteComment(= Preferences::qcNone), protectCasing(Qt::PartiallyChecked), cancelFlag(false= ), destinationCodec(nullptr), config(KSharedConfig::openConfig(QStringLiter= al("kbibtexrc"))), configGroupName(QStringLiteral("FileExporterBibTeX")), c= onfigGroupNameGeneral(QStringLiteral("General")) { // nothing } = @@ -91,7 +91,7 @@ public: } = void loadStateFromFile(const File *bibtexfile) { - if (bibtexfile =3D=3D NULL) return; + if (bibtexfile =3D=3D nullptr) return; = if (bibtexfile->hasProperty(File::Encoding)) encoding =3D bibtexfile->property(File::Encoding).toString(); @@ -497,7 +497,7 @@ void FileExporterBibTeX::cancel() = QString FileExporterBibTeX::valueToBibTeX(const Value &value, const QStrin= g &key, UseLaTeXEncoding useLaTeXEncoding) { - if (staticFileExporterBibTeX =3D=3D NULL) { + if (staticFileExporterBibTeX =3D=3D nullptr) { staticFileExporterBibTeX =3D new FileExporterBibTeX(); staticFileExporterBibTeX->d->loadState(); } diff --git a/src/io/fileexporterbibtex.h b/src/io/fileexporterbibtex.h index 50c81dcb..46216885 100644 --- a/src/io/fileexporterbibtex.h +++ b/src/io/fileexporterbibtex.h @@ -46,8 +46,8 @@ public: = void setEncoding(const QString &encoding); = - bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D NULL); - bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D NULL); + bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D nullptr); + bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D nullptr); = static QString valueToBibTeX(const Value &value, const QString &fieldT= ype =3D QString(), UseLaTeXEncoding useLaTeXEncoding =3D leLaTeX); = diff --git a/src/io/fileexporterbibtex2html.h b/src/io/fileexporterbibtex2h= tml.h index 7b9e9d07..8690d579 100644 --- a/src/io/fileexporterbibtex2html.h +++ b/src/io/fileexporterbibtex2html.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -32,8 +32,8 @@ public: = void reloadConfig(); = - bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D NULL); - bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D NULL); + bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D nullptr); + bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D nullptr); = void setLaTeXBibliographyStyle(const QString &bibStyle); = diff --git a/src/io/fileexporterbibtexoutput.h b/src/io/fileexporterbibtexo= utput.h index 3838eebb..09f7dbaf 100644 --- a/src/io/fileexporterbibtexoutput.h +++ b/src/io/fileexporterbibtexoutput.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -35,8 +35,8 @@ public: = void reloadConfig(); = - bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D NULL); - bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D NULL); + bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D nullptr); + bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D nullptr); = void setLaTeXLanguage(const QString &language); void setLaTeXBibliographyStyle(const QString &bibStyle); diff --git a/src/io/fileexporterbibutils.h b/src/io/fileexporterbibutils.h index b1397951..d554815a 100644 --- a/src/io/fileexporterbibutils.h +++ b/src/io/fileexporterbibutils.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -32,8 +32,8 @@ public: explicit FileExporterBibUtils(); ~FileExporterBibUtils(); = - bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D NULL); - bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D NULL); + bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D nullptr); + bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D nullptr); = private: class Private; diff --git a/src/io/fileexporterpdf.cpp b/src/io/fileexporterpdf.cpp index fc70227f..1ab4133c 100644 --- a/src/io/fileexporterpdf.cpp +++ b/src/io/fileexporterpdf.cpp @@ -89,7 +89,7 @@ bool FileExporterPDF::save(QIODevice *iodevice, const Fil= e *bibtexfile, QStringL if (result) result =3D generatePDF(iodevice, errorLog); = - if (errorLog !=3D NULL) + if (errorLog !=3D nullptr) qCDebug(LOG_KBIBTEX_IO) << "errorLog" << errorLog->join(QStringLit= eral(";")); = iodevice->close(); @@ -195,7 +195,7 @@ void FileExporterPDF::fillEmbeddedFileList(const File *= bibtexfile) = void FileExporterPDF::fillEmbeddedFileList(const QSharedPointer element, const File *bibtexfile) { - if (bibtexfile =3D=3D NULL || !bibtexfile->hasProperty(File::Url)) { + if (bibtexfile =3D=3D nullptr || !bibtexfile->hasProperty(File::Url)) { /// If no valid File was provided or File is not saved, do not app= end files return; } diff --git a/src/io/fileexporterpdf.h b/src/io/fileexporterpdf.h index 276ec5ab..6ba23876 100644 --- a/src/io/fileexporterpdf.h +++ b/src/io/fileexporterpdf.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -35,8 +35,8 @@ public: = void reloadConfig(); = - bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D NULL); - bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D NULL); + bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D nullptr); + bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D nullptr); = void setDocumentSearchPaths(const QStringList &searchPaths); = diff --git a/src/io/fileexporterps.h b/src/io/fileexporterps.h index a2bd5862..c8ea5502 100644 --- a/src/io/fileexporterps.h +++ b/src/io/fileexporterps.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -34,8 +34,8 @@ public: = void reloadConfig(); = - bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D NULL); - bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D NULL); + bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D nullptr); + bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D nullptr); = private: QString m_fileBasename; diff --git a/src/io/fileexporterris.h b/src/io/fileexporterris.h index e538b730..cc886ba9 100644 --- a/src/io/fileexporterris.h +++ b/src/io/fileexporterris.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -33,8 +33,8 @@ public: FileExporterRIS(); ~FileExporterRIS(); = - bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D NULL); - bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D NULL); + bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D nullptr); + bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D nullptr); = public slots: void cancel(); diff --git a/src/io/fileexporterrtf.h b/src/io/fileexporterrtf.h index 7759b793..42ace189 100644 --- a/src/io/fileexporterrtf.h +++ b/src/io/fileexporterrtf.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -34,8 +34,8 @@ public: = void reloadConfig(); = - bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D NULL); - bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D NULL); + bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D nullptr); + bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D nullptr); = private: QString m_fileBasename; diff --git a/src/io/fileexportertoolchain.cpp b/src/io/fileexportertoolchai= n.cpp index 14f270e2..43d62bdd 100644 --- a/src/io/fileexportertoolchain.cpp +++ b/src/io/fileexportertoolchain.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -33,7 +33,7 @@ const QString FileExporterToolchain::keyBibliographyStyle= =3D QStringLiteral("bibl const QString FileExporterToolchain::defaultBibliographyStyle =3D QStringL= iteral("plain"); = FileExporterToolchain::FileExporterToolchain() - : FileExporter(), m_process(NULL), m_errorLog(NULL) + : FileExporter(), m_process(nullptr), m_errorLog(nullptr) { tempDir.setAutoRemove(true); } @@ -70,12 +70,12 @@ bool FileExporterToolchain::runProcess(const QString &c= md, const QStringList &ar m_process->setProcessEnvironment(processEnvironment); m_process->setWorkingDirectory(tempDir.path()); = - if (m_errorLog !=3D NULL) { + if (m_errorLog !=3D nullptr) { connect(m_process, &QProcess::readyReadStandardOutput, this, &File= ExporterToolchain::slotReadProcessStandardOutput); connect(m_process, &QProcess::readyReadStandardError, this, &FileE= xporterToolchain::slotReadProcessErrorOutput); } = - if (errorLog !=3D NULL) + if (errorLog !=3D nullptr) errorLog->append(i18n("Running process '%1' using working director= y '%2'", (cmd + QLatin1Char(' ') + args.join(QStringLiteral(" "))), m_proce= ss->workingDirectory())); m_process->start(cmd, args); m_errorLog =3D errorLog; @@ -88,10 +88,10 @@ bool FileExporterToolchain::runProcess(const QString &c= md, const QStringList &ar } else result =3D false; = - if (!result && errorLog !=3D NULL) + if (!result && errorLog !=3D nullptr) errorLog->append(i18n("Process '%1' failed", (cmd + QLatin1Char(' = ') + args.join(QStringLiteral(" "))))); = - if (errorLog !=3D NULL) { + if (errorLog !=3D nullptr) { QTextStream tsStdOut(m_process->readAllStandardOutput()); QString line; while (!(line =3D tsStdOut.readLine()).isNull()) @@ -104,7 +104,7 @@ bool FileExporterToolchain::runProcess(const QString &c= md, const QStringList &ar } = delete(m_process); - m_process =3D NULL; + m_process =3D nullptr; = return result; } @@ -124,19 +124,19 @@ bool FileExporterToolchain::writeFileToIODevice(const= QString &filename, QIODevi file.close(); delete[] buffer; = - if (errorLog !=3D NULL) + if (errorLog !=3D nullptr) errorLog->append(i18n("Writing to file '%1' succeeded", filena= me)); return result; } = - if (errorLog !=3D NULL) + if (errorLog !=3D nullptr) errorLog->append(i18n("Writing to file '%1' failed", filename)); return false; } = void FileExporterToolchain::cancel() { - if (m_process !=3D NULL) { + if (m_process !=3D nullptr) { qWarning("Canceling process"); m_process->terminate(); m_process->kill(); diff --git a/src/io/fileexportertoolchain.h b/src/io/fileexportertoolchain.h index a079a6d8..842d86dc 100644 --- a/src/io/fileexportertoolchain.h +++ b/src/io/fileexportertoolchain.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -52,9 +52,9 @@ public slots: protected: QTemporaryDir tempDir; = - bool runProcesses(const QStringList &progs, QStringList *errorLog =3D = NULL); - bool runProcess(const QString &cmd, const QStringList &args, QStringLi= st *errorLog =3D NULL); - bool writeFileToIODevice(const QString &filename, QIODevice *device, Q= StringList *errorLog =3D NULL); + bool runProcesses(const QStringList &progs, QStringList *errorLog =3D = nullptr); + bool runProcess(const QString &cmd, const QStringList &args, QStringLi= st *errorLog =3D nullptr); + bool writeFileToIODevice(const QString &filename, QIODevice *device, Q= StringList *errorLog =3D nullptr); = private: QProcess *m_process; diff --git a/src/io/fileexporterxml.cpp b/src/io/fileexporterxml.cpp index 8dcd006a..388158da 100644 --- a/src/io/fileexporterxml.cpp +++ b/src/io/fileexporterxml.cpp @@ -95,19 +95,19 @@ bool FileExporterXML::write(QTextStream &stream, const = Element *element, const F bool result =3D false; = const Entry *entry =3D dynamic_cast(element); - if (entry !=3D NULL) { - if (bibtexfile !=3D NULL) + if (entry !=3D nullptr) { + if (bibtexfile !=3D nullptr) entry =3D entry->resolveCrossref(bibtexfile); result |=3D writeEntry(stream, entry); - if (bibtexfile !=3D NULL) + if (bibtexfile !=3D nullptr) delete entry; /// delete artificially created Entry from resol= veCrossref(..) } else { const Macro *macro =3D dynamic_cast(element); - if (macro !=3D NULL) + if (macro !=3D nullptr) result |=3D writeMacro(stream, macro); else { const Comment *comment =3D dynamic_cast(eleme= nt); - if (comment !=3D NULL) + if (comment !=3D nullptr) result |=3D writeComment(stream, comment); else { // preambles are ignored, make no sense in XML files diff --git a/src/io/fileexporterxml.h b/src/io/fileexporterxml.h index a376b0f2..d93226ae 100644 --- a/src/io/fileexporterxml.h +++ b/src/io/fileexporterxml.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -38,8 +38,8 @@ public: FileExporterXML(); ~FileExporterXML(); = - bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D NULL); - bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D NULL); + bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D nullptr); + bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D nullptr); = static QString valueToXML(const Value &value, const QString &fieldType= =3D QString()); = @@ -49,7 +49,7 @@ public slots: private: bool m_cancelFlag; = - bool write(QTextStream &stream, const Element *element, const File *bi= btexfile =3D NULL); + bool write(QTextStream &stream, const Element *element, const File *bi= btexfile =3D nullptr); bool writeEntry(QTextStream &stream, const Entry *entry); bool writeMacro(QTextStream &stream, const Macro *macro); bool writeComment(QTextStream &stream, const Comment *comment); diff --git a/src/io/fileexporterxslt.h b/src/io/fileexporterxslt.h index c547ed18..903e0ee7 100644 --- a/src/io/fileexporterxslt.h +++ b/src/io/fileexporterxslt.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -38,8 +38,8 @@ public: explicit FileExporterXSLT(const QString &xsltFilename =3D QString()); ~FileExporterXSLT(); = - bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D NULL); - bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D NULL); + bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *er= rorLog =3D nullptr); + bool save(QIODevice *iodevice, const QSharedPointer ele= ment, const File *bibtexfile, QStringList *errorLog =3D nullptr); = void setXSLTFilename(const QString &xsltFilename); = diff --git a/src/io/fileimporter.cpp b/src/io/fileimporter.cpp index 4e01befd..60b8797e 100644 --- a/src/io/fileimporter.cpp +++ b/src/io/fileimporter.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -40,7 +40,7 @@ File *FileImporter::fromString(const QString &text) { if (text.isEmpty()) { qCWarning(LOG_KBIBTEX_IO) << "Cannot create File object from empty= string"; - return NULL; + return nullptr; } = QBuffer buffer; @@ -52,7 +52,7 @@ File *FileImporter::fromString(const QString &text) = buffer.open(QIODevice::ReadOnly); File *result =3D load(&buffer); - if (result =3D=3D NULL) + if (result =3D=3D nullptr) qCWarning(LOG_KBIBTEX_IO) << "Creating File object from" << buffer= .size() << "Bytes of data failed"; buffer.close(); = @@ -68,7 +68,7 @@ Person *FileImporter::splitName(const QString &name) QString lastName; = if (segments.isEmpty()) - return NULL; + return nullptr; = if (!containsComma) { /** PubMed uses a special writing style for names, where the last = name is followed by single capital letter, diff --git a/src/io/fileimporterbibtex.cpp b/src/io/fileimporterbibtex.cpp index 25d7c5df..db965542 100644 --- a/src/io/fileimporterbibtex.cpp +++ b/src/io/fileimporterbibtex.cpp @@ -40,7 +40,7 @@ const char *FileImporterBibTeX::defaultCodecName =3D "utf-8"; = FileImporterBibTeX::FileImporterBibTeX(bool ignoreComments, KBibTeX::Casin= g keywordCasing) - : FileImporter(), m_cancelFlag(false), m_textStream(NULL), m_ignor= eComments(ignoreComments), m_keywordCasing(keywordCasing), m_lineNo(1) + : FileImporter(), m_cancelFlag(false), m_textStream(nullptr), m_ig= noreComments(ignoreComments), m_keywordCasing(keywordCasing), m_lineNo(1) { m_keysForPersonDetection.append(Entry::ftAuthor); m_keysForPersonDetection.append(Entry::ftEditor); @@ -57,7 +57,7 @@ File *FileImporterBibTeX::load(QIODevice *iodevice) = if (!iodevice->isReadable() && !iodevice->open(QIODevice::ReadOnly)) { qCWarning(LOG_KBIBTEX_IO) << "Input device not readable"; - return NULL; + return nullptr; } = File *result =3D new File(); @@ -112,7 +112,7 @@ File *FileImporterBibTeX::load(QIODevice *iodevice) emit progress(m_textStream->pos(), rawText.length()); Element *element =3D nextElement(); = - if (element !=3D NULL) { + if (element !=3D nullptr) { if (!m_ignoreComments || !Comment::isComment(*element)) result->append(QSharedPointer(element)); else @@ -124,12 +124,12 @@ File *FileImporterBibTeX::load(QIODevice *iodevice) if (m_cancelFlag) { qCWarning(LOG_KBIBTEX_IO) << "Loading file has been canceled"; delete result; - result =3D NULL; + result =3D nullptr; } = delete m_textStream; = - if (result !=3D NULL) { + if (result !=3D nullptr) { /// Set the file's preferences for string delimiters /// deduced from statistics built while parsing the file result->setProperty(File::StringDelimiter, m_statistics.countQuota= tionMarks > m_statistics.countCurlyBrackets ? QStringLiteral("\"\"") : QStr= ingLiteral("{}")); @@ -182,12 +182,12 @@ Element *FileImporterBibTeX::nextElement() return readPreambleElement(); else if (elementType.toLower() =3D=3D QStringLiteral("import")) { qCDebug(LOG_KBIBTEX_IO) << "Skipping potential HTML/JavaScript= @import statement"; - return NULL; + return nullptr; } else if (!elementType.isEmpty()) return readEntryElement(elementType); else { qCWarning(LOG_KBIBTEX_IO) << "ElementType is empty"; - return NULL; + return nullptr; } } else if (token =3D=3D tUnknown && m_nextChar =3D=3D QLatin1Char('%')= ) { /// do not complain about LaTeX-like comments, just eat them @@ -202,13 +202,13 @@ Element *FileImporterBibTeX::nextElement() if (token !=3D tEOF) qCWarning(LOG_KBIBTEX_IO) << "Don't know how to parse next token o= f type " << tokenidToString(token) << " in line " << m_lineNo << "(" << m_p= revLine << endl << m_currentLine << ")" << endl; = - return NULL; + return nullptr; } = Comment *FileImporterBibTeX::readCommentElement() { if (!readCharUntil(QStringLiteral("{("))) - return NULL; + return nullptr; return new Comment(EncoderLaTeX::instance().decode(readBracketString()= )); } = @@ -226,7 +226,7 @@ Comment *FileImporterBibTeX::readPlainCommentElement(co= nst QString &prefix) if (result.startsWith(QStringLiteral("x-kbibtex"))) { qCWarning(LOG_KBIBTEX_IO) << "Plain comment element starts with \"= x-kbibtex\", this should not happen"; /// ignore special comments - return NULL; + return nullptr; } = return new Comment(result); @@ -238,7 +238,7 @@ Macro *FileImporterBibTeX::readMacroElement() while (token !=3D tBracketOpen) { if (token =3D=3D tEOF) { qCWarning(LOG_KBIBTEX_IO) << "Error in parsing unknown macro' = (near line " << m_lineNo << ":" << m_prevLine << endl << m_currentLine << = "): Opening curly brace ({) expected"; - return NULL; + return nullptr; } token =3D nextToken(); } @@ -271,7 +271,7 @@ Macro *FileImporterBibTeX::readMacroElement() = if (nextToken() !=3D tAssign) { qCCritical(LOG_KBIBTEX_IO) << "Error in parsing macro '" << key <<= "'' (near line " << m_lineNo << ":" << m_prevLine << endl << m_currentLine= << "): Assign symbol (=3D) expected"; - return NULL; + return nullptr; } = Macro *macro =3D new Macro(key); @@ -295,7 +295,7 @@ Preamble *FileImporterBibTeX::readPreambleElement() while (token !=3D tBracketOpen) { if (token =3D=3D tEOF) { qCWarning(LOG_KBIBTEX_IO) << "Error in parsing unknown preambl= e' (near line " << m_lineNo << ":" << m_prevLine << endl << m_currentLine <= < "): Opening curly brace ({) expected"; - return NULL; + return nullptr; } token =3D nextToken(); } @@ -327,7 +327,7 @@ Entry *FileImporterBibTeX::readEntryElement(const QStri= ng &typeString) while (token !=3D tBracketOpen) { if (token =3D=3D tEOF) { qCWarning(LOG_KBIBTEX_IO) << "Error in parsing unknown entry (= near line" << m_lineNo << ":" << m_prevLine << endl << m_currentLine << "):= Opening curly brace '{' expected"; - return NULL; + return nullptr; } token =3D nextToken(); } @@ -370,7 +370,7 @@ Entry *FileImporterBibTeX::readEntryElement(const QStri= ng &typeString) else qCWarning(LOG_KBIBTEX_IO) << "Error in parsing entry" << i= d << "(near line" << m_lineNo << ":" << m_prevLine << endl << m_currentLine= << "): Comma symbol (,) expected but got character" << QString(QStringLite= ral("0x%1")).arg(m_nextChar.unicode(), 4, 16, QLatin1Char('0')) << "(token"= << tokenidToString(token) << ")"; delete entry; - return NULL; + return nullptr; } = QString keyName =3D bf->format(readSimpleString(), m_keywordCasing= ); @@ -386,7 +386,7 @@ Entry *FileImporterBibTeX::readEntryElement(const QStri= ng &typeString) /// Something looks terribly wrong qCWarning(LOG_KBIBTEX_IO) << "Error in parsing entry" << i= d << "(near line" << m_lineNo << ":" << m_prevLine << endl << m_currentLine= << "): Closing curly bracket expected, but found" << tokenidToString(token= ); delete entry; - return NULL; + return nullptr; } } /// Try to avoid non-ascii characters in keys @@ -396,7 +396,7 @@ Entry *FileImporterBibTeX::readEntryElement(const QStri= ng &typeString) if (token !=3D tAssign) { qCWarning(LOG_KBIBTEX_IO) << "Error in parsing entry" << id <<= ", key" << keyName << " (near line " << m_lineNo << ":" << m_prevLine << = endl << m_currentLine << "): Assign symbol (=3D) expected after field name"= << keyName; delete entry; - return NULL; + return nullptr; } = Value value; @@ -791,7 +791,7 @@ QList > FileImporterBibTeX::spl= itKeywords(const QString char *curSplitChar =3D splitChars; static const QRegExp unneccessarySpacing(QStringLiteral("[ \n\r\t]+")); int index =3D 0; - if (usedSplitChar !=3D 0) + if (usedSplitChar !=3D nullptr) *usedSplitChar =3D '\0'; = /// for each char in list ... @@ -807,7 +807,7 @@ QList > FileImporterBibTeX::spl= itKeywords(const QString } /// Memorize (some) split characters for later use /// (e.g. when writing file again) - if (usedSplitChar !=3D 0) + if (usedSplitChar !=3D nullptr) *usedSplitChar =3D *curSplitChar; /// no more splits necessary break; @@ -893,7 +893,7 @@ QList > FileImporterBibTeX::spli= tNames(const QString &tex = void FileImporterBibTeX::parsePersonList(const QString &text, Value &value) { - parsePersonList(text, value, NULL); + parsePersonList(text, value, nullptr); } = void FileImporterBibTeX::parsePersonList(const QString &text, Value &value= , CommaContainment *comma) @@ -940,7 +940,7 @@ void FileImporterBibTeX::parsePersonList(const QString = &text, Value &value, Comm = QSharedPointer FileImporterBibTeX::personFromString(const QString = &name) { - return personFromString(name, NULL); + return personFromString(name, nullptr); } = QSharedPointer FileImporterBibTeX::personFromString(const QString = &name, CommaContainment *comma) @@ -952,7 +952,7 @@ QSharedPointer FileImporterBibTeX::personFromSt= ring(const QString &name, = QSharedPointer FileImporterBibTeX::personFromTokenList(const QStri= ngList &tokens, CommaContainment *comma) { - if (comma !=3D NULL) *comma =3D ccNoComma; + if (comma !=3D nullptr) *comma =3D ccNoComma; = /// Simple case: provided list of tokens is empty, return invalid Pers= on if (tokens.isEmpty()) @@ -1009,7 +1009,7 @@ QSharedPointer FileImporterBibTeX::personFrom= TokenList(const QStringList partC.append(token); } if (commaCount > 0) { - if (comma !=3D NULL) *comma =3D ccContainsComma; + if (comma !=3D nullptr) *comma =3D ccContainsComma; return QSharedPointer(new Person(partC.isEmpty() ? partB.j= oin(QChar(' ')) : partC.join(QChar(' ')), partA.join(QChar(' ')), partC.isE= mpty() ? QString() : partB.join(QChar(' ')))); } = diff --git a/src/io/fileimporterbibtex.h b/src/io/fileimporterbibtex.h index f995ecf8..e2eb2467 100644 --- a/src/io/fileimporterbibtex.h +++ b/src/io/fileimporterbibtex.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -79,7 +79,7 @@ public: * @return A list of Keyword object containing the keywords * @see Keyword */ - static QList > splitKeywords(const QString &te= xt, char *usedSplitChar =3D 0); + static QList > splitKeywords(const QString &te= xt, char *usedSplitChar =3D nullptr); = /** * Split a list of names into single Person objects. @@ -151,7 +151,7 @@ private: Token readValue(Value &value, const QString &fieldType); = static QSharedPointer personFromString(const QString &name, Co= mmaContainment *comma); - static QSharedPointer personFromTokenList(const QStringList &t= okens, CommaContainment *comma =3D NULL); + static QSharedPointer personFromTokenList(const QStringList &t= okens, CommaContainment *comma =3D nullptr); static void parsePersonList(const QString &text, Value &value, CommaCo= ntainment *comma); = /** diff --git a/src/io/fileimporterbibutils.cpp b/src/io/fileimporterbibutils.= cpp index 0e000345..2042766b 100644 --- a/src/io/fileimporterbibutils.cpp +++ b/src/io/fileimporterbibutils.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -52,7 +52,7 @@ File *FileImporterBibUtils::load(QIODevice *iodevice) { if (!iodevice->isReadable() && !iodevice->open(QIODevice::ReadOnly)) { qCWarning(LOG_KBIBTEX_IO) << "Input device not readable"; - return NULL; + return nullptr; } = QBuffer buffer; @@ -62,5 +62,5 @@ File *FileImporterBibUtils::load(QIODevice *iodevice) if (result) return d->bibtexImporter.load(&buffer); else - return NULL; + return nullptr; } diff --git a/src/io/fileimporterpdf.cpp b/src/io/fileimporterpdf.cpp index 0ac8b4e5..d648546f 100644 --- a/src/io/fileimporterpdf.cpp +++ b/src/io/fileimporterpdf.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -41,18 +41,18 @@ File *FileImporterPDF::load(QIODevice *iodevice) { if (!iodevice->isReadable() && !iodevice->open(QIODevice::ReadOnly)) { qCWarning(LOG_KBIBTEX_IO) << "Input device not readable"; - return NULL; + return nullptr; } = m_cancelFlag =3D false; - File *result =3D NULL; + File *result =3D nullptr; QByteArray buffer =3D iodevice->readAll(); = Poppler::Document *doc =3D Poppler::Document::loadFromData(buffer); - if (doc =3D=3D NULL) { + if (doc =3D=3D nullptr) { qCWarning(LOG_KBIBTEX_IO) << "Could not load PDF document"; iodevice->close(); - return NULL; + return nullptr; } = /// Iterate through all files embedded in this PDF file (if any), @@ -79,7 +79,7 @@ File *FileImporterPDF::load(QIODevice *iodevice) else { /// ... otherwise delete empty bibliography object delete result; - result =3D NULL; + result =3D nullptr; } } else qCDebug(LOG_KBIBTEX_IO) << "Create bibliography file f= rom embedded file" << file->name() << "failed"; diff --git a/src/io/fileimporterris.cpp b/src/io/fileimporterris.cpp index cb4b393c..6b0206e4 100644 --- a/src/io/fileimporterris.cpp +++ b/src/io/fileimporterris.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -94,7 +94,7 @@ public: Element *nextElement(QTextStream &textStream) { RISitemList list =3D readElement(textStream); if (list.empty()) - return NULL; + return nullptr; = QString entryType =3D Entry::etMisc; Entry *entry =3D new Entry(entryType, QString(QStringLiteral("RIS_= %1")).arg(referenceCounter++)); @@ -255,7 +255,7 @@ File *FileImporterRIS::load(QIODevice *iodevice) { if (!iodevice->isReadable() && !iodevice->open(QIODevice::ReadOnly)) { qCDebug(LOG_KBIBTEX_IO) << "Input device not readable"; - return NULL; + return nullptr; } = d->cancelFlag =3D false; @@ -267,7 +267,7 @@ File *FileImporterRIS::load(QIODevice *iodevice) emit progress(textStream.pos(), iodevice->size()); QCoreApplication::instance()->processEvents(); Element *element =3D d->nextElement(textStream); - if (element !=3D NULL) + if (element !=3D nullptr) result->append(QSharedPointer(element)); QCoreApplication::instance()->processEvents(); } @@ -275,7 +275,7 @@ File *FileImporterRIS::load(QIODevice *iodevice) = if (d->cancelFlag) { delete result; - result =3D NULL; + result =3D nullptr; } = iodevice->close(); diff --git a/src/io/fileinfo.cpp b/src/io/fileinfo.cpp index eb816165..4a507ae9 100644 --- a/src/io/fileinfo.cpp +++ b/src/io/fileinfo.cpp @@ -184,7 +184,7 @@ void FileInfo::urlsInText(const QString &text, TestExis= tence testExistence, cons QList FileInfo::entryUrls(const Entry *entry, const QUrl &bibTeXUrl,= TestExistence testExistence) { QList result; - if (entry =3D=3D NULL || entry->isEmpty()) + if (entry =3D=3D nullptr || entry->isEmpty()) return result; = if (entry->contains(Entry::ftDOI)) { diff --git a/src/io/textencoder.cpp b/src/io/textencoder.cpp index 886cdf2e..d10b7276 100644 --- a/src/io/textencoder.cpp +++ b/src/io/textencoder.cpp @@ -38,7 +38,7 @@ QByteArray TextEncoder::encode(const QString &input, cons= t QString &destinationE QByteArray TextEncoder::encode(const QString &input, const QTextCodec *des= tinationCodec) { /// Invalid codec? Cannot do anything - if (destinationCodec =3D=3D NULL) + if (destinationCodec =3D=3D nullptr) return QByteArray(); = /// Perform Canonical Decomposition followed by Canonical Composition diff --git a/src/networking/associatedfiles.cpp b/src/networking/associated= files.cpp index f035894d..395f6e4c 100644 --- a/src/networking/associatedfiles.cpp +++ b/src/networking/associatedfiles.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -84,7 +84,7 @@ QString AssociatedFiles::absoluteFilename(const QUrl &doc= umentUrl, const QUrl &b } = QString AssociatedFiles::associateDocumentURL(const QUrl &document, QShare= dPointer &entry, const File *bibTeXFile, PathType pathType, const bo= ol dryRun) { - Q_ASSERT(bibTeXFile !=3D NULL); // FIXME more graceful? + Q_ASSERT(bibTeXFile !=3D nullptr); // FIXME more graceful? = const QUrl baseUrl =3D bibTeXFile->property(File::Url).toUrl(); if (baseUrl.isEmpty() && pathType =3D=3D ptRelative) { @@ -117,7 +117,7 @@ QString AssociatedFiles::associateDocumentURL(const QUr= l &document, QSharedPoint } = QString AssociatedFiles::associateDocumentURL(const QUrl &document, const = File *bibTeXFile, PathType pathType) { - Q_ASSERT(bibTeXFile !=3D NULL); // FIXME more graceful? + Q_ASSERT(bibTeXFile !=3D nullptr); // FIXME more graceful? = const QUrl baseUrl =3D bibTeXFile->property(File::Url).toUrl(); if (baseUrl.isEmpty() && pathType =3D=3D ptRelative) { @@ -132,7 +132,7 @@ QString AssociatedFiles::associateDocumentURL(const QUr= l &document, const File * } = QUrl AssociatedFiles::copyDocument(const QUrl &sourceUrl, const QString &e= ntryId, const File *bibTeXFile, RenameOperation renameOperation, MoveCopyOp= eration moveCopyOperation, QWidget *widget, const QString &userDefinedFilen= ame, const bool dryRun) { - Q_ASSERT(bibTeXFile !=3D NULL); // FIXME more graceful? + Q_ASSERT(bibTeXFile !=3D nullptr); // FIXME more graceful? = if (moveCopyOperation =3D=3D mcoNoCopyMove) return sourceUrl; /// nothing to do if no move or copy requested diff --git a/src/networking/findpdf.cpp b/src/networking/findpdf.cpp index 4b22673b..26638935 100644 --- a/src/networking/findpdf.cpp +++ b/src/networking/findpdf.cpp @@ -209,13 +209,13 @@ public: /// Failed to write to temporary file qCWarning(LOG_KBIBTEX_NETWORKING) << "Failed to write = to temporary file for filename" << resultItem.tempFilename->fileName(); delete resultItem.tempFilename; - resultItem.tempFilename =3D NULL; + resultItem.tempFilename =3D nullptr; } } else { /// Failed to create temporary file qCWarning(LOG_KBIBTEX_NETWORKING) << "Failed to create tem= porary file for templaet" << resultItem.tempFilename->fileTemplate(); delete resultItem.tempFilename; - resultItem.tempFilename =3D NULL; + resultItem.tempFilename =3D nullptr; } resultItem.url =3D url; resultItem.textPreview =3D doc->info(QStringLiteral("Title")).= simplified(); diff --git a/src/networking/findpdf.h b/src/networking/findpdf.h index 920fdba8..8eb34eb2 100644 --- a/src/networking/findpdf.h +++ b/src/networking/findpdf.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -59,7 +59,7 @@ public: DownloadMode downloadMode; /// User's preference what to do with t= his hit (default is NoDownload) } ResultItem; = - explicit FindPDF(QObject *parent =3D NULL); + explicit FindPDF(QObject *parent =3D nullptr); ~FindPDF(); = /** diff --git a/src/networking/internalnetworkaccessmanager.cpp b/src/networki= ng/internalnetworkaccessmanager.cpp index 28ec4f5c..33c7e14f 100644 --- a/src/networking/internalnetworkaccessmanager.cpp +++ b/src/networking/internalnetworkaccessmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -60,7 +60,7 @@ public: } } = - HTTPEquivCookieJar(QObject *parent =3D NULL) + HTTPEquivCookieJar(QObject *parent =3D nullptr) : QNetworkCookieJar(parent) { // nothing } @@ -68,7 +68,7 @@ public: = = QString InternalNetworkAccessManager::userAgentString; -InternalNetworkAccessManager *InternalNetworkAccessManager::instance =3D N= ULL; +InternalNetworkAccessManager *InternalNetworkAccessManager::instance =3D n= ullptr; = InternalNetworkAccessManager::InternalNetworkAccessManager(QObject *parent) : QNetworkAccessManager(parent) @@ -79,14 +79,14 @@ InternalNetworkAccessManager::InternalNetworkAccessMana= ger(QObject *parent) = void InternalNetworkAccessManager::mergeHtmlHeadCookies(const QString &htm= lCode, const QUrl &url) { - Q_ASSERT_X(cookieJar !=3D NULL, "void InternalNetworkAccessManager::me= rgeHtmlHeadCookies(const QString &htmlCode, const QUrl &url)", "cookieJar i= s invalid"); + Q_ASSERT_X(cookieJar !=3D nullptr, "void InternalNetworkAccessManager:= :mergeHtmlHeadCookies(const QString &htmlCode, const QUrl &url)", "cookieJa= r is invalid"); cookieJar->mergeHtmlHeadCookies(htmlCode, url); setCookieJar(cookieJar); } = InternalNetworkAccessManager *InternalNetworkAccessManager::self() { - if (instance =3D=3D NULL) { + if (instance =3D=3D nullptr) { instance =3D new InternalNetworkAccessManager(QApplication::instan= ce()); } = @@ -129,7 +129,7 @@ QNetworkReply *InternalNetworkAccessManager::get(QNetwo= rkRequest &request, const = QNetworkReply *InternalNetworkAccessManager::get(QNetworkRequest &request,= const QNetworkReply *oldReply) { - return get(request, oldReply =3D=3D NULL ? QUrl() : oldReply->url()); + return get(request, oldReply =3D=3D nullptr ? QUrl() : oldReply->url()= ); } = QString InternalNetworkAccessManager::userAgent() @@ -170,7 +170,7 @@ QString InternalNetworkAccessManager::userAgent() << QStringLiteral("Mozilla/5.0 (Windows; U; Windows NT 6.0; en= -US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.133 Safari/534.= 16"); = if (userAgentString.isEmpty()) { - qsrand(time(NULL)); + qsrand(time(nullptr)); userAgentString =3D userAgentList[qrand() % userAgentList.length()= ]; } return userAgentString; @@ -190,7 +190,7 @@ void InternalNetworkAccessManager::networkReplyTimeout() QTimer *timer =3D static_cast(sender()); timer->stop(); QNetworkReply *reply =3D m_mapTimerToReply[timer]; - if (reply !=3D NULL) { + if (reply !=3D nullptr) { qCWarning(LOG_KBIBTEX_NETWORKING) << "Timeout on reply to " << rep= ly->url().toDisplayString(); reply->close(); m_mapTimerToReply.remove(timer); @@ -199,8 +199,8 @@ void InternalNetworkAccessManager::networkReplyTimeout() void InternalNetworkAccessManager::networkReplyFinished() { QNetworkReply *reply =3D static_cast(sender()); - QTimer *timer =3D m_mapTimerToReply.key(reply, NULL); - if (timer !=3D NULL) { + QTimer *timer =3D m_mapTimerToReply.key(reply, nullptr); + if (timer !=3D nullptr) { disconnect(timer, &QTimer::timeout, this, &InternalNetworkAccessMa= nager::networkReplyTimeout); timer->stop(); m_mapTimerToReply.remove(timer); diff --git a/src/networking/internalnetworkaccessmanager.h b/src/networking= /internalnetworkaccessmanager.h index d5abbfbe..94a91f99 100644 --- a/src/networking/internalnetworkaccessmanager.h +++ b/src/networking/internalnetworkaccessmanager.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -40,14 +40,14 @@ class KBIBTEXNETWORKING_EXPORT InternalNetworkAccessMan= ager : public QNetworkAcc public: static InternalNetworkAccessManager *self(); QNetworkReply *get(QNetworkRequest &request, const QUrl &oldUrl); - QNetworkReply *get(QNetworkRequest &request, const QNetworkReply *oldR= eply =3D NULL); + QNetworkReply *get(QNetworkRequest &request, const QNetworkReply *oldR= eply =3D nullptr); = void mergeHtmlHeadCookies(const QString &htmlCode, const QUrl &url); = void setNetworkReplyTimeout(QNetworkReply *reply, int timeOutSec =3D 3= 0); = protected: - InternalNetworkAccessManager(QObject *parent =3D NULL); + InternalNetworkAccessManager(QObject *parent =3D nullptr); class HTTPEquivCookieJar; HTTPEquivCookieJar *cookieJar; = diff --git a/src/networking/onlinesearch/onlinesearchabstract.cpp b/src/net= working/onlinesearch/onlinesearchabstract.cpp index bf963a98..6dcf5227 100644 --- a/src/networking/onlinesearch/onlinesearchabstract.cpp +++ b/src/networking/onlinesearch/onlinesearchabstract.cpp @@ -87,14 +87,14 @@ QIcon OnlineSearchAbstract::icon(QListWidgetItem *listW= idgetItem) QNetworkRequest request(favIconUrl()); QNetworkReply *reply =3D InternalNetworkAccessManager::self()->get(req= uest); reply->setObjectName(fileNameStem); - if (listWidgetItem !=3D NULL) + if (listWidgetItem !=3D nullptr) m_iconReplyToListWidgetItem.insert(reply, listWidgetItem); connect(reply, &QNetworkReply::finished, this, &OnlineSearchAbstract::= iconDownloadFinished); return QIcon::fromTheme(QStringLiteral("applications-internet")); } = OnlineSearchQueryFormAbstract *OnlineSearchAbstract::customWidget(QWidget = *) { - return NULL; + return nullptr; } = void OnlineSearchAbstract::startSearchFromForm() @@ -199,7 +199,7 @@ void OnlineSearchAbstract::sendVisualNotification(const= QString &text, const QSt = // check if service already exists on plugin instantiation QDBusConnectionInterface *interface =3D QDBusConnection::sessionBus().= interface(); - if (interface =3D=3D NULL || !interface->isServiceRegistered(dbusServi= ceName)) { + if (interface =3D=3D nullptr || !interface->isServiceRegistered(dbusSe= rviceName)) { return; } = @@ -348,9 +348,9 @@ void OnlineSearchAbstract::iconDownloadFinished() QNetworkRequest request(redirUrl); QNetworkReply *newReply =3D InternalNetworkAccessManager::self= ()->get(request); newReply->setObjectName(reply->objectName()); - QListWidgetItem *listWidgetItem =3D m_iconReplyToListWidgetIte= m.value(reply, NULL); + QListWidgetItem *listWidgetItem =3D m_iconReplyToListWidgetIte= m.value(reply, nullptr); m_iconReplyToListWidgetItem.remove(reply); - if (listWidgetItem !=3D NULL) + if (listWidgetItem !=3D nullptr) m_iconReplyToListWidgetItem.insert(newReply, listWidgetIte= m); connect(newReply, &QNetworkReply::finished, this, &OnlineSearc= hAbstract::iconDownloadFinished); return; @@ -388,8 +388,8 @@ void OnlineSearchAbstract::iconDownloadFinished() iconFile.write(iconData); iconFile.close(); = - QListWidgetItem *listWidgetItem =3D m_iconReplyToListWidgetIte= m.value(reply, NULL); - if (listWidgetItem !=3D NULL) + QListWidgetItem *listWidgetItem =3D m_iconReplyToListWidgetIte= m.value(reply, nullptr); + if (listWidgetItem !=3D nullptr) listWidgetItem->setIcon(QIcon(filename)); } else { qCWarning(LOG_KBIBTEX_NETWORKING) << "Could not save icon data= from URL" << reply->url().toDisplayString() << "to file" << filename; diff --git a/src/networking/onlinesearch/onlinesearchabstract.h b/src/netwo= rking/onlinesearch/onlinesearchabstract.h index afb0c7ff..049b916b 100644 --- a/src/networking/onlinesearch/onlinesearchabstract.h +++ b/src/networking/onlinesearch/onlinesearchabstract.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -93,7 +93,7 @@ public: virtual void startSearch(const QMap &query, int numR= esults) =3D 0; virtual QString label() const =3D 0; QString name(); - virtual QIcon icon(QListWidgetItem *listWidgetItem =3D NULL); + virtual QIcon icon(QListWidgetItem *listWidgetItem =3D nullptr); virtual OnlineSearchQueryFormAbstract *customWidget(QWidget *parent); virtual QUrl homepage() const =3D 0; virtual bool busy() const; diff --git a/src/networking/onlinesearch/onlinesearchacmportal.cpp b/src/ne= tworking/onlinesearch/onlinesearchacmportal.cpp index 5391c019..5d2b43dc 100644 --- a/src/networking/onlinesearch/onlinesearchacmportal.cpp +++ b/src/networking/onlinesearch/onlinesearchacmportal.cpp @@ -245,7 +245,7 @@ void OnlineSearchAcmPortal::doneFetchingBibTeX() d->sanitizeBibTeXCode(bibTeXcode); File *bibtexFile =3D importer.fromString(bibTeXcode); = - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibtexFil= e)) { QSharedPointer entry =3D element.dynamicCast= (); if (publishEntry(entry)) diff --git a/src/networking/onlinesearch/onlinesearcharxiv.cpp b/src/networ= king/onlinesearch/onlinesearcharxiv.cpp index 6ba9b38f..6e4262e0 100644 --- a/src/networking/onlinesearch/onlinesearcharxiv.cpp +++ b/src/networking/onlinesearch/onlinesearcharxiv.cpp @@ -107,7 +107,7 @@ public: OnlineSearchArXivPrivate(OnlineSearchArXiv *parent) : p(parent), xslt(QStandardPaths::locate(QStandardPaths::GenericDataLocation,= QStringLiteral("kbibtex/arxiv2bibtex.xsl"))), - form(NULL), arXivQueryBaseUrl(QStringLiteral("http://export.arxi= v.org/api/query?")) + form(nullptr), arXivQueryBaseUrl(QStringLiteral("http://export.a= rxiv.org/api/query?")) { /// nothing } @@ -649,7 +649,7 @@ QString OnlineSearchArXiv::favIconUrl() const = OnlineSearchQueryFormAbstract *OnlineSearchArXiv::customWidget(QWidget *pa= rent) { - if (d->form =3D=3D NULL) + if (d->form =3D=3D nullptr) d->form =3D new OnlineSearchArXiv::OnlineSearchQueryFormArXiv(pare= nt); return d->form; } @@ -680,7 +680,7 @@ void OnlineSearchArXiv::downloadDone() File *bibtexFile =3D importer.fromString(bibTeXcode); = bool hasEntries =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibte= xFile)) { QSharedPointer entry =3D element.dynamicCast(); hasEntries |=3D publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchbibsonomy.cpp b/src/ne= tworking/onlinesearch/onlinesearchbibsonomy.cpp index febc3658..33711f14 100644 --- a/src/networking/onlinesearch/onlinesearchbibsonomy.cpp +++ b/src/networking/onlinesearch/onlinesearchbibsonomy.cpp @@ -118,12 +118,12 @@ public: OnlineSearchQueryFormBibsonomy *form; = OnlineSearchBibsonomyPrivate(OnlineSearchBibsonomy *parent) - : p(parent), form(NULL) { + : p(parent), form(nullptr) { // nothing } = QUrl buildQueryUrl() { - if (form =3D=3D NULL) { + if (form =3D=3D nullptr) { qCWarning(LOG_KBIBTEX_NETWORKING) << "Cannot build query url i= f no form is specified"; return QUrl(); } @@ -217,7 +217,7 @@ QString OnlineSearchBibsonomy::favIconUrl() const = OnlineSearchQueryFormAbstract *OnlineSearchBibsonomy::customWidget(QWidget= *parent) { - if (d->form =3D=3D NULL) + if (d->form =3D=3D nullptr) d->form =3D new OnlineSearchBibsonomy::OnlineSearchQueryFormBibson= omy(parent); return d->form; } @@ -242,7 +242,7 @@ void OnlineSearchBibsonomy::downloadDone() const File *bibtexFile =3D importer.fromString(bibTeXcode); = bool hasEntries =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibte= xFile)) { QSharedPointer entry =3D element.dynamicCast(); hasEntries |=3D publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchbiorxiv.cpp b/src/netw= orking/onlinesearch/onlinesearchbiorxiv.cpp index 84fcb614..0b732843 100644 --- a/src/networking/onlinesearch/onlinesearchbiorxiv.cpp +++ b/src/networking/onlinesearch/onlinesearchbiorxiv.cpp @@ -154,7 +154,7 @@ void OnlineSearchBioRxiv::bibTeXDownloadDone() { FileImporterBibTeX importer; File *bibtexFile =3D importer.fromString(bibTeXcode); = - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibte= xFile)) { QSharedPointer entry =3D element.dynamicCast(); publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchdoi.cpp b/src/networki= ng/onlinesearch/onlinesearchdoi.cpp index c3c7f77c..badff8ef 100644 --- a/src/networking/onlinesearch/onlinesearchdoi.cpp +++ b/src/networking/onlinesearch/onlinesearchdoi.cpp @@ -89,12 +89,12 @@ public: OnlineSearchQueryFormDOI *form; = OnlineSearchDOIPrivate(OnlineSearchDOI */* UNUSED parent*/) - : /* UNUSED p(parent),*/ form(NULL) { + : /* UNUSED p(parent),*/ form(nullptr) { // nothing } = QUrl buildQueryUrl() { - if (form =3D=3D NULL) { + if (form =3D=3D nullptr) { qCWarning(LOG_KBIBTEX_NETWORKING) << "Cannot build query url i= f no form is specified"; return QUrl(); } @@ -166,7 +166,7 @@ QString OnlineSearchDOI::label() const = OnlineSearchQueryFormAbstract *OnlineSearchDOI::customWidget(QWidget *pare= nt) { - if (d->form =3D=3D NULL) + if (d->form =3D=3D nullptr) d->form =3D new OnlineSearchDOI::OnlineSearchQueryFormDOI(parent); return d->form; } @@ -205,7 +205,7 @@ void OnlineSearchDOI::downloadDone() File *bibtexFile =3D importer.fromString(bibTeXcode); = bool hasEntries =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*b= ibtexFile)) { QSharedPointer entry =3D element.dynamicCas= t(); hasEntries |=3D publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchgooglescholar.cpp b/sr= c/networking/onlinesearch/onlinesearchgooglescholar.cpp index cd9b593e..52929978 100644 --- a/src/networking/onlinesearch/onlinesearchgooglescholar.cpp +++ b/src/networking/onlinesearch/onlinesearchgooglescholar.cpp @@ -312,7 +312,7 @@ void OnlineSearchGoogleScholar::doneFetchingBibTeX() File *bibtexFile =3D d->importer.fromString(rawText); = bool hasEntry =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibte= xFile)) { QSharedPointer entry =3D element.dynamicCast(); if (!entry.isNull()) { diff --git a/src/networking/onlinesearch/onlinesearchideasrepec.cpp b/src/n= etworking/onlinesearch/onlinesearchideasrepec.cpp index 6ab3f6bb..0649ba11 100644 --- a/src/networking/onlinesearch/onlinesearchideasrepec.cpp +++ b/src/networking/onlinesearch/onlinesearchideasrepec.cpp @@ -217,7 +217,7 @@ void OnlineSearchIDEASRePEc::downloadBibTeXDone() FileImporterBibTeX importer; File *bibtexFile =3D importer.fromString(bibTeXcode); = - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibte= xFile)) { QSharedPointer entry =3D element.dynamicCast(); if (!entry.isNull()) { diff --git a/src/networking/onlinesearch/onlinesearchieeexplore.cpp b/src/n= etworking/onlinesearch/onlinesearchieeexplore.cpp index 5e9ba7c0..fe87cc12 100644 --- a/src/networking/onlinesearch/onlinesearchieeexplore.cpp +++ b/src/networking/onlinesearch/onlinesearchieeexplore.cpp @@ -136,7 +136,7 @@ void OnlineSearchIEEEXplore::doneFetchingXML() File *bibtexFile =3D importer.fromString(bibTeXcode); = bool hasEntries =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*b= ibtexFile)) { QSharedPointer entry =3D element.dynamicCas= t(); hasEntries |=3D publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchingentaconnect.cpp b/s= rc/networking/onlinesearch/onlinesearchingentaconnect.cpp index 54e5e1da..f761cc56 100644 --- a/src/networking/onlinesearch/onlinesearchingentaconnect.cpp +++ b/src/networking/onlinesearch/onlinesearchingentaconnect.cpp @@ -167,12 +167,12 @@ public: OnlineSearchQueryFormIngentaConnect *form; = OnlineSearchIngentaConnectPrivate(OnlineSearchIngentaConnect *parent) - : p(parent), ingentaConnectBaseUrl(QStringLiteral("http://www.= ingentaconnect.com/search?format=3Dbib")), form(NULL) { + : p(parent), ingentaConnectBaseUrl(QStringLiteral("http://www.= ingentaconnect.com/search?format=3Dbib")), form(nullptr) { // nothing } = QUrl buildQueryUrl() { - if (form =3D=3D NULL) { + if (form =3D=3D nullptr) { qCWarning(LOG_KBIBTEX_NETWORKING) << "Cannot build query url i= f no form is specified"; return QUrl(); } @@ -346,7 +346,7 @@ QString OnlineSearchIngentaConnect::favIconUrl() const = OnlineSearchQueryFormAbstract *OnlineSearchIngentaConnect::customWidget(QW= idget *parent) { - if (d->form =3D=3D NULL) + if (d->form =3D=3D nullptr) d->form =3D new OnlineSearchIngentaConnect::OnlineSearchQueryFormI= ngentaConnect(parent); return d->form; } @@ -371,7 +371,7 @@ void OnlineSearchIngentaConnect::downloadDone() File *bibtexFile =3D importer.fromString(bibTeXcode); = bool hasEntries =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibte= xFile)) { QSharedPointer entry =3D element.dynamicCast(); hasEntries |=3D publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchisbndb.cpp b/src/netwo= rking/onlinesearch/onlinesearchisbndb.cpp index 089b4276..202cbc5e 100644 --- a/src/networking/onlinesearch/onlinesearchisbndb.cpp +++ b/src/networking/onlinesearch/onlinesearchisbndb.cpp @@ -130,7 +130,7 @@ void OnlineSearchIsbnDB::downloadDone() File *bibtexFile =3D importer.fromString(bibTeXcode); = bool hasEntries =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibte= xFile)) { QSharedPointer entry =3D element.dynamicCast(); hasEntries |=3D publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchjstor.cpp b/src/networ= king/onlinesearch/onlinesearchjstor.cpp index 8730f809..ac72158c 100644 --- a/src/networking/onlinesearch/onlinesearchjstor.cpp +++ b/src/networking/onlinesearch/onlinesearchjstor.cpp @@ -207,7 +207,7 @@ void OnlineSearchJStor::doneFetchingBibTeXCode() FileImporterBibTeX importer; File *bibtexFile =3D importer.fromString(bibTeXcode); int numFoundResults =3D 0; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibtexFil= e)) { QSharedPointer entry =3D element.dynamicCast= (); if (publishEntry(entry)) diff --git a/src/networking/onlinesearch/onlinesearchmathscinet.cpp b/src/n= etworking/onlinesearch/onlinesearchmathscinet.cpp index 5a342aa2..31f5fa09 100644 --- a/src/networking/onlinesearch/onlinesearchmathscinet.cpp +++ b/src/networking/onlinesearch/onlinesearchmathscinet.cpp @@ -225,7 +225,7 @@ void OnlineSearchMathSciNet::doneFetchingBibTeXcode() const File *bibtexFile =3D importer.fromString(bibtexCode); = bool hasEntry =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : *bibtexFile) { QSharedPointer entry =3D element.dynamicCast= (); hasEntry |=3D publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchmrlookup.cpp b/src/net= working/onlinesearch/onlinesearchmrlookup.cpp index f0e5e93a..4c548bee 100644 --- a/src/networking/onlinesearch/onlinesearchmrlookup.cpp +++ b/src/networking/onlinesearch/onlinesearchmrlookup.cpp @@ -102,7 +102,7 @@ void OnlineSearchMRLookup::doneFetchingResultPage() File *bibtexFile =3D importer.fromString(bibtexCode); = bool hasEntry =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibtexFil= e)) { const QSharedPointer entry =3D element.dynamicCast<= Entry>(); hasEntry |=3D publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchpubmed.cpp b/src/netwo= rking/onlinesearch/onlinesearchpubmed.cpp index 46a5220e..66c8d343 100644 --- a/src/networking/onlinesearch/onlinesearchpubmed.cpp +++ b/src/networking/onlinesearch/onlinesearchpubmed.cpp @@ -209,7 +209,7 @@ void OnlineSearchPubMed::eFetchDone() FileImporterBibTeX importer; File *bibtexFile =3D importer.fromString(bibTeXcode); = - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { bool hasEntry =3D false; for (const auto &element : const_cast(*bibte= xFile)) { QSharedPointer entry =3D element.dynamicCast(); diff --git a/src/networking/onlinesearch/onlinesearchsciencedirect.cpp b/sr= c/networking/onlinesearch/onlinesearchsciencedirect.cpp index 20b1b2ce..b6f5adfa 100644 --- a/src/networking/onlinesearch/onlinesearchsciencedirect.cpp +++ b/src/networking/onlinesearch/onlinesearchsciencedirect.cpp @@ -279,7 +279,7 @@ void OnlineSearchScienceDirect::doneFetchingBibTeX() File *bibtexFile =3D importer.fromString(bibTeXcode); = bool hasEntry =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibtexFil= e)) { QSharedPointer entry =3D element.dynamicCast= (); hasEntry |=3D publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchsimplebibtexdownload.c= pp b/src/networking/onlinesearch/onlinesearchsimplebibtexdownload.cpp index b4aecc57..574a5de0 100644 --- a/src/networking/onlinesearch/onlinesearchsimplebibtexdownload.cpp +++ b/src/networking/onlinesearch/onlinesearchsimplebibtexdownload.cpp @@ -81,7 +81,7 @@ void OnlineSearchSimpleBibTeXDownload::downloadDone() File *bibtexFile =3D importer.fromString(bibTeXcode); = bool hasEntries =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const auto &element : const_cast(*bibte= xFile)) { QSharedPointer entry =3D element.dynamicCast(); hasEntries |=3D publishEntry(entry); diff --git a/src/networking/onlinesearch/onlinesearchspringerlink.cpp b/src= /networking/onlinesearch/onlinesearchspringerlink.cpp index 22cd5134..e52a9551 100644 --- a/src/networking/onlinesearch/onlinesearchspringerlink.cpp +++ b/src/networking/onlinesearch/onlinesearchspringerlink.cpp @@ -150,13 +150,13 @@ public: OnlineSearchSpringerLinkPrivate(OnlineSearchSpringerLink *parent) : p(parent), springerMetadataKey(QStringLiteral("7pphfmtb9rtwt= 3dw3e4hm7av")), xslt(QStandardPaths::locate(QStandardPaths::GenericDataLocation,= QStringLiteral("kbibtex/pam2bibtex.xsl"))), - form(NULL) + form(nullptr) { /// nothing } = QUrl buildQueryUrl() { - if (form =3D=3D NULL) return QUrl(); + if (form =3D=3D nullptr) return QUrl(); = QUrl queryUrl =3D QUrl(QString(QStringLiteral("http://api.springer= .com/metadata/pam/?api_key=3D")).append(springerMetadataKey)); = @@ -246,7 +246,7 @@ void OnlineSearchSpringerLink::startSearchFromForm() InternalNetworkAccessManager::self()->setNetworkReplyTimeout(reply); connect(reply, &QNetworkReply::finished, this, &OnlineSearchSpringerLi= nk::doneFetchingPAM); = - if (d->form !=3D NULL) d->form->saveState(); + if (d->form !=3D nullptr) d->form->saveState(); } = void OnlineSearchSpringerLink::startSearch(const QMap &q= uery, int numResults) @@ -277,7 +277,7 @@ QString OnlineSearchSpringerLink::favIconUrl() const = OnlineSearchQueryFormAbstract *OnlineSearchSpringerLink::customWidget(QWid= get *parent) { - if (d->form =3D=3D NULL) + if (d->form =3D=3D nullptr) d->form =3D new OnlineSearchQueryFormSpringerLink(parent); return d->form; } @@ -303,7 +303,7 @@ void OnlineSearchSpringerLink::doneFetchingPAM() const File *bibtexFile =3D importer.fromString(bibTeXcode); = bool hasEntries =3D false; - if (bibtexFile !=3D NULL) { + if (bibtexFile !=3D nullptr) { for (const QSharedPointer &element : *bibtexFile)= { QSharedPointer entry =3D element.dynamicCast(); hasEntries |=3D publishEntry(entry); diff --git a/src/networking/zotero/api.h b/src/networking/zotero/api.h index 9f559db5..24c81835 100644 --- a/src/networking/zotero/api.h +++ b/src/networking/zotero/api.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -55,7 +55,7 @@ public: * @param apiKey necessary API key to authenticate and to get authoriz= ation for requests on private data * @param parent used for Qt-internal operations */ - explicit API(RequestScope requestScope, int userOrGroupPrefix, const Q= String &apiKey, QObject *parent =3D 0); + explicit API(RequestScope requestScope, int userOrGroupPrefix, const Q= String &apiKey, QObject *parent =3D nullptr); = ~API(); = diff --git a/src/networking/zotero/collectionmodel.h b/src/networking/zoter= o/collectionmodel.h index e597db60..f553a3d8 100644 --- a/src/networking/zotero/collectionmodel.h +++ b/src/networking/zotero/collectionmodel.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -40,7 +40,7 @@ class KBIBTEXNETWORKING_EXPORT CollectionModel : public Q= AbstractItemModel public: static const int CollectionIdRole; = - explicit CollectionModel(Zotero::Collection *collection, QObject *pare= nt =3D NULL); + explicit CollectionModel(Zotero::Collection *collection, QObject *pare= nt =3D nullptr); QVariant data(const QModelIndex &index, int role =3D Qt::DisplayRole) = const; QModelIndex index(int row, int column, const QModelIndex &) const; QModelIndex parent(const QModelIndex &) const; diff --git a/src/networking/zotero/groups.h b/src/networking/zotero/groups.h index 4905b9f1..118179fa 100644 --- a/src/networking/zotero/groups.h +++ b/src/networking/zotero/groups.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -36,7 +36,7 @@ class KBIBTEXNETWORKING_EXPORT Groups : public QObject { Q_OBJECT public: - explicit Groups(QSharedPointer api, QObject *parent =3D N= ULL); + explicit Groups(QSharedPointer api, QObject *parent =3D n= ullptr); ~Groups(); = bool initialized() const; diff --git a/src/networking/zotero/items.cpp b/src/networking/zotero/items.= cpp index cce98c16..8bb39004 100644 --- a/src/networking/zotero/items.cpp +++ b/src/networking/zotero/items.cpp @@ -135,7 +135,7 @@ void Items::finishedFetchingItems() File *bibtexFile =3D importer.fromString(bibTeXcode); = /// Perform basic sanity checks ... - if (bibtexFile !=3D NULL && !bibtexFile->isEmpty()) { + if (bibtexFile !=3D nullptr && !bibtexFile->isEmpty()) { for (const QSharedPointer &element : const_cast(*bibtexFile)) { emit foundElement(element); ///< ... and publish result } diff --git a/src/networking/zotero/items.h b/src/networking/zotero/items.h index 1560db1a..2c2e03d9 100644 --- a/src/networking/zotero/items.h +++ b/src/networking/zotero/items.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -39,7 +39,7 @@ class KBIBTEXNETWORKING_EXPORT Items : public QObject { Q_OBJECT public: - explicit Items(QSharedPointer api, QObject *parent =3D NU= LL); + explicit Items(QSharedPointer api, QObject *parent =3D nu= llptr); ~Items(); = void retrieveItemsByCollection(const QString &collectionId); diff --git a/src/networking/zotero/tagmodel.h b/src/networking/zotero/tagmo= del.h index fa0cc695..ad8d793b 100644 --- a/src/networking/zotero/tagmodel.h +++ b/src/networking/zotero/tagmodel.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -40,7 +40,7 @@ class KBIBTEXNETWORKING_EXPORT TagModel : public QAbstrac= tItemModel public: enum Roles { TagRole =3D Qt::UserRole + 6685, TagCountRole =3D Qt::Use= rRole + 6686 }; = - explicit TagModel(Zotero::Tags *tags, QObject *parent =3D NULL); + explicit TagModel(Zotero::Tags *tags, QObject *parent =3D nullptr); QVariant data(const QModelIndex &index, int role =3D Qt::DisplayRole) = const; QModelIndex index(int row, int column, const QModelIndex &) const; QModelIndex parent(const QModelIndex &) const; diff --git a/src/networking/zotero/tags.h b/src/networking/zotero/tags.h index 85127f6a..7d12c8cb 100644 --- a/src/networking/zotero/tags.h +++ b/src/networking/zotero/tags.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -36,7 +36,7 @@ class KBIBTEXNETWORKING_EXPORT Tags : public QObject { Q_OBJECT public: - explicit Tags(QSharedPointer api, QObject *parent =3D NUL= L); + explicit Tags(QSharedPointer api, QObject *parent =3D nul= lptr); ~Tags(); = bool initialized() const; diff --git a/src/parts/part.cpp b/src/parts/part.cpp index 23b6886b..67f2d12d 100644 --- a/src/parts/part.cpp +++ b/src/parts/part.cpp @@ -140,7 +140,7 @@ public: QFileSystemWatcher fileSystemWatcher; = KBibTeXPartPrivate(QWidget *parentWidget, KBibTeXPart *parent) - : p(parent), config(KSharedConfig::openConfig(QStringLiteral("= kbibtexrc"))), bibTeXFile(NULL), model(NULL), sortFilterProxyModel(NULL), s= ignalMapperNewElement(new QSignalMapper(parent)), viewDocumentMenu(new QMen= u(i18n("View Document"), parent->widget())), signalMapperViewDocument(new Q= SignalMapper(parent)), isSaveAsOperation(false), fileSystemWatcher(p) { + : p(parent), config(KSharedConfig::openConfig(QStringLiteral("= kbibtexrc"))), bibTeXFile(nullptr), model(nullptr), sortFilterProxyModel(nu= llptr), signalMapperNewElement(new QSignalMapper(parent)), viewDocumentMenu= (new QMenu(i18n("View Document"), parent->widget())), signalMapperViewDocum= ent(new QSignalMapper(parent)), isSaveAsOperation(false), fileSystemWatcher= (p) { connect(signalMapperViewDocument, static_cast(&QSignalMapper::mapped), p, &KBibTeXPart::elementViewDocumen= tMenu); connect(&fileSystemWatcher, &QFileSystemWatcher::fileChanged, p, &= KBibTeXPart::fileExternallyChange); = @@ -333,7 +333,7 @@ public: model =3D new FileModel(); model->setBibliographyFile(bibTeXFile); = - if (sortFilterProxyModel !=3D NULL) delete sortFilterProxyModel; + if (sortFilterProxyModel !=3D nullptr) delete sortFilterProxyModel; sortFilterProxyModel =3D new SortFilterFileModel(p); sortFilterProxyModel->setSourceModel(model); partWidget->fileView()->setModel(sortFilterProxyModel); @@ -346,7 +346,7 @@ public: = qApp->setOverrideCursor(Qt::WaitCursor); = - if (bibTeXFile !=3D NULL) { + if (bibTeXFile !=3D nullptr) { const QUrl oldUrl =3D bibTeXFile->property(File::Url, QUrl()).= toUrl(); if (oldUrl.isValid() && oldUrl.isLocalFile()) { const QString path =3D oldUrl.toDisplayString(); @@ -374,7 +374,7 @@ public: inputfile.close(); delete importer; = - if (bibTeXFile =3D=3D NULL) { + if (bibTeXFile =3D=3D nullptr) { qCWarning(LOG_KBIBTEX_PARTS) << "Opening file failed, creating= new one instead:" << url.url(QUrl::PreferLocalFile); qApp->restoreOverrideCursor(); /// Opening file failed, creating new one instead @@ -385,7 +385,7 @@ public: bibTeXFile->setProperty(File::Url, QUrl(url)); = model->setBibliographyFile(bibTeXFile); - if (sortFilterProxyModel !=3D NULL) delete sortFilterProxyModel; + if (sortFilterProxyModel !=3D nullptr) delete sortFilterProxyModel; sortFilterProxyModel =3D new SortFilterFileModel(p); sortFilterProxyModel->setSourceModel(model); partWidget->fileView()->setModel(sortFilterProxyModel); @@ -436,7 +436,7 @@ public: statJob =3D KIO::stat(newerBackupUrl, KIO::StatJob::Destinatio= nSide, 0 /** not details necessary, just need to know if file exists */, KI= O::HideProgressInfo); KJobWidgets::setWindow(statJob, p->widget()); if (statJob->exec() && statJob->error() =3D=3D KIO::Job::NoErr= or) { - KIO::CopyJob *moveJob =3D NULL; ///< guaranteed to be init= ialized in either branch of the following code + KIO::CopyJob *moveJob =3D nullptr; ///< guaranteed to be i= nitialized in either branch of the following code /** * The following 'if' block is necessary to handle the * following situation: User opens, modifies, and saves @@ -467,7 +467,7 @@ public: moveJob =3D KIO::copy(newerBackupUrl, olderBackupU= rl, KIO::HideProgressInfo | KIO::Overwrite); } } - if (moveJob =3D=3D NULL) ///< implicit 'else' section, see= longer comment above + if (moveJob =3D=3D nullptr) ///< implicit 'else' section, = see longer comment above moveJob =3D KIO::move(newerBackupUrl, olderBackupUrl, = KIO::HideProgressInfo | KIO::Overwrite); KJobWidgets::setWindow(moveJob, p->widget()); copySucceeded =3D moveJob->exec(); @@ -513,7 +513,7 @@ public: = if (isSaveAsOperation) { /// only show export dialog at SaveAs or SaveCopyAs operations - FileExporterToolchain *fet =3D NULL; + FileExporterToolchain *fet =3D nullptr; = if (FileExporterBibTeX::isFileExporterBibTeX(*exporter)) { QPointer dlg =3D new QDialog(p->widget()); @@ -533,7 +533,7 @@ public: if (dlg->exec() =3D=3D QDialog::Accepted) settingsWidget->saveProperties(bibTeXFile); delete dlg; - } else if ((fet =3D qobject_cast(expo= rter)) !=3D NULL) { + } else if ((fet =3D qobject_cast(expo= rter)) !=3D nullptr) { QPointer dlg =3D new QDialog(p->widget()); dlg->setWindowTitle(i18n("PDF/PostScript File Settings")); QBoxLayout *layout =3D new QVBoxLayout(dlg); @@ -556,9 +556,9 @@ public: return exporter; } = - bool saveFile(QFile &file, FileExporter *exporter, QStringList *errorL= og =3D NULL) { + bool saveFile(QFile &file, FileExporter *exporter, QStringList *errorL= og =3D nullptr) { SortFilterFileModel *model =3D qobject_cast= (partWidget->fileView()->model()); - Q_ASSERT_X(model !=3D NULL, "FileExporter *KBibTeXPart::KBibTeXPar= tPrivate:saveFile(...)", "SortFilterFileModel *model from editor->model() i= s invalid"); + Q_ASSERT_X(model !=3D nullptr, "FileExporter *KBibTeXPart::KBibTeX= PartPrivate:saveFile(...)", "SortFilterFileModel *model from editor->model(= ) is invalid"); = return exporter->save(&file, model->fileSourceModel()->bibliograph= yFile(), errorLog); } @@ -664,7 +664,7 @@ public: const QList urlList =3D FileInfo::entryUrls(entry.data()= , partWidget->fileView()->fileModel()->bibliographyFile()->property(File::U= rl).toUrl(), FileInfo::TestExistenceYes); if (!urlList.isEmpty()) { /// Memorize first action, necessary to set menu title - QAction *firstAction =3D NULL; + QAction *firstAction =3D nullptr; /// First iteration: local references only for (const QUrl &url : urlList) { /// First iteration: local references only @@ -683,16 +683,16 @@ public: signalMapperViewDocumentSenders.insert(action); viewDocumentMenu->addAction(action); /// Memorize first action - if (firstAction =3D=3D NULL) firstAction =3D action; + if (firstAction =3D=3D nullptr) firstAction =3D action; } - if (firstAction !=3D NULL) { + if (firstAction !=3D nullptr) { /// If there is 'first action', then there must be /// local URLs (i.e. local files) and firstAction /// is the first one where a title can be set above viewDocumentMenu->insertSection(firstAction, i18n("Loc= al Files")); } = - firstAction =3D NULL; /// Now the first remote action is t= o be memorized + firstAction =3D nullptr; /// Now the first remote action i= s to be memorized /// Second iteration: remote references only for (const QUrl &url : urlList) { if (url.isLocalFile()) continue; ///< skip local files @@ -709,9 +709,9 @@ public: signalMapperViewDocumentSenders.insert(action); viewDocumentMenu->addAction(action); /// Memorize first action - if (firstAction =3D=3D NULL) firstAction =3D action; + if (firstAction =3D=3D nullptr) firstAction =3D action; } - if (firstAction !=3D NULL) { + if (firstAction !=3D nullptr) { /// If there is 'first action', then there must be /// some remote URLs and firstAction is the first /// one where a title can be set above @@ -1036,12 +1036,12 @@ void KBibTeXPart::updateActions() /// enable menu item only if there is at least one document to view d->elementViewDocumentAction->setEnabled(!emptySelection && numDocumen= tsToView > 0); /// activate sub-menu only if there are at least two documents to view - d->elementViewDocumentAction->setMenu(numDocumentsToView > 1 ? d->view= DocumentMenu : NULL); + d->elementViewDocumentAction->setMenu(numDocumentsToView > 1 ? d->view= DocumentMenu : nullptr); d->elementViewDocumentAction->setToolTip(numDocumentsToView =3D=3D 1 ?= (*d->viewDocumentMenu->actions().constBegin())->text() : QStringLiteral(""= )); = /// update list of references which can be sent to LyX QStringList references; - if (d->partWidget->fileView()->selectionModel() !=3D NULL) { + if (d->partWidget->fileView()->selectionModel() !=3D nullptr) { const QModelIndexList mil =3D d->partWidget->fileView()->selection= Model()->selectedRows(); for (const QModelIndex &index : mil) { QSharedPointer entry =3D d->partWidget->fileView()->fil= eModel()->element(d->partWidget->fileView()->sortFilterProxyModel()->mapToS= ource(index).row()).dynamicCast(); diff --git a/src/processing/checkbibtex.cpp b/src/processing/checkbibtex.cpp index dbfc787b..d5dc5c59 100644 --- a/src/processing/checkbibtex.cpp +++ b/src/processing/checkbibtex.cpp @@ -54,7 +54,7 @@ CheckBibTeX::CheckBibTeXResult CheckBibTeX::checkBibTeX(Q= SharedPointer &e /// fetch and inser crossref'ed entry QString crossRefStr; Value crossRefVal =3D entry->value(Entry::ftCrossRef); - if (!crossRefVal.isEmpty() && file !=3D NULL) { + if (!crossRefVal.isEmpty() && file !=3D nullptr) { crossRefStr =3D PlainTextValue::text(crossRefVal); QSharedPointer crossRefDest =3D file->containsKey(crossRefS= tr, File::etEntry).dynamicCast(); if (!crossRefDest.isNull()) @@ -64,7 +64,7 @@ CheckBibTeX::CheckBibTeXResult CheckBibTeX::checkBibTeX(Q= SharedPointer &e } = /// include all macro definitions, in case they are referenced - if (file !=3D NULL) + if (file !=3D nullptr) for (const auto &element : const_cast(*file)) if (Macro::isMacro(*element)) dummyFile << element; diff --git a/src/processing/findduplicates.cpp b/src/processing/findduplica= tes.cpp index b91ed8e5..6a019d54 100644 --- a/src/processing/findduplicates.cpp +++ b/src/processing/findduplicates.cpp @@ -210,8 +210,8 @@ public: QWidget *widget; = FindDuplicatesPrivate(int sens, QWidget *w) - : maxDistance(10000), sensitivity(sens), widget(w =3D=3D NULL = ? qApp->activeWindow() : w) { - d =3D new int*[dsize]; + : maxDistance(10000), sensitivity(sens), widget(w =3D=3D nullp= tr ? qApp->activeWindow() : w) { + d =3D new int *[dsize]; for (int i =3D 0; i < dsize; ++i) d[i] =3D new int[dsize]; } diff --git a/src/processing/journalabbreviations.cpp b/src/processing/journ= alabbreviations.cpp index a025f0db..f490f9ca 100644 --- a/src/processing/journalabbreviations.cpp +++ b/src/processing/journalabbreviations.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -92,7 +92,7 @@ public: } }; = -JournalAbbreviations *JournalAbbreviations::instance =3D NULL; +JournalAbbreviations *JournalAbbreviations::instance =3D nullptr; = JournalAbbreviations::JournalAbbreviations() : d(new JournalAbbreviations::Private(this)) @@ -106,7 +106,7 @@ JournalAbbreviations::~JournalAbbreviations() } = JournalAbbreviations *JournalAbbreviations::self() { - if (instance =3D=3D NULL) + if (instance =3D=3D nullptr) instance =3D new JournalAbbreviations(); return instance; } diff --git a/src/processing/lyx.cpp b/src/processing/lyx.cpp index b73e6891..bbe04de2 100644 --- a/src/processing/lyx.cpp +++ b/src/processing/lyx.cpp @@ -46,7 +46,7 @@ public: const KConfigGroup group; = LyXPrivate(LyX */* UNUSED parent*/, QWidget *widget) - : /* UNUSED p(parent),*/ action(NULL), config(KSharedConfig::openC= onfig(QStringLiteral("kbibtexrc"))), group(config, LyX::configGroupName) { + : /* UNUSED p(parent),*/ action(nullptr), config(KSharedConfig::op= enConfig(QStringLiteral("kbibtexrc"))), group(config, LyX::configGroupName)= { this->widget =3D widget; } = @@ -104,7 +104,7 @@ LyX::~LyX() void LyX::setReferences(const QStringList &references) { d->references =3D references; - d->action->setEnabled(d->widget !=3D NULL && !d->references.isEmpty()); + d->action->setEnabled(d->widget !=3D nullptr && !d->references.isEmpty= ()); } = void LyX::sendReferenceToLyX() diff --git a/src/program/docklets/documentpreview.cpp b/src/program/docklet= s/documentpreview.cpp index 939588ca..8317d860 100644 --- a/src/program/docklets/documentpreview.cpp +++ b/src/program/docklets/documentpreview.cpp @@ -152,11 +152,11 @@ public: connect(part, static_cast(&KP= arts::ReadOnlyPart::completed), p, &DocumentPreview::loadingFinished); return part; } else - return NULL; + return nullptr; } = DocumentPreviewPrivate(DocumentPreview *parent) - : p(parent), config(KSharedConfig::openConfig(QStringLiteral("= kbibtexrc"))), anyLocal(false), entry(NULL), anyRemote(false) { + : p(parent), config(KSharedConfig::openConfig(QStringLiteral("= kbibtexrc"))), anyLocal(false), entry(nullptr), anyRemote(false) { setupGUI(); } = @@ -219,8 +219,8 @@ public: = /// add parts to stackedWidget okularPart =3D locatePart(QStringLiteral("application/pdf"), stack= edWidget); - swpOkular =3D (okularPart =3D=3D NULL) ? -1 : stackedWidget->addWi= dget(okularPart->widget()); - if (okularPart =3D=3D NULL || swpOkular < 0) { + swpOkular =3D (okularPart =3D=3D nullptr) ? -1 : stackedWidget->ad= dWidget(okularPart->widget()); + if (okularPart =3D=3D nullptr || swpOkular < 0) { qCWarning(LOG_KBIBTEX_PROGRAM) << "No Okular part for PDF or P= ostScript document preview available."; } #ifdef HAVE_WEBENGINEWIDGETS @@ -236,7 +236,7 @@ public: connect(htmlWidget, &QWebView::loadFinished, p, &DocumentPreview::= loadingFinished); #else // HAVE_WEBKITWIDGETS htmlPart =3D locatePart(QStringLiteral("text/html"), stackedWidget= ); - if (htmlPart !=3D NULL) { + if (htmlPart !=3D nullptr) { qCDebug(LOG_KBIBTEX_PROGRAM) << "HTML KPart is available, usin= g it instead of WebEngine or WebKit (neither available) for HTML/Web previe= w."; swpHTML =3D stackedWidget->addWidget(htmlPart->widget()); } else { @@ -289,7 +289,7 @@ public: p->setCursor(Qt::WaitCursor); = /// reset and clear all controls - if (swpOkular >=3D 0 && okularPart !=3D NULL) + if (swpOkular >=3D 0 && okularPart !=3D nullptr) okularPart->closeUrl(); #ifdef HAVE_WEBENGINEWIDGETS htmlWidget->stop(); @@ -297,7 +297,7 @@ public: #ifdef HAVE_WEBKITWIDGETS htmlWidget->stop(); #else // HAVE_WEBKITWIDGETS - if (swpHTML >=3D 0 && htmlPart !=3D NULL) + if (swpHTML >=3D 0 && htmlPart !=3D nullptr) htmlPart->closeUrl(); #endif // HAVE_WEBKITWIDGETS #endif // HAVE_WEBENGINEWIDGETS @@ -427,7 +427,7 @@ public: const QString actionName =3D actionNode.attributes().n= amedItem(QStringLiteral("name")).toAttr().nodeValue(); const QString actionShortcut =3D actionNode.attributes= ().namedItem(QStringLiteral("shortcut")).toAttr().value(); QAction *action =3D part->actionCollection()->action(a= ctionName); - if (action !=3D NULL) { + if (action !=3D nullptr) { action->setShortcut(QKeySequence(actionShortcut)); } } @@ -445,7 +445,7 @@ public: menuBar->clear(); toolBar->clear(); = - if (okularPart !=3D NULL && part =3D=3D okularPart && swpOkular >= =3D 0) { + if (okularPart !=3D nullptr && part =3D=3D okularPart && swpOkular= >=3D 0) { stackedWidget->setCurrentIndex(swpOkular); stackedWidget->widget(swpOkular)->setEnabled(true); setupToolMenuBarForPart(okularPart); @@ -459,7 +459,7 @@ public: stackedWidget->setCurrentIndex(swpHTML); stackedWidget->widget(swpHTML)->setEnabled(true); #else // HAVE_WEBKITWIDGETS - } else if (htmlPart !=3D NULL && part =3D=3D htmlPart && swpHTML >= =3D 0) { + } else if (htmlPart !=3D nullptr && part =3D=3D htmlPart && swpHTM= L >=3D 0) { stackedWidget->setCurrentIndex(swpHTML); stackedWidget->widget(swpHTML)->setEnabled(true); setupToolMenuBarForPart(htmlPart); @@ -478,7 +478,7 @@ public: = if (swpHTML >=3D 0) stackedWidget->widget(swpHTML)->setEnabled(false); - if (swpOkular >=3D 0 && okularPart !=3D NULL) { + if (swpOkular >=3D 0 && okularPart !=3D nullptr) { stackedWidget->widget(swpOkular)->setEnabled(false); okularPart->closeUrl(); } @@ -488,12 +488,12 @@ public: #ifdef HAVE_WEBKITWIDGETS htmlWidget->stop(); #else // HAVE_WEBKITWIDGETS - if (swpHTML >=3D 0 && htmlPart !=3D NULL) + if (swpHTML >=3D 0 && htmlPart !=3D nullptr) htmlPart->closeUrl(); #endif // HAVE_WEBKITWIDGETS #endif // HAVE_WEBENGINEWIDGETS = - if (swpOkular >=3D 0 && okularPart !=3D NULL && okularMimetypes.co= ntains(urlInfo.mimeType)) { + if (swpOkular >=3D 0 && okularPart !=3D nullptr && okularMimetypes= .contains(urlInfo.mimeType)) { p->setCursor(Qt::BusyCursor); showMessage(i18n("Loading...")); // krazy:exclude=3Dqmethods return okularPart->openUrl(urlInfo.url); @@ -508,13 +508,13 @@ public: htmlWidget->load(urlInfo.url); return true; #else // HAVE_WEBKITWIDGETS - return (swpHTML >=3D 0 && htmlPart !=3D NULL) ? htmlPart->open= Url(urlInfo.url) : false; + return (swpHTML >=3D 0 && htmlPart !=3D nullptr) ? htmlPart->o= penUrl(urlInfo.url) : false; #endif // HAVE_WEBKITWIDGETS #endif // HAVE_WEBENGINEWIDGETS } else if (imageMimetypes.contains(urlInfo.mimeType)) { p->setCursor(Qt::BusyCursor); message->setPixmap(QPixmap(urlInfo.url.url(QUrl::PreferLocalFi= le))); - showPart(NULL, message); + showPart(nullptr, message); p->unsetCursor(); return true; } else { @@ -584,7 +584,7 @@ public: /// get dock where this widget is inside /// static cast is save as constructor requires parent to be QDock= Widget QDockWidget *pp =3D static_cast(p->parent()); - return pp !=3D NULL && !pp->isHidden(); + return pp !=3D nullptr && !pp->isHidden(); } = void loadState() { diff --git a/src/program/docklets/documentpreview.h b/src/program/docklets/= documentpreview.h index a61f46cb..c2ebe855 100644 --- a/src/program/docklets/documentpreview.h +++ b/src/program/docklets/documentpreview.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -41,7 +41,7 @@ class ImageLabel : public QLabel Q_OBJECT = public: - explicit ImageLabel(const QString &text, QWidget *parent =3D NULL, Qt:= :WindowFlags f =3D 0); + explicit ImageLabel(const QString &text, QWidget *parent =3D nullptr, = Qt::WindowFlags f =3D 0); void setPixmap(const QPixmap &pixmap); = protected: diff --git a/src/program/docklets/elementform.cpp b/src/program/docklets/el= ementform.cpp index b7489dde..58dc8615 100644 --- a/src/program/docklets/elementform.cpp +++ b/src/program/docklets/elementform.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -56,7 +56,7 @@ public: static const QString configKeyAutoApply; = ElementFormPrivate(MDIWidget *_mdiWidget, ElementForm *parent) - : p(parent), file(NULL), mdiWidget(_mdiWidget), gotModified(fa= lse), config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) { + : p(parent), file(nullptr), mdiWidget(_mdiWidget), gotModified= (false), config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) { KConfigGroup configGroup(config, configGroupName); = layout =3D new QGridLayout(p); @@ -139,7 +139,7 @@ public: /// get dock where this widget is inside /// static cast is save as constructor requires parent to be QDock= Widget QDockWidget *pp =3D static_cast(p->parent()); - return pp !=3D NULL && !pp->isHidden(); + return pp !=3D nullptr && !pp->isHidden(); } = void apply() { diff --git a/src/program/docklets/filesettings.cpp b/src/program/docklets/f= ilesettings.cpp index 923995c0..2eb9fc65 100644 --- a/src/program/docklets/filesettings.cpp +++ b/src/program/docklets/filesettings.cpp @@ -1,5 +1,5 @@ /*************************************************************************= **** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * = * * This program is free software; you can redistribute it and/or modify = * @@ -34,7 +34,7 @@ #include "openfileinfo.h" = FileSettings::FileSettings(QWidget *parent) - : FileSettingsWidget(parent), m_fileView(NULL) + : FileSettingsWidget(parent), m_fileView(nullptr) { setEnabled(false); = @@ -55,8 +55,8 @@ void FileSettings::setFileView(FileView *fileView) = void FileSettings::widgetsChangedSlot() { - File *file =3D m_fileView !=3D NULL && m_fileView->fileModel() !=3D NU= LL ? m_fileView->fileModel()->bibliographyFile() : NULL; - if (file !=3D NULL) { + File *file =3D m_fileView !=3D nullptr && m_fileView->fileModel() !=3D= nullptr ? m_fileView->fileModel()->bibliographyFile() : nullptr; + if (file !=3D nullptr) { saveProperties(file); /// Notify main view about change it its data m_fileView->externalModification(); @@ -64,7 +64,7 @@ void FileSettings::widgetsChangedSlot() } = void FileSettings::currentFileChangedSlot() { - File *file =3D m_fileView !=3D NULL && m_fileView->fileModel() !=3D NU= LL ? m_fileView->fileModel()->bibliographyFile() : NULL; + File *file =3D m_fileView !=3D nullptr && m_fileView->fileModel() !=3D= nullptr ? m_fileView->fileModel()->bibliographyFile() : nullptr; loadProperties(file); - setEnabled(file !=3D NULL); + setEnabled(file !=3D nullptr); } diff --git a/src/program/docklets/referencepreview.cpp b/src/program/dockle= ts/referencepreview.cpp index 360dff08..d20b299c 100644 --- a/src/program/docklets/referencepreview.cpp +++ b/src/program/docklets/referencepreview.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2015 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * and contributors = * * = * * Contributions to this file were made by = * @@ -104,7 +104,7 @@ public: = ReferencePreviewPrivate(ReferencePreview *parent) : p(parent), config(KSharedConfig::openConfig(QStringLiteral("= kbibtexrc"))), configGroupName(QStringLiteral("Reference Preview Docklet")), - configKeyName(QStringLiteral("Style")), file(NULL), fileView(NUL= L), + configKeyName(QStringLiteral("Style")), file(nullptr), fileView(= nullptr), textColor(QApplication::palette().text().color()), defaultFontSize(QFontDatabase::systemFont(QFontDatabase::General= Font).pointSize()), htmlStart("\n\n\n= \n\n"), @@ -248,7 +248,7 @@ void ReferencePreview::renderHTML() = QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); = - FileExporter *exporter =3D NULL; + FileExporter *exporter =3D nullptr; = const PreviewStyles previewStyle =3D d->comboBox->itemData(d->comboBox= ->currentIndex()).value(); = @@ -275,7 +275,7 @@ void ReferencePreview::renderHTML() } else qCWarning(LOG_KBIBTEX_PROGRAM) << "Don't know how to handle output= type " << previewStyle.type; = - if (exporter !=3D NULL) { + if (exporter !=3D nullptr) { QBuffer buffer(this); buffer.open(QBuffer::WriteOnly); = @@ -399,7 +399,7 @@ void ReferencePreview::linkClicked(const QUrl &url) QString text =3D url.toDisplayString(); if (text.startsWith(QStringLiteral("kbibtex:filter:"))) { text =3D text.mid(15); - if (d->fileView !=3D NULL) { + if (d->fileView !=3D nullptr) { int p =3D text.indexOf(QStringLiteral("=3D")); SortFilterFileModel::FilterQuery fq; fq.terms << text.mid(p + 1); diff --git a/src/program/docklets/searchform.cpp b/src/program/docklets/sea= rchform.cpp index a49375b4..a3b605dd 100644 --- a/src/program/docklets/searchform.cpp +++ b/src/program/docklets/searchform.cpp @@ -106,14 +106,14 @@ public: QMap formToScrollArea; = SearchFormPrivate(SearchResults *searchResults, SearchForm *parent) - : p(parent), whichEnginesLabel(NULL), config(KSharedConfig::op= enConfig(QStringLiteral("kbibtexrc"))), - configGroupName(QStringLiteral("Search Engines Docklet")), sr(se= archResults), searchButton(NULL), useEntryButton(NULL), currentEntry(NULL) { + : p(parent), whichEnginesLabel(nullptr), config(KSharedConfig:= :openConfig(QStringLiteral("kbibtexrc"))), + configGroupName(QStringLiteral("Search Engines Docklet")), sr(se= archResults), searchButton(nullptr), useEntryButton(nullptr), currentEntry(= nullptr) { createGUI(); } = OnlineSearchQueryFormAbstract *currentQueryForm() { QScrollArea *area =3D qobject_cast(queryTermsStack-= >currentWidget()); - return formToScrollArea.key(area, NULL); + return formToScrollArea.key(area, nullptr); } = QScrollArea *wrapInScrollArea(OnlineSearchQueryFormAbstract *form, QWi= dget *parent) { @@ -150,7 +150,7 @@ public: return container; } = - OnlineSearchQueryFormAbstract *createGeneralQueryTermsForm(QWidget *pa= rent =3D NULL) { + OnlineSearchQueryFormAbstract *createGeneralQueryTermsForm(QWidget *pa= rent =3D nullptr) { generalQueryTermsForm =3D new OnlineSearchQueryFormGeneral(parent); return generalQueryTermsForm; } @@ -236,7 +236,7 @@ public: addEngine(new OnlineSearchIDEASRePEc(p)); addEngine(new OnlineSearchDOI(p)); = - p->itemCheckChanged(NULL); + p->itemCheckChanged(nullptr); updateGUI(); } = @@ -252,7 +252,7 @@ public: = OnlineSearchQueryFormAbstract *widget =3D engine->customWidget(que= ryTermsStack); item->setData(WidgetRole, QVariant::fromValue(widget)); - if (widget !=3D NULL) { + if (widget !=3D nullptr) { connect(widget, &OnlineSearchQueryFormAbstract::returnPressed,= searchButton, &QPushButton::click); QScrollArea *scrollArea =3D wrapInScrollArea(widget, queryTerm= sStack); queryTermsStack->addWidget(scrollArea); @@ -293,10 +293,10 @@ public: } = void updateGUI() { - if (whichEnginesLabel =3D=3D NULL) return; + if (whichEnginesLabel =3D=3D nullptr) return; = QStringList checkedEngines; - QListWidgetItem *cursor =3D NULL; + QListWidgetItem *cursor =3D nullptr; for (QMap::ConstIterato= r it =3D itemToOnlineSearch.constBegin(); it !=3D itemToOnlineSearch.constE= nd(); ++it) if (it.key()->checkState() =3D=3D Qt::Checked) { checkedEngines << it.key()->text(); @@ -311,22 +311,22 @@ public: default: whichEnginesLabel->setText(i18n("Search engines %1= , %2, and more are selected (change).= ", checkedEngines.first(), checkedEngines.at(1))); break; } = - OnlineSearchQueryFormAbstract *currentQueryWidget =3D NULL; - if (cursor !=3D NULL && checkedEngines.size() =3D=3D 1) + OnlineSearchQueryFormAbstract *currentQueryWidget =3D nullptr; + if (cursor !=3D nullptr && checkedEngines.size() =3D=3D 1) currentQueryWidget =3D cursor->data(WidgetRole).value(); - if (currentQueryWidget =3D=3D NULL) + if (currentQueryWidget =3D=3D nullptr) currentQueryWidget =3D generalQueryTermsForm; - QScrollArea *area =3D formToScrollArea.value(currentQueryWidget, N= ULL); - if (area !=3D NULL) + QScrollArea *area =3D formToScrollArea.value(currentQueryWidget, n= ullptr); + if (area !=3D nullptr) queryTermsStack->setCurrentWidget(area); = - if (useEntryButton !=3D NULL) + if (useEntryButton !=3D nullptr) useEntryButton->setEnabled(!currentEntry.isNull() && tabWidget= ->currentIndex() =3D=3D 0); } = void openHomepage() { QListWidgetItem *item =3D enginesList->currentItem(); - if (item !=3D NULL) { + if (item !=3D nullptr) { QUrl url =3D item->data(HomepageRole).toUrl(); /// Guess mime type for url to open QMimeType mimeType =3D FileInfo::mimeTypeForUrl(url); @@ -337,7 +337,7 @@ public: } = void enginesListCurrentChanged(QListWidgetItem *current) { - actionOpenHomepage->setEnabled(current !=3D NULL); + actionOpenHomepage->setEnabled(current !=3D nullptr); } }; = @@ -457,7 +457,7 @@ void SearchForm::itemCheckChanged(QListWidgetItem *item) = d->searchButton->setEnabled(numCheckedEngines > 0); = - if (item !=3D NULL) { + if (item !=3D nullptr) { KConfigGroup configGroup(d->config, d->configGroupName); QString name =3D item->data(NameRole).toString(); configGroup.writeEntry(name, item->checkState() =3D=3D Qt::Checked= ); diff --git a/src/program/docklets/searchresults.cpp b/src/program/docklets/= searchresults.cpp index 59c3751d..ace94e96 100644 --- a/src/program/docklets/searchresults.cpp +++ b/src/program/docklets/searchresults.cpp @@ -49,7 +49,7 @@ public: QAction *actionViewCurrent, *actionImportSelected, *actionCopySelected; = SearchResultsPrivate(MDIWidget *mdiWidget, SearchResults *parent) - : /* UNUSED p(parent),*/ m(mdiWidget), file(new File()), mainEdito= r(NULL) { + : /* UNUSED p(parent),*/ m(mdiWidget), file(new File()), mainEdito= r(nullptr) { QGridLayout *layout =3D new QGridLayout(parent); layout->setMargin(0); layout->setColumnStretch(0, 1); @@ -141,13 +141,13 @@ public: = void updateCannotImportMessage() { const bool isEmpty =3D resultList->model()->rowCount() =3D=3D 0; - if (mainEditor =3D=3D NULL && isEmpty) + if (mainEditor =3D=3D nullptr && isEmpty) labelCannotImportMsg->setText(i18n("No results to import and n= o bibliography open to import to.")); - else if (mainEditor =3D=3D NULL) + else if (mainEditor =3D=3D nullptr) labelCannotImportMsg->setText(i18n("No bibliography open to im= port to.")); else if (isEmpty) labelCannotImportMsg->setText(i18n("No results to import.")); - widgetCannotImport->setVisible(mainEditor =3D=3D NULL || isEmpty); + widgetCannotImport->setVisible(mainEditor =3D=3D nullptr || isEmpt= y); } }; = @@ -185,15 +185,15 @@ void SearchResults::documentSwitched(FileView *oldEdi= tor, FileView *newEditor) void SearchResults::updateGUI() { d->updateCannotImportMessage(); - d->buttonImport->setEnabled(d->mainEditor !=3D NULL && !d->resultList-= >selectedElements().isEmpty()); + d->buttonImport->setEnabled(d->mainEditor !=3D nullptr && !d->resultLi= st->selectedElements().isEmpty()); d->actionImportSelected->setEnabled(d->buttonImport->isEnabled()); d->actionCopySelected->setEnabled(!d->resultList->selectedElements().i= sEmpty()); - d->actionViewCurrent->setEnabled(d->resultList->currentElement() !=3D = NULL); + d->actionViewCurrent->setEnabled(d->resultList->currentElement() !=3D = nullptr); } = void SearchResults::importSelected() { - Q_ASSERT_X(d->mainEditor !=3D NULL, "SearchResults::importSelected", "= d->mainEditor is NULL"); + Q_ASSERT_X(d->mainEditor !=3D nullptr, "SearchResults::importSelected"= , "d->mainEditor is NULL"); = FileModel *targetModel =3D d->mainEditor->fileModel(); FileModel *sourceModel =3D d->resultList->fileModel(); diff --git a/src/program/docklets/statistics.cpp b/src/program/docklets/sta= tistics.cpp index 601dc3b2..7281aeb0 100644 --- a/src/program/docklets/statistics.cpp +++ b/src/program/docklets/statistics.cpp @@ -43,7 +43,7 @@ public: const QItemSelectionModel *selectionModel; = StatisticsPrivate(Statistics *parent) - : /* UNUSED p(parent),*/ fileView(NULL), file(NULL), selectionMode= l(NULL) { + : /* UNUSED p(parent),*/ fileView(nullptr), file(nullptr), selecti= onModel(nullptr) { QFormLayout *layout =3D new QFormLayout(parent); = labelNumberOfElements =3D new QLabel(parent); @@ -82,10 +82,10 @@ public: } = void update() { - file =3D fileView !=3D NULL && fileView->fileModel() !=3D NULL ? f= ileView->fileModel()->bibliographyFile() : NULL; - selectionModel =3D fileView !=3D NULL ? fileView->selectionModel()= : NULL; + file =3D fileView !=3D nullptr && fileView->fileModel() !=3D nullp= tr ? fileView->fileModel()->bibliographyFile() : nullptr; + selectionModel =3D fileView !=3D nullptr ? fileView->selectionMode= l() : nullptr; = - if (file !=3D NULL) { + if (file !=3D nullptr) { int numElements, numEntries, numJournalArticles, numConference= Publications, numBooks, numComments, numMacros; countElementTypes(numElements, numEntries, numJournalArticles,= numConferencePublications, numBooks, numComments, numMacros); = @@ -127,9 +127,9 @@ public: = void countElementTypes(int &numElements, int &numEntries, int &numJour= nalArticles, int &numConferencePublications, int &numBooks, int &numComment= s, int &numMacros) { numElements =3D numEntries =3D numJournalArticles =3D numConferenc= ePublications =3D numBooks =3D numComments =3D numMacros =3D 0; - Q_ASSERT_X(file !=3D NULL, "Statistics::StatisticsPrivate::countEl= ementTypes(..)", "Function was called with file=3D=3DNULL"); + Q_ASSERT_X(file !=3D nullptr, "Statistics::StatisticsPrivate::coun= tElementTypes(..)", "Function was called with file=3D=3DNULL"); = - if (selectionModel !=3D NULL && selectionModel->selectedRows().cou= nt() > 1) { + if (selectionModel !=3D nullptr && selectionModel->selectedRows().= count() > 1) { /// Use selected items for statistics if selection contains at= least two elements const auto selectedRows =3D selectionModel->selectedRows(); numElements =3D selectedRows.count(); @@ -161,10 +161,10 @@ Statistics::~Statistics() = void Statistics::setFileView(FileView *fileView) { - if (d->fileView !=3D NULL) + if (d->fileView !=3D nullptr) disconnect(d->fileView, &FileView::selectedElementsChanged, this, = &Statistics::update); d->fileView =3D fileView; - if (d->fileView !=3D NULL) + if (d->fileView !=3D nullptr) connect(d->fileView, &FileView::selectedElementsChanged, this, &St= atistics::update); d->update(); } diff --git a/src/program/docklets/valuelist.cpp b/src/program/docklets/valu= elist.cpp index 1ef9aec9..9d940bf8 100644 --- a/src/program/docklets/valuelist.cpp +++ b/src/program/docklets/valuelist.cpp @@ -68,7 +68,7 @@ public: : p(parent), config(KSharedConfig::openConfig(QStringLiteral("= kbibtexrc"))), configGroupName(QStringLiteral("Value List Docklet")), configKeyFieldName(QStringLiteral("FieldName")), configKeyShowCo= untColumn(QStringLiteral("ShowCountColumn")), configKeySortByCountAction(QStringLiteral("SortByCountAction")),= configKeyHeaderState(QStringLiteral("HeaderState")), - fileView(NULL), model(NULL), sortingModel(NULL), countWidth(8 + = parent->fontMetrics().width(i18n("Count"))) { + fileView(nullptr), model(nullptr), sortingModel(nullptr), countW= idth(8 + parent->fontMetrics().width(i18n("Count"))) { setupGUI(); initialize(); } @@ -188,13 +188,13 @@ public: if (text.isEmpty()) text =3D comboboxFieldNames->currentText(); = delegate->setFieldName(text); - model =3D fileView =3D=3D NULL ? NULL : fileView->valueListModel(t= ext); + model =3D fileView =3D=3D nullptr ? nullptr : fileView->valueListM= odel(text); QAbstractItemModel *usedModel =3D model; - if (usedModel !=3D NULL) { + if (usedModel !=3D nullptr) { model->setShowCountColumn(showCountColumnAction->isChecked()); model->setSortBy(sortByCountAction->isChecked() ? ValueListMod= el::SortByCount : ValueListModel::SortByText); = - if (sortingModel !=3D NULL) delete sortingModel; + if (sortingModel !=3D nullptr) delete sortingModel; sortingModel =3D new QSortFilterProxyModel(p); sortingModel->setSourceModel(model); if (treeviewFieldValues->header()->isSortIndicatorShown()) @@ -239,22 +239,22 @@ ValueList::~ValueList() = void ValueList::setFileView(FileView *fileView) { - if (d->fileView !=3D NULL) + if (d->fileView !=3D nullptr) disconnect(d->fileView, &FileView::selectedElementsChanged, this, = &ValueList::editorSelectionChanged); d->fileView =3D fileView; - if (d->fileView !=3D NULL) { + if (d->fileView !=3D nullptr) { connect(d->fileView, &FileView::selectedElementsChanged, this, &Va= lueList::editorSelectionChanged); connect(d->fileView, &FileView::destroyed, this, &ValueList::edito= rDestroyed); } editorSelectionChanged(); update(); - resizeEvent(NULL); + resizeEvent(nullptr); } = void ValueList::update() { d->update(); - setEnabled(d->fileView !=3D NULL); + setEnabled(d->fileView !=3D nullptr); } = void ValueList::resizeEvent(QResizeEvent *) @@ -430,10 +430,10 @@ void ValueList::deleteAllOccurrences() = void ValueList::showCountColumnToggled() { - if (d->model !=3D NULL) + if (d->model !=3D nullptr) d->model->setShowCountColumn(d->showCountColumnAction->isChecked()= ); if (d->showCountColumnAction->isChecked()) - resizeEvent(NULL); + resizeEvent(nullptr); = d->sortByCountAction->setEnabled(!d->showCountColumnAction->isChecked(= )); = @@ -444,7 +444,7 @@ void ValueList::showCountColumnToggled() = void ValueList::sortByCountToggled() { - if (d->model !=3D NULL) + if (d->model !=3D nullptr) d->model->setSortBy(d->sortByCountAction->isChecked() ? ValueListM= odel::SortByCount : ValueListModel::SortByText); = KConfigGroup configGroup(d->config, d->configGroupName); @@ -454,7 +454,7 @@ void ValueList::sortByCountToggled() = void ValueList::delayedResize() { - resizeEvent(NULL); + resizeEvent(nullptr); } = void ValueList::columnsChanged() @@ -464,11 +464,11 @@ void ValueList::columnsChanged() configGroup.writeEntry(d->configKeyHeaderState, headerState); d->config->sync(); = - resizeEvent(NULL); + resizeEvent(nullptr); } = void ValueList::editorSelectionChanged() { - const bool selectedElements =3D d->fileView =3D=3D NULL ? false : d->f= ileView->selectedElements().count() > 0; + const bool selectedElements =3D d->fileView =3D=3D nullptr ? false : d= ->fileView->selectedElements().count() > 0; d->assignSelectionAction->setEnabled(selectedElements); d->removeSelectionAction->setEnabled(selectedElements); } @@ -476,7 +476,7 @@ void ValueList::editorSelectionChanged() { void ValueList::editorDestroyed() { /// Reset internal variable to NULL to avoid /// accessing invalid pointer/data later - d->fileView =3D NULL; + d->fileView =3D nullptr; editorSelectionChanged(); } = diff --git a/src/program/docklets/zoterobrowser.cpp b/src/program/docklets/= zoterobrowser.cpp index f90777a3..be0bd5ef 100644 --- a/src/program/docklets/zoterobrowser.cpp +++ b/src/program/docklets/zoterobrowser.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2015 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -81,19 +81,19 @@ public: static const QString walletFolderOAuth, walletEntryKBibTeXZotero, wall= etKeyZoteroId, walletKeyZoteroApiKey; = Private(SearchResults *sr, ZoteroBrowser *parent) - : p(parent), items(NULL), groups(NULL), tags(NULL), tagModel(N= ULL), collection(NULL), collectionModel(NULL), needToApplyCredentials(true)= , searchResults(sr), comboBoxGroupListInitialized(false), nonBusyCursor(p->= cursor()), wallet(NULL) { + : p(parent), items(nullptr), groups(nullptr), tags(nullptr), t= agModel(nullptr), collection(nullptr), collectionModel(nullptr), needToAppl= yCredentials(true), searchResults(sr), comboBoxGroupListInitialized(false),= nonBusyCursor(p->cursor()), wallet(nullptr) { setupGUI(); } = ~Private() { - if (wallet !=3D NULL) + if (wallet !=3D nullptr) delete wallet; - if (items !=3D NULL) delete items; - if (groups !=3D NULL) delete groups; - if (tags !=3D NULL) delete tags; - if (tagModel !=3D NULL) delete tagModel; - if (collection !=3D NULL) delete collection; - if (collectionModel !=3D NULL) delete collectionModel; + if (items !=3D nullptr) delete items; + if (groups !=3D nullptr) delete groups; + if (tags !=3D nullptr) delete tags; + if (tagModel !=3D nullptr) delete tagModel; + if (collection !=3D nullptr) delete collection; + if (collectionModel !=3D nullptr) delete collectionModel; api.clear(); } = @@ -169,11 +169,11 @@ public: } = void queueReadOAuthCredentials() { - if (wallet !=3D NULL && wallet->isOpen()) + if (wallet !=3D nullptr && wallet->isOpen()) p->readOAuthCredentials(true); else { /// Wallet is closed or not initialized - if (wallet !=3D NULL) + if (wallet !=3D nullptr) /// Delete existing but closed wallet, will be replaced by= new, open wallet soon delete wallet; p->setEnabled(false); @@ -184,11 +184,11 @@ public: } = void queueWriteOAuthCredentials() { - if (wallet !=3D NULL && wallet->isOpen()) + if (wallet !=3D nullptr && wallet->isOpen()) p->writeOAuthCredentials(true); else { /// Wallet is closed or not initialized - if (wallet !=3D NULL) + if (wallet !=3D nullptr) /// Delete existing but closed wallet, will be replaced by= new, open wallet soon delete wallet; p->setEnabled(false); diff --git a/src/program/documentlist.cpp b/src/program/documentlist.cpp index 4eb7f251..664eeea0 100644 --- a/src/program/documentlist.cpp +++ b/src/program/documentlist.cpp @@ -80,7 +80,7 @@ void DocumentListDelegate::paint(QPainter *painter, const= QStyleOptionViewItem & int height =3D option.rect.height(); = QStyle *style =3D QApplication::style(); - style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0= ); + style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, n= ullptr); = painter->save(); = @@ -192,7 +192,7 @@ QVariant DocumentListModel::data(const QModelIndex &ind= ex, int role) const overlays << QStringLiteral("document-save"); else overlays << QStringLiteral(""); - return KDE::icon(iconName, overlays, 0); + return KDE::icon(iconName, overlays, nullptr); } case Qt::ToolTipRole: { QString htmlText(QString(QStringLiteral(" %2")).arg(KIconLoader::global()->iconPath(iconName, KIconLoader::Small= ), openFileInfo->shortCaption())); @@ -257,7 +257,7 @@ public: QSignalMapper openMenuSignalMapper; = DocumentListViewPrivate(DocumentListView *parent) - : p(parent), ofim(OpenFileInfoManager::instance()), actionAddT= oFav(NULL), actionRemFromFav(NULL), actionCloseFile(NULL), actionOpenFile(N= ULL), actionOpenMenu(NULL) { + : p(parent), ofim(OpenFileInfoManager::instance()), actionAddT= oFav(nullptr), actionRemFromFav(nullptr), actionCloseFile(nullptr), actionO= penFile(nullptr), actionOpenMenu(nullptr) { connect(&openMenuSignalMapper, static_cast(&QSignalMapper::mapped), p, &DocumentListView::openFileWithService); } }; @@ -350,25 +350,25 @@ void DocumentListView::closeFile() void DocumentListView::currentChanged(const QModelIndex ¤t, const QM= odelIndex &) { bool hasCurrent =3D current !=3D QModelIndex(); - OpenFileInfo *ofi =3D hasCurrent ? qvariant_cast(curre= nt.data(Qt::UserRole)) : NULL; + OpenFileInfo *ofi =3D hasCurrent ? qvariant_cast(curre= nt.data(Qt::UserRole)) : nullptr; bool isOpen =3D hasCurrent ? ofi->flags().testFlag(OpenFileInfo::Open)= : false; bool isFavorite =3D hasCurrent ? ofi->flags().testFlag(OpenFileInfo::F= avorite) : false; bool hasName =3D hasCurrent ? ofi->flags().testFlag(OpenFileInfo::HasN= ame) : false; = - if (d->actionOpenFile !=3D NULL) + if (d->actionOpenFile !=3D nullptr) d->actionOpenFile->setEnabled(hasCurrent && !isOpen); - if (d->actionCloseFile !=3D NULL) + if (d->actionCloseFile !=3D nullptr) d->actionCloseFile->setEnabled(hasCurrent && isOpen); - if (d->actionAddToFav !=3D NULL) + if (d->actionAddToFav !=3D nullptr) d->actionAddToFav->setEnabled(hasCurrent && !isFavorite && hasName= ); - if (d->actionRemFromFav !=3D NULL) + if (d->actionRemFromFav !=3D nullptr) d->actionRemFromFav->setEnabled(hasCurrent && isFavorite); = for (QAction *action : const_cast &>(d->openMen= uActions)) { d->actionOpenMenu->removeAction(action); } d->openMenuServices.clear(); - if (ofi !=3D NULL) { + if (ofi !=3D nullptr) { d->openMenuServices =3D ofi->listOfServices(); int i =3D 0; for (KService::Ptr servicePtr : const_cast= (d->openMenuServices)) { diff --git a/src/program/documentlist.h b/src/program/documentlist.h index f17def13..175ebc2d 100644 --- a/src/program/documentlist.h +++ b/src/program/documentlist.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -39,7 +39,7 @@ private: OpenFileInfoManager *ofim; = public: - explicit DocumentListDelegate(QObject *parent =3D NULL); + explicit DocumentListDelegate(QObject *parent =3D nullptr); = void paint(QPainter *painter, const QStyleOptionViewItem &option, cons= t QModelIndex &index) const; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &= index) const; @@ -51,7 +51,7 @@ class DocumentListModel : public QAbstractListModel Q_OBJECT = public: - explicit DocumentListModel(OpenFileInfo::StatusFlag statusFlag, QObjec= t *parent =3D NULL); + explicit DocumentListModel(OpenFileInfo::StatusFlag statusFlag, QObjec= t *parent =3D nullptr); ~DocumentListModel(); = int rowCount(const QModelIndex &parent =3D QModelIndex()) const; @@ -96,7 +96,7 @@ class DocumentList : public QTabWidget public: enum Category { OpenFiles =3D 0, RecentFiles =3D 1, Favorites =3D 2 }; = - explicit DocumentList(QWidget *parent =3D NULL); + explicit DocumentList(QWidget *parent =3D nullptr); = signals: void openFile(const QUrl &url); diff --git a/src/program/mainwindow.cpp b/src/program/mainwindow.cpp index 44be3f2a..e9f1670e 100644 --- a/src/program/mainwindow.cpp +++ b/src/program/mainwindow.cpp @@ -331,10 +331,10 @@ void KBibTeXMainWindow::newDocument() void KBibTeXMainWindow::openDocumentDialog() { OpenFileInfo *currFile =3D OpenFileInfoManager::instance()->currentFil= e(); - QUrl currFileUrl =3D currFile =3D=3D NULL ? QUrl() : currFile->url(); + QUrl currFileUrl =3D currFile =3D=3D nullptr ? QUrl() : currFile->url(= ); QString startDir =3D currFileUrl.isValid() ? QUrl(currFileUrl.url()).p= ath() : QString(); OpenFileInfo *ofi =3D OpenFileInfoManager::instance()->currentFile(); - if (ofi !=3D NULL) { + if (ofi !=3D nullptr) { QUrl url =3D ofi->url(); if (url.isValid()) startDir =3D url.path(); } @@ -391,16 +391,16 @@ void KBibTeXMainWindow::showPreferences() void KBibTeXMainWindow::documentSwitched(FileView *oldFileView, FileView *= newFileView) { OpenFileInfo *openFileInfo =3D d->mdiWidget->currentFile(); - bool validFile =3D openFileInfo !=3D NULL; + bool validFile =3D openFileInfo !=3D nullptr; d->actionClose->setEnabled(validFile); = setCaption(validFile ? i18n("%1 - KBibTeX", openFileInfo->shortCaption= ()) : i18n("KBibTeX")); = - d->fileSettings->setEnabled(newFileView !=3D NULL); - d->referencePreview->setEnabled(newFileView !=3D NULL); - d->elementForm->setEnabled(newFileView !=3D NULL); - d->documentPreview->setEnabled(newFileView !=3D NULL); - if (oldFileView !=3D NULL) { + d->fileSettings->setEnabled(newFileView !=3D nullptr); + d->referencePreview->setEnabled(newFileView !=3D nullptr); + d->elementForm->setEnabled(newFileView !=3D nullptr); + d->documentPreview->setEnabled(newFileView !=3D nullptr); + if (oldFileView !=3D nullptr) { disconnect(newFileView, &FileView::currentElementChanged, d->refer= encePreview, &ReferencePreview::setElement); disconnect(newFileView, &FileView::currentElementChanged, d->eleme= ntForm, &ElementForm::setElement); disconnect(newFileView, &FileView::currentElementChanged, d->docum= entPreview, &DocumentPreview::setElement); @@ -410,7 +410,7 @@ void KBibTeXMainWindow::documentSwitched(FileView *oldF= ileView, FileView *newFil // FIXME disconnect(oldEditor, SIGNAL(modified()), d->elementForm,= SLOT(refreshElement())); disconnect(d->elementForm, &ElementForm::elementModified, newFileV= iew, &FileView::externalModification); } - if (newFileView !=3D NULL) { + if (newFileView !=3D nullptr) { connect(newFileView, &FileView::currentElementChanged, d->referenc= ePreview, &ReferencePreview::setElement); connect(newFileView, &FileView::currentElementChanged, d->elementF= orm, &ElementForm::setElement); connect(newFileView, &FileView::currentElementChanged, d->document= Preview, &DocumentPreview::setElement); @@ -423,9 +423,9 @@ void KBibTeXMainWindow::documentSwitched(FileView *oldF= ileView, FileView *newFil } = d->documentPreview->setBibTeXUrl(validFile ? openFileInfo->url() : QUr= l()); - d->referencePreview->setElement(QSharedPointer(), NULL); - d->elementForm->setElement(QSharedPointer(), NULL); - d->documentPreview->setElement(QSharedPointer(), NULL); + d->referencePreview->setElement(QSharedPointer(), nullptr); + d->elementForm->setElement(QSharedPointer(), nullptr); + d->documentPreview->setElement(QSharedPointer(), nullptr); d->valueList->setFileView(newFileView); d->fileSettings->setFileView(newFileView); d->statistics->setFileView(newFileView); @@ -474,9 +474,9 @@ void KBibTeXMainWindow::delayed() { /// Static variable, memorizes the dynamically created /// BibliographyService instance and allows to tell if /// this slot was called for the first or second time. - static BibliographyService *bs =3D NULL; + static BibliographyService *bs =3D nullptr; = - if (bs =3D=3D NULL) { + if (bs =3D=3D nullptr) { /// First call to this slot bs =3D new BibliographyService(this); if (!bs->isKBibTeXdefault() && KMessageBox::questionYesNo(this, i1= 8n("KBibTeX is not the default editor for its bibliography formats like Bib= TeX or RIS."), i18n("Default Bibliography Editor"), KGuiItem(i18n("Set as D= efault Editor")), KGuiItem(i18n("Keep settings unchanged"))) =3D=3D KMessag= eBox::Yes) { @@ -488,11 +488,11 @@ void KBibTeXMainWindow::delayed() { /// KBibTeX is default application or user doesn't care, /// therefore clean up memory delete bs; - bs =3D NULL; + bs =3D nullptr; } } else { /// Second call to this slot. This time, clean up memory. bs->deleteLater(); - bs =3D NULL; + bs =3D nullptr; } } diff --git a/src/program/mainwindow.h b/src/program/mainwindow.h index c2e4ebbb..8accf57a 100644 --- a/src/program/mainwindow.h +++ b/src/program/mainwindow.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -36,7 +36,7 @@ class KBibTeXMainWindow : public KParts::MainWindow Q_OBJECT = public: - explicit KBibTeXMainWindow(QWidget *parent =3D NULL); + explicit KBibTeXMainWindow(QWidget *parent =3D nullptr); virtual ~KBibTeXMainWindow(); = public slots: diff --git a/src/program/mdiwidget.cpp b/src/program/mdiwidget.cpp index 51a2153d..f6c9adcc 100644 --- a/src/program/mdiwidget.cpp +++ b/src/program/mdiwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2015 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -53,7 +53,7 @@ public: static const int URLRole =3D Qt::UserRole + 235; static const int SortRole =3D Qt::UserRole + 236; = - LRUItemModel(OpenFileInfoManager *openFileInfoManager, QObject *parent= =3D NULL) + LRUItemModel(OpenFileInfoManager *openFileInfoManager, QObject *parent= =3D nullptr) : QAbstractItemModel(parent), ofim(openFileInfoManager) { // nothing } @@ -194,7 +194,7 @@ public: KSharedConfigPtr config; = MDIWidgetPrivate(MDIWidget *parent) - : p(parent), ofim(OpenFileInfoManager::instance()), currentFil= e(NULL), config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) { + : p(parent), ofim(OpenFileInfoManager::instance()), currentFil= e(nullptr), config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) { createWelcomeWidget(); = modelLRU =3D new LRUItemModel(ofim, listLRU); @@ -240,14 +240,14 @@ MDIWidget::~MDIWidget() = void MDIWidget::setFile(OpenFileInfo *openFileInfo, KService::Ptr serviceP= tr) { - KParts::Part *part =3D openFileInfo =3D=3D NULL ? NULL : openFileInfo-= >part(this, servicePtr); + KParts::Part *part =3D openFileInfo =3D=3D nullptr ? nullptr : openFil= eInfo->part(this, servicePtr); /// 'part' will only be NULL if no OpenFileInfo object was given, /// or if the OpenFileInfo could not locate a KPart QWidget *widget =3D d->welcomeWidget; ///< by default use Welcome widg= et - if (part !=3D NULL) { + if (part !=3D nullptr) { /// KPart object was located, use its object (instead of Welcome w= idget) widget =3D part->widget(); - } else if (openFileInfo !=3D NULL) { + } else if (openFileInfo !=3D nullptr) { /// A valid OpenFileInfo was given, but no KPart could be located = d->ofim->close(openFileInfo); // FIXME does not close correctly if= file is new @@ -259,17 +259,17 @@ void MDIWidget::setFile(OpenFileInfo *openFileInfo, K= Service::Ptr servicePtr) return; } = - FileView *oldEditor =3D NULL; + FileView *oldEditor =3D nullptr; bool hasChanged =3D true; if (indexOf(widget) >=3D 0) { /// Chosen widget is already known (Welcome widget or a previously= used KPart) = /// In case previous (still current) widget was a KBibTeX Part, re= member its editor PartWidget *currentPartWidget =3D qobject_cast(curre= ntWidget()); - oldEditor =3D currentPartWidget =3D=3D NULL ? NULL : currentPartWi= dget->fileView(); + oldEditor =3D currentPartWidget =3D=3D nullptr ? nullptr : current= PartWidget->fileView(); /// Record if set widget is different from previous (still current= ) widget hasChanged =3D widget !=3D currentWidget(); - } else if (openFileInfo !=3D NULL) { + } else if (openFileInfo !=3D nullptr) { /// Widget was not known previously, but a valid (new?) OpenFileIn= fo was given addWidget(widget); d->addToMapper(openFileInfo); @@ -282,14 +282,14 @@ void MDIWidget::setFile(OpenFileInfo *openFileInfo, K= Service::Ptr servicePtr) emit activePartChanged(part); /// If new widget comes from a KBibTeX Part, retrieve its editor PartWidget *newPartWidget =3D qobject_cast(widget); - FileView *newEditor =3D newPartWidget =3D=3D NULL ? NULL : newPart= Widget->fileView(); + FileView *newEditor =3D newPartWidget =3D=3D nullptr ? nullptr : n= ewPartWidget->fileView(); emit documentSwitched(oldEditor, newEditor); } = /// Notify main window about a change of current file, /// so that the title may contain the current file's URL. /// This signal will be connected to KMainWindow::setCaption. - if (openFileInfo !=3D NULL) { + if (openFileInfo !=3D nullptr) { QUrl url =3D openFileInfo->url(); if (url.isValid()) emit setCaption(QString(QStringLiteral("%1 [%2]")).arg(openFil= eInfo->shortCaption(), squeeze_text(openFileInfo->fullCaption(), 64))); diff --git a/src/program/openfileinfo.cpp b/src/program/openfileinfo.cpp index ce8d19ff..b12c4879 100644 --- a/src/program/openfileinfo.cpp +++ b/src/program/openfileinfo.cpp @@ -60,7 +60,7 @@ public: QUrl url; = OpenFileInfoPrivate(OpenFileInfoManager *openFileInfoManager, const QU= rl &url, const QString &mimeType, OpenFileInfo *p) - : m_counter(-1), p(p), part(NULL), internalServicePtr(KService::P= tr()), internalWidgetParent(NULL), flags(0) { + : m_counter(-1), p(p), part(nullptr), internalServicePtr(KService= ::Ptr()), internalWidgetParent(nullptr), flags(nullptr) { this->openFileInfoManager =3D openFileInfoManager; this->url =3D url; if (this->url.isValid() && this->url.scheme().isEmpty()) @@ -69,9 +69,9 @@ public: } = ~OpenFileInfoPrivate() { - if (part !=3D NULL) { + if (part !=3D nullptr) { KParts::ReadWritePart *rwp =3D qobject_cast(part); - if (rwp !=3D NULL) + if (rwp !=3D nullptr) rwp->closeUrl(true); delete part; } @@ -80,26 +80,26 @@ public: KParts::ReadOnlyPart *createPart(QWidget *newWidgetParent, KService::P= tr newServicePtr =3D KService::Ptr()) { if (!p->flags().testFlag(OpenFileInfo::Open)) { qCWarning(LOG_KBIBTEX_PROGRAM) << "Cannot create part for a fi= le which is not open"; - return NULL; + return nullptr; } = - Q_ASSERT_X(internalWidgetParent =3D=3D NULL || internalWidgetParen= t =3D=3D newWidgetParent, "KParts::ReadOnlyPart *OpenFileInfo::OpenFileInfo= Private::createPart(QWidget *newWidgetParent, KService::Ptr newServicePtr = =3D KService::Ptr())", "internal widget should be either NULL or the same o= ne as supplied as \"newWidgetParent\""); + Q_ASSERT_X(internalWidgetParent =3D=3D nullptr || internalWidgetPa= rent =3D=3D newWidgetParent, "KParts::ReadOnlyPart *OpenFileInfo::OpenFileI= nfoPrivate::createPart(QWidget *newWidgetParent, KService::Ptr newServicePt= r =3D KService::Ptr())", "internal widget should be either NULL or the same= one as supplied as \"newWidgetParent\""); = /** use cached part for this parent if possible */ if (internalWidgetParent =3D=3D newWidgetParent && (newServicePtr = =3D=3D KService::Ptr() || internalServicePtr =3D=3D newServicePtr)) { - Q_ASSERT_X(part !=3D NULL, "KParts::ReadOnlyPart *OpenFileInfo= ::OpenFileInfoPrivate::createPart(QWidget *newWidgetParent, KService::Ptr n= ewServicePtr =3D KService::Ptr())", "Part is NULL"); + Q_ASSERT_X(part !=3D nullptr, "KParts::ReadOnlyPart *OpenFileI= nfo::OpenFileInfoPrivate::createPart(QWidget *newWidgetParent, KService::Pt= r newServicePtr =3D KService::Ptr())", "Part is NULL"); return part; - } else if (part !=3D NULL) { + } else if (part !=3D nullptr) { KParts::ReadWritePart *rwp =3D qobject_cast(part); - if (rwp !=3D NULL) + if (rwp !=3D nullptr) rwp->closeUrl(true); part->deleteLater(); - part =3D NULL; + part =3D nullptr; } = /// reset to invalid values in case something goes wrong internalServicePtr =3D KService::Ptr(); - internalWidgetParent =3D NULL; + internalWidgetParent =3D nullptr; = if (!newServicePtr) { /// no valid KService has been passed @@ -108,20 +108,20 @@ public: } if (!newServicePtr) { qCCritical(LOG_KBIBTEX_PROGRAM) << "Cannot find service to han= dle mimetype " << mimeType << endl; - return NULL; + return nullptr; } = QString errorString; part =3D newServicePtr->createInstance(newW= idgetParent, (QObject *)newWidgetParent, QVariantList(), &errorString); - if (part =3D=3D NULL) { + if (part =3D=3D nullptr) { qCDebug(LOG_KBIBTEX_PROGRAM) << "Could not instantiate read-wr= ite part for service" << newServicePtr->name() << "(mimeType=3D" << mimeTyp= e << ", library=3D" << newServicePtr->library() << ", error msg=3D" << erro= rString << ")"; /// creating a read-write part failed, so maybe it is read-onl= y (like Okular's PDF viewer)? part =3D newServicePtr->createInstance(n= ewWidgetParent, (QObject *)newWidgetParent, QVariantList(), &errorString); } - if (part =3D=3D NULL) { + if (part =3D=3D nullptr) { /// still cannot create part, must be error qCCritical(LOG_KBIBTEX_PROGRAM) << "Could not instantiate part= for service" << newServicePtr->name() << "(mimeType=3D" << mimeType << ", = library=3D" << newServicePtr->library() << ", error msg=3D" << errorString = << ")"; - return NULL; + return nullptr; } = if (url.isValid()) { @@ -139,7 +139,7 @@ public: internalServicePtr =3D newServicePtr; internalWidgetParent =3D newWidgetParent; = - Q_ASSERT_X(part !=3D NULL, "KParts::ReadOnlyPart *OpenFileInfo::Op= enFileInfoPrivate::createPart(QWidget *newWidgetParent, KService::Ptr newSe= rvicePtr =3D KService::Ptr())", "Creation of part failed, is NULL"); /// te= st should not be necessary, but just to be save ... + Q_ASSERT_X(part !=3D nullptr, "KParts::ReadOnlyPart *OpenFileInfo:= :OpenFileInfoPrivate::createPart(QWidget *newWidgetParent, KService::Ptr ne= wServicePtr =3D KService::Ptr())", "Creation of part failed, is NULL"); ///= test should not be necessary, but just to be save ... return part; } = @@ -193,7 +193,7 @@ QUrl OpenFileInfo::url() const bool OpenFileInfo::isModified() const { KParts::ReadWritePart *rwPart =3D qobject_cast< KParts::ReadWritePart = *>(d->part); - if (rwPart =3D=3D NULL) + if (rwPart =3D=3D nullptr) return false; else return rwPart->isModified(); @@ -202,7 +202,7 @@ bool OpenFileInfo::isModified() const bool OpenFileInfo::save() { KParts::ReadWritePart *rwPart =3D qobject_cast< KParts::ReadWritePart = *>(d->part); - if (rwPart =3D=3D NULL) + if (rwPart =3D=3D nullptr) return true; else return rwPart->save(); @@ -210,16 +210,16 @@ bool OpenFileInfo::save() = bool OpenFileInfo::close() { - if (d->part =3D=3D NULL) { + if (d->part =3D=3D nullptr) { /// if there is no part, closing always "succeeds" return true; } = KParts::ReadWritePart *rwp =3D qobject_cast(d= ->part); - if (rwp =3D=3D NULL || rwp->closeUrl(true)) { + if (rwp =3D=3D nullptr || rwp->closeUrl(true)) { d->part->deleteLater(); - d->part =3D NULL; - d->internalWidgetParent =3D NULL; + d->part =3D nullptr; + d->internalWidgetParent =3D nullptr; return true; } return false; @@ -363,7 +363,7 @@ public: OpenFileInfo *currentFileInfo; = OpenFileInfoManagerPrivate(OpenFileInfoManager *parent) - : p(parent), currentFileInfo(NULL) { + : p(parent), currentFileInfo(nullptr) { // nothing } = @@ -412,7 +412,7 @@ public: } = OpenFileInfo *ofi =3D p->contains(fileUrl); - if (ofi =3D=3D NULL) { + if (ofi =3D=3D nullptr) { ofi =3D p->open(fileUrl); } ofi->addFlags(statusFlag); @@ -453,7 +453,7 @@ const int OpenFileInfoManager::OpenFileInfoManagerPriva= te::maxNumFavoriteFiles =3D const int OpenFileInfoManager::OpenFileInfoManagerPrivate::maxNumRecentlyU= sedFiles =3D 8; const int OpenFileInfoManager::OpenFileInfoManagerPrivate::maxNumOpenFiles= =3D 16; = -OpenFileInfoManager *OpenFileInfoManager::singleton =3D NULL; +OpenFileInfoManager *OpenFileInfoManager::singleton =3D nullptr; = OpenFileInfoManager::OpenFileInfoManager(QObject *parent) : QObject(parent), d(new OpenFileInfoManagerPrivate(this)) @@ -462,7 +462,7 @@ OpenFileInfoManager::OpenFileInfoManager(QObject *paren= t) } = OpenFileInfoManager *OpenFileInfoManager::instance() { - if (singleton =3D=3D NULL) + if (singleton =3D=3D nullptr) singleton =3D new OpenFileInfoManager(QCoreApplication::instance()= ); return singleton; } @@ -486,7 +486,7 @@ OpenFileInfo *OpenFileInfoManager::open(const QUrl &url) Q_ASSERT_X(url.isValid(), "OpenFileInfo *OpenFileInfoManager::open(con= st QUrl&)", "URL is not valid"); = OpenFileInfo *result =3D contains(url); - if (result =3D=3D NULL) { + if (result =3D=3D nullptr) { /// file not yet open result =3D new OpenFileInfo(this, url); connect(result, &OpenFileInfo::flagsChanged, this, &OpenFileInfoMa= nager::flagsChanged); @@ -498,13 +498,13 @@ OpenFileInfo *OpenFileInfoManager::open(const QUrl &u= rl) = OpenFileInfo *OpenFileInfoManager::contains(const QUrl &url) const { - if (!url.isValid()) return NULL; /// can only be unnamed file + if (!url.isValid()) return nullptr; /// can only be unnamed file = for (auto *ofi : const_cast(d->openFileInfoList)) { if (ofi->url() =3D=3D url) return ofi; } - return NULL; + return nullptr; } = bool OpenFileInfoManager::changeUrl(OpenFileInfo *openFileInfo, const QUrl= &url) @@ -512,7 +512,7 @@ bool OpenFileInfoManager::changeUrl(OpenFileInfo *openF= ileInfo, const QUrl &url) OpenFileInfo *previouslyContained =3D contains(url); = /// check if old url differs from new url and old url is valid - if (previouslyContained !=3D NULL && previouslyContained->flags().test= Flag(OpenFileInfo::Open) && previouslyContained !=3D openFileInfo) { + if (previouslyContained !=3D nullptr && previouslyContained->flags().t= estFlag(OpenFileInfo::Open) && previouslyContained !=3D openFileInfo) { qCWarning(LOG_KBIBTEX_PROGRAM) << "Open file with same URL already= exists, forcefully closing it" << endl; close(previouslyContained); } @@ -527,7 +527,7 @@ bool OpenFileInfoManager::changeUrl(OpenFileInfo *openF= ileInfo, const QUrl &url) OpenFileInfo::StatusFlags statusFlags =3D (openFileInfo->flags() &= (~OpenFileInfo::Open)) | OpenFileInfo::RecentlyUsed; ofi->setFlags(statusFlags); } - if (previouslyContained !=3D NULL) { + if (previouslyContained !=3D nullptr) { /// keep Favorite flag if set in file that have previously same URL if (previouslyContained->flags().testFlag(OpenFileInfo::Favorite)) openFileInfo->setFlags(openFileInfo->flags() | OpenFileInfo::F= avorite); @@ -550,7 +550,7 @@ bool OpenFileInfoManager::changeUrl(OpenFileInfo *openF= ileInfo, const QUrl &url) = bool OpenFileInfoManager::close(OpenFileInfo *openFileInfo) { - if (openFileInfo =3D=3D NULL) { + if (openFileInfo =3D=3D nullptr) { qCWarning(LOG_KBIBTEX_PROGRAM) << "void OpenFileInfoManager::close= (OpenFileInfo *openFileInfo): Cannot close openFileInfo which is NULL"; return false; } @@ -559,7 +559,7 @@ bool OpenFileInfoManager::close(OpenFileInfo *openFileI= nfo) openFileInfo->setLastAccess(); = /// remove flag "open" from file to be closed and determine which file= to show instead - OpenFileInfo *nextCurrent =3D (d->currentFileInfo =3D=3D openFileInfo)= ? NULL : d->currentFileInfo; + OpenFileInfo *nextCurrent =3D (d->currentFileInfo =3D=3D openFileInfo)= ? nullptr : d->currentFileInfo; for (OpenFileInfo *ofi : const_cast(d->openFileInfoList)) { if (!isClosing && ofi =3D=3D openFileInfo && openFileInfo->close()= ) { isClosing =3D true; @@ -568,7 +568,7 @@ bool OpenFileInfoManager::close(OpenFileInfo *openFileI= nfo) /// If file has a filename, remember as recently used if (openFileInfo->flags().testFlag(OpenFileInfo::HasName)) openFileInfo->addFlags(OpenFileInfo::RecentlyUsed); - } else if (nextCurrent =3D=3D NULL && ofi->flags().testFlag(OpenFi= leInfo::Open)) + } else if (nextCurrent =3D=3D nullptr && ofi->flags().testFlag(Ope= nFileInfo::Open)) nextCurrent =3D ofi; } = @@ -636,14 +636,14 @@ void OpenFileInfoManager::setCurrentFile(OpenFileInfo= *openFileInfo, KService::P OpenFileInfo *previous =3D d->currentFileInfo; d->currentFileInfo =3D openFileInfo; = - if (d->currentFileInfo !=3D NULL) { + if (d->currentFileInfo !=3D nullptr) { d->currentFileInfo->addFlags(OpenFileInfo::Open); d->currentFileInfo->setLastAccess(); } if (hasChanged) { - if (previous !=3D NULL) previous->setLastAccess(); + if (previous !=3D nullptr) previous->setLastAccess(); emit currentChanged(openFileInfo, servicePtr); - } else if (openFileInfo !=3D NULL && servicePtr !=3D openFileInfo->cur= rentService()) + } else if (openFileInfo !=3D nullptr && servicePtr !=3D openFileInfo->= currentService()) emit currentChanged(openFileInfo, servicePtr); } = diff --git a/src/program/openfileinfo.h b/src/program/openfileinfo.h index a27d5afc..628675ec 100644 --- a/src/program/openfileinfo.h +++ b/src/program/openfileinfo.h @@ -146,7 +146,7 @@ public: bool queryCloseAll(); = void setCurrentFile(OpenFileInfo *openFileInfo, KService::Ptr serviceP= tr =3D KService::Ptr()); - OpenFileInfoList filteredItems(OpenFileInfo::StatusFlags required, Ope= nFileInfo::StatusFlags forbidden =3D 0); + OpenFileInfoList filteredItems(OpenFileInfo::StatusFlags required, Ope= nFileInfo::StatusFlags forbidden =3D nullptr); = friend class OpenFileInfo; = diff --git a/src/program/program.cpp b/src/program/program.cpp index 10e43a8b..2681a54e 100644 --- a/src/program/program.cpp +++ b/src/program/program.cpp @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) mainWindow->show(); = KService::Ptr service =3D KService::serviceByStorageId(QStringLiteral(= "kbibtexpart.desktop")); - if (service.data() =3D=3D NULL) { + if (service.data() =3D=3D nullptr) { /// Dump some environment variables that may be helpful /// in tracing back why the part's .desktop file was not found qCDebug(LOG_KBIBTEX_PROGRAM) << "PATH=3D" << getenv("PATH"); diff --git a/src/test/kbibtexfilestest.cpp b/src/test/kbibtexfilestest.cpp index a205e1bc..5273a176 100644 --- a/src/test/kbibtexfilestest.cpp +++ b/src/test/kbibtexfilestest.cpp @@ -115,7 +115,7 @@ void KBibTeXFilesTest::testFiles() QVERIFY(QFileInfo::exists(absoluteFilename)); = /// First load the file ... - File *file =3D NULL; + File *file =3D nullptr; loadFile(absoluteFilename, testFile, &file); QVERIFY(file); = @@ -125,7 +125,7 @@ void KBibTeXFilesTest::testFiles() QVERIFY(!tempFileName.isEmpty()); = /// ... and finally try to load again the newly saved version - File *file2 =3D NULL; + File *file2 =3D nullptr; loadFile(tempFileName, testFile, &file2); QVERIFY(file2); = @@ -136,9 +136,9 @@ void KBibTeXFilesTest::testFiles() = void KBibTeXFilesTest::loadFile(const QString &absoluteFilename, const Tes= tFile ¤tTestFile, File **outFile) { - *outFile =3D NULL; + *outFile =3D nullptr; = - FileImporter *importer =3D NULL; + FileImporter *importer =3D nullptr; if (currentTestFile.filename.endsWith(QStringLiteral(".bib"))) { importer =3D new FileImporterBibTeX(false); } else { @@ -146,7 +146,7 @@ void KBibTeXFilesTest::loadFile(const QString &absolute= Filename, const TestFile } = QFile file(absoluteFilename); - File *bibTeXFile =3D NULL; + File *bibTeXFile =3D nullptr; QVERIFY(file.open(QFile::ReadOnly)); bibTeXFile =3D importer->load(&file); file.close(); @@ -167,7 +167,7 @@ void KBibTeXFilesTest::loadFile(const QString &absolute= Filename, const TestFile if (!authors.isEmpty()) { ValueItem *vi =3D authors.last().data(); Person *p =3D dynamic_cast(vi); - if (p !=3D NULL) { + if (p !=3D nullptr) { lastEntryLastAuthorLastName =3D p->lastName(); } else lastEntryLastAuthorLastName.clear(); @@ -176,7 +176,7 @@ void KBibTeXFilesTest::loadFile(const QString &absolute= Filename, const TestFile if (!editors.isEmpty()) { ValueItem *vi =3D editors.last().data(); Person *p =3D dynamic_cast(vi); - if (p !=3D NULL) { + if (p !=3D nullptr) { lastEntryLastAuthorLastName =3D p->lastName(); } else lastEntryLastAuthorLastName.clear(); @@ -242,7 +242,7 @@ void KBibTeXFilesTest::saveFile(File *file, const TestF= ile ¤tTestFile, QSt { *outFile =3D QString(); = - FileExporter *exporter =3D NULL; + FileExporter *exporter =3D nullptr; if (currentTestFile.filename.endsWith(QStringLiteral(".bib"))) { FileExporterBibTeX *bibTeXExporter =3D new FileExporterBibTeX(); bibTeXExporter->setEncoding(QStringLiteral("utf-8")); diff --git a/src/test/kbibtextest.h b/src/test/kbibtextest.h index 9ddabb94..ad3d5819 100644 --- a/src/test/kbibtextest.h +++ b/src/test/kbibtextest.h @@ -1,5 +1,5 @@ /*************************************************************************= ** - * Copyright (C) 2004-2014 by Thomas Fischer = * + * Copyright (C) 2004-2017 by Thomas Fischer = * * = * * This program is free software; you can redistribute it and/or modify = * * it under the terms of the GNU General Public License as published by = * @@ -30,7 +30,7 @@ class KBibTeXTest : public QDialog Q_OBJECT = public: - explicit KBibTeXTest(QWidget *parent =3D NULL); + explicit KBibTeXTest(QWidget *parent =3D nullptr); = public slots: void startOnlineSearchTests();