Commit e749a327 authored by Lukas Appelhans's avatar Lukas Appelhans

-Sl works

parent 3c8ce8ee
......@@ -35,6 +35,10 @@ void SyncOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Oper
connect(Akabei::Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)),
SLOT(searchResult(QUuid,QList<Akabei::Package*>)));
Akabei::Backend::instance()->searchPackages(args.first());
} else if (operations.contains(APM::ListRepo)) {
if (args.isEmpty())
return;
listRepo(args.first());
}
}
......@@ -65,3 +69,29 @@ void SyncOperation::searchResult(QUuid , QList< Akabei::Package* > packages)
out.flush();
}
void SyncOperation::listRepo(const QString &repo)
{
AkabeiClient::DatabaseHandler * db = 0;
foreach (AkabeiClient::DatabaseHandler * database, AkabeiClient::Backend::instance()->databases()) {
if (database->name() == repo) {
db = database;
break;
}
}
if (!db)
return;
QTextStream out(stdout);
foreach (Akabei::Package * pkg, db->database()->packages()) {
Akabei::Package::List installed = Akabei::Backend::instance()->localDatabase()->queryPackages("SELECT * FROM packages WHERE Name LIKE \"" + pkg->name() + "\"");
out << db->name() << ' ' << pkg->name() << ' ' << pkg->version().toByteArray().data();
if (!installed.isEmpty()) {
if (installed.first()->version() == pkg->version())
out << ' ' << i18n("[Installed]");
else
out << ' ' << i18n("[Installed: %1]", installed.first()->version().toByteArray().data());
}
out << endl;
}
out.flush();
}
......@@ -26,6 +26,7 @@ public:
private slots:
void searchResult(QUuid,QList<Akabei::Package*>);
void listRepo(const QString &repo);
};
#endif // SYNCOPERATION_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