SoftwareUpdater updates

*Added a check-only option to check for updates and display a
  notification when updates are available.
*Added argv commands to specify an action when using Terminal or
  BRoster to launch app: commands [update | check | full-sync]
*Draw a download progress bar on the package icon
*Increased the size of the package icon to improve the bar look
*Added package counts to each list category
This commit is contained in:
Brian Hill
2017-04-20 18:08:51 -04:00
parent 0fb349bc5d
commit 73c2c7b4b5
16 changed files with 761 additions and 81 deletions
+16 -7
View File
@@ -13,8 +13,6 @@
#include <Catalog.h>
#include <package/manager/Exceptions.h>
#include "constants.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "UpdateAction"
@@ -39,15 +37,21 @@ UpdateAction::~UpdateAction()
status_t
UpdateAction::Perform()
UpdateAction::Perform(update_type action_request)
{
try {
fUpdateManager->CheckNetworkConnection();
int32 action = fUpdateManager->GetUpdateType();
update_type action = action_request;
// Prompt the user if needed
if (action == USER_SELECTION_NEEDED)
action = fUpdateManager->GetUpdateType();
if (action == CANCEL_UPDATE)
throw BAbortedByUserException();
else if (action <= INVALID_SELECTION || action >= UPDATE_TYPE_END)
throw BException("Invalid update type, cannot continue with updates");
throw BException(B_TRANSLATE(
"Invalid update type, cannot continue with updates"));
fUpdateManager->Init(BPackageManager::B_ADD_INSTALLED_REPOSITORIES
| BPackageManager::B_ADD_REMOTE_REPOSITORIES
@@ -61,7 +65,11 @@ UpdateAction::Perform()
fUpdateManager->Update(&packages, packageCount);
} else if (action == FULLSYNC)
fUpdateManager->FullSync();
else
// Should not happen but just in case
throw BException(B_TRANSLATE(
"Invalid update type, cannot continue with updates"));
} catch (BFatalErrorException ex) {
fUpdateManager->FinalUpdate(B_TRANSLATE("Updates did not complete"),
ex.Message());
@@ -79,7 +87,8 @@ UpdateAction::Perform()
B_TRANSLATE("There were no updates found."));
return B_OK;
} catch (BException ex) {
fprintf(stderr, "Exception occurred while updating packages : %s\n",
fprintf(stderr, B_TRANSLATE(
"Exception occurred while updating packages : %s\n"),
ex.Message().String());
fUpdateManager->FinalUpdate(B_TRANSLATE("Updates did not complete"),
ex.Message());