]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Abort loading the current URL if the user presses Escape
authorFrank Reininghaus <frank78ac@googlemail.com>
Wed, 16 Oct 2013 20:37:50 +0000 (22:37 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Wed, 16 Oct 2013 20:39:47 +0000 (22:39 +0200)
BUG: 323181
FIXED-IN: 4.12.0
REVIEW: 113234

src/kitemviews/kitemlistcontroller.cpp
src/kitemviews/kitemlistcontroller.h
src/views/dolphinview.cpp
src/views/dolphinview.h

index 9335ab816c334631ffa53ff6cbf78563e9399097..befb09713ec9fd2c53b0efc03e6c5cb025a10aa6 100644 (file)
@@ -403,6 +403,7 @@ bool KItemListController::keyPressEvent(QKeyEvent* event)
             m_selectionManager->clearSelection();
         }
         m_keyboardManager->cancelSearch();
+        emit escapePressed();
         break;
 
     case Qt::Key_Space:
index 4d5fee3450fa8e391dc881f1878e057e863290b0..bb72856e0c1e053c8dc1cdb8d5e432f101a4ed9e 100644 (file)
@@ -230,6 +230,11 @@ signals:
      */
     void aboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
 
+    /**
+     * Is emitted if the Escape key is pressed.
+     */
+    void escapePressed();
+
     void modelChanged(KItemModelBase* current, KItemModelBase* previous);
     void viewChanged(KItemListView* current, KItemListView* previous);
 
index c1d245301c7f09764e386a21643ccc6ad95f09a2..fd149e0f6aa0a947680c5c3c7481ecda7c24be99 100644 (file)
@@ -154,6 +154,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
     connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int)));
     connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int)));
     connect(controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
+    connect(controller, SIGNAL(escapePressed()), this, SLOT(stopLoading()));
     connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
 
     connect(m_model, SIGNAL(directoryLoadingStarted()),       this, SLOT(slotDirectoryLoadingStarted()));
@@ -485,11 +486,6 @@ void DolphinView::reload()
     restoreState(restoreStream);
 }
 
-void DolphinView::stopLoading()
-{
-    m_model->cancelDirectoryLoading();
-}
-
 void DolphinView::readSettings()
 {
     const int oldZoomLevel = m_view->zoomLevel();
@@ -724,6 +720,11 @@ void DolphinView::pasteIntoFolder()
     }
 }
 
+void DolphinView::stopLoading()
+{
+    m_model->cancelDirectoryLoading();
+}
+
 bool DolphinView::eventFilter(QObject* watched, QEvent* event)
 {
     switch (event->type()) {
index 86bc5c159d43702e0330a99ee031785599f7e6ab..a6f969bc1b7d8e27c233588199a9f6ac5e404397 100644 (file)
@@ -217,7 +217,6 @@ public:
     QList<QByteArray> visibleRoles() const;
 
     void reload();
-    void stopLoading();
 
     /**
      * Refreshes the view to get synchronized with the settings (e.g. icons size,
@@ -369,6 +368,8 @@ public slots:
      */
     void pasteIntoFolder();
 
+    void stopLoading();
+
     /** Activates the view if the item list container gets focus. */
     virtual bool eventFilter(QObject* watched, QEvent* event);