From 2e588733c759cccd2d86e34a3a394b9a8ab0c800 Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Thu, 28 Apr 2022 22:55:28 +0200 Subject: Improve naming consistency and leave mode on Escape --- src/selectionmode/bottombar.cpp | 4 ++-- src/selectionmode/bottombar.h | 2 +- src/selectionmode/bottombarcontentscontainer.cpp | 24 ++++++++++++------------ src/selectionmode/bottombarcontentscontainer.h | 2 +- src/selectionmode/selectionmodebottombar.h | 0 src/selectionmode/selectionmodetopbar.h | 0 src/selectionmode/topbar.cpp | 2 +- src/selectionmode/topbar.h | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 src/selectionmode/selectionmodebottombar.h create mode 100644 src/selectionmode/selectionmodetopbar.h (limited to 'src/selectionmode') diff --git a/src/selectionmode/bottombar.cpp b/src/selectionmode/bottombar.cpp index 4ca184a6d..529384435 100644 --- a/src/selectionmode/bottombar.cpp +++ b/src/selectionmode/bottombar.cpp @@ -52,7 +52,7 @@ BottomBar::BottomBar(KActionCollection *actionCollection, QWidget *parent) : } setVisibleInternal(visible, WithAnimation); }); - connect(m_contentsContainer, &BottomBarContentsContainer::leaveSelectionModeRequested, this, &BottomBar::leaveSelectionModeRequested); + connect(m_contentsContainer, &BottomBarContentsContainer::selectionModeLeavingRequested, this, &BottomBar::selectionModeLeavingRequested); BackgroundColorHelper::instance()->controlBackgroundColor(this); } @@ -114,7 +114,7 @@ void BottomBar::slotSplitTabDisabled() switch (contents()) { case CopyToOtherViewContents: case MoveToOtherViewContents: - Q_EMIT leaveSelectionModeRequested(); + Q_EMIT selectionModeLeavingRequested(); default: return; } diff --git a/src/selectionmode/bottombar.h b/src/selectionmode/bottombar.h index ab29a85a5..8d33e5ac1 100644 --- a/src/selectionmode/bottombar.h +++ b/src/selectionmode/bottombar.h @@ -100,7 +100,7 @@ Q_SIGNALS: */ void error(const QString &errorMessage); - void leaveSelectionModeRequested(); + void selectionModeLeavingRequested(); protected: /** Is installed on an internal widget to make sure that the height of the bar is adjusted to its contents. */ diff --git a/src/selectionmode/bottombarcontentscontainer.cpp b/src/selectionmode/bottombarcontentscontainer.cpp index 2c924415a..0358c6ded 100644 --- a/src/selectionmode/bottombarcontentscontainer.cpp +++ b/src/selectionmode/bottombarcontentscontainer.cpp @@ -158,7 +158,7 @@ void BottomBarContentsContainer::addCopyContents() // i18n: Aborts the current step-by-step process to copy files by leaving the selection mode. auto *cancelButton = new QPushButton(i18nc("@action:button", "Abort Copying"), this); - connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::leaveSelectionModeRequested); + connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::selectionModeLeavingRequested); m_layout->addWidget(cancelButton); auto *copyButton = new QPushButton(this); @@ -176,7 +176,7 @@ void BottomBarContentsContainer::addCopyContents() resetContents(BottomBar::Contents::PasteContents); // resetContents() needs to be connected last because // it instantly deletes the button and then the other slots won't be called. } - Q_EMIT leaveSelectionModeRequested(); + Q_EMIT selectionModeLeavingRequested(); }); updateMainActionButton(KFileItemList()); m_layout->addWidget(copyButton); @@ -191,7 +191,7 @@ void BottomBarContentsContainer::addCopyLocationContents() // i18n: Aborts the current step-by-step process to copy the location of files by leaving the selection mode. auto *cancelButton = new QPushButton(i18nc("@action:button", "Abort Copying"), this); - connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::leaveSelectionModeRequested); + connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::selectionModeLeavingRequested); m_layout->addWidget(cancelButton); auto *copyLocationButton = new QPushButton(this); @@ -210,7 +210,7 @@ void BottomBarContentsContainer::addCopyToOtherViewContents() // i18n: Aborts the current step-by-step process to copy the location of files by leaving the selection mode. auto *cancelButton = new QPushButton(i18nc("@action:button", "Abort Copying"), this); - connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::leaveSelectionModeRequested); + connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::selectionModeLeavingRequested); m_layout->addWidget(cancelButton); auto *copyToOtherViewButton = new QPushButton(this); @@ -228,7 +228,7 @@ void BottomBarContentsContainer::addCutContents() // i18n: Aborts the current step-by-step process to cut files by leaving the selection mode. auto *cancelButton = new QPushButton(i18nc("@action:button", "Abort Cutting"), this); - connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::leaveSelectionModeRequested); + connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::selectionModeLeavingRequested); m_layout->addWidget(cancelButton); auto *cutButton = new QPushButton(this); @@ -246,7 +246,7 @@ void BottomBarContentsContainer::addCutContents() resetContents(BottomBar::Contents::PasteContents); // resetContents() needs to be connected last because // it instantly deletes the button and then the other slots won't be called. } - Q_EMIT leaveSelectionModeRequested(); + Q_EMIT selectionModeLeavingRequested(); }); updateMainActionButton(KFileItemList()); m_layout->addWidget(cutButton); @@ -261,7 +261,7 @@ void BottomBarContentsContainer::addDeleteContents() // i18n: Aborts the current step-by-step process to delete files by leaving the selection mode. auto *cancelButton = new QPushButton(i18nc("@action:button", "Abort"), this); - connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::leaveSelectionModeRequested); + connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::selectionModeLeavingRequested); m_layout->addWidget(cancelButton); auto *deleteButton = new QPushButton(this); @@ -279,7 +279,7 @@ void BottomBarContentsContainer::addDuplicateContents() // i18n: Aborts the current step-by-step process to duplicate files by leaving the selection mode. auto *cancelButton = new QPushButton(i18nc("@action:button", "Abort Duplicating"), this); - connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::leaveSelectionModeRequested); + connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::selectionModeLeavingRequested); m_layout->addWidget(cancelButton); auto *duplicateButton = new QPushButton(this); @@ -349,7 +349,7 @@ void BottomBarContentsContainer::addMoveToOtherViewContents() // i18n: Aborts the current step-by-step process to copy the location of files by leaving the selection mode. auto *cancelButton = new QPushButton(i18nc("@action:button", "Abort Moving"), this); - connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::leaveSelectionModeRequested); + connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::selectionModeLeavingRequested); m_layout->addWidget(cancelButton); auto *moveToOtherViewButton = new QPushButton(this); @@ -367,7 +367,7 @@ void BottomBarContentsContainer::addMoveToTrashContents() // i18n: Aborts the current step-by-step process of moving files to the trash by leaving the selection mode. auto *cancelButton = new QPushButton(i18nc("@action:button", "Abort"), this); - connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::leaveSelectionModeRequested); + connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::selectionModeLeavingRequested); m_layout->addWidget(cancelButton); auto *moveToTrashButton = new QPushButton(this); @@ -393,7 +393,7 @@ void BottomBarContentsContainer::addPasteContents() * So we first have to claim that we have different contents before requesting to leave selection mode. */ auto actuallyLeaveSelectionMode = [this]() { m_contents = BottomBar::Contents::CopyLocationContents; - Q_EMIT leaveSelectionModeRequested(); + Q_EMIT selectionModeLeavingRequested(); }; auto *pasteButton = new QPushButton(this); @@ -428,7 +428,7 @@ void BottomBarContentsContainer::addRenameContents() // i18n: Aborts the current step-by-step process to delete files by leaving the selection mode. auto *cancelButton = new QPushButton(i18nc("@action:button", "Stop Renaming"), this); - connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::leaveSelectionModeRequested); + connect(cancelButton, &QAbstractButton::clicked, this, &BottomBarContentsContainer::selectionModeLeavingRequested); m_layout->addWidget(cancelButton); auto *renameButton = new QPushButton(this); diff --git a/src/selectionmode/bottombarcontentscontainer.h b/src/selectionmode/bottombarcontentscontainer.h index b9d7947ae..aa335a5bf 100644 --- a/src/selectionmode/bottombarcontentscontainer.h +++ b/src/selectionmode/bottombarcontentscontainer.h @@ -78,7 +78,7 @@ Q_SIGNALS: */ void barVisibilityChangeRequested(bool visible); - void leaveSelectionModeRequested(); + void selectionModeLeavingRequested(); private: void addCopyContents(); diff --git a/src/selectionmode/selectionmodebottombar.h b/src/selectionmode/selectionmodebottombar.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/selectionmode/selectionmodetopbar.h b/src/selectionmode/selectionmodetopbar.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/selectionmode/topbar.cpp b/src/selectionmode/topbar.cpp index 51467cd99..0a5d3f2cf 100644 --- a/src/selectionmode/topbar.cpp +++ b/src/selectionmode/topbar.cpp @@ -70,7 +70,7 @@ TopBar::TopBar(QWidget *parent) : m_closeButton->setAccessibleName(m_closeButton->toolTip()); m_closeButton->setFlat(true); connect(m_closeButton, &QAbstractButton::pressed, - this, &TopBar::leaveSelectionModeRequested); + this, &TopBar::selectionModeLeavingRequested); QHBoxLayout *layout = new QHBoxLayout(contentsContainer); auto contentsMargins = layout->contentsMargins(); diff --git a/src/selectionmode/topbar.h b/src/selectionmode/topbar.h index 10a65cba0..b7374ff3b 100644 --- a/src/selectionmode/topbar.h +++ b/src/selectionmode/topbar.h @@ -42,7 +42,7 @@ public: void setVisible(bool visible, Animated animated); Q_SIGNALS: - void leaveSelectionModeRequested(); + void selectionModeLeavingRequested(); protected: /** Calls updateLabelString() */ -- cgit v1.3