Commit 04130844 authored by Lukas Appelhans's avatar Lukas Appelhans

Show proper error messages

parent f6aa7bbe
......@@ -121,7 +121,7 @@ bool SyncOperation::isIgnored(Akabei::Package *pkg)
void SyncOperation::updateDatabases()
{
QTextStream out(stdout);
out << i18n("Starting database update") << endl;
out << i18n("Starting database update ...") << endl;
foreach (AkabeiClient::DatabaseHandler* db, AkabeiClient::Backend::instance()->databases()) {
if (db->name().length() > m_maxDbNameLenght)
......@@ -134,19 +134,19 @@ void SyncOperation::updateDatabases()
void SyncOperation::updateSystem()
{
Akabei::Package::List toBeUpgraded;
foreach (Akabei::Package *p, Akabei::Backend::instance()->localDatabase()->packages()) {
if (isIgnored(p)) {
continue;
}
Akabei::Package *latest = Akabei::Helpers::latestVersionOfPackage(p->name());
if (latest && latest->version() > p->version()) {
toBeUpgraded.append(latest);
}
}
QueueOperation *op = new QueueOperation(APM::UpdateSystem, m_options, this);
op->start(AkabeiClient::Update, toBeUpgraded);
connect(op, SIGNAL(finished()), SLOT(nextOperation()));
......@@ -351,16 +351,16 @@ void SyncOperation::updateNextDatabase()
AkabeiClient::DatabaseHandler* db = AkabeiClient::Backend::instance()->databases().at(m_currentDatabasePos);
connect(db, SIGNAL(statusChanged(AkabeiClient::DatabaseHandler::Status)), this, SLOT(databaseStatusChanged(AkabeiClient::DatabaseHandler::Status)));
connect(db, SIGNAL(progress(int)), this, SLOT(databaseProgressChanged(int)));
connect(db, SIGNAL(errorTriggered(int)), this, SLOT(databaseErrorTriggered(int)));
connect(db, SIGNAL(errorTriggered(Akabei::Error::List)), this, SLOT(databaseErrorTriggered(Akabei::Error::List)));
db->update(m_options.contains(APM::Force));
}
void SyncOperation::databaseErrorTriggered(int error)
void SyncOperation::databaseErrorTriggered(Akabei::Error::List errors)
{
Q_UNUSED(error)
QTextStream err(stderr);
//FIXME: Show proper error message
err << i18n("There has been an error while updating %1!", static_cast<AkabeiClient::DatabaseHandler*>(QObject::sender())->name()) << endl;
err << i18n("There has been an error while updating %1: ", static_cast<AkabeiClient::DatabaseHandler*>(QObject::sender())->name());
foreach (Akabei::Error error, errors)
err << error.description() << endl;
}
void SyncOperation::databaseProgressChanged(int progress)
......@@ -396,7 +396,7 @@ void SyncOperation::databaseStatusChanged(AkabeiClient::DatabaseHandler::Status
AkabeiClient::DatabaseHandler* db = AkabeiClient::Backend::instance()->databases().at(m_currentDatabasePos);
disconnect(db, SIGNAL(statusChanged(AkabeiClient::DatabaseHandler::Status)), this, SLOT(databaseStatusChanged(AkabeiClient::DatabaseHandler::Status)));
disconnect(db, SIGNAL(progress(int)), this, SLOT(databaseProgressChanged(int)));
disconnect(db, SIGNAL(errorTriggered(int)), this, SLOT(databaseErrorTriggered(int)));
disconnect(db, SIGNAL(errorTriggered(Akabei::Error::List)), this, SLOT(databaseErrorTriggered(Akabei::Error::List)));
QTextStream out(stdout);
if (status == AkabeiClient::DatabaseHandler::StatusUpToDate) {
......
......@@ -33,7 +33,7 @@ private slots:
void showGroup(QUuid,QList<Akabei::Group*>);
void databaseStatusChanged(AkabeiClient::DatabaseHandler::Status);
void databaseProgressChanged(int);
void databaseErrorTriggered(int);
void databaseErrorTriggered(Akabei::Error::List);
void install(QUuid,QList<Akabei::Package*>);
void nextOperation();
......@@ -45,7 +45,7 @@ private:
void updateDatabases();
void updateSystem();
void updateNextDatabase();
bool isIgnored(Akabei::Package *);
QList<APM::OperationName> m_operations;
......
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