X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/8e55f2c2409fd6ca9ebc66a6568f4d3bcbef7576..aa748158342da7acd1bc485aa36534e9f7dde151:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index c801d095d..f38995603 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -376,16 +376,17 @@ void DolphinViewContainer::disconnectUrlNavigator() void DolphinViewContainer::setSelectionModeEnabled(bool enabled, KActionCollection *actionCollection, SelectionMode::BottomBar::Contents bottomBarContents) { const bool wasEnabled = m_view->selectionMode(); - m_view->setSelectionMode(enabled); + m_view->setSelectionModeEnabled(enabled); if (!enabled) { + if (!wasEnabled) { + return; // nothing to do here + } Q_CHECK_PTR(m_selectionModeTopBar); // there is no point in disabling selectionMode when it wasn't even enabled once. Q_CHECK_PTR(m_selectionModeBottomBar); m_selectionModeTopBar->setVisible(false, WithAnimation); m_selectionModeBottomBar->setVisible(false, WithAnimation); - if (wasEnabled) { - Q_EMIT selectionModeChanged(false); - } + Q_EMIT selectionModeChanged(false); return; } @@ -396,7 +397,7 @@ void DolphinViewContainer::setSelectionModeEnabled(bool enabled, KActionCollecti }); m_selectionModeTopBar = new SelectionMode::TopBar(this); // will be created hidden - connect(m_selectionModeTopBar, &SelectionMode::TopBar::leaveSelectionModeRequested, this, [this]() { + connect(m_selectionModeTopBar, &SelectionMode::TopBar::selectionModeLeavingRequested, this, [this]() { setSelectionModeEnabled(false); }); m_topLayout->addWidget(m_selectionModeTopBar, positionFor.selectionModeTopBar, 0); @@ -410,7 +411,7 @@ void DolphinViewContainer::setSelectionModeEnabled(bool enabled, KActionCollecti connect(m_selectionModeBottomBar, &SelectionMode::BottomBar::error, this, [this](const QString &errorMessage) { showErrorMessage(errorMessage); }); - connect(m_selectionModeBottomBar, &SelectionMode::BottomBar::leaveSelectionModeRequested, this, [this]() { + connect(m_selectionModeBottomBar, &SelectionMode::BottomBar::selectionModeLeavingRequested, this, [this]() { setSelectionModeEnabled(false); }); m_topLayout->addWidget(m_selectionModeBottomBar, positionFor.selectionModeBottomBar, 0);