]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinpart.cpp
Sourcecode hierarchy cleanup: Move class PixmapViewer from "src" to "src/panels/infor...
[dolphin.git] / src / dolphinpart.cpp
index 35cc81503b17110c577945071b6472a599392002..a8254552ee89245ecb35b57200c27752c4c90c8b 100644 (file)
 */
 
 #include "dolphinpart.h"
-#include "dolphinviewactionhandler.h"
-#include "dolphinsortfilterproxymodel.h"
-#include "dolphinview.h"
-#include "dolphinmodel.h"
-#include "dolphinnewmenuobserver.h"
-#include "dolphinremoteencoding.h"
 
 #include <kfileitemlistproperties.h>
 #include <konq_operations.h>
 #include <kio/netaccess.h>
 #include <ktoolinvocation.h>
 #include <kauthorized.h>
-#include <knewmenu.h>
+#include <knewfilemenu.h>
 #include <kmenu.h>
 #include <kinputdialog.h>
 
 #include "settings/dolphinsettings.h"
+#include "views/dolphinview.h"
+#include "views/dolphinviewactionhandler.h"
+#include "views/dolphinsortfilterproxymodel.h"
+#include "views/dolphinmodel.h"
+#include "views/dolphinnewmenuobserver.h"
+#include "views/dolphinremoteencoding.h"
 
 #include <QActionGroup>
 #include <QApplication>
@@ -106,8 +106,6 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
             this, SLOT(slotSelectionChanged(KFileItemList)));
     connect(m_view, SIGNAL(requestItemInfo(KFileItem)),
             this, SLOT(slotRequestItemInfo(KFileItem)));
-    connect(m_view, SIGNAL(requestUrlChange(KUrl)),
-            this, SLOT(slotRequestUrlChange(KUrl)));
     connect(m_view, SIGNAL(modeChanged()),
             this, SIGNAL(viewModeChanged())); // relay signal
     connect(m_view, SIGNAL(redirection(KUrl, KUrl)),
@@ -156,7 +154,8 @@ void DolphinPart::createActions()
 {
     // Edit menu
 
-    m_newMenu = new KNewMenu(actionCollection(), widget(), "new_menu");
+    m_newMenu = new KNewFileMenu(actionCollection(), "new_menu", this);
+    m_newMenu->setParentWidget(widget());
     DolphinNewMenuObserver::instance().attach(m_newMenu);
     connect(m_newMenu->menu(), SIGNAL(aboutToShow()),
             this, SLOT(updateNewMenu()));
@@ -348,7 +347,11 @@ void DolphinPart::slotRequestItemInfo(const KFileItem& item)
 void DolphinPart::slotItemTriggered(const KFileItem& item)
 {
     KParts::OpenUrlArguments args;
-    args.setMimeType(item.mimetype());
+    // Forget about the known mimetype if a target URL is used.
+    // Testcase: network:/ with a item (mimetype "inode/some-foo-service") pointing to a http URL (html)
+    if (item.targetUrl() == item.url()) {
+        args.setMimeType(item.mimetype());
+    }
 
     // Ideally, konqueror should be changed to not require trustedSource for directory views,
     // since the idea was not to need BrowserArguments for non-browser stuff...
@@ -385,13 +388,18 @@ void DolphinPart::slotOpenContextMenu(const KFileItem& _item,
 
     // TODO: We should change the signature of the slots (and signals) for being able
     //       to tell for which items we want a popup.
-    const KFileItemList items = (m_view->selectedItems().count() ? m_view->selectedItems()
-                                 : KFileItemList() << item);
+    KFileItemList items;
+    if (m_view->selectedItems().isEmpty()) {
+        items.append(item);
+    } else {
+        items = m_view->selectedItems();
+    }
+
     KFileItemListProperties capabilities(items);
 
     KParts::BrowserExtension::ActionGroupMap actionGroups;
     QList<QAction *> editActions;
-
+    editActions += m_view->versionControlActions(m_view->selectedItems());
     editActions += customActions;
 
     if (!_item.isNull()) { // only for context menu on one or more items
@@ -455,16 +463,6 @@ void DolphinPart::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
     }
 }
 
-void DolphinPart::slotRequestUrlChange(const KUrl& url)
-{
-    if (m_view->url() != url) {
-        // If the view URL is not equal to 'url', then an inner URL change has
-        // been done (e. g. by activating an existing column in the column view).
-        openUrl(url);
-        emit m_extension->openUrlNotify();
-    }
-}
-
 ////
 
 void DolphinPartBrowserExtension::restoreState(QDataStream &stream)
@@ -601,8 +599,8 @@ void DolphinPart::slotOpenTerminal()
 
 void DolphinPart::updateNewMenu()
 {
-    // As requested by KNewMenu :
-    m_newMenu->slotCheckUpToDate();
+    // As requested by KNewFileMenu :
+    m_newMenu->checkUpToDate();
     m_newMenu->setViewShowsHiddenFiles(m_view->showHiddenFiles());
     // And set the files that the menu apply on :
     m_newMenu->setPopupFiles(url());
@@ -625,4 +623,9 @@ void DolphinPart::createDirectory()
     m_newMenu->createDirectory();
 }
 
+void DolphinPart::setFilesToSelect(const KUrl::List& files)
+{
+    m_view->markUrlsAsSelected(files);
+}
+
 #include "dolphinpart.moc"