Refresh printers on page refresh

This commit is contained in:
Anton Thomasson 2019-12-17 20:20:09 +01:00
parent ad0f92ba1e
commit 8c721b398b
3 changed files with 18 additions and 0 deletions

View file

@ -33,6 +33,8 @@ Page {
}
}
signal refreshed()
Component.onCompleted: {
discovery.discover();
}
@ -64,6 +66,7 @@ Page {
text: qsTr("Refresh")
onClicked: {
discovery.discover();
page.refreshed();
}
}
}
@ -96,6 +99,15 @@ Page {
}
}
Connections {
target: page
onRefreshed: {
console.log("onRefreshed")
printer.refresh()
}
}
onClicked: {
if(!canPrint)
return;

View file

@ -43,6 +43,10 @@ void IppPrinter::setUrl(QString url)
void IppPrinter::onUrlChanged()
{
refresh();
}
void IppPrinter::refresh() {
_attrs = QJsonObject();
emit attrsChanged();

View file

@ -22,6 +22,8 @@ public:
QString getUrl() {return _url;}
void setUrl(QString url);
Q_INVOKABLE void refresh();
Q_INVOKABLE bool print(QJsonObject attrs, QString file);
Q_INVOKABLE bool getJobs();
Q_INVOKABLE bool cancelJob(qint32 jobId);