diff --git a/src/qtquick/qml/DialogContent.qml b/src/qtquick/qml/DialogContent.qml --- a/src/qtquick/qml/DialogContent.qml +++ b/src/qtquick/qml/DialogContent.qml @@ -65,7 +65,6 @@ id: newStuffPage onMessage: component.showPassiveNotification(message); onIdleMessage: component.showPassiveNotification(message); - onBusyMessage: component.showPassiveNotification(message); onErrorMessage: component.showPassiveNotification(message); } } diff --git a/src/qtquick/qml/Page.qml b/src/qtquick/qml/Page.qml --- a/src/qtquick/qml/Page.qml +++ b/src/qtquick/qml/Page.qml @@ -204,6 +204,34 @@ view.implicitCellHeight: root.viewMode == Page.ViewMode.Tiles ? Math.round(view.implicitCellWidth / 3) : (root.viewMode == Page.ViewMode.Preview ? Kirigami.Units.gridUnit * 25 : Math.round(view.implicitCellWidth / 1.6) + Kirigami.Units.gridUnit*2) view.delegate: root.viewMode == Page.ViewMode.Tiles ? tileDelegate : (root.viewMode == Page.ViewMode.Preview ? bigPreviewDelegate : thumbDelegate) + view.footer: Item { + width: GridView.view.width + height: Kirigami.Units.gridUnit * 3 + visible: opacity > 0 + opacity: newStuffModel.isLoadingData && !newStuffEngine.isLoading ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } } + QtControls.BusyIndicator { + anchors { + top: parent.top + right: parent.horizontalCenter + bottom: parent.bottom + margins: Kirigami.Units.smallSpacing + } + width: height + running: parent.visible + QtControls.Label { + anchors { + top: parent.top + left: parent.right + leftMargin: Kirigami.Units.largeSpacing + bottom: parent.bottom + } + text: i18nc("A text shown beside a busy indicator suggesting that data is being fetched", "Loading more...") + verticalAlignment: Text.AlignVCenter + } + } + } + Component { id: bigPreviewDelegate EntryGridDelegates.BigPreviewDelegate { } diff --git a/src/qtquick/quickitemsmodel.h b/src/qtquick/quickitemsmodel.h --- a/src/qtquick/quickitemsmodel.h +++ b/src/qtquick/quickitemsmodel.h @@ -69,6 +69,11 @@ * The NewStuffQuickEngine to show items from */ Q_PROPERTY(QObject* engine READ engine WRITE setEngine NOTIFY engineChanged) + /** + * Whether or not the model is fetching information from a remote location + * @since 5.64 + */ + Q_PROPERTY(bool isLoadingData READ isLoadingData NOTIFY isLoadingDataChanged) public: explicit ItemsModel(QObject *parent = nullptr); virtual ~ItemsModel(); @@ -127,6 +132,17 @@ void setEngine(QObject *newEngine); Q_SIGNAL void engineChanged(); + /** + * Whether or not the model is fetching information from a remote location + * @since 5.64 + */ + bool isLoadingData() const; + /** + * Fired when the isLoadingData value changes + * @since 5.64 + */ + Q_SIGNAL void isLoadingDataChanged(); + /** * @brief This will install (or update, if already installed) the item at the given index * diff --git a/src/qtquick/quickitemsmodel.cpp b/src/qtquick/quickitemsmodel.cpp --- a/src/qtquick/quickitemsmodel.cpp +++ b/src/qtquick/quickitemsmodel.cpp @@ -51,6 +51,8 @@ QHash commentsModels; + bool isLoadingData{false}; + bool initModel() { if (model) { @@ -61,6 +63,9 @@ } model = new KNSCore::ItemsModel(coreEngine, q); + q->connect(coreEngine, &KNSCore::Engine::signalBusy, q, [=](){ isLoadingData = true; emit q->isLoadingDataChanged(); }); + q->connect(coreEngine, &KNSCore::Engine::signalIdle, q, [=](){ isLoadingData = false; emit q->isLoadingDataChanged(); }); + q->connect(coreEngine, &KNSCore::Engine::signalProvidersLoaded, coreEngine, &KNSCore::Engine::reloadEntries); // Entries have been fetched and should be shown: q->connect(coreEngine, &KNSCore::Engine::signalEntriesLoaded, model, &KNSCore::ItemsModel::slotEntriesLoaded); @@ -387,6 +392,11 @@ } } +bool ItemsModel::isLoadingData() const +{ + return d->isLoadingData; +} + void ItemsModel::installItem(int index, int linkId) { if (d->coreEngine) {