]> cloud.milkyroute.net Git - dolphin.git/commitdiff
merge -c764347 by Peter, needed for dolphinpart bugfixing
authorDavid Faure <faure@kde.org>
Mon, 21 Jan 2008 16:12:25 +0000 (16:12 +0000)
committerDavid Faure <faure@kde.org>
Mon, 21 Jan 2008 16:12:25 +0000 (16:12 +0000)
svn path=/branches/KDE/4.0/kdebase/apps/; revision=764379

src/dolphinpart.cpp
src/dolphinpart.h
src/dolphinview.cpp
src/dolphinview.h
src/dolphinviewcontainer.cpp

index d26f14061fd00722fd383fd8cba7ace4f0de0e5b..235f176cd43f38bc4fc42f86c5f1f164471d8f1a 100644 (file)
@@ -70,7 +70,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QStringLi
                              KUrl(),
                              m_dirLister,
                              m_dolphinModel,
-                             m_proxyModel);
+                             m_proxyModel,
+                             actionCollection());
     setWidget(m_view);
 
     setXMLFile("dolphinpart.rc");
@@ -144,14 +145,6 @@ void DolphinPart::createActions()
     propertiesAction->setShortcut(Qt::ALT+Qt::Key_Return);
     connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties()));
 
-    // This action doesn't appear in the GUI, it's for the shortcut only.
-    // KNewMenu takes care of the GUI stuff.
-    KAction* newDirAction = actionCollection()->addAction( "create_dir" );
-    newDirAction->setText( i18n("Create Folder..." ) );
-    connect(newDirAction, SIGNAL(triggered()), SLOT(slotNewDir()));
-    newDirAction->setShortcut(Qt::Key_F10);
-    widget()->addAction(newDirAction);
-
     // Go menu
 
     QActionGroup* goActionGroup = new QActionGroup(this);
@@ -414,11 +407,6 @@ void DolphinPart::slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers mod
         m_view->trashSelectedItems();
 }
 
-void DolphinPart::slotNewDir()
-{
-    KonqOperations::newDir(widget(), url());
-}
-
 void DolphinPart::slotEditMimeType()
 {
     const KFileItemList items = m_view->selectedItems();
index 300924a8da9d79c939f18655c88f34dc0b805004..3e3c73f6643377b3f64394631be0a153e208683a 100644 (file)
@@ -115,11 +115,6 @@ private Q_SLOTS:
      */
     void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
 
-    /**
-     * Connected to the key shortcut for "new directory" (F10)
-     */
-    void slotNewDir();
-
     /**
      * Connected to all "Go" menu actions provided by DolphinPart
      */
index ddb7185f0201409bb714b7b8886e60ddec08d1e0..4a1fbb927d348270c68b74b2e48fc10689e93713 100644 (file)
@@ -61,7 +61,8 @@ DolphinView::DolphinView(QWidget* parent,
                          const KUrl& url,
                          KDirLister* dirLister,
                          DolphinModel* dolphinModel,
-                         DolphinSortFilterProxyModel* proxyModel) :
+                         DolphinSortFilterProxyModel* proxyModel,
+                         KActionCollection* actionCollection) :
     QWidget(parent),
     m_active(true),
     m_showPreview(false),
@@ -127,6 +128,16 @@ DolphinView::DolphinView(QWidget* parent,
 
     applyViewProperties(url);
     m_topLayout->addWidget(itemView());
+
+    Q_ASSERT(actionCollection != 0);
+    if (actionCollection->action("create_dir") == 0) {
+        // This action doesn't appear in the GUI, it's for the shortcut only.
+        // KNewMenu takes care of the GUI stuff.
+        KAction* newDirAction = actionCollection->addAction("create_dir");
+        newDirAction->setText(i18n("Create Folder..."));
+        connect(newDirAction, SIGNAL(triggered()), SLOT(createDir()));
+        newDirAction->setShortcut(Qt::Key_F10);
+    }
 }
 
 DolphinView::~DolphinView()
@@ -1138,6 +1149,11 @@ void DolphinView::slotPreviewJobFinished(KJob* job)
     m_previewJob = 0;
 }
 
+void DolphinView::createDir()
+{
+    KonqOperations::newDir(this, url());
+}
+
 void DolphinView::cutSelectedItems()
 {
     QMimeData* mimeData = new QMimeData();
index 60e29b4d5a8d702bdef99da8f75e5cb90b3e7136..485748751de7ef1c96a28a9992f256a2f43d6ae6 100644 (file)
@@ -119,21 +119,23 @@ public:
     };
 
     /**
-     * @param parent          Parent widget of the view.
-     * @param url             Specifies the content which should be shown.
-     * @param dirLister       Used directory lister. The lister is not owned
-     *                        by the view and won't get deleted.
-     * @param dolphinModel    Used directory model. The model is not owned
-     *                        by the view and won't get deleted.
-     * @param proxyModel      Used proxy model which specifies the sorting. The
-     *                        model is not owned by the view and won't get
-     *                        deleted.
+     * @param parent           Parent widget of the view.
+     * @param url              Specifies the content which should be shown.
+     * @param dirLister        Used directory lister. The lister is not owned
+     *                         by the view and won't get deleted.
+     * @param dolphinModel     Used directory model. The model is not owned
+     *                         by the view and won't get deleted.
+     * @param proxyModel       Used proxy model which specifies the sorting. The
+     *                         model is not owned by the view and won't get
+     *                         deleted.
+     * @param actionCollection Action collection which contains the menu actions.
      */
     DolphinView(QWidget* parent,
                 const KUrl& url,
                 KDirLister* dirLister,
                 DolphinModel* dolphinModel,
-                DolphinSortFilterProxyModel* proxyModel);
+                DolphinSortFilterProxyModel* proxyModel,
+                KActionCollection* actionCollection);
 
     virtual ~DolphinView();
 
@@ -616,6 +618,12 @@ private slots:
      */
     void slotPreviewJobFinished(KJob* job);
 
+    /**
+     * Opens the dialog for creating a directory. Is connected
+     * with the key shortcut for "new directory" (F10).
+     */
+    void createDir();
+
 private:
     void loadDirectory(const KUrl& url, bool reload = false);
 
index a1846dc758c73bd2acb4a9351595cf3fc284c21c..b9caa7b8e6fdafd27cd0ae7b80abeb27afc31868 100644 (file)
@@ -115,7 +115,8 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
                              url,
                              m_dirLister,
                              m_dolphinModel,
-                             m_proxyModel);
+                             m_proxyModel,
+                             mainWindow->actionCollection());
     connect(m_view, SIGNAL(urlChanged(const KUrl&)),
             m_urlNavigator, SLOT(setUrl(const KUrl&)));
     connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&)),