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:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user