diff options
author | Tim Jenssen <tim.jenssen@nokia.com> | 2011-12-15 13:28:30 +0100 |
---|---|---|
committer | Alexander Lenhardt <alexander.lenhardt@nokia.com> | 2011-12-15 14:30:59 +0100 |
commit | ab02e01224111725def138db1c2d5b4daabbbf3a (patch) | |
tree | 4c7c8af99f5d0dd145b390d8e52691f808a54c9f /installerbuilder/libinstaller | |
parent | 75fcb2cbc0ad54d91e446150f10954a294d90bfe (diff) |
improve parse arguments at operationrunner
- and don't pollute args with this cleanlooks hack
Change-Id: I6cacd33b5c02effe267fabc745b1e8f1aab77166
Reviewed-by: Alexander Lenhardt <alexander.lenhardt@nokia.com>
Diffstat (limited to 'installerbuilder/libinstaller')
-rw-r--r-- | installerbuilder/libinstaller/operationrunner.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/installerbuilder/libinstaller/operationrunner.cpp b/installerbuilder/libinstaller/operationrunner.cpp index fc8a11fd0..e4d6ec5d0 100644 --- a/installerbuilder/libinstaller/operationrunner.cpp +++ b/installerbuilder/libinstaller/operationrunner.cpp @@ -99,19 +99,22 @@ int OperationRunner::runOperation(const QStringList &arguments) << "are working as expected." << std::endl; } - QStringList argumentList = arguments; - bool isPerformType = argumentList.contains(QLatin1String("--runoperation")); - bool isUndoType = argumentList.contains(QLatin1String("--undooperation")); - argumentList.removeFirst(); //the application name itself - argumentList.removeAll(QLatin1String("--runoperation")); - argumentList.removeAll(QLatin1String("--undooperation")); - argumentList.removeAll(QLatin1String("--verbose")); + bool isPerformType = arguments.contains(QLatin1String("--runoperation")); + bool isUndoType = arguments.contains(QLatin1String("--undooperation")); if ((!isPerformType && !isUndoType) || (isPerformType && isUndoType)) { std::cerr << "wrong arguments are used, cannot run this operation"; return EXIT_FAILURE; } + QStringList argumentList; + + if (isPerformType) + argumentList = arguments.mid(testStringList.indexOf("--runoperation") + 1); + else + argumentList = arguments.mid(testStringList.indexOf("--undooperation") + 1); + + try { const QString operationName = argumentList.takeFirst(); KDUpdater::UpdateOperation* const operation = KDUpdater::UpdateOperationFactory::instance() |