Commit 046609cd authored by Lukas Appelhans's avatar Lukas Appelhans

More stuff

parent 11d5643e
......@@ -131,14 +131,20 @@ void SyncOperation::install(QUuid , QList< Akabei::Package* > packages)
AkabeiClient::Backend::instance()->queue()->addPackage(pkg, AkabeiClient::Install);
}
connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(validationFinished(bool)), SLOT(validationFinished(bool)));
connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(errorsOccurred(QList<Akabei::Error*>&)), SLOT(errors(QList<Akabei::Error*>&)));
AkabeiClient::Backend::instance()->transactionHandler()->validate();
}
void SyncOperation::validationFinished(bool valid)
{
QTextStream out(stdout);
if (!valid) {
out << "Queue not valid" << endl;
out.flush();
return;
}
int downloadSize = 0;
int installSize = 0;
QTextStream out(stdout);
out << "Packages: ";
foreach (AkabeiClient::QueueItem * item, AkabeiClient::Backend::instance()->queue()->items()) {
if (item != AkabeiClient::Backend::instance()->queue()->items().first())
......@@ -160,6 +166,33 @@ void SyncOperation::validationFinished(bool valid)
out << "Download size: " << KIO::convertSize(downloadSize) << endl;
out << "Installed size: " << KIO::convertSize(installSize) << endl;
out.flush();
out << "Continue with installation?[y/n]";
out.flush();
//std::string input;
//getline(std::cin, input);
//if (input != "y")
// return;
kDebug() << "Let's install";
connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(progressChanged(int)), SLOT(showProgress(int)));
Akabei::ProcessingOptions options;
AkabeiClient::Backend::instance()->transactionHandler()->process(options);
}
void SyncOperation::showProgress(int progress)
{
kDebug() << progress;
}
void SyncOperation::errors(QList<Akabei::Error*>& errors)
{
kDebug() << "yoyoyo";
QTextStream out(stdout);
out << "Errors occurred: " << endl;
foreach (Akabei::Error * err, errors) {
out << err->description() << endl;
}
out.flush();
}
void SyncOperation::searchResult(QUuid , QList< Akabei::Package* > packages)
......
......@@ -15,6 +15,7 @@
#include <QUuid>
#include "apm.h"
#include <akabeiclient/akabeidatabasehandler.h>
#include <akabeierror.h>
class SyncOperation : public QObject
{
......@@ -35,6 +36,8 @@ private slots:
void databaseErrorTriggered(int);
void install(QUuid,QList<Akabei::Package*>);
void validationFinished(bool valid);
void showProgress(int);
void errors(QList<Akabei::Error*>& errors);
private:
int currentDatabasePos;
......
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