Change in kio[master]: Apply the edited URL to the navigator when clicking the "Che...

Frank Reininghaus (Code Review) noreply at kde.org
Sun Dec 14 17:12:37 UTC 2014


Frank Reininghaus has uploaded a new change for review.

  https://gerrit.vesnicky.cesnet.cz/r/233

Change subject: Apply the edited URL to the navigator when clicking the "Check" button
......................................................................

Apply the edited URL to the navigator when clicking the "Check" button

If the navigator is in "editable" mode, pressing Enter applies the
edited URL to the view. This commit also enables this behavior for the
case that the user clicks the button to the right of the line edit in
order to switch back to breadcrumb mode. Before this commit, the edited
URL was lost.

BUG: 257538
Change-Id: I553afb1f6af033a026e8d8cf08f57f682ac723c2
FIXED-IN: 5.6.0
---
M src/filewidgets/kurlnavigator.cpp
M src/filewidgets/kurlnavigator.h
2 files changed, 27 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.vesnicky.cesnet.cz:29418/kio refs/changes/33/233/1

diff --git a/src/filewidgets/kurlnavigator.cpp b/src/filewidgets/kurlnavigator.cpp
index d0fd71a..ba19f28 100644
--- a/src/filewidgets/kurlnavigator.cpp
+++ b/src/filewidgets/kurlnavigator.cpp
@@ -69,6 +69,9 @@
 
     void initialize(const QUrl &url);
 
+    /** Applies the edited URL in m_pathBox to the URL navigator */
+    void applyUncommittedUrl();
+
     void slotReturnPressed();
     void slotProtocolChanged(const QString &);
     void openPathSelectorMenu();
@@ -81,9 +84,14 @@
     void appendWidget(QWidget *widget, int stretch = 0);
 
     /**
+     * This slot is connected to the clicked signal of the navigation bar button. It calls switchView().
+     * Moreover, if switching from "editable" mode to the breadcrumb view, it calls applyUncommittedUrl().
+     */
+    void slotToggleEditableButtonPressed();
+
+    /**
      * Switches the navigation bar between the breadcrumb view and the
-     * traditional view (see setUrlEditable()) and is connected to the clicked signal
-     * of the navigation bar button.
+     * traditional view (see setUrlEditable()).
      */
     void switchView();
 
@@ -254,7 +262,7 @@
     m_toggleEditableMode->installEventFilter(q);
     m_toggleEditableMode->setMinimumWidth(20);
     connect(m_toggleEditableMode, SIGNAL(clicked()),
-            q, SLOT(switchView()));
+            q, SLOT(slotToggleEditableButtonPressed()));
 
     if (m_placesSelector != 0) {
         m_layout->addWidget(m_placesSelector);
@@ -291,7 +299,7 @@
     m_layout->insertWidget(m_layout->count() - 1, widget, stretch);
 }
 
-void KUrlNavigator::Private::slotReturnPressed()
+void KUrlNavigator::Private::applyUncommittedUrl()
 {
     // Parts of the following code have been taken
     // from the class KateFileSelector located in
@@ -311,6 +319,11 @@
     // synchronize the result in the path box.
     const QUrl currentUrl = q->locationUrl();
     m_pathBox->setUrl(currentUrl);
+}
+
+void KUrlNavigator::Private::slotReturnPressed()
+{
+    applyUncommittedUrl();
 
     emit q->returnPressed();
 
@@ -383,6 +396,15 @@
     }
 }
 
+void KUrlNavigator::Private::slotToggleEditableButtonPressed()
+{
+    if (m_editable) {
+        applyUncommittedUrl();
+    }
+
+    switchView();
+}
+
 void KUrlNavigator::Private::switchView()
 {
     m_toggleEditableMode->setFocus();
diff --git a/src/filewidgets/kurlnavigator.h b/src/filewidgets/kurlnavigator.h
index 5ffa577..0c12bd5 100644
--- a/src/filewidgets/kurlnavigator.h
+++ b/src/filewidgets/kurlnavigator.h
@@ -450,7 +450,7 @@
 private:
     Q_PRIVATE_SLOT(d, void slotReturnPressed())
     Q_PRIVATE_SLOT(d, void slotProtocolChanged(const QString &protocol))
-    Q_PRIVATE_SLOT(d, void switchView())
+    Q_PRIVATE_SLOT(d, void slotToggleEditableButtonPressed())
     Q_PRIVATE_SLOT(d, void dropUrls(const QUrl &destination, QDropEvent *))
     Q_PRIVATE_SLOT(d, void slotNavigatorButtonClicked(const QUrl &url, Qt::MouseButton button))
     Q_PRIVATE_SLOT(d, void openContextMenu())

-- 
To view, visit https://gerrit.vesnicky.cesnet.cz/r/233
To unsubscribe, visit https://gerrit.vesnicky.cesnet.cz/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I553afb1f6af033a026e8d8cf08f57f682ac723c2
Gerrit-PatchSet: 1
Gerrit-Project: kio
Gerrit-Branch: master
Gerrit-Owner: Frank Reininghaus <frank78ac at googlemail.com>
Gerrit-Reviewer: Sysadmin Testing Account <null at kde.org>


More information about the Kde-frameworks-devel mailing list