Commit 4fe1011b authored by Lisa's avatar Lisa

Fixed a problem in upgrade and a typo error in queueoperation

parent 5c456d64
......@@ -105,6 +105,7 @@ void QueueOperation::validationFinished(bool valid, QList<AkabeiClient::Transact
else
out << i18n("n");
}
out << i18n("]");
out.flush();
std::string input;
getline(std::cin, input);
......
......@@ -136,20 +136,20 @@ void SyncOperation::updateSystem()
}
void SyncOperation::upgrade(QUuid uuid, QList< Akabei::Package* > packages)
{
{
if (packages.isEmpty() || queryId != uuid) {
nextOperation();
return;
}
QHash<QString, QList<Akabei::Package*> > mappedpkgs;
QMultiHash<QString, Akabei::Package* > mappedpkgs;
foreach (Akabei::Package * pkg, packages) {
mappedpkgs[pkg->name()].append(pkg);
mappedpkgs.insertMulti(pkg->name(), pkg);
}
QList<Akabei::Package*> toBeUpgraded;
foreach (const QString &pkg, mappedpkgs.keys()) {
QList<Akabei::Package*> candidates = mappedpkgs[pkg];
QList<Akabei::Package*> candidates = mappedpkgs.values(pkg);
if (!candidates.isEmpty()) {
QMap<Akabei::Package::Version, Akabei::Package*> versions;
......@@ -167,7 +167,7 @@ void SyncOperation::upgrade(QUuid uuid, QList< Akabei::Package* > packages)
if (!local) {
continue;
}
if (!versions.isEmpty() && versions.values().last()->version() > local->version()) {
toBeUpgraded << versions.values().last();
}
......@@ -206,7 +206,7 @@ void SyncOperation::install(QUuid uuid, QList< Akabei::Package* > packages)
if (pkg->database() == Akabei::Backend::instance()->localDatabase()) {
qDebug() << "Local";
local[pkg->name()] = pkg;
packages.removeAll(pkg);
// packages.removeAll(pkg);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment