COPKGManager: add function to get status for new package updates

This commit is contained in:
2014-11-13 12:01:44 +01:00
parent 77002eb839
commit 6942173bf7
2 changed files with 22 additions and 0 deletions

View File

@@ -250,6 +250,27 @@ void COPKGManager::updateMenu()
menu->setFooter(COPKGManagerFooterButtons, COPKGManagerFooterButtonCount); menu->setFooter(COPKGManagerFooterButtons, COPKGManagerFooterButtonCount);
} }
bool COPKGManager::hasUpdates()
{
if (!hasOpkgSupport())
return false;
bool ret = false;
getPkgData(OM_LIST);
getPkgData(OM_LIST_UPGRADEABLE);
for (map<string, struct pkg>::iterator it = pkg_map.begin(); it != pkg_map.end(); it++){
if (it->second.upgradable){
dprintf(DEBUG_INFO, "[neutrino opkg] Update packages available...\n");
ret = true;
}
}
pkg_map.clear();
return ret;
}
void COPKGManager::refreshMenu() { void COPKGManager::refreshMenu() {
list_installed_done = false, list_installed_done = false,
list_upgradeable_done = false; list_upgradeable_done = false;

View File

@@ -86,5 +86,6 @@ class COPKGManager : public CMenuTarget
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
static bool hasOpkgSupport(); static bool hasOpkgSupport();
bool hasUpdates();
}; };
#endif #endif