From 887bcb3e044f89a8c168ad61586224b632072c4a Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 4 May 2018 21:21:14 +0200 Subject: [PATCH] Fixed version in Changelog --- Changelog | 2 +- src/lay/lay/laySaltManagerDialog.cc | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index 0a724b879b..792abaa2f4 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,4 @@ -0.25.2 (2018-05-03): +0.25.3 (2018-05-03): * Enhancement: Compile option to use libcurl instead of QtNetwork This workaround enables builds on the native CentOS6 diff --git a/src/lay/lay/laySaltManagerDialog.cc b/src/lay/lay/laySaltManagerDialog.cc index 7c2195ecf4..68639c821d 100644 --- a/src/lay/lay/laySaltManagerDialog.cc +++ b/src/lay/lay/laySaltManagerDialog.cc @@ -611,19 +611,31 @@ BEGIN_PROTECTED throw tl::Exception (tl::to_string (tr ("No package selected to delete"))); } + std::vector failed; + if (gg.size () == 1) { SaltGrain *g = gg.front (); if (QMessageBox::question (this, tr ("Delete Package"), tr ("Are you sure to delete package '%1'?").arg (tl::to_qstring (g->name ())), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { - mp_salt->remove_grain (*g); + if (! mp_salt->remove_grain (*g)) { + failed.push_back (g->name ()); + } } } else { if (QMessageBox::question (this, tr ("Delete Packages"), tr ("Are you sure to delete the selected %1 packages?").arg (int (gg.size ())), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { for (std::vector::const_iterator i = gg.begin (); i != gg.end (); ++i) { - mp_salt->remove_grain (**i); + if (! mp_salt->remove_grain (**i)) { + failed.push_back ((*i)->name ()); + } } } } + if (failed.size () == 1) { + throw tl::Exception (tl::to_string (tr ("Failed to remove package %1 (no write permissions on directory?)").arg (tl::to_qstring (failed.front ())))); + } else if (failed.size () > 1) { + throw tl::Exception (tl::to_string (tr ("Failed to remove the following packages:\n %1").arg (tl::to_qstring (tl::join (failed, "\n "))))); + } + END_PROTECTED }