diff options
| author | Aleix Pol <aleixpol@kde.org> | 2015-10-15 14:37:16 (GMT) |
|---|---|---|
| committer | Aleix Pol <aleixpol@kde.org> | 2015-10-15 14:37:16 (GMT) |
| commit | ed9ae251c0e76998e4ef264e0ff29251d71f0dd8 (patch) | |
| tree | 19f67eb80d70bf9894d22a18cfbedada10aaf470 | |
| parent | 7534e9029dc1d63e32ef00d3add7161ee7df948b (diff) | |
Show the transactions progress in the Installed page
| -rw-r--r-- | discover/qml/InstalledPage.qml | 5 | ||||
| -rw-r--r-- | discover/qml/Main.qml | 7 | ||||
| -rw-r--r-- | libmuon/Transaction/TransactionModel.cpp | 5 | ||||
| -rw-r--r-- | libmuon/Transaction/TransactionModel.h | 2 |
4 files changed, 12 insertions, 7 deletions
diff --git a/discover/qml/InstalledPage.qml b/discover/qml/InstalledPage.qml index 77c5a8b..66a83ee 100644 --- a/discover/qml/InstalledPage.qml +++ b/discover/qml/InstalledPage.qml @@ -29,6 +29,11 @@ ApplicationsListPage { text: i18n("items installed") } Item { Layout.fillWidth: true } + Label { + visible: TransactionModel.count>0 + text: i18n("%1 jobs pending...", TransactionModel.count) + } + Item { Layout.fillWidth: true } Label { text: i18n("Sort by ") } Button { text: page.currentSortAction.text diff --git a/discover/qml/Main.qml b/discover/qml/Main.qml index ae284c4..0714768 100644 --- a/discover/qml/Main.qml +++ b/discover/qml/Main.qml @@ -100,7 +100,7 @@ Rectangle }, TopLevelPageData { iconName: "applications-other" - text: i18n("Installed") + text: TransactionModel.count == 0 ? i18n("Installed") : i18n("Installing...") component: topInstalledComp objectName: "installed" shortcut: "Alt+I" @@ -185,10 +185,5 @@ Rectangle window.clearSearch() } } - - ProgressView { - id: progressBox //used from UpdateProgressPage.qml - Layout.fillWidth: true - } } } diff --git a/libmuon/Transaction/TransactionModel.cpp b/libmuon/Transaction/TransactionModel.cpp index 227075e..a181a06 100644 --- a/libmuon/Transaction/TransactionModel.cpp +++ b/libmuon/Transaction/TransactionModel.cpp @@ -36,7 +36,10 @@ TransactionModel *TransactionModel::global() TransactionModel::TransactionModel(QObject *parent) : QAbstractListModel(parent) -{} +{ + connect(this, &QAbstractItemModel::rowsInserted, this, &TransactionModel::countChanged); + connect(this, &QAbstractItemModel::rowsRemoved, this, &TransactionModel::countChanged); +} QHash< int, QByteArray > TransactionModel::roleNames() const { diff --git a/libmuon/Transaction/TransactionModel.h b/libmuon/Transaction/TransactionModel.h index d47cadf..2a6c9e3 100644 --- a/libmuon/Transaction/TransactionModel.h +++ b/libmuon/Transaction/TransactionModel.h @@ -30,6 +30,7 @@ class MUONCOMMON_EXPORT TransactionModel : public QAbstractListModel { Q_OBJECT + Q_PROPERTY(int count READ rowCount NOTIFY countChanged) public: enum Roles { TransactionRoleRole = Qt::UserRole, @@ -67,6 +68,7 @@ signals: void transactionAdded(Transaction *trans); void transactionCancelled(Transaction *trans); void transactionRemoved(Transaction* trans); + void countChanged(); private slots: void transactionChanged(); |
