#include "dolphincategorydrawer.h"
#include "dolphincontroller.h"
#include "dolphinsettings.h"
+#include "dolphinviewautoscroller.h"
#include "dolphin_iconsmodesettings.h"
#include "dolphin_generalsettings.h"
#include "draganddrophelper.h"
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&)));
KCategorizedView::dataChanged(topLeft, bottomRight);
KCategorizedSortFilterProxyModel* proxyModel = dynamic_cast<KCategorizedSortFilterProxyModel*>(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();
// 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();
}
}
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();
}
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);
}
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