X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/ca7aaecbdbddb27f7442e69d2770b97b4307f338..148282e2d856b47ceb191eeef4c834118c8cdffd:/src/dolphiniconsview.cpp diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 9947a2755..b95de351a 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -22,6 +22,7 @@ #include "dolphincategorydrawer.h" #include "dolphincontroller.h" #include "dolphinsettings.h" +#include "dolphinviewautoscroller.h" #include "dolphin_iconsmodesettings.h" #include "dolphin_generalsettings.h" #include "draganddrophelper.h" @@ -61,11 +62,10 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle viewport()->setAcceptDrops(true); setMouseTracking(true); + new DolphinViewAutoScroller(this); - // TODO: Connecting to the signal 'activated()' is not possible, as kstyle - // does not forward the single vs. doubleclick to it yet (KDE 4.1?). Hence it is - // necessary connecting the signal 'singleClick()' or 'doubleClick' and to handle the - // RETURN-key in keyPressEvent(). + connect(this, SIGNAL(clicked(const QModelIndex&)), + controller, SLOT(requestTab(const QModelIndex&))); if (KGlobalSettings::singleClick()) { connect(this, SIGNAL(clicked(const QModelIndex&)), controller, SLOT(triggerItem(const QModelIndex&))); @@ -154,7 +154,7 @@ void DolphinIconsView::dataChanged(const QModelIndex& topLeft, const QModelIndex KCategorizedView::dataChanged(topLeft, bottomRight); KCategorizedSortFilterProxyModel* proxyModel = dynamic_cast(model()); - if ((flow() == QListView::LeftToRight) && !proxyModel->isCategorizedModel()) { + if (!proxyModel->isCategorizedModel()) { // bypass a QListView issue that items are not layout correctly if the decoration size of // an index changes scheduleDelayedItemsLayout(); @@ -209,12 +209,12 @@ void DolphinIconsView::startDrag(Qt::DropActions supportedActions) // TODO: invoking KCategorizedView::startDrag() should not be necessary, we'll // fix this in KDE 4.1 KCategorizedView::startDrag(supportedActions); - DragAndDropHelper::startDrag(this, supportedActions); + DragAndDropHelper::instance().startDrag(this, supportedActions, m_controller); } void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event) { - if (event->mimeData()->hasUrls()) { + if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) { event->acceptProposedAction(); } } @@ -242,7 +242,7 @@ void DolphinIconsView::dragMoveEvent(QDragMoveEvent* event) m_dropRect.setSize(QSize()); // set as invalid } } - if (event->mimeData()->hasUrls()) { + if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) { // accept url drops, independently from the destination item event->acceptProposedAction(); } @@ -252,17 +252,9 @@ void DolphinIconsView::dragMoveEvent(QDragMoveEvent* event) void DolphinIconsView::dropEvent(QDropEvent* event) { - if (!selectionModel()->isSelected(indexAt(event->pos()))) { - const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData()); - if (!urls.isEmpty()) { - const QModelIndex index = indexAt(event->pos()); - const KFileItem item = m_controller->itemForIndex(index); - m_controller->indicateDroppedUrls(urls, - m_controller->url(), - item); - event->acceptProposedAction(); - } - } + const QModelIndex index = indexAt(event->pos()); + const KFileItem item = m_controller->itemForIndex(index); + m_controller->indicateDroppedUrls(item, m_controller->url(), event); KCategorizedView::dropEvent(event); } @@ -285,6 +277,10 @@ void DolphinIconsView::wheelEvent(QWheelEvent* event) event->ignore(); return; } + + horizontalScrollBar()->setSingleStep(m_itemSize.width() / 10); + verticalScrollBar()->setSingleStep(m_itemSize.height() / 10); + KCategorizedView::wheelEvent(event); // if the icons are aligned left to right, the vertical wheel event should // be applied to the horizontal scrollbar