Commit 6bdfbdef authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Change the update all button into a cancel button while updating

BUG: 386243
parent b8096e9d
......@@ -80,9 +80,18 @@ DiscoverPage
Layout.minimumWidth: Kirigami.Units.gridUnit * 6
Layout.rightMargin: Kirigami.Units.gridUnit
text: unselectedItem.visible ? i18n("Update Selected") : i18n("Update All")
enabled: !resourcesUpdatesModel.isProgressing
visible: !resourcesUpdatesModel.isProgressing
onClicked: page.start()
}
Button {
Layout.minimumWidth: Kirigami.Units.gridUnit * 6
Layout.rightMargin: Kirigami.Units.gridUnit
iconName: "dialog-cancel"
text: i18n("Cancel")
enabled: resourcesUpdatesModel.transaction && resourcesUpdatesModel.transaction.isCancellable
visible: resourcesUpdatesModel.isProgressing
onClicked: resourcesUpdatesModel.transaction.cancel()
}
}
}
......
......@@ -250,4 +250,9 @@ void ResourcesUpdatesModel::setTransaction(UpdateTransaction* transaction)
Q_EMIT progressingChanged();
}
Transaction* ResourcesUpdatesModel::transaction() const
{
return m_transaction.data();
}
#include "ResourcesUpdatesModel.moc"
......@@ -32,6 +32,7 @@ class QAction;
class AbstractBackendUpdater;
class ResourcesModel;
class QDBusInterface;
class Transaction;
class UpdateTransaction;
class DISCOVERCOMMON_EXPORT ResourcesUpdatesModel : public QStandardItemModel
......@@ -40,6 +41,7 @@ class DISCOVERCOMMON_EXPORT ResourcesUpdatesModel : public QStandardItemModel
Q_PROPERTY(bool isProgressing READ isProgressing NOTIFY progressingChanged)
Q_PROPERTY(QDateTime lastUpdate READ lastUpdate NOTIFY progressingChanged)
Q_PROPERTY(qint64 secsToLastUpdate READ secsToLastUpdate NOTIFY progressingChanged)
Q_PROPERTY(Transaction* transaction READ transaction NOTIFY progressingChanged)
public:
explicit ResourcesUpdatesModel(QObject* parent = nullptr);
......@@ -54,6 +56,7 @@ class DISCOVERCOMMON_EXPORT ResourcesUpdatesModel : public QStandardItemModel
qint64 secsToLastUpdate() const;
QVector<AbstractBackendUpdater*> updaters() const { return m_updaters; }
Transaction* transaction() const;
Q_SIGNALS:
void downloadSpeedChanged();
......
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