Commit 4b9521ad authored by Lisa's avatar Lisa

Multiple operations now supported.

parent 2b13f9a7
......@@ -22,10 +22,10 @@
#include <QCoreApplication>
#include <QTimer>
OperationManager::OperationManager(APM::OperationType type, APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject * parent)
OperationManager::OperationManager(APM::OperationType type, QList<APM::OperationName> operations, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject * parent)
: QObject(parent),
m_type(type),
m_operation(operation),
m_operations(operations),
m_options(options),
m_args(args)
{
......@@ -65,23 +65,23 @@ void OperationManager::start()
{
switch (m_type) {
case APM::QueryOperationType: {
QueryOperation * query = new QueryOperation(this);
query->start(m_operation, m_options, m_args);
QueryOperation * query = new QueryOperation(m_operations, m_options, m_args, this);
query->start();
break;
}
case APM::RemoveOperationType: {
RemoveOperation * remove = new RemoveOperation(this);
remove->start(m_operation, m_options, m_args);
RemoveOperation * remove = new RemoveOperation(m_operations, m_options, m_args, this);
remove->start();
break;
}
case APM::SyncOperationType: {
SyncOperation * sync = new SyncOperation(this);
sync->start(m_operation, m_options, m_args);
SyncOperation * sync = new SyncOperation(m_operations, m_options, m_args, this);
sync->start();
break;
}
case APM::UpgradeOperationType: {
UpgradeOperation * upgrade = new UpgradeOperation(this);
upgrade->start(m_operation, m_options, m_args);
upgrade->start(m_operations, m_options, m_args);
break;
}
default:
......
......@@ -21,7 +21,7 @@ class OperationManager : public QObject
{
Q_OBJECT
public:
explicit OperationManager(APM::OperationType type, APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject* parent = 0);
explicit OperationManager(APM::OperationType type, QList<APM::OperationName> operations, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject* parent = 0);
virtual ~OperationManager();
private slots:
......@@ -30,7 +30,7 @@ private slots:
private:
APM::OperationType m_type;
APM::OperationName m_operation;
QList<APM::OperationName> m_operations;
QHash<APM::OptionName, AkabeiOption> m_options;
QStringList m_args;
};
......
This diff is collapsed.
......@@ -39,7 +39,7 @@ enum OperationName {
None,
ShowChangelog, ShowInstalledAsDeps, ShowInstalledExplicitely, ShowPackagesOfGroup, ShowPackagesOfGroupLocal, ShowInformationLocal,
ShowInformation, CheckFiles, ShowOwner, ShowNotRequired, ShowUpgradeable,
Install, RemoveOldFromCache, RemoveAllCache, ListRepo, Search, UpdateDatabases, UpdateSystem, UpdateDatabaseAndSystem,
Install, RemoveOldFromCache, RemoveAllCache, ListRepo, Search, UpdateDatabases, UpdateSystem,
Remove, Cascade, Unneeded, SearchLocal,
DatabaseOperation, Upgrade, Help, Version
};
......@@ -98,12 +98,6 @@ public:
AkabeiOperation(APM::OperationType, APM::OperationName, const char *, const char *, const char *, bool);
AkabeiOperation(APM::OperationType, APM::OperationName, const char *, const char *, const char *, bool, QStringList);
/*
* Checks, with special rules, than no more than one operation is specified on the command line
* see cmdline.cpp for a more detailed explanation
*/
void set(AkabeiOperation &);
/*
* Options checking
*/
......@@ -116,7 +110,8 @@ typedef QList<AkabeiOperation> AkabeiOperationList;
class CmdLine
{
private:
AkabeiOperation m_operation;
APM::OperationType m_type;
QHash<APM::OperationName, AkabeiOperation> m_operations;
QHash<APM::OptionName, AkabeiOption> m_options;
QStringList m_freeArgs;
......@@ -130,14 +125,15 @@ private:
bool parsed;
void secondParse(QStringList, QList<QByteArray> &);
void secondParse(QStringList, QSet<QByteArray> &);
bool freeArgsRequired();
public:
CmdLine();
void parse(int argc, char **argv);
APM::OperationType type();
APM::OperationName operation();
QList<APM::OperationName> operations();
QHash<APM::OptionName, AkabeiOption> options();
QStringList freeArgs();
};
......
......@@ -28,6 +28,6 @@ int main(int argc, char** argv)
return -1;
}
OperationManager apm(cmd.type(), cmd.operation(), cmd.options(), cmd.freeArgs());
OperationManager apm(cmd.type(), cmd.operations(), cmd.options(), cmd.freeArgs());
return app.exec();
}
......@@ -23,10 +23,12 @@
#include <QDir>
#include <QCoreApplication>
QueryOperation::QueryOperation(QObject * parent)
QueryOperation::QueryOperation(QList<APM::OperationName> operations, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject * parent)
: QObject(parent)
, m_operations(operations)
, m_options(options)
, m_args(args)
{
}
QueryOperation::~QueryOperation()
......@@ -34,49 +36,51 @@ QueryOperation::~QueryOperation()
}
void QueryOperation::start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args)
void QueryOperation::start()
{
APM::OperationName operation = m_operations.takeFirst();
if (operation == APM::ShowInformationLocal) {
if (options.contains(APM::QueryPackageFile)) {
showInformation(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
if (m_options.contains(APM::QueryPackageFile)) {
showInformation(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(m_args.first()));
} else {
showInformation(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first(), Akabei::SearchNameEqual));
showInformation(Akabei::Backend::instance()->localDatabase()->searchPackages(m_args.first(), Akabei::SearchNameEqual));
//CHange back to searchPackages when we have sorted results after Name and description
}
} else if (operation == APM::ShowPackagesOfGroupLocal) {
connect(Akabei::Backend::instance(), SIGNAL(queryGroupsCompleted(QUuid,QList<Akabei::Group*>)),
SLOT(showGroup(QUuid,QList<Akabei::Group*>)));
Akabei::Backend::instance()->localDatabase()->queryGroups("SELECT * FROM groups WHERE Name LIKE \"" + args.first() + "\"");
Akabei::Backend::instance()->localDatabase()->queryGroups("SELECT * FROM groups WHERE Name LIKE \"" + m_args.first() + "\"");
} else if (operation == APM::ShowChangelog) {
if (options.contains(APM::QueryPackageFile)) {
showChangelog(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
if (m_options.contains(APM::QueryPackageFile)) {
showChangelog(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(m_args.first()));
} else {
showChangelog(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first()));
showChangelog(Akabei::Backend::instance()->localDatabase()->searchPackages(m_args.first()));
}
} else if (operation == APM::ShowInstalledAsDeps || operation == APM::ShowInstalledExplicitely) {
QString query = "SELECT * FROM packages WHERE";
if (!args.isEmpty()) // TODO: vedi un po' qua che vuol dire
query = query + " Name LIKE \"" + args.first() + "\" AND";
if (!m_args.isEmpty())
query = query + " Name LIKE \"" + m_args.first() + "\" AND";
if (operation == APM::ShowInstalledAsDeps)
query = query + " InstallReason LIKE 0";// + QString((int)Akabei::Package::InstalledAsDependencyReason);
else
query = query + " InstallReason LIKE " + QString::number((int)Akabei::Package::ExplicitlyInstalledReason);
showInstalledAsDeps(Akabei::Backend::instance()->localDatabase()->queryPackages(query));
} else if (operation == APM::CheckFiles) {
if (options.contains(APM::QueryPackageFile)) {
checkFiles(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
if (m_options.contains(APM::QueryPackageFile)) {
checkFiles(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(m_args.first()));
} else {
checkFiles(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first()));
checkFiles(Akabei::Backend::instance()->localDatabase()->searchPackages(m_args.first()));
}
} else if (operation == APM::SearchLocal) {
if (args.isEmpty())
if (m_args.isEmpty())
showLocalPackages(QString());
else
showLocalPackages(args.first());
showLocalPackages(m_args.first());
} else if (operation == APM::ShowOwner) {
showOwner(args.first());
showOwner(m_args.first());
} else if (operation == APM::SearchLocal) {
showLocalQuery(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first(), Akabei::SearchNameEqual));
showLocalQuery(Akabei::Backend::instance()->localDatabase()->searchPackages(m_args.first(), Akabei::SearchNameEqual));
} else if (operation == APM::ShowNotRequired) {
showNotRequired();
} else if (operation == APM::ShowUpgradeable) {
......@@ -118,7 +122,7 @@ void QueryOperation::showInformation(QList<Akabei::Package*> packages)
out << i18n("Installation script") << qSetFieldWidth(2) << ":" << qSetFieldWidth(20) << (pkg->hasScriptlet() ? i18n("Yes") : i18n("No")) << endl;
out << i18n("Description") << qSetFieldWidth(2) << ":" << qSetFieldWidth(20) << pkg->description() << endl;
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void QueryOperation::showGroup(QUuid uuid,QList<Akabei::Group*> groups)
......@@ -137,7 +141,7 @@ void QueryOperation::showGroup(QUuid uuid,QList<Akabei::Group*> groups)
foreach (Akabei::Package * pkg, sorted.values())
out << group->name() << ' ' << pkg->name() << endl;
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void QueryOperation::showChangelog(QList< Akabei::Package* > packages)
......@@ -150,7 +154,7 @@ void QueryOperation::showChangelog(QList< Akabei::Package* > packages)
QTextStream out(stdout);
out << pkg->retrieveChangelog() << endl;
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void QueryOperation::showInstalledAsDeps(QList<Akabei::Package*> packages)
......@@ -166,7 +170,7 @@ void QueryOperation::showInstalledAsDeps(QList<Akabei::Package*> packages)
foreach (Akabei::Package * pkg, sorted.values())
out << pkg->name() << ' ' << pkg->version().toByteArray().data() << endl;
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void QueryOperation::checkFiles(QList<Akabei::Package*> packages)
......@@ -186,7 +190,7 @@ void QueryOperation::checkFiles(QList<Akabei::Package*> packages)
}
out << pkg->name() << ": " << all << " overall files, " << missing << " file(s) missing" << endl;
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void QueryOperation::showLocalPackages(const QString &query)
......@@ -213,7 +217,7 @@ void QueryOperation::showLocalPackages(const QString &query)
out << pkg->name() << ' ' << pkg->version().toByteArray().data() << endl;
}
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void QueryOperation::showOwner(const QString &query)
......@@ -237,7 +241,7 @@ void QueryOperation::showOwner(const QString &query)
}
out << "Error: No packages owns " << query << endl;
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void QueryOperation::showLocalQuery(QList<Akabei::Package*> packages)
......@@ -251,7 +255,7 @@ void QueryOperation::showLocalQuery(QList<Akabei::Package*> packages)
out << "\t" << pkg->description() << endl;
}
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void QueryOperation::showNotRequired()
......@@ -268,7 +272,7 @@ void QueryOperation::showNotRequired()
foreach (Akabei::Package * pkg, pkgs.values())
out << pkg->name() << ' ' << pkg->version().toByteArray().data() << endl;
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void QueryOperation::showUpgradeable()
......@@ -295,5 +299,14 @@ void QueryOperation::showUpgradeable()
foreach (Akabei::Package * pkg, upgradeable.values())
out << pkg->name() << ' ' << pkg->version().toByteArray().data() << endl;
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void QueryOperation::nextOperation()
{
if (m_operations.isEmpty()) {
QCoreApplication::instance()->quit();
return;
}
start();
}
......@@ -22,10 +22,17 @@ class QueryOperation : public QObject
{
Q_OBJECT
public:
explicit QueryOperation(QObject * parent = 0);
explicit QueryOperation(QList<APM::OperationName> operations, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject * parent = 0);
virtual ~QueryOperation();
void start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args);
void start();
private:
QList<APM::OperationName> m_operations;
QHash<APM::OptionName, AkabeiOption> m_options;
QStringList m_args;
void nextOperation();
private slots:
void showInformation(QList<Akabei::Package*> packages);
......
......@@ -24,34 +24,33 @@
#include <akabeihelpers.h>
#include "queueoperation.h"
RemoveOperation::RemoveOperation(QObject * parent)
RemoveOperation::RemoveOperation(QList<APM::OperationName> operations, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject * parent)
: QObject(parent)
, m_operations(operations)
, m_options(options)
, m_args(args)
{
}
RemoveOperation::~RemoveOperation()
{
}
void RemoveOperation::start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args)
void RemoveOperation::start()
{
m_operation = operation;
m_options = options;
m_args = args;
APM::OperationName operation = m_operations.takeFirst();
QString query = "SELECT * FROM packages WHERE";
foreach (const QString &pkg, args) {
foreach (const QString &pkg, m_args) {
query = query + " name=\"" + pkg + "\"";
if (args.last() != pkg)
if (m_args.last() != pkg)
query = query + " OR";
}
if (operation == APM::Unneeded) { //TODO: Implement those!
removeUnneeded(Akabei::Backend::instance()->localDatabase()->packages());
} else if (operation == APM::Remove) {
if (options.contains(APM::Recursive)) {
if (m_options.contains(APM::Recursive)) {
removeRecursive(Akabei::Backend::instance()->localDatabase()->queryPackages(query));
} else {
remove(Akabei::Backend::instance()->localDatabase()->queryPackages(query));
......@@ -67,9 +66,9 @@ void RemoveOperation::remove(QList<Akabei::Package*> packages)
QCoreApplication::instance()->quit();
return;
}
QueueOperation *operation = new QueueOperation(m_operation, m_options, this);
QueueOperation *operation = new QueueOperation(APM::Remove, m_options, this);
operation->start(AkabeiClient::Remove, packages);
connect(operation, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
connect(operation, SIGNAL(finished()), QCoreApplication::instance(), SLOT(nextOperation()));
}
void RemoveOperation::removeRecursive(QList<Akabei::Package*> packages)
......@@ -86,9 +85,9 @@ void RemoveOperation::removeRecursive(QList<Akabei::Package*> packages)
pkgs << p;
}
}
QueueOperation *operation = new QueueOperation(m_operation, m_options, this);
QueueOperation *operation = new QueueOperation(APM::Remove, m_options, this);
operation->start(AkabeiClient::Remove, pkgs);
connect(operation, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
connect(operation, SIGNAL(finished()), QCoreApplication::instance(), SLOT(nextOperation()));
}
void RemoveOperation::removeUnneeded(QList< Akabei::Package* > packages)
......@@ -113,7 +112,16 @@ void RemoveOperation::removeUnneeded(QList< Akabei::Package* > packages)
QCoreApplication::instance()->quit();
return;
}
QueueOperation *operation = new QueueOperation(m_operation, m_options, this);
QueueOperation *operation = new QueueOperation(APM::Unneeded, m_options, this);
operation->start(AkabeiClient::Remove, unneeded);
connect(operation, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
connect(operation, SIGNAL(finished()), QCoreApplication::instance(), SLOT(nextOperation()));
}
void RemoveOperation::nextOperation()
{
if (m_operations.isEmpty()) {
QCoreApplication::instance()->quit();
return;
}
start();
}
\ No newline at end of file
......@@ -20,18 +20,19 @@ class RemoveOperation : public QObject
{
Q_OBJECT
public:
RemoveOperation(QObject * parent = 0);
RemoveOperation(QList<APM::OperationName> operations, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject * parent = 0);
virtual ~RemoveOperation();
void start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args);
void start();
public slots:
void remove(QList<Akabei::Package*> packages);
void removeRecursive(QList<Akabei::Package*> packages);
void removeUnneeded(QList< Akabei::Package* > packages);
void nextOperation();
private:
APM::OperationName m_operation;
QList<APM::OperationName> m_operations;
QHash<APM::OptionName, AkabeiOption> m_options;
QStringList m_args;
};
......
......@@ -35,9 +35,12 @@
#include <iostream>
SyncOperation::SyncOperation(QObject* parent)
SyncOperation::SyncOperation(QList<APM::OperationName> operations, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject* parent)
: QObject(parent)
, m_maxDbNameLenght(0)
, m_operations(operations)
, m_options(options)
, m_args(args)
{}
SyncOperation::~SyncOperation() {}
......@@ -45,40 +48,40 @@ SyncOperation::~SyncOperation() {}
//TODO: Instead of putting all in operation, we want to split stuff like SkipDependencies into some special flags parameter :) that way
// we can have proper errorhandling
// or let shainer write that CLI parser
void SyncOperation::start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args)
void SyncOperation::start()
{
QTextStream err(stderr);
Akabei::Backend *backend = Akabei::Backend::instance();
m_operation = operation;
m_options = options;
m_args = args;
APM::OperationName operation = m_operations.takeFirst();
qDebug() << "prossima operazione: " << operation;
switch(operation) {
case APM::Search:
{
connect(backend, SIGNAL(queryPackagesCompleted(QUuid, QList<Akabei::Package*>)), SLOT(searchResult(QUuid,QList<Akabei::Package*>)));
backend->searchPackages(args);
backend->searchPackages(m_args);
break;
}
case APM::ListRepo:
{
listRepo(args.first());
listRepo(m_args.first());
break;
}
case APM::ShowInformation:
{
connect(backend, SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)), SLOT(showInformation(QUuid,QList<Akabei::Package*>)));
backend->searchPackages(args, Akabei::SearchNameEqual);
backend->searchPackages(m_args, Akabei::SearchNameEqual);
break;
}
case APM::ShowPackagesOfGroup:
{
connect(backend, SIGNAL(queryGroupsCompleted(QUuid,QList<Akabei::Group*>)), SLOT(showGroup(QUuid,QList<Akabei::Group*>)));
backend->queryGroups("SELECT * FROM groups WHERE name LIKE \"" + args.first() + "\"");
backend->queryGroups("SELECT * FROM groups WHERE name LIKE \"" + m_args.first() + "\"");
break;
}
......@@ -94,17 +97,10 @@ void SyncOperation::start(APM::OperationName operation, QHash<APM::OptionName, A
break;
}
case APM::UpdateDatabaseAndSystem:
{
updateDatabases();
updateSystem();
break;
}
case APM::Install:
{
connect(backend, SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)), SLOT(install(QUuid,QList<Akabei::Package*>)));
queryId = backend->searchPackages(args, Akabei::SearchNameEqual);
queryId = backend->searchPackages(m_args, Akabei::SearchNameEqual);
break;
}
......@@ -141,7 +137,6 @@ void SyncOperation::updateSystem()
queryId = Akabei::Backend::instance()->searchPackages(locals, Akabei::SearchNameEqual);
}
void SyncOperation::upgrade(QUuid uuid, QList< Akabei::Package* > packages)
{
if (packages.isEmpty() || queryId != uuid) {
......@@ -184,9 +179,9 @@ void SyncOperation::upgrade(QUuid uuid, QList< Akabei::Package* > packages)
return;
}
QueueOperation *op = new QueueOperation(m_operation, m_options, this);
QueueOperation *op = new QueueOperation(APM::UpdateSystem, m_options, this);
op->start(AkabeiClient::Update, toBeUpgraded);
connect(op, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
connect(op, SIGNAL(finished()), QCoreApplication::instance(), SLOT(nextOperation()));
}
void SyncOperation::install(QUuid uuid, QList< Akabei::Package* > packages)
......@@ -300,9 +295,9 @@ void SyncOperation::install(QUuid uuid, QList< Akabei::Package* > packages)
}
}
QueueOperation *op = new QueueOperation(m_operation, m_options, this);
QueueOperation *op = new QueueOperation(APM::Install, m_options, this);
op->start(AkabeiClient::Install, toBeInstalled.values() + toBeUpgraded.values() + toBeReinstalled.values());
connect(op, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
connect(op, SIGNAL(finished()), QCoreApplication::instance(), SLOT(nextOperation()));
}
void SyncOperation::searchResult(QUuid , QList< Akabei::Package* > packages)
......@@ -339,7 +334,7 @@ void SyncOperation::searchResult(QUuid , QList< Akabei::Package* > packages)
}
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void SyncOperation::listRepo(const QString &repo)
......@@ -366,7 +361,7 @@ void SyncOperation::listRepo(const QString &repo)
out << endl;
}
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void SyncOperation::showInformation(QUuid,QList<Akabei::Package*> packages)
......@@ -442,7 +437,7 @@ void SyncOperation::showInformation(QUuid,QList<Akabei::Package*> packages)
}
out.reset();
QCoreApplication::instance()->quit();
nextOperation();
}
void SyncOperation::showGroup(QUuid uuid,QList<Akabei::Group*> groups)
......@@ -466,7 +461,7 @@ void SyncOperation::showGroup(QUuid uuid,QList<Akabei::Group*> groups)
}
out.flush();
QCoreApplication::instance()->quit();
nextOperation();
}
void SyncOperation::updateNextDatabase()
......@@ -474,6 +469,7 @@ void SyncOperation::updateNextDatabase()
if (m_currentDatabasePos == AkabeiClient::Backend::instance()->databases().count()) {
QTextStream out(stdout);
out << i18n("Updating all databases finished") << endl;
nextOperation();
return;
}
AkabeiClient::DatabaseHandler* db = AkabeiClient::Backend::instance()->databases().at(m_currentDatabasePos);
......@@ -538,3 +534,12 @@ void SyncOperation::databaseStatusChanged(AkabeiClient::DatabaseHandler::Status
m_currentDatabasePos++;
updateNextDatabase();
}
void SyncOperation::nextOperation()
{
if (m_operations.isEmpty()) {
QCoreApplication::instance()->quit();
return;
}
start();
}
\ No newline at end of file
......@@ -22,10 +22,10 @@ class SyncOperation : public QObject
{
Q_OBJECT
public:
explicit SyncOperation(QObject* parent = 0);
explicit SyncOperation(QList<APM::OperationName> operations, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject* parent = 0);
virtual ~SyncOperation();
void start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args);
void start();
private slots:
void searchResult(QUuid,QList<Akabei::Package*>);
......@@ -38,16 +38,17 @@ private slots:
void install(QUuid,QList<Akabei::Package*>);
void upgrade(QUuid,QList<Akabei::Package*>);
void nextOperation();
private:
int m_currentDatabasePos;
int m_maxDbNameLenght;
void updateDatabases();
void updateSystem();
void updateNextDatabase();
APM::OperationName m_operation;
QList<APM::OperationName> m_operations;
QHash<APM::OptionName, AkabeiOption> m_options;
QStringList m_args;
QUuid queryId;
......
......@@ -37,13 +37,13 @@ UpgradeOperation::~UpgradeOperation()
}
void UpgradeOperation::start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args)
void UpgradeOperation::start(QList<APM::OperationName> operations, QHash<APM::OptionName, AkabeiOption> options, QStringList args)
{
QList<Akabei::Package*> pkgs;
foreach (const QString &p, args)
pkgs << Akabei::Backend::instance()->loadPackageFromFile(p);
QueueOperation *op = new QueueOperation(operation, options, this);
QueueOperation *op = new QueueOperation(operations.first(), options, this);
op->start(AkabeiClient::Install, pkgs);
connect(op, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
}
......@@ -22,7 +22,7 @@ public:
UpgradeOperation(QObject * parent = 0);
virtual ~UpgradeOperation();
void start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args);
void start(QList<APM::OperationName> operations, QHash<APM::OptionName, AkabeiOption> options, QStringList args);
};
#endif // UPGRADEOPERATION_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