+void DolphinView::toggleAdditionalInfo(QAction* action)
+{
+ const KFileItemDelegate::Information info =
+ static_cast<KFileItemDelegate::Information>(action->data().toInt());
+
+ KFileItemDelegate::InformationList list = additionalInfo();
+
+ const bool show = action->isChecked();
+
+ const int index = list.indexOf(info);
+ const bool containsInfo = (index >= 0);
+ if (show && !containsInfo) {
+ list.append(info);
+ setAdditionalInfo(list);
+ } else if (!show && containsInfo) {
+ list.removeAt(index);
+ setAdditionalInfo(list);
+ Q_ASSERT(list.indexOf(info) < 0);
+ }
+}
+
+void DolphinView::mouseReleaseEvent(QMouseEvent* event)
+{
+ QWidget::mouseReleaseEvent(event);
+ setActive(true);
+}
+
+void DolphinView::wheelEvent(QWheelEvent* event)
+{
+ if (event->modifiers() & Qt::ControlModifier) {
+ const int delta = event->delta();
+ const int level = zoomLevel();
+ if (delta > 0) {
+ setZoomLevel(level + 1);
+ } else if (delta < 0) {
+ setZoomLevel(level - 1);
+ }
+ event->accept();
+ }
+}
+
+bool DolphinView::eventFilter(QObject* watched, QEvent* event)
+{
+ switch (event->type()) {
+ case QEvent::FocusIn:
+ if (watched == itemView()) {
+ m_controller->requestActivation();
+ }
+ break;
+
+ case QEvent::MouseButtonPress:
+ if ((watched == itemView()->viewport()) && (m_expandedViews.count() > 0)) {
+ // Listening to a mousebutton press event to delete expanded views is a
+ // workaround, as it seems impossible for the FolderExpander to know when
+ // a dragging outside a view has been finished. However it works quite well:
+ // A mousebutton press event indicates that a drag operation must be
+ // finished already.
+ deleteExpandedViews();
+ }
+ break;
+
+ case QEvent::DragEnter:
+ if (watched == itemView()->viewport()) {
+ setActive(true);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return QWidget::eventFilter(watched, event);
+}
+
+void DolphinView::activate()
+{
+ setActive(true);
+}
+
+void DolphinView::triggerItem(const KFileItem& item)
+{
+ const Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
+ if ((modifier & Qt::ShiftModifier) || (modifier & Qt::ControlModifier)) {
+ // items are selected by the user, hence don't trigger the
+ // item specified by 'index'
+ return;
+ }
+
+ // TODO: the m_isContextMenuOpen check is a workaround for Qt-issue 207192
+ if (item.isNull() || m_isContextMenuOpen) {
+ return;
+ }
+
+ if (m_toolTipManager != 0) {
+ m_toolTipManager->hideTip();
+ }
+ emit itemTriggered(item); // caught by DolphinViewContainer or DolphinPart
+}
+
+void DolphinView::emitSelectionChangedSignal()
+{
+ emit selectionChanged(DolphinView::selectedItems());
+}
+
+void DolphinView::openContextMenu(const QPoint& pos)
+{
+ KFileItem item;
+ if (isColumnViewActive()) {
+ item = m_columnView->itemAt(pos);
+ } else {
+ const QModelIndex index = itemView()->indexAt(pos);
+ if (index.isValid() && (index.column() == DolphinModel::Name)) {
+ const QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(index);
+ item = m_dolphinModel->itemForIndex(dolphinModelIndex);
+ }
+ }
+
+ if (m_toolTipManager != 0) {
+ m_toolTipManager->hideTip();
+ }
+
+ m_isContextMenuOpen = true; // TODO: workaround for Qt-issue 207192
+ emit requestContextMenu(item, url());
+ m_isContextMenuOpen = false;
+}
+
+void DolphinView::dropUrls(const KFileItem& destItem,
+ const KUrl& destPath,
+ QDropEvent* event)
+{
+ DragAndDropHelper::instance().dropUrls(destItem, destPath, event, this);
+}
+
+void DolphinView::updateSorting(DolphinView::Sorting sorting)
+{
+ ViewProperties props(viewPropertiesUrl());
+ props.setSorting(sorting);
+
+ m_proxyModel->setSorting(sorting);
+
+ emit sortingChanged(sorting);
+}
+
+void DolphinView::updateSortOrder(Qt::SortOrder order)
+{
+ ViewProperties props(viewPropertiesUrl());
+ props.setSortOrder(order);
+
+ m_proxyModel->setSortOrder(order);
+
+ emit sortOrderChanged(order);
+}
+