Commit 8431c309 authored by Lisa's avatar Lisa

Fixes around

parent 53a7e5f7
......@@ -33,9 +33,9 @@ OperationManager::OperationManager(APM::OperationType type, APM::OperationName o
//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 = ".";
QString cache = ".";
QString dbs = ".";
QString root;
QString cache;
QString dbs;
if (options.contains(APM::RootDir)) {
root = options[APM::RootDir].args[0];
......
......@@ -12,8 +12,6 @@
#include <kaboutdata.h>
#include <klocalizedstring.h>
#include <QDebug>
/*
* Build our database of accepted operations and options with the right properties and associations
*/
......@@ -214,7 +212,6 @@ AkabeiOperation::AkabeiOperation()
/*
* This requires some explanation
*
* 0: APM::None means no operation has still been set, so no problem here.
* 1: -S is Install, but for example -Ss is Search. Same for most removing operations. This overlapping is fine.
* 2: the elements in a hash aren't sorted, so "s" may be found before "S".
......@@ -345,6 +342,10 @@ void CmdLine::parse(int argc, char** argv)
throw CmdLineException("multiple types present.");
}
type = it.value();
if (type == APM::QueryOperationType) {
found << "Q";
}
/*
* We look only for the acceptable operations
......@@ -399,6 +400,13 @@ void CmdLine::parse(int argc, char** argv)
throw CmdLineException("invalid option for this operation");
}
if (!opt.commandShort.isEmpty()) {
found << opt.commandShort;
}
if (!opt.commandLong.isEmpty()) {
found << opt.commandLong;
}
/*
* Gets arguments associated with the option
*/
......@@ -442,7 +450,6 @@ void CmdLine::parse(int argc, char** argv)
}
args->clear(); /* frees up memory */
secondParse(KCmdLineArgs::allArguments(), found);
parsed = true;
}
......@@ -453,7 +460,7 @@ void CmdLine::parse(int argc, char** argv)
* * if the operation is repeated more than once (not accepted)
* * if there's something "out of context" in the command line (like, some meaningless command)
*/
void CmdLine::secondParse(QStringList args, QList<QByteArray> foundCmds)
void CmdLine::secondParse(QStringList args, QList<QByteArray>& foundCmds)
{
QList<QByteArray> cmdline;
......@@ -464,11 +471,23 @@ void CmdLine::secondParse(QStringList args, QList<QByteArray> foundCmds)
/* Long command */
if (part.at(0) == '-' && part.at(1) == '-') {
cmdline << part.remove(0, 2).toUtf8();
part.remove(0, 2);
int sep = part.indexOf("=");
if (sep != -1) {
part.truncate(sep);
}
cmdline << part.toUtf8();
/* Short command: takes each letter separately */
} else if (part.at(0) == '-') {
part.remove(0, 1);
int sep = part.indexOf("=");
if (sep != -1) {
part.truncate(sep);
}
/* The only short commands with two letters is treated separately to avoid problems */
if (part.contains("cc")) {
if (part.count("cc") > 1) {
......
......@@ -130,7 +130,7 @@ private:
bool parsed;
void secondParse(QStringList, QList<QByteArray>);
void secondParse(QStringList, QList<QByteArray> &);
public:
CmdLine();
......
......@@ -40,7 +40,6 @@ void QueryOperation::start(APM::OperationName operation, QHash<APM::OptionName,
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
}
......@@ -191,7 +190,7 @@ void QueryOperation::checkFiles(QList<Akabei::Package*> packages)
}
void QueryOperation::showLocalPackages(const QString &query)
{
{
QTextStream out(stdout);
QList<Akabei::Package*> packages;
if (!query.isEmpty())
......
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