Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Add-ons
Commits
89a812ae
Commit
89a812ae
authored
May 07, 2022
by
Fushan Wen
Browse files
applets/dict: Show error message when there is a network error
parent
bf27764c
Pipeline
#174530
passed with stage
in 1 minute and 37 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
applets/dict/package/contents/ui/main.qml
View file @
89a812ae
...
...
@@ -19,10 +19,10 @@ ColumnLayout {
id
:
dict
selectedDictionary
:
plasmoid
.
configuration
.
dictionary
// Activate the busy indicator, and deactivate it when page is loaded.
onSearchInProgress
:
loadingP
laceholder
.
opacity
=
1
;
onSearchInProgress
:
p
laceholder
.
opacity
=
1
;
onDefinitionFound
:
{
web
.
loadHtml
(
html
);
loadingP
laceholder
.
opacity
=
0
;
p
laceholder
.
opacity
=
0
;
}
}
...
...
@@ -37,9 +37,10 @@ ColumnLayout {
onAccepted
:
{
if
(
input
.
text
===
""
)
{
web
.
visible
=
false
;
placeholder
.
opacity
=
0
;
web
.
loadHtml
(
""
);
}
else
{
web
.
visible
=
true
;
web
.
visible
=
Qt
.
binding
(()
=>
!
dict
.
hasError
)
;
dict
.
lookup
(
input
.
text
);
}
}
...
...
@@ -64,16 +65,17 @@ ColumnLayout {
profile
:
dict
.
webProfile
}
Rectangle
{
id
:
loadingP
laceholder
Item
{
id
:
p
laceholder
anchors.fill
:
parent
color
:
web
.
backgroundColor
opacity
:
0
visible
:
opacity
>
0
PlasmaComponents3.BusyIndicator
{
anchors.centerIn
:
parent
running
:
visible
Loader
{
active
:
placeholder
.
visible
anchors.fill
:
parent
asynchronous
:
true
sourceComponent
:
dict
.
hasError
?
errorPlaceholder
:
loadingPlaceholder
}
Behavior
on
opacity
{
...
...
@@ -83,6 +85,35 @@ ColumnLayout {
}
}
}
Component
{
id
:
loadingPlaceholder
Rectangle
{
anchors.fill
:
parent
color
:
web
.
backgroundColor
PlasmaComponents3.BusyIndicator
{
anchors.centerIn
:
parent
}
}
}
Component
{
id
:
errorPlaceholder
Item
{
anchors.fill
:
parent
PlasmaExtras.PlaceholderMessage
{
width
:
parent
.
width
-
PlasmaCore
.
Units
.
gridUnit
*
2
// For text wrap
anchors.centerIn
:
parent
iconName
:
"
network-disconnect
"
text
:
i18n
(
"
Unable to load definition
"
)
explanation
:
i18nc
(
"
%2 human-readable error string
"
,
"
Error code: %1 (%2)
"
,
dict
.
errorCode
,
dict
.
errorString
)
}
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment