]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincolumnwidget.cpp
There are some extractable strings in subdirs too.
[dolphin.git] / src / dolphincolumnwidget.cpp
index fba415efc56594f9534268159b15e25694cd944d..a380dc52bf09256d4cb36a3f1e6677c6517a13bb 100644 (file)
@@ -29,6 +29,7 @@
 #include "dolphin_generalsettings.h"
 #include "draganddrophelper.h"
 #include "selectionmanager.h"
+#include "tooltipmanager.h"
 
 #include <kcolorscheme.h>
 #include <kdirlister.h>
@@ -52,6 +53,7 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
     QListView(parent),
     m_active(true),
     m_view(columnView),
+    m_selectionManager(0),
     m_url(url),
     m_childUrl(),
     m_font(),
@@ -70,6 +72,7 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
     setDragDropMode(QAbstractItemView::DragDrop);
     setDropIndicatorShown(false);
     setSelectionRectVisible(true);
+    setEditTriggers(QAbstractItemView::NoEditTriggers);
 
     setVerticalScrollMode(QListView::ScrollPerPixel);
     setHorizontalScrollMode(QListView::ScrollPerPixel);
@@ -123,17 +126,21 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
     const bool useSelManager = KGlobalSettings::singleClick() &&
                                DolphinSettings::instance().generalSettings()->showSelectionToggle();
     if (useSelManager) {
-        SelectionManager* selManager = new SelectionManager(this);
-        connect(selManager, SIGNAL(selectionChanged()),
+        m_selectionManager = new SelectionManager(this);
+        connect(m_selectionManager, SIGNAL(selectionChanged()),
                 this, SLOT(requestActivation()));
         connect(m_view->m_controller, SIGNAL(urlChanged(const KUrl&)),
-                selManager, SLOT(reset()));
+                m_selectionManager, SLOT(reset()));
     }
 
     new KMimeTypeResolver(this, m_dolphinModel);
     m_iconManager = new IconManager(this, m_proxyModel);
     m_iconManager->setShowPreview(m_view->m_controller->dolphinView()->showPreview());
 
+    if (DolphinSettings::instance().generalSettings()->showToolTips()) {
+        new ToolTipManager(this, m_proxyModel);
+    }
+
     m_dirLister->openUrl(url, KDirLister::NoFlags);
 
     connect(KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()),
@@ -157,6 +164,9 @@ void DolphinColumnWidget::setDecorationSize(const QSize& size)
     if (m_iconManager != 0) {
         m_iconManager->updatePreviews();
     }
+    if (m_selectionManager != 0) {
+        m_selectionManager->reset();
+    }
 }
 
 void DolphinColumnWidget::setActive(bool active)
@@ -327,6 +337,10 @@ void DolphinColumnWidget::paintEvent(QPaintEvent* event)
 void DolphinColumnWidget::mousePressEvent(QMouseEvent* event)
 {
     requestActivation();
+    if (indexAt(event->pos()).isValid() && (event->button() == Qt::LeftButton)) {
+        // TODO: see comment in DolphinIconsView::mousePressEvent()
+        setState(QAbstractItemView::DraggingState);
+    }
     QListView::mousePressEvent(event);
 }
 
@@ -359,14 +373,28 @@ void DolphinColumnWidget::contextMenuEvent(QContextMenuEvent* event)
 
 void DolphinColumnWidget::wheelEvent(QWheelEvent* event)
 {
+    if (m_selectionManager != 0) {
+        m_selectionManager->reset();
+    }
+
     // let Ctrl+wheel events propagate to the DolphinView for icon zooming
     if (event->modifiers() & Qt::ControlModifier) {
         event->ignore();
         return;
     }
+
     QListView::wheelEvent(event);
 }
 
+void DolphinColumnWidget::leaveEvent(QEvent* event)
+{
+    QListView::leaveEvent(event);
+    // if the mouse is above an item and moved very fast outside the widget,
+    // no viewportEntered() signal might be emitted although the mouse has been moved
+    // above the viewport
+    m_view->m_controller->emitViewportEntered();
+}
+
 void DolphinColumnWidget::selectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
 {
     QListView::selectionChanged(selected, deselected);