summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Riddell <jr@jriddell.org>2016-09-26 16:29:46 (GMT)
committerJonathan Riddell <jr@jriddell.org>2016-09-26 16:29:46 (GMT)
commitd28eb4c620bc1d36d6c396dd6dc1bd421e7f22ae (patch)
tree59dcb9bf0499a74143715bc36ee29ea148b03514
parent8431c32e087f8ca9b3dfe8e25f02ea55ee93ce00 (diff)
i18n, check return from appstream, give dialog parent
-rw-r--r--app/kipiinterface.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/kipiinterface.cpp b/app/kipiinterface.cpp
index f7c2040..64d4b72 100644
--- a/app/kipiinterface.cpp
+++ b/app/kipiinterface.cpp
@@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <KXMLGUIFactory>
#include <KDirLister>
#include <KLocalizedString>
+#include <KMessageBox>
// KIPI
#include <kipi/imagecollectionshared.h>
@@ -356,7 +357,7 @@ void KIPIInterface::loadOnePlugin()
void KIPIInterface::slotInstallPlugins(bool checked) {
Q_UNUSED(checked);
m_installTransaction = 0;
- d->installDialog = new QProgressDialog(i18n("Installing Plugins..."), i18n("Cancel"), 0, 100);
+ d->installDialog = new QProgressDialog(i18n("Installing Plugins..."), i18n("Cancel"), 0, 100, d->mMainWindow);
d->installDialog->setWindowModality(Qt::WindowModal);
d->installDialog->setAutoClose(false);
connect(d->installDialog, SIGNAL(canceled()), SLOT(cancelInstall()));
@@ -364,7 +365,13 @@ void KIPIInterface::slotInstallPlugins(bool checked) {
Appstream::Database appstreamDatabase;
appstreamDatabase.open();
Appstream::Component kipiPlugins = appstreamDatabase.componentById("photolayoutseditor.desktop");
- QString package = kipiPlugins.packageNames()[0]; //TODO check
+ QString package;
+ if (kipiPlugins.packageNames().length() > 0) {
+ package = kipiPlugins.packageNames()[0];
+ } else {
+ KMessageBox::sorry(d->mMainWindow, i18n("Could not install plugins."));
+ return;
+ }
PackageKit::Transaction *transaction = PackageKit::Daemon::resolve(package,
PackageKit::Transaction::FilterArch);
@@ -387,7 +394,7 @@ void KIPIInterface::packageInstall(PackageKit::Transaction::Info, QString packag
void KIPIInterface::packageFinished(PackageKit::Transaction::Exit status, uint runtime) {
if (status == PackageKit::Transaction::Exit::ExitSuccess) {
- d->installDialog->setLabelText("Image plugins have been installed.");
+ d->installDialog->setLabelText(i18n("Image plugins have been installed."));
d->installDialog->setValue(100);
d->installDialog->setCancelButtonText("&Close");
d->mPluginLoader = 0;