Commit 45081996 authored by Lisa's avatar Lisa

Reverted previous commit which broke code style

parent 76c0acee
...@@ -158,7 +158,7 @@ CmdLine::CmdLine() ...@@ -158,7 +158,7 @@ CmdLine::CmdLine()
QList<AkabeiOperation *> tmp; QList<AkabeiOperation *> tmp;
tmp << &removeallcache << &help << &version << &install << &remove << &database << &changelog << &installedasdeps << &installedexp; tmp << &removeallcache << &help << &version << &install << &remove << &database << &changelog << &installedasdeps << &installedexp;
tmp << &checkfiles << &showowner << &notrequired << &upgradeable << &cascade; tmp << &checkfiles << &showowner << &notrequired << &upgradeable << &cascade;
tmp << &removeold << &groups << &info << &listrepo << &groupsl << &searchl << &infol << &unneeded; tmp << &removeold << &groups << &info << &listrepo << &groupsl << &searchl << &infol;
tmp << &search << &updatedb << &updatesys << &updatedbandsys << &upgrade; tmp << &search << &updatedb << &updatesys << &updatedbandsys << &upgrade;
/* /*
...@@ -445,7 +445,6 @@ void CmdLine::parse(int argc, char** argv) ...@@ -445,7 +445,6 @@ void CmdLine::parse(int argc, char** argv)
} }
secondParse(KCmdLineArgs::allArguments(), found); secondParse(KCmdLineArgs::allArguments(), found);
/* /*
* Gets all the other arguments around * Gets all the other arguments around
*/ */
...@@ -456,7 +455,7 @@ void CmdLine::parse(int argc, char** argv) ...@@ -456,7 +455,7 @@ void CmdLine::parse(int argc, char** argv)
if (!m_freeArgs.isEmpty() && !m_operation.hasFreeArgs) { if (!m_freeArgs.isEmpty() && !m_operation.hasFreeArgs) {
throw CmdLineException("unexpected free arguments."); throw CmdLineException("unexpected free arguments.");
} }
if (m_freeArgs.isEmpty() && m_operation.hasFreeArgs) { if (m_freeArgs.isEmpty() && m_operation.hasFreeArgs) {
throw CmdLineException("free arguments required but not present."); throw CmdLineException("free arguments required but not present.");
} }
...@@ -466,7 +465,7 @@ void CmdLine::parse(int argc, char** argv) ...@@ -466,7 +465,7 @@ void CmdLine::parse(int argc, char** argv)
} }
/* /*
* This function handles all the parsing which can't be handled by KDE classes * This function handles all the parsing which can't be handled before
* In particular, checks * In particular, checks
* * if the operation is repeated more than once (not accepted) * * 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) * * if there's something "out of context" in the command line (like, some meaningless command)
...@@ -522,8 +521,7 @@ void CmdLine::secondParse(QStringList args, QList<QByteArray>& foundCmds) ...@@ -522,8 +521,7 @@ void CmdLine::secondParse(QStringList args, QList<QByteArray>& foundCmds)
*/ */
foreach(const QByteArray & com, cmdline) { foreach(const QByteArray & com, cmdline) {
if (!foundCmds.contains(com)) { if (!foundCmds.contains(com)) {
QString msg = "out of context operation: " + com; throw CmdLineException("Out of context operation");
throw CmdLineException(msg.toUtf8().data());
} }
} }
......
...@@ -48,7 +48,7 @@ void RemoveOperation::start(APM::OperationName operation, QHash<APM::OptionName, ...@@ -48,7 +48,7 @@ void RemoveOperation::start(APM::OperationName operation, QHash<APM::OptionName,
query = query + " OR"; query = query + " OR";
} }
if (operation == APM::Unneeded) { if (operation == APM::Unneeded) { //TODO: Implement those!
removeUnneeded(Akabei::Backend::instance()->localDatabase()->packages()); removeUnneeded(Akabei::Backend::instance()->localDatabase()->packages());
} else if (operation == APM::Remove) { } else if (operation == APM::Remove) {
if (options.contains(APM::Recursive)) { if (options.contains(APM::Recursive)) {
...@@ -102,10 +102,7 @@ void RemoveOperation::removeUnneeded(QList< Akabei::Package* > packages) ...@@ -102,10 +102,7 @@ void RemoveOperation::removeUnneeded(QList< Akabei::Package* > packages)
foreach(Akabei::Package * pkg, packages) { foreach(Akabei::Package * pkg, packages) {
bool required = false; bool required = false;
foreach(Akabei::Package * p, pkg->computeRequiredBy()) { foreach(Akabei::Package * p, pkg->computeRequiredBy()) {
/* FIXME: isn't this quite useless, since packages contains only the local ones? */
required = required || p->database() == Akabei::Backend::instance()->localDatabase(); required = required || p->database() == Akabei::Backend::instance()->localDatabase();
if (required) if (required)
break; 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