Blob Blame History Raw
--- upplay.orig/dirbrowser/cdbrowser.cpp	2020-11-19 17:28:50.000000000 +0100
+++ upplay/dirbrowser/cdbrowser.cpp	2020-11-30 11:54:15.313447480 +0100
@@ -105,6 +105,7 @@
     
 #ifdef USING_WEBENGINE
     connect(this, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
+    QApplication::instance()->installEventFilter(this);
 #else
     connect(this, SIGNAL(linkClicked(const QUrl &)), 
             this, SLOT(onLinkClicked(const QUrl &)));
@@ -131,6 +132,9 @@
 
 CDBrowser::~CDBrowser()
 {
+#ifdef USING_WEBENGINE
+    QApplication::instance()->removeEventFilter(this);
+#endif
     deleteReaders("~CDBrowser");
 }
 
@@ -197,12 +201,16 @@
 
 bool CDBrowser::eventFilter(QObject *object, QEvent *event)
 {
-    switch (event->type()) {
+	if (object->parent() != this) return false;
+	switch (event->type()) {
     case QEvent::MouseButtonRelease:
     {
         const QMouseEvent *mouseEvent(static_cast<QMouseEvent*>(event));
         if (mouseEvent) {
             m_lastbutton = mouseEvent->button();
+            if (m_lastbutton == Qt::BackButton) {
+                back(0);
+            }
         }
     }
     break;
@@ -262,6 +270,9 @@
 {
     //qDebug() << "CDBrowser::mouseReleaseEvent";
     m_lastbutton = event->button();
+    if (m_lastbutton == Qt::BackButton) {
+        back(0);
+    }
     QWEBVIEW::mouseReleaseEvent(event);
 }
 
@@ -959,13 +970,6 @@
             " m_initUDN [" << qs2utf8s(m_initUDN) <<
             "] curpath size " << m_curpath.size() << endl);
 
-#ifdef USING_WEBENGINE
-    if (focusWidget()) {
-        focusWidget()->removeEventFilter(this);
-        focusWidget()->installEventFilter(this);
-    }
-#endif
-
     deleteReaders("initialPage");
     emit sig_now_in(this, tr("Servers"));
     m_searchcaps.clear();