Commit a277f06a authored by Lukas Appelhans's avatar Lukas Appelhans

-Qe done and even with sorting!

parent 03bf26aa
......@@ -50,11 +50,14 @@ void QueryOperation::start(QList<APM::Operation> operations, QStringList args)
connect(Akabei::Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)),
SLOT(showChangelog(QUuid,QList<Akabei::Package*>)));
Akabei::Backend::instance()->searchPackages(args.first());
} else if (operations.contains(APM::ShowInstalledAsDeps)) {
} else if (operations.contains(APM::ShowInstalledAsDeps) || operations.contains(APM::ShowInstalledExplicitely)) {
QString query = "SELECT * FROM packages WHERE";
if (!args.isEmpty())
query = query + " Name LIKE \"" + args.first() + "\" AND";
query = query + " InstallReason LIKE 1";// + QString((int)Akabei::Package::InstalledAsDependencyReason);
if (operations.contains(APM::ShowInstalledAsDeps))
query = query + " InstallReason LIKE 0";// + QString((int)Akabei::Package::InstalledAsDependencyReason);
else
query = query + " InstallReason LIKE 1";
showInstalledAsDeps(Akabei::Backend::instance()->localDatabase()->queryPackages(query));
}
}
......@@ -124,7 +127,10 @@ void QueryOperation::showInstalledAsDeps(QList<Akabei::Package*> packages)
if (packages.isEmpty())
return;
QTextStream out(stdout);
QMap<QString, Akabei::Package*> sorted;
foreach (Akabei::Package * pkg, packages)
sorted[pkg->name()] = pkg;
foreach (Akabei::Package * pkg, sorted.values())
out << pkg->name() << ' ' << pkg->version().toByteArray().data() << endl;
out.flush();
}
......
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