From 88b71b3a579b0052dae1eff2a8e00d842c31991e Mon Sep 17 00:00:00 2001 From: Maxim Ermilov Date: Fri, 17 Oct 2014 01:45:03 +0400 Subject: [PATCH] ubuntu: port to oxide --- src/ubuntu/InAppBrowser.qml | 9 ++++----- src/ubuntu/inappbrowser.cpp | 12 ++++-------- src/ubuntu/inappbrowser.h | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/ubuntu/InAppBrowser.qml b/src/ubuntu/InAppBrowser.qml index 03448f6..2d1af51 100644 --- a/src/ubuntu/InAppBrowser.qml +++ b/src/ubuntu/InAppBrowser.qml @@ -21,9 +21,9 @@ * */ import QtQuick 2.0 -import QtWebKit 3.0 import Ubuntu.Components.Popups 0.1 import Ubuntu.Components 0.1 +import com.canonical.Oxide 1.0 Rectangle { anchors.fill: parent @@ -60,10 +60,9 @@ Rectangle { y: urlEntry.height height: parent.height - y url: url1 - onLoadingChanged: { - if (loadRequest.status) { - root.exec("InAppBrowser", "loadFinished", [loadRequest.status]) - } + id: _view + onLoadingStateChanged: { + root.exec("InAppBrowser", "loadFinished", [_view.loading]) } } } diff --git a/src/ubuntu/inappbrowser.cpp b/src/ubuntu/inappbrowser.cpp index 7a0538f..97be212 100644 --- a/src/ubuntu/inappbrowser.cpp +++ b/src/ubuntu/inappbrowser.cpp @@ -91,14 +91,10 @@ void Inappbrowser::injectScriptCode(int, int, const QString&, bool) { qCritical() << "unimplemented " << __PRETTY_FUNCTION__; } -void Inappbrowser::loadFinished(int status) { - if (status == 2) { - this->callbackWithoutRemove(_eventCb, LOADERROR_EVENT); - } - if (status == 0) { +void Inappbrowser::loadFinished(bool status) { + if (status) { + this->callbackWithoutRemove(_eventCb, LOADSTOP_EVENT); + } else { this->callbackWithoutRemove(_eventCb, LOADSTART_EVENT); } - if (status == 3) { - this->callbackWithoutRemove(_eventCb, LOADSTOP_EVENT); - } } diff --git a/src/ubuntu/inappbrowser.h b/src/ubuntu/inappbrowser.h index 7a4a68a..1da4e03 100644 --- a/src/ubuntu/inappbrowser.h +++ b/src/ubuntu/inappbrowser.h @@ -52,7 +52,7 @@ public slots: void injectScriptFile(int cb, int, const QString&, bool); void injectScriptCode(int cb, int, const QString&, bool); - void loadFinished(int status); + void loadFinished(bool status); private: int _eventCb;