COPKGManager: add member doUpdate()

This commit is contained in:
2014-11-22 22:20:49 +01:00
parent 6a06d5cdc1
commit eb6f972f60
2 changed files with 10 additions and 5 deletions

View File

@@ -271,6 +271,14 @@ bool COPKGManager::hasUpdates()
return ret; return ret;
} }
void COPKGManager::doUpdate()
{
int r = execCmd(pkg_types[OM_UPDATE]);
if (r) {
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPDATE), strerror(errno), pkg_types[OM_UPDATE]);
}
}
void COPKGManager::refreshMenu() { void COPKGManager::refreshMenu() {
list_installed_done = false, list_installed_done = false,
list_upgradeable_done = false; list_upgradeable_done = false;
@@ -280,11 +288,7 @@ void COPKGManager::refreshMenu() {
int COPKGManager::showMenu() int COPKGManager::showMenu()
{ {
installed = false; installed = false;
doUpdate();
int r = execCmd(pkg_types[OM_UPDATE]);
if (r) {
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPDATE), strerror(errno), pkg_types[OM_UPDATE]);
}
getPkgData(OM_LIST); getPkgData(OM_LIST);
getPkgData(OM_LIST_UPGRADEABLE); getPkgData(OM_LIST_UPGRADEABLE);

View File

@@ -69,6 +69,7 @@ class COPKGManager : public CMenuTarget
void refreshMenu(); void refreshMenu();
bool badpackage(std::string &s); bool badpackage(std::string &s);
void showError(const char* local_msg, char* sys_msg, const std::string& command); void showError(const char* local_msg, char* sys_msg, const std::string& command);
void doUpdate();
struct pkg { struct pkg {
std::string name; std::string name;