Commit 54794ee6 authored by Lukas Appelhans's avatar Lukas Appelhans
Browse files

Implement some processingoption and more error messages yay :)

parent d82f316a
......@@ -177,7 +177,7 @@ QList< Error* > Operation::errors() const
return d->errors;
}
ProcessingOptions Operation::processOptions() const
ProcessingOptions Operation::processingOptions() const
{
Q_D(const Operation);
return d->processingOptions;
......
......@@ -84,7 +84,7 @@ public:
QString description() const;
ProcessingOptions processOptions() const;
ProcessingOptions processingOptions() const;
protected:
explicit Operation(const QString &targetName);
......
......@@ -31,6 +31,7 @@
#include <sqlite3.h>
#include "akabeiplainscriptletoperation.h"
#include <akabeierror.h>
namespace Akabei {
......@@ -100,7 +101,7 @@ void PlainInstallOperation::run()
if (archive_read_open_filename(archive, d->package->pathToArchive().toUtf8().data(),
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
// TODO handle
setErrors(QList<Akabei::Error*>() << new Akabei::Error(Akabei::Error::UnknownError, QObject::tr("Could not open package file."), this));
setFinished(false);
return;
}
......@@ -132,12 +133,12 @@ void PlainInstallOperation::run()
archive_read_finish(archive);
/* restore the old cwd is we have it */
if(currentDir.exists()) {
if (currentDir.exists()) {
chdir(currentDir.absolutePath().toUtf8().data());
}
if(errs) {
// TODO handle
if (errs) {
setErrors(QList<Akabei::Error*>() << new Akabei::Error(Akabei::Error::FilesystemConflictError, QObject::tr("There have been %1 file conflict(s).", "", errs), this));
setFinished(false);
return;
}
......@@ -146,6 +147,11 @@ void PlainInstallOperation::run()
QDateTime dt = QDateTime::currentDateTime();
// And set the install reason TODO
Package::InstallReason reason = Package::ExplicitlyInstalledReason;
if (processingOptions() & InstallAsDependencies) {
reason = Package::InstalledAsDependencyReason;
} else if (processingOptions() & InstallAsExplicit) {
reason = Package::ExplicitlyInstalledReason;
}
// Create a new package.
Package *p = d->package->generateInstalledPackage(reason, dt);
......
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