diff options
Diffstat (limited to 'src/dolphiniconsview.cpp')
| -rw-r--r-- | src/dolphiniconsview.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index d3d485f1a..ccf4cbfc5 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -23,7 +23,9 @@ #include "dolphincontroller.h" #include "dolphinsettings.h" #include "dolphin_iconsmodesettings.h" +#include "dolphin_generalsettings.h" #include "draganddrophelper.h" +#include "selectionmanager.h" #include <kcategorizedsortfilterproxymodel.h> #include <kdialog.h> @@ -33,6 +35,7 @@ #include <QApplication> #include <QPainter> #include <QPoint> +#include <QScrollBar> DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) : KCategorizedView(parent), @@ -64,6 +67,13 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle if (KGlobalSettings::singleClick()) { connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(triggerItem(const QModelIndex&))); + if (DolphinSettings::instance().generalSettings()->showSelectionToggle()) { + SelectionManager* selManager = new SelectionManager(this); + connect(selManager, SIGNAL(selectionChanged()), + this, SLOT(requestActivation())); + connect(m_controller, SIGNAL(urlChanged(const KUrl&)), + selManager, SLOT(reset())); + } } else { connect(this, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(triggerItem(const QModelIndex&))); @@ -285,6 +295,29 @@ void DolphinIconsView::keyPressEvent(QKeyEvent* event) } } +void DolphinIconsView::wheelEvent(QWheelEvent* event) +{ + // let Ctrl+wheel events propagate to the DolphinView for icon zooming + if ((event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) { + event->ignore(); + return; + } + KCategorizedView::wheelEvent(event); + // if the icons are aligned left to right, the vertical wheel event should + // be applied to the horizontal scrollbar + const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); + const bool scrollHorizontal = (event->orientation() == Qt::Vertical) && + (settings->arrangement() == QListView::LeftToRight); + if (scrollHorizontal) { + QWheelEvent horizEvent(event->pos(), + event->delta(), + event->buttons(), + event->modifiers(), + Qt::Horizontal); + QApplication::sendEvent(horizontalScrollBar(), &horizEvent); + } +} + void DolphinIconsView::triggerItem(const QModelIndex& index) { m_controller->triggerItem(itemForIndex(index)); @@ -369,6 +402,11 @@ void DolphinIconsView::zoomOut() } } +void DolphinIconsView::requestActivation() +{ + m_controller->requestActivation(); +} + bool DolphinIconsView::isZoomInPossible() const { IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); @@ -431,6 +469,7 @@ void DolphinIconsView::updateGridSize(bool showPreview, int additionalInfoCount) size = previewSize; } + setIconSize(QSize(size, size)); Q_ASSERT(additionalInfoCount >= 0); itemHeight += additionalInfoCount * m_font.pointSize() * 2; |
