]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Disable all the 'create new' items when in the Trash
[dolphin.git] / src / dolphinmainwindow.cpp
index c63b395a309ddda9af11e1e6fbb511cee3727d2e..a0509ad47da00a77034288efb4653d427afd7897 100644 (file)
@@ -457,6 +457,10 @@ void DolphinMainWindow::updateNewMenu()
     m_newFileMenu->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
     m_newFileMenu->checkUpToDate();
     m_newFileMenu->setPopupFiles(activeViewContainer()->url());
+
+    // If we're in the trash, also disable all the 'create new' items
+    // TODO: remove this once https://phabricator.kde.org/T8234 is implemented
+    slotWriteStateChanged(m_activeViewContainer->view()->url().scheme() != QLatin1String("trash"));
 }
 
 void DolphinMainWindow::createDirectory()
@@ -804,7 +808,10 @@ void DolphinMainWindow::slotHandleUrlStatFinished(KJob* job)
 
 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable)
 {
-    newFileMenu()->setEnabled(isFolderWritable);
+    const auto actions = m_newFileMenu->menu()->actions();
+    for (auto menuItem : actions) {
+        menuItem->setEnabled(isFolderWritable);
+    }
 }
 
 void DolphinMainWindow::openContextMenu(const QPoint& pos,