Add nag-screen

This commit is contained in:
Anton Thomasson 2020-06-07 14:28:54 +02:00
parent ee0fc56bde
commit 5df016b0fa
9 changed files with 261 additions and 2 deletions

View file

@ -40,6 +40,7 @@ DISTFILES += qml/harbour-seaprint.qml \
qml/pages/*svg \
qml/pages/BusyPage.qml \
qml/pages/DebugPage.qml \
qml/pages/NagScreen.qml \
rpm/harbour-seaprint.changes.in \
rpm/harbour-seaprint.changes.run.in \
rpm/harbour-seaprint.spec \

View file

@ -2,6 +2,7 @@ import QtQuick 2.0
import Sailfish.Silica 1.0
import QtQuick.LocalStorage 2.0
import Nemo.Notifications 1.0
import Nemo.Configuration 1.0
import "pages"
ApplicationWindow
@ -73,5 +74,13 @@ ApplicationWindow
publish()
}
}
ConfigurationValue
{
id: nagScreenSetting
key: "/apps/harbour-seaprint/settings/nag-screen"
defaultValue: 0
property int expectedValue: 1
}
}

View file

@ -46,7 +46,6 @@ Page {
signal refreshed()
Component.onCompleted: {
console.log("Can convert from PDF:", ConvertChecker.pdf)
IppDiscovery.discover();
if(selectedFile != "")
{
@ -56,6 +55,20 @@ Page {
}
}
property bool nagged: false
onStatusChanged: {
if(status==PageStatus.Active && !nagged && nagScreenSetting.value != nagScreenSetting.expectedValue)
{
console.log("Can convert from PDF:", ConvertChecker.pdf)
if(!ConvertChecker.pdf)
{
nagged=true
pageStack.push(Qt.resolvedUrl("NagScreen.qml"))
}
}
}
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable {
anchors.fill: parent
@ -107,7 +120,6 @@ Page {
Connections {
target: printer
onAttrsChanged: {
console.log(printer.url, Object.keys(printer.attrs))
if(Object.keys(printer.attrs).length === 0) {
delegate.visible = false
}

82
qml/pages/NagScreen.qml Normal file
View file

@ -0,0 +1,82 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
backNavigation: false
Column {
y: Theme.paddingLarge
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 2*Theme.paddingLarge
spacing: Theme.paddingLarge
Label {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("Optional dependencies are not installed!")
}
Label {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("In order to convert PDF files to other formats, you need utilities from the package \"poppler-utils\"")
}
Label {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("To install, enable delveloper mode, and open a terminal.")
}
Label {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("Become root:")
}
Label {
width: parent.width
wrapMode: Text.WordWrap
font.family: "monospace"
text: "devel-su"
}
Label {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("Install poppler-utils:")
}
Label {
width: parent.width
wrapMode: Text.WordWrap
font.family: "monospace"
text: "pkcon install poppler-utils"
}
Item{}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Dismiss")
onClicked: pageStack.pop()
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Don't show again")
onClicked: {
nagScreenSetting.value = nagScreenSetting.expectedValue
pageStack.pop()
}
}
}
}

View file

@ -253,6 +253,37 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NagScreen</name>
<message>
<source>Dismiss</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Don&apos;t show again</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Optional dependencies are not installed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In order to convert PDF files to other formats, you need utilities from the package &quot;poppler-utils&quot;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>To install, enable delveloper mode, and open a terminal.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Become root:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Install poppler-utils:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PrinterPage</name>
<message>

View file

@ -253,6 +253,37 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NagScreen</name>
<message>
<source>Dismiss</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Don&apos;t show again</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Optional dependencies are not installed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In order to convert PDF files to other formats, you need utilities from the package &quot;poppler-utils&quot;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>To install, enable delveloper mode, and open a terminal.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Become root:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Install poppler-utils:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PrinterPage</name>
<message>

View file

@ -253,6 +253,37 @@
<translation>Échec de l&apos;annulation de la tâche d&apos;impression</translation>
</message>
</context>
<context>
<name>NagScreen</name>
<message>
<source>Dismiss</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Don&apos;t show again</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Optional dependencies are not installed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In order to convert PDF files to other formats, you need utilities from the package &quot;poppler-utils&quot;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>To install, enable delveloper mode, and open a terminal.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Become root:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Install poppler-utils:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PrinterPage</name>
<message>

View file

@ -253,6 +253,37 @@
<translation></translation>
</message>
</context>
<context>
<name>NagScreen</name>
<message>
<source>Dismiss</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Don&apos;t show again</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Optional dependencies are not installed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In order to convert PDF files to other formats, you need utilities from the package &quot;poppler-utils&quot;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>To install, enable delveloper mode, and open a terminal.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Become root:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Install poppler-utils:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PrinterPage</name>
<message>

View file

@ -253,6 +253,37 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NagScreen</name>
<message>
<source>Dismiss</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Don&apos;t show again</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Optional dependencies are not installed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In order to convert PDF files to other formats, you need utilities from the package &quot;poppler-utils&quot;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>To install, enable delveloper mode, and open a terminal.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Become root:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Install poppler-utils:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PrinterPage</name>
<message>