Commit 433f6a58 authored by Lukas Appelhans's avatar Lukas Appelhans

Okay cleanup a bit and only search local database

parent d43d0ea2
......@@ -39,27 +39,23 @@ void QueryOperation::start(QList<APM::Operation> operations, QStringList args)
if (args.isEmpty())
return;
if (operations.contains(APM::QueryPackageFile)) {
showInformation(QUuid(), QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
showInformation(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
} else {
connect(Akabei::Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)),
SLOT(showInformation(QUuid,QList<Akabei::Package*>)));
Akabei::Backend::instance()->searchPackages(args.first());
showInformation(Akabei::Backend::instance()->localDatabase()->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() + "\"");
Akabei::Backend::instance()->localDatabase()->queryGroups("SELECT * FROM groups WHERE Name LIKE \"" + args.first() + "\"");
} else if (operations.contains(APM::ShowChangelog)) {
if (args.isEmpty())
return;
if (operations.contains(APM::QueryPackageFile)) {
showChangelog(QUuid(), QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
showChangelog(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
} else {
connect(Akabei::Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)),
SLOT(showChangelog(QUuid,QList<Akabei::Package*>)));
Akabei::Backend::instance()->searchPackages(args.first());
showChangelog(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first()));
}
} else if (operations.contains(APM::ShowInstalledAsDeps) || operations.contains(APM::ShowInstalledExplicitely)) {
QString query = "SELECT * FROM packages WHERE";
......@@ -74,11 +70,9 @@ void QueryOperation::start(QList<APM::Operation> operations, QStringList args)
if (args.isEmpty())
return;
if (operations.contains(APM::QueryPackageFile)) {
checkFiles(QUuid(), QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
checkFiles(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
} else {
connect(Akabei::Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)),
SLOT(checkFiles(QUuid,QList<Akabei::Package*>)));
Akabei::Backend::instance()->searchPackages(args.first());
checkFiles(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first()));
}
} else if (operations.contains(APM::ShowLocal)) {
if (args.isEmpty())
......@@ -102,9 +96,8 @@ void QueryOperation::start(QList<APM::Operation> operations, QStringList args)
}
}
void QueryOperation::showInformation(QUuid uuid,QList<Akabei::Package*> packages)
void QueryOperation::showInformation(QList<Akabei::Package*> packages)
{
Q_UNUSED(uuid)
if (packages.isEmpty())
return;
Akabei::Package * pkg = packages.first();
......@@ -151,9 +144,8 @@ void QueryOperation::showGroup(QUuid uuid,QList<Akabei::Group*> groups)
out.flush();
}
void QueryOperation::showChangelog(QUuid uuid, QList< Akabei::Package* > packages)
void QueryOperation::showChangelog(QList< Akabei::Package* > packages)
{
Q_UNUSED(uuid)
if (packages.isEmpty())
return;
Akabei::Package * pkg = packages.first();
......@@ -175,7 +167,7 @@ void QueryOperation::showInstalledAsDeps(QList<Akabei::Package*> packages)
out.flush();
}
void QueryOperation::checkFiles(QUuid,QList<Akabei::Package*> packages)
void QueryOperation::checkFiles(QList<Akabei::Package*> packages)
{
if (packages.isEmpty())
return;
......
......@@ -27,11 +27,11 @@ public:
void start(QList<APM::Operation> operations, QStringList args);
private slots:
void showInformation(QUuid uuid,QList<Akabei::Package*> packages);
void showInformation(QList<Akabei::Package*> packages);
void showGroup(QUuid uuid,QList<Akabei::Group*> groups);
void showChangelog(QUuid uuid, QList<Akabei::Package*> packages);
void showChangelog(QList<Akabei::Package*> packages);
void showInstalledAsDeps(QList<Akabei::Package*>);
void checkFiles(QUuid,QList<Akabei::Package*>);
void checkFiles(QList<Akabei::Package*>);
void showLocalPackages(const QString &query);
void showOwner(const QString &query);
void showLocalQuery(QList<Akabei::Package*>);
......
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