#include "dolphinmodel.h"
#include "dolphinsortfilterproxymodel.h"
#include "dolphinsettings.h"
-
#include "dolphin_columnmodesettings.h"
+#include "draganddrophelper.h"
#include <kcolorutils.h>
#include <kcolorscheme.h>
m_proxyModel->setFilterRegExp(nameFilter);
}
+void DolphinColumnWidget::startDrag(Qt::DropActions supportedActions)
+{
+ DragAndDropHelper::startDrag(this, supportedActions);
+}
+
void DolphinColumnWidget::dragEnterEvent(QDragEnterEvent* event)
{
if (event->mimeData()->hasUrls()) {
// TODO: remove this code when the issue #160611 is solved in Qt 4.4
const QModelIndex index = indexAt(event->pos());
setDirtyRegion(m_dropRect);
- m_dropRect = visualRect(index);
+ if (itemForIndex(index).isDir()) {
+ m_dropRect = visualRect(index);
+ } else {
+ m_dropRect.setSize(QSize()); // set as invalid
+ }
setDirtyRegion(m_dropRect);
}
const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
if (!urls.isEmpty()) {
const QModelIndex index = indexAt(event->pos());
- if (index.isValid()) {
- const KFileItem item = itemForIndex(index);
- m_view->m_controller->indicateDroppedUrls(urls,
- url(),
- item,
- event->source());
- event->acceptProposedAction();
- }
+ const KFileItem item = itemForIndex(index);
+ m_view->m_controller->indicateDroppedUrls(urls,
+ url(),
+ item);
+ event->acceptProposedAction();
}
QListView::dropEvent(event);
m_dragging = false;
// TODO: remove this code when the issue #160611 is solved in Qt 4.4
if (m_dragging) {
const QBrush& brush = m_viewOptions.palette.brush(QPalette::Normal, QPalette::Highlight);
- DolphinController::drawHoverIndication(viewport(), m_dropRect, brush);
+ DragAndDropHelper::drawHoverIndication(viewport(), m_dropRect, brush);
}
}
selModel->select(selected, QItemSelectionModel::Select);
selModel->select(deselected, QItemSelectionModel::Deselect);
}
+
void DolphinColumnWidget::triggerItem(const QModelIndex& index)
{
const KFileItem item = itemForIndex(index);