From 27370dc43a2f976917c07db600e1d22781625db8 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 19 Aug 2023 17:44:08 +0900 Subject: konqueror: extend 'double click to move to parent' functinality to iconview mode as well Signed-off-by: Michele Calgaro (cherry picked from commit bfb2c13ee37585256a4a9e78989f68376cd28e34) --- konqueror/iconview/konq_iconview.cpp | 35 +++++++++++++++++++++++++++-------- konqueror/iconview/konq_iconview.h | 1 + 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/konqueror/iconview/konq_iconview.cpp b/konqueror/iconview/konq_iconview.cpp index 6a701e01f..396e7d301 100644 --- a/konqueror/iconview/konq_iconview.cpp +++ b/konqueror/iconview/konq_iconview.cpp @@ -348,8 +348,6 @@ KonqKfmIconView::KonqKfmIconView( TQWidget *parentWidget, TQObject *parent, cons this, TQT_SLOT( slotMouseButtonClicked(int, TQIconViewItem*, const TQPoint&)) ); connect( m_pIconView, TQT_SIGNAL( contextMenuRequested(TQIconViewItem*, const TQPoint&)), this, TQT_SLOT( slotContextMenuRequested(TQIconViewItem*, const TQPoint&)) ); - connect( m_pIconView, TQT_SIGNAL( mouseDoubleClicked(TQIconViewItem*)), - this, TQT_SLOT( slotDoubleClicked(TQIconViewItem*)) ); // Signals needed to implement the spring loading folders behavior connect( m_pIconView, TQT_SIGNAL( held( TQIconViewItem * ) ), @@ -412,6 +410,8 @@ KonqKfmIconView::KonqKfmIconView( TQWidget *parentWidget, TQObject *parent, cons // m_pIconView->calculateGridX(); setViewMode( mode ); + + m_pActivateDoubleClickTimer = new TQTimer(this); } KonqKfmIconView::~KonqKfmIconView() @@ -869,21 +869,40 @@ void KonqKfmIconView::slotMouseButtonPressed(int _button, TQIconViewItem* _item, void KonqKfmIconView::slotMouseButtonClicked(int _button, TQIconViewItem* _item, const TQPoint& ) { - if( _button == Qt::MidButton ) + if (_button == Qt::MidButton) + { mmbClicked( _item ? static_cast(_item)->item() : 0L ); + } + else if (!_item && _button == Qt::LeftButton) + { + if (m_pActivateDoubleClickTimer->isActive()) + { + m_pActivateDoubleClickTimer->stop(); + slotDoubleClicked(_item); + } + else + { + m_pActivateDoubleClickTimer->start(TQApplication::doubleClickInterval(), true); + } + } } void KonqKfmIconView::slotDoubleClicked(TQIconViewItem *_item) { - if (!_item) + if (!_item && KonqFMSettings::settings()->doubleClickMoveToParent()) { KParts::URLArgs args; args.trustedSource = true; - KURL upURL = m_dirLister->url().upURL(); + KURL baseURL(m_dirLister->url().internalReferenceURL()); + if (baseURL.isEmpty()) + { + baseURL = m_dirLister->url(); + } + KURL upURL = baseURL.upURL(); if (!upURL.isEmpty()) - { - m_extension->openURLRequest(upURL, args); - } + { + m_extension->openURLRequest(upURL, args); + } } } diff --git a/konqueror/iconview/konq_iconview.h b/konqueror/iconview/konq_iconview.h index 777b07b8a..dd8d54fec 100644 --- a/konqueror/iconview/konq_iconview.h +++ b/konqueror/iconview/konq_iconview.h @@ -224,6 +224,7 @@ protected: KonqIconViewWidget *m_pIconView; TQTimer *m_pTimeoutRefreshTimer; + TQTimer *m_pActivateDoubleClickTimer; TQPtrDict m_itemDict; // maps KFileItem * -> KFileIVI * -- cgit v1.2.1