Commit 91c2b116 authored by Lukas Appelhans's avatar Lukas Appelhans

Open file and more

parent 57b1142f
......@@ -13,6 +13,7 @@
#include <QTemporaryFile>
#include <qtextstream.h>
#include <QDebug>
Akabei::Hook::Hook(const QString& name, const QString &content, QList<Akabei::Package*> pkgs)
: d_ptr(new HookPrivate(name, content, pkgs))
......@@ -50,6 +51,7 @@ QString Akabei::Hook::path()
return d->file->fileName();
d->file = new QTemporaryFile();
d->file->open();
QTextStream out(d->file);
out << d->content;
out.flush();
......
......@@ -88,15 +88,15 @@ void PlainHookOperation::add(const QList<Hook*> &hooks)
void PlainHookOperation::run()
{
qDebug() << "Run hookoperation";
qDebug() << "Run hookoperation with" << d->hooks.count() << "hooks";
d->it = d->hooks.begin();
d->process();
setFinished(true);
}
void PlainHookOperation::Private::process()
{
if (it == hooks.end()) {
qDebug() << "At end...";
q->setFinished(true);
return;
}
......@@ -106,6 +106,7 @@ void PlainHookOperation::Private::process()
q->connect(process, SIGNAL(errorsOccured(QList<Akabei::Error*>)), SLOT(slotErrors(QList<Akabei::Error*>)));
q->connect(process, SIGNAL(finished(bool)), SLOT(slotFinished(bool)));
q->connect(process, SIGNAL(addMessage(QString)), SLOT(slotMessage(QString)));
qDebug() << "Run" << QString("sh %1").arg((*it)->path());
process->run(QString("sh %1").arg((*it)->path()));
}
......@@ -117,6 +118,7 @@ void PlainHookOperation::Private::slotErrors(QList< Error* > errors)
void PlainHookOperation::Private::slotFinished(bool fin)
{
if (fin) {
qDebug() << "Process next";
it++;
process();
}
......
......@@ -11,6 +11,8 @@
#include "akabeiplainreinstalloperation.h"
#include "akabeiplainhookoperation.h"
#include <akabeipackage.h>
#include <QtCore/QFile>
#include <QDateTime>
......@@ -245,8 +247,9 @@ void PlainReInstallOperation::validate()
}
// Same for hooks
if (!d->package->hasHooks()) {
// TODO add hooks
if (d->package->hasHooks()) {
qDebug() << "We have hooks" << d->package->hooks();
PlainHookOperation::instance()->add(d->package->retrieveHooks());
}
}
......
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