From kde-commits Sun Sep 05 07:14:27 2010 From: =?utf-8?q?Aaron=20J=2E=20Seigo?= Date: Sun, 05 Sep 2010 07:14:27 +0000 To: kde-commits Subject: KDE/kdebase/apps/plasma/applets/folderview Message-Id: <20100905071427.1FF88AC884 () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=128367063413833 SVN commit 1171792 by aseigo: allow iconviews to be configured as to wether folder drill-down should be triggered by click or hover; this is use to allow the drill down to be started with a mouse click and then further drill down to be on hover only. M +5 -0 actionoverlay.cpp M +18 -0 iconview.cpp M +3 -0 iconview.h M +1 -0 popupview.cpp --- trunk/KDE/kdebase/apps/plasma/applets/folderview/actionoverlay.cpp #1171791:1171792 @@ -213,9 +213,14 @@ fadeIn->start(); } m_hoverIndex = index; + IconView *iview = qobject_cast(view); + if (iview && iview->clickToViewFolders()) { AsyncFileTester::checkIfFolder(index, this, "checkIfFolderResult"); + } else { + m_openButton->hide(); } } +} void ActionOverlay::checkIfFolderResult(const QModelIndex &index, bool isFolder) { --- trunk/KDE/kdebase/apps/plasma/applets/folderview/iconview.cpp #1171791:1171792 @@ -79,6 +79,7 @@ m_wordWrap(false), m_popupShowPreview(true), m_folderIsEmpty(false), + m_clickToViewFolders(true), m_flow(layoutDirection() == Qt::LeftToRight ? LeftToRight : RightToLeft), m_popupCausedWidget(0), m_dropOperation(0), @@ -1588,7 +1589,10 @@ emit entered(index); m_hoveredIndex = index; markAreaDirty(visualRect(index)); + if (!m_clickToViewFolders) { + AsyncFileTester::checkIfFolder(m_hoveredIndex, this, "checkIfFolderResult"); } + } updateToolTip(); } @@ -1620,8 +1624,12 @@ markAreaDirty(visualRect(m_hoveredIndex)); m_hoveredIndex = index; updateToolTip(); + + if (!m_clickToViewFolders) { + AsyncFileTester::checkIfFolder(m_hoveredIndex, this, "checkIfFolderResult"); } } +} void IconView::keyPressEvent(QKeyEvent *event) { @@ -2563,6 +2571,16 @@ } } +void IconView::setClickToViewFolders(bool click) +{ + m_clickToViewFolders = click; +} + +bool IconView::clickToViewFolders() const +{ + return m_clickToViewFolders; +} + void IconView::openPopup(const QModelIndex &index) { if (m_popupView && m_popupIndex == index) { --- trunk/KDE/kdebase/apps/plasma/applets/folderview/iconview.h #1171791:1171792 @@ -120,6 +120,8 @@ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + void setClickToViewFolders(bool click); + bool clickToViewFolders() const; void openPopup(const QModelIndex &index); signals: @@ -230,6 +232,7 @@ bool m_wordWrap; bool m_popupShowPreview; bool m_folderIsEmpty; + bool m_clickToViewFolders; QPersistentModelIndex m_hoveredIndex; QPersistentModelIndex m_pressedIndex; QPersistentModelIndex m_editorIndex; --- trunk/KDE/kdebase/apps/plasma/applets/folderview/popupview.cpp #1171791:1171792 @@ -208,6 +208,7 @@ m_iconView->setGridSize(m_parentView->gridSize()); m_iconView->setWordWrap(m_parentView->wordWrap()); m_iconView->setIconsMoveable(false); + m_iconView->setClickToViewFolders(false); connect(m_iconView, SIGNAL(activated(QModelIndex)), SLOT(activated(QModelIndex))); connect(m_iconView, SIGNAL(contextMenuRequest(QWidget*,QPoint)), SLOT(contextMenuRequest(QWidget*,QPoint)));