diff --git a/discover/qml/ApplicationsListPage.qml b/discover/qml/ApplicationsListPage.qml --- a/discover/qml/ApplicationsListPage.qml +++ b/discover/qml/ApplicationsListPage.qml @@ -78,5 +78,75 @@ application: model.application compact: page.compact } + Kirigami.Label { + anchors.centerIn: parent + opacity: apps.count == 0 && !appsModel.isBusy ? 0.3 : 0 + Behavior on opacity { PropertyAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad; } } + text: i18n("Sorry, nothing found...") + } + + BusyIndicator { + id: busyIndicator + anchors { + top: parent.bottom + horizontalCenter: parent.horizontalCenter + margins: Kirigami.Units.largeSpacing + } + running: false + opacity: 0 + states: [ + State { + name: "running"; + when: appsModel.isBusy + PropertyChanges { target: busyIndicator; opacity: 1; running: true; } + AnchorChanges { target: busyIndicator; anchors.bottom: parent.bottom; anchors.top: undefined; } + } + ] + transitions: [ + Transition { + from: "" + to: "running" + SequentialAnimation { + PauseAnimation { duration: Kirigami.Units.longDuration * 5; } + ParallelAnimation { + AnchorAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad; } + PropertyAnimation { property: "opacity"; duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad; } + } + } + }, + Transition { + from: "running" + to: "" + ParallelAnimation { + AnchorAnimation { duration: Kirigami.Units.shortDuration; easing.type: Easing.InOutQuad; } + PropertyAnimation { property: "opacity"; duration: Kirigami.Units.shortDuration; easing.type: Easing.InOutQuad; } + } + } + ] + Kirigami.Label { + id: busyLabel + anchors { + horizontalCenter: parent.horizontalCenter + bottom: parent.top + } + text: i18n("Still looking...") + opacity: 0 + states: [ + State { + name: "running"; + when: busyIndicator.opacity === 1; + PropertyChanges { target: busyLabel; opacity: 1; } + } + ] + transitions: Transition { + from: "" + to: "running" + SequentialAnimation { + PauseAnimation { duration: Kirigami.Units.longDuration * 5; } + PropertyAnimation { property: "opacity"; duration: Kirigami.Units.longDuration * 10; easing.type: Easing.InOutCubic; } + } + } + } + } } } diff --git a/libdiscover/backends/KNSBackend/KNSBackend.cpp b/libdiscover/backends/KNSBackend/KNSBackend.cpp --- a/libdiscover/backends/KNSBackend/KNSBackend.cpp +++ b/libdiscover/backends/KNSBackend/KNSBackend.cpp @@ -108,7 +108,16 @@ m_engine = new KNSCore::Engine(this); m_engine->init(m_name); // Setting setFetching to false when we get an error ensures we don't end up in an eternally-fetching state - connect(m_engine, &KNSCore::Engine::signalError, this, [this](const QString &error) { this->setFetching(false); qWarning() << "kns error" << objectName() << error; }); + connect(m_engine, &KNSCore::Engine::signalError, this, [this](const QString &error) { + if(error == QLatin1Literal("All categories are missing")) { + markInvalid(error); + } + m_responsePending = false; + Q_EMIT searchFinished(); + Q_EMIT availableForQueries(); + this->setFetching(false); + qWarning() << "kns error" << objectName() << error; + }); connect(m_engine, &KNSCore::Engine::signalEntriesLoaded, this, &KNSBackend::receivedEntries); connect(m_engine, &KNSCore::Engine::signalEntryChanged, this, &KNSBackend::statusChanged); connect(m_engine, &KNSCore::Engine::signalEntryDetailsLoaded, this, &KNSBackend::statusChanged); @@ -188,7 +197,7 @@ setFetching(false); return; } -// qDebug() << "received" << this << m_page << m_resourcesByName.count(); +// qDebug() << "received" << objectName() << this << m_page << m_resourcesByName.count(); if (!m_responsePending) { ++m_page; m_engine->requestData(m_page, 100);