]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.cpp
a lot of more KUrl::path() -> KUrl::toLocalFile() changes (mostly after a check for...
[dolphin.git] / src / dolphinviewcontainer.cpp
index e22342ed8b5e055b2270f1c557b47c91716bd952..5300553703bae977b1d53285ebd2b7e0e4af1b74 100644 (file)
@@ -41,7 +41,9 @@
 #include <konqmimedata.h>
 #include <konq_fileitemcapabilities.h>
 #include <konq_operations.h>
+#include <kshell.h>
 #include <kurl.h>
+#include <kurlcombobox.h>
 #include <krun.h>
 
 #include "dolphinmodel.h"
@@ -87,11 +89,15 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
             this, SLOT(dropUrls(const KUrl&, QDropEvent*)));
     connect(m_urlNavigator, SIGNAL(activated()),
             this, SLOT(activate()));
+    connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)),
+            this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion)));
 
     const GeneralSettings* settings = DolphinSettings::instance().generalSettings();
     m_urlNavigator->setUrlEditable(settings->editableUrl());
     m_urlNavigator->setShowFullPath(settings->showFullPath());
     m_urlNavigator->setHomeUrl(settings->homeUrl());
+    KUrlComboBox* editor = m_urlNavigator->editor();
+    editor->setCompletionMode(KGlobalSettings::Completion(settings->urlCompletionMode()));
 
     m_dirLister = new DolphinDirLister();
     m_dirLister->setAutoUpdate(true);
@@ -128,8 +134,8 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
                              m_proxyModel);
     connect(m_view, SIGNAL(urlChanged(const KUrl&)),
             m_urlNavigator, SLOT(setUrl(const KUrl&)));
-    connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&)),
-            this, SLOT(openContextMenu(KFileItem, const KUrl&)));
+    connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&, const QList<QAction*>&)),
+            this, SLOT(openContextMenu(KFileItem, const KUrl&, const QList<QAction*>&)));
     connect(m_view, SIGNAL(contentsMoved(int, int)),
             this, SLOT(saveContentsPos(int, int)));
     connect(m_view, SIGNAL(requestItemInfo(KFileItem)),
@@ -158,6 +164,8 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
             this, SLOT(setNameFilter(const QString&)));
     connect(m_filterBar, SIGNAL(closeRequest()),
             this, SLOT(closeFilterBar()));
+    connect(m_view, SIGNAL(urlChanged(const KUrl&)),
+            m_filterBar, SLOT(clear()));
 
     m_topLayout->addWidget(m_urlNavigator);
     m_topLayout->addWidget(m_view);
@@ -345,9 +353,11 @@ void DolphinViewContainer::setNameFilter(const QString& nameFilter)
 }
 
 void DolphinViewContainer::openContextMenu(const KFileItem& item,
-                                           const KUrl& url)
+                                           const KUrl& url,
+                                           const QList<QAction*>& customActions)
 {
     DolphinContextMenu contextMenu(m_mainWindow, item, url);
+    contextMenu.setCustomActions(customActions);
     contextMenu.open();
 }
 
@@ -397,7 +407,9 @@ void DolphinViewContainer::restoreView(const KUrl& url)
             showErrorMessage(i18nc("@info:status",
                                    "Protocol not supported by Dolphin, Konqueror has been launched"));
         }
-        const QString command = app + ' ' + url.pathOrUrl();
+
+        QString secureUrl = KShell::quoteArg(url.pathOrUrl());
+        const QString command = app + ' ' + secureUrl;
         KRun::runCommand(command, app, app, this);
     } else {
         showErrorMessage(i18nc("@info:status", "Invalid protocol"));
@@ -429,6 +441,13 @@ void DolphinViewContainer::requestFocus()
     m_view->setFocus();
 }
 
+void DolphinViewContainer::saveUrlCompletionMode(KGlobalSettings::Completion completion)
+{
+    DolphinSettings& settings = DolphinSettings::instance();
+    settings.generalSettings()->setUrlCompletionMode(completion);
+    settings.save();
+}
+
 void DolphinViewContainer::slotItemTriggered(const KFileItem& item)
 {
     KUrl url = item.targetUrl();