+
+ KCategorizedView::dropEvent(event);
+
+ m_dragging = false;
+}
+
+void DolphinIconsView::paintEvent(QPaintEvent* event)
+{
+ KCategorizedView::paintEvent(event);
+
+ // TODO: remove this code when the issue #160611 is solved in Qt 4.4
+ if (m_dragging) {
+ const QBrush& brush = m_viewOptions.palette.brush(QPalette::Normal, QPalette::Highlight);
+ DragAndDropHelper::drawHoverIndication(viewport(), m_dropRect, brush);
+ }
+}
+
+void DolphinIconsView::keyPressEvent(QKeyEvent* event)
+{
+ KCategorizedView::keyPressEvent(event);
+
+ const QItemSelectionModel* selModel = selectionModel();
+ const QModelIndex currentIndex = selModel->currentIndex();
+ const bool trigger = currentIndex.isValid()
+ && (event->key() == Qt::Key_Return)
+ && (selModel->selectedIndexes().count() <= 1);
+ if (trigger) {
+ triggerItem(currentIndex);
+ }
+}
+
+void DolphinIconsView::triggerItem(const QModelIndex& index)
+{
+ m_controller->triggerItem(itemForIndex(index));
+}
+
+void DolphinIconsView::slotEntered(const QModelIndex& index)
+{
+ m_controller->emitItemEntered(itemForIndex(index));
+}
+
+void DolphinIconsView::slotShowPreviewChanged()
+{
+ const DolphinView* view = m_controller->dolphinView();
+ const int infoCount = view->additionalInfo().count();
+ updateGridSize(view->showPreview(), infoCount);
+}
+
+void DolphinIconsView::slotAdditionalInfoChanged(const KFileItemDelegate::InformationList& info)
+{
+ const bool showPreview = m_controller->dolphinView()->showPreview();
+ updateGridSize(showPreview, info.count());
+}
+
+void DolphinIconsView::zoomIn()
+{
+ if (isZoomInPossible()) {
+ IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
+
+ const int oldIconSize = settings->iconSize();
+ int newIconSize = oldIconSize;
+
+ const bool showPreview = m_controller->dolphinView()->showPreview();
+ if (showPreview) {
+ const int previewSize = increasedIconSize(settings->previewSize());
+ settings->setPreviewSize(previewSize);
+ } else {
+ newIconSize = increasedIconSize(oldIconSize);
+ settings->setIconSize(newIconSize);
+ if (settings->previewSize() < newIconSize) {
+ // assure that the preview size is always >= the icon size
+ settings->setPreviewSize(newIconSize);
+ }
+ }
+
+ // increase also the grid size
+ const int diff = newIconSize - oldIconSize;
+ settings->setItemWidth(settings->itemWidth() + diff);
+ settings->setItemHeight(settings->itemHeight() + diff);
+
+ const int infoCount = m_controller->dolphinView()->additionalInfo().count();
+ updateGridSize(showPreview, infoCount);
+ }
+}
+
+void DolphinIconsView::zoomOut()
+{
+ if (isZoomOutPossible()) {
+ IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
+
+ const int oldIconSize = settings->iconSize();
+ int newIconSize = oldIconSize;
+
+ const bool showPreview = m_controller->dolphinView()->showPreview();
+ if (showPreview) {
+ const int previewSize = decreasedIconSize(settings->previewSize());
+ settings->setPreviewSize(previewSize);
+ if (settings->iconSize() > previewSize) {
+ // assure that the icon size is always <= the preview size
+ newIconSize = previewSize;
+ settings->setIconSize(newIconSize);
+ }
+ } else {
+ newIconSize = decreasedIconSize(settings->iconSize());
+ settings->setIconSize(newIconSize);
+ }
+
+ // decrease also the grid size
+ const int diff = oldIconSize - newIconSize;
+ settings->setItemWidth(settings->itemWidth() - diff);
+ settings->setItemHeight(settings->itemHeight() - diff);
+
+ const int infoCount = m_controller->dolphinView()->additionalInfo().count();
+ updateGridSize(showPreview, infoCount);