diff options
| author | Kai Uwe Broulik <[email protected]> | 2022-02-03 21:37:30 +0100 |
|---|---|---|
| committer | Kai Uwe Broulik <[email protected]> | 2022-02-07 07:29:35 +0000 |
| commit | e9bd295b3cce63048b141d1fdba844091419a973 (patch) | |
| tree | af1b7d2df96b4ed5d0e2dc215f320f872d489522 /src/panels/places/placespanel.cpp | |
| parent | 32c072fe5f78efbcb76187ed535190d3a0e869f3 (diff) | |
[Places Panel] Make use of KFilePlacesView::dragAutoActivationDelay
Code moved to KIO
Diffstat (limited to 'src/panels/places/placespanel.cpp')
| -rw-r--r-- | src/panels/places/placespanel.cpp | 62 |
1 files changed, 2 insertions, 60 deletions
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 5b2f040d1..81056fb9c 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -95,17 +95,9 @@ void PlacesPanel::proceedWithTearDown() void PlacesPanel::readSettings() { if (GeneralSettings::autoExpandFolders()) { - if (!m_dragActivationTimer) { - m_dragActivationTimer = new QTimer(this); - m_dragActivationTimer->setInterval(750); - m_dragActivationTimer->setSingleShot(true); - connect(m_dragActivationTimer, &QTimer::timeout, - this, &PlacesPanel::slotDragActivationTimeout); - } + setDragAutoActivationDelay(750); } else { - delete m_dragActivationTimer; - m_dragActivationTimer = nullptr; - m_pendingDragActivation = QPersistentModelIndex(); + setDragAutoActivationDelay(0); } const int iconSize = qMax(0, PlacesPanelSettings::iconSize()); @@ -135,46 +127,6 @@ void PlacesPanel::showEvent(QShowEvent* event) KFilePlacesView::showEvent(event); } -void PlacesPanel::dragMoveEvent(QDragMoveEvent *event) -{ - KFilePlacesView::dragMoveEvent(event); - - if (!m_dragActivationTimer) { - return; - } - - const QModelIndex index = indexAt(event->pos()); - if (!index.isValid()) { - return; - } - - QPersistentModelIndex persistentIndex(index); - if (!m_pendingDragActivation.isValid() || m_pendingDragActivation != persistentIndex) { - m_pendingDragActivation = persistentIndex; - m_dragActivationTimer->start(); - } -} - -void PlacesPanel::dragLeaveEvent(QDragLeaveEvent *event) -{ - KFilePlacesView::dragLeaveEvent(event); - - if (m_dragActivationTimer) { - m_dragActivationTimer->stop(); - m_pendingDragActivation = QPersistentModelIndex(); - } -} - -void PlacesPanel::dropEvent(QDropEvent *event) -{ - KFilePlacesView::dropEvent(event); - - if (m_dragActivationTimer) { - m_dragActivationTimer->stop(); - m_pendingDragActivation = QPersistentModelIndex(); - } -} - void PlacesPanel::slotConfigureTrash() { const QUrl url = currentIndex().data(KFilePlacesModel::UrlRole).toUrl(); @@ -185,16 +137,6 @@ void PlacesPanel::slotConfigureTrash() settingsDialog->show(); } -void PlacesPanel::slotDragActivationTimeout() -{ - if (!m_pendingDragActivation.isValid()) { - return; - } - - auto *placesModel = static_cast<KFilePlacesModel *>(model()); - Q_EMIT placeActivated(KFilePlacesModel::convertedUrl(placesModel->url(m_pendingDragActivation))); -} - void PlacesPanel::slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent) { KIO::DropJob *job = DragAndDropHelper::dropUrls(dest, event, parent); |
