Verified Commit bb370a6f authored by azubieta's avatar azubieta
Browse files

Improve progress messages

parent ebb4a591
......@@ -15,8 +15,8 @@ void InstallJob::start() {
qDebug() << "calling pkexec appimage-services install " << target;
connect(&process, SIGNAL(finished(int)), this, SLOT(onProcessFinished(int)));
description(this, i18n("Installing Application"),
qMakePair<QString, QString>(i18nc("The AppImage being installed", "Source"), target));
description(this, i18n("Installing application"),
qMakePair<QString, QString>(i18nc("The AppImage being installed", "Application"), target));
process.start();
}
......
......@@ -12,7 +12,8 @@ RemoveJob::RemoveJob(const QString& target, QObject* parent)
QDBusConnection::sessionBus(), this)) {}
void RemoveJob::start() {
description(this, i18n("Removing launcher entry"));
description(this, i18n("Removing launcher entry"),
qMakePair<QString, QString>(i18nc("Target AppImage", "Application"), target));
auto reply = launcherInterface->unregisterApp(target);
if (reply.isError()) {
......@@ -30,7 +31,7 @@ void RemoveJob::callFinishedSlot(QDBusPendingCallWatcher* watcher) {
setError(-1);
setErrorText(watcher->error().message());
} else
infoMessage(this, i18n("Application successfully removed"));
infoMessage(this, i18n("Entry removed"));
// notify result delayed
QTimer::singleShot(1000, this, &RemoveJob::emitResult);
......
......@@ -15,8 +15,8 @@ void UninstallJob::start() {
qDebug() << "calling pkexec appimage-services install " << target;
connect(&process, SIGNAL(finished(int)), this, SLOT(onProcessFinished(int)));
description(this, i18n("Uninstalling Application"),
qMakePair<QString, QString>(i18nc("The AppImage being uninstalled", "Source"), target));
description(this, i18n("Uninstalling application"),
qMakePair<QString, QString>(i18nc("The AppImage being uninstalled", "Application"), target));
process.start();
}
......@@ -27,6 +27,8 @@ void UninstallJob::onProcessFinished(int exitCode) {
if (exitCode != 0) {
setError(exitCode);
setErrorText(process.readAllStandardError());
} else {
infoMessage(this, i18n("Application uninstalled"));
}
// notify result delayed
......
// libraries
#include <QFile>
#include <QDebug>
#include <KLocalizedString>
#include <KNotification>
#include <QTimer>
......@@ -25,16 +23,13 @@ void UpdateJob::onBytesReceivedChanged(int value) {
void UpdateJob::onStateChanged(int state) {
switch (state) {
case 10:
description(this, i18nc("Job heading, like 'Copying'", "Reading update data"),
qMakePair<QString, QString>(i18nc("The AppImage being updated", "Source"), target));
infoMessage(this, i18nc("Job heading, like 'Copying'", "Reading update data"));
break;
case 20:
description(this, i18nc("Job heading, like 'Copying'", "Looking for updates"),
qMakePair<QString, QString>(i18nc("The AppImage being updated", "Source"), target));
infoMessage(this, i18nc("Job heading, like 'Copying'", "Looking for updates"));
break;
case 30:
description(this, i18nc("Job heading, like 'Copying'", "Downloading"),
qMakePair<QString, QString>(i18nc("The AppImage being updated", "Source"), target));
infoMessage(this, i18nc("Job heading, like 'Copying'", "Downloading update"));
break;
// final states
case 21:
......@@ -58,6 +53,9 @@ bool UpdateJob::doKill() {
}
void UpdateJob::start() {
description(this, i18nc("Job heading, like 'Copying'", "Updating application"),
qMakePair<QString, QString>(i18nc("The AppImage being updated", "Application"), target));
if (error() == 0)
connectUpdaterInterface();
......@@ -146,15 +144,6 @@ void UpdateJob::onError(int errorCode) {
setErrorText(errorTitle);
}
void UpdateJob::notifyError(const QString& title, const QString& message, QWidget* parentWidget) {
KNotification* notify = new KNotification(QStringLiteral("notification"), parentWidget,
KNotification::CloseOnTimeout | KNotification::DefaultEvent);
notify->setTitle(title);
notify->setText(message);
notify->setIconName("dialog-warning");
notify->sendEvent();
}
void UpdateJob::emitResultDelayed() {
QTimer::singleShot(400, [this]() {
emitResult();
......
......@@ -20,8 +20,6 @@ public:
void start() override;
static void notifyError(const QString& title, const QString& message, QWidget* parentWidget = nullptr);
protected slots:
void onBytesTotalChanged(int total);
......
Supports Markdown
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