]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge remote-tracking branch 'origin/KDE/4.12'
authorFrank Reininghaus <frank78ac@googlemail.com>
Sun, 29 Dec 2013 08:50:17 +0000 (09:50 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Sun, 29 Dec 2013 08:50:17 +0000 (09:50 +0100)
src/views/dolphinviewactionhandler.cpp
src/views/dolphinviewactionhandler.h

index 9a9718c3336869693105866c5622200ad0c508b4..051174f6dbb25d787ca24151e73199f57021adc2 100644 (file)
@@ -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");
index edbe41b9009d9a04cf86ddb65b221be98aaa83e1..e80ffc0dffb426b1882ec302aca99cc90fce6bc3 100644 (file)
@@ -196,6 +196,11 @@ private Q_SLOTS:
      */
     void slotHiddenFilesShownChanged(bool shown);
 
+    /**
+     * Updates the state of the 'Create Folder...' action.
+     */
+    void slotWriteStateChanged(bool isFolderWritable);
+
     /**
      * Opens the view properties dialog, which allows to modify the properties
      * of the currently active view.