Commit a73e3378 authored by Lukas Appelhans's avatar Lukas Appelhans

-Qt is done

parent 55b36461
......@@ -85,6 +85,8 @@ void QueryOperation::start(QList<APM::Operation> operations, QStringList args)
if (!args.isEmpty())
query = query + " WHERE Name LIKE \"" + args.first() + "\"";
showLocalQuery(Akabei::Backend::instance()->localDatabase()->queryPackages(query));
} else if (operations.contains(APM::ShowNotRequired)) {
showNotRequired();
}
}
......@@ -237,3 +239,19 @@ void QueryOperation::showLocalQuery(QList<Akabei::Package*> packages)
}
out.flush();
}
void QueryOperation::showNotRequired()
{
QTextStream out(stdout);
QList<Akabei::Package*> packages = Akabei::Backend::instance()->localDatabase()->packages();
QMap<QString, Akabei::Package*> pkgs;
foreach (Akabei::Package* pkg, packages)
pkgs[pkg->name()] = pkg;
foreach (Akabei::Package* pkg, packages) {
foreach (const QString &dep, pkg->dependencies())
pkgs.remove(dep);
}
foreach (Akabei::Package * pkg, pkgs.values())
out << pkg->name() << ' ' << pkg->version().toByteArray().data() << endl;
out.flush();
}
......@@ -35,6 +35,7 @@ private slots:
void showLocalPackages(const QString &query);
void showOwner(const QString &query);
void showLocalQuery(QList<Akabei::Package*>);
void showNotRequired();
};
#endif // QUERYOPERATION_H
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