+void DolphinController::indicateAdditionalInfoChange(const KFileItemDelegate::InformationList& info)
+{
+ emit additionalInfoChanged(info);
+}
+
+void DolphinController::indicateActivationChange(bool active)
+{
+ emit activationChanged(active);
+}
+
+void DolphinController::setZoomLevel(int level)
+{
+ Q_ASSERT(level >= ZoomLevelInfo::minimumLevel());
+ Q_ASSERT(level <= ZoomLevelInfo::maximumLevel());
+ if (level != m_zoomLevel) {
+ m_zoomLevel = level;
+ emit zoomLevelChanged(m_zoomLevel);
+ }
+}
+
+void DolphinController::handleKeyPressEvent(QKeyEvent* event)
+{
+ Q_ASSERT(m_itemView != 0);
+
+ const QItemSelectionModel* selModel = m_itemView->selectionModel();
+ const QModelIndex currentIndex = selModel->currentIndex();
+ const bool trigger = currentIndex.isValid()
+ && ((event->key() == Qt::Key_Return)
+ || (event->key() == Qt::Key_Enter))
+ && (selModel->selectedIndexes().count() > 0);
+ if (trigger) {
+ const QModelIndexList indexList = selModel->selectedIndexes();
+ foreach (const QModelIndex& index, indexList) {
+ emit itemTriggered(itemForIndex(index));
+ }
+ }
+}
+
+void DolphinController::replaceUrlByClipboard()
+{
+ const QClipboard* clipboard = QApplication::clipboard();
+ QString text;
+ if (clipboard->mimeData(QClipboard::Selection)->hasText()) {
+ text = clipboard->mimeData(QClipboard::Selection)->text();
+ } else if (clipboard->mimeData(QClipboard::Clipboard)->hasText()) {
+ text = clipboard->mimeData(QClipboard::Clipboard)->text();
+ }
+ if (!text.isEmpty() && QDir::isAbsolutePath(text)) {
+ m_dolphinView->setUrl(KUrl(text));
+ }
+}
+
+void DolphinController::emitHideToolTip()
+{
+ emit hideToolTip();
+}
+
+void DolphinController::emitItemTriggered(const KFileItem& item)
+{
+ emit itemTriggered(item);
+}
+
+KFileItem DolphinController::itemForIndex(const QModelIndex& index) const
+{
+ 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);
+}
+