Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Okular
Commits
1dc81340
Commit
1dc81340
authored
Sep 09, 2021
by
Albert Astals Cid
Browse files
okularkirigami: Show document error/warning/notice
parent
1f84075c
Pipeline
#79658
passed with stage
in 9 minutes and 33 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
mobile/app/package/contents/ui/MainView.qml
View file @
1dc81340
...
...
@@ -10,6 +10,8 @@ import org.kde.okular 2.0 as Okular
import
org
.
kde
.
kirigami
2.10
as
Kirigami
Kirigami.Page
{
id
:
root
property
alias
document
:
pageArea
.
document
leftPadding
:
0
topPadding
:
0
...
...
@@ -34,6 +36,47 @@ Kirigami.Page {
onClicked
:
fileBrowserRoot
.
controlsVisible
=
!
fileBrowserRoot
.
controlsVisible
}
Connections
{
target
:
root
.
document
onError
:
(
text
,
duration
)
=>
{
inlineMessage
.
showMessage
(
Kirigami
.
MessageType
.
Error
,
text
,
duration
);
}
onWarning
:
(
text
,
duration
)
=>
{
inlineMessage
.
showMessage
(
Kirigami
.
MessageType
.
Warning
,
text
,
duration
);
}
onNotice
:
(
text
,
duration
)
=>
{
inlineMessage
.
showMessage
(
Kirigami
.
MessageType
.
Information
,
text
,
duration
);
}
}
Kirigami.InlineMessage
{
id
:
inlineMessage
width
:
parent
.
width
function
showMessage
(
type
,
text
,
duration
)
{
inlineMessage
.
type
=
type
;
inlineMessage
.
text
=
text
;
inlineMessage
.
visible
=
true
;
inlineMessageTimer
.
interval
=
duration
>
0
?
duration
:
500
+
100
*
text
.
length
;
}
onVisibleChanged
:
{
if
(
visible
)
{
inlineMessageTimer
.
start
()
}
else
{
inlineMessageTimer
.
stop
()
}
}
Timer
{
id
:
inlineMessageTimer
onTriggered
:
inlineMessage
.
visible
=
false
}
}
// TODO KF 5.64 replace usage by upstream PlaceholderMessage
PlaceholderMessage
{
visible
:
documentItem
.
url
.
toString
().
length
===
0
...
...
mobile/components/documentitem.cpp
View file @
1dc81340
...
...
@@ -34,6 +34,9 @@ DocumentItem::DocumentItem(QObject *parent)
connect
(
m_document
,
&
Okular
::
Document
::
searchFinished
,
this
,
&
DocumentItem
::
searchFinished
);
connect
(
m_document
->
bookmarkManager
(),
&
Okular
::
BookmarkManager
::
bookmarksChanged
,
this
,
&
DocumentItem
::
bookmarkedPagesChanged
);
connect
(
m_document
->
bookmarkManager
(),
&
Okular
::
BookmarkManager
::
bookmarksChanged
,
this
,
&
DocumentItem
::
bookmarksChanged
);
connect
(
m_document
,
&
Okular
::
Document
::
error
,
this
,
&
DocumentItem
::
error
);
connect
(
m_document
,
&
Okular
::
Document
::
warning
,
this
,
&
DocumentItem
::
warning
);
connect
(
m_document
,
&
Okular
::
Document
::
notice
,
this
,
&
DocumentItem
::
notice
);
}
DocumentItem
::~
DocumentItem
()
...
...
mobile/components/documentitem.h
View file @
1dc81340
...
...
@@ -139,6 +139,30 @@ Q_SIGNALS:
void
bookmarksChanged
();
void
windowTitleForDocumentChanged
();
/**
* This signal is emitted whenever an error occurred.
*
* @param text The description of the error.
* @param duration The time in milliseconds the message should be shown to the user.
*/
void
error
(
const
QString
&
text
,
int
duration
);
/**
* This signal is emitted to signal a warning.
*
* @param text The description of the warning.
* @param duration The time in milliseconds the message should be shown to the user.
*/
void
warning
(
const
QString
&
text
,
int
duration
);
/**
* This signal is emitted to signal a notice.
*
* @param text The description of the notice.
* @param duration The time in milliseconds the message should be shown to the user.
*/
void
notice
(
const
QString
&
text
,
int
duration
);
private
Q_SLOTS
:
void
searchFinished
(
int
id
,
Okular
::
Document
::
SearchStatus
endStatus
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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