]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Use KNewMenu::createDirectory() instead of KonqOperations::newDir() when F10 has...
authorPeter Penz <peter.penz19@gmail.com>
Thu, 26 Mar 2009 18:44:36 +0000 (18:44 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 26 Mar 2009 18:44:36 +0000 (18:44 +0000)
CCMAIL: rahman.duran@gmail.com

svn path=/trunk/KDE/kdebase/apps/; revision=945037

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/dolphinpart.cpp
src/dolphinpart.h
src/dolphinviewactionhandler.cpp
src/dolphinviewactionhandler.h

index c2939e59ae074de1587132dc6c97e8a4ffd21900..35bc8bb86338a348b58f51ff1e1d3f1c3ca6ee0d 100644 (file)
@@ -543,6 +543,12 @@ void DolphinMainWindow::updateNewMenu()
     m_newMenu->setPopupFiles(activeViewContainer()->url());
 }
 
+void DolphinMainWindow::createDirectory()
+{
+    m_newMenu->setPopupFiles(activeViewContainer()->url());
+    m_newMenu->createDirectory();
+}
+
 void DolphinMainWindow::quit()
 {
     close();
@@ -976,6 +982,7 @@ void DolphinMainWindow::init()
     setCaption(homeUrl.fileName());
     m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
     connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
+    connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
     ViewProperties props(homeUrl);
     m_viewTab[m_tabIndex].primaryView = new DolphinViewContainer(this,
                                                                  m_viewTab[m_tabIndex].splitter,
@@ -987,9 +994,9 @@ void DolphinMainWindow::init()
     view->reload();
     m_activeViewContainer->show();
     m_actionHandler->setCurrentView(view);
-    
+
     m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
-    connect(this, SIGNAL(urlChanged(const KUrl&)), 
+    connect(this, SIGNAL(urlChanged(const KUrl&)),
             m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
 
     m_tabBar = new KTabBar(this);
index 77fc36b58e5840648edc1642e291e93f9445f967..687eecddfefdf9eccc1333eb5d6b88ec4c68b739 100644 (file)
@@ -172,6 +172,8 @@ private slots:
     /** Updates the 'Create New...' sub menu. */
     void updateNewMenu();
 
+    void createDirectory();
+
     /** Shows the error message in the status bar of the active view. */
     void showErrorMessage(const QString& message);
 
index dd590efd53071d6ab6ba8ae8a84ea9372bd8d417..93bd3ce5ded04c68b06097d76affac046b1fc67f 100644 (file)
@@ -125,6 +125,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
 
     m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
     m_actionHandler->setCurrentView(m_view);
+    connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
 
     m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
     connect(this, SIGNAL(aboutToOpenURL()),
@@ -543,4 +544,10 @@ void DolphinPart::updateProgress(int percent)
     m_extension->loadingProgress(percent);
 }
 
+void DolphinPart::createDirectory()
+{
+    m_newMenu->setPopupFiles(url());
+    m_newMenu->createDirectory();
+}
+
 #include "dolphinpart.moc"
index e7198d45ebc03f653e1d3bab3c2592012247687a..4a030af89cc18fa96dcd7542104d11699b690603 100644 (file)
@@ -198,6 +198,8 @@ private Q_SLOTS:
     */
     void updateProgress(int percent);
 
+    void createDirectory();
+
 private:
     void createActions();
     void createGoAction(const char* name, const char* iconName,
index 404c6eae095a54c2a9d01c8d3decbb5edc8269d6..88530febf3e3df579f437718122c8404baffdadb 100644 (file)
@@ -27,6 +27,7 @@
 #include <kaction.h>
 #include <kactioncollection.h>
 #include <klocale.h>
+#include <knewmenu.h>
 #include <ktoggleaction.h>
 #include <krun.h>
 #include <kpropertiesdialog.h>
@@ -81,7 +82,7 @@ void DolphinViewActionHandler::createActions()
     newDirAction->setText(i18nc("@action", "Create Folder..."));
     newDirAction->setShortcut(Qt::Key_F10);
     newDirAction->setIcon(KIcon("folder-new"));
-    connect(newDirAction, SIGNAL(triggered()), SLOT(slotCreateDir()));
+    connect(newDirAction, SIGNAL(triggered()), this, SIGNAL(createDirectory()));
 
     // Edit menu
 
@@ -283,12 +284,6 @@ QActionGroup* DolphinViewActionHandler::createSortByActionGroup()
     return sortByActionGroup;
 }
 
-void DolphinViewActionHandler::slotCreateDir()
-{
-    Q_ASSERT(m_currentView);
-    KonqOperations::newDir(m_currentView, m_currentView->url());
-}
-
 void DolphinViewActionHandler::slotViewModeActionTriggered(QAction* action)
 {
     const DolphinView::Mode mode = action->data().value<DolphinView::Mode>();
index 18305d19f01c9da798ae76a5034d5a50f4a1e69e..40062de0489a53f8bf1f39a2768c826e5d9e3127 100644 (file)
@@ -55,7 +55,7 @@ public:
      * Sets the view that this action handler should work on.
      */
     void setCurrentView(DolphinView* view);
-    
+
     /**
      * Returns the view that this action handler should work on.
      */
@@ -65,11 +65,11 @@ public:
      * Returns the name of the action for the current viewmode
      */
     QString currentViewModeActionName() const;
-    
+
     /**
      * Returns m_actionCollection
      */
-    KActionCollection* actionCollection(); 
+    KActionCollection* actionCollection();
 
 public Q_SLOTS:
     /**
@@ -85,13 +85,14 @@ Q_SIGNALS:
      */
     void actionBeingHandled();
 
-private Q_SLOTS:
     /**
-     * Opens the dialog for creating a directory. Is connected
-     * with the key shortcut for "new directory" (F10).
+     * Emitted if the user requested creating a new directory by the F10 key.
+     * The receiver of the signal (DolphinMainWindow or DolphinPart) invokes
+     * the method createDirectory of their KNewMenu instance.
      */
-    void slotCreateDir();
+    void createDirectory();
 
+private Q_SLOTS:
     /**
      * Emitted when the user requested a change of view mode
      */