From: Nathaniel Graham Date: Sun, 6 May 2018 20:06:16 +0000 (-0600) Subject: Disable all the 'create new' items when in the Trash X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/e133c4557ecc37ed3f7e1b9418306aa8cc516865?ds=sidebyside Disable all the 'create new' items when in the Trash Summary: Disable all the items in the 'create new' menu when the active view is in the trash, because they're not useful and don't even work. We don't disable the entire menu because it's useful to be able to see what specific things are disabled. This can be reverted once T8234 is implemented. BUG: 332463 FIXED-IN: 18.08.0 Test Plan: - Enter the trash with and without a split view; the 'create new' menu items are all disabled - Be looking at something other than the trash with and without a split view; the 'create new' menu items are all enabled - Toggle between split views (one in the trash, one elsewhere); menu is correct for both cases Out of the trash: {F5837042} In the trash: {F5837043} Reviewers: #dolphin, broulik, elvisangelaccio, markg Reviewed By: #dolphin, elvisangelaccio, markg Subscribers: markg, elvisangelaccio Differential Revision: https://phabricator.kde.org/D12731 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index c63b395a3..a0509ad47 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -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,