+ Q_ASSERT(m_itemView != 0);
+
+ QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(m_itemView->model());
+ KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
+ const QModelIndex dirIndex = proxyModel->mapToSource(index);
+ return dirModel->itemForIndex(dirIndex);
+}
+
+void DolphinController::triggerItem(const QModelIndex& index)
+{
+ if (m_mouseButtons & Qt::LeftButton) {
+ const KFileItem item = itemForIndex(index);
+ if (index.isValid() && (index.column() == KDirModel::Name)) {
+ emit itemTriggered(item);
+ } else {
+ m_itemView->clearSelection();
+ emit itemEntered(KFileItem());
+ }
+ }
+}
+
+void DolphinController::requestTab(const QModelIndex& index)
+{
+ if (m_mouseButtons & Qt::MidButton) {
+ const KFileItem item = itemForIndex(index);
+ const bool validRequest = index.isValid() &&
+ (index.column() == KDirModel::Name) &&
+ (item.isDir() || m_dolphinView->isTabsForFilesEnabled());
+ if (validRequest) {
+ emit tabRequested(item.url());
+ }
+ }
+}
+
+void DolphinController::emitItemEntered(const QModelIndex& index)
+{
+ KFileItem item = itemForIndex(index);
+ if (!item.isNull()) {
+ emit itemEntered(item);
+ }