]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/selectionmode/bottombarcontentscontainer.cpp
Add missing KF6::ColorScheme link
[dolphin.git] / src / selectionmode / bottombarcontentscontainer.cpp
index 4619bcae0703fe29a9063ecf99f294ab547f8910..0e3087a9c52f2b571a2af065a8d4a6ed4e81ee31 100644 (file)
@@ -1,6 +1,6 @@
 /*
     This file is part of the KDE project
-    SPDX-FileCopyrightText: 2022 Felix Ernst <felixernst@zohomail.eu>
+    SPDX-FileCopyrightText: 2022 Felix Ernst <felixernst@kde.org>
 
     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
 */
@@ -166,7 +166,7 @@ void BottomBarContentsContainer::addCopyContents()
 
     auto *copyButton = new QPushButton(this);
     // We claim to have PasteContents already so triggering the copy action next won't instantly hide the bottom bar.
-    connect(copyButton, &QAbstractButton::clicked, [this]() {
+    connect(copyButton, &QAbstractButton::clicked, this, [this]() {
         if (GeneralSettings::showPasteBarAfterCopying()) {
             m_contents = BottomBar::Contents::PasteContents; // prevents hiding
         }
@@ -174,7 +174,7 @@ void BottomBarContentsContainer::addCopyContents()
     // Connect the copy action as a second step.
     m_mainAction = ActionWithWidget(m_actionCollection->action(KStandardAction::name(KStandardAction::Copy)), copyButton);
     // Finally connect the lambda that actually changes the contents to the PasteContents.
-    connect(copyButton, &QAbstractButton::clicked, [this]() {
+    connect(copyButton, &QAbstractButton::clicked, this, [this]() {
         if (GeneralSettings::showPasteBarAfterCopying()) {
             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.
@@ -244,7 +244,7 @@ void BottomBarContentsContainer::addCutContents()
 
     auto *cutButton = new QPushButton(this);
     // We claim to have PasteContents already so triggering the cut action next won't instantly hide the bottom bar.
-    connect(cutButton, &QAbstractButton::clicked, [this]() {
+    connect(cutButton, &QAbstractButton::clicked, this, [this]() {
         if (GeneralSettings::showPasteBarAfterCopying()) {
             m_contents = BottomBar::Contents::PasteContents; // prevents hiding
         }
@@ -252,7 +252,7 @@ void BottomBarContentsContainer::addCutContents()
     // Connect the cut action as a second step.
     m_mainAction = ActionWithWidget(m_actionCollection->action(KStandardAction::name(KStandardAction::Cut)), cutButton);
     // Finally connect the lambda that actually changes the contents to the PasteContents.
-    connect(cutButton, &QAbstractButton::clicked, [this]() {
+    connect(cutButton, &QAbstractButton::clicked, this, [this]() {
         if (GeneralSettings::showPasteBarAfterCopying()) {
             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.
@@ -483,7 +483,9 @@ std::vector<QAction *> BottomBarContentsContainer::contextActionsFor(const KFile
     if (selectedItems.isEmpty()) {
         // There are no contextual actions to show for these items.
         // We might even want to hide this bar in this case. To make this clear, we reset m_internalContextMenu.
-        m_internalContextMenu.release()->deleteLater();
+        if (m_internalContextMenu) {
+            m_internalContextMenu.release()->deleteLater();
+        }
         return std::vector<QAction *>{};
     }
 
@@ -660,3 +662,5 @@ void BottomBarContentsContainer::updateMainActionButton(const KFileItemList& sel
     }
 }
 // clang-format on
+
+#include "moc_bottombarcontentscontainer.cpp"