Commit 9591f314 authored by Lisa's avatar Lisa

First draft of the new command line parsing system

parent e343ac82
project(akabei)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
find_package(KDE4 REQUIRED)
find_package(AkabeiClient REQUIRED)
find_package(AkabeiCore REQUIRED)
include (KDE4Defaults)
include (MacroLibrary)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
include_directories(${QT_INCLUDES}
${CMAKE_CURRENT_BINARY_DIR}
${KDE4_INCLUDE_DIR}
${AKABEICLIENT_INCLUDE_DIR}
${AKABEICORE_INCLUDE_DIR})
set(apm_SRCS queueoperation.cpp upgradeoperation.cpp removeoperation.cpp syncoperation.cpp apm.cpp queryoperation.cpp main.cpp)
set(apm_SRCS queueoperation.cpp upgradeoperation.cpp removeoperation.cpp syncoperation.cpp apm.cpp queryoperation.cpp cmdline.cpp main.cpp)
#qt4_automoc(${guzuta_SRCS})
kde4_add_executable(akabei ${apm_SRCS})
target_link_libraries(akabei ${KDE4_KDEUI_LIBRARY} ${KDE4_KIO_LIBRARY} ${AKABEICLIENT_LIBRARIES})
......
......@@ -22,10 +22,10 @@
#include <QCoreApplication>
#include <QTimer>
APM::APM(OperationType type, QList<Operation> operations, QMultiHash<Operation, QString> options, QStringList args, QObject * parent)
OperationManager::OperationManager(APM::OperationType type, APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject * parent)
: QObject(parent),
m_operationType(type),
m_operations(operations),
m_type(type),
m_operation(operation),
m_options(options),
m_args(args)
{
......@@ -33,43 +33,55 @@ APM::APM(OperationType type, QList<Operation> operations, QMultiHash<Operation,
//QCoreApplication::instance()->quit();
//QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit()));
connect(AkabeiClient::Backend::instance(), SIGNAL(statusChanged(Akabei::Backend::Status)), SLOT(statusChanged(Akabei::Backend::Status)));
QString root = options.value(APM::RootDir);
QString cache = options.value(APM::CacheDir);
QString dbs = options.value(APM::DBPath);
QString root = ".";
QString cache = ".";
QString dbs = ".";
if (options.contains(APM::RootDir)) {
root = options[APM::RootDir].args[0];
}
if (options.contains(APM::CacheDir)) {
cache = options[APM::CacheDir].args[0];
}
if (options.contains(APM::DBPath)) {
dbs = options[APM::DBPath].args[0];
}
AkabeiClient::Backend::instance()->initialize(root, cache, dbs);
}
APM::~APM()
{}
OperationManager::~OperationManager()
{
}
void APM::statusChanged(Akabei::Backend::Status status)
void OperationManager::statusChanged(Akabei::Backend::Status status)
{
if (status == Akabei::Backend::StatusReady)
start();
}
void APM::start()
void OperationManager::start()
{
switch (m_operationType) {
case QueryOperationType: {
switch (m_type) {
case APM::QueryOperationType: {
QueryOperation * query = new QueryOperation(this);
query->start(m_operations, m_options, m_args);
query->start(m_operation, m_options, m_args);
break;
}
case RemoveOperationType: {
case APM::RemoveOperationType: {
RemoveOperation * remove = new RemoveOperation(this);
remove->start(m_operations, m_options, m_args);
remove->start(m_operation, m_options, m_args);
break;
}
case SyncOperationType: {
case APM::SyncOperationType: {
SyncOperation * sync = new SyncOperation(this);
sync->start(m_operations, m_options, m_args);
sync->start(m_operation, m_options, m_args);
break;
}
case UpgradeOperationType: {
case APM::UpgradeOperationType: {
UpgradeOperation * upgrade = new UpgradeOperation(this);
upgrade->start(m_operations, m_options, m_args);
upgrade->start(m_operation, m_options, m_args);
break;
}
default:
......
......@@ -15,74 +15,23 @@
#include <QtCore/QObject>
#include <QStringList>
class APM : public QObject
#include "cmdline.h"
class OperationManager : public QObject
{
Q_OBJECT
public:
enum OperationType {
NoType = 0,
DatabaseOperationType = 1,
QueryOperationType = 2,
RemoveOperationType = 3,
SyncOperationType = 4,
UpgradeOperationType = 5
};
enum Operation {
NoOperation = 0,
///Query operations
ShowChangelog,
ShowInstalledAsDeps,
ShowInstalledExplicitely,
ShowPackagesOfGroup, //Also in Sync
ShowInformation, //Also in Sync
CheckFiles,
ShowLocal,
ShowOwner,
QueryPackageFile,
SearchLocal,
ShowNotRequired,
ShowUpgradeable,
ShowLess,
///Sync operations
Install,
AsDeps,//Also in upgrade
AsExplicit,//Also in upgrade
RemoveOldPackages,
RemoveAllPackages,
SkipDependencyCheck,//Also in Remove/Upgrade
Force,//Also in upgrade
ListRepo,
Search,
DownloadOnly,
OnlyNeeded,
Ignore,
IgnoreGroup,
UpdateDatabases,
UpdateSystem,
///Remove operations
Remove,
Cascade,
DatabaseOnly,//Also in upgrade
RemoveConfig,
Recursive,
Unneeded,
///Upgrade operation makes only use of operations specified above
///Random
RootDir,
CacheDir,
DBPath
};
explicit APM(OperationType type, QList<Operation> operations, QMultiHash<Operation, QString> options, QStringList args, QObject* parent = 0);
virtual ~APM();
explicit OperationManager(APM::OperationType type, APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args, QObject* parent = 0);
virtual ~OperationManager();
private slots:
void statusChanged(Akabei::Backend::Status);
void start();
private:
OperationType m_operationType;
QList<Operation> m_operations;
QMultiHash<Operation, QString> m_options;
APM::OperationType m_type;
APM::OperationName m_operation;
QHash<APM::OptionName, AkabeiOption> m_options;
QStringList m_args;
};
......
This diff is collapsed.
/* This file is part of the Chakra project
Copyright (C) 2011 Lisa "shainer" Vitolo <shainer@chakra-project.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef _CMDLINE_H
#define _CMDLINE_H
#include <QString>
#include <QList>
#include <QHash>
#include <klocalizedstring.h>
#include <kcmdlineargs.h>
#include <exception>
namespace APM
{
enum OperationType {
NoType, DatabaseOperationType, QueryOperationType, RemoveOperationType, SyncOperationType, UpgradeOperationType
};
typedef enum OperationType OperationType;
enum OptionName {
QueryPackageFile, ShowLocal, ShowLess, InstallAsDeps, InstallAsExplicit,
SkipDependencyCheck, Force, DownloadOnly, OnlyNeeded, Ignore, IgnoreGroup, DatabaseOnly,
RemoveConfig, Recursive,
RootDir, CacheDir, DBPath
};
typedef enum OptionName OptionName;
enum OperationName {
None,
ShowChangelog, ShowInstalledAsDeps, ShowInstalledExplicitely, ShowPackagesOfGroup, ShowPackagesOfGroupLocal, ShowInformationLocal,
ShowInformation, CheckFiles, ShowOwner, ShowNotRequired, ShowUpgradeable,
Install, RemoveOldFromCache, RemoveAllCache, ListRepo, Search, UpdateDatabases, UpdateSystem, UpdateDatabaseAndSystem,
Remove, Cascade, Unneeded, SearchLocal,
DatabaseOperation, Upgrade, Help, Version
};
typedef enum OperationName OperationName;
};
/**
* \class AkabeiOption cmdline.h "cmdline.h"
* \brief Representation of a command line option
*/
class AkabeiOption
{
private:
void init(APM::OptionName, const char *, const char *, const char *, bool, QStringList);
public:
APM::OptionName name;
QByteArray commandShort, commandLong;
KLocalizedString description;
bool hasArg;
/*
* Args are required by some options like --ignore or --ignoregroup
*/
QStringList args;
AkabeiOption(APM::OptionName, const char *, const char *, const char *, bool);
AkabeiOption(APM::OptionName, const char *, const char *, const char *, bool, QStringList);
AkabeiOption() {}
};
typedef QList<AkabeiOption> AkabeiOptionList;
/**
* \class AkabeiOperation cmdline.h "cmdline.h"
* \brief Representation of a command line operation
*/
class AkabeiOperation
{
private:
void init(APM::OperationType, APM::OperationName, const char *, const char *, const char *, bool, QStringList);
public:
APM::OperationType type;
APM::OperationName name;
QByteArray commandShort, commandLong;
KLocalizedString description;
QHash<APM::OptionName, AkabeiOption> options; /* options that can be associated to this operation */
bool hasFreeArgs;
/*
* An example of free args is the list of packages following an install command
*/
QStringList freeArgs;
AkabeiOperation();
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
*/
void addOption(AkabeiOption &);
bool isOptionSupported(APM::OptionName);
};
typedef QList<AkabeiOperation> AkabeiOperationList;
class CmdLine
{
private:
AkabeiOperation m_operation;
QHash<APM::OptionName, AkabeiOption> m_options;
QStringList m_freeArgs;
/* Database */
QMultiHash<QByteArray, AkabeiOperation> acceptedOperations;
AkabeiOptionList acceptedOptions;
QHash<QByteArray, APM::OperationType> typechars;
bool parsed;
public:
CmdLine();
void parse(int argc, char **argv);
APM::OperationType type();
APM::OperationName operation();
QHash<APM::OptionName, AkabeiOption> options();
QStringList freeArgs();
};
class CmdLineException : public std::exception
{
const char* message;
public:
CmdLineException(const char *m)
: message(m)
{}
virtual const char *what() const throw() {
return message;
}
};
#endif
This diff is collapsed.
......@@ -34,62 +34,57 @@ QueryOperation::~QueryOperation()
}
void QueryOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Operation, QString> options, QStringList args)
void QueryOperation::start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args)
{
if (operations.contains(APM::ShowInformation)) {
if (args.isEmpty())
return;
if (operations.contains(APM::QueryPackageFile)) {
if (operation == APM::ShowInformationLocal) {
if (options.contains(APM::QueryPackageFile)) {
showInformation(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
} else {
qDebug() << 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)) {
if (args.isEmpty())
return;
} 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() + "\"");
} else if (operations.contains(APM::ShowChangelog)) {
if (args.isEmpty())
return;
if (operations.contains(APM::QueryPackageFile)) {
} else if (operation == APM::ShowChangelog) {
if (options.contains(APM::QueryPackageFile)) {
showChangelog(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
} else {
showChangelog(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first()));
}
} else if (operations.contains(APM::ShowInstalledAsDeps) || operations.contains(APM::ShowInstalledExplicitely)) {
} else if (operation == APM::ShowInstalledAsDeps || operation == APM::ShowInstalledExplicitely) {
QString query = "SELECT * FROM packages WHERE";
if (!args.isEmpty())
if (!args.isEmpty()) // TODO: vedi un po' qua che vuol dire
query = query + " Name LIKE \"" + args.first() + "\" AND";
if (operations.contains(APM::ShowInstalledAsDeps))
query = query + " InstallReason LIKE " + QString::number((int)Akabei::Package::InstalledAsDependencyReason);
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 (operations.contains(APM::CheckFiles)) {
if (args.isEmpty())
return;
if (operations.contains(APM::QueryPackageFile)) {
} else if (operation == APM::CheckFiles) {
if (options.contains(APM::QueryPackageFile)) {
checkFiles(QList<Akabei::Package*>() << Akabei::Backend::instance()->loadPackageFromFile(args.first()));
} else {
checkFiles(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first()));
}
} else if (operations.contains(APM::ShowLocal)) {
} else if (operation == APM::SearchLocal) {
if (args.isEmpty())
showLocalPackages(QString());
else
showLocalPackages(args.first());
} else if (operations.contains(APM::ShowOwner) && !args.isEmpty()) {
} else if (operation == APM::ShowOwner) {
showOwner(args.first());
} else if (operations.contains(APM::SearchLocal)) {
showLocalQuery(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first()));
} else if (operations.contains(APM::ShowNotRequired)) {
} else if (operation == APM::SearchLocal) {
showLocalQuery(Akabei::Backend::instance()->localDatabase()->searchPackages(args.first(), Akabei::SearchNameEqual));
} else if (operation == APM::ShowNotRequired) {
showNotRequired();
} else if (operations.contains(APM::ShowUpgradeable)) {
} else if (operation == APM::ShowUpgradeable) {
showUpgradeable();
} else {
QTextStream err(stderr);
err << "akabei: Operation not supported yet" << endl;
QCoreApplication::instance()->quit();
}
}
......
......@@ -15,6 +15,7 @@
#include <QUuid>
#include "apm.h"
#include "cmdline.h"
#include <akabeipackage.h>
class QueryOperation : public QObject
......@@ -24,7 +25,7 @@ public:
explicit QueryOperation(QObject * parent = 0);
virtual ~QueryOperation();
void start(QList<APM::Operation> operations, QMultiHash<APM::Operation, QString> options, QStringList args);
void start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args);
private slots:
void showInformation(QList<Akabei::Package*> packages);
......
......@@ -35,23 +35,24 @@ int getcols()
return ws.ws_col;
}
QueueOperation::QueueOperation(QList<APM::Operation> operations, QMultiHash< APM::Operation, QString > options, QObject * parent)
QueueOperation::QueueOperation(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QObject * parent)
: QObject(parent),
m_operations(operations)
m_operation(operation),
m_options(options)
{
if (operations.contains(APM::Force))
if (options.contains(APM::Force))
m_processingOptions |= Akabei::Force;
if (operations.contains(APM::AsDeps))
if (options.contains(APM::InstallAsDeps))
m_processingOptions |= Akabei::InstallAsDependencies;
if (operations.contains(APM::AsExplicit))
if (options.contains(APM::InstallAsExplicit))
m_processingOptions |= Akabei::InstallAsExplicit;
if (operations.contains(APM::SkipDependencyCheck))
if (options.contains(APM::SkipDependencyCheck))
m_processingOptions |= Akabei::SkipDependencies;
if (operations.contains(APM::DownloadOnly))
if (options.contains(APM::DownloadOnly))
m_processingOptions |= Akabei::DownloadOnly;
if (operations.contains(APM::RemoveConfig))
if (options.contains(APM::RemoveConfig))
m_processingOptions |= Akabei::RemoveConfigs;
if (operations.contains(APM::DatabaseOnly))
if (options.contains(APM::DatabaseOnly))
m_processingOptions |= Akabei::DatabaseOnly;
}
......@@ -116,7 +117,7 @@ void QueueOperation::validationFinished(bool valid, QList<AkabeiClient::Transact
}
//First we check if the packages we're about to remove are needed somewhere
if (m_action == AkabeiClient::Remove && !m_operations.contains(APM::Cascade) && !(Akabei::Backend::instance()->operationRunner()->processingOptions() & Akabei::SkipDependencies)) {
if (m_action == AkabeiClient::Remove && !(Akabei::Backend::instance()->operationRunner()->processingOptions() & Akabei::SkipDependencies)) {
QList<Akabei::Package*> conflict;
foreach (AkabeiClient::QueueItem * item, AkabeiClient::Backend::instance()->queue()->items()) {
conflict << item->requiredByTree();
......@@ -323,4 +324,4 @@ void QueueOperation::transactionMessage(const QString& message)
{
QTextStream out(stdout);
out << message << endl;
}
\ No newline at end of file
}
......@@ -25,7 +25,7 @@ class QueueOperation : public QObject
{
Q_OBJECT
public:
QueueOperation(QList<APM::Operation> operations, QMultiHash< APM::Operation, QString > options, QObject * parent = 0);
QueueOperation(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QObject * parent = 0);
virtual ~QueueOperation();
void start(AkabeiClient::PackageAction action, QList<Akabei::Package*> packages);
......@@ -44,7 +44,8 @@ signals:
private:
AkabeiClient::PackageAction m_action;
Akabei::ProcessingOptions m_processingOptions;
QList<APM::Operation> m_operations;
APM::OperationName m_operation;
QHash<APM::OptionName, AkabeiOption> m_options;
QHash<Akabei::Package*, int> m_progresses;
};
......
......@@ -35,31 +35,27 @@ RemoveOperation::~RemoveOperation()
}
void RemoveOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Operation, QString> options, QStringList args)
void RemoveOperation::start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args)
{
m_operations = operations;
m_operation = operation;
m_options = options;
m_args = args;
APM::Operation operation = APM::NoOperation;
if (!operations.isEmpty())
operation = operations.first();
QString query = "SELECT * FROM packages WHERE";
foreach (const QString &pkg, args) {
query = query + " name=\"" + pkg + "\"";
if (args.last() != pkg)
query = query + " OR";
}
if (operation == APM::Unneeded) { //TODO: Implement those!
removeUnneeded(Akabei::Backend::instance()->localDatabase()->packages());
} else if (!args.isEmpty()) {
QString query = "SELECT * FROM packages WHERE";
foreach (const QString &pkg, args) {
query = query + " name=\"" + pkg + "\"";
if (args.last() != pkg)
query = query + " OR";
}
if (operations.contains(APM::Recursive))
} else if (operation == APM::Remove) {
if (options.contains(APM::Recursive)) {
removeRecursive(Akabei::Backend::instance()->localDatabase()->queryPackages(query));
else
} else {
remove(Akabei::Backend::instance()->localDatabase()->queryPackages(query));
} else if (!m_operations.isEmpty()) {
QList<APM::Operation> ops = operations;
ops.removeFirst();
start(ops, options, args);
}
} else {
QCoreApplication::instance()->quit();
}
......@@ -71,7 +67,7 @@ void RemoveOperation::remove(QList<Akabei::Package*> packages)
QCoreApplication::instance()->quit();
return;
}
QueueOperation *operation = new QueueOperation(m_operations, m_options, this);
QueueOperation *operation = new QueueOperation(m_operation, m_options, this);
operation->start(AkabeiClient::Remove, packages);
connect(operation, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
}
......@@ -90,7 +86,7 @@ void RemoveOperation::removeRecursive(QList<Akabei::Package*> packages)
pkgs << p;
}
}
QueueOperation *operation = new QueueOperation(m_operations, m_options, this);
QueueOperation *operation = new QueueOperation(m_operation, m_options, this);
operation->start(AkabeiClient::Remove, pkgs);
connect(operation, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
}
......@@ -101,7 +97,7 @@ void RemoveOperation::removeUnneeded(QList< Akabei::Package* > packages)
QCoreApplication::instance()->quit();
return;
}
qDebug() << "Remove" << packages.count() << "unnneeded";
qDebug() << "APM::Remove" << packages.count() << "unnneeded";
QList<Akabei::Package*> unneeded;
foreach (Akabei::Package * pkg, packages) {
bool required = false;
......@@ -117,7 +113,7 @@ void RemoveOperation::removeUnneeded(QList< Akabei::Package* > packages)
QCoreApplication::instance()->quit();
return;
}
QueueOperation *operation = new QueueOperation(m_operations, m_options, this);
QueueOperation *operation = new QueueOperation(m_operation, m_options, this);
operation->start(AkabeiClient::Remove, unneeded);
connect(operation, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
}
......@@ -13,6 +13,7 @@
#include <QObject>
#include "apm.h"
#include "cmdline.h"
#include <akabeierror.h>
class RemoveOperation : public QObject
......@@ -22,7 +23,7 @@ public:
RemoveOperation(QObject * parent = 0);
virtual ~RemoveOperation();
void start(QList<APM::Operation> operations, QMultiHash<APM::Operation, QString> options, QStringList args);
void start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args);
public slots:
void remove(QList<Akabei::Package*> packages);
......@@ -30,8 +31,8 @@ public slots:
void removeUnneeded(QList< Akabei::Package* > packages);
private:
QList<APM::Operation> m_operations;
QMultiHash<APM::Operation, QString> m_options;
APM::OperationName m_operation;
QHash<APM::OptionName, AkabeiOption> m_options;
QStringList m_args;
};
......
......@@ -45,47 +45,31 @@ 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(QList<APM::Operation> operations, QMultiHash<APM::Operation, QString> options, QStringList args)
void SyncOperation::start(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QStringList args)
{
APM::Operation operation = operations.takeFirst();
QTextStream err(stderr);
Akabei::Backend *backend = Akabei::Backend::instance();
m_operations = operations;
m_operation = operation;
m_options = options;
m_args = args;
switch(operation) {
case APM::Search:
{
if (args.isEmpty()) {
err << i18n("akabei: An argument is needed.") << endl;
return;
}
{
connect(backend, SIGNAL(queryPackagesCompleted(QUuid, QList<Akabei::Package*>)), SLOT(searchResult(QUuid,QList<Akabei::Package*>)));
backend->searchPackages(args);
break;
}
case APM::ListRepo:
{
if (args.isEmpty()) {
err << i18n("akabei: An argument is needed.") << endl;
return;
}
{
listRepo(args.first());
break;
}
case APM::ShowInformation:
{
if (args.isEmpty()) {
err << i18n("akabei: An argument is needed") << endl;
return;
}
connect(backend, SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)), SLOT(showInformation(QUuid,QList<Akabei::Package*>)));
backend->searchPackages(args, Akabei::SearchNameEqual);
break;
......@@ -93,11 +77,6 @@ void SyncOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Oper
case APM::ShowPackagesOfGroup:
{
if (args.isEmpty()) {
err << i18n("akabei: An argument is needed") << endl;
return;
}
connect(backend, SIGNAL(queryGroupsCompleted(QUuid,QList<Akabei::Group*>)), SLOT(showGroup(QUuid,QList<Akabei::Group*>)));
backend->queryGroups("SELECT * FROM groups WHERE name LIKE \"" + args.first() + "\"");
break;
......@@ -105,40 +84,25 @@ void SyncOperation::start(QList<APM::Operation> operations, QMultiHash<APM::Oper
case APM::UpdateDatabases:
{
if (AkabeiClient::Backend::instance()->databases().isEmpty()) {
return;
}
QTextStream out(stdout);
out << i18n("Starting database update") << endl;
foreach (AkabeiClient::DatabaseHandler* db, AkabeiClient::Backend::instance()->databases()) {
if (db->name().length() > m_maxDbNameLenght)
m_maxDbNameLenght = db->name().length();
}
m_currentDatabasePos = 0;
updateNextDatabase();
updateDatabases();
break;
}
case APM::UpdateSystem: