]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphincolumnview.cpp
Coding style update for pointer comparison
[dolphin.git] / src / views / dolphincolumnview.cpp
index 4b3a9f582da9fae9825591c3a52936025e77326f..fec0879ea39e58d27c2be079602494c81fa1cc1a 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2007-2009 by Peter Penz <peter.penz@gmx.at>             *
+ *   Copyright (C) 2007-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  *
 #include "viewmodecontroller.h"
 #include "zoomlevelinfo.h"
 
-#include <kcolorscheme.h>
-#include <kdirlister.h>
-#include <kfileitem.h>
-#include <kio/previewjob.h>
-#include <kicon.h>
-#include <kiconeffect.h>
-#include <kjob.h>
-#include <klocale.h>
+#include <KColorScheme>
+#include <KDirLister>
+#include <KFileItem>
+#include <KIO/PreviewJob>
+#include <KIcon>
+#include <KIconEffect>
+#include <KJob>
+#include <KLocale>
 #include <konqmimedata.h>
 
 #include <QApplication>
@@ -90,7 +90,7 @@ DolphinColumnView::DolphinColumnView(QWidget* parent,
     m_resizeWidget->installEventFilter(this);
 
     const ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
-    Q_ASSERT(settings != 0);
+    Q_ASSERT(settings);
 
     if (settings->useSystemFont()) {
         m_font = KGlobalSettings::generalFont();
@@ -149,7 +149,7 @@ DolphinColumnView::DolphinColumnView(QWidget* parent,
 
     updateDecorationSize(dolphinView->showPreview());
     updateBackground();
-    
+
     DolphinViewController* dolphinViewController = m_container->m_dolphinViewController;
     m_extensionsFactory = new ViewExtensionsFactory(this, dolphinViewController, viewModeController);
     m_extensionsFactory->fileItemDelegate()->setMinimizedNameColumn(true);
@@ -166,6 +166,7 @@ DolphinColumnView::~DolphinColumnView()
     m_dirLister = 0; // deleted by m_dolphinModel
 }
 
+
 void DolphinColumnView::setActive(bool active)
 {
     if (m_active != active) {
@@ -179,6 +180,34 @@ void DolphinColumnView::setActive(bool active)
     }
 }
 
+bool DolphinColumnView::isActive() const
+{
+    return m_active;
+}
+
+void DolphinColumnView::setChildUrl(const KUrl& url)
+{
+    m_childUrl = url;
+}
+
+KUrl DolphinColumnView::childUrl() const
+{
+    return m_childUrl;
+}
+
+void DolphinColumnView::setUrl(const KUrl& url)
+{
+    if (url != m_url) {
+        m_url = url;
+        m_dirLister->openUrl(url, KDirLister::NoFlags);
+    }
+}
+
+KUrl DolphinColumnView::url() const
+{
+    return m_url;
+}
+
 void DolphinColumnView::updateBackground()
 {
     // TODO: The alpha-value 150 is copied from DolphinView::setActive(). When
@@ -212,7 +241,7 @@ void DolphinColumnView::setSelectionModel(QItemSelectionModel* model)
     // If a change of the selection is done although the view is not active
     // (e. g. by the selection markers), the column must be activated. This
     // is done by listening to the current selectionChanged() signal.
-    if (selectionModel() != 0) {
+    if (selectionModel()) {
         disconnect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
                    this, SLOT(requestActivation()));
     }
@@ -254,21 +283,15 @@ void DolphinColumnView::startDrag(Qt::DropActions supportedActions)
 
 void DolphinColumnView::dragEnterEvent(QDragEnterEvent* event)
 {
-    if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) {
-        event->acceptProposedAction();
-        requestActivation();
-    }
+    event->acceptProposedAction();
+    requestActivation();
     DolphinTreeView::dragEnterEvent(event);
 }
 
 void DolphinColumnView::dragMoveEvent(QDragMoveEvent* event)
 {
     DolphinTreeView::dragMoveEvent(event);
-
-    if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) {
-        // accept url drops, independently from the destination item
-        event->acceptProposedAction();
-    }
+    event->acceptProposedAction();
 }
 
 void DolphinColumnView::dropEvent(QDropEvent* event)
@@ -277,7 +300,7 @@ void DolphinColumnView::dropEvent(QDropEvent* event)
     m_container->m_dolphinViewController->setItemView(this);
     const QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(index);
     const KFileItem item = m_dolphinModel->itemForIndex(dolphinModelIndex);
-    m_container->m_dolphinViewController->indicateDroppedUrls(item, url(), event);
+    m_container->m_dolphinViewController->indicateDroppedUrls(item, event);
     DolphinTreeView::dropEvent(event);
 }
 
@@ -313,7 +336,7 @@ void DolphinColumnView::mousePressEvent(QMouseEvent* event)
 }
 
 void DolphinColumnView::keyPressEvent(QKeyEvent* event)
-{   
+{
     DolphinTreeView::keyPressEvent(event);
 
     DolphinViewController* controller = m_container->m_dolphinViewController;
@@ -484,7 +507,7 @@ void DolphinColumnView::requestActivation()
 void DolphinColumnView::updateFont()
 {
     const ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
-    Q_ASSERT(settings != 0);
+    Q_ASSERT(settings);
 
     if (settings->useSystemFont()) {
         m_font = KGlobalSettings::generalFont();
@@ -564,7 +587,7 @@ void DolphinColumnView::deactivate()
     selectionModel()->setCurrentIndex(current, QItemSelectionModel::NoUpdate);
     connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
             this, SLOT(requestActivation()));
-    
+
     updateBackground();
 }