[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kbibtex] src: Modernizing C++ code: 'nullptr' instead of 'NULL'
From: Thomas Fischer <null () kde ! org>
Date: 2017-03-31 21:56:21
Message-ID: E1cu4Wr-0004Se-PP () code ! kde ! org
[Download RAW message or body]
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 = NULL;
+BibTeXEntries *BibTeXEntries::BibTeXEntriesPrivate::singleton = nullptr;
BibTeXEntries::BibTeXEntries()
@@ -122,7 +122,7 @@ BibTeXEntries::~BibTeXEntries()
const BibTeXEntries *BibTeXEntries::self()
{
- if (BibTeXEntriesPrivate::singleton == NULL)
+ if (BibTeXEntriesPrivate::singleton == nullptr)
BibTeXEntriesPrivate::singleton = 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 = NULL;
+BibTeXFields *BibTeXFields::BibTeXFieldsPrivate::singleton = nullptr;
BibTeXFields::BibTeXFields()
: QList<FieldDescription *>(), d(new BibTeXFieldsPrivate(this))
@@ -162,7 +162,7 @@ BibTeXFields::~BibTeXFields()
const BibTeXFields *BibTeXFields::self()
{
- if (BibTeXFieldsPrivate::singleton == NULL)
+ if (BibTeXFieldsPrivate::singleton == nullptr)
BibTeXFieldsPrivate::singleton = new BibTeXFields();
return BibTeXFieldsPrivate::singleton;
}
@@ -227,7 +227,7 @@ const FieldDescription *BibTeXFields::find(const QString &name) \
const return fd;
}
qCWarning(LOG_KBIBTEX_CONFIG) << "No field description for " << name << "(" << \
iName << ")";
- return NULL;
+ return nullptr;
}
KBibTeX::TypeFlag BibTeXFields::typeFlagFromString(const QString &typeFlagString)
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 == NULL)
+ if (NotificationHub::NotificationHubPrivate::singleton == nullptr)
NotificationHub::NotificationHubPrivate::singleton = new NotificationHub();
return NotificationHub::NotificationHubPrivate::singleton;
}
@@ -103,4 +103,4 @@ void NotificationHub::publishEvent(int eventId)
const int NotificationHub::EventAny = -1;
const int NotificationHub::EventConfigurationChanged = 0;
const int NotificationHub::EventUserDefined = 1024;
-NotificationHub *NotificationHub::NotificationHubPrivate::singleton = NULL;
+NotificationHub *NotificationHub::NotificationHubPrivate::singleton = nullptr;
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, const File \
*bibTeXfile) {
Entry *result = new Entry(original);
- if (bibTeXfile == NULL)
+ if (bibTeXfile == nullptr)
return result;
const QString crossRef = PlainTextValue::text(original.value(ftCrossRef));
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 = true;
FileModel::FileModel(QObject *parent)
- : QAbstractTableModel(parent), m_file(NULL)
+ : QAbstractTableModel(parent), m_file(nullptr)
{
NotificationHub::registerNotificationListener(this, \
NotificationHub::EventConfigurationChanged); readConfiguration();
@@ -162,7 +162,7 @@ bool FileModel::hasChildren(const QModelIndex &parent) const
int FileModel::rowCount(const QModelIndex & /*parent*/) const
{
- return m_file != NULL ? m_file->count() : 0;
+ return m_file != 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 == NULL)
+ if (m_file == 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 == NULL || row >= rowCount() || row >= m_file->count())
+ if (row < 0 || m_file == nullptr || row >= rowCount() || row >= m_file->count())
return false;
if (parent != QModelIndex())
return false;
@@ -313,7 +313,7 @@ bool FileModel::removeRow(int row, const QModelIndex &parent)
bool FileModel::removeRowList(const QList<int> &rows)
{
- if (m_file == NULL) return false;
+ if (m_file == nullptr) return false;
QList<int> internalRows = rows;
std::sort(internalRows.begin(), internalRows.end(), std::greater<int>());
@@ -331,7 +331,7 @@ bool FileModel::removeRowList(const QList<int> &rows)
bool FileModel::insertRow(QSharedPointer<Element> element, int row, const \
QModelIndex &parent) {
- if (m_file == NULL || row < 0 || row > rowCount() || parent != QModelIndex())
+ if (m_file == nullptr || row < 0 || row > rowCount() || parent != QModelIndex())
return false;
/// Check for duplicate ids or keys when inserting a new element
@@ -386,14 +386,14 @@ bool FileModel::insertRow(QSharedPointer<Element> element, int \
row, const QModel
QSharedPointer<Element> FileModel::element(int row) const
{
- if (m_file == NULL || row < 0 || row >= m_file->count()) return \
QSharedPointer<Element>(); + if (m_file == nullptr || row < 0 || row >= \
m_file->count()) return QSharedPointer<Element>();
return (*m_file)[row];
}
int FileModel::row(QSharedPointer<Element> element) const
{
- if (m_file == NULL) return -1;
+ if (m_file == 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = 0);
+ explicit FileModel(QObject *parent = 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==(const ValueItem &other) const
{
const Keyword *otherKeyword = dynamic_cast<const Keyword *>(&other);
- if (otherKeyword != NULL) {
+ if (otherKeyword != nullptr) {
return otherKeyword->text() == text();
} else
return false;
@@ -160,7 +160,7 @@ bool Person::containsPattern(const QString &pattern, \
Qt::CaseSensitivity caseSen bool Person::operator==(const ValueItem &other) const
{
const Person *otherPerson = dynamic_cast<const Person *>(&other);
- if (otherPerson != NULL) {
+ if (otherPerson != nullptr) {
return otherPerson->firstName() == firstName() && otherPerson->lastName() == \
lastName(); } else
return false;
@@ -250,7 +250,7 @@ bool MacroKey::containsPattern(const QString &pattern, \
Qt::CaseSensitivity caseS bool MacroKey::operator==(const ValueItem &other) const
{
const MacroKey *otherMacroKey = dynamic_cast<const MacroKey *>(&other);
- if (otherMacroKey != NULL) {
+ if (otherMacroKey != nullptr) {
return otherMacroKey->text() == text();
} else
return false;
@@ -300,7 +300,7 @@ bool PlainText::containsPattern(const QString &pattern, \
Qt::CaseSensitivity case bool PlainText::operator==(const ValueItem &other) const
{
const PlainText *otherPlainText = dynamic_cast<const PlainText *>(&other);
- if (otherPlainText != NULL) {
+ if (otherPlainText != nullptr) {
return otherPlainText->text() == text();
} else
return false;
@@ -385,7 +385,7 @@ bool VerbatimText::containsPattern(const QString &pattern, \
Qt::CaseSensitivity c bool VerbatimText::operator==(const ValueItem &other) const
{
const VerbatimText *otherVerbatimText = dynamic_cast<const VerbatimText \
*>(&other);
- if (otherVerbatimText != NULL) {
+ if (otherVerbatimText != nullptr) {
return otherVerbatimText->text() == text();
} else
return false;
@@ -557,29 +557,29 @@ QString PlainTextValue::text(const ValueItem &valueItem, \
ValueItemType &vit) QString result;
vit = VITOther;
- if (notificationListener == NULL)
+ if (notificationListener == nullptr)
notificationListener = new PlainTextValue();
const PlainText *plainText = dynamic_cast<const PlainText *>(&valueItem);
- if (plainText != NULL) {
+ if (plainText != nullptr) {
result = plainText->text();
} else {
const MacroKey *macroKey = dynamic_cast<const MacroKey *>(&valueItem);
- if (macroKey != NULL) {
+ if (macroKey != nullptr) {
result = macroKey->text(); // TODO Use File to resolve key to full text
} else {
const Person *person = dynamic_cast<const Person *>(&valueItem);
- if (person != NULL) {
+ if (person != nullptr) {
result = Person::transcribePersonName(person, personNameFormatting);
vit = VITPerson;
} else {
const Keyword *keyword = dynamic_cast<const Keyword *>(&valueItem);
- if (keyword != NULL) {
+ if (keyword != nullptr) {
result = keyword->text();
vit = VITKeyword;
} else {
const VerbatimText *verbatimText = dynamic_cast<const \
VerbatimText *>(&valueItem);
- if (verbatimText != NULL) {
+ if (verbatimText != nullptr) {
result = verbatimText->text();
}
}
@@ -638,4 +638,4 @@ void PlainTextValue::readConfiguration()
}
QString PlainTextValue::personNameFormatting;
-PlainTextValue *PlainTextValue::notificationListener = NULL;
+PlainTextValue *PlainTextValue::notificationListener = 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 = NULL;
+EntryLayout *EntryLayout::EntryLayoutPrivate::singleton = nullptr;
EntryLayout::EntryLayout()
: QVector<QSharedPointer<EntryTabLayout> >(), d(new \
EntryLayoutPrivate(this)) @@ -103,7 +103,7 @@ EntryLayout::~EntryLayout()
EntryLayout *EntryLayout::self()
{
- if (EntryLayoutPrivate::singleton == NULL)
+ if (EntryLayoutPrivate::singleton == nullptr)
EntryLayoutPrivate::singleton = new EntryLayout();
return EntryLayoutPrivate::singleton;
}
diff --git a/src/gui/delayedexecutiontimer.h b/src/gui/delayedexecutiontimer.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 = 1000, int minimumDelay = 250, \
QObject *parent = 0); + explicit DelayedExecutionTimer(int maximumDelay = 1000, \
int minimumDelay = 250, QObject *parent = nullptr); explicit \
DelayedExecutionTimer(QObject *parent);
/**
diff --git a/src/gui/element/associatedfilesui.cpp \
b/src/gui/element/associatedfilesui.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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<Entry>()), bibTeXfile(NULL) {
+ : p(parent), entry(QSharedPointer<Entry>()), bibTeXfile(nullptr) {
setupGUI();
}
@@ -256,7 +256,7 @@ void AssociatedFilesUI::updateUIandPreview() {
d->radioKeepFilename->setChecked(true);
} else
d->radioRenameToEntryId->setEnabled(true);
- if (d->bibTeXfile == NULL || !d->bibTeXfile->hasProperty(File::Url)) {
+ if (d->bibTeXfile == 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 != NULL && !d->sourceUrl.isEmpty() && !entryId.isEmpty()) {
- const QUrl newUrl = AssociatedFiles::copyDocument(d->sourceUrl, entryId, \
d->bibTeXfile, renameOperation(), moveCopyOperation(), NULL, \
d->lineEditUserDefinedName->text(), true); + if (d->bibTeXfile != nullptr && \
!d->sourceUrl.isEmpty() && !entryId.isEmpty()) { + const QUrl newUrl = \
AssociatedFiles::copyDocument(d->sourceUrl, entryId, d->bibTeXfile, \
renameOperation(), moveCopyOperation(), nullptr, d->lineEditUserDefinedName->text(), \
true); if (!newUrl.isEmpty())
preview = AssociatedFiles::associateDocumentURL(newUrl, d->bibTeXfile, \
pathType()); }
diff --git a/src/gui/element/elementeditor.cpp b/src/gui/element/elementeditor.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(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))), \
elementChanged(false), elementUnapplied(false) { + : file(nullptr), \
p(parent), previousWidget(nullptr), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))), \
elementChanged(false), elementUnapplied(false) { internalEntry = \
QSharedPointer<Entry>(); internalMacro = QSharedPointer<Macro>();
internalComment = QSharedPointer<Comment>();
@@ -107,7 +107,7 @@ public:
ElementWidget *widget = new EntryConfiguredWidget(etl, tab);
connect(widget, &ElementWidget::modified, p, \
&ElementEditor::childModified); widgets << widget;
- if (previousWidget == NULL)
+ if (previousWidget == nullptr)
previousWidget = widget; ///< memorize the first tab
int index = tab->addTab(widget, widget->icon(), widget->label());
tab->hideTab(index);
@@ -245,7 +245,7 @@ public:
}
bool hasDuplicateId() const {
- return referenceWidget != NULL && referenceWidget->isDuplicateId();
+ return referenceWidget != nullptr && referenceWidget->isDuplicateId();
}
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 != NULL)
+ if (referenceWidget != 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 = qobject_cast<ElementWidget \
*>(tab->currentWidget());
- if (currentElementWidget != NULL)
+ if (currentElementWidget != nullptr)
currentElementWidget->apply(element);
}
}
@@ -384,7 +384,7 @@ public:
/// Interprete future widget as an ElementWidget
ElementWidget *futureWidget = qobject_cast<ElementWidget *>(futureTab);
/// Past and future ElementWidget values are valid?
- if (previousWidget != NULL && futureWidget != NULL) {
+ if (previousWidget != nullptr && futureWidget != nullptr) {
/// Assign to temp wihch internal variable holds current state
QSharedPointer<Element> 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 reference \
widget's state
- if (isToSourceWidget && referenceWidget != NULL) \
referenceWidget->apply(temp); + if (isToSourceWidget && referenceWidget != \
nullptr) referenceWidget->apply(temp);
/// Tell future widget to initialize itself based on internal state
futureWidget->reset(temp);
/// When switchin from source widget to another widget, initialize \
reference widget
- if (isFromSourceWidget && referenceWidget != NULL)
+ if (isFromSourceWidget && referenceWidget != nullptr)
referenceWidget->reset(temp);
}
previousWidget = futureWidget;
@@ -514,7 +514,7 @@ void ElementEditor::setElement(QSharedPointer<const Element> \
element, const File if (!comment.isNull())
clone = QSharedPointer<Comment>(new Comment(*comment.data()));
else
- Q_ASSERT_X(element == NULL, "ElementEditor::ElementEditor(const \
Element *element, QWidget *parent)", "element is not NULL but could not be cast on a \
valid Element sub-class"); + Q_ASSERT_X(element == nullptr, \
"ElementEditor::ElementEditor(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/elementwidgets.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 = 16;
static const char *PropertyIdSuggestion = "PropertyIdSuggestion";
ElementWidget::ElementWidget(QWidget *parent)
- : QWidget(parent), isReadOnly(false), m_file(NULL), m_isModified(false)
+ : QWidget(parent), isReadOnly(false), m_file(nullptr), m_isModified(false)
{
// nothing
};
@@ -165,7 +165,7 @@ void EntryConfiguredWidget::setFile(const File *file)
{
for (QMap<QString, FieldInput *>::Iterator it = bibtexKeyToWidget.begin(); it != \
bibtexKeyToWidget.end(); ++it) { it.value()->setFile(file);
- if (file != NULL) {
+ if (file != nullptr) {
/// list of unique values for same field
QStringList list = 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 = bf->find(sfl.bibtexLabel);
- KBibTeX::TypeFlags typeFlags = fd == NULL ? KBibTeX::tfSource : \
fd->typeFlags;
- KBibTeX::TypeFlag preferredTypeFlag = fd == NULL ? KBibTeX::tfSource : \
fd->preferredTypeFlag; + KBibTeX::TypeFlags typeFlags = fd == nullptr ? \
KBibTeX::tfSource : fd->typeFlags; + KBibTeX::TypeFlag preferredTypeFlag = fd \
== nullptr ? KBibTeX::tfSource : fd->preferredTypeFlag;
labeledFieldInput->fieldInput = new FieldInput(sfl.fieldInputLayout, \
preferredTypeFlag, typeFlags, this); \
labeledFieldInput->fieldInput->setFieldKey(sfl.bibtexLabel);
bibtexKeyToWidget.insert(sfl.bibtexLabel, labeledFieldInput->fieldInput);
@@ -266,7 +266,7 @@ void EntryConfiguredWidget::layoutGUI(bool forceVisible, const \
QString &entryTyp
const QString key = \
bibtexKeyToWidget.key(listOfLabeledFieldInput[i]->fieldInput).toLower(); const \
FieldDescription *fd = bf->find(key);
- bool typeIndependent = fd == NULL ? false : fd->typeIndependent;
+ bool typeIndependent = fd == nullptr ? false : fd->typeIndependent;
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_entryIdManuallySet(false), \
m_element(QSharedPointer<Element>()) + : ElementWidget(parent), \
m_applyElement(nullptr), m_entryIdManuallySet(false), \
m_element(QSharedPointer<Element>()) {
createGUI();
}
@@ -515,7 +515,7 @@ void ReferenceWidget::prepareSuggestionsMenu()
QString suggestion = suggestionBase;
/// Test for duplicate ids, use fallback ids with numeric suffix
- if (m_file != NULL && m_file->containsKey(suggestion)) {
+ if (m_file != nullptr && m_file->containsKey(suggestion)) {
int suffix = 2;
while (m_file->containsKey(suggestion = suggestionBase + QChar('_') + \
QString::number(suffix))) ++suffix;
@@ -540,7 +540,7 @@ void ReferenceWidget::prepareSuggestionsMenu()
void ReferenceWidget::insertSuggestionFromAction()
{
QAction *action = qobject_cast<QAction *>(sender());
- if (action != NULL) {
+ if (action != nullptr) {
const QString suggestion = \
action->property(PropertyIdSuggestion).toString(); entryId->setText(suggestion);
}
@@ -794,7 +794,7 @@ void OtherFieldsWidget::listCurrentChanged(QTreeWidgetItem *item, \
QTreeWidgetIte {
Q_UNUSED(previous)
bool validUrl = false;
- bool somethingSelected = item != NULL;
+ bool somethingSelected = item != nullptr;
buttonDelete->setEnabled(somethingSelected && !isReadOnly);
if (somethingSelected) {
currentUrl = 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() != NULL, \
"OtherFieldsWidget::actionDelete", "otherFieldsList->currentItem() is NULL"); + \
Q_ASSERT_X(otherFieldsList->currentItem() != nullptr, \
"OtherFieldsWidget::actionDelete", "otherFieldsList->currentItem() is NULL"); \
QString key = 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 = otherFieldsList->selectedItems().isEmpty() ? QString() : \
otherFieldsList->selectedItems().first()->text(0);
- const QString curText = otherFieldsList->currentItem() == NULL ? QString() : \
otherFieldsList->currentItem()->text(0); + const QString curText = \
otherFieldsList->currentItem() == nullptr ? QString() : \
otherFieldsList->currentItem()->text(0); otherFieldsList->clear();
for (Entry::ConstIterator it = internalEntry->constBegin(); it != \
internalEntry->constEnd(); ++it) @@ -1099,7 +1099,7 @@ protected:
FileImporterBibTeX importer;
FileExporterBibTeX exporter;
const File *file = importer.fromString(event->mimeData()->text());
- if (file != NULL && file->count() == 1)
+ if (file != nullptr && file->count() == 1)
document()->setPlainText(exporter.toString(file->first(), file));
else
KTextEdit::dropEvent(event);
@@ -1124,7 +1124,7 @@ bool SourceWidget::apply(QSharedPointer<Element> element) const
const QString text = sourceEdit->document()->toPlainText();
FileImporterBibTeX importer;
File *file = importer.fromString(text);
- if (file == NULL) return false;
+ if (file == nullptr) return false;
bool result = false;
if (file->count() == 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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, QObject \
*parent) void PDFItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem \
&option, const QModelIndex &index) const {
QStyle *style = QApplication::style();
- style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0);
+ style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, nullptr);
painter->save();
@@ -149,7 +149,7 @@ void PDFItemDelegate::updateItemWidgets(const QList<QWidget *> \
widgets, const QS if (!index.isValid()) return;
const PDFListModel *model = qobject_cast<const PDFListModel *>(index.model());
- if (model == NULL) {
+ if (model == nullptr) {
qCDebug(LOG_KBIBTEX_GUI) << "WARNING - INVALID MODEL!";
return;
}
@@ -167,7 +167,7 @@ void PDFItemDelegate::updateItemWidgets(const QList<QWidget *> \
widgets, const QS
/// setup label which will show the PDF file's URL
KSqueezedTextLabel *label = qobject_cast<KSqueezedTextLabel \
*>(widgets[posLabelUrl]);
- if (label != NULL) {
+ if (label != nullptr) {
const QString text = index.data(URLRole).toUrl().toDisplayString();
label->setText(text);
label->setToolTip(text);
@@ -177,7 +177,7 @@ void PDFItemDelegate::updateItemWidgets(const QList<QWidget *> \
widgets, const QS
/// setup label which will show the PDF's title or textual beginning
QLabel *previewLabel = qobject_cast<QLabel *>(widgets[posLabelPreview]);
- if (previewLabel != NULL) {
+ if (previewLabel != 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<QWidget *> \
widgets, const QS
/// setup the view button
QPushButton *viewButton = qobject_cast<QPushButton *>(widgets[posViewButton]);
- if (viewButton != NULL) {
+ if (viewButton != nullptr) {
const QSize hint = viewButton->sizeHint();
const int h = 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<QWidget *> widgets, const QS /// setup each of the three radio buttons
for (int i = 0; i < 3; ++i) {
QRadioButton *radioButton = qobject_cast<QRadioButton \
*>(widgets[posRadioNoDownload + i]);
- if (radioButton != NULL) {
+ if (radioButton != nullptr) {
const QSize hint = radioButton->sizeHint();
const int h = hint.isValid() ? qMin(buttonHeight, hint.height()) : \
buttonHeight;
radioButton->move(option.rect.width() - margin - (3 - i) * (buttonWidth \
+ margin), option.rect.height() - margin - h); @@ -232,13 +232,13 @@ void \
PDFItemDelegate::slotViewPDF() QMimeType mimeType = \
FileInfo::mimeTypeForUrl(tempUrl); const QString mimeTypeName = mimeType.name();
/// Ask KDE subsystem to open url in viewer matching mime type
- KRun::runUrl(tempUrl, mimeTypeName, NULL, false, false, \
url.toDisplayString()); + KRun::runUrl(tempUrl, mimeTypeName, nullptr, \
false, false, url.toDisplayString()); } else if (url.isValid()) {
/// Guess mime type for url to open
QMimeType mimeType = FileInfo::mimeTypeForUrl(url);
const QString mimeTypeName = 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, int role) \
const else if (role == Qt::ToolTipRole)
return QStringLiteral("<qt>") + m_resultList[index.row()].textPreview + \
QStringLiteral("</qt>"); ///< 'qt' tags required for word wrap else if (role == \
TempFileNameRole) {
- if (m_resultList[index.row()].tempFilename != NULL)
+ if (m_resultList[index.row()].tempFilename != 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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<FindPDF::ResultItem> &resultList, QObject *parent = \
NULL); + explicit PDFListModel(QList<FindPDF::ResultItem> &resultList, QObject \
*parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
diff --git a/src/gui/field/colorlabelwidget.cpp b/src/gui/field/colorlabelwidget.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL)
+ ColorLabelComboBoxModel(QObject *p = nullptr)
: QAbstractItemModel(p), userColor(Qt::black), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) { \
readConfiguration();
NotificationHub::registerNotificationListener(this, \
NotificationHub::EventConfigurationChanged);
diff --git a/src/gui/field/colorlabelwidget.h b/src/gui/field/colorlabelwidget.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 KComboBox
Q_OBJECT
public:
- explicit ColorLabelWidget(QWidget *parent = NULL);
+ explicit ColorLabelWidget(QWidget *parent = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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), \
fieldLineEdit(NULL), fieldListEdit(NULL), fieldInputType(KBibTeX::SingleLine), \
preferredTypeFlag(KBibTeX::tfSource), bibtexFile(NULL), element(NULL) { + \
: p(parent), colorWidget(nullptr), starRatingWidget(nullptr), fieldLineEdit(nullptr), \
fieldListEdit(nullptr), fieldInputType(KBibTeX::SingleLine), \
preferredTypeFlag(KBibTeX::tfSource), bibtexFile(nullptr), element(nullptr) { /// \
nothing }
~FieldInputPrivate() {
- if (colorWidget != NULL) delete colorWidget;
- else if (starRatingWidget != NULL) delete starRatingWidget;
- else if (fieldLineEdit != NULL) delete fieldLineEdit;
- else if (fieldListEdit != NULL) delete fieldListEdit;
+ if (colorWidget != nullptr) delete colorWidget;
+ else if (starRatingWidget != nullptr) delete starRatingWidget;
+ else if (fieldLineEdit != nullptr) delete fieldLineEdit;
+ else if (fieldListEdit != nullptr) delete fieldListEdit;
}
void createGUI() {
@@ -134,13 +134,13 @@ public:
void clear() {
disableModifiedSignal();
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
fieldLineEdit->setText(QStringLiteral(""));
- else if (fieldListEdit != NULL)
+ else if (fieldListEdit != nullptr)
fieldListEdit->clear();
- else if (colorWidget != NULL)
+ else if (colorWidget != nullptr)
colorWidget->clear();
- else if (starRatingWidget != NULL)
+ else if (starRatingWidget != nullptr)
starRatingWidget->unsetValue();
enableModifiedSignal();
}
@@ -151,13 +151,13 @@ public:
disableModifiedSignal();
bool result = false;
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
result = fieldLineEdit->reset(value);
- else if (fieldListEdit != NULL)
+ else if (fieldListEdit != nullptr)
result = fieldListEdit->reset(value);
- else if (colorWidget != NULL)
+ else if (colorWidget != nullptr)
result = colorWidget->reset(value);
- else if (starRatingWidget != NULL)
+ else if (starRatingWidget != nullptr)
result = starRatingWidget->reset(value);
enableModifiedSignal();
@@ -166,61 +166,61 @@ public:
bool apply(Value &value) const {
bool result = false;
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
result = fieldLineEdit->apply(value);
- else if (fieldListEdit != NULL)
+ else if (fieldListEdit != nullptr)
result = fieldListEdit->apply(value);
- else if (colorWidget != NULL)
+ else if (colorWidget != nullptr)
result = colorWidget->apply(value);
- else if (starRatingWidget != NULL)
+ else if (starRatingWidget != nullptr)
result = starRatingWidget->apply(value);
return result;
}
void setReadOnly(bool isReadOnly) {
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
fieldLineEdit->setReadOnly(isReadOnly);
- else if (fieldListEdit != NULL)
+ else if (fieldListEdit != nullptr)
fieldListEdit->setReadOnly(isReadOnly);
- else if (colorWidget != NULL)
+ else if (colorWidget != nullptr)
colorWidget->setReadOnly(isReadOnly);
- else if (starRatingWidget != NULL)
+ else if (starRatingWidget != nullptr)
starRatingWidget->setReadOnly(isReadOnly);
}
void setFile(const File *file) {
bibtexFile = file;
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
fieldLineEdit->setFile(file);
- if (fieldListEdit != NULL)
+ if (fieldListEdit != nullptr)
fieldListEdit->setFile(file);
}
void setElement(const Element *element) {
this->element = element;
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
fieldLineEdit->setElement(element);
- if (fieldListEdit != NULL)
+ if (fieldListEdit != nullptr)
fieldListEdit->setElement(element);
}
void setFieldKey(const QString &fieldKey) {
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
fieldLineEdit->setFieldKey(fieldKey);
- if (fieldListEdit != NULL)
+ if (fieldListEdit != nullptr)
fieldListEdit->setFieldKey(fieldKey);
}
void setCompletionItems(const QStringList &items) {
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
fieldLineEdit->setCompletionItems(items);
- if (fieldListEdit != NULL)
+ if (fieldListEdit != nullptr)
fieldListEdit->setCompletionItems(items);
}
bool selectCrossRef() {
- Q_ASSERT_X(fieldLineEdit != NULL, "void \
FieldInput::FieldInputPrivate::selectCrossRef()", "fieldLineEdit is \
invalid");
- if (bibtexFile == NULL) return false;
+ Q_ASSERT_X(fieldLineEdit != nullptr, "void \
FieldInput::FieldInputPrivate::selectCrossRef()", "fieldLineEdit is invalid"); + \
if (bibtexFile == nullptr) return false;
/// create a standard input dialog with a list of all keys (ids of entries)
bool ok = false;
@@ -229,7 +229,7 @@ public:
/// remove own id
const Entry *entry = dynamic_cast<const Entry *>(element);
- if (entry != NULL) list.removeOne(entry->id());
+ if (entry != nullptr) list.removeOne(entry->id());
QString crossRef = QInputDialog::getItem(p, i18n("Select Cross Reference"), \
i18n("Select the cross reference to another entry:"), list, 0, false, &ok);
@@ -244,24 +244,24 @@ public:
}
void enableModifiedSignal() {
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
connect(fieldLineEdit, &FieldLineEdit::textChanged, p, \
&FieldInput::modified);
- if (fieldListEdit != NULL)
+ if (fieldListEdit != nullptr)
connect(fieldListEdit, &FieldListEdit::modified, p, \
&FieldInput::modified);
- if (colorWidget != NULL)
+ if (colorWidget != nullptr)
connect(colorWidget, &ColorLabelWidget::modified, p, \
&FieldInput::modified);
- if (starRatingWidget != NULL)
+ if (starRatingWidget != nullptr)
connect(starRatingWidget, &StarRatingFieldInput::modified, p, \
&FieldInput::modified); }
void disableModifiedSignal() {
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
disconnect(fieldLineEdit, &FieldLineEdit::textChanged, p, \
&FieldInput::modified);
- if (fieldListEdit != NULL)
+ if (fieldListEdit != nullptr)
disconnect(fieldListEdit, &FieldListEdit::modified, p, \
&FieldInput::modified);
- if (colorWidget != NULL)
+ if (colorWidget != nullptr)
disconnect(colorWidget, &ColorLabelWidget::modified, p, \
&FieldInput::modified);
- if (starRatingWidget != NULL)
+ if (starRatingWidget != nullptr)
disconnect(starRatingWidget, &StarRatingFieldInput::modified, p, \
&FieldInput::modified); }
};
@@ -322,14 +322,14 @@ void FieldInput::setCompletionItems(const QStringList &items)
QWidget *FieldInput::buddy()
{
- if (d->fieldLineEdit != NULL)
+ if (d->fieldLineEdit != nullptr)
return d->fieldLineEdit->buddy();
// TODO fieldListEdit
- else if (d->colorWidget != NULL)
+ else if (d->colorWidget != nullptr)
return d->colorWidget;
- else if (d->starRatingWidget != NULL)
+ else if (d->starRatingWidget != 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 \
preferredTypeFlag, KBibTeX::TypeFlags typeFlags, QWidget *parent = NULL); + \
FieldInput(KBibTeX::FieldInputType fieldInputType, KBibTeX::TypeFlag \
preferredTypeFlag, KBibTeX::TypeFlags typeFlags, QWidget *parent = 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, FieldLineEdit \
*p)
- : parent(p), preferredTypeFlag(ptf), typeFlags(tf), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))), \
configGroupNameGeneral(QStringLiteral("General")), file(NULL) { + : \
parent(p), preferredTypeFlag(ptf), typeFlags(tf), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))), \
configGroupNameGeneral(QStringLiteral("General")), file(nullptr) { menuTypes = new \
QMenu(parent); menuTypesSignalMapper = new QSignalMapper(parent);
setupMenu();
@@ -190,7 +190,7 @@ public:
File *file = importer.fromString(fakeBibTeXFile);
QSharedPointer<Entry> entry;
- if (file != NULL) {
+ if (file != nullptr) {
if (!file->isEmpty() && !(entry = \
(file->first().dynamicCast<Entry>())).isNull()) value = entry->value(key);
delete file;
@@ -388,7 +388,7 @@ public:
void updateURL(const QString &text) {
QList<QUrl> urls;
- FileInfo::urlsInText(text, FileInfo::TestExistenceYes, file != NULL && \
file->property(File::Url).toUrl().isValid() ? \
QUrl(file->property(File::Url).toUrl()).path() : QString(), urls); + \
FileInfo::urlsInText(text, FileInfo::TestExistenceYes, file != nullptr && \
file->property(File::Url).toUrl().isValid() ? \
QUrl(file->property(File::Url).toUrl()).path() : QString(), urls); if \
(!urls.isEmpty() && urls.first().isValid()) urlToOpen = urls.first();
else
@@ -484,11 +484,11 @@ void FieldLineEdit::dropEvent(QDropEvent *event)
const QString clipboardText = event->mimeData()->text();
if (clipboardText.isEmpty()) return;
- const File *file = NULL;
+ const File *file = nullptr;
if (!d->fieldKey.isEmpty() && clipboardText.startsWith(QStringLiteral("@"))) {
FileImporterBibTeX importer;
file = importer.fromString(clipboardText);
- const QSharedPointer<Entry> entry = (file != NULL && file->count() == 1) ? \
file->first().dynamicCast<Entry>() : QSharedPointer<Entry>(); + const \
QSharedPointer<Entry> entry = (file != nullptr && file->count() == 1) ? \
file->first().dynamicCast<Entry>() : QSharedPointer<Entry>(); if (!entry.isNull() && \
d->fieldKey == Entry::ftCrossRef) {
/// handle drop on crossref line differently (use dropped entry's id)
Value v;
@@ -504,7 +504,7 @@ void FieldLineEdit::dropEvent(QDropEvent *event)
}
}
- if (file == NULL || file->count() == 0) {
+ if (file == nullptr || file->count() == 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 MenuLineEdit
Q_OBJECT
public:
- FieldLineEdit(KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags typeFlags, \
bool isMultiLine = false, QWidget *parent = NULL); + \
FieldLineEdit(KBibTeX::TypeFlag preferredTypeFlag, KBibTeX::TypeFlags typeFlags, bool \
isMultiLine = false, QWidget *parent = 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, \
FieldListEdit *parent)
- : p(parent), innerSpacing(4), preferredTypeFlag(ptf), typeFlags(tf), \
file(NULL), m_isReadOnly(false) { + : p(parent), innerSpacing(4), \
preferredTypeFlag(ptf), typeFlags(tf), file(nullptr), m_isReadOnly(false) { smRemove \
= new QSignalMapper(parent); smGoUp = new QSignalMapper(parent);
smGoDown = new QSignalMapper(parent);
@@ -324,13 +324,13 @@ void FieldListEdit::dropEvent(QDropEvent *event)
const QString clipboardText = event->mimeData()->text();
if (clipboardText.isEmpty()) return;
- const File *file = NULL;
+ const File *file = nullptr;
if (!d->fieldKey.isEmpty() && clipboardText.startsWith(QStringLiteral("@"))) {
FileImporterBibTeX importer;
file = importer.fromString(clipboardText);
- const QSharedPointer<Entry> entry = (file != NULL && file->count() == 1) ? \
file->first().dynamicCast<Entry>() : QSharedPointer<Entry>(); + const \
QSharedPointer<Entry> entry = (file != nullptr && file->count() == 1) ? \
file->first().dynamicCast<Entry>() : QSharedPointer<Entry>();
- if (file != NULL && !entry.isNull() && d->fieldKey == \
QStringLiteral("^external")) { + if (file != nullptr && !entry.isNull() && \
d->fieldKey == QStringLiteral("^external")) { /// handle "external" list differently
const QList<QUrl> urlList = 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 == NULL || file->count() == 0) {
+ if (file == nullptr || file->count() == 0) {
/// fall-back case: single field line edit with text
d->removeAllFieldLineEdits();
FieldLineEdit *fle = addFieldLineEdit();
@@ -361,7 +361,7 @@ void FieldListEdit::lineAdd(Value *value)
{
FieldLineEdit *le = addFieldLineEdit();
le->setCompletionItems(d->completionItems);
- if (value != NULL)
+ if (value != nullptr)
le->reset(*value);
}
@@ -491,7 +491,7 @@ UrlListEdit::~UrlListEdit()
void UrlListEdit::slotAddReference()
{
- QUrl bibtexUrl(d->file != NULL ? d->file->property(File::Url, \
QVariant()).toUrl() : QUrl()); + QUrl bibtexUrl(d->file != nullptr ? \
d->file->property(File::Url, QVariant()).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 = dynamic_cast<const Entry *>(m_element);
- const QString entryId = entry != NULL ? entry->id() : QString();
+ const QString entryId = entry != nullptr ? entry->id() : QString();
const QString visibleFilename = AssociatedFilesUI::associateUrl(url, entryId, \
d->file, this); if (!visibleFilename.isEmpty()) {
Value *value = new Value();
@@ -533,7 +533,7 @@ void UrlListEdit::slotSaveLocally(QWidget *widget)
/// Get filename from url (without any path/directory part)
QString filename = url.fileName();
/// Build QFileInfo from current BibTeX file if available
- QFileInfo bibFileinfo = d->file != NULL ? \
QFileInfo(d->file->property(File::Url).toUrl().path()) : QFileInfo(); + \
QFileInfo bibFileinfo = d->file != nullptr ? \
QFileInfo(d->file->property(File::Url).toUrl().path()) : QFileInfo(); /// Build \
proposal to a local filename for remote file
filename = bibFileinfo.isFile() ? bibFileinfo.absolutePath() + \
QDir::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 = qobject_cast<QPushButton *>(widget);
- if (buttonSaveLocally == NULL) return; ///< should never happen!
+ if (buttonSaveLocally == nullptr) return; ///< should never happen!
/// Assume a FieldLineEdit was the sender of this signal
FieldLineEdit *fieldLineEdit = qobject_cast<FieldLineEdit \
*>(m_signalMapperFieldLineEditTextChanged->mapping(widget));
- if (fieldLineEdit == NULL) return; ///< should never happen!
+ if (fieldLineEdit == 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 == NULL)
+ if (file == nullptr)
m_keywordsFromFile.clear();
else
m_keywordsFromFile = file->uniqueEntryValuesSet(Entry::ftKeywords);
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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL); + FieldListEdit(KBibTeX::TypeFlag preferredTypeFlag, \
KBibTeX::TypeFlags typeFlags, QWidget *parent = 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 = NULL); + PersonListEdit(KBibTeX::TypeFlag \
preferredTypeFlag, KBibTeX::TypeFlags typeFlags, QWidget *parent = 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 = NULL);
+ explicit UrlListEdit(QWidget *parent = nullptr);
~UrlListEdit();
virtual void setReadOnly(bool isReadOnly);
@@ -157,7 +157,7 @@ class KeywordListEdit : public FieldListEdit
public:
static const QString keyGlobalKeywordList;
- explicit KeywordListEdit(QWidget *parent = NULL);
+ explicit KeywordListEdit(QWidget *parent = 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 = (struct HeaderProperty *)calloc(1, sizeof(struct \
HeaderProperty)); headerProperty->columnCount = BibTeXFields::self()->count();
@@ -186,7 +186,7 @@ public:
headerProperty->sumWidths += headerProperty->columns[col].width;
++col;
}
- if (headerProperty->sumWidths <= 0){
+ if (headerProperty->sumWidths <= 0) {
qCWarning(LOG_KBIBTEX_GUI) << "Sum of column widths over visible columns \
is zero, resetting configuration"; resetHeaderProperties();
}
@@ -318,14 +318,14 @@ BasicFileView::~BasicFileView()
void BasicFileView::setModel(QAbstractItemModel *model)
{
- d->sortFilterProxyModel = NULL;
+ d->sortFilterProxyModel = nullptr;
d->fileModel = dynamic_cast<FileModel *>(model);
- if (d->fileModel == NULL) {
+ if (d->fileModel == nullptr) {
d->sortFilterProxyModel = qobject_cast<QSortFilterProxyModel *>(model);
- Q_ASSERT_X(d->sortFilterProxyModel != NULL, \
"BasicFileView::setModel(QAbstractItemModel *model)", "d->sortFilterProxyModel is \
NULL"); + Q_ASSERT_X(d->sortFilterProxyModel != nullptr, \
"BasicFileView::setModel(QAbstractItemModel *model)", "d->sortFilterProxyModel is \
NULL");
d->fileModel = dynamic_cast<FileModel \
*>(d->sortFilterProxyModel->sourceModel()); }
- if (d->fileModel == NULL)
+ if (d->fileModel == 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()->sortIndicatorOrder());
- Q_ASSERT_X(d->fileModel != NULL, "BasicFileView::setModel(QAbstractItemModel \
*model)", "d->fileModel is NULL"); + Q_ASSERT_X(d->fileModel != nullptr, \
"BasicFileView::setModel(QAbstractItemModel *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 = qobject_cast<SortFilterFileModel *>(model());
- if (sortedModel != NULL) {
+ if (sortedModel != nullptr) {
sortedModel->sort(t, s);
/// Store sorting column and order in configuration data struct
d->headerProperty->sortedColumn = header()->sortIndicatorSection();
@@ -405,7 +405,7 @@ void BasicFileView::sort(int t, Qt::SortOrder s)
void BasicFileView::noSorting()
{
SortFilterFileModel *sortedModel = qobject_cast<SortFilterFileModel *>(model());
- if (sortedModel != NULL) {
+ if (sortedModel != 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = 0);
+ explicit BasicFileView(const QString &name, QWidget *parent = nullptr);
~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 = importer.fromString(text);
- if (file != NULL) {
+ if (file != nullptr) {
if (!file->isEmpty()) {
FileModel *fileModel = fileView->fileModel();
QSortFilterProxyModel *sfpModel = fileView->sortFilterProxyModel();
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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 QStyledItemDelegate
Q_OBJECT
public:
- explicit FileDelegate(QWidget *parent = NULL)
+ explicit FileDelegate(QWidget *parent = 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 = \
KConfigGroup(config, configGroupNameWindowSize); @@ -100,7 +100,7 @@ private:
const QString ElementEditorDialog::configGroupNameWindowSize = \
QStringLiteral("ElementEditorDialog");
FileView::FileView(const QString &name, QWidget *parent)
- : BasicFileView(name, parent), m_isReadOnly(false), \
m_current(QSharedPointer<Element>()), m_filterBar(NULL), m_lastEditorPage(NULL), \
m_elementEditorDialog(NULL), m_elementEditor(NULL), m_dbb(NULL) + : \
BasicFileView(name, parent), m_isReadOnly(false), \
m_current(QSharedPointer<Element>()), 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 &selected, \
const QItemSelec
if (index.column() != 0) continue; ///< consider only column-0 indices to \
avoid duplicate elements m_selection.append(elementAt(index));
}
- if (m_current == NULL && !selectedSet.isEmpty())
+ if (m_current == nullptr && !selectedSet.isEmpty())
m_current = elementAt(selectedSet.first());
const QModelIndexList deselectedSet = deselected.indexes();
@@ -238,14 +238,14 @@ bool FileView::isReadOnly() const
ValueListModel *FileView::valueListModel(const QString &field)
{
FileModel *model = fileModel();
- if (model != NULL) {
+ if (model != nullptr) {
ValueListModel *result = new ValueListModel(model->bibliographyFile(), \
field, this);
/// Keep track of external changes through modifications in this \
ValueListModel instance
connect(result, &ValueListModel::dataChanged, this, \
&FileView::externalModification); 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 != NULL)
+ if (m_filterBar != nullptr)
m_filterBar->setFilter(fq);
}
@@ -293,15 +293,15 @@ void FileView::prepareEditorDialog(DialogType dialogType)
}
/// Create both the dialog window and the editing widget only once
- if (m_elementEditorDialog == NULL)
+ if (m_elementEditorDialog == nullptr)
m_elementEditorDialog = new ElementEditorDialog(this);
- if (m_elementEditor == NULL) {
+ if (m_elementEditor == nullptr) {
m_elementEditor = new ElementEditor(false, m_elementEditorDialog);
m_elementEditorDialog->setElementEditor(m_elementEditor);
}
- if (m_dbb != NULL) {
+ if (m_dbb != nullptr) {
delete m_dbb;
- m_dbb = NULL;
+ m_dbb = nullptr;
}
if (dialogType == DialogTypeView) {
diff --git a/src/gui/file/findduplicatesui.cpp b/src/gui/file/findduplicatesui.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, SelectionTypeCheck};
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 = QModelIndex()) const {
- if (currentClique == NULL)
+ if (currentClique == nullptr)
return 0;
if (parent == 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<EntryClique *> &cliqueList, QTreeView *treeView, \
QObject *parent = NULL) + CheckableFileModel(QList<EntryClique *> &cliqueList, \
QTreeView *treeView, QObject *parent = nullptr)
: FileModel(parent), cl(cliqueList), currentClique(0), tv(treeView) {
// nothing
}
@@ -475,13 +475,13 @@ private:
EntryClique *currentClique;
public:
- FilterIdFileModel(QObject *parent = NULL)
- : QSortFilterProxyModel(parent), internalModel(NULL), \
currentClique(NULL) { + FilterIdFileModel(QObject *parent = nullptr)
+ : QSortFilterProxyModel(parent), internalModel(nullptr), \
currentClique(nullptr) { // nothing
}
void setCurrentClique(EntryClique *currentClique) {
- Q_ASSERT_X(internalModel != NULL, \
"FilterIdFileModel::setCurrentClique(EntryClique *currentClique)", "internalModel is \
NULL"); + Q_ASSERT_X(internalModel != nullptr, \
"FilterIdFileModel::setCurrentClique(EntryClique *currentClique)", "internalModel is \
NULL"); internalModel->setCurrentClique(currentClique);
this->currentClique = currentClique;
invalidate();
@@ -490,13 +490,13 @@ public:
void setSourceModel(QAbstractItemModel *model) {
QSortFilterProxyModel::setSourceModel(model);
internalModel = dynamic_cast<CheckableFileModel *>(model);
- Q_ASSERT_X(internalModel != NULL, \
"FilterIdFileModel::setSourceModel(QAbstractItemModel *model)", "internalModel is \
NULL"); + Q_ASSERT_X(internalModel != nullptr, \
"FilterIdFileModel::setSourceModel(QAbstractItemModel *model)", "internalModel is \
NULL"); }
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const {
Q_UNUSED(source_parent)
- if (internalModel != NULL && currentClique != NULL) {
+ if (internalModel != nullptr && currentClique != nullptr) {
QSharedPointer<Entry> entry = \
internalModel->element(source_row).dynamicCast<Entry>(); if (!entry.isNull()) {
QList<QSharedPointer<Entry> > entryList = \
currentClique->entryList();
diff --git a/src/gui/file/sortfilterfilemodel.cpp \
b/src/gui/file/sortfilterfilemodel.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 = QStringLiteral("User \
Interface");
SortFilterFileModel::SortFilterFileModel(QObject *parent)
- : QSortFilterProxyModel(parent), m_internalModel(NULL), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) + : \
QSortFilterProxyModel(parent), m_internalModel(nullptr), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) {
m_filterQuery.combination = AnyTerm;
loadState();
diff --git a/src/gui/file/sortfilterfilemodel.h b/src/gui/file/sortfilterfilemodel.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = 0);
+ explicit SortFilterFileModel(QObject *parent = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -42,7 +42,7 @@ public:
IdentifierRole = Qt::UserRole + 9672
};
- explicit ItalicTextItemModel(QObject *parent = NULL);
+ explicit ItalicTextItemModel(QObject *parent = nullptr);
~ItalicTextItemModel();
/**
diff --git a/src/gui/preferences/kbibtexpreferencesdialog.cpp \
b/src/gui/preferences/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 = qobject_cast<SettingsAbstractWidget \
*>(p->currentPage()->widget());
- if (widget != NULL)
+ if (widget != nullptr)
widget->resetToDefaults();
break;
}
diff --git a/src/gui/preferences/kbibtexpreferencesdialog.h \
b/src/gui/preferences/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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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/preferences/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 QStyledItemDelegate
Q_OBJECT
public:
- ColorLabelSettingsDelegate(QWidget *parent = NULL)
+ ColorLabelSettingsDelegate(QWidget *parent = 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::openConfig(QStringLiteral("kbibtexrc"))), + \
model(nullptr), buttonRemove(nullptr), view(nullptr) { /// nothing
}
void loadState() {
/// Delegate state maintenance to model
- if (model != NULL)
+ if (model != nullptr)
model->loadState();
}
void saveState() {
/// Delegate state maintenance to model
- if (model != NULL)
+ if (model != nullptr)
model->saveState();
}
void resetToDefaults() {
/// Delegate state maintenance to model
- if (model != NULL)
+ if (model != nullptr)
model->resetToDefaults();
}
@@ -365,7 +365,7 @@ SettingsColorLabelWidget::SettingsColorLabelWidget(QWidget \
*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 QString \
&colorString) /// selected item in the tree view
SortFilterFileModel *sfbfm = qobject_cast<SortFilterFileModel \
*>(d->fileView->model());
- Q_ASSERT_X(sfbfm != NULL, "ColorLabelContextMenu::colorActivated(const QString \
&colorString)", "SortFilterFileModel *sfbfm is NULL"); + Q_ASSERT_X(sfbfm != \
nullptr, "ColorLabelContextMenu::colorActivated(const QString &colorString)", \
"SortFilterFileModel *sfbfm is NULL"); FileModel *model = sfbfm->fileSourceModel();
- Q_ASSERT_X(model != NULL, "ColorLabelContextMenu::colorActivated(const QString \
&colorString)", "FileModel *model is NULL"); + Q_ASSERT_X(model != nullptr, \
"ColorLabelContextMenu::colorActivated(const QString &colorString)", "FileModel \
*model is NULL");
/// Apply color change to all selected rows
const QModelIndexList list = d->fileView->selectionModel()->selectedIndexes();
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 != NULL) {
+ if (tokenWidget != nullptr) {
QPushButton *buttonUp = new \
QPushButton(QIcon::fromTheme(QStringLiteral("go-up")), QStringLiteral(""), \
tokenWidget);
QPushButton *buttonDown = new \
QPushButton(QIcon::fromTheme(QStringLiteral("go-down")), QStringLiteral(""), \
tokenWidget);
QPushButton *buttonRemove = new \
QPushButton(QIcon::fromTheme(QStringLiteral("list-remove")), QStringLiteral(""), \
tokenWidget); @@ -589,7 +589,7 @@ public:
const QStringList tokenList = formatString.split(QStringLiteral("|"), \
QString::SkipEmptyParts); for (const QString &token : tokenList) {
- TokenWidget *tokenWidget = NULL;
+ TokenWidget *tokenWidget = nullptr;
if (token[0] == 'a' || token[0] == 'A' || token[0] == 'z') {
struct IdSuggestions::IdSuggestionTokenInfo info = \
p->evalToken(token.mid(1));
diff --git a/src/gui/preferences/settingsidsuggestionseditor.h \
b/src/gui/preferences/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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = 0, Qt::WindowFlags flags = \
0); + explicit IdSuggestionsEditDialog(QWidget *parent = nullptr, Qt::WindowFlags \
flags = 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 *parent = 0, \
Qt::WindowFlags f = 0); + explicit IdSuggestionsEditWidget(const Entry \
*previewEntry, QWidget *parent = nullptr, Qt::WindowFlags f = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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<const Entry> exampleBibTeXEntry;
public:
- IdSuggestionsModel(QObject *parent = NULL)
+ IdSuggestionsModel(QObject *parent = nullptr)
: QAbstractListModel(parent) {
m_idSuggestions = new IdSuggestions();
m_defaultFormatStringRow = -1;
@@ -54,7 +54,7 @@ public:
if (exampleBibTeXEntry.isNull()) {
static FileImporterBibTeX fileImporterBibTeX;
File *file = fileImporterBibTeX.fromString(exampleBibTeXEntryString);
- if (file != NULL) {
+ if (file != nullptr) {
if (!file->isEmpty())
exampleBibTeXEntry = file->first().dynamicCast<const Entry>();
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, const \
QModelIndex &index) {
if (index.column() == 0) {
FieldLineEdit *fieldLineEdit = qobject_cast<FieldLineEdit *>(editor);
- if (fieldLineEdit != NULL)
+ if (fieldLineEdit != nullptr)
fieldLineEdit->reset(index.model()->data(index, \
Qt::EditRole).value<Value>()); }
}
@@ -69,7 +69,7 @@ void ValueListDelegate::setEditorData(QWidget *editor, const \
QModelIndex &index) void ValueListDelegate::setModelData(QWidget *editor, \
QAbstractItemModel *model, const QModelIndex &index) const {
FieldLineEdit *fieldLineEdit = qobject_cast<FieldLineEdit *>(editor);
- if (fieldLineEdit != NULL) {
+ if (fieldLineEdit != nullptr) {
Value v;
fieldLineEdit->apply(v);
if (v.count() == 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 &value, int \
role) {
- Q_ASSERT_X(file != NULL, "ValueListModel::setData", "You cannot set data if \
there is no BibTeX file associated with this value list."); + Q_ASSERT_X(file != \
nullptr, "ValueListModel::setData", "You cannot set 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 == Qt::EditRole && index.column() == 0) {
@@ -345,7 +345,7 @@ void ValueListModel::readConfiguration()
void ValueListModel::updateValues()
{
values.clear();
- if (file == NULL) return;
+ if (file == nullptr) return;
for (const auto &element : const_cast<const File &>(*file)) {
QSharedPointer<const Entry> entry = element.dynamicCast<const Entry>();
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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL)
+ explicit ValueListDelegate(QTreeView *parent = nullptr)
: QStyledItemDelegate(parent), m_fieldName(QString()), m_parent(parent) \
{}
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const \
QModelIndex &index) const;
diff --git a/src/gui/widgets/filesettingswidget.cpp \
b/src/gui/widgets/filesettingswidget.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"), \
i18n("Jr."))), m_file(NULL) + : QWidget(parent), \
dummyPerson(Person(i18n("John"), i18n("Doe"), i18n("Jr."))), m_file(nullptr) {
setupGUI();
}
@@ -46,7 +46,7 @@ void FileSettingsWidget::resetToLoadedProperties()
void FileSettingsWidget::loadProperties(File *file)
{
m_file = file;
- if (m_file == NULL) return; /// Nothing to do
+ if (m_file == 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 = file;
- if (m_file == NULL) return;
+ if (m_file == nullptr) return;
file->setProperty(File::Encoding, m_comboBoxEncodings->currentText());
QString stringDelimiter = m_comboBoxStringDelimiters->currentText();
@@ -116,7 +116,7 @@ void FileSettingsWidget::saveProperties(File *file)
void FileSettingsWidget::resetToDefaults()
{
- if (m_file != NULL) {
+ if (m_file != nullptr) {
m_file->setPropertiesToDefault();
loadProperties(m_file);
}
diff --git a/src/gui/widgets/hidingtabwidget.cpp \
b/src/gui/widgets/hidingtabwidget.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 >= count()) return NULL;
+ if (index < 0 || index >= count()) return nullptr;
HiddenTabInfo hti;
hti.widget = widget(index);
- hti.leftNeighborWidget = index > 0 ? widget(index - 1) : NULL;
- hti.rightNeighborWidget = index < count() - 1 ? widget(index + 1) : NULL;
+ hti.leftNeighborWidget = index > 0 ? widget(index - 1) : nullptr;
+ hti.rightNeighborWidget = index < count() - 1 ? widget(index + 1) : nullptr;
hti.label = tabText(index);
hti.icon = tabIcon(index);
hti.enabled = isTabEnabled(index);
diff --git a/src/gui/widgets/hidingtabwidget.h b/src/gui/widgets/hidingtabwidget.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL);
+ explicit HidingTabWidget(QWidget *parent = 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/menulineedit.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = \
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 = hLayout->count() - 1; i >= 0; --i) {
QWidget *w = hLayout->itemAt(i)->widget();
- if (w != NULL && w != m_singleLineEditText && w != \
m_multiLineEditText) { + if (w != nullptr && w != m_singleLineEditText \
&& w != m_multiLineEditText) {
/// for all widgets except the main editing widget: change tab \
focus policy
w->setFocusPolicy(limitKeyboardTabStops ? Qt::ClickFocus : \
Qt::StrongFocus); }
@@ -135,7 +135,7 @@ public:
}
void fixTabOrder() {
- QWidget *cur = NULL;
+ QWidget *cur = nullptr;
if (hLayout->count() > 0)
p->setTabOrder(p, (cur = hLayout->itemAt(0)->widget()));
for (int i = 1; i < hLayout->count(); ++i) {
@@ -152,7 +152,7 @@ public:
/// check each widget inside MenuLineEdit
for (int i = hLayout->count() - 1; i >= 0; --i) {
QWidget *w = hLayout->itemAt(i)->widget();
- if (w != NULL && w != m_singleLineEditText && w != m_multiLineEditText) \
{ + if (w != nullptr && w != m_singleLineEditText && w != \
m_multiLineEditText) {
/// for all widgets except the main editing widget: change tab focus \
policy QSizePolicy sp = w->sizePolicy();
w->setSizePolicy(sp.horizontalPolicy(), \
QSizePolicy::MinimumExpanding); @@ -164,7 +164,7 @@ public:
this->makeInnerWidgetsTransparent = makeInnerWidgetsTransparent;
for (int i = hLayout->count() - 1; i >= 0; --i) {
QWidget *w = hLayout->itemAt(i)->widget();
- if (w != NULL)
+ if (w != nullptr)
w->setStyleSheet(makeInnerWidgetsTransparent ? transparentStyleSheet \
: normalStyleSheet); }
}
@@ -193,7 +193,7 @@ const QString MenuLineEdit::MenuLineEditPrivate::normalStyleSheet \
= QStringLiter MenuLineEdit::MenuLineEdit(bool isMultiLine, QWidget *parent)
: QFrame(parent), d(new MenuLineEditPrivate(isMultiLine, this))
{
- if (d->m_singleLineEditText != NULL) {
+ if (d->m_singleLineEditText != nullptr) {
/// Only for single-line variants stretch buttons vertically
QTimer::singleShot(250, this, &MenuLineEdit::slotVerticallyStretchButtons);
}
@@ -216,19 +216,19 @@ void MenuLineEdit::setReadOnly(bool readOnly)
QString MenuLineEdit::text() const
{
- if (d->m_singleLineEditText != NULL)
+ if (d->m_singleLineEditText != nullptr)
return d->m_singleLineEditText->text();
- if (d->m_multiLineEditText != NULL)
+ if (d->m_multiLineEditText != nullptr)
return d->m_multiLineEditText->document()->toPlainText();
return QStringLiteral("");
}
void MenuLineEdit::setText(const QString &text)
{
- if (d->m_singleLineEditText != NULL) {
+ if (d->m_singleLineEditText != nullptr) {
d->m_singleLineEditText->setText(text);
d->m_singleLineEditText->setCursorPosition(0);
- } else if (d->m_multiLineEditText != NULL) {
+ } else if (d->m_multiLineEditText != nullptr) {
d->m_multiLineEditText->document()->setPlainText(text);
QTextCursor tc = 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 != NULL)
+ if (d->m_singleLineEditText != nullptr)
d->m_singleLineEditText->setFont(font);
- if (d->m_multiLineEditText != NULL)
+ if (d->m_multiLineEditText != nullptr)
d->m_multiLineEditText->document()->setDefaultFont(font);
}
@@ -256,19 +256,19 @@ void MenuLineEdit::setButtonToolTip(const QString &text)
void MenuLineEdit::setChildAcceptDrops(bool acceptDrops)
{
- if (d->m_singleLineEditText != NULL)
+ if (d->m_singleLineEditText != nullptr)
d->m_singleLineEditText->setAcceptDrops(acceptDrops);
- if (d->m_multiLineEditText != NULL)
+ if (d->m_multiLineEditText != nullptr)
d->m_multiLineEditText->setAcceptDrops(acceptDrops);
}
QWidget *MenuLineEdit::buddy()
{
- if (d->m_singleLineEditText != NULL)
+ if (d->m_singleLineEditText != nullptr)
return d->m_singleLineEditText;
- if (d->m_multiLineEditText != NULL)
+ if (d->m_multiLineEditText != nullptr)
return d->m_multiLineEditText;
- return NULL;
+ return nullptr;
}
void MenuLineEdit::prependWidget(QWidget *widget)
@@ -288,30 +288,30 @@ void MenuLineEdit::setInnerWidgetsTransparency(bool \
makeInnerWidgetsTransparent)
bool MenuLineEdit::isModified() const
{
- if (d->m_singleLineEditText != NULL)
+ if (d->m_singleLineEditText != nullptr)
return d->m_singleLineEditText->isModified();
- if (d->m_multiLineEditText != NULL)
+ if (d->m_multiLineEditText != nullptr)
return d->m_multiLineEditText->document()->isModified();
return false;
}
void MenuLineEdit::setCompletionItems(const QStringList &items)
{
- if (d->m_singleLineEditText != NULL)
+ if (d->m_singleLineEditText != nullptr)
d->m_singleLineEditText->completionObject()->setItems(items);
}
void MenuLineEdit::focusInEvent(QFocusEvent *)
{
- if (d->m_singleLineEditText != NULL)
+ if (d->m_singleLineEditText != nullptr)
d->m_singleLineEditText->setFocus();
- else if (d->m_multiLineEditText != NULL)
+ else if (d->m_multiLineEditText != nullptr)
d->m_multiLineEditText->setFocus();
}
void MenuLineEdit::slotTextChanged()
{
- Q_ASSERT_X(d->m_multiLineEditText != NULL, "MenuLineEdit::slotTextChanged", \
"d->m_multiLineEditText is NULL"); + Q_ASSERT_X(d->m_multiLineEditText != nullptr, \
"MenuLineEdit::slotTextChanged", "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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* *
* 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 = NULL);
+ explicit StarRating(int maxNumberOfStars, QWidget *parent = nullptr);
/**
* Get the current rating in percent (i.e >=0.0 and <=100.0).
@@ -125,7 +125,7 @@ class KBIBTEXGUI_EXPORT StarRatingFieldInput : public StarRating
Q_OBJECT
public:
- explicit StarRatingFieldInput(int maxNumberOfStars, QWidget *parent = NULL)
+ explicit StarRatingFieldInput(int maxNumberOfStars, QWidget *parent = 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 = icu::Transliterator::createInstance("Any-Latin;Latin-ASCII", \
UTRANS_FORWARD, uec);
/// Initialize lookup table with NULL pointers
- for (int i = 0; i < lookupTableNumModifiers; ++i) lookupTable[i] = NULL;
+ for (int i = 0; i < lookupTableNumModifiers; ++i) lookupTable[i] = nullptr;
int lookupTableCount = 0;
/// Go through all table rows of encoderLaTeXEscapedCharacters
@@ -565,10 +565,10 @@ EncoderLaTeX::~EncoderLaTeX()
{
/// Clean-up memory
for (int i = lookupTableNumModifiers - 1; i >= 0; --i)
- if (lookupTable[i] != NULL)
+ if (lookupTable[i] != nullptr)
delete lookupTable[i];
- if (m_trans != NULL)
+ if (m_trans != nullptr)
delete m_trans;
}
@@ -1121,7 +1121,7 @@ bool EncoderLaTeX::containsOnlyAscii(const QString &ntext)
int EncoderLaTeX::modifierInLookupTable(const char latinModifier) const
{
- for (int m = 0; m < lookupTableNumModifiers && lookupTable[m] != NULL; ++m)
+ for (int m = 0; m < lookupTableNumModifiers && lookupTable[m] != nullptr; ++m)
if (lookupTable[m]->modifier == 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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<const Element> element, const File \
*bibtexfile, QStringList *errorLog = NULL);
- QString toString(const File *bibtexfile, QStringList *errorLog = NULL);
+ QString toString(const QSharedPointer<const Element> element, const File \
*bibtexfile, QStringList *errorLog = nullptr); + QString toString(const File \
*bibtexfile, QStringList *errorLog = nullptr);
- virtual bool save(QIODevice *iodevice, const File *bibtexfile, QStringList \
*errorLog = NULL) = 0;
- virtual bool save(QIODevice *iodevice, const QSharedPointer<const Element> \
element, const File *bibtexfile, QStringList *errorLog = NULL) = 0; + virtual bool \
save(QIODevice *iodevice, const File *bibtexfile, QStringList *errorLog = nullptr) = \
0; + virtual bool save(QIODevice *iodevice, const QSharedPointer<const Element> \
element, const File *bibtexfile, QStringList *errorLog = nullptr) = 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 = NULL;
+FileExporterBibTeX *FileExporterBibTeX::staticFileExporterBibTeX = nullptr;
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")), \
configGroupNameGeneral(QStringLiteral("General")) { + : p(parent), \
keywordCasing(KBibTeX::cLowerCase), quoteComment(Preferences::qcNone), \
protectCasing(Qt::PartiallyChecked), cancelFlag(false), destinationCodec(nullptr), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))), \
configGroupName(QStringLiteral("FileExporterBibTeX")), \
configGroupNameGeneral(QStringLiteral("General")) { // nothing
}
@@ -91,7 +91,7 @@ public:
}
void loadStateFromFile(const File *bibtexfile) {
- if (bibtexfile == NULL) return;
+ if (bibtexfile == nullptr) return;
if (bibtexfile->hasProperty(File::Encoding))
encoding = bibtexfile->property(File::Encoding).toString();
@@ -497,7 +497,7 @@ void FileExporterBibTeX::cancel()
QString FileExporterBibTeX::valueToBibTeX(const Value &value, const QString &key, \
UseLaTeXEncoding useLaTeXEncoding) {
- if (staticFileExporterBibTeX == NULL) {
+ if (staticFileExporterBibTeX == nullptr) {
staticFileExporterBibTeX = 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 *errorLog = \
NULL);
- bool save(QIODevice *iodevice, const QSharedPointer<const Element> element, \
const File *bibtexfile, QStringList *errorLog = NULL); + bool save(QIODevice \
*iodevice, const File *bibtexfile, QStringList *errorLog = nullptr); + bool \
save(QIODevice *iodevice, const QSharedPointer<const Element> element, const File \
*bibtexfile, QStringList *errorLog = nullptr);
static QString valueToBibTeX(const Value &value, const QString &fieldType = \
QString(), UseLaTeXEncoding useLaTeXEncoding = leLaTeX);
diff --git a/src/io/fileexporterbibtex2html.h b/src/io/fileexporterbibtex2html.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 *errorLog = \
NULL);
- bool save(QIODevice *iodevice, const QSharedPointer<const Element> element, \
const File *bibtexfile, QStringList *errorLog = NULL); + bool save(QIODevice \
*iodevice, const File *bibtexfile, QStringList *errorLog = nullptr); + bool \
save(QIODevice *iodevice, const QSharedPointer<const Element> element, const File \
*bibtexfile, QStringList *errorLog = nullptr);
void setLaTeXBibliographyStyle(const QString &bibStyle);
diff --git a/src/io/fileexporterbibtexoutput.h b/src/io/fileexporterbibtexoutput.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 *errorLog = \
NULL);
- bool save(QIODevice *iodevice, const QSharedPointer<const Element> element, \
const File *bibtexfile, QStringList *errorLog = NULL); + bool save(QIODevice \
*iodevice, const File *bibtexfile, QStringList *errorLog = nullptr); + bool \
save(QIODevice *iodevice, const QSharedPointer<const Element> element, const File \
*bibtexfile, QStringList *errorLog = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 *errorLog = \
NULL);
- bool save(QIODevice *iodevice, const QSharedPointer<const Element> element, \
const File *bibtexfile, QStringList *errorLog = NULL); + bool save(QIODevice \
*iodevice, const File *bibtexfile, QStringList *errorLog = nullptr); + bool \
save(QIODevice *iodevice, const QSharedPointer<const Element> element, const File \
*bibtexfile, QStringList *errorLog = 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 File \
*bibtexfile, QStringL if (result)
result = generatePDF(iodevice, errorLog);
- if (errorLog != NULL)
+ if (errorLog != nullptr)
qCDebug(LOG_KBIBTEX_IO) << "errorLog" << \
errorLog->join(QStringLiteral(";"));
iodevice->close();
@@ -195,7 +195,7 @@ void FileExporterPDF::fillEmbeddedFileList(const File \
*bibtexfile)
void FileExporterPDF::fillEmbeddedFileList(const QSharedPointer<const Element> \
element, const File *bibtexfile) {
- if (bibtexfile == NULL || !bibtexfile->hasProperty(File::Url)) {
+ if (bibtexfile == nullptr || !bibtexfile->hasProperty(File::Url)) {
/// If no valid File was provided or File is not saved, do not append 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 *errorLog = \
NULL);
- bool save(QIODevice *iodevice, const QSharedPointer<const Element> element, \
const File *bibtexfile, QStringList *errorLog = NULL); + bool save(QIODevice \
*iodevice, const File *bibtexfile, QStringList *errorLog = nullptr); + bool \
save(QIODevice *iodevice, const QSharedPointer<const Element> element, const File \
*bibtexfile, QStringList *errorLog = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 *errorLog = \
NULL);
- bool save(QIODevice *iodevice, const QSharedPointer<const Element> element, \
const File *bibtexfile, QStringList *errorLog = NULL); + bool save(QIODevice \
*iodevice, const File *bibtexfile, QStringList *errorLog = nullptr); + bool \
save(QIODevice *iodevice, const QSharedPointer<const Element> element, const File \
*bibtexfile, QStringList *errorLog = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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<const Element> element, \
const File *bibtexfile, QStringList *errorLog = NULL);
- bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *errorLog = \
NULL); + bool save(QIODevice *iodevice, const QSharedPointer<const Element> \
element, const File *bibtexfile, QStringList *errorLog = nullptr); + bool \
save(QIODevice *iodevice, const File *bibtexfile, QStringList *errorLog = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 *errorLog = \
NULL);
- bool save(QIODevice *iodevice, const QSharedPointer<const Element> element, \
const File *bibtexfile, QStringList *errorLog = NULL); + bool save(QIODevice \
*iodevice, const File *bibtexfile, QStringList *errorLog = nullptr); + bool \
save(QIODevice *iodevice, const QSharedPointer<const Element> element, const File \
*bibtexfile, QStringList *errorLog = nullptr);
private:
QString m_fileBasename;
diff --git a/src/io/fileexportertoolchain.cpp b/src/io/fileexportertoolchain.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = \
QStringLiteral("bibl const QString FileExporterToolchain::defaultBibliographyStyle = \
QStringLiteral("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 &cmd, const \
QStringList &ar m_process->setProcessEnvironment(processEnvironment);
m_process->setWorkingDirectory(tempDir.path());
- if (m_errorLog != NULL) {
+ if (m_errorLog != nullptr) {
connect(m_process, &QProcess::readyReadStandardOutput, this, \
&FileExporterToolchain::slotReadProcessStandardOutput);
connect(m_process, &QProcess::readyReadStandardError, this, \
&FileExporterToolchain::slotReadProcessErrorOutput); }
- if (errorLog != NULL)
+ if (errorLog != nullptr)
errorLog->append(i18n("Running process '%1' using working directory '%2'", \
(cmd + QLatin1Char(' ') + args.join(QStringLiteral(" "))), \
m_process->workingDirectory())); m_process->start(cmd, args);
m_errorLog = errorLog;
@@ -88,10 +88,10 @@ bool FileExporterToolchain::runProcess(const QString &cmd, const \
QStringList &ar } else
result = false;
- if (!result && errorLog != NULL)
+ if (!result && errorLog != nullptr)
errorLog->append(i18n("Process '%1' failed", (cmd + QLatin1Char(' ') + \
args.join(QStringLiteral(" ")))));
- if (errorLog != NULL) {
+ if (errorLog != nullptr) {
QTextStream tsStdOut(m_process->readAllStandardOutput());
QString line;
while (!(line = tsStdOut.readLine()).isNull())
@@ -104,7 +104,7 @@ bool FileExporterToolchain::runProcess(const QString &cmd, const \
QStringList &ar }
delete(m_process);
- m_process = NULL;
+ m_process = nullptr;
return result;
}
@@ -124,19 +124,19 @@ bool FileExporterToolchain::writeFileToIODevice(const QString \
&filename, QIODevi file.close();
delete[] buffer;
- if (errorLog != NULL)
+ if (errorLog != nullptr)
errorLog->append(i18n("Writing to file '%1' succeeded", filename));
return result;
}
- if (errorLog != NULL)
+ if (errorLog != nullptr)
errorLog->append(i18n("Writing to file '%1' failed", filename));
return false;
}
void FileExporterToolchain::cancel()
{
- if (m_process != NULL) {
+ if (m_process != 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL);
- bool runProcess(const QString &cmd, const QStringList &args, QStringList \
*errorLog = NULL);
- bool writeFileToIODevice(const QString &filename, QIODevice *device, QStringList \
*errorLog = NULL); + bool runProcesses(const QStringList &progs, QStringList \
*errorLog = nullptr); + bool runProcess(const QString &cmd, const QStringList \
&args, QStringList *errorLog = nullptr); + bool writeFileToIODevice(const QString \
&filename, QIODevice *device, QStringList *errorLog = 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 = false;
const Entry *entry = dynamic_cast<const Entry *>(element);
- if (entry != NULL) {
- if (bibtexfile != NULL)
+ if (entry != nullptr) {
+ if (bibtexfile != nullptr)
entry = entry->resolveCrossref(bibtexfile);
result |= writeEntry(stream, entry);
- if (bibtexfile != NULL)
+ if (bibtexfile != nullptr)
delete entry; /// delete artificially created Entry from \
resolveCrossref(..) } else {
const Macro *macro = dynamic_cast<const Macro *>(element);
- if (macro != NULL)
+ if (macro != nullptr)
result |= writeMacro(stream, macro);
else {
const Comment *comment = dynamic_cast<const Comment *>(element);
- if (comment != NULL)
+ if (comment != nullptr)
result |= 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 *errorLog = \
NULL);
- bool save(QIODevice *iodevice, const QSharedPointer<const Element> element, \
const File *bibtexfile, QStringList *errorLog = NULL); + bool save(QIODevice \
*iodevice, const File *bibtexfile, QStringList *errorLog = nullptr); + bool \
save(QIODevice *iodevice, const QSharedPointer<const Element> element, const File \
*bibtexfile, QStringList *errorLog = nullptr);
static QString valueToXML(const Value &value, const QString &fieldType = \
QString());
@@ -49,7 +49,7 @@ public slots:
private:
bool m_cancelFlag;
- bool write(QTextStream &stream, const Element *element, const File *bibtexfile = \
NULL); + bool write(QTextStream &stream, const Element *element, const File \
*bibtexfile = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = QString());
~FileExporterXSLT();
- bool save(QIODevice *iodevice, const File *bibtexfile, QStringList *errorLog = \
NULL);
- bool save(QIODevice *iodevice, const QSharedPointer<const Element> element, \
const File *bibtexfile, QStringList *errorLog = NULL); + bool save(QIODevice \
*iodevice, const File *bibtexfile, QStringList *errorLog = nullptr); + bool \
save(QIODevice *iodevice, const QSharedPointer<const Element> element, const File \
*bibtexfile, QStringList *errorLog = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = load(&buffer);
- if (result == NULL)
+ if (result == 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 = "utf-8";
FileImporterBibTeX::FileImporterBibTeX(bool ignoreComments, KBibTeX::Casing \
keywordCasing)
- : FileImporter(), m_cancelFlag(false), m_textStream(NULL), \
m_ignoreComments(ignoreComments), m_keywordCasing(keywordCasing), m_lineNo(1) + \
: FileImporter(), m_cancelFlag(false), m_textStream(nullptr), \
m_ignoreComments(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 = new File();
@@ -112,7 +112,7 @@ File *FileImporterBibTeX::load(QIODevice *iodevice)
emit progress(m_textStream->pos(), rawText.length());
Element *element = nextElement();
- if (element != NULL) {
+ if (element != nullptr) {
if (!m_ignoreComments || !Comment::isComment(*element))
result->append(QSharedPointer<Element>(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 = NULL;
+ result = nullptr;
}
delete m_textStream;
- if (result != NULL) {
+ if (result != nullptr) {
/// Set the file's preferences for string delimiters
/// deduced from statistics built while parsing the file
result->setProperty(File::StringDelimiter, m_statistics.countQuotationMarks \
> m_statistics.countCurlyBrackets ? QStringLiteral("\"\"") : QStringLiteral("{}")); \
> @@ -182,12 +182,12 @@ Element *FileImporterBibTeX::nextElement()
return readPreambleElement();
else if (elementType.toLower() == 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 == tUnknown && m_nextChar == QLatin1Char('%')) {
/// do not complain about LaTeX-like comments, just eat them
@@ -202,13 +202,13 @@ Element *FileImporterBibTeX::nextElement()
if (token != tEOF)
qCWarning(LOG_KBIBTEX_IO) << "Don't know how to parse next token of type " \
<< tokenidToString(token) << " in line " << m_lineNo << "(" << m_prevLine << 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(const \
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 != tBracketOpen) {
if (token == 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 = nextToken();
}
@@ -271,7 +271,7 @@ Macro *FileImporterBibTeX::readMacroElement()
if (nextToken() != tAssign) {
qCCritical(LOG_KBIBTEX_IO) << "Error in parsing macro '" << key << "'' (near \
line " << m_lineNo << ":" << m_prevLine << endl << m_currentLine << "): Assign symbol \
(=) expected";
- return NULL;
+ return nullptr;
}
Macro *macro = new Macro(key);
@@ -295,7 +295,7 @@ Preamble *FileImporterBibTeX::readPreambleElement()
while (token != tBracketOpen) {
if (token == tEOF) {
qCWarning(LOG_KBIBTEX_IO) << "Error in parsing unknown preamble' (near \
line " << m_lineNo << ":" << m_prevLine << endl << m_currentLine << "): Opening curly \
brace ({) expected";
- return NULL;
+ return nullptr;
}
token = nextToken();
}
@@ -327,7 +327,7 @@ Entry *FileImporterBibTeX::readEntryElement(const QString \
&typeString) while (token != tBracketOpen) {
if (token == 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 = nextToken();
}
@@ -370,7 +370,7 @@ Entry *FileImporterBibTeX::readEntryElement(const QString \
&typeString) else
qCWarning(LOG_KBIBTEX_IO) << "Error in parsing entry" << id << \
"(near line" << m_lineNo << ":" << m_prevLine << endl << m_currentLine << "): Comma \
symbol (,) expected but got character" << \
QString(QStringLiteral("0x%1")).arg(m_nextChar.unicode(), 4, 16, QLatin1Char('0')) << \
"(token" << tokenidToString(token) << ")"; delete entry;
- return NULL;
+ return nullptr;
}
QString keyName = bf->format(readSimpleString(), m_keywordCasing);
@@ -386,7 +386,7 @@ Entry *FileImporterBibTeX::readEntryElement(const QString \
&typeString) /// Something looks terribly wrong
qCWarning(LOG_KBIBTEX_IO) << "Error in parsing entry" << id << \
"(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 QString \
&typeString) if (token != tAssign) {
qCWarning(LOG_KBIBTEX_IO) << "Error in parsing entry" << id << ", key" \
<< keyName << " (near line " << m_lineNo << ":" << m_prevLine << endl << \
m_currentLine << "): Assign symbol (=) expected after field name" << keyName; delete \
entry;
- return NULL;
+ return nullptr;
}
Value value;
@@ -791,7 +791,7 @@ QList<QSharedPointer<Keyword> > \
FileImporterBibTeX::splitKeywords(const QString char *curSplitChar = splitChars;
static const QRegExp unneccessarySpacing(QStringLiteral("[ \n\r\t]+"));
int index = 0;
- if (usedSplitChar != 0)
+ if (usedSplitChar != nullptr)
*usedSplitChar = '\0';
/// for each char in list ...
@@ -807,7 +807,7 @@ QList<QSharedPointer<Keyword> > \
FileImporterBibTeX::splitKeywords(const QString }
/// Memorize (some) split characters for later use
/// (e.g. when writing file again)
- if (usedSplitChar != 0)
+ if (usedSplitChar != nullptr)
*usedSplitChar = *curSplitChar;
/// no more splits necessary
break;
@@ -893,7 +893,7 @@ QList<QSharedPointer<Person> > \
FileImporterBibTeX::splitNames(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<Person> FileImporterBibTeX::personFromString(const QString &name)
{
- return personFromString(name, NULL);
+ return personFromString(name, nullptr);
}
QSharedPointer<Person> FileImporterBibTeX::personFromString(const QString &name, \
CommaContainment *comma) @@ -952,7 +952,7 @@ QSharedPointer<Person> \
FileImporterBibTeX::personFromString(const QString &name,
QSharedPointer<Person> FileImporterBibTeX::personFromTokenList(const QStringList \
&tokens, CommaContainment *comma) {
- if (comma != NULL) *comma = ccNoComma;
+ if (comma != nullptr) *comma = ccNoComma;
/// Simple case: provided list of tokens is empty, return invalid Person
if (tokens.isEmpty())
@@ -1009,7 +1009,7 @@ QSharedPointer<Person> \
FileImporterBibTeX::personFromTokenList(const QStringList partC.append(token);
}
if (commaCount > 0) {
- if (comma != NULL) *comma = ccContainsComma;
+ if (comma != nullptr) *comma = ccContainsComma;
return QSharedPointer<Person>(new Person(partC.isEmpty() ? \
partB.join(QChar(' ')) : partC.join(QChar(' ')), partA.join(QChar(' ')), \
partC.isEmpty() ? 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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<QSharedPointer<Keyword> > splitKeywords(const QString &text, char \
*usedSplitChar = 0); + static QList<QSharedPointer<Keyword> > splitKeywords(const \
QString &text, char *usedSplitChar = nullptr);
/**
* Split a list of names into single Person objects.
@@ -151,7 +151,7 @@ private:
Token readValue(Value &value, const QString &fieldType);
static QSharedPointer<Person> personFromString(const QString &name, \
CommaContainment *comma);
- static QSharedPointer<Person> personFromTokenList(const QStringList &tokens, \
CommaContainment *comma = NULL); + static QSharedPointer<Person> \
personFromTokenList(const QStringList &tokens, CommaContainment \
*comma = nullptr);
static void parsePersonList(const QString &text, Value &value, CommaContainment \
*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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = false;
- File *result = NULL;
+ File *result = nullptr;
QByteArray buffer = iodevice->readAll();
Poppler::Document *doc = Poppler::Document::loadFromData(buffer);
- if (doc == NULL) {
+ if (doc == 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 = NULL;
+ result = nullptr;
}
} else
qCDebug(LOG_KBIBTEX_IO) << "Create bibliography file from \
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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = readElement(textStream);
if (list.empty())
- return NULL;
+ return nullptr;
QString entryType = Entry::etMisc;
Entry *entry = 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 = false;
@@ -267,7 +267,7 @@ File *FileImporterRIS::load(QIODevice *iodevice)
emit progress(textStream.pos(), iodevice->size());
QCoreApplication::instance()->processEvents();
Element *element = d->nextElement(textStream);
- if (element != NULL)
+ if (element != nullptr)
result->append(QSharedPointer<Element>(element));
QCoreApplication::instance()->processEvents();
}
@@ -275,7 +275,7 @@ File *FileImporterRIS::load(QIODevice *iodevice)
if (d->cancelFlag) {
delete result;
- result = NULL;
+ result = 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, TestExistence \
testExistence, cons QList<QUrl> FileInfo::entryUrls(const Entry *entry, const QUrl \
&bibTeXUrl, TestExistence testExistence) {
QList<QUrl> result;
- if (entry == NULL || entry->isEmpty())
+ if (entry == 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, const QString \
&destinationE QByteArray TextEncoder::encode(const QString &input, const QTextCodec \
*destinationCodec) {
/// Invalid codec? Cannot do anything
- if (destinationCodec == NULL)
+ if (destinationCodec == nullptr)
return QByteArray();
/// Perform Canonical Decomposition followed by Canonical Composition
diff --git a/src/networking/associatedfiles.cpp b/src/networking/associatedfiles.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 &documentUrl, \
const QUrl &b }
QString AssociatedFiles::associateDocumentURL(const QUrl &document, \
QSharedPointer<Entry> &entry, const File *bibTeXFile, PathType pathType, const bool \
dryRun) {
- Q_ASSERT(bibTeXFile != NULL); // FIXME more graceful?
+ Q_ASSERT(bibTeXFile != nullptr); // FIXME more graceful?
const QUrl baseUrl = bibTeXFile->property(File::Url).toUrl();
if (baseUrl.isEmpty() && pathType == ptRelative) {
@@ -117,7 +117,7 @@ QString AssociatedFiles::associateDocumentURL(const QUrl \
&document, QSharedPoint }
QString AssociatedFiles::associateDocumentURL(const QUrl &document, const File \
*bibTeXFile, PathType pathType) {
- Q_ASSERT(bibTeXFile != NULL); // FIXME more graceful?
+ Q_ASSERT(bibTeXFile != nullptr); // FIXME more graceful?
const QUrl baseUrl = bibTeXFile->property(File::Url).toUrl();
if (baseUrl.isEmpty() && pathType == ptRelative) {
@@ -132,7 +132,7 @@ QString AssociatedFiles::associateDocumentURL(const QUrl \
&document, const File * }
QUrl AssociatedFiles::copyDocument(const QUrl &sourceUrl, const QString &entryId, \
const File *bibTeXFile, RenameOperation renameOperation, MoveCopyOperation \
moveCopyOperation, QWidget *widget, const QString &userDefinedFilename, const bool \
dryRun) {
- Q_ASSERT(bibTeXFile != NULL); // FIXME more graceful?
+ Q_ASSERT(bibTeXFile != nullptr); // FIXME more graceful?
if (moveCopyOperation == 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 = NULL;
+ resultItem.tempFilename = nullptr;
}
} else {
/// Failed to create temporary file
qCWarning(LOG_KBIBTEX_NETWORKING) << "Failed to create temporary \
file for templaet" << resultItem.tempFilename->fileTemplate(); delete \
resultItem.tempFilename;
- resultItem.tempFilename = NULL;
+ resultItem.tempFilename = nullptr;
}
resultItem.url = url;
resultItem.textPreview = \
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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 this hit \
(default is NoDownload) } ResultItem;
- explicit FindPDF(QObject *parent = NULL);
+ explicit FindPDF(QObject *parent = nullptr);
~FindPDF();
/**
diff --git a/src/networking/internalnetworkaccessmanager.cpp \
b/src/networking/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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL)
+ HTTPEquivCookieJar(QObject *parent = nullptr)
: QNetworkCookieJar(parent) {
// nothing
}
@@ -68,7 +68,7 @@ public:
QString InternalNetworkAccessManager::userAgentString;
-InternalNetworkAccessManager *InternalNetworkAccessManager::instance = NULL;
+InternalNetworkAccessManager *InternalNetworkAccessManager::instance = nullptr;
InternalNetworkAccessManager::InternalNetworkAccessManager(QObject *parent)
: QNetworkAccessManager(parent)
@@ -79,14 +79,14 @@ InternalNetworkAccessManager::InternalNetworkAccessManager(QObject \
*parent)
void InternalNetworkAccessManager::mergeHtmlHeadCookies(const QString &htmlCode, \
const QUrl &url) {
- Q_ASSERT_X(cookieJar != NULL, "void \
InternalNetworkAccessManager::mergeHtmlHeadCookies(const QString &htmlCode, const \
QUrl &url)", "cookieJar is invalid"); + Q_ASSERT_X(cookieJar != nullptr, "void \
InternalNetworkAccessManager::mergeHtmlHeadCookies(const QString &htmlCode, const \
QUrl &url)", "cookieJar is invalid"); cookieJar->mergeHtmlHeadCookies(htmlCode, \
url); setCookieJar(cookieJar);
}
InternalNetworkAccessManager *InternalNetworkAccessManager::self()
{
- if (instance == NULL) {
+ if (instance == nullptr) {
instance = new InternalNetworkAccessManager(QApplication::instance());
}
@@ -129,7 +129,7 @@ QNetworkReply *InternalNetworkAccessManager::get(QNetworkRequest \
&request, const
QNetworkReply *InternalNetworkAccessManager::get(QNetworkRequest &request, const \
QNetworkReply *oldReply) {
- return get(request, oldReply == NULL ? QUrl() : oldReply->url());
+ return get(request, oldReply == 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 = userAgentList[qrand() % userAgentList.length()];
}
return userAgentString;
@@ -190,7 +190,7 @@ void InternalNetworkAccessManager::networkReplyTimeout()
QTimer *timer = static_cast<QTimer *>(sender());
timer->stop();
QNetworkReply *reply = m_mapTimerToReply[timer];
- if (reply != NULL) {
+ if (reply != nullptr) {
qCWarning(LOG_KBIBTEX_NETWORKING) << "Timeout on reply to " << \
reply->url().toDisplayString(); reply->close();
m_mapTimerToReply.remove(timer);
@@ -199,8 +199,8 @@ void InternalNetworkAccessManager::networkReplyTimeout()
void InternalNetworkAccessManager::networkReplyFinished()
{
QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
- QTimer *timer = m_mapTimerToReply.key(reply, NULL);
- if (timer != NULL) {
+ QTimer *timer = m_mapTimerToReply.key(reply, nullptr);
+ if (timer != nullptr) {
disconnect(timer, &QTimer::timeout, this, \
&InternalNetworkAccessManager::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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 InternalNetworkAccessManager : \
public QNetworkAcc public:
static InternalNetworkAccessManager *self();
QNetworkReply *get(QNetworkRequest &request, const QUrl &oldUrl);
- QNetworkReply *get(QNetworkRequest &request, const QNetworkReply *oldReply = \
NULL); + QNetworkReply *get(QNetworkRequest &request, const QNetworkReply \
*oldReply = nullptr);
void mergeHtmlHeadCookies(const QString &htmlCode, const QUrl &url);
void setNetworkReplyTimeout(QNetworkReply *reply, int timeOutSec = 30);
protected:
- InternalNetworkAccessManager(QObject *parent = NULL);
+ InternalNetworkAccessManager(QObject *parent = nullptr);
class HTTPEquivCookieJar;
HTTPEquivCookieJar *cookieJar;
diff --git a/src/networking/onlinesearch/onlinesearchabstract.cpp \
b/src/networking/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 *listWidgetItem)
QNetworkRequest request(favIconUrl());
QNetworkReply *reply = InternalNetworkAccessManager::self()->get(request);
reply->setObjectName(fileNameStem);
- if (listWidgetItem != NULL)
+ if (listWidgetItem != 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 = QDBusConnection::sessionBus().interface();
- if (interface == NULL || !interface->isServiceRegistered(dbusServiceName)) {
+ if (interface == nullptr || !interface->isServiceRegistered(dbusServiceName)) {
return;
}
@@ -348,9 +348,9 @@ void OnlineSearchAbstract::iconDownloadFinished()
QNetworkRequest request(redirUrl);
QNetworkReply *newReply = \
InternalNetworkAccessManager::self()->get(request); \
newReply->setObjectName(reply->objectName());
- QListWidgetItem *listWidgetItem = \
m_iconReplyToListWidgetItem.value(reply, NULL); + QListWidgetItem \
*listWidgetItem = m_iconReplyToListWidgetItem.value(reply, nullptr); \
m_iconReplyToListWidgetItem.remove(reply);
- if (listWidgetItem != NULL)
+ if (listWidgetItem != nullptr)
m_iconReplyToListWidgetItem.insert(newReply, listWidgetItem);
connect(newReply, &QNetworkReply::finished, this, \
&OnlineSearchAbstract::iconDownloadFinished); return;
@@ -388,8 +388,8 @@ void OnlineSearchAbstract::iconDownloadFinished()
iconFile.write(iconData);
iconFile.close();
- QListWidgetItem *listWidgetItem = \
m_iconReplyToListWidgetItem.value(reply, NULL);
- if (listWidgetItem != NULL)
+ QListWidgetItem *listWidgetItem = \
m_iconReplyToListWidgetItem.value(reply, nullptr); + if (listWidgetItem != \
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/networking/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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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<QString, QString> &query, int numResults) = \
0; virtual QString label() const = 0;
QString name();
- virtual QIcon icon(QListWidgetItem *listWidgetItem = NULL);
+ virtual QIcon icon(QListWidgetItem *listWidgetItem = nullptr);
virtual OnlineSearchQueryFormAbstract *customWidget(QWidget *parent);
virtual QUrl homepage() const = 0;
virtual bool busy() const;
diff --git a/src/networking/onlinesearch/onlinesearchacmportal.cpp \
b/src/networking/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 = importer.fromString(bibTeXcode);
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
if (publishEntry(entry))
diff --git a/src/networking/onlinesearch/onlinesearcharxiv.cpp \
b/src/networking/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.arxiv.org/api/query?")) + \
form(nullptr), arXivQueryBaseUrl(QStringLiteral("http://export.arxiv.org/api/query?"))
{
/// nothing
}
@@ -649,7 +649,7 @@ QString OnlineSearchArXiv::favIconUrl() const
OnlineSearchQueryFormAbstract *OnlineSearchArXiv::customWidget(QWidget *parent)
{
- if (d->form == NULL)
+ if (d->form == nullptr)
d->form = new OnlineSearchArXiv::OnlineSearchQueryFormArXiv(parent);
return d->form;
}
@@ -680,7 +680,7 @@ void OnlineSearchArXiv::downloadDone()
File *bibtexFile = importer.fromString(bibTeXcode);
bool hasEntries = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntries |= publishEntry(entry);
diff --git a/src/networking/onlinesearch/onlinesearchbibsonomy.cpp \
b/src/networking/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 == NULL) {
+ if (form == nullptr) {
qCWarning(LOG_KBIBTEX_NETWORKING) << "Cannot build query url if no form \
is specified"; return QUrl();
}
@@ -217,7 +217,7 @@ QString OnlineSearchBibsonomy::favIconUrl() const
OnlineSearchQueryFormAbstract *OnlineSearchBibsonomy::customWidget(QWidget *parent)
{
- if (d->form == NULL)
+ if (d->form == nullptr)
d->form = new OnlineSearchBibsonomy::OnlineSearchQueryFormBibsonomy(parent);
return d->form;
}
@@ -242,7 +242,7 @@ void OnlineSearchBibsonomy::downloadDone()
const File *bibtexFile = importer.fromString(bibTeXcode);
bool hasEntries = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntries |= publishEntry(entry);
diff --git a/src/networking/onlinesearch/onlinesearchbiorxiv.cpp \
b/src/networking/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 = importer.fromString(bibTeXcode);
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
publishEntry(entry);
diff --git a/src/networking/onlinesearch/onlinesearchdoi.cpp \
b/src/networking/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 == NULL) {
+ if (form == nullptr) {
qCWarning(LOG_KBIBTEX_NETWORKING) << "Cannot build query url if no form \
is specified"; return QUrl();
}
@@ -166,7 +166,7 @@ QString OnlineSearchDOI::label() const
OnlineSearchQueryFormAbstract *OnlineSearchDOI::customWidget(QWidget *parent)
{
- if (d->form == NULL)
+ if (d->form == nullptr)
d->form = new OnlineSearchDOI::OnlineSearchQueryFormDOI(parent);
return d->form;
}
@@ -205,7 +205,7 @@ void OnlineSearchDOI::downloadDone()
File *bibtexFile = importer.fromString(bibTeXcode);
bool hasEntries = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File \
&>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntries |= publishEntry(entry);
diff --git a/src/networking/onlinesearch/onlinesearchgooglescholar.cpp \
b/src/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 = d->importer.fromString(rawText);
bool hasEntry = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
if (!entry.isNull()) {
diff --git a/src/networking/onlinesearch/onlinesearchideasrepec.cpp \
b/src/networking/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 = importer.fromString(bibTeXcode);
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
if (!entry.isNull()) {
diff --git a/src/networking/onlinesearch/onlinesearchieeexplore.cpp \
b/src/networking/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 = importer.fromString(bibTeXcode);
bool hasEntries = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File \
&>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntries |= publishEntry(entry);
diff --git a/src/networking/onlinesearch/onlinesearchingentaconnect.cpp \
b/src/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=bib")), \
form(NULL) { + : p(parent), \
ingentaConnectBaseUrl(QStringLiteral("http://www.ingentaconnect.com/search?format=bib")), \
form(nullptr) { // nothing
}
QUrl buildQueryUrl() {
- if (form == NULL) {
+ if (form == nullptr) {
qCWarning(LOG_KBIBTEX_NETWORKING) << "Cannot build query url if no form \
is specified"; return QUrl();
}
@@ -346,7 +346,7 @@ QString OnlineSearchIngentaConnect::favIconUrl() const
OnlineSearchQueryFormAbstract *OnlineSearchIngentaConnect::customWidget(QWidget \
*parent) {
- if (d->form == NULL)
+ if (d->form == nullptr)
d->form = new \
OnlineSearchIngentaConnect::OnlineSearchQueryFormIngentaConnect(parent); return \
d->form; }
@@ -371,7 +371,7 @@ void OnlineSearchIngentaConnect::downloadDone()
File *bibtexFile = importer.fromString(bibTeXcode);
bool hasEntries = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntries |= publishEntry(entry);
diff --git a/src/networking/onlinesearch/onlinesearchisbndb.cpp \
b/src/networking/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 = importer.fromString(bibTeXcode);
bool hasEntries = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntries |= publishEntry(entry);
diff --git a/src/networking/onlinesearch/onlinesearchjstor.cpp \
b/src/networking/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 = importer.fromString(bibTeXcode);
int numFoundResults = 0;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
if (publishEntry(entry))
diff --git a/src/networking/onlinesearch/onlinesearchmathscinet.cpp \
b/src/networking/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 = importer.fromString(bibtexCode);
bool hasEntry = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : *bibtexFile) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntry |= publishEntry(entry);
diff --git a/src/networking/onlinesearch/onlinesearchmrlookup.cpp \
b/src/networking/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 = importer.fromString(bibtexCode);
bool hasEntry = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
const QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntry |= publishEntry(entry);
diff --git a/src/networking/onlinesearch/onlinesearchpubmed.cpp \
b/src/networking/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 = importer.fromString(bibTeXcode);
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
bool hasEntry = false;
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
diff --git a/src/networking/onlinesearch/onlinesearchsciencedirect.cpp \
b/src/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 = importer.fromString(bibTeXcode);
bool hasEntry = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntry |= publishEntry(entry);
diff --git a/src/networking/onlinesearch/onlinesearchsimplebibtexdownload.cpp \
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 = importer.fromString(bibTeXcode);
bool hasEntries = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const auto &element : const_cast<const File &>(*bibtexFile)) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntries |= 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("7pphfmtb9rtwt3dw3e4hm7av")),
xslt(QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("kbibtex/pam2bibtex.xsl"))),
- form(NULL)
+ form(nullptr)
{
/// nothing
}
QUrl buildQueryUrl() {
- if (form == NULL) return QUrl();
+ if (form == nullptr) return QUrl();
QUrl queryUrl = \
QUrl(QString(QStringLiteral("http://api.springer.com/metadata/pam/?api_key=")).append(springerMetadataKey));
@@ -246,7 +246,7 @@ void OnlineSearchSpringerLink::startSearchFromForm()
InternalNetworkAccessManager::self()->setNetworkReplyTimeout(reply);
connect(reply, &QNetworkReply::finished, this, \
&OnlineSearchSpringerLink::doneFetchingPAM);
- if (d->form != NULL) d->form->saveState();
+ if (d->form != nullptr) d->form->saveState();
}
void OnlineSearchSpringerLink::startSearch(const QMap<QString, QString> &query, int \
numResults) @@ -277,7 +277,7 @@ QString OnlineSearchSpringerLink::favIconUrl() const
OnlineSearchQueryFormAbstract *OnlineSearchSpringerLink::customWidget(QWidget \
*parent) {
- if (d->form == NULL)
+ if (d->form == nullptr)
d->form = new OnlineSearchQueryFormSpringerLink(parent);
return d->form;
}
@@ -303,7 +303,7 @@ void OnlineSearchSpringerLink::doneFetchingPAM()
const File *bibtexFile = importer.fromString(bibTeXcode);
bool hasEntries = false;
- if (bibtexFile != NULL) {
+ if (bibtexFile != nullptr) {
for (const QSharedPointer<Element> &element : *bibtexFile) {
QSharedPointer<Entry> entry = element.dynamicCast<Entry>();
hasEntries |= 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 authorization for \
requests on private data
* @param parent used for Qt-internal operations
*/
- explicit API(RequestScope requestScope, int userOrGroupPrefix, const QString \
&apiKey, QObject *parent = 0); + explicit API(RequestScope requestScope, int \
userOrGroupPrefix, const QString &apiKey, QObject *parent = nullptr);
~API();
diff --git a/src/networking/zotero/collectionmodel.h \
b/src/networking/zotero/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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 \
QAbstractItemModel public:
static const int CollectionIdRole;
- explicit CollectionModel(Zotero::Collection *collection, QObject *parent = \
NULL); + explicit CollectionModel(Zotero::Collection *collection, QObject *parent \
= nullptr);
QVariant data(const QModelIndex &index, int role = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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<Zotero::API> api, QObject *parent = NULL);
+ explicit Groups(QSharedPointer<Zotero::API> api, QObject *parent = nullptr);
~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 = importer.fromString(bibTeXcode);
/// Perform basic sanity checks ...
- if (bibtexFile != NULL && !bibtexFile->isEmpty()) {
+ if (bibtexFile != nullptr && !bibtexFile->isEmpty()) {
for (const QSharedPointer<Element> &element : const_cast<const File \
&>(*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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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<Zotero::API> api, QObject *parent = NULL);
+ explicit Items(QSharedPointer<Zotero::API> api, QObject *parent = nullptr);
~Items();
void retrieveItemsByCollection(const QString &collectionId);
diff --git a/src/networking/zotero/tagmodel.h b/src/networking/zotero/tagmodel.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 QAbstractItemModel
public:
enum Roles { TagRole = Qt::UserRole + 6685, TagCountRole = Qt::UserRole + 6686 \
};
- explicit TagModel(Zotero::Tags *tags, QObject *parent = NULL);
+ explicit TagModel(Zotero::Tags *tags, QObject *parent = nullptr);
QVariant data(const QModelIndex &index, int role = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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<Zotero::API> api, QObject *parent = NULL);
+ explicit Tags(QSharedPointer<Zotero::API> api, QObject *parent = nullptr);
~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), signalMapperNewElement(new \
QSignalMapper(parent)), viewDocumentMenu(new QMenu(i18n("View Document"), \
parent->widget())), signalMapperViewDocument(new QSignalMapper(parent)), \
isSaveAsOperation(false), fileSystemWatcher(p) { + : p(parent), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))), bibTeXFile(nullptr), \
model(nullptr), sortFilterProxyModel(nullptr), signalMapperNewElement(new \
QSignalMapper(parent)), viewDocumentMenu(new QMenu(i18n("View Document"), \
parent->widget())), signalMapperViewDocument(new QSignalMapper(parent)), \
isSaveAsOperation(false), fileSystemWatcher(p) {
connect(signalMapperViewDocument, static_cast<void(QSignalMapper::*)(QObject \
*)>(&QSignalMapper::mapped), p, \
&KBibTeXPart::elementViewDocumentMenu);
connect(&fileSystemWatcher, &QFileSystemWatcher::fileChanged, p, \
&KBibTeXPart::fileExternallyChange);
@@ -333,7 +333,7 @@ public:
model = new FileModel();
model->setBibliographyFile(bibTeXFile);
- if (sortFilterProxyModel != NULL) delete sortFilterProxyModel;
+ if (sortFilterProxyModel != nullptr) delete sortFilterProxyModel;
sortFilterProxyModel = new SortFilterFileModel(p);
sortFilterProxyModel->setSourceModel(model);
partWidget->fileView()->setModel(sortFilterProxyModel);
@@ -346,7 +346,7 @@ public:
qApp->setOverrideCursor(Qt::WaitCursor);
- if (bibTeXFile != NULL) {
+ if (bibTeXFile != nullptr) {
const QUrl oldUrl = bibTeXFile->property(File::Url, QUrl()).toUrl();
if (oldUrl.isValid() && oldUrl.isLocalFile()) {
const QString path = oldUrl.toDisplayString();
@@ -374,7 +374,7 @@ public:
inputfile.close();
delete importer;
- if (bibTeXFile == NULL) {
+ if (bibTeXFile == 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 != NULL) delete sortFilterProxyModel;
+ if (sortFilterProxyModel != nullptr) delete sortFilterProxyModel;
sortFilterProxyModel = new SortFilterFileModel(p);
sortFilterProxyModel->setSourceModel(model);
partWidget->fileView()->setModel(sortFilterProxyModel);
@@ -436,7 +436,7 @@ public:
statJob = KIO::stat(newerBackupUrl, KIO::StatJob::DestinationSide, 0 /** \
not details necessary, just need to know if file exists */, KIO::HideProgressInfo); \
KJobWidgets::setWindow(statJob, p->widget());
if (statJob->exec() && statJob->error() == KIO::Job::NoError) {
- KIO::CopyJob *moveJob = NULL; ///< guaranteed to be initialized in \
either branch of the following code + KIO::CopyJob *moveJob = nullptr; \
///< guaranteed to be initialized 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 = KIO::copy(newerBackupUrl, olderBackupUrl, \
KIO::HideProgressInfo | KIO::Overwrite); }
}
- if (moveJob == NULL) ///< implicit 'else' section, see longer \
comment above + if (moveJob == nullptr) ///< implicit 'else' section, \
see longer comment above
moveJob = KIO::move(newerBackupUrl, olderBackupUrl, \
KIO::HideProgressInfo | KIO::Overwrite); KJobWidgets::setWindow(moveJob, \
p->widget()); copySucceeded = moveJob->exec();
@@ -513,7 +513,7 @@ public:
if (isSaveAsOperation) {
/// only show export dialog at SaveAs or SaveCopyAs operations
- FileExporterToolchain *fet = NULL;
+ FileExporterToolchain *fet = nullptr;
if (FileExporterBibTeX::isFileExporterBibTeX(*exporter)) {
QPointer<QDialog> dlg = new QDialog(p->widget());
@@ -533,7 +533,7 @@ public:
if (dlg->exec() == QDialog::Accepted)
settingsWidget->saveProperties(bibTeXFile);
delete dlg;
- } else if ((fet = qobject_cast<FileExporterToolchain *>(exporter)) != \
NULL) { + } else if ((fet = qobject_cast<FileExporterToolchain \
*>(exporter)) != nullptr) { QPointer<QDialog> dlg = new QDialog(p->widget());
dlg->setWindowTitle(i18n("PDF/PostScript File Settings"));
QBoxLayout *layout = new QVBoxLayout(dlg);
@@ -556,9 +556,9 @@ public:
return exporter;
}
- bool saveFile(QFile &file, FileExporter *exporter, QStringList *errorLog = NULL) \
{ + bool saveFile(QFile &file, FileExporter *exporter, QStringList *errorLog = \
nullptr) {
SortFilterFileModel *model = qobject_cast<SortFilterFileModel \
*>(partWidget->fileView()->model());
- Q_ASSERT_X(model != NULL, "FileExporter \
*KBibTeXPart::KBibTeXPartPrivate:saveFile(...)", "SortFilterFileModel *model from \
editor->model() is invalid"); + Q_ASSERT_X(model != nullptr, "FileExporter \
*KBibTeXPart::KBibTeXPartPrivate:saveFile(...)", "SortFilterFileModel *model from \
editor->model() is invalid");
return exporter->save(&file, model->fileSourceModel()->bibliographyFile(), \
errorLog); }
@@ -664,7 +664,7 @@ public:
const QList<QUrl> urlList = FileInfo::entryUrls(entry.data(), \
partWidget->fileView()->fileModel()->bibliographyFile()->property(File::Url).toUrl(), \
FileInfo::TestExistenceYes); if (!urlList.isEmpty()) {
/// Memorize first action, necessary to set menu title
- QAction *firstAction = NULL;
+ QAction *firstAction = 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 == NULL) firstAction = action;
+ if (firstAction == nullptr) firstAction = action;
}
- if (firstAction != NULL) {
+ if (firstAction != 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("Local \
Files")); }
- firstAction = NULL; /// Now the first remote action is to be \
memorized + firstAction = nullptr; /// Now the first remote action is \
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 == NULL) firstAction = action;
+ if (firstAction == nullptr) firstAction = action;
}
- if (firstAction != NULL) {
+ if (firstAction != 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 && numDocumentsToView > \
0);
/// activate sub-menu only if there are at least two documents to view
- d->elementViewDocumentAction->setMenu(numDocumentsToView > 1 ? \
d->viewDocumentMenu : NULL); + \
d->elementViewDocumentAction->setMenu(numDocumentsToView > 1 ? d->viewDocumentMenu : \
nullptr);
d->elementViewDocumentAction->setToolTip(numDocumentsToView == 1 ? \
(*d->viewDocumentMenu->actions().constBegin())->text() : QStringLiteral(""));
/// update list of references which can be sent to LyX
QStringList references;
- if (d->partWidget->fileView()->selectionModel() != NULL) {
+ if (d->partWidget->fileView()->selectionModel() != nullptr) {
const QModelIndexList mil = \
d->partWidget->fileView()->selectionModel()->selectedRows(); for (const QModelIndex \
&index : mil) { QSharedPointer<Entry> entry = \
d->partWidget->fileView()->fileModel()->element(d->partWidget->fileView()->sortFilterProxyModel()->mapToSource(index).row()).dynamicCast<Entry>();
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(QSharedPointer<Entry> &e /// fetch and inser crossref'ed \
entry QString crossRefStr;
Value crossRefVal = entry->value(Entry::ftCrossRef);
- if (!crossRefVal.isEmpty() && file != NULL) {
+ if (!crossRefVal.isEmpty() && file != nullptr) {
crossRefStr = PlainTextValue::text(crossRefVal);
QSharedPointer<Entry> crossRefDest = file->containsKey(crossRefStr, \
File::etEntry).dynamicCast<Entry>(); if (!crossRefDest.isNull())
@@ -64,7 +64,7 @@ CheckBibTeX::CheckBibTeXResult \
CheckBibTeX::checkBibTeX(QSharedPointer<Entry> &e }
/// include all macro definitions, in case they are referenced
- if (file != NULL)
+ if (file != nullptr)
for (const auto &element : const_cast<const File &>(*file))
if (Macro::isMacro(*element))
dummyFile << element;
diff --git a/src/processing/findduplicates.cpp b/src/processing/findduplicates.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 == NULL ? \
qApp->activeWindow() : w) {
- d = new int*[dsize];
+ : maxDistance(10000), sensitivity(sens), widget(w == nullptr ? \
qApp->activeWindow() : w) { + d = new int *[dsize];
for (int i = 0; i < dsize; ++i)
d[i] = new int[dsize];
}
diff --git a/src/processing/journalabbreviations.cpp \
b/src/processing/journalabbreviations.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL;
+JournalAbbreviations *JournalAbbreviations::instance = nullptr;
JournalAbbreviations::JournalAbbreviations()
: d(new JournalAbbreviations::Private(this))
@@ -106,7 +106,7 @@ JournalAbbreviations::~JournalAbbreviations()
}
JournalAbbreviations *JournalAbbreviations::self() {
- if (instance == NULL)
+ if (instance == nullptr)
instance = 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::openConfig(QStringLiteral("kbibtexrc"))), group(config, \
LyX::configGroupName) { + : /* UNUSED p(parent),*/ action(nullptr), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))), group(config, \
LyX::configGroupName) { this->widget = widget;
}
@@ -104,7 +104,7 @@ LyX::~LyX()
void LyX::setReferences(const QStringList &references)
{
d->references = references;
- d->action->setEnabled(d->widget != NULL && !d->references.isEmpty());
+ d->action->setEnabled(d->widget != nullptr && !d->references.isEmpty());
}
void LyX::sendReferenceToLyX()
diff --git a/src/program/docklets/documentpreview.cpp \
b/src/program/docklets/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<void(KParts::ReadOnlyPart::*)()>(&KParts::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 = locatePart(QStringLiteral("application/pdf"), stackedWidget);
- swpOkular = (okularPart == NULL) ? -1 : \
stackedWidget->addWidget(okularPart->widget());
- if (okularPart == NULL || swpOkular < 0) {
+ swpOkular = (okularPart == nullptr) ? -1 : \
stackedWidget->addWidget(okularPart->widget()); + if (okularPart == nullptr || \
swpOkular < 0) {
qCWarning(LOG_KBIBTEX_PROGRAM) << "No Okular part for PDF or PostScript \
document preview available."; }
#ifdef HAVE_WEBENGINEWIDGETS
@@ -236,7 +236,7 @@ public:
connect(htmlWidget, &QWebView::loadFinished, p, \
&DocumentPreview::loadingFinished); #else // HAVE_WEBKITWIDGETS
htmlPart = locatePart(QStringLiteral("text/html"), stackedWidget);
- if (htmlPart != NULL) {
+ if (htmlPart != nullptr) {
qCDebug(LOG_KBIBTEX_PROGRAM) << "HTML KPart is available, using it \
instead of WebEngine or WebKit (neither available) for HTML/Web preview."; swpHTML = \
stackedWidget->addWidget(htmlPart->widget()); } else {
@@ -289,7 +289,7 @@ public:
p->setCursor(Qt::WaitCursor);
/// reset and clear all controls
- if (swpOkular >= 0 && okularPart != NULL)
+ if (swpOkular >= 0 && okularPart != nullptr)
okularPart->closeUrl();
#ifdef HAVE_WEBENGINEWIDGETS
htmlWidget->stop();
@@ -297,7 +297,7 @@ public:
#ifdef HAVE_WEBKITWIDGETS
htmlWidget->stop();
#else // HAVE_WEBKITWIDGETS
- if (swpHTML >= 0 && htmlPart != NULL)
+ if (swpHTML >= 0 && htmlPart != nullptr)
htmlPart->closeUrl();
#endif // HAVE_WEBKITWIDGETS
#endif // HAVE_WEBENGINEWIDGETS
@@ -427,7 +427,7 @@ public:
const QString actionName = \
actionNode.attributes().namedItem(QStringLiteral("name")).toAttr().nodeValue();
const QString actionShortcut = \
actionNode.attributes().namedItem(QStringLiteral("shortcut")).toAttr().value();
QAction *action = part->actionCollection()->action(actionName);
- if (action != NULL) {
+ if (action != nullptr) {
action->setShortcut(QKeySequence(actionShortcut));
}
}
@@ -445,7 +445,7 @@ public:
menuBar->clear();
toolBar->clear();
- if (okularPart != NULL && part == okularPart && swpOkular >= 0) {
+ if (okularPart != nullptr && part == okularPart && swpOkular >= 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 != NULL && part == htmlPart && swpHTML >= 0) {
+ } else if (htmlPart != nullptr && part == htmlPart && swpHTML >= 0) {
stackedWidget->setCurrentIndex(swpHTML);
stackedWidget->widget(swpHTML)->setEnabled(true);
setupToolMenuBarForPart(htmlPart);
@@ -478,7 +478,7 @@ public:
if (swpHTML >= 0)
stackedWidget->widget(swpHTML)->setEnabled(false);
- if (swpOkular >= 0 && okularPart != NULL) {
+ if (swpOkular >= 0 && okularPart != nullptr) {
stackedWidget->widget(swpOkular)->setEnabled(false);
okularPart->closeUrl();
}
@@ -488,12 +488,12 @@ public:
#ifdef HAVE_WEBKITWIDGETS
htmlWidget->stop();
#else // HAVE_WEBKITWIDGETS
- if (swpHTML >= 0 && htmlPart != NULL)
+ if (swpHTML >= 0 && htmlPart != nullptr)
htmlPart->closeUrl();
#endif // HAVE_WEBKITWIDGETS
#endif // HAVE_WEBENGINEWIDGETS
- if (swpOkular >= 0 && okularPart != NULL && \
okularMimetypes.contains(urlInfo.mimeType)) { + if (swpOkular >= 0 && \
okularPart != nullptr && okularMimetypes.contains(urlInfo.mimeType)) { \
p->setCursor(Qt::BusyCursor); showMessage(i18n("Loading...")); // \
krazy:exclude=qmethods return okularPart->openUrl(urlInfo.url);
@@ -508,13 +508,13 @@ public:
htmlWidget->load(urlInfo.url);
return true;
#else // HAVE_WEBKITWIDGETS
- return (swpHTML >= 0 && htmlPart != NULL) ? \
htmlPart->openUrl(urlInfo.url) : false; + return (swpHTML >= 0 && htmlPart \
!= nullptr) ? htmlPart->openUrl(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::PreferLocalFile)));
- 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 QDockWidget
QDockWidget *pp = static_cast<QDockWidget *>(p->parent());
- return pp != NULL && !pp->isHidden();
+ return pp != 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL, Qt::WindowFlags \
f = 0); + explicit ImageLabel(const QString &text, QWidget *parent = nullptr, \
Qt::WindowFlags f = 0); void setPixmap(const QPixmap &pixmap);
protected:
diff --git a/src/program/docklets/elementform.cpp \
b/src/program/docklets/elementform.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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(false), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) { + : \
p(parent), file(nullptr), mdiWidget(_mdiWidget), gotModified(false), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) { KConfigGroup \
configGroup(config, configGroupName);
layout = 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 QDockWidget
QDockWidget *pp = static_cast<QDockWidget *>(p->parent());
- return pp != NULL && !pp->isHidden();
+ return pp != nullptr && !pp->isHidden();
}
void apply() {
diff --git a/src/program/docklets/filesettings.cpp \
b/src/program/docklets/filesettings.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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* *
* 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 = m_fileView != NULL && m_fileView->fileModel() != NULL ? \
m_fileView->fileModel()->bibliographyFile() : NULL;
- if (file != NULL) {
+ File *file = m_fileView != nullptr && m_fileView->fileModel() != nullptr ? \
m_fileView->fileModel()->bibliographyFile() : nullptr; + if (file != 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 = m_fileView != NULL && m_fileView->fileModel() != NULL ? \
m_fileView->fileModel()->bibliographyFile() : NULL; + File *file = m_fileView != \
nullptr && m_fileView->fileModel() != nullptr ? \
m_fileView->fileModel()->bibliographyFile() : nullptr; loadProperties(file);
- setEnabled(file != NULL);
+ setEnabled(file != nullptr);
}
diff --git a/src/program/docklets/referencepreview.cpp \
b/src/program/docklets/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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* 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(NULL),
+ configKeyName(QStringLiteral("Style")), file(nullptr), fileView(nullptr),
textColor(QApplication::palette().text().color()),
defaultFontSize(QFontDatabase::systemFont(QFontDatabase::GeneralFont).pointSize()),
htmlStart("<html>\n<head>\n<meta http-equiv=\"content-type\" content=\"text/html; \
charset=utf-8\" />\n<style type=\"text/css\">\npre {\n white-space: pre-wrap;\n \
white-space: -moz-pre-wrap;\n white-space: -pre-wrap;\n white-space: -o-pre-wrap;\n \
word-wrap: break-word;\n}\n</style>\n</head>\n<body style=\"color: " + \
textColor.name() + "; font-size: " + QString::number(defaultFontSize) + "pt; \
font-family: '" + QFontDatabase::systemFont(QFontDatabase::GeneralFont).family() + \
"'; background-color: '" + \
QApplication::palette().base().color().name(QColor::HexRgb) + "'\">"), @@ -248,7 \
+248,7 @@ void ReferencePreview::renderHTML()
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- FileExporter *exporter = NULL;
+ FileExporter *exporter = nullptr;
const PreviewStyles previewStyle = \
d->comboBox->itemData(d->comboBox->currentIndex()).value<PreviewStyles>();
@@ -275,7 +275,7 @@ void ReferencePreview::renderHTML()
} else
qCWarning(LOG_KBIBTEX_PROGRAM) << "Don't know how to handle output type " << \
previewStyle.type;
- if (exporter != NULL) {
+ if (exporter != nullptr) {
QBuffer buffer(this);
buffer.open(QBuffer::WriteOnly);
@@ -399,7 +399,7 @@ void ReferencePreview::linkClicked(const QUrl &url)
QString text = url.toDisplayString();
if (text.startsWith(QStringLiteral("kbibtex:filter:"))) {
text = text.mid(15);
- if (d->fileView != NULL) {
+ if (d->fileView != nullptr) {
int p = text.indexOf(QStringLiteral("="));
SortFilterFileModel::FilterQuery fq;
fq.terms << text.mid(p + 1);
diff --git a/src/program/docklets/searchform.cpp \
b/src/program/docklets/searchform.cpp index a49375b4..a3b605dd 100644
--- a/src/program/docklets/searchform.cpp
+++ b/src/program/docklets/searchform.cpp
@@ -106,14 +106,14 @@ public:
QMap<OnlineSearchQueryFormAbstract *, QScrollArea *> formToScrollArea;
SearchFormPrivate(SearchResults *searchResults, SearchForm *parent)
- : p(parent), whichEnginesLabel(NULL), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))),
- configGroupName(QStringLiteral("Search Engines Docklet")), \
sr(searchResults), searchButton(NULL), useEntryButton(NULL), currentEntry(NULL) { + \
: p(parent), whichEnginesLabel(nullptr), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))), + \
configGroupName(QStringLiteral("Search Engines Docklet")), sr(searchResults), \
searchButton(nullptr), useEntryButton(nullptr), currentEntry(nullptr) { createGUI();
}
OnlineSearchQueryFormAbstract *currentQueryForm() {
QScrollArea *area = qobject_cast<QScrollArea \
*>(queryTermsStack->currentWidget());
- return formToScrollArea.key(area, NULL);
+ return formToScrollArea.key(area, nullptr);
}
QScrollArea *wrapInScrollArea(OnlineSearchQueryFormAbstract *form, QWidget \
*parent) { @@ -150,7 +150,7 @@ public:
return container;
}
- OnlineSearchQueryFormAbstract *createGeneralQueryTermsForm(QWidget *parent = \
NULL) { + OnlineSearchQueryFormAbstract *createGeneralQueryTermsForm(QWidget \
*parent = nullptr) { generalQueryTermsForm = 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 = \
engine->customWidget(queryTermsStack);
item->setData(WidgetRole, QVariant::fromValue<OnlineSearchQueryFormAbstract \
*>(widget));
- if (widget != NULL) {
+ if (widget != nullptr) {
connect(widget, &OnlineSearchQueryFormAbstract::returnPressed, \
searchButton, &QPushButton::click);
QScrollArea *scrollArea = wrapInScrollArea(widget, queryTermsStack);
queryTermsStack->addWidget(scrollArea);
@@ -293,10 +293,10 @@ public:
}
void updateGUI() {
- if (whichEnginesLabel == NULL) return;
+ if (whichEnginesLabel == nullptr) return;
QStringList checkedEngines;
- QListWidgetItem *cursor = NULL;
+ QListWidgetItem *cursor = nullptr;
for (QMap<QListWidgetItem *, OnlineSearchAbstract *>::ConstIterator it = \
itemToOnlineSearch.constBegin(); it != itemToOnlineSearch.constEnd(); ++it) if \
(it.key()->checkState() == Qt::Checked) { checkedEngines << it.key()->text();
@@ -311,22 +311,22 @@ public:
default: whichEnginesLabel->setText(i18n("Search engines <b>%1</b>, \
<b>%2</b>, and more are selected (<a href=\"changeEngine\">change</a>).", \
checkedEngines.first(), checkedEngines.at(1))); break; }
- OnlineSearchQueryFormAbstract *currentQueryWidget = NULL;
- if (cursor != NULL && checkedEngines.size() == 1)
+ OnlineSearchQueryFormAbstract *currentQueryWidget = nullptr;
+ if (cursor != nullptr && checkedEngines.size() == 1)
currentQueryWidget = \
cursor->data(WidgetRole).value<OnlineSearchQueryFormAbstract *>();
- if (currentQueryWidget == NULL)
+ if (currentQueryWidget == nullptr)
currentQueryWidget = generalQueryTermsForm;
- QScrollArea *area = formToScrollArea.value(currentQueryWidget, NULL);
- if (area != NULL)
+ QScrollArea *area = formToScrollArea.value(currentQueryWidget, nullptr);
+ if (area != nullptr)
queryTermsStack->setCurrentWidget(area);
- if (useEntryButton != NULL)
+ if (useEntryButton != nullptr)
useEntryButton->setEnabled(!currentEntry.isNull() && \
tabWidget->currentIndex() == 0); }
void openHomepage() {
QListWidgetItem *item = enginesList->currentItem();
- if (item != NULL) {
+ if (item != nullptr) {
QUrl url = item->data(HomepageRole).toUrl();
/// Guess mime type for url to open
QMimeType mimeType = FileInfo::mimeTypeForUrl(url);
@@ -337,7 +337,7 @@ public:
}
void enginesListCurrentChanged(QListWidgetItem *current) {
- actionOpenHomepage->setEnabled(current != NULL);
+ actionOpenHomepage->setEnabled(current != nullptr);
}
};
@@ -457,7 +457,7 @@ void SearchForm::itemCheckChanged(QListWidgetItem *item)
d->searchButton->setEnabled(numCheckedEngines > 0);
- if (item != NULL) {
+ if (item != nullptr) {
KConfigGroup configGroup(d->config, d->configGroupName);
QString name = item->data(NameRole).toString();
configGroup.writeEntry(name, item->checkState() == 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()), mainEditor(NULL) {
+ : /* UNUSED p(parent),*/ m(mdiWidget), file(new File()), mainEditor(nullptr) \
{ QGridLayout *layout = new QGridLayout(parent);
layout->setMargin(0);
layout->setColumnStretch(0, 1);
@@ -141,13 +141,13 @@ public:
void updateCannotImportMessage() {
const bool isEmpty = resultList->model()->rowCount() == 0;
- if (mainEditor == NULL && isEmpty)
+ if (mainEditor == nullptr && isEmpty)
labelCannotImportMsg->setText(i18n("No results to import and no \
bibliography open to import to."));
- else if (mainEditor == NULL)
+ else if (mainEditor == nullptr)
labelCannotImportMsg->setText(i18n("No bibliography open to import \
to.")); else if (isEmpty)
labelCannotImportMsg->setText(i18n("No results to import."));
- widgetCannotImport->setVisible(mainEditor == NULL || isEmpty);
+ widgetCannotImport->setVisible(mainEditor == nullptr || isEmpty);
}
};
@@ -185,15 +185,15 @@ void SearchResults::documentSwitched(FileView *oldEditor, \
FileView *newEditor) void SearchResults::updateGUI()
{
d->updateCannotImportMessage();
- d->buttonImport->setEnabled(d->mainEditor != NULL && \
!d->resultList->selectedElements().isEmpty()); + \
d->buttonImport->setEnabled(d->mainEditor != nullptr && \
!d->resultList->selectedElements().isEmpty()); \
d->actionImportSelected->setEnabled(d->buttonImport->isEnabled());
d->actionCopySelected->setEnabled(!d->resultList->selectedElements().isEmpty());
- d->actionViewCurrent->setEnabled(d->resultList->currentElement() != NULL);
+ d->actionViewCurrent->setEnabled(d->resultList->currentElement() != nullptr);
}
void SearchResults::importSelected()
{
- Q_ASSERT_X(d->mainEditor != NULL, "SearchResults::importSelected", \
"d->mainEditor is NULL"); + Q_ASSERT_X(d->mainEditor != nullptr, \
"SearchResults::importSelected", "d->mainEditor is NULL");
FileModel *targetModel = d->mainEditor->fileModel();
FileModel *sourceModel = d->resultList->fileModel();
diff --git a/src/program/docklets/statistics.cpp \
b/src/program/docklets/statistics.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), selectionModel(NULL) {
+ : /* UNUSED p(parent),*/ fileView(nullptr), file(nullptr), \
selectionModel(nullptr) { QFormLayout *layout = new QFormLayout(parent);
labelNumberOfElements = new QLabel(parent);
@@ -82,10 +82,10 @@ public:
}
void update() {
- file = fileView != NULL && fileView->fileModel() != NULL ? \
fileView->fileModel()->bibliographyFile() : NULL;
- selectionModel = fileView != NULL ? fileView->selectionModel() : NULL;
+ file = fileView != nullptr && fileView->fileModel() != nullptr ? \
fileView->fileModel()->bibliographyFile() : nullptr; + selectionModel = \
fileView != nullptr ? fileView->selectionModel() : nullptr;
- if (file != NULL) {
+ if (file != nullptr) {
int numElements, numEntries, numJournalArticles, \
numConferencePublications, numBooks, numComments, numMacros;
countElementTypes(numElements, numEntries, numJournalArticles, \
numConferencePublications, numBooks, numComments, numMacros);
@@ -127,9 +127,9 @@ public:
void countElementTypes(int &numElements, int &numEntries, int \
&numJournalArticles, int &numConferencePublications, int &numBooks, int &numComments, \
int &numMacros) {
numElements = numEntries = numJournalArticles = numConferencePublications = \
numBooks = numComments = numMacros = 0;
- Q_ASSERT_X(file != NULL, \
"Statistics::StatisticsPrivate::countElementTypes(..)", "Function was called with \
file==NULL"); + Q_ASSERT_X(file != nullptr, \
"Statistics::StatisticsPrivate::countElementTypes(..)", "Function was called with \
file==NULL");
- if (selectionModel != NULL && selectionModel->selectedRows().count() > 1) {
+ if (selectionModel != nullptr && selectionModel->selectedRows().count() > 1) \
{
/// Use selected items for statistics if selection contains at least two \
elements const auto selectedRows = selectionModel->selectedRows();
numElements = selectedRows.count();
@@ -161,10 +161,10 @@ Statistics::~Statistics()
void Statistics::setFileView(FileView *fileView)
{
- if (d->fileView != NULL)
+ if (d->fileView != nullptr)
disconnect(d->fileView, &FileView::selectedElementsChanged, this, \
&Statistics::update); d->fileView = fileView;
- if (d->fileView != NULL)
+ if (d->fileView != nullptr)
connect(d->fileView, &FileView::selectedElementsChanged, this, \
&Statistics::update); d->update();
}
diff --git a/src/program/docklets/valuelist.cpp b/src/program/docklets/valuelist.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")), \
configKeyShowCountColumn(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), countWidth(8 + \
parent->fontMetrics().width(i18n("Count"))) { setupGUI();
initialize();
}
@@ -188,13 +188,13 @@ public:
if (text.isEmpty()) text = comboboxFieldNames->currentText();
delegate->setFieldName(text);
- model = fileView == NULL ? NULL : fileView->valueListModel(text);
+ model = fileView == nullptr ? nullptr : fileView->valueListModel(text);
QAbstractItemModel *usedModel = model;
- if (usedModel != NULL) {
+ if (usedModel != nullptr) {
model->setShowCountColumn(showCountColumnAction->isChecked());
model->setSortBy(sortByCountAction->isChecked() ? \
ValueListModel::SortByCount : ValueListModel::SortByText);
- if (sortingModel != NULL) delete sortingModel;
+ if (sortingModel != nullptr) delete sortingModel;
sortingModel = new QSortFilterProxyModel(p);
sortingModel->setSourceModel(model);
if (treeviewFieldValues->header()->isSortIndicatorShown())
@@ -239,22 +239,22 @@ ValueList::~ValueList()
void ValueList::setFileView(FileView *fileView)
{
- if (d->fileView != NULL)
+ if (d->fileView != nullptr)
disconnect(d->fileView, &FileView::selectedElementsChanged, this, \
&ValueList::editorSelectionChanged); d->fileView = fileView;
- if (d->fileView != NULL) {
+ if (d->fileView != nullptr) {
connect(d->fileView, &FileView::selectedElementsChanged, this, \
&ValueList::editorSelectionChanged);
connect(d->fileView, &FileView::destroyed, this, \
&ValueList::editorDestroyed); }
editorSelectionChanged();
update();
- resizeEvent(NULL);
+ resizeEvent(nullptr);
}
void ValueList::update()
{
d->update();
- setEnabled(d->fileView != NULL);
+ setEnabled(d->fileView != nullptr);
}
void ValueList::resizeEvent(QResizeEvent *)
@@ -430,10 +430,10 @@ void ValueList::deleteAllOccurrences()
void ValueList::showCountColumnToggled()
{
- if (d->model != NULL)
+ if (d->model != 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 != NULL)
+ if (d->model != nullptr)
d->model->setSortBy(d->sortByCountAction->isChecked() ? \
ValueListModel::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 = d->fileView == NULL ? false : \
d->fileView->selectedElements().count() > 0; + const bool selectedElements = \
d->fileView == 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 = NULL;
+ d->fileView = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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, \
walletKeyZoteroId, walletKeyZoteroApiKey;
Private(SearchResults *sr, ZoteroBrowser *parent)
- : p(parent), items(NULL), groups(NULL), tags(NULL), tagModel(NULL), \
collection(NULL), collectionModel(NULL), needToApplyCredentials(true), \
searchResults(sr), comboBoxGroupListInitialized(false), nonBusyCursor(p->cursor()), \
wallet(NULL) { + : p(parent), items(nullptr), groups(nullptr), \
tags(nullptr), tagModel(nullptr), collection(nullptr), collectionModel(nullptr), \
needToApplyCredentials(true), searchResults(sr), comboBoxGroupListInitialized(false), \
nonBusyCursor(p->cursor()), wallet(nullptr) { setupGUI();
}
~Private() {
- if (wallet != NULL)
+ if (wallet != nullptr)
delete wallet;
- if (items != NULL) delete items;
- if (groups != NULL) delete groups;
- if (tags != NULL) delete tags;
- if (tagModel != NULL) delete tagModel;
- if (collection != NULL) delete collection;
- if (collectionModel != NULL) delete collectionModel;
+ if (items != nullptr) delete items;
+ if (groups != nullptr) delete groups;
+ if (tags != nullptr) delete tags;
+ if (tagModel != nullptr) delete tagModel;
+ if (collection != nullptr) delete collection;
+ if (collectionModel != nullptr) delete collectionModel;
api.clear();
}
@@ -169,11 +169,11 @@ public:
}
void queueReadOAuthCredentials() {
- if (wallet != NULL && wallet->isOpen())
+ if (wallet != nullptr && wallet->isOpen())
p->readOAuthCredentials(true);
else {
/// Wallet is closed or not initialized
- if (wallet != NULL)
+ if (wallet != 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 != NULL && wallet->isOpen())
+ if (wallet != nullptr && wallet->isOpen())
p->writeOAuthCredentials(true);
else {
/// Wallet is closed or not initialized
- if (wallet != NULL)
+ if (wallet != 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 = option.rect.height();
QStyle *style = QApplication::style();
- style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0);
+ style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, nullptr);
painter->save();
@@ -192,7 +192,7 @@ QVariant DocumentListModel::data(const QModelIndex &index, 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("<qt><img src=\"%1\"> \
<b>%2</b>")).arg(KIconLoader::global()->iconPath(iconName, KIconLoader::Small), \
openFileInfo->shortCaption())); @@ -257,7 +257,7 @@ public:
QSignalMapper openMenuSignalMapper;
DocumentListViewPrivate(DocumentListView *parent)
- : p(parent), ofim(OpenFileInfoManager::instance()), \
actionAddToFav(NULL), actionRemFromFav(NULL), actionCloseFile(NULL), \
actionOpenFile(NULL), actionOpenMenu(NULL) { + : p(parent), \
ofim(OpenFileInfoManager::instance()), actionAddToFav(nullptr), \
actionRemFromFav(nullptr), actionCloseFile(nullptr), actionOpenFile(nullptr), \
actionOpenMenu(nullptr) {
connect(&openMenuSignalMapper, \
static_cast<void(QSignalMapper::*)(int)>(&QSignalMapper::mapped), p, \
&DocumentListView::openFileWithService); }
};
@@ -350,25 +350,25 @@ void DocumentListView::closeFile()
void DocumentListView::currentChanged(const QModelIndex ¤t, const QModelIndex \
&) {
bool hasCurrent = current != QModelIndex();
- OpenFileInfo *ofi = hasCurrent ? qvariant_cast<OpenFileInfo \
*>(current.data(Qt::UserRole)) : NULL; + OpenFileInfo *ofi = hasCurrent ? \
qvariant_cast<OpenFileInfo *>(current.data(Qt::UserRole)) : nullptr;
bool isOpen = hasCurrent ? ofi->flags().testFlag(OpenFileInfo::Open) : false;
bool isFavorite = hasCurrent ? ofi->flags().testFlag(OpenFileInfo::Favorite) : \
false;
bool hasName = hasCurrent ? ofi->flags().testFlag(OpenFileInfo::HasName) : \
false;
- if (d->actionOpenFile != NULL)
+ if (d->actionOpenFile != nullptr)
d->actionOpenFile->setEnabled(hasCurrent && !isOpen);
- if (d->actionCloseFile != NULL)
+ if (d->actionCloseFile != nullptr)
d->actionCloseFile->setEnabled(hasCurrent && isOpen);
- if (d->actionAddToFav != NULL)
+ if (d->actionAddToFav != nullptr)
d->actionAddToFav->setEnabled(hasCurrent && !isFavorite && hasName);
- if (d->actionRemFromFav != NULL)
+ if (d->actionRemFromFav != nullptr)
d->actionRemFromFav->setEnabled(hasCurrent && isFavorite);
for (QAction *action : const_cast<const QList<QAction *> &>(d->openMenuActions)) \
{ d->actionOpenMenu->removeAction(action);
}
d->openMenuServices.clear();
- if (ofi != NULL) {
+ if (ofi != nullptr) {
d->openMenuServices = ofi->listOfServices();
int i = 0;
for (KService::Ptr servicePtr : const_cast<const KService::List \
&>(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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL);
+ explicit DocumentListDelegate(QObject *parent = nullptr);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const \
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, QObject *parent \
= NULL); + explicit DocumentListModel(OpenFileInfo::StatusFlag statusFlag, QObject \
*parent = nullptr); ~DocumentListModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
@@ -96,7 +96,7 @@ class DocumentList : public QTabWidget
public:
enum Category { OpenFiles = 0, RecentFiles = 1, Favorites = 2 };
- explicit DocumentList(QWidget *parent = NULL);
+ explicit DocumentList(QWidget *parent = 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 = OpenFileInfoManager::instance()->currentFile();
- QUrl currFileUrl = currFile == NULL ? QUrl() : currFile->url();
+ QUrl currFileUrl = currFile == nullptr ? QUrl() : currFile->url();
QString startDir = currFileUrl.isValid() ? QUrl(currFileUrl.url()).path() : \
QString(); OpenFileInfo *ofi = OpenFileInfoManager::instance()->currentFile();
- if (ofi != NULL) {
+ if (ofi != nullptr) {
QUrl url = ofi->url();
if (url.isValid()) startDir = url.path();
}
@@ -391,16 +391,16 @@ void KBibTeXMainWindow::showPreferences()
void KBibTeXMainWindow::documentSwitched(FileView *oldFileView, FileView \
*newFileView) {
OpenFileInfo *openFileInfo = d->mdiWidget->currentFile();
- bool validFile = openFileInfo != NULL;
+ bool validFile = openFileInfo != nullptr;
d->actionClose->setEnabled(validFile);
setCaption(validFile ? i18n("%1 - KBibTeX", openFileInfo->shortCaption()) : \
i18n("KBibTeX"));
- d->fileSettings->setEnabled(newFileView != NULL);
- d->referencePreview->setEnabled(newFileView != NULL);
- d->elementForm->setEnabled(newFileView != NULL);
- d->documentPreview->setEnabled(newFileView != NULL);
- if (oldFileView != NULL) {
+ d->fileSettings->setEnabled(newFileView != nullptr);
+ d->referencePreview->setEnabled(newFileView != nullptr);
+ d->elementForm->setEnabled(newFileView != nullptr);
+ d->documentPreview->setEnabled(newFileView != nullptr);
+ if (oldFileView != nullptr) {
disconnect(newFileView, &FileView::currentElementChanged, \
d->referencePreview, &ReferencePreview::setElement);
disconnect(newFileView, &FileView::currentElementChanged, d->elementForm, \
&ElementForm::setElement);
disconnect(newFileView, &FileView::currentElementChanged, \
d->documentPreview, &DocumentPreview::setElement); @@ -410,7 +410,7 @@ void \
KBibTeXMainWindow::documentSwitched(FileView *oldFileView, FileView \
*newFil
// FIXME disconnect(oldEditor, SIGNAL(modified()), d->elementForm, \
SLOT(refreshElement()));
disconnect(d->elementForm, &ElementForm::elementModified, newFileView, \
&FileView::externalModification); }
- if (newFileView != NULL) {
+ if (newFileView != nullptr) {
connect(newFileView, &FileView::currentElementChanged, d->referencePreview, \
&ReferencePreview::setElement);
connect(newFileView, &FileView::currentElementChanged, d->elementForm, \
&ElementForm::setElement);
connect(newFileView, &FileView::currentElementChanged, d->documentPreview, \
&DocumentPreview::setElement); @@ -423,9 +423,9 @@ void \
KBibTeXMainWindow::documentSwitched(FileView *oldFileView, FileView *newFil }
d->documentPreview->setBibTeXUrl(validFile ? openFileInfo->url() : QUrl());
- d->referencePreview->setElement(QSharedPointer<Element>(), NULL);
- d->elementForm->setElement(QSharedPointer<Element>(), NULL);
- d->documentPreview->setElement(QSharedPointer<Element>(), NULL);
+ d->referencePreview->setElement(QSharedPointer<Element>(), nullptr);
+ d->elementForm->setElement(QSharedPointer<Element>(), nullptr);
+ d->documentPreview->setElement(QSharedPointer<Element>(), 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 = NULL;
+ static BibliographyService *bs = nullptr;
- if (bs == NULL) {
+ if (bs == nullptr) {
/// First call to this slot
bs = new BibliographyService(this);
if (!bs->isKBibTeXdefault() && KMessageBox::questionYesNo(this, \
i18n("KBibTeX is not the default editor for its bibliography formats like BibTeX or \
RIS."), i18n("Default Bibliography Editor"), KGuiItem(i18n("Set as Default Editor")), \
KGuiItem(i18n("Keep settings unchanged"))) == KMessageBox::Yes) { @@ -488,11 +488,11 \
@@ void KBibTeXMainWindow::delayed() { /// KBibTeX is default application or user \
doesn't care, /// therefore clean up memory
delete bs;
- bs = NULL;
+ bs = nullptr;
}
} else {
/// Second call to this slot. This time, clean up memory.
bs->deleteLater();
- bs = NULL;
+ bs = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL);
+ explicit KBibTeXMainWindow(QWidget *parent = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = Qt::UserRole + 235;
static const int SortRole = Qt::UserRole + 236;
- LRUItemModel(OpenFileInfoManager *openFileInfoManager, QObject *parent = NULL)
+ LRUItemModel(OpenFileInfoManager *openFileInfoManager, QObject *parent = \
nullptr) : QAbstractItemModel(parent), ofim(openFileInfoManager) {
// nothing
}
@@ -194,7 +194,7 @@ public:
KSharedConfigPtr config;
MDIWidgetPrivate(MDIWidget *parent)
- : p(parent), ofim(OpenFileInfoManager::instance()), currentFile(NULL), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) { + : \
p(parent), ofim(OpenFileInfoManager::instance()), currentFile(nullptr), \
config(KSharedConfig::openConfig(QStringLiteral("kbibtexrc"))) { \
createWelcomeWidget();
modelLRU = new LRUItemModel(ofim, listLRU);
@@ -240,14 +240,14 @@ MDIWidget::~MDIWidget()
void MDIWidget::setFile(OpenFileInfo *openFileInfo, KService::Ptr servicePtr)
{
- KParts::Part *part = openFileInfo == NULL ? NULL : openFileInfo->part(this, \
servicePtr); + KParts::Part *part = openFileInfo == nullptr ? nullptr : \
openFileInfo->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 = d->welcomeWidget; ///< by default use Welcome widget
- if (part != NULL) {
+ if (part != nullptr) {
/// KPart object was located, use its object (instead of Welcome widget)
widget = part->widget();
- } else if (openFileInfo != NULL) {
+ } else if (openFileInfo != 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, \
KService::Ptr servicePtr) return;
}
- FileView *oldEditor = NULL;
+ FileView *oldEditor = nullptr;
bool hasChanged = true;
if (indexOf(widget) >= 0) {
/// Chosen widget is already known (Welcome widget or a previously used \
KPart)
/// In case previous (still current) widget was a KBibTeX Part, remember its \
editor
PartWidget *currentPartWidget = qobject_cast<PartWidget *>(currentWidget());
- oldEditor = currentPartWidget == NULL ? NULL : \
currentPartWidget->fileView(); + oldEditor = currentPartWidget == nullptr ? \
nullptr : currentPartWidget->fileView();
/// Record if set widget is different from previous (still current) widget
hasChanged = widget != currentWidget();
- } else if (openFileInfo != NULL) {
+ } else if (openFileInfo != nullptr) {
/// Widget was not known previously, but a valid (new?) OpenFileInfo was \
given addWidget(widget);
d->addToMapper(openFileInfo);
@@ -282,14 +282,14 @@ void MDIWidget::setFile(OpenFileInfo *openFileInfo, \
KService::Ptr servicePtr) emit activePartChanged(part);
/// If new widget comes from a KBibTeX Part, retrieve its editor
PartWidget *newPartWidget = qobject_cast<PartWidget *>(widget);
- FileView *newEditor = newPartWidget == NULL ? NULL : \
newPartWidget->fileView(); + FileView *newEditor = newPartWidget == nullptr ? \
nullptr : newPartWidget->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 != NULL) {
+ if (openFileInfo != nullptr) {
QUrl url = openFileInfo->url();
if (url.isValid())
emit setCaption(QString(QStringLiteral("%1 \
[%2]")).arg(openFileInfo->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 QUrl &url, \
const QString &mimeType, OpenFileInfo *p)
- : m_counter(-1), p(p), part(NULL), internalServicePtr(KService::Ptr()), \
internalWidgetParent(NULL), flags(0) { + : m_counter(-1), p(p), \
part(nullptr), internalServicePtr(KService::Ptr()), internalWidgetParent(nullptr), \
flags(nullptr) { this->openFileInfoManager = openFileInfoManager;
this->url = url;
if (this->url.isValid() && this->url.scheme().isEmpty())
@@ -69,9 +69,9 @@ public:
}
~OpenFileInfoPrivate() {
- if (part != NULL) {
+ if (part != nullptr) {
KParts::ReadWritePart *rwp = qobject_cast<KParts::ReadWritePart \
*>(part);
- if (rwp != NULL)
+ if (rwp != nullptr)
rwp->closeUrl(true);
delete part;
}
@@ -80,26 +80,26 @@ public:
KParts::ReadOnlyPart *createPart(QWidget *newWidgetParent, KService::Ptr \
newServicePtr = KService::Ptr()) { if (!p->flags().testFlag(OpenFileInfo::Open)) {
qCWarning(LOG_KBIBTEX_PROGRAM) << "Cannot create part for a file which \
is not open";
- return NULL;
+ return nullptr;
}
- Q_ASSERT_X(internalWidgetParent == NULL || internalWidgetParent == \
newWidgetParent, "KParts::ReadOnlyPart \
*OpenFileInfo::OpenFileInfoPrivate::createPart(QWidget *newWidgetParent, \
KService::Ptr newServicePtr = KService::Ptr())", "internal widget should be either \
NULL or the same one as supplied as \"newWidgetParent\""); + \
Q_ASSERT_X(internalWidgetParent == nullptr || internalWidgetParent == \
newWidgetParent, "KParts::ReadOnlyPart \
*OpenFileInfo::OpenFileInfoPrivate::createPart(QWidget *newWidgetParent, \
KService::Ptr newServicePtr = 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 == newWidgetParent && (newServicePtr == \
KService::Ptr() || internalServicePtr == newServicePtr)) {
- Q_ASSERT_X(part != NULL, "KParts::ReadOnlyPart \
*OpenFileInfo::OpenFileInfoPrivate::createPart(QWidget *newWidgetParent, \
KService::Ptr newServicePtr = KService::Ptr())", "Part is NULL"); + \
Q_ASSERT_X(part != nullptr, "KParts::ReadOnlyPart \
*OpenFileInfo::OpenFileInfoPrivate::createPart(QWidget *newWidgetParent, \
KService::Ptr newServicePtr = KService::Ptr())", "Part is NULL"); return part;
- } else if (part != NULL) {
+ } else if (part != nullptr) {
KParts::ReadWritePart *rwp = qobject_cast<KParts::ReadWritePart \
*>(part);
- if (rwp != NULL)
+ if (rwp != nullptr)
rwp->closeUrl(true);
part->deleteLater();
- part = NULL;
+ part = nullptr;
}
/// reset to invalid values in case something goes wrong
internalServicePtr = KService::Ptr();
- internalWidgetParent = NULL;
+ internalWidgetParent = nullptr;
if (!newServicePtr) {
/// no valid KService has been passed
@@ -108,20 +108,20 @@ public:
}
if (!newServicePtr) {
qCCritical(LOG_KBIBTEX_PROGRAM) << "Cannot find service to handle \
mimetype " << mimeType << endl;
- return NULL;
+ return nullptr;
}
QString errorString;
part = newServicePtr->createInstance<KParts::ReadWritePart>(newWidgetParent, \
(QObject *)newWidgetParent, QVariantList(), &errorString);
- if (part == NULL) {
+ if (part == nullptr) {
qCDebug(LOG_KBIBTEX_PROGRAM) << "Could not instantiate read-write part \
for service" << newServicePtr->name() << "(mimeType=" << mimeType << ", library=" << \
newServicePtr->library() << ", error msg=" << errorString << ")";
/// creating a read-write part failed, so maybe it is read-only (like \
Okular's PDF viewer)?
part = newServicePtr->createInstance<KParts::ReadOnlyPart>(newWidgetParent, \
(QObject *)newWidgetParent, QVariantList(), &errorString); }
- if (part == NULL) {
+ if (part == nullptr) {
/// still cannot create part, must be error
qCCritical(LOG_KBIBTEX_PROGRAM) << "Could not instantiate part for \
service" << newServicePtr->name() << "(mimeType=" << mimeType << ", library=" << \
newServicePtr->library() << ", error msg=" << errorString << ")";
- return NULL;
+ return nullptr;
}
if (url.isValid()) {
@@ -139,7 +139,7 @@ public:
internalServicePtr = newServicePtr;
internalWidgetParent = newWidgetParent;
- Q_ASSERT_X(part != NULL, "KParts::ReadOnlyPart \
*OpenFileInfo::OpenFileInfoPrivate::createPart(QWidget *newWidgetParent, \
KService::Ptr newServicePtr = KService::Ptr())", "Creation of part failed, is NULL"); \
/// test should not be necessary, but just to be save ... + Q_ASSERT_X(part != \
nullptr, "KParts::ReadOnlyPart *OpenFileInfo::OpenFileInfoPrivate::createPart(QWidget \
*newWidgetParent, KService::Ptr newServicePtr = 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 = qobject_cast< KParts::ReadWritePart *>(d->part);
- if (rwPart == NULL)
+ if (rwPart == nullptr)
return false;
else
return rwPart->isModified();
@@ -202,7 +202,7 @@ bool OpenFileInfo::isModified() const
bool OpenFileInfo::save()
{
KParts::ReadWritePart *rwPart = qobject_cast< KParts::ReadWritePart *>(d->part);
- if (rwPart == NULL)
+ if (rwPart == nullptr)
return true;
else
return rwPart->save();
@@ -210,16 +210,16 @@ bool OpenFileInfo::save()
bool OpenFileInfo::close()
{
- if (d->part == NULL) {
+ if (d->part == nullptr) {
/// if there is no part, closing always "succeeds"
return true;
}
KParts::ReadWritePart *rwp = qobject_cast<KParts::ReadWritePart *>(d->part);
- if (rwp == NULL || rwp->closeUrl(true)) {
+ if (rwp == nullptr || rwp->closeUrl(true)) {
d->part->deleteLater();
- d->part = NULL;
- d->internalWidgetParent = NULL;
+ d->part = nullptr;
+ d->internalWidgetParent = 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 = p->contains(fileUrl);
- if (ofi == NULL) {
+ if (ofi == nullptr) {
ofi = p->open(fileUrl);
}
ofi->addFlags(statusFlag);
@@ -453,7 +453,7 @@ const int \
OpenFileInfoManager::OpenFileInfoManagerPrivate::maxNumFavoriteFiles = const int \
OpenFileInfoManager::OpenFileInfoManagerPrivate::maxNumRecentlyUsedFiles = 8; const \
int OpenFileInfoManager::OpenFileInfoManagerPrivate::maxNumOpenFiles = 16;
-OpenFileInfoManager *OpenFileInfoManager::singleton = NULL;
+OpenFileInfoManager *OpenFileInfoManager::singleton = nullptr;
OpenFileInfoManager::OpenFileInfoManager(QObject *parent)
: QObject(parent), d(new OpenFileInfoManagerPrivate(this))
@@ -462,7 +462,7 @@ OpenFileInfoManager::OpenFileInfoManager(QObject *parent)
}
OpenFileInfoManager *OpenFileInfoManager::instance() {
- if (singleton == NULL)
+ if (singleton == nullptr)
singleton = new OpenFileInfoManager(QCoreApplication::instance());
return singleton;
}
@@ -486,7 +486,7 @@ OpenFileInfo *OpenFileInfoManager::open(const QUrl &url)
Q_ASSERT_X(url.isValid(), "OpenFileInfo *OpenFileInfoManager::open(const \
QUrl&)", "URL is not valid");
OpenFileInfo *result = contains(url);
- if (result == NULL) {
+ if (result == nullptr) {
/// file not yet open
result = new OpenFileInfo(this, url);
connect(result, &OpenFileInfo::flagsChanged, this, \
&OpenFileInfoManager::flagsChanged); @@ -498,13 +498,13 @@ OpenFileInfo \
*OpenFileInfoManager::open(const QUrl &url)
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<const OpenFileInfoManager::OpenFileInfoList \
&>(d->openFileInfoList)) { if (ofi->url() == url)
return ofi;
}
- return NULL;
+ return nullptr;
}
bool OpenFileInfoManager::changeUrl(OpenFileInfo *openFileInfo, const QUrl &url)
@@ -512,7 +512,7 @@ bool OpenFileInfoManager::changeUrl(OpenFileInfo *openFileInfo, \
const QUrl &url) OpenFileInfo *previouslyContained = contains(url);
/// check if old url differs from new url and old url is valid
- if (previouslyContained != NULL && \
previouslyContained->flags().testFlag(OpenFileInfo::Open) && previouslyContained != \
openFileInfo) { + if (previouslyContained != nullptr && \
previouslyContained->flags().testFlag(OpenFileInfo::Open) && previouslyContained != \
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 *openFileInfo, \
const QUrl &url)
OpenFileInfo::StatusFlags statusFlags = (openFileInfo->flags() & \
(~OpenFileInfo::Open)) | OpenFileInfo::RecentlyUsed; ofi->setFlags(statusFlags);
}
- if (previouslyContained != NULL) {
+ if (previouslyContained != nullptr) {
/// keep Favorite flag if set in file that have previously same URL
if (previouslyContained->flags().testFlag(OpenFileInfo::Favorite))
openFileInfo->setFlags(openFileInfo->flags() | OpenFileInfo::Favorite);
@@ -550,7 +550,7 @@ bool OpenFileInfoManager::changeUrl(OpenFileInfo *openFileInfo, \
const QUrl &url)
bool OpenFileInfoManager::close(OpenFileInfo *openFileInfo)
{
- if (openFileInfo == NULL) {
+ if (openFileInfo == 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 *openFileInfo)
openFileInfo->setLastAccess();
/// remove flag "open" from file to be closed and determine which file to show \
instead
- OpenFileInfo *nextCurrent = (d->currentFileInfo == openFileInfo) ? NULL : \
d->currentFileInfo; + OpenFileInfo *nextCurrent = (d->currentFileInfo == \
openFileInfo) ? nullptr : d->currentFileInfo;
for (OpenFileInfo *ofi : const_cast<const OpenFileInfoManager::OpenFileInfoList \
&>(d->openFileInfoList)) { if (!isClosing && ofi == openFileInfo && \
openFileInfo->close()) { isClosing = true;
@@ -568,7 +568,7 @@ bool OpenFileInfoManager::close(OpenFileInfo *openFileInfo)
/// If file has a filename, remember as recently used
if (openFileInfo->flags().testFlag(OpenFileInfo::HasName))
openFileInfo->addFlags(OpenFileInfo::RecentlyUsed);
- } else if (nextCurrent == NULL && ofi->flags().testFlag(OpenFileInfo::Open))
+ } else if (nextCurrent == nullptr && \
ofi->flags().testFlag(OpenFileInfo::Open)) nextCurrent = ofi;
}
@@ -636,14 +636,14 @@ void OpenFileInfoManager::setCurrentFile(OpenFileInfo \
*openFileInfo, KService::P OpenFileInfo *previous = d->currentFileInfo;
d->currentFileInfo = openFileInfo;
- if (d->currentFileInfo != NULL) {
+ if (d->currentFileInfo != nullptr) {
d->currentFileInfo->addFlags(OpenFileInfo::Open);
d->currentFileInfo->setLastAccess();
}
if (hasChanged) {
- if (previous != NULL) previous->setLastAccess();
+ if (previous != nullptr) previous->setLastAccess();
emit currentChanged(openFileInfo, servicePtr);
- } else if (openFileInfo != NULL && servicePtr != openFileInfo->currentService())
+ } else if (openFileInfo != nullptr && servicePtr != \
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 servicePtr = \
KService::Ptr());
- OpenFileInfoList filteredItems(OpenFileInfo::StatusFlags required, \
OpenFileInfo::StatusFlags forbidden = 0); + OpenFileInfoList \
filteredItems(OpenFileInfo::StatusFlags required, OpenFileInfo::StatusFlags forbidden \
= 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 = \
KService::serviceByStorageId(QStringLiteral("kbibtexpart.desktop"));
- if (service.data() == NULL) {
+ if (service.data() == 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=" << 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 = NULL;
+ File *file = 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 = NULL;
+ File *file2 = nullptr;
loadFile(tempFileName, testFile, &file2);
QVERIFY(file2);
@@ -136,9 +136,9 @@ void KBibTeXFilesTest::testFiles()
void KBibTeXFilesTest::loadFile(const QString &absoluteFilename, const TestFile \
¤tTestFile, File **outFile) {
- *outFile = NULL;
+ *outFile = nullptr;
- FileImporter *importer = NULL;
+ FileImporter *importer = nullptr;
if (currentTestFile.filename.endsWith(QStringLiteral(".bib"))) {
importer = new FileImporterBibTeX(false);
} else {
@@ -146,7 +146,7 @@ void KBibTeXFilesTest::loadFile(const QString &absoluteFilename, \
const TestFile }
QFile file(absoluteFilename);
- File *bibTeXFile = NULL;
+ File *bibTeXFile = nullptr;
QVERIFY(file.open(QFile::ReadOnly));
bibTeXFile = importer->load(&file);
file.close();
@@ -167,7 +167,7 @@ void KBibTeXFilesTest::loadFile(const QString &absoluteFilename, \
const TestFile if (!authors.isEmpty()) {
ValueItem *vi = authors.last().data();
Person *p = dynamic_cast<Person *>(vi);
- if (p != NULL) {
+ if (p != nullptr) {
lastEntryLastAuthorLastName = p->lastName();
} else
lastEntryLastAuthorLastName.clear();
@@ -176,7 +176,7 @@ void KBibTeXFilesTest::loadFile(const QString &absoluteFilename, \
const TestFile if (!editors.isEmpty()) {
ValueItem *vi = editors.last().data();
Person *p = dynamic_cast<Person *>(vi);
- if (p != NULL) {
+ if (p != nullptr) {
lastEntryLastAuthorLastName = p->lastName();
} else
lastEntryLastAuthorLastName.clear();
@@ -242,7 +242,7 @@ void KBibTeXFilesTest::saveFile(File *file, const TestFile \
¤tTestFile, QSt {
*outFile = QString();
- FileExporter *exporter = NULL;
+ FileExporter *exporter = nullptr;
if (currentTestFile.filename.endsWith(QStringLiteral(".bib"))) {
FileExporterBibTeX *bibTeXExporter = 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 <fischer@unix-ag.uni-kl.de> *
+ * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> *
* *
* 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 = NULL);
+ explicit KBibTeXTest(QWidget *parent = nullptr);
public slots:
void startOnlineSearchTests();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic