Commit dd4be7a4 authored by Lukas Appelhans's avatar Lukas Appelhans

-Sg done

parent e4cf25a3
......@@ -49,7 +49,13 @@ void SyncOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Oper
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()->queryGroups("SELECT * FROM groups WHERE Name LIKE \"" + args.first() + "\"");
}
}
void SyncOperation::searchResult(QUuid , QList< Akabei::Package* > packages)
......@@ -154,3 +160,19 @@ void SyncOperation::showInformation(QUuid,QList<Akabei::Package*> packages)
out.flush();
}
void SyncOperation::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 @@ private slots:
void searchResult(QUuid,QList<Akabei::Package*>);
void listRepo(const QString &repo);
void showInformation(QUuid,QList<Akabei::Package*> packages);
void showGroup(QUuid,QList<Akabei::Group*>);
};
#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