X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/3ccdcc2176bc5e4e03f733c21d05a5a4b0c1af25..4d81aabd1ee78c2fca61452ef3a866cfad0c88a5:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index d383d04d6..305c7f282 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -42,7 +42,12 @@ #include #include #include +#include +#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) +#include +#else #include +#endif #include #include #include @@ -810,7 +815,6 @@ void DolphinMainWindow::slotAboutToShowBackPopupMenu() m_backAction->menu()->clear(); for (int i = urlNavigator->historyIndex() + 1; i < urlNavigator->historySize() && entries < MaxNumberOfNavigationentries; ++i, ++entries) { QAction *action = urlNavigatorHistoryAction(urlNavigator, i, m_backAction->menu()); - action->setData(i); m_backAction->menu()->addAction(action); } } @@ -839,7 +843,6 @@ void DolphinMainWindow::slotAboutToShowForwardPopupMenu() m_forwardAction->menu()->clear(); for (int i = urlNavigator->historyIndex() - 1; i >= 0 && entries < MaxNumberOfNavigationentries; --i, ++entries) { QAction *action = urlNavigatorHistoryAction(urlNavigator, i, m_forwardAction->menu()); - action->setData(i); m_forwardAction->menu()->addAction(action); } } @@ -1243,7 +1246,11 @@ void DolphinMainWindow::handleUrl(const QUrl& url) activeViewContainer()->setUrl(url); } else { m_lastHandleUrlOpenJob = new KIO::OpenUrlJob(url); +#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) + m_lastHandleUrlOpenJob->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); +#else m_lastHandleUrlOpenJob->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); +#endif m_lastHandleUrlOpenJob->setShowOpenOrExecuteDialog(true); connect(m_lastHandleUrlOpenJob, &KIO::OpenUrlJob::mimeTypeFound, this, @@ -1433,6 +1440,10 @@ void DolphinMainWindow::activeViewChanged(DolphinViewContainer* viewContainer) // except the requestItemInfo so that on hover the information panel can still be updated connect(oldViewContainer->view(), &DolphinView::requestItemInfo, this, &DolphinMainWindow::requestItemInfo); + + // Disconnect other slots. + disconnect(nullptr, &DolphinViewContainer::selectionModeChanged, + actionCollection()->action(QStringLiteral("toggle_selection_mode")), &QAction::setChecked); } connectViewSignals(viewContainer); @@ -2286,13 +2297,6 @@ void DolphinMainWindow::updateViewActions() { m_actionHandler->updateViewActions(); - QAction *toggleSelectionModeAction = actionCollection()->action(QStringLiteral("toggle_selection_mode")); - disconnect(nullptr, &DolphinViewContainer::selectionModeChanged, - toggleSelectionModeAction, &QAction::setChecked); - toggleSelectionModeAction->setChecked(m_activeViewContainer->isSelectionModeEnabled()); - connect(m_activeViewContainer, &DolphinViewContainer::selectionModeChanged, - toggleSelectionModeAction, &QAction::setChecked); - QAction* toggleFilterBarAction = actionCollection()->action(QStringLiteral("toggle_filter")); toggleFilterBarAction->setChecked(m_activeViewContainer->isFilterBarVisible()); @@ -2350,6 +2354,12 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) const QAction* toggleSearchAction = actionCollection()->action(QStringLiteral("toggle_search")); connect(toggleSearchAction, &QAction::triggered, container, &DolphinViewContainer::setSearchModeEnabled); + // Make the toggled state of the selection mode actions visually follow the selection mode state of the view. + auto toggleSelectionModeAction = actionCollection()->action(QStringLiteral("toggle_selection_mode")); + toggleSelectionModeAction->setChecked(m_activeViewContainer->isSelectionModeEnabled()); + connect(m_activeViewContainer, &DolphinViewContainer::selectionModeChanged, + toggleSelectionModeAction, &QAction::setChecked); + const DolphinView* view = container->view(); connect(view, &DolphinView::selectionChanged, this, &DolphinMainWindow::slotSelectionChanged); @@ -2670,7 +2680,7 @@ bool DolphinMainWindow::isUrlOpen(const QString &url) return m_tabWidget->isUrlOpen(QUrl::fromUserInput(url)); } -bool DolphinMainWindow::isUrlOrParentOpen(const QString &url) +bool DolphinMainWindow::isItemVisibleInAnyView(const QString &urlOfItem) { - return m_tabWidget->isUrlOrParentOpen(QUrl::fromUserInput(url)); + return m_tabWidget->isItemVisibleInAnyView(QUrl::fromUserInput(urlOfItem)); }