Commit a540e6fd authored by Kurt Hindenburg's avatar Kurt Hindenburg

Fix readability-implicit-bool-cast issues using nullptr

parent 29382cc6
...@@ -523,7 +523,7 @@ Profile::Ptr Application::processProfileChangeArgs(Profile::Ptr baseProfile) ...@@ -523,7 +523,7 @@ Profile::Ptr Application::processProfileChangeArgs(Profile::Ptr baseProfile)
void Application::startBackgroundMode(MainWindow* window) void Application::startBackgroundMode(MainWindow* window)
{ {
if (_backgroundInstance) { if (_backgroundInstance != nullptr) {
return; return;
} }
......
...@@ -101,7 +101,7 @@ QUrl BookmarkHandler::currentUrl() const ...@@ -101,7 +101,7 @@ QUrl BookmarkHandler::currentUrl() const
QUrl BookmarkHandler::urlForView(ViewProperties* view) const QUrl BookmarkHandler::urlForView(ViewProperties* view) const
{ {
if (view) if (view != nullptr)
return QUrl(view->url()); return QUrl(view->url());
else else
return QUrl(); return QUrl();
...@@ -114,7 +114,7 @@ QString BookmarkHandler::currentTitle() const ...@@ -114,7 +114,7 @@ QString BookmarkHandler::currentTitle() const
QString BookmarkHandler::titleForView(ViewProperties* view) const QString BookmarkHandler::titleForView(ViewProperties* view) const
{ {
const QUrl& url = view ? view->url() : QUrl(); const QUrl& url = view != nullptr ? view->url() : QUrl();
if (url.isLocalFile()) { if (url.isLocalFile()) {
QString path = url.path(); QString path = url.path();
...@@ -139,7 +139,7 @@ QString BookmarkHandler::currentIcon() const ...@@ -139,7 +139,7 @@ QString BookmarkHandler::currentIcon() const
QString BookmarkHandler::iconForView(ViewProperties* view) const QString BookmarkHandler::iconForView(ViewProperties* view) const
{ {
if (view) if (view != nullptr)
return view->icon().name(); return view->icon().name();
else else
return QString(); return QString();
......
...@@ -219,7 +219,7 @@ void ColorScheme::setColorTableEntry(int index , const ColorEntry& entry) ...@@ -219,7 +219,7 @@ void ColorScheme::setColorTableEntry(int index , const ColorEntry& entry)
{ {
Q_ASSERT(index >= 0 && index < TABLE_COLORS); Q_ASSERT(index >= 0 && index < TABLE_COLORS);
if (!_table) { if (_table == nullptr) {
_table = new ColorEntry[TABLE_COLORS]; _table = new ColorEntry[TABLE_COLORS];
for (int i = 0; i < TABLE_COLORS; i++) for (int i = 0; i < TABLE_COLORS; i++)
...@@ -292,7 +292,7 @@ void ColorScheme::setRandomizedBackgroundColor(bool randomize) ...@@ -292,7 +292,7 @@ void ColorScheme::setRandomizedBackgroundColor(bool randomize)
if (randomize) { if (randomize) {
setRandomizationRange(BGCOLOR_INDEX , MAX_HUE , 255 , 0); setRandomizationRange(BGCOLOR_INDEX , MAX_HUE , 255 , 0);
} else { } else {
if (_randomTable) if (_randomTable != nullptr)
setRandomizationRange(BGCOLOR_INDEX , 0 , 0 , 0); setRandomizationRange(BGCOLOR_INDEX , 0 , 0 , 0);
} }
} }
...@@ -313,7 +313,7 @@ void ColorScheme::setRandomizationRange(int index , quint16 hue , quint8 saturat ...@@ -313,7 +313,7 @@ void ColorScheme::setRandomizationRange(int index , quint16 hue , quint8 saturat
const ColorEntry* ColorScheme::colorTable() const const ColorEntry* ColorScheme::colorTable() const
{ {
if (_table) if (_table != nullptr)
return _table; return _table;
else else
return defaultTable; return defaultTable;
...@@ -449,7 +449,7 @@ void ColorSchemeWallpaper::load() ...@@ -449,7 +449,7 @@ void ColorSchemeWallpaper::load()
return; return;
// Create and load original pixmap // Create and load original pixmap
if (!_picture) if (_picture == nullptr)
_picture = new QPixmap(); _picture = new QPixmap();
if (_picture->isNull()) if (_picture->isNull())
...@@ -463,7 +463,7 @@ bool ColorSchemeWallpaper::isNull() const ...@@ -463,7 +463,7 @@ bool ColorSchemeWallpaper::isNull() const
bool ColorSchemeWallpaper::draw(QPainter& painter, const QRect& rect, qreal opacity) bool ColorSchemeWallpaper::draw(QPainter& painter, const QRect& rect, qreal opacity)
{ {
if (!_picture || _picture->isNull()) if ((_picture == nullptr) || _picture->isNull())
return false; return false;
if (qFuzzyCompare(1.0, opacity)) { if (qFuzzyCompare(1.0, opacity)) {
......
...@@ -209,7 +209,7 @@ void ColorSchemeEditor::wallpaperPathChanged(const QString& path) ...@@ -209,7 +209,7 @@ void ColorSchemeEditor::wallpaperPathChanged(const QString& path)
} }
void ColorSchemeEditor::setDescription(const QString& text) void ColorSchemeEditor::setDescription(const QString& text)
{ {
if (_colors) if (_colors != nullptr)
_colors->setDescription(text); _colors->setDescription(text);
if (_ui->descriptionEdit->text() != text) if (_ui->descriptionEdit->text() != text)
......
...@@ -85,7 +85,7 @@ CopyInputDialog::~CopyInputDialog() ...@@ -85,7 +85,7 @@ CopyInputDialog::~CopyInputDialog()
void CopyInputDialog::setChosenSessions(const QSet<Session*>& sessions) void CopyInputDialog::setChosenSessions(const QSet<Session*>& sessions)
{ {
QSet<Session*> checked = sessions; QSet<Session*> checked = sessions;
if (_masterSession) if (_masterSession != nullptr)
checked.insert(_masterSession); checked.insert(_masterSession);
_model->setCheckedSessions(checked); _model->setCheckedSessions(checked);
...@@ -96,7 +96,7 @@ QSet<Session*> CopyInputDialog::chosenSessions() const ...@@ -96,7 +96,7 @@ QSet<Session*> CopyInputDialog::chosenSessions() const
} }
void CopyInputDialog::setMasterSession(Session* session) void CopyInputDialog::setMasterSession(Session* session)
{ {
if (_masterSession) if (_masterSession != nullptr)
_model->setCheckable(_masterSession, true); _model->setCheckable(_masterSession, true);
_model->setCheckable(session, false); _model->setCheckable(session, false);
......
...@@ -490,7 +490,7 @@ void EditProfileDialog::toggleMouseWheelZoom(bool enable) ...@@ -490,7 +490,7 @@ void EditProfileDialog::toggleMouseWheelZoom(bool enable)
} }
void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme) void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme)
{ {
if (!_ui->colorSchemeList->model()) if (_ui->colorSchemeList->model() == nullptr)
_ui->colorSchemeList->setModel(new QStandardItemModel(this)); _ui->colorSchemeList->setModel(new QStandardItemModel(this));
const QString& name = lookupProfile()->colorScheme(); const QString& name = lookupProfile()->colorScheme();
...@@ -520,7 +520,7 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme) ...@@ -520,7 +520,7 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme)
model->sort(0); model->sort(0);
if (selectCurrentScheme && selectedItem) { if (selectCurrentScheme && (selectedItem != nullptr)) {
_ui->colorSchemeList->updateGeometry(); _ui->colorSchemeList->updateGeometry();
_ui->colorSchemeList->selectionModel()->setCurrentIndex(selectedItem->index() , _ui->colorSchemeList->selectionModel()->setCurrentIndex(selectedItem->index() ,
QItemSelectionModel::Select); QItemSelectionModel::Select);
...@@ -531,7 +531,7 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme) ...@@ -531,7 +531,7 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme)
} }
void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator) void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator)
{ {
if (!_ui->keyBindingList->model()) if (_ui->keyBindingList->model() == nullptr)
_ui->keyBindingList->setModel(new QStandardItemModel(this)); _ui->keyBindingList->setModel(new QStandardItemModel(this));
const QString& name = lookupProfile()->keyBindings(); const QString& name = lookupProfile()->keyBindings();
...@@ -550,7 +550,7 @@ void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator) ...@@ -550,7 +550,7 @@ void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator)
QStringList translatorNames = keyManager->allTranslators(); QStringList translatorNames = keyManager->allTranslators();
foreach(const QString& translatorName, translatorNames) { foreach(const QString& translatorName, translatorNames) {
const KeyboardTranslator* translator = keyManager->findTranslator(translatorName); const KeyboardTranslator* translator = keyManager->findTranslator(translatorName);
if (!translator) continue; if (translator == nullptr) continue;
QStandardItem* item = new QStandardItem(translator->description()); QStandardItem* item = new QStandardItem(translator->description());
item->setEditable(false); item->setEditable(false);
...@@ -566,7 +566,7 @@ void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator) ...@@ -566,7 +566,7 @@ void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator)
model->sort(0); model->sort(0);
if (selectCurrentTranslator && selectedItem) { if (selectCurrentTranslator && (selectedItem != nullptr)) {
_ui->keyBindingList->selectionModel()->setCurrentIndex(selectedItem->index() , _ui->keyBindingList->selectionModel()->setCurrentIndex(selectedItem->index() ,
QItemSelectionModel::Select); QItemSelectionModel::Select);
} }
...@@ -689,7 +689,7 @@ void EditProfileDialog::showColorSchemeEditor(bool isNewScheme) ...@@ -689,7 +689,7 @@ void EditProfileDialog::showColorSchemeEditor(bool isNewScheme)
// Setting up ColorSchemeEditor ui // Setting up ColorSchemeEditor ui
// close any running ColorSchemeEditor // close any running ColorSchemeEditor
if (_colorDialog) { if (_colorDialog != nullptr) {
closeColorSchemeEditor(); closeColorSchemeEditor();
} }
_colorDialog = new ColorSchemeEditor(this); _colorDialog = new ColorSchemeEditor(this);
...@@ -701,7 +701,7 @@ void EditProfileDialog::showColorSchemeEditor(bool isNewScheme) ...@@ -701,7 +701,7 @@ void EditProfileDialog::showColorSchemeEditor(bool isNewScheme)
} }
void EditProfileDialog::closeColorSchemeEditor() void EditProfileDialog::closeColorSchemeEditor()
{ {
if (_colorDialog) { if (_colorDialog != nullptr) {
_colorDialog->close(); _colorDialog->close();
delete _colorDialog; delete _colorDialog;
} }
...@@ -736,7 +736,7 @@ void EditProfileDialog::colorSchemeSelected() ...@@ -736,7 +736,7 @@ void EditProfileDialog::colorSchemeSelected()
if (!selected.isEmpty()) { if (!selected.isEmpty()) {
QAbstractItemModel* model = _ui->colorSchemeList->model(); QAbstractItemModel* model = _ui->colorSchemeList->model();
const ColorScheme* colors = model->data(selected.first(), Qt::UserRole + 1).value<const ColorScheme*>(); const ColorScheme* colors = model->data(selected.first(), Qt::UserRole + 1).value<const ColorScheme*>();
if (colors) { if (colors != nullptr) {
updateTempProfileProperty(Profile::ColorScheme, colors->name()); updateTempProfileProperty(Profile::ColorScheme, colors->name());
previewColorScheme(selected.first()); previewColorScheme(selected.first());
...@@ -841,7 +841,7 @@ void EditProfileDialog::keyBindingSelected() ...@@ -841,7 +841,7 @@ void EditProfileDialog::keyBindingSelected()
QAbstractItemModel* model = _ui->keyBindingList->model(); QAbstractItemModel* model = _ui->keyBindingList->model();
const KeyboardTranslator* translator = model->data(selected.first(), Qt::UserRole + 1) const KeyboardTranslator* translator = model->data(selected.first(), Qt::UserRole + 1)
.value<const KeyboardTranslator*>(); .value<const KeyboardTranslator*>();
if (translator) { if (translator != nullptr) {
updateTempProfileProperty(Profile::KeyBindings, translator->name()); updateTempProfileProperty(Profile::KeyBindings, translator->name());
} }
} }
...@@ -885,7 +885,7 @@ void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator) ...@@ -885,7 +885,7 @@ void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator)
auto editor = new KeyBindingEditor; auto editor = new KeyBindingEditor;
if (translator) if (translator != nullptr)
editor->setup(translator); editor->setup(translator);
if (isNewTranslator) if (isNewTranslator)
...@@ -1295,13 +1295,13 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte ...@@ -1295,13 +1295,13 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte
const ColorScheme* scheme = index.data(Qt::UserRole + 1).value<const ColorScheme*>(); const ColorScheme* scheme = index.data(Qt::UserRole + 1).value<const ColorScheme*>();
QFont profileFont = index.data(Qt::UserRole + 2).value<QFont>(); QFont profileFont = index.data(Qt::UserRole + 2).value<QFont>();
Q_ASSERT(scheme); Q_ASSERT(scheme);
if (!scheme) if (scheme == nullptr)
return; return;
painter->setRenderHint(QPainter::Antialiasing); painter->setRenderHint(QPainter::Antialiasing);
// Draw background // Draw background
QStyle *style = option.widget ? option.widget->style() : QApplication::style(); QStyle *style = option.widget != nullptr ? option.widget->style() : QApplication::style();
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, option.widget); style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, option.widget);
// Draw name // Draw name
......
...@@ -143,7 +143,7 @@ const HistoryType& Emulation::history() const ...@@ -143,7 +143,7 @@ const HistoryType& Emulation::history() const
void Emulation::setCodec(const QTextCodec * codec) void Emulation::setCodec(const QTextCodec * codec)
{ {
if (codec) { if (codec != nullptr) {
_codec = codec; _codec = codec;
delete _decoder; delete _decoder;
...@@ -166,7 +166,7 @@ void Emulation::setCodec(EmulationCodec codec) ...@@ -166,7 +166,7 @@ void Emulation::setCodec(EmulationCodec codec)
void Emulation::setKeyBindings(const QString& name) void Emulation::setKeyBindings(const QString& name)
{ {
_keyTranslator = KeyboardTranslatorManager::instance()->findTranslator(name); _keyTranslator = KeyboardTranslatorManager::instance()->findTranslator(name);
if (!_keyTranslator) { if (_keyTranslator == nullptr) {
_keyTranslator = KeyboardTranslatorManager::instance()->defaultTranslator(); _keyTranslator = KeyboardTranslatorManager::instance()->defaultTranslator();
} }
} }
......
...@@ -115,7 +115,7 @@ ushort* ExtendedCharTable::lookupExtendedChar(ushort hash , ushort& length) cons ...@@ -115,7 +115,7 @@ ushort* ExtendedCharTable::lookupExtendedChar(ushort hash , ushort& length) cons
// argument and return a pointer to the character sequence // argument and return a pointer to the character sequence
ushort* buffer = extendedCharTable[hash]; ushort* buffer = extendedCharTable[hash];
if (buffer) { if (buffer != nullptr) {
length = buffer[0]; length = buffer[0];
return buffer + 1; return buffer + 1;
} else { } else {
......
...@@ -358,7 +358,7 @@ void RegExpFilter::process() ...@@ -358,7 +358,7 @@ void RegExpFilter::process()
RegExpFilter::HotSpot* spot = newHotSpot(startLine, startColumn, RegExpFilter::HotSpot* spot = newHotSpot(startLine, startColumn,
endLine, endColumn, match.capturedTexts()); endLine, endColumn, match.capturedTexts());
if (!spot) { if (spot == nullptr) {
continue; continue;
} }
...@@ -405,14 +405,14 @@ void UrlFilter::HotSpot::activate(QObject* object) ...@@ -405,14 +405,14 @@ void UrlFilter::HotSpot::activate(QObject* object)
const UrlType kind = urlType(); const UrlType kind = urlType();
const QString& actionName = object ? object->objectName() : QString(); const QString& actionName = object != nullptr ? object->objectName() : QString();
if (actionName == QLatin1String("copy-action")) { if (actionName == QLatin1String("copy-action")) {
QApplication::clipboard()->setText(url); QApplication::clipboard()->setText(url);
return; return;
} }
if (!object || actionName == QLatin1String("open-action")) { if ((object == nullptr) || actionName == QLatin1String("open-action")) {
if (kind == StandardUrl) { if (kind == StandardUrl) {
// if the URL path does not include the protocol ( eg. "www.kde.org" ) then // if the URL path does not include the protocol ( eg. "www.kde.org" ) then
// prepend http:// ( eg. "www.kde.org" --> "http://www.kde.org" ) // prepend http:// ( eg. "www.kde.org" --> "http://www.kde.org" )
...@@ -501,7 +501,7 @@ QList<QAction*> UrlFilter::HotSpot::actions() ...@@ -501,7 +501,7 @@ QList<QAction*> UrlFilter::HotSpot::actions()
RegExpFilter::HotSpot* FileFilter::newHotSpot(int startLine, int startColumn, int endLine, RegExpFilter::HotSpot* FileFilter::newHotSpot(int startLine, int startColumn, int endLine,
int endColumn, const QStringList& capturedTexts) int endColumn, const QStringList& capturedTexts)
{ {
if (!_session) { if (_session == nullptr) {
qCDebug(KonsoleDebug) << "Trying to create new hot spot without session!"; qCDebug(KonsoleDebug) << "Trying to create new hot spot without session!";
return nullptr; return nullptr;
} }
......
...@@ -91,7 +91,7 @@ HistoryFile::HistoryFile() ...@@ -91,7 +91,7 @@ HistoryFile::HistoryFile()
HistoryFile::~HistoryFile() HistoryFile::~HistoryFile()
{ {
if (_fileMap) if (_fileMap != nullptr)
unmap(); unmap();
} }
...@@ -128,7 +128,7 @@ bool HistoryFile::isMapped() const ...@@ -128,7 +128,7 @@ bool HistoryFile::isMapped() const
void HistoryFile::add(const unsigned char* buffer, int count) void HistoryFile::add(const unsigned char* buffer, int count)
{ {
if (_fileMap) if (_fileMap != nullptr)
unmap(); unmap();
_readWriteBalance++; _readWriteBalance++;
...@@ -155,7 +155,7 @@ void HistoryFile::get(unsigned char* buffer, int size, int loc) ...@@ -155,7 +155,7 @@ void HistoryFile::get(unsigned char* buffer, int size, int loc)
//calls (decided by using MAP_THRESHOLD) then mmap the log //calls (decided by using MAP_THRESHOLD) then mmap the log
//file to improve performance. //file to improve performance.
_readWriteBalance--; _readWriteBalance--;
if (!_fileMap && _readWriteBalance < MAP_THRESHOLD) if ((_fileMap == nullptr) && _readWriteBalance < MAP_THRESHOLD)
map(); map();
if (loc < 0 || size < 0 || loc + size > _length) { if (loc < 0 || size < 0 || loc + size > _length) {
...@@ -163,7 +163,7 @@ void HistoryFile::get(unsigned char* buffer, int size, int loc) ...@@ -163,7 +163,7 @@ void HistoryFile::get(unsigned char* buffer, int size, int loc)
return; return;
} }
if (_fileMap) { if (_fileMap != nullptr) {
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
buffer[i] = _fileMap[loc + i]; buffer[i] = _fileMap[loc + i];
} else { } else {
...@@ -607,7 +607,7 @@ bool HistoryTypeFile::isEnabled() const ...@@ -607,7 +607,7 @@ bool HistoryTypeFile::isEnabled() const
HistoryScroll* HistoryTypeFile::scroll(HistoryScroll* old) const HistoryScroll* HistoryTypeFile::scroll(HistoryScroll* old) const
{ {
if (dynamic_cast<HistoryFile *>(old)) if (dynamic_cast<HistoryFile *>(old) != nullptr)
return old; // Unchanged. return old; // Unchanged.
HistoryScroll* newScroll = new HistoryScrollFile(_fileName); HistoryScroll* newScroll = new HistoryScrollFile(_fileName);
...@@ -657,9 +657,9 @@ int CompactHistoryType::maximumLineCount() const ...@@ -657,9 +657,9 @@ int CompactHistoryType::maximumLineCount() const
HistoryScroll* CompactHistoryType::scroll(HistoryScroll* old) const HistoryScroll* CompactHistoryType::scroll(HistoryScroll* old) const
{ {
if (old) { if (old != nullptr) {
CompactHistoryScroll* oldBuffer = dynamic_cast<CompactHistoryScroll*>(old); CompactHistoryScroll* oldBuffer = dynamic_cast<CompactHistoryScroll*>(old);
if (oldBuffer) { if (oldBuffer != nullptr) {
oldBuffer->setMaxNbLines(_maxLines); oldBuffer->setMaxNbLines(_maxLines);
return oldBuffer; return oldBuffer;
} }
......
...@@ -158,7 +158,7 @@ void KeyBindingEditor::setDescription(const QString& newDescription) ...@@ -158,7 +158,7 @@ void KeyBindingEditor::setDescription(const QString& newDescription)
void KeyBindingEditor::setTranslatorDescription(const QString& newDescription) void KeyBindingEditor::setTranslatorDescription(const QString& newDescription)
{ {
if (_translator) if (_translator != nullptr)
_translator->setDescription(newDescription); _translator->setDescription(newDescription);
} }
......
...@@ -189,7 +189,7 @@ const KeyboardTranslator* KeyboardTranslatorManager::defaultTranslator() ...@@ -189,7 +189,7 @@ const KeyboardTranslator* KeyboardTranslatorManager::defaultTranslator()
// Try to find the default.keytab file if it exists, otherwise // Try to find the default.keytab file if it exists, otherwise
// fall back to the internal hard-coded fallback translator // fall back to the internal hard-coded fallback translator
const KeyboardTranslator* translator = findTranslator(QStringLiteral("default")); const KeyboardTranslator* translator = findTranslator(QStringLiteral("default"));
if (!translator) { if (translator == nullptr) {
translator = _fallbackTranslator; translator = _fallbackTranslator;
} }
return translator; return translator;
......
...@@ -174,7 +174,7 @@ void MainWindow::correctStandardShortcuts() ...@@ -174,7 +174,7 @@ void MainWindow::correctStandardShortcuts()
{ {
// replace F1 shortcut for help contents // replace F1 shortcut for help contents
QAction* helpAction = actionCollection()->action(QStringLiteral("help_contents")); QAction* helpAction = actionCollection()->action(QStringLiteral("help_contents"));
if (helpAction) { if (helpAction != nullptr) {
actionCollection()->setDefaultShortcut(helpAction, QKeySequence()); actionCollection()->setDefaultShortcut(helpAction, QKeySequence());
} }
...@@ -182,7 +182,7 @@ void MainWindow::correctStandardShortcuts() ...@@ -182,7 +182,7 @@ void MainWindow::correctStandardShortcuts()
// changed the shortcut; however, if the user changed it to Ctrl+B // changed the shortcut; however, if the user changed it to Ctrl+B
// this will still get changed to Ctrl+Shift+B // this will still get changed to Ctrl+Shift+B
QAction* bookmarkAction = actionCollection()->action(QStringLiteral("add_bookmark")); QAction* bookmarkAction = actionCollection()->action(QStringLiteral("add_bookmark"));
if (bookmarkAction && bookmarkAction->shortcut() == QKeySequence(Konsole::ACCEL + Qt::Key_B)) { if ((bookmarkAction != nullptr) && bookmarkAction->shortcut() == QKeySequence(Konsole::ACCEL + Qt::Key_B)) {
actionCollection()->setDefaultShortcut(bookmarkAction, Konsole::ACCEL + Qt::SHIFT + Qt::Key_B); actionCollection()->setDefaultShortcut(bookmarkAction, Konsole::ACCEL + Qt::SHIFT + Qt::Key_B);
} }
} }
...@@ -218,7 +218,7 @@ void MainWindow::activeViewChanged(SessionController* controller) ...@@ -218,7 +218,7 @@ void MainWindow::activeViewChanged(SessionController* controller)
disconnect(bookmarkHandler(), &Konsole::BookmarkHandler::openUrl, 0, 0); disconnect(bookmarkHandler(), &Konsole::BookmarkHandler::openUrl, 0, 0);
connect(bookmarkHandler(), &Konsole::BookmarkHandler::openUrl, controller, &Konsole::SessionController::openUrl); connect(bookmarkHandler(), &Konsole::BookmarkHandler::openUrl, controller, &Konsole::SessionController::openUrl);
if (_pluggedController) if (_pluggedController != nullptr)
disconnectController(_pluggedController); disconnectController(_pluggedController);
Q_ASSERT(controller); Q_ASSERT(controller);
...@@ -250,7 +250,7 @@ void MainWindow::activeViewTitleChanged(ViewProperties* properties) ...@@ -250,7 +250,7 @@ void MainWindow::activeViewTitleChanged(ViewProperties* properties)
void MainWindow::updateWindowCaption() void MainWindow::updateWindowCaption()
{ {
if (!_pluggedController) if (_pluggedController == nullptr)
return; return;
const QString& title = _pluggedController->title(); const QString& title = _pluggedController->title();
...@@ -273,7 +273,7 @@ void MainWindow::updateWindowCaption() ...@@ -273,7 +273,7 @@ void MainWindow::updateWindowCaption()
void MainWindow::updateWindowIcon() void MainWindow::updateWindowIcon()
{ {
if (_pluggedController && !_pluggedController->icon().isNull()) if ((_pluggedController != nullptr) && !_pluggedController->icon().isNull())
setWindowIcon(_pluggedController->icon()); setWindowIcon(_pluggedController->icon());
} }
...@@ -374,7 +374,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions) ...@@ -374,7 +374,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions)
// it if it is the non-default profile. // it if it is the non-default profile.
if (sessionActions.size() > 2) { if (sessionActions.size() > 2) {
// Update the 'New Tab' KActionMenu // Update the 'New Tab' KActionMenu
if (_newTabMenuAction->menu()) { if (_newTabMenuAction->menu() != nullptr) {
_newTabMenuAction->menu()->clear(); _newTabMenuAction->menu()->clear();
} else { } else {
_newTabMenuAction->setMenu(new QMenu()); _newTabMenuAction->setMenu(new QMenu());
...@@ -394,7 +394,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions) ...@@ -394,7 +394,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions)
} }
} }
} else { } else {
if (_newTabMenuAction->menu()) { if (_newTabMenuAction->menu() != nullptr) {
_newTabMenuAction->menu()->clear(); _newTabMenuAction->menu()->clear();
} else { } else {
_newTabMenuAction->setMenu(new QMenu()); _newTabMenuAction->setMenu(new QMenu());
...@@ -412,7 +412,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions) ...@@ -412,7 +412,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions)
QString MainWindow::activeSessionDir() const QString MainWindow::activeSessionDir() const
{ {
if (