Commit 7f48cf9e authored by Lukas Appelhans's avatar Lukas Appelhans

-Qm done

parent f945fb39
......@@ -68,6 +68,11 @@ void QueryOperation::start(QList<APM::Operation> operations, QStringList args)
connect(Akabei::Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)),
SLOT(checkFiles(QUuid,QList<Akabei::Package*>)));
Akabei::Backend::instance()->searchPackages(args.first());
} else if (operations.contains(APM::ShowLocal)) {
if (args.isEmpty())
showLocalPackages(QString());
else
showLocalPackages(args.first());
}
}
......@@ -158,5 +163,32 @@ void QueryOperation::checkFiles(QUuid,QList<Akabei::Package*> packages)
missing++;
}
out << pkg->name() << ": " << all << " overall files, " << missing << " file(s) missing" << endl;
out.flush();
}
void QueryOperation::showLocalPackages(const QString &query)
{
QTextStream out(stdout);
QList<Akabei::Package*> packages;
if (!query.isEmpty())
packages = Akabei::Backend::instance()->localDatabase()->searchPackages(query);
else
packages = Akabei::Backend::instance()->localDatabase()->packages();
foreach (Akabei::Package* pkg, packages) {
bool found = false;
foreach (Akabei::Database* db, Akabei::Backend::instance()->databases()) {
foreach (Akabei::Package* p, db->searchPackages(pkg->name())) {
if (p->name() == pkg->name()) {
found = true;
break;
}
}
if (found)
break;
}
if (!found)
out << pkg->name() << ' ' << pkg->version().toByteArray().data() << endl;
}
out.flush();
}
......@@ -32,6 +32,7 @@ private slots:
void showChangelog(QUuid uuid, QList<Akabei::Package*> packages);
void showInstalledAsDeps(QList<Akabei::Package*>);
void checkFiles(QUuid,QList<Akabei::Package*>);
void showLocalPackages(const QString &query);
};
#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