From e8808e813077dcaa277bef5fe8fc732cb9ac3cd2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 17 Jul 2020 20:42:15 +0200 Subject: [PATCH] opkg_manager: show count of available updates after update check --- src/gui/opkg_manager.cpp | 12 ++++++++---- src/gui/opkg_manager.h | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index addfd376a..a932a1e73 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -147,6 +147,7 @@ void COPKGManager::init() v_bad_pattern = getBadPackagePatternList(); CFileHelpers::createDir(OPKG_TMP_DIR); silent = false; + num_updates = 0; } COPKGManager::~COPKGManager() @@ -459,7 +460,7 @@ bool COPKGManager::checkUpdates(const std::string & package_name, bool show_prog return false; silent = !show_progress; - + num_updates = 0; doUpdate(); bool ret = false; @@ -495,9 +496,9 @@ bool COPKGManager::checkUpdates(const std::string & package_name, bool show_prog dprintf(DEBUG_INFO, "[COPKGManager] [%s - %d] Update packages available for...%s\n", __func__, __LINE__, it->second.name.c_str()); if (!package_name.empty() && package_name == it->second.name){ ret = true; - break; }else ret = true; + num_updates++; } i++; } @@ -552,8 +553,11 @@ void COPKGManager::refreshMenu() { int COPKGManager::showMenu() { installed = false; - if (checkUpdates()) - DisplayInfoMessage(g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_UPDATES_AVAILABLE)); + if (checkUpdates()){ + std::string update_msg = to_string(num_updates) + " "; + update_msg += g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_UPDATES_AVAILABLE); + DisplayInfoMessage(update_msg.c_str()); + } #if 0 getPkgData(OM_LIST); diff --git a/src/gui/opkg_manager.h b/src/gui/opkg_manager.h index fb36c7f98..46c18c4b1 100644 --- a/src/gui/opkg_manager.h +++ b/src/gui/opkg_manager.h @@ -163,6 +163,8 @@ class COPKGManager : public CMenuTarget pkg(std::string &_name, std::string &_version, std::string &_desc) : name(_name), version(_version), desc(_desc), installed(false), upgradable(false) { } }; + + int num_updates; public: COPKGManager(); ~COPKGManager();