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