From 5df016b0fa386c5c563d260c034d3157ffabcb05 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sun, 7 Jun 2020 14:28:54 +0200 Subject: [PATCH] Add nag-screen --- harbour-seaprint.pro | 1 + qml/harbour-seaprint.qml | 9 +++ qml/pages/FirstPage.qml | 16 ++++- qml/pages/NagScreen.qml | 82 ++++++++++++++++++++++++++ translations/harbour-seaprint-de.ts | 31 ++++++++++ translations/harbour-seaprint-es.ts | 31 ++++++++++ translations/harbour-seaprint-fr.ts | 31 ++++++++++ translations/harbour-seaprint-zh_CN.ts | 31 ++++++++++ translations/harbour-seaprint.ts | 31 ++++++++++ 9 files changed, 261 insertions(+), 2 deletions(-) create mode 100644 qml/pages/NagScreen.qml diff --git a/harbour-seaprint.pro b/harbour-seaprint.pro index ce025df..48a3da5 100644 --- a/harbour-seaprint.pro +++ b/harbour-seaprint.pro @@ -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 \ diff --git a/qml/harbour-seaprint.qml b/qml/harbour-seaprint.qml index 8431cf3..d0e037a 100644 --- a/qml/harbour-seaprint.qml +++ b/qml/harbour-seaprint.qml @@ -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 + } } diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index 723b31b..bc8f1d8 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -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 } diff --git a/qml/pages/NagScreen.qml b/qml/pages/NagScreen.qml new file mode 100644 index 0000000..658e8f7 --- /dev/null +++ b/qml/pages/NagScreen.qml @@ -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() + } + } + } + +} diff --git a/translations/harbour-seaprint-de.ts b/translations/harbour-seaprint-de.ts index b55e1b4..89afc70 100644 --- a/translations/harbour-seaprint-de.ts +++ b/translations/harbour-seaprint-de.ts @@ -253,6 +253,37 @@ + + NagScreen + + Dismiss + + + + Don't show again + + + + Optional dependencies are not installed! + + + + In order to convert PDF files to other formats, you need utilities from the package "poppler-utils" + + + + To install, enable delveloper mode, and open a terminal. + + + + Become root: + + + + Install poppler-utils: + + + PrinterPage diff --git a/translations/harbour-seaprint-es.ts b/translations/harbour-seaprint-es.ts index 90b58ab..cae287f 100644 --- a/translations/harbour-seaprint-es.ts +++ b/translations/harbour-seaprint-es.ts @@ -253,6 +253,37 @@ + + NagScreen + + Dismiss + + + + Don't show again + + + + Optional dependencies are not installed! + + + + In order to convert PDF files to other formats, you need utilities from the package "poppler-utils" + + + + To install, enable delveloper mode, and open a terminal. + + + + Become root: + + + + Install poppler-utils: + + + PrinterPage diff --git a/translations/harbour-seaprint-fr.ts b/translations/harbour-seaprint-fr.ts index 6acdf78..e3a70bf 100644 --- a/translations/harbour-seaprint-fr.ts +++ b/translations/harbour-seaprint-fr.ts @@ -253,6 +253,37 @@ Échec de l'annulation de la tâche d'impression + + NagScreen + + Dismiss + + + + Don't show again + + + + Optional dependencies are not installed! + + + + In order to convert PDF files to other formats, you need utilities from the package "poppler-utils" + + + + To install, enable delveloper mode, and open a terminal. + + + + Become root: + + + + Install poppler-utils: + + + PrinterPage diff --git a/translations/harbour-seaprint-zh_CN.ts b/translations/harbour-seaprint-zh_CN.ts index 039297b..c458bc6 100644 --- a/translations/harbour-seaprint-zh_CN.ts +++ b/translations/harbour-seaprint-zh_CN.ts @@ -253,6 +253,37 @@ 作业失败 + + NagScreen + + Dismiss + + + + Don't show again + + + + Optional dependencies are not installed! + + + + In order to convert PDF files to other formats, you need utilities from the package "poppler-utils" + + + + To install, enable delveloper mode, and open a terminal. + + + + Become root: + + + + Install poppler-utils: + + + PrinterPage diff --git a/translations/harbour-seaprint.ts b/translations/harbour-seaprint.ts index 7e657c3..6e18016 100644 --- a/translations/harbour-seaprint.ts +++ b/translations/harbour-seaprint.ts @@ -253,6 +253,37 @@ + + NagScreen + + Dismiss + + + + Don't show again + + + + Optional dependencies are not installed! + + + + In order to convert PDF files to other formats, you need utilities from the package "poppler-utils" + + + + To install, enable delveloper mode, and open a terminal. + + + + Become root: + + + + Install poppler-utils: + + + PrinterPage