HaikuDepot: Introduce new PackageState' pending'

When installing a package, it is set to pending, which removes
the Install button from the package info area. When multiple
packages are downloaded, theould all be put to pending,
right now, they will still offer to be installed, although they
are already scheduled for downloading. Requesting a package to
be installed when it is already schduled will mess things up later.
Godm, I hate this nano bug...
This commit is contained in:
Stephan Aßmus
2014-03-18 21:02:24 +01:00
parent e883b3c9ff
commit 4fc7f247a8
4 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2013, Stephan Aßmus <[email protected]>.
* Copyright 2013-2014, Stephan Aßmus <[email protected]>.
* Copyright 2013, Rene Gollent <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
+2 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2013, Stephan Aßmus <[email protected]>.
* Copyright 2013-2014, Stephan Aßmus <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef PACKAGE_INFO_H
@@ -193,6 +193,7 @@ enum PackageState {
DOWNLOADING = 2,
ACTIVATED = 3,
UNINSTALLED = 4,
PENDING = 5,
};
+4
View File
@@ -23,6 +23,8 @@ static const char* skPackageStateAvailable = B_TRANSLATE_MARK("Available");
static const char* skPackageStateUninstalled = B_TRANSLATE_MARK("Uninstalled");
static const char* skPackageStateActive = B_TRANSLATE_MARK("Active");
static const char* skPackageStateInactive = B_TRANSLATE_MARK("Inactive");
static const char* skPackageStatePending = B_TRANSLATE_MARK(
"Pending" B_UTF8_ELLIPSIS);
inline BString
@@ -43,6 +45,8 @@ package_state_to_string(PackageInfoRef ref)
data.SetToFormat("%3.2f%%", ref->DownloadProgress() * 100.0);
return data;
}
case PENDING:
return B_TRANSLATE(skPackageStatePending);
}
return B_TRANSLATE("Unknown");
+3 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2013, Haiku, Inc. All Rights Reserved.
* Copyright 2013-2014, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -108,6 +108,7 @@ public:
| BPackageManager::B_ADD_REMOTE_REPOSITORIES
| BPackageManager::B_REFRESH_REPOSITORIES);
PackageInfoRef ref(Package());
ref->SetState(PENDING);
fPackageManager->SetCurrentActionPackage(ref, true);
fPackageManager->AddProgressListener(this);
const char* packageName = ref->Title().String();
@@ -310,7 +311,7 @@ PackageManager::GetPackageActions(PackageInfoRef package, Model* model)
if (state == ACTIVATED || state == INSTALLED) {
actionList.Add(PackageActionRef(new UninstallPackageAction(
package, model), true));
} else {
} else if (state == NONE || state == UNINSTALLED) {
actionList.Add(PackageActionRef(new InstallPackageAction(package,
model), true));
}