COPKGManager: add function to get status for new package updates

Origin commit data
------------------
Commit: 6942173bf7
Author: Thilo Graf <dbt@novatux.de>
Date: 2014-11-13 (Thu, 13 Nov 2014)
This commit is contained in:
2014-11-13 12:01:44 +01:00
parent a9c1e0d1c7
commit b2f72fe6a4
2 changed files with 22 additions and 0 deletions

View File

@@ -250,6 +250,27 @@ void COPKGManager::updateMenu()
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() {
list_installed_done = false,
list_upgradeable_done = false;

View File

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