Commit 4f4ee351 authored by Lukas Appelhans's avatar Lukas Appelhans

Better queries

parent d64928f9
......@@ -42,7 +42,7 @@ void QueryOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Ope
if (operations.contains(APM::QueryPackageFile)) {
showInformation(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
} else {
showInformation(Akabei::Backend::instance()->localDatabase()->queryPackages("SELECT * FROM packages WHERE Name LIKE \"" + args.first() + "\""));
showInformation(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first(), Akabei::SearchNameEqual));
//CHange back to searchPackages when we have sorted results after Name and description
}
} else if (operations.contains(APM::ShowPackagesOfGroup)) {
......@@ -84,10 +84,7 @@ void QueryOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Ope
} else if (operations.contains(APM::ShowOwner) && !args.isEmpty()) {
showOwner(args.first());
} else if (operations.contains(APM::SearchLocal)) {
QString query = "SELECT * FROM packages";
if (!args.isEmpty())
query = query + " WHERE Name LIKE \"" + args.first() + "\"";
showLocalQuery(Akabei::Backend::instance()->localDatabase()->queryPackages(query));
showLocalQuery(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first(), Akabei::SearchNameEqual));
} else if (operations.contains(APM::ShowNotRequired)) {
showNotRequired();
} else if (operations.contains(APM::ShowUpgradeable)) {
......@@ -103,7 +100,7 @@ void QueryOperation::showInformation(QList<Akabei::Package*> packages)
return;
Akabei::Package * pkg = packages.first();
QTextStream out(stdout);
out.setFieldWidth(30);
out.setFieldWidth(20);//TODO: Use QFontMetrics to get width of longest word and use that as width of the field (Also in -Si)
out.setFieldAlignment(QTextStream::AlignLeft);
out << i18n("Name") << qSetFieldWidth(2) << ":" << qSetFieldWidth(20) << pkg->name() << endl;
out << i18n("Version") << qSetFieldWidth(2) << ":" << qSetFieldWidth(20) << QString(pkg->version().toByteArray().data()) << endl;
......
......@@ -84,7 +84,7 @@ void SyncOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Oper
}
connect(backend, SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)), SLOT(showInformation(QUuid,QList<Akabei::Package*>)));
backend->searchPackages(args);
backend->searchPackages(args, Akabei::SearchNameEqual);
break;
}
......@@ -126,7 +126,7 @@ void SyncOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Oper
}
connect(backend, SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)), SLOT(upgrade(QUuid,QList<Akabei::Package*>)));
queryId = backend->searchPackages(locals);
queryId = backend->searchPackages(locals, Akabei::SearchNameEqual);
break;
}
......@@ -137,7 +137,7 @@ void SyncOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Oper
}
connect(backend, SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)), SLOT(install(QUuid,QList<Akabei::Package*>)));
queryId = backend->searchPackages(args);
queryId = backend->searchPackages(args, Akabei::SearchNameEqual);
break;
}
......
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