Commit 95574674 authored by Lukas Appelhans's avatar Lukas Appelhans

akabei -Qg works!

parent f4b4d25a
......@@ -36,6 +36,12 @@ void QueryOperation::start(QList<APM::Operation> operations, QStringList args)
connect(Akabei::Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)),
SLOT(showInformation(QUuid,QList<Akabei::Package*>)));
Akabei::Backend::instance()->searchPackages(args.first());
} else if (operations.contains(APM::ShowPackagesOfGroup)) {
if (args.isEmpty())
return;
connect(Akabei::Backend::instance(), SIGNAL(queryGroupsCompleted(QUuid,QList<Akabei::Group*>)),
SLOT(showGroup(QUuid,QList<Akabei::Group*>)));
Akabei::Backend::instance()->searchGroups(args.first());
}
}
......@@ -71,3 +77,19 @@ void QueryOperation::showInformation(QUuid uuid,QList<Akabei::Package*> packages
out << i18n("Description") << qSetFieldWidth(2) << ":" << qSetFieldWidth(20) << pkg->description() << endl;
out.flush();
}
void QueryOperation::showGroup(QUuid uuid,QList<Akabei::Group*> groups)
{
Q_UNUSED(uuid)
if (groups.isEmpty())
return;
Akabei::Group * group = groups.first();
QTextStream out(stdout);
QMap<QString, Akabei::Package*> sorted;
foreach (Akabei::Package * pkg, group->packages())
sorted[pkg->name()] = pkg;
foreach (Akabei::Package * pkg, sorted.values())
out << group->name() << ' ' << pkg->name() << endl;
out.flush();
}
......@@ -28,6 +28,7 @@ public:
private slots:
void showInformation(QUuid uuid,QList<Akabei::Package*> packages);
void showGroup(QUuid uuid,QList<Akabei::Group*> groups);
};
#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