From d3496b12310d9fec0e52e537c341e87fcaa2f8b5 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Wed, 9 Feb 2011 19:21:58 +0100 Subject: Coding style update for pointer comparison Most developers seem to prefer if (ptr) ... if (!ptr) ... in comparison to if (ptr != 0) ... if (ptr == 0) ... Adjusted the Dolphin-code to use the "most-prefered style" to make contributors happy. --- .../versioncontrol/versioncontrolobserver.cpp | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/views/versioncontrol/versioncontrolobserver.cpp') diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index 26528f974..62f50f30b 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -49,13 +49,14 @@ VersionControlObserver::VersionControlObserver(QAbstractItemView* view) : m_plugin(0), m_updateItemStatesThread(0) { - Q_ASSERT(view != 0); + Q_ASSERT(view); QAbstractProxyModel* proxyModel = qobject_cast(view->model()); - m_dolphinModel = (proxyModel == 0) ? - qobject_cast(view->model()) : - qobject_cast(proxyModel->sourceModel()); - if (m_dolphinModel != 0) { + m_dolphinModel = proxyModel ? + qobject_cast(proxyModel->sourceModel()) : + qobject_cast(view->model()); + + if (m_dolphinModel) { m_dirLister = m_dolphinModel->dirLister(); connect(m_dirLister, SIGNAL(completed()), this, SLOT(delayedDirectoryVerification())); @@ -75,7 +76,7 @@ VersionControlObserver::VersionControlObserver(QAbstractItemView* view) : VersionControlObserver::~VersionControlObserver() { - if (m_updateItemStatesThread != 0) { + if (m_updateItemStatesThread) { if (m_updateItemStatesThread->isFinished()) { delete m_updateItemStatesThread; m_updateItemStatesThread = 0; @@ -91,7 +92,7 @@ VersionControlObserver::~VersionControlObserver() } } - if (m_plugin != 0) { + if (m_plugin) { m_plugin->disconnect(); m_plugin = 0; } @@ -137,12 +138,12 @@ void VersionControlObserver::verifyDirectory() return; } - if (m_plugin != 0) { + if (m_plugin) { m_plugin->disconnect(); } m_plugin = searchPlugin(versionControlUrl); - if (m_plugin != 0) { + if (m_plugin) { connect(m_plugin, SIGNAL(versionStatesChanged()), this, SLOT(silentDirectoryVerification())); connect(m_plugin, SIGNAL(infoMessage(QString)), @@ -180,7 +181,7 @@ void VersionControlObserver::verifyDirectory() void VersionControlObserver::slotThreadFinished() { - if (m_plugin == 0) { + if (!m_plugin) { return; } @@ -222,8 +223,8 @@ void VersionControlObserver::slotThreadFinished() void VersionControlObserver::updateItemStates() { - Q_ASSERT(m_plugin != 0); - if (m_updateItemStatesThread == 0) { + Q_ASSERT(m_plugin); + if (!m_updateItemStatesThread) { m_updateItemStatesThread = new UpdateItemStatesThread(); connect(m_updateItemStatesThread, SIGNAL(finished()), this, SLOT(slotThreadFinished())); @@ -282,7 +283,7 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director for (KService::List::ConstIterator it = pluginServices.constBegin(); it != pluginServices.constEnd(); ++it) { if (enabledPlugins.contains((*it)->name())) { KVersionControlPlugin* plugin = (*it)->createInstance(); - if (plugin != 0) { + if (plugin) { plugins.append(plugin); } } @@ -330,7 +331,7 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director bool VersionControlObserver::isVersioned() const { - return m_dolphinModel->hasVersionData() && (m_plugin != 0); + return m_dolphinModel->hasVersionData() && m_plugin; } #include "versioncontrolobserver.moc" -- cgit v1.3