┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinviewcontainer.cpp
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2022-04-24 02:34:43 +0200
committerFelix Ernst <[email protected]>2022-08-14 14:42:40 +0000
commit402b4a5698f3d12d1848b298c38828d509abfd0d (patch)
tree20ce1bccd0f1a92fcdeaef47c745f719b8840558 /src/dolphinviewcontainer.cpp
parent3b7c05b385dc56fbc0b9ffdd332f8d30e7624d0c (diff)
Keep working towards a reviewable state
- Various code improvements - Smoother animations - The bottom bar in General Mode only becomes visible if items are currently selected - Removed the selection mode action from the default toolbar since it can already be toggled in various ways - More documentation - Some cleaning
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
-rw-r--r--src/dolphinviewcontainer.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp
index dd72a6d66..d45096d0b 100644
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -42,8 +42,6 @@
#include <QUrl>
#include <QDesktopServices>
-#include <iostream>
-
// An overview of the widgets contained by this ViewContainer
struct LayoutStructure {
int searchBox = 0;
@@ -377,7 +375,6 @@ void DolphinViewContainer::disconnectUrlNavigator()
void DolphinViewContainer::setSelectionModeEnabled(bool enabled, KActionCollection *actionCollection, SelectionModeBottomBar::Contents bottomBarContents)
{
- std::cout << "DolphinViewContainer::setSelectionModeEnabled(" << enabled << ", " << bottomBarContents << ")\n";
const bool wasEnabled = m_view->selectionMode();
m_view->setSelectionMode(enabled);
@@ -410,7 +407,6 @@ void DolphinViewContainer::setSelectionModeEnabled(bool enabled, KActionCollecti
connect(m_view, &DolphinView::selectionChanged, this, [this](const KFileItemList &selection) {
m_selectionModeBottomBar->slotSelectionChanged(selection, m_view->url());
});
-
connect(m_selectionModeBottomBar, &SelectionModeBottomBar::error, this, [this](const QString &errorMessage) {
showErrorMessage(errorMessage);
});
@@ -434,8 +430,15 @@ void DolphinViewContainer::setSelectionModeEnabled(bool enabled, KActionCollecti
bool DolphinViewContainer::isSelectionModeEnabled() const
{
const bool isEnabled = m_view->selectionMode();
- Q_ASSERT( !isEnabled // We cannot assert the invisibility of the bars because of the hide animation.
- || ( isEnabled && m_selectionModeTopBar && m_selectionModeTopBar->isVisible() && m_selectionModeBottomBar && m_selectionModeBottomBar->isVisible()));
+ Q_ASSERT((!isEnabled
+ // We can't assert that the bars are invisible only because the selection mode is disabled because the hide animation might still be playing.
+ && (!m_selectionModeBottomBar || !m_selectionModeBottomBar->isEnabled() ||
+ !m_selectionModeBottomBar->isVisible() || m_selectionModeBottomBar->contents() == SelectionModeBottomBar::PasteContents))
+ || ( isEnabled
+ && m_selectionModeTopBar && m_selectionModeTopBar->isVisible()
+ // The bottom bar is either visible or was hidden because it has nothing to show in GeneralContents mode e.g. because no items are selected.
+ && m_selectionModeBottomBar
+ && (m_selectionModeBottomBar->isVisible() || m_selectionModeBottomBar->contents() == SelectionModeBottomBar::GeneralContents)));
return isEnabled;
}