diff options
| author | Frank Reininghaus <[email protected]> | 2013-12-29 09:23:17 +0100 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-12-29 09:23:17 +0100 |
| commit | 280fa647f15faf8fdd415328d7ff1fd15c621fc9 (patch) | |
| tree | 5dc16e889b75e72d36a1ad2e2a3cf98bd6003c95 /src/views/dolphinviewactionhandler.cpp | |
| parent | c2108b122e2708245907d9f779f164721bcb3653 (diff) | |
Disable the "Create folder" action in read-only directories
The action can be triggered, e.g., by pressing F10.
BUG: 294054
FIXED-IN: 4.12.1
REVIEW: 114560
Diffstat (limited to 'src/views/dolphinviewactionhandler.cpp')
| -rw-r--r-- | src/views/dolphinviewactionhandler.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 9a9718c33..051174f6d 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -84,6 +84,8 @@ void DolphinViewActionHandler::setCurrentView(DolphinView* view) this, SLOT(slotSortRoleChanged(QByteArray))); connect(view, SIGNAL(zoomLevelChanged(int,int)), this, SLOT(slotZoomLevelChanged(int,int))); + connect(view, SIGNAL(writeStateChanged(bool)), + this, SLOT(slotWriteStateChanged(bool))); } DolphinView* DolphinViewActionHandler::currentView() @@ -99,6 +101,7 @@ void DolphinViewActionHandler::createActions() newDirAction->setText(i18nc("@action", "Create Folder...")); newDirAction->setShortcut(Qt::Key_F10); newDirAction->setIcon(KIcon("folder-new")); + newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable connect(newDirAction, SIGNAL(triggered()), this, SIGNAL(createDirectory())); // File menu @@ -482,6 +485,11 @@ void DolphinViewActionHandler::slotHiddenFilesShownChanged(bool shown) showHiddenFilesAction->setChecked(shown); } +void DolphinViewActionHandler::slotWriteStateChanged(bool isFolderWritable) +{ + m_actionCollection->action("create_dir")->setEnabled(isFolderWritable); +} + KToggleAction* DolphinViewActionHandler::iconsModeAction() { KToggleAction* iconsView = m_actionCollection->add<KToggleAction>("icons"); |
