Verified Commit c6041bc8 authored by Fushan Wen's avatar Fushan Wen
Browse files

applets/dict: Add `loadingPlaceHolder` and `errorPlaceHolder`

Show loading status and error message in the config window.
parent 33f5aba6
......@@ -6,7 +6,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.5
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kirigami 2.19 as Kirigami
import org.kde.plasma.private.dict 1.0
Page {
......@@ -51,4 +51,34 @@ Page {
}
}
}
Loader {
active: dictionariesModel.loading || dictionariesModel.count === 0
asynchronous: true
anchors.centerIn: parent
visible: active
sourceComponent: dictionariesModel.loading ? loadingPlaceHolder : errorPlaceHolder
Component {
id: loadingPlaceHolder
Kirigami.LoadingPlaceholder {
anchors.centerIn: parent
}
}
Component {
id: errorPlaceHolder
Kirigami.PlaceholderMessage {
anchors.centerIn: parent
width: root.width - (Kirigami.Units.largeSpacing * 4)
icon.name: "network-disconnect"
text: i18n("Unable to load dictionary list")
explanation: i18nc("%2 human-readable error string", "Error code: %1 (%2)", dictionariesModel.errorCode, dictionariesModel.errorString)
}
}
}
}
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