]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinview.cpp
dolphinview: Fix right click broken on placeholderLabel
[dolphin.git] / src / views / dolphinview.cpp
index e8603858f9e03c1fd4edb89c365c256166768796..d16aa3b09207631afe265b7d429ccba98dd39aea 100644 (file)
@@ -161,6 +161,10 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
     auto *centeringLayout = new QVBoxLayout(m_container);
     centeringLayout->addWidget(m_placeholderLabel);
     centeringLayout->setAlignment(m_placeholderLabel, Qt::AlignCenter);
+    m_placeholderLabel->setContextMenuPolicy(Qt::CustomContextMenu);
+    connect(m_placeholderLabel, &QWidget::customContextMenuRequested, this, [this](const QPoint& pos){
+        slotViewContextMenuRequested(m_placeholderLabel->mapToGlobal(pos));
+    });
 
     controller->setSelectionBehavior(KItemListController::MultiSelection);
     connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated);
@@ -195,6 +199,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
     connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection);
     connect(m_model, &KFileItemModel::urlIsFileError,            this, &DolphinView::urlIsFileError);
     connect(m_model, &KFileItemModel::fileItemsChanged,            this, &DolphinView::fileItemsChanged);
+    connect(m_model, &KFileItemModel::currentDirectoryRemoved, this, &DolphinView::currentDirectoryRemoved);
 
     connect(this, &DolphinView::itemCountChanged,
             this, &DolphinView::updatePlaceholderLabel);
@@ -1906,8 +1911,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
 #ifndef Q_OS_WIN
             //Confirm hiding file/directory by renaming inline
             if (!hiddenFilesShown() && newName.startsWith(QLatin1Char('.')) && !oldItem.name().startsWith(QLatin1Char('.'))) {
-                KGuiItem yesGuiItem(KStandardGuiItem::yes());
-                yesGuiItem.setText(i18nc("@action:button", "Rename and Hide"));
+                KGuiItem yesGuiItem(i18nc("@action:button", "Rename and Hide"), QStringLiteral("view-hidden"));
 
 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
                 const auto code = KMessageBox::questionTwoActions(this,
@@ -2264,6 +2268,8 @@ void DolphinView::updatePlaceholderLabel()
         m_placeholderLabel->setText(i18n("No relevant network resources found"));
     } else if (m_url.scheme() == QLatin1String("mtp") && m_url.path() == QLatin1String("/")) {
         m_placeholderLabel->setText(i18n("No MTP-compatible devices found"));
+    } else if (m_url.scheme() == QLatin1String("afc") && m_url.path() == QLatin1String("/")) {
+        m_placeholderLabel->setText(i18n("No Apple devices found"));
     } else if (m_url.scheme() == QLatin1String("bluetooth")) {
         m_placeholderLabel->setText(i18n("No Bluetooth devices found"));
     } else {