From 4e6fbe0320b8e59a225770a2e08359b2cf349c98 Mon Sep 17 00:00:00 2001
From: Julian Harnath <julian.harnath@rwth-aachen.de>
Date: Wed, 27 Dec 2017 15:08:27 +0000
Subject: [PATCH] HaikuDepot: notify work status from main window

* Update the work status view with package state changes from
  MainWindow instead of PackageListView, because PackageListView
  does not always show all packages that are going to be installed
  (e.g. dependencies that are not shown when a search filter is
  active).

* Fixes the bug that prevented pending/download status to show up
  for dependencies when filters are used.
---
 src/apps/haikudepot/ui/MainWindow.cpp      | 3 +++
 src/apps/haikudepot/ui/PackageListView.cpp | 7 +------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/apps/haikudepot/ui/MainWindow.cpp b/src/apps/haikudepot/ui/MainWindow.cpp
index bc8d021bdf..a06ca7f047 100644
--- a/src/apps/haikudepot/ui/MainWindow.cpp
+++ b/src/apps/haikudepot/ui/MainWindow.cpp
@@ -509,6 +509,9 @@ MainWindow::MessageReceived(BMessage* message)
 							fFeaturedPackagesView->AddPackage(ref);
 					}
 				}
+
+				if (!fSinglePackageMode && (changes & PKG_CHANGED_STATE) != 0)
+					fWorkStatusView->PackageStatusChanged(ref);
 			}
 			break;
 		}
diff --git a/src/apps/haikudepot/ui/PackageListView.cpp b/src/apps/haikudepot/ui/PackageListView.cpp
index 6de9218ba6..bcdbf7e101 100644
--- a/src/apps/haikudepot/ui/PackageListView.cpp
+++ b/src/apps/haikudepot/ui/PackageListView.cpp
@@ -843,13 +843,8 @@ PackageListView::MessageReceived(BMessage* message)
 					row->UpdateSummary();
 				if ((changes & PKG_CHANGED_RATINGS) != 0)
 					row->UpdateRating();
-				if ((changes & PKG_CHANGED_STATE) != 0) {
+				if ((changes & PKG_CHANGED_STATE) != 0)
 					row->UpdateState();
-					if (fWorkStatusView != NULL) {
-						fWorkStatusView->PackageStatusChanged(
-							row->Package());
-					}
-				}
 				if ((changes & PKG_CHANGED_SIZE) != 0)
 					row->UpdateSize();
 				if ((changes & PKG_CHANGED_ICON) != 0)