#include "kitemlistcontroller.h"
-
-#include "kitemlistview.h"
#include "kitemlistselectionmanager.h"
-
-#include "private/kitemlistrubberband.h"
+#include "kitemlistview.h"
#include "private/kitemlistkeyboardsearchmanager.h"
+#include "private/kitemlistrubberband.h"
+#include "views/draganddrophelper.h"
+#include <QAccessible>
#include <QApplication>
#include <QDrag>
-#include <QEvent>
#include <QGraphicsScene>
#include <QGraphicsSceneEvent>
#include <QGraphicsView>
#include <QMimeData>
#include <QTimer>
-#include <QAccessible>
-#include <views/draganddrophelper.h>
KItemListController::KItemListController(KItemModelBase* model, KItemListView* view, QObject* parent) :
QObject(parent),
return m_mouseDoubleClickAction;
}
+int KItemListController::indexCloseToMousePressedPosition() const
+{
+ QHashIterator<KItemListWidget*, KItemListGroupHeader*> it(m_view->m_visibleGroups);
+ while (it.hasNext()) {
+ it.next();
+ KItemListGroupHeader *groupHeader = it.value();
+ const QPointF mappedToGroup = groupHeader->mapFromItem(nullptr, m_pressedMousePos);
+ if (groupHeader->contains(mappedToGroup)) {
+ return it.key()->index();
+ }
+ }
+ return -1;
+}
+
void KItemListController::setAutoActivationDelay(int delay)
{
m_autoActivationTimer->setInterval(delay);
return m_singleClickActivationEnforced;
}
-bool KItemListController::showEvent(QShowEvent* event)
-{
- Q_UNUSED(event);
- return false;
-}
-
-bool KItemListController::hideEvent(QHideEvent* event)
-{
- Q_UNUSED(event);
- return false;
-}
-
bool KItemListController::keyPressEvent(QKeyEvent* event)
{
int index = m_selectionManager->currentItem();
}
}
}
- // Fall through to the default case and add the Space to the current search string.
-
+ Q_FALLTHROUGH(); // fall through to the default case and add the Space to the current search string.
default:
m_keyboardManager->addKeys(event->text());
// Make sure unconsumed events get propagated up the chain. #302329
{
Q_UNUSED(event);
Q_UNUSED(transform);
+
+ DragAndDropHelper::clearUrlListMatchesUrlCache();
+
return false;
}