]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincolumnwidget.cpp
SVN_SILENT: assure that the position of the methods in the cpp file matchs with the...
[dolphin.git] / src / dolphincolumnwidget.cpp
index bf1c882a476fbdcf7f567749aaa47f9d714aaee2..fba415efc56594f9534268159b15e25694cd944d 100644 (file)
@@ -60,11 +60,9 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
     m_dolphinModel(0),
     m_proxyModel(0),
     m_iconManager(0),
-    m_dragging(false),
     m_dropRect()
 {
     setMouseTracking(true);
-    viewport()->setAttribute(Qt::WA_Hover);
     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
     setSelectionBehavior(SelectItems);
@@ -156,6 +154,9 @@ void DolphinColumnWidget::setDecorationSize(const QSize& size)
     setIconSize(size);
     m_decorationSize = size;
     doItemsLayout();
+    if (m_iconManager != 0) {
+        m_iconManager->updatePreviews();
+    }
 }
 
 void DolphinColumnWidget::setActive(bool active)
@@ -228,6 +229,14 @@ void DolphinColumnWidget::setNameFilter(const QString& nameFilter)
     m_proxyModel->setFilterRegExp(nameFilter);
 }
 
+void DolphinColumnWidget::editItem(const KFileItem& item)
+{
+    const QModelIndex dirIndex = m_dolphinModel->indexForItem(item);
+    const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
+    if (proxyIndex.isValid()) {
+        edit(proxyIndex);
+    }
+}
 
 QStyleOptionViewItem DolphinColumnWidget::viewOptions() const
 {
@@ -248,16 +257,11 @@ void DolphinColumnWidget::dragEnterEvent(QDragEnterEvent* event)
     if (event->mimeData()->hasUrls()) {
         event->acceptProposedAction();
     }
-
-    m_dragging = true;
 }
 
 void DolphinColumnWidget::dragLeaveEvent(QDragLeaveEvent* event)
 {
     QListView::dragLeaveEvent(event);
-
-    // TODO: remove this code when the issue #160611 is solved in Qt 4.4
-    m_dragging = false;
     setDirtyRegion(m_dropRect);
 }
 
@@ -298,7 +302,6 @@ void DolphinColumnWidget::dropEvent(QDropEvent* event)
         event->acceptProposedAction();
     }
     QListView::dropEvent(event);
-    m_dragging = false;
 }
 
 void DolphinColumnWidget::paintEvent(QPaintEvent* event)
@@ -310,25 +313,15 @@ void DolphinColumnWidget::paintEvent(QPaintEvent* event)
         if (proxyIndex.isValid() && !selectionModel()->isSelected(proxyIndex)) {
             const QRect itemRect = visualRect(proxyIndex);
             QPainter painter(viewport());
-            painter.save();
-
             QColor color = KColorScheme(QPalette::Active, KColorScheme::View).foreground().color();
             color.setAlpha(32);
             painter.setPen(Qt::NoPen);
             painter.setBrush(color);
             painter.drawRect(itemRect);
-
-            painter.restore();
         }
     }
 
     QListView::paintEvent(event);
-
-    // TODO: remove this code when the issue #160611 is solved in Qt 4.4
-    if (m_dragging) {
-        const QBrush& brush = viewOptions().palette.brush(QPalette::Normal, QPalette::Highlight);
-        DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
-    }
 }
 
 void DolphinColumnWidget::mousePressEvent(QMouseEvent* event)
@@ -440,10 +433,10 @@ void DolphinColumnWidget::deactivate()
     // necessary connecting the signal 'singleClick()' or 'doubleClick'.
     if (KGlobalSettings::singleClick()) {
         disconnect(this, SIGNAL(clicked(const QModelIndex&)),
-                   this, SLOT(triggerItem(const QModelIndex&)));
+                   m_view->m_controller, SLOT(triggerItem(const QModelIndex&)));
     } else {
         disconnect(this, SIGNAL(doubleClicked(const QModelIndex&)),
-                   this, SLOT(triggerItem(const QModelIndex&)));
+                   m_view->m_controller, SLOT(triggerItem(const QModelIndex&)));
     }
 
     const QModelIndex current = selectionModel()->currentIndex();