Commit 03bf26aa authored by Lukas Appelhans's avatar Lukas Appelhans

-Qd is done

parent e4d144b9
......@@ -48,14 +48,6 @@ void APM::start()
QueryOperation * query = new QueryOperation(this);
query->start(m_operations, m_args);
}
QTextStream out(stdout);
//out << endl;
out << "blub";
out << endl;
out.flush();
kDebug() << "Start";
printf("Start\n");
kDebug() << "Type" << m_operationType << "Operations" << m_operations << "Args" << m_args;
}
#include "apm.moc"
......@@ -12,9 +12,11 @@
#include <akabeibackend.h>
#include <akabeigroup.h>
#include <akabeidatabase.h>
#include <klocale.h>
#include <QTextStream>
#include <kio/global.h>
#include <kdebug.h>
#include <QDate>
QueryOperation::QueryOperation(QObject * parent)
......@@ -42,6 +44,18 @@ void QueryOperation::start(QList<APM::Operation> operations, QStringList args)
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() + "\"");
} else if (operations.contains(APM::ShowChangelog)) {
if (args.isEmpty())
return;
connect(Akabei::Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)),
SLOT(showChangelog(QUuid,QList<Akabei::Package*>)));
Akabei::Backend::instance()->searchPackages(args.first());
} else if (operations.contains(APM::ShowInstalledAsDeps)) {
QString query = "SELECT * FROM packages WHERE";
if (!args.isEmpty())
query = query + " Name LIKE \"" + args.first() + "\" AND";
query = query + " InstallReason LIKE 1";// + QString((int)Akabei::Package::InstalledAsDependencyReason);
showInstalledAsDeps(Akabei::Backend::instance()->localDatabase()->queryPackages(query));
}
}
......@@ -93,3 +107,25 @@ void QueryOperation::showGroup(QUuid uuid,QList<Akabei::Group*> groups)
out << group->name() << ' ' << pkg->name() << endl;
out.flush();
}
void QueryOperation::showChangelog(QUuid uuid, QList< Akabei::Package* > packages)
{
Q_UNUSED(uuid)
if (packages.isEmpty())
return;
Akabei::Package * pkg = packages.first();
QTextStream out(stdout);
out << pkg->retrieveChangelog() << endl;
out.flush();
}
void QueryOperation::showInstalledAsDeps(QList<Akabei::Package*> packages)
{
if (packages.isEmpty())
return;
QTextStream out(stdout);
foreach (Akabei::Package * pkg, packages)
out << pkg->name() << ' ' << pkg->version().toByteArray().data() << endl;
out.flush();
}
......@@ -29,6 +29,8 @@ public:
private slots:
void showInformation(QUuid uuid,QList<Akabei::Package*> packages);
void showGroup(QUuid uuid,QList<Akabei::Group*> groups);
void showChangelog(QUuid uuid, QList<Akabei::Package*> packages);
void showInstalledAsDeps(QList<Akabei::Package*>);
};
#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