]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/versioncontrol/versioncontrolobserver.cpp
Coding style update for pointer comparison
[dolphin.git] / src / views / versioncontrol / versioncontrolobserver.cpp
index 76f1754512f0e03f5a203c6df33e43ade70eebff..62f50f30b7bfb0261e41bcf47c4bcbd623ae0f63 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                  *
+ *   Copyright (C) 2009 by Peter Penz <peter.penz19@gmail.com>             *
  *                                                                         *
  *   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,13 +49,14 @@ VersionControlObserver::VersionControlObserver(QAbstractItemView* view) :
     m_plugin(0),
     m_updateItemStatesThread(0)
 {
-    Q_ASSERT(view != 0);
+    Q_ASSERT(view);
 
     QAbstractProxyModel* proxyModel = qobject_cast<QAbstractProxyModel*>(view->model());
-    m_dolphinModel = (proxyModel == 0) ?
-                     qobject_cast<DolphinModel*>(view->model()) :
-                     qobject_cast<DolphinModel*>(proxyModel->sourceModel());
-    if (m_dolphinModel != 0) {
+    m_dolphinModel = proxyModel ?
+                     qobject_cast<DolphinModel*>(proxyModel->sourceModel()) :
+                     qobject_cast<DolphinModel*>(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<KVersionControlPlugin>();
-                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"