From 54a3a0d52a5120673d75a384c5830d5c800290c8 Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Thu, 21 Nov 2024 16:08:25 +0300 Subject: [PATCH 01/15] Initial WebView support --- CONTRIBUTORS.md | 2 +- Opal/LinkHandler/LinkHandler.js | 6 +- Opal/LinkHandler/PreviewType.qml | 8 +++ Opal/LinkHandler/private/ExternalUrlPage.qml | 71 ++++++++++++++++++++ Opal/LinkHandler/qmldir | 1 + 5 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 Opal/LinkHandler/PreviewType.qml diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5f78d7b..bc1599a 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -8,4 +8,4 @@ SPDX-License-Identifier: GFDL-1.3-or-later ## Programming - author: Mirian Margiani -- many improvements: roundedrectangle \ No newline at end of file +- link title copying, link sharing, webview preview: roundedrectangle \ No newline at end of file diff --git a/Opal/LinkHandler/LinkHandler.js b/Opal/LinkHandler/LinkHandler.js index 93319ae..0e3e343 100644 --- a/Opal/LinkHandler/LinkHandler.js +++ b/Opal/LinkHandler/LinkHandler.js @@ -37,7 +37,7 @@ \sa Qt::openUrlExternally */ -function openOrCopyUrl(externalUrl, title) { +function openOrCopyUrl(externalUrl, title, previewType) { pageStack.push(Qt.resolvedUrl("private/ExternalUrlPage.qml"), - {'externalUrl': externalUrl, 'title': !!title ? title : ''}) -} + {'externalUrl': externalUrl, 'title': !!title ? title : '', 'previewType': typeof previewType !== 'undefined' ? previewType : 0}) +} \ No newline at end of file diff --git a/Opal/LinkHandler/PreviewType.qml b/Opal/LinkHandler/PreviewType.qml new file mode 100644 index 0000000..53e2ec6 --- /dev/null +++ b/Opal/LinkHandler/PreviewType.qml @@ -0,0 +1,8 @@ +pragma Singleton +import QtQuick 2.0 + +QtObject { + property int auto: 0 + property int enable: 1 + property int disable: 2 +} \ No newline at end of file diff --git a/Opal/LinkHandler/private/ExternalUrlPage.qml b/Opal/LinkHandler/private/ExternalUrlPage.qml index 04158e8..45049c3 100644 --- a/Opal/LinkHandler/private/ExternalUrlPage.qml +++ b/Opal/LinkHandler/private/ExternalUrlPage.qml @@ -7,14 +7,85 @@ import QtQuick 2.2 import Sailfish.Silica 1.0 import Nemo.Notifications 1.0 import Sailfish.Share 1.0 +import Nemo.DBus 2.0 +import '..' Page { id: root property url externalUrl property string title: '' // optional + property int previewType: LinkPreviewType.auto allowedOrientations: Orientation.All + Component { + id: webViewComponent + Page { + id: webViewPage + allowedOrientations: Orientation.All + property bool __linkhandler_webview: true + + onStatusChanged: if (status == PageStatus.Active) + Qt.createQmlObject("import Sailfish.WebView 1.0 +WebView { + anchors.fill: parent + url: externalUrl +}", webViewPage) + Component.onCompleted: statusChanged() + } + } + + Timer { + id: pushWebviewTimer + interval: 0 + onTriggered: pageStack.pushAttached(webViewComponent) + } + + DBusInterface { + bus: DBus.SystemBus + service: 'net.connman' + iface: 'net.connman.Manager' + path: '/' + + signalsEnabled: previewType === LinkPreviewType.auto + + function checkState(state) { + if (state === "online") { + try { + const tester = Qt.createQmlObject("import QtQuick 2.0 +import Sailfish.Silica 1.0 +import Sailfish.WebView 1.0 +Item{}", root, 'WebviewTester [inline]') + } catch(err) { console.log(err); return } + if (typeof tester === 'undefined') return + tester.destroy() + + if (!pageStack.nextPage()) + pageStack.pushAttached(webViewComponent) + } else if (pageStack.nextPage() && pageStack.nextPage().__linkhandler_webview) + pageStack.popAttached() + } + + function propertyChanged(name, value) { + if (name === 'State') checkState(value) + } + + Component.onCompleted:{ + switch (previewType) { + case LinkPreviewType.disable: + break + case LinkPreviewType.enable: + // pageStack.completeAnimation doesn't work + pushWebviewTimer.start() + break + default: + call('GetProperties', [], function(properties) { + checkState(properties.State) + }) + } + } + } + ShareAction { id: shareHandler mimeType: 'text/x-url' diff --git a/Opal/LinkHandler/qmldir b/Opal/LinkHandler/qmldir index e1b28af..5c844f9 100644 --- a/Opal/LinkHandler/qmldir +++ b/Opal/LinkHandler/qmldir @@ -3,3 +3,4 @@ module Opal.LinkHandler # SPDX-FileCopyrightText: 2023 Mirian Margiani # SPDX-License-Identifier: GPL-3.0-or-later LinkHandler 1.0 LinkHandler.js +singleton LinkPreviewType 1.0 PreviewType.qml \ No newline at end of file From 4599570f9d49d7afa8fd1bc4ff822a05b17f36e8 Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Thu, 21 Nov 2024 16:10:48 +0300 Subject: [PATCH 02/15] Cleanup WebView when closed --- Opal/LinkHandler/private/ExternalUrlPage.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Opal/LinkHandler/private/ExternalUrlPage.qml b/Opal/LinkHandler/private/ExternalUrlPage.qml index 45049c3..c91fd12 100644 --- a/Opal/LinkHandler/private/ExternalUrlPage.qml +++ b/Opal/LinkHandler/private/ExternalUrlPage.qml @@ -24,13 +24,14 @@ Page { id: webViewPage allowedOrientations: Orientation.All property bool __linkhandler_webview: true + property var __webview onStatusChanged: if (status == PageStatus.Active) - Qt.createQmlObject("import Sailfish.WebView 1.0 + __webview = Qt.createQmlObject("import Sailfish.WebView 1.0 WebView { anchors.fill: parent url: externalUrl -}", webViewPage) +}", webViewPage); else if (__webview) __webview.destroy() Component.onCompleted: statusChanged() } } From c2bb0240d49bd0bd4aa253cc6312d9413b910d57 Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Thu, 21 Nov 2024 16:21:34 +0300 Subject: [PATCH 03/15] Add comments on permissions --- Opal/LinkHandler/private/ExternalUrlPage.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Opal/LinkHandler/private/ExternalUrlPage.qml b/Opal/LinkHandler/private/ExternalUrlPage.qml index c91fd12..1cfa679 100644 --- a/Opal/LinkHandler/private/ExternalUrlPage.qml +++ b/Opal/LinkHandler/private/ExternalUrlPage.qml @@ -43,6 +43,8 @@ WebView { } DBusInterface { + // Sailjail info: if we don't specify Internet permission, we won't have access to this service, and as a result no webview will pop up + // And WebView permission doesn't seem to change anything bus: DBus.SystemBus service: 'net.connman' iface: 'net.connman.Manager' From 24f9ff169c1ee07c62273e749719573c6c5eaed0 Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Thu, 21 Nov 2024 16:36:41 +0300 Subject: [PATCH 04/15] internetOnly type --- Opal/LinkHandler/PreviewType.qml | 5 +++-- Opal/LinkHandler/private/ExternalUrlPage.qml | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Opal/LinkHandler/PreviewType.qml b/Opal/LinkHandler/PreviewType.qml index 53e2ec6..9931054 100644 --- a/Opal/LinkHandler/PreviewType.qml +++ b/Opal/LinkHandler/PreviewType.qml @@ -3,6 +3,7 @@ import QtQuick 2.0 QtObject { property int auto: 0 - property int enable: 1 - property int disable: 2 + property int internetOnly: 1 + property int enable: 2 + property int disable: 3 } \ No newline at end of file diff --git a/Opal/LinkHandler/private/ExternalUrlPage.qml b/Opal/LinkHandler/private/ExternalUrlPage.qml index 1cfa679..560b5df 100644 --- a/Opal/LinkHandler/private/ExternalUrlPage.qml +++ b/Opal/LinkHandler/private/ExternalUrlPage.qml @@ -54,14 +54,16 @@ WebView { function checkState(state) { if (state === "online") { - try { - const tester = Qt.createQmlObject("import QtQuick 2.0 + if (previewType !== LinkPreviewType.internetOnly) { + try { + const tester = Qt.createQmlObject("import QtQuick 2.0 import Sailfish.Silica 1.0 import Sailfish.WebView 1.0 Item{}", root, 'WebviewTester [inline]') - } catch(err) { console.log(err); return } - if (typeof tester === 'undefined') return - tester.destroy() + } catch(err) { console.log(err); return } + if (typeof tester === 'undefined') return + tester.destroy() + } if (!pageStack.nextPage()) pageStack.pushAttached(webViewComponent) From e56b22aa2726485b97c6c3e65c60eb31aa88fadf Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Thu, 21 Nov 2024 16:36:47 +0300 Subject: [PATCH 05/15] Documentation --- Opal/LinkHandler/LinkHandler.js | 12 +++++++++++- README.md | 8 ++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Opal/LinkHandler/LinkHandler.js b/Opal/LinkHandler/LinkHandler.js index 0e3e343..336d290 100644 --- a/Opal/LinkHandler/LinkHandler.js +++ b/Opal/LinkHandler/LinkHandler.js @@ -28,12 +28,22 @@ */ /*! - \qmlmethod bool LinkHandler::openOrCopyUrl(externalUrl, title) + \qmlmethod bool LinkHandler::openOrCopyUrl(externalUrl, title, previewType) This function shows a page that lets the user preview an external link (\a externalUrl) before either copying it to the clipboard, copying its title (if available), sharing it or opening it externally. The \a title argument is optional. + This module includes an algorithm for checking if the WebView module is installed, + Internet connection is established and Sailjail permissions include Internet usage. + You can override this algorithm with \a previewType property which can be one of the following: + + \list + \li \c LinkPreviewType.auto - default + \li \c LinkPreviewType.internetOnly - skips WebView check, recommended for internet links + \li \c LinkPreviewType.disable - skips all checks and disables preview, recommended for apps without Internet permission + \li \c LinkPreviewType.disable - skips all checks and enables preview + \endlist \sa Qt::openUrlExternally */ diff --git a/README.md b/README.md index 133563f..ce14b50 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,15 @@ SPDX-License-Identifier: GFDL-1.3-or-later # Link handler for Sailfish apps -This module provides a link handler to open, copy or share external links. +This module provides a link handler to open, copy, share or preview external links. Text items and Silica's `Label` support external links using the `title` notation. They can then be opened externally when clicked by a user. -To avoid surprises, it is often desirable to give users the option to copy an -external link instead of immediately opening it in the default web browser. -This module provides a way to do that. +To avoid surprises, it is often desirable to give users the option to copy, +share or preview an external link instead of immediately opening it +in the default web browser. This module provides a way to do that. ## Usage From ca21f5d436e147b63a279d9235de794edbd72572 Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Thu, 21 Nov 2024 16:40:03 +0300 Subject: [PATCH 06/15] lupdate --- translations/opal-linkhandler-ab.ts | 16 ++++++++-------- translations/opal-linkhandler-be.ts | 16 ++++++++-------- translations/opal-linkhandler-cs.ts | 16 ++++++++-------- translations/opal-linkhandler-de.ts | 16 ++++++++-------- translations/opal-linkhandler-el.ts | 16 ++++++++-------- translations/opal-linkhandler-en.ts | 16 ++++++++-------- translations/opal-linkhandler-es.ts | 16 ++++++++-------- translations/opal-linkhandler-et.ts | 16 ++++++++-------- translations/opal-linkhandler-fi.ts | 16 ++++++++-------- translations/opal-linkhandler-fr.ts | 16 ++++++++-------- translations/opal-linkhandler-hu.ts | 16 ++++++++-------- translations/opal-linkhandler-id.ts | 16 ++++++++-------- translations/opal-linkhandler-it.ts | 16 ++++++++-------- translations/opal-linkhandler-lt.ts | 16 ++++++++-------- translations/opal-linkhandler-nb_NO.ts | 16 ++++++++-------- translations/opal-linkhandler-nl.ts | 16 ++++++++-------- translations/opal-linkhandler-pl.ts | 16 ++++++++-------- translations/opal-linkhandler-ro.ts | 16 ++++++++-------- translations/opal-linkhandler-ru.ts | 16 ++++++++-------- translations/opal-linkhandler-sk.ts | 16 ++++++++-------- translations/opal-linkhandler-sr.ts | 16 ++++++++-------- translations/opal-linkhandler-sv.ts | 16 ++++++++-------- translations/opal-linkhandler-tr.ts | 16 ++++++++-------- translations/opal-linkhandler-uk.ts | 16 ++++++++-------- translations/opal-linkhandler-zh_CN.ts | 16 ++++++++-------- translations/opal-linkhandler.ts | 16 ++++++++-------- 26 files changed, 208 insertions(+), 208 deletions(-) diff --git a/translations/opal-linkhandler-ab.ts b/translations/opal-linkhandler-ab.ts index fdc7dc1..b4d3780 100644 --- a/translations/opal-linkhandler-ab.ts +++ b/translations/opal-linkhandler-ab.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-be.ts b/translations/opal-linkhandler-be.ts index 5528139..fcc48a5 100644 --- a/translations/opal-linkhandler-be.ts +++ b/translations/opal-linkhandler-be.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-cs.ts b/translations/opal-linkhandler-cs.ts index 11e1087..568859a 100644 --- a/translations/opal-linkhandler-cs.ts +++ b/translations/opal-linkhandler-cs.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-de.ts b/translations/opal-linkhandler-de.ts index 737411f..5882a2a 100644 --- a/translations/opal-linkhandler-de.ts +++ b/translations/opal-linkhandler-de.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Externer Link - + Share Teilen - + Copy text to clipboard Text kopieren - + Open in browser Im Browser öffnen - + Open externally Extern öffnen - + Copied to clipboard: %1 In die Zwischenablage kopiert: %1 - + Share link Link teilen - + Copy to clipboard In die Zwischenablage kopieren diff --git a/translations/opal-linkhandler-el.ts b/translations/opal-linkhandler-el.ts index 83734b6..83e954d 100644 --- a/translations/opal-linkhandler-el.ts +++ b/translations/opal-linkhandler-el.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-en.ts b/translations/opal-linkhandler-en.ts index d3d2c45..004e1bb 100644 --- a/translations/opal-linkhandler-en.ts +++ b/translations/opal-linkhandler-en.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link External Link - + Share Share - + Copy text to clipboard Copy text to clipboard - + Open in browser Open in browser - + Open externally Open externally - + Copied to clipboard: %1 Copied to clipboard: %1 - + Share link Share link - + Copy to clipboard Copy to clipboard diff --git a/translations/opal-linkhandler-es.ts b/translations/opal-linkhandler-es.ts index 4fb70ad..1924c86 100644 --- a/translations/opal-linkhandler-es.ts +++ b/translations/opal-linkhandler-es.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Enlace externo - + Share Compartir - + Copy text to clipboard Copiar texto al portapapeles - + Open in browser Abrir en el navegador - + Open externally Abrir externamente - + Copied to clipboard: %1 Copiado al portapapeles: %1 - + Share link Compartir enlace - + Copy to clipboard Copiar al portapapeles diff --git a/translations/opal-linkhandler-et.ts b/translations/opal-linkhandler-et.ts index 6612c83..3a4f02d 100644 --- a/translations/opal-linkhandler-et.ts +++ b/translations/opal-linkhandler-et.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Väline link - + Share Jaga - + Copy text to clipboard Kopeeri tekst lõikelauale - + Open in browser Ava veebibrauseris - + Open externally Ava välise rakendusega - + Copied to clipboard: %1 Kopeerisin lõikelauale: %1 - + Share link Jaga linki - + Copy to clipboard Kopeeri lõikelauale diff --git a/translations/opal-linkhandler-fi.ts b/translations/opal-linkhandler-fi.ts index fb642fd..e8e01dc 100644 --- a/translations/opal-linkhandler-fi.ts +++ b/translations/opal-linkhandler-fi.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Ulkoinen linkki - + Share Jaa - + Copy text to clipboard Kopioi teksti leikepöydälle - + Open in browser Avaa selaimessa - + Open externally Avaa ulkoisesti - + Copied to clipboard: %1 Kopioitu leikepöydälle: %1 - + Share link Jaa linkki - + Copy to clipboard Kopioi leiikepöydälle diff --git a/translations/opal-linkhandler-fr.ts b/translations/opal-linkhandler-fr.ts index 70a59a4..0235db6 100644 --- a/translations/opal-linkhandler-fr.ts +++ b/translations/opal-linkhandler-fr.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Lien externe - + Share - + Copy text to clipboard - + Open in browser Ouvrir dans le navigateur - + Open externally - + Copied to clipboard: %1 Copié dans le presse-papiers : %1 - + Share link - + Copy to clipboard Copier dans le presse-papiers diff --git a/translations/opal-linkhandler-hu.ts b/translations/opal-linkhandler-hu.ts index 632e707..7c23bf0 100644 --- a/translations/opal-linkhandler-hu.ts +++ b/translations/opal-linkhandler-hu.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Külső hivatkozás - + Share - + Copy text to clipboard - + Open in browser Megnyitás böngészőben - + Open externally Megnyitás külső alkalmazással - + Copied to clipboard: %1 A vágólapra másolva: %1 - + Share link - + Copy to clipboard Másolás a vágólapra diff --git a/translations/opal-linkhandler-id.ts b/translations/opal-linkhandler-id.ts index 33d166b..ebcfdd0 100644 --- a/translations/opal-linkhandler-id.ts +++ b/translations/opal-linkhandler-id.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Tautan luar - + Share - + Copy text to clipboard - + Open in browser Buka di browser - + Open externally - + Copied to clipboard: %1 Disalin ke papan klip: %1 - + Share link - + Copy to clipboard Salin ke papan klip diff --git a/translations/opal-linkhandler-it.ts b/translations/opal-linkhandler-it.ts index e21d42b..6841944 100644 --- a/translations/opal-linkhandler-it.ts +++ b/translations/opal-linkhandler-it.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Collegamento esterno - + Share - + Copy text to clipboard - + Open in browser Apri nel browser - + Open externally Apri esternamente - + Copied to clipboard: %1 Copiato negli appunti %1 - + Share link - + Copy to clipboard Copia negli appunti diff --git a/translations/opal-linkhandler-lt.ts b/translations/opal-linkhandler-lt.ts index e04f9da..3e25c94 100644 --- a/translations/opal-linkhandler-lt.ts +++ b/translations/opal-linkhandler-lt.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Copy text to clipboard - + Share - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-nb_NO.ts b/translations/opal-linkhandler-nb_NO.ts index 48eb843..5f6b2bf 100644 --- a/translations/opal-linkhandler-nb_NO.ts +++ b/translations/opal-linkhandler-nb_NO.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Ekstern lenke - + Share - + Copy text to clipboard - + Open in browser Åpne i nettleser - + Open externally Åpne med annet program - + Copied to clipboard: %1 Kopiert til utklippstavlen: %1 - + Share link - + Copy to clipboard Kopier til utklippstavlen diff --git a/translations/opal-linkhandler-nl.ts b/translations/opal-linkhandler-nl.ts index 9ea7541..ec0f299 100644 --- a/translations/opal-linkhandler-nl.ts +++ b/translations/opal-linkhandler-nl.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-pl.ts b/translations/opal-linkhandler-pl.ts index e43054d..e2b4923 100644 --- a/translations/opal-linkhandler-pl.ts +++ b/translations/opal-linkhandler-pl.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Link Zewnętrzny - + Share - + Copy text to clipboard - + Open in browser Otwórz w przeglądarce - + Open externally Otwórz za pomocą innej aplikacji - + Copied to clipboard: %1 Skopiowano do schowka: %1 - + Share link - + Copy to clipboard Kopiuj do schowka diff --git a/translations/opal-linkhandler-ro.ts b/translations/opal-linkhandler-ro.ts index f261095..fac2425 100644 --- a/translations/opal-linkhandler-ro.ts +++ b/translations/opal-linkhandler-ro.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-ru.ts b/translations/opal-linkhandler-ru.ts index e5d183f..52294a3 100644 --- a/translations/opal-linkhandler-ru.ts +++ b/translations/opal-linkhandler-ru.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Внешняя ссылка - + Share Поделиться - + Copy text to clipboard Скопировать текст в буфер обмена - + Open in browser Открыть в браузере - + Open externally Открыть снаружи - + Copied to clipboard: %1 Скопировано в буфер обмена: %1 - + Share link Поделиться ссылкой - + Copy to clipboard Скопировать в буфер обмена diff --git a/translations/opal-linkhandler-sk.ts b/translations/opal-linkhandler-sk.ts index 202395e..55d65b9 100644 --- a/translations/opal-linkhandler-sk.ts +++ b/translations/opal-linkhandler-sk.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Externý odkaz - + Share Zdielať - + Copy text to clipboard Kopírovať text na klipboard - + Open in browser Otvoriť v prehliadači - + Open externally Otvoriť zvonku - + Copied to clipboard: %1 Kopírovať do schránky: %1 - + Share link Zdieľať odkaz - + Copy to clipboard Kopírovať do schránky diff --git a/translations/opal-linkhandler-sr.ts b/translations/opal-linkhandler-sr.ts index b0a0c78..e42d9e2 100644 --- a/translations/opal-linkhandler-sr.ts +++ b/translations/opal-linkhandler-sr.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-sv.ts b/translations/opal-linkhandler-sv.ts index cbfcf0d..af1d413 100644 --- a/translations/opal-linkhandler-sv.ts +++ b/translations/opal-linkhandler-sv.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Extern länk - + Share - + Copy text to clipboard - + Open in browser Öppna i webbläsare - + Open externally Öppna externt - + Copied to clipboard: %1 Kopierat till urklipp: %1 - + Share link - + Copy to clipboard Kopiera till urklipp diff --git a/translations/opal-linkhandler-tr.ts b/translations/opal-linkhandler-tr.ts index 6242e0a..e694115 100644 --- a/translations/opal-linkhandler-tr.ts +++ b/translations/opal-linkhandler-tr.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Dış Bağlantı - + Share - + Copy text to clipboard - + Open in browser Tarayıcıda aç - + Open externally - + Copied to clipboard: %1 Panoya kopyalandı: %1 - + Share link - + Copy to clipboard Panoya kopyala diff --git a/translations/opal-linkhandler-uk.ts b/translations/opal-linkhandler-uk.ts index 8636bf2..1d3aaf3 100644 --- a/translations/opal-linkhandler-uk.ts +++ b/translations/opal-linkhandler-uk.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Зовнішнє посилання - + Share - + Copy text to clipboard - + Open in browser Відкрити в браузері - + Open externally Відкрити зовні - + Copied to clipboard: %1 Скопійовано до буфера обміну: %1 - + Share link - + Copy to clipboard Копіювати в буфер обміну diff --git a/translations/opal-linkhandler-zh_CN.ts b/translations/opal-linkhandler-zh_CN.ts index eebbd1a..6818e71 100644 --- a/translations/opal-linkhandler-zh_CN.ts +++ b/translations/opal-linkhandler-zh_CN.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link 外部链接 - + Share - + Copy text to clipboard - + Open in browser 用浏览器打开 - + Open externally 用外部应用打开 - + Copied to clipboard: %1 复制到剪贴板:%1 - + Share link - + Copy to clipboard 复制到剪切板 diff --git a/translations/opal-linkhandler.ts b/translations/opal-linkhandler.ts index 801f495..5551835 100644 --- a/translations/opal-linkhandler.ts +++ b/translations/opal-linkhandler.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard From 62807fd7e4b7f55cbc57837b991c583c4352a803 Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Wed, 27 Nov 2024 16:11:11 +0300 Subject: [PATCH 07/15] Revert "lupdate" This reverts commit ca21f5d436e147b63a279d9235de794edbd72572. --- translations/opal-linkhandler-ab.ts | 16 ++++++++-------- translations/opal-linkhandler-be.ts | 16 ++++++++-------- translations/opal-linkhandler-cs.ts | 16 ++++++++-------- translations/opal-linkhandler-de.ts | 16 ++++++++-------- translations/opal-linkhandler-el.ts | 16 ++++++++-------- translations/opal-linkhandler-en.ts | 16 ++++++++-------- translations/opal-linkhandler-es.ts | 16 ++++++++-------- translations/opal-linkhandler-et.ts | 16 ++++++++-------- translations/opal-linkhandler-fi.ts | 16 ++++++++-------- translations/opal-linkhandler-fr.ts | 16 ++++++++-------- translations/opal-linkhandler-hu.ts | 16 ++++++++-------- translations/opal-linkhandler-id.ts | 16 ++++++++-------- translations/opal-linkhandler-it.ts | 16 ++++++++-------- translations/opal-linkhandler-lt.ts | 16 ++++++++-------- translations/opal-linkhandler-nb_NO.ts | 16 ++++++++-------- translations/opal-linkhandler-nl.ts | 16 ++++++++-------- translations/opal-linkhandler-pl.ts | 16 ++++++++-------- translations/opal-linkhandler-ro.ts | 16 ++++++++-------- translations/opal-linkhandler-ru.ts | 16 ++++++++-------- translations/opal-linkhandler-sk.ts | 16 ++++++++-------- translations/opal-linkhandler-sr.ts | 16 ++++++++-------- translations/opal-linkhandler-sv.ts | 16 ++++++++-------- translations/opal-linkhandler-tr.ts | 16 ++++++++-------- translations/opal-linkhandler-uk.ts | 16 ++++++++-------- translations/opal-linkhandler-zh_CN.ts | 16 ++++++++-------- translations/opal-linkhandler.ts | 16 ++++++++-------- 26 files changed, 208 insertions(+), 208 deletions(-) diff --git a/translations/opal-linkhandler-ab.ts b/translations/opal-linkhandler-ab.ts index b4d3780..fdc7dc1 100644 --- a/translations/opal-linkhandler-ab.ts +++ b/translations/opal-linkhandler-ab.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-be.ts b/translations/opal-linkhandler-be.ts index fcc48a5..5528139 100644 --- a/translations/opal-linkhandler-be.ts +++ b/translations/opal-linkhandler-be.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-cs.ts b/translations/opal-linkhandler-cs.ts index 568859a..11e1087 100644 --- a/translations/opal-linkhandler-cs.ts +++ b/translations/opal-linkhandler-cs.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-de.ts b/translations/opal-linkhandler-de.ts index 5882a2a..737411f 100644 --- a/translations/opal-linkhandler-de.ts +++ b/translations/opal-linkhandler-de.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Externer Link - + Share Teilen - + Copy text to clipboard Text kopieren - + Open in browser Im Browser öffnen - + Open externally Extern öffnen - + Copied to clipboard: %1 In die Zwischenablage kopiert: %1 - + Share link Link teilen - + Copy to clipboard In die Zwischenablage kopieren diff --git a/translations/opal-linkhandler-el.ts b/translations/opal-linkhandler-el.ts index 83e954d..83734b6 100644 --- a/translations/opal-linkhandler-el.ts +++ b/translations/opal-linkhandler-el.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-en.ts b/translations/opal-linkhandler-en.ts index 004e1bb..d3d2c45 100644 --- a/translations/opal-linkhandler-en.ts +++ b/translations/opal-linkhandler-en.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link External Link - + Share Share - + Copy text to clipboard Copy text to clipboard - + Open in browser Open in browser - + Open externally Open externally - + Copied to clipboard: %1 Copied to clipboard: %1 - + Share link Share link - + Copy to clipboard Copy to clipboard diff --git a/translations/opal-linkhandler-es.ts b/translations/opal-linkhandler-es.ts index 1924c86..4fb70ad 100644 --- a/translations/opal-linkhandler-es.ts +++ b/translations/opal-linkhandler-es.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Enlace externo - + Share Compartir - + Copy text to clipboard Copiar texto al portapapeles - + Open in browser Abrir en el navegador - + Open externally Abrir externamente - + Copied to clipboard: %1 Copiado al portapapeles: %1 - + Share link Compartir enlace - + Copy to clipboard Copiar al portapapeles diff --git a/translations/opal-linkhandler-et.ts b/translations/opal-linkhandler-et.ts index 3a4f02d..6612c83 100644 --- a/translations/opal-linkhandler-et.ts +++ b/translations/opal-linkhandler-et.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Väline link - + Share Jaga - + Copy text to clipboard Kopeeri tekst lõikelauale - + Open in browser Ava veebibrauseris - + Open externally Ava välise rakendusega - + Copied to clipboard: %1 Kopeerisin lõikelauale: %1 - + Share link Jaga linki - + Copy to clipboard Kopeeri lõikelauale diff --git a/translations/opal-linkhandler-fi.ts b/translations/opal-linkhandler-fi.ts index e8e01dc..fb642fd 100644 --- a/translations/opal-linkhandler-fi.ts +++ b/translations/opal-linkhandler-fi.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Ulkoinen linkki - + Share Jaa - + Copy text to clipboard Kopioi teksti leikepöydälle - + Open in browser Avaa selaimessa - + Open externally Avaa ulkoisesti - + Copied to clipboard: %1 Kopioitu leikepöydälle: %1 - + Share link Jaa linkki - + Copy to clipboard Kopioi leiikepöydälle diff --git a/translations/opal-linkhandler-fr.ts b/translations/opal-linkhandler-fr.ts index 0235db6..70a59a4 100644 --- a/translations/opal-linkhandler-fr.ts +++ b/translations/opal-linkhandler-fr.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Lien externe - + Share - + Copy text to clipboard - + Open in browser Ouvrir dans le navigateur - + Open externally - + Copied to clipboard: %1 Copié dans le presse-papiers : %1 - + Share link - + Copy to clipboard Copier dans le presse-papiers diff --git a/translations/opal-linkhandler-hu.ts b/translations/opal-linkhandler-hu.ts index 7c23bf0..632e707 100644 --- a/translations/opal-linkhandler-hu.ts +++ b/translations/opal-linkhandler-hu.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Külső hivatkozás - + Share - + Copy text to clipboard - + Open in browser Megnyitás böngészőben - + Open externally Megnyitás külső alkalmazással - + Copied to clipboard: %1 A vágólapra másolva: %1 - + Share link - + Copy to clipboard Másolás a vágólapra diff --git a/translations/opal-linkhandler-id.ts b/translations/opal-linkhandler-id.ts index ebcfdd0..33d166b 100644 --- a/translations/opal-linkhandler-id.ts +++ b/translations/opal-linkhandler-id.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Tautan luar - + Share - + Copy text to clipboard - + Open in browser Buka di browser - + Open externally - + Copied to clipboard: %1 Disalin ke papan klip: %1 - + Share link - + Copy to clipboard Salin ke papan klip diff --git a/translations/opal-linkhandler-it.ts b/translations/opal-linkhandler-it.ts index 6841944..e21d42b 100644 --- a/translations/opal-linkhandler-it.ts +++ b/translations/opal-linkhandler-it.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Collegamento esterno - + Share - + Copy text to clipboard - + Open in browser Apri nel browser - + Open externally Apri esternamente - + Copied to clipboard: %1 Copiato negli appunti %1 - + Share link - + Copy to clipboard Copia negli appunti diff --git a/translations/opal-linkhandler-lt.ts b/translations/opal-linkhandler-lt.ts index 3e25c94..e04f9da 100644 --- a/translations/opal-linkhandler-lt.ts +++ b/translations/opal-linkhandler-lt.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Copy text to clipboard - + Share - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-nb_NO.ts b/translations/opal-linkhandler-nb_NO.ts index 5f6b2bf..48eb843 100644 --- a/translations/opal-linkhandler-nb_NO.ts +++ b/translations/opal-linkhandler-nb_NO.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Ekstern lenke - + Share - + Copy text to clipboard - + Open in browser Åpne i nettleser - + Open externally Åpne med annet program - + Copied to clipboard: %1 Kopiert til utklippstavlen: %1 - + Share link - + Copy to clipboard Kopier til utklippstavlen diff --git a/translations/opal-linkhandler-nl.ts b/translations/opal-linkhandler-nl.ts index ec0f299..9ea7541 100644 --- a/translations/opal-linkhandler-nl.ts +++ b/translations/opal-linkhandler-nl.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-pl.ts b/translations/opal-linkhandler-pl.ts index e2b4923..e43054d 100644 --- a/translations/opal-linkhandler-pl.ts +++ b/translations/opal-linkhandler-pl.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Link Zewnętrzny - + Share - + Copy text to clipboard - + Open in browser Otwórz w przeglądarce - + Open externally Otwórz za pomocą innej aplikacji - + Copied to clipboard: %1 Skopiowano do schowka: %1 - + Share link - + Copy to clipboard Kopiuj do schowka diff --git a/translations/opal-linkhandler-ro.ts b/translations/opal-linkhandler-ro.ts index fac2425..f261095 100644 --- a/translations/opal-linkhandler-ro.ts +++ b/translations/opal-linkhandler-ro.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-ru.ts b/translations/opal-linkhandler-ru.ts index 52294a3..e5d183f 100644 --- a/translations/opal-linkhandler-ru.ts +++ b/translations/opal-linkhandler-ru.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Внешняя ссылка - + Share Поделиться - + Copy text to clipboard Скопировать текст в буфер обмена - + Open in browser Открыть в браузере - + Open externally Открыть снаружи - + Copied to clipboard: %1 Скопировано в буфер обмена: %1 - + Share link Поделиться ссылкой - + Copy to clipboard Скопировать в буфер обмена diff --git a/translations/opal-linkhandler-sk.ts b/translations/opal-linkhandler-sk.ts index 55d65b9..202395e 100644 --- a/translations/opal-linkhandler-sk.ts +++ b/translations/opal-linkhandler-sk.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Externý odkaz - + Share Zdielať - + Copy text to clipboard Kopírovať text na klipboard - + Open in browser Otvoriť v prehliadači - + Open externally Otvoriť zvonku - + Copied to clipboard: %1 Kopírovať do schránky: %1 - + Share link Zdieľať odkaz - + Copy to clipboard Kopírovať do schránky diff --git a/translations/opal-linkhandler-sr.ts b/translations/opal-linkhandler-sr.ts index e42d9e2..b0a0c78 100644 --- a/translations/opal-linkhandler-sr.ts +++ b/translations/opal-linkhandler-sr.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard diff --git a/translations/opal-linkhandler-sv.ts b/translations/opal-linkhandler-sv.ts index af1d413..cbfcf0d 100644 --- a/translations/opal-linkhandler-sv.ts +++ b/translations/opal-linkhandler-sv.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Extern länk - + Share - + Copy text to clipboard - + Open in browser Öppna i webbläsare - + Open externally Öppna externt - + Copied to clipboard: %1 Kopierat till urklipp: %1 - + Share link - + Copy to clipboard Kopiera till urklipp diff --git a/translations/opal-linkhandler-tr.ts b/translations/opal-linkhandler-tr.ts index e694115..6242e0a 100644 --- a/translations/opal-linkhandler-tr.ts +++ b/translations/opal-linkhandler-tr.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Dış Bağlantı - + Share - + Copy text to clipboard - + Open in browser Tarayıcıda aç - + Open externally - + Copied to clipboard: %1 Panoya kopyalandı: %1 - + Share link - + Copy to clipboard Panoya kopyala diff --git a/translations/opal-linkhandler-uk.ts b/translations/opal-linkhandler-uk.ts index 1d3aaf3..8636bf2 100644 --- a/translations/opal-linkhandler-uk.ts +++ b/translations/opal-linkhandler-uk.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link Зовнішнє посилання - + Share - + Copy text to clipboard - + Open in browser Відкрити в браузері - + Open externally Відкрити зовні - + Copied to clipboard: %1 Скопійовано до буфера обміну: %1 - + Share link - + Copy to clipboard Копіювати в буфер обміну diff --git a/translations/opal-linkhandler-zh_CN.ts b/translations/opal-linkhandler-zh_CN.ts index 6818e71..eebbd1a 100644 --- a/translations/opal-linkhandler-zh_CN.ts +++ b/translations/opal-linkhandler-zh_CN.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link 外部链接 - + Share - + Copy text to clipboard - + Open in browser 用浏览器打开 - + Open externally 用外部应用打开 - + Copied to clipboard: %1 复制到剪贴板:%1 - + Share link - + Copy to clipboard 复制到剪切板 diff --git a/translations/opal-linkhandler.ts b/translations/opal-linkhandler.ts index 5551835..801f495 100644 --- a/translations/opal-linkhandler.ts +++ b/translations/opal-linkhandler.ts @@ -4,42 +4,42 @@ Opal.LinkHandler - + External Link - + Share - + Copy text to clipboard - + Open in browser - + Open externally - + Copied to clipboard: %1 - + Share link - + Copy to clipboard From e3f1f3c1013d8cfbaf4a0a435e62b4f24746e7a1 Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Wed, 27 Nov 2024 16:17:36 +0300 Subject: [PATCH 08/15] README: add permissions --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index ce14b50..9d64709 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,19 @@ Label { } ``` +## Permissions + +Some permissions are required for WebView-based preview support in this module to work in Sailjail. This only affects apps intended for the Harbour store that show local video files. + +Add this to your `harbour-my-app.desktop` file: + +```{ini} +[X-Sailjail] +Permissions=Internet;WebView +``` + +See [here](https://github.com/sailfishos/sailjail-permissions#permissions) for a list of all Sailjail permissions. + ## Screenshots | 1. | 2. | From 4ac77aeb54fe65e086dbb8b5d3addbfda89ba813 Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Wed, 27 Nov 2024 16:39:33 +0300 Subject: [PATCH 09/15] README: update permissions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d64709..3d8fb79 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Label { ## Permissions -Some permissions are required for WebView-based preview support in this module to work in Sailjail. This only affects apps intended for the Harbour store that show local video files. +Some permissions are required for WebView-based preview support in this module to work in Sailjail. Make sure that if you aren't using Internet URLs you don't need Internet permission, and if you are not using preview at all you don't need any of these permissions. Add this to your `harbour-my-app.desktop` file: From 75db3af1ede06a2cf2553477cd88d8b7b0ee4f24 Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Wed, 27 Nov 2024 16:46:40 +0300 Subject: [PATCH 10/15] Preview indicator --- Opal/LinkHandler/private/ExternalUrlPage.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Opal/LinkHandler/private/ExternalUrlPage.qml b/Opal/LinkHandler/private/ExternalUrlPage.qml index 560b5df..2a99e5e 100644 --- a/Opal/LinkHandler/private/ExternalUrlPage.qml +++ b/Opal/LinkHandler/private/ExternalUrlPage.qml @@ -199,5 +199,16 @@ Item{}", root, 'WebviewTester [inline]') } } } + + Label { + text: qsTr("Swipe left to preview") + visible: pageStack.nextPage() && pageStack.nextPage().__linkhandler_webview + width: parent.width - 2*Theme.horizontalPageMargin + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + color: Theme.secondaryHighlightColor + font.pixelSize: Theme.fontSizeSmall + wrapMode: Text.Wrap + } } } From 97228564504fbae43285865c5f235ea9fdb472eb Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Wed, 27 Nov 2024 17:30:52 +0300 Subject: [PATCH 11/15] Fix signals not working with internetOnly --- Opal/LinkHandler/private/ExternalUrlPage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Opal/LinkHandler/private/ExternalUrlPage.qml b/Opal/LinkHandler/private/ExternalUrlPage.qml index 2a99e5e..8aac875 100644 --- a/Opal/LinkHandler/private/ExternalUrlPage.qml +++ b/Opal/LinkHandler/private/ExternalUrlPage.qml @@ -50,7 +50,7 @@ WebView { iface: 'net.connman.Manager' path: '/' - signalsEnabled: previewType === LinkPreviewType.auto + signalsEnabled: LinkPreviewType.auto || previewType === LinkPreviewType.internetOnly function checkState(state) { if (state === "online") { From 9e35e95e3e5ca4a2757d080f30ae535c626e1fcc Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Wed, 27 Nov 2024 17:34:30 +0300 Subject: [PATCH 12/15] Scheme check --- Opal/LinkHandler/PreviewType.qml | 6 ++++-- Opal/LinkHandler/private/ExternalUrlPage.qml | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Opal/LinkHandler/PreviewType.qml b/Opal/LinkHandler/PreviewType.qml index 9931054..8a6fe06 100644 --- a/Opal/LinkHandler/PreviewType.qml +++ b/Opal/LinkHandler/PreviewType.qml @@ -4,6 +4,8 @@ import QtQuick 2.0 QtObject { property int auto: 0 property int internetOnly: 1 - property int enable: 2 - property int disable: 3 + property int schemeOnly: 2 + property int internetAndScheme: 3 + property int enable: 4 + property int disable: 5 } \ No newline at end of file diff --git a/Opal/LinkHandler/private/ExternalUrlPage.qml b/Opal/LinkHandler/private/ExternalUrlPage.qml index 8aac875..658d21a 100644 --- a/Opal/LinkHandler/private/ExternalUrlPage.qml +++ b/Opal/LinkHandler/private/ExternalUrlPage.qml @@ -39,22 +39,24 @@ WebView { Timer { id: pushWebviewTimer interval: 0 - onTriggered: pageStack.pushAttached(webViewComponent) + onTriggered: if (previewType === LinkPreviewType.enable) pageStack.pushAttached(webViewComponent) + else if (previewType === LinkPreviewType.schemeOnly) connman.checkState('online') } DBusInterface { // Sailjail info: if we don't specify Internet permission, we won't have access to this service, and as a result no webview will pop up // And WebView permission doesn't seem to change anything + id: connman bus: DBus.SystemBus service: 'net.connman' iface: 'net.connman.Manager' path: '/' - signalsEnabled: LinkPreviewType.auto || previewType === LinkPreviewType.internetOnly + signalsEnabled: previewType === LinkPreviewType.auto || previewType === LinkPreviewType.internetOnly || previewType === LinkPreviewType.internetAndScheme function checkState(state) { if (state === "online") { - if (previewType !== LinkPreviewType.internetOnly) { + if (previewType === LinkPreviewType.auto) { try { const tester = Qt.createQmlObject("import QtQuick 2.0 import Sailfish.Silica 1.0 @@ -65,6 +67,16 @@ Item{}", root, 'WebviewTester [inline]') tester.destroy() } + if (previewType !== LinkPreviewType.internetOnly) { + switch (externalUrl.toString().slice(0, externalUrl.toString().indexOf(':'))) { + case 'http': + case 'https': + case 'file': + break + default: return + } + } + if (!pageStack.nextPage()) pageStack.pushAttached(webViewComponent) } else if (pageStack.nextPage() && pageStack.nextPage().__linkhandler_webview) @@ -80,6 +92,7 @@ Item{}", root, 'WebviewTester [inline]') case LinkPreviewType.disable: break case LinkPreviewType.enable: + case LinkPreviewType.schemeOnly: // pageStack.completeAnimation doesn't work pushWebviewTimer.start() break From cb8382c4ae56be391d5091fbbd96b07431aed8bc Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Wed, 27 Nov 2024 18:10:20 +0300 Subject: [PATCH 13/15] Add NumberAnimation --- Opal/LinkHandler/private/ExternalUrlPage.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Opal/LinkHandler/private/ExternalUrlPage.qml b/Opal/LinkHandler/private/ExternalUrlPage.qml index 658d21a..9de22f0 100644 --- a/Opal/LinkHandler/private/ExternalUrlPage.qml +++ b/Opal/LinkHandler/private/ExternalUrlPage.qml @@ -159,6 +159,8 @@ Item{}", root, 'WebviewTester [inline]') } width: parent.width spacing: Theme.paddingLarge + height: implicitHeight + Behavior on height { NumberAnimation { duration: 200 } } ButtonLayout { id: firstRow From 38934d8469c4968242e563bf6a427fa1b6f92a3a Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Wed, 27 Nov 2024 20:01:21 +0300 Subject: [PATCH 14/15] Update docs --- Opal/LinkHandler/LinkHandler.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Opal/LinkHandler/LinkHandler.js b/Opal/LinkHandler/LinkHandler.js index 336d290..5976aaa 100644 --- a/Opal/LinkHandler/LinkHandler.js +++ b/Opal/LinkHandler/LinkHandler.js @@ -35,15 +35,21 @@ copying its title (if available), sharing it or opening it externally. The \a title argument is optional. This module includes an algorithm for checking if the WebView module is installed, - Internet connection is established and Sailjail permissions include Internet usage. + Internet connection is established, Sailjail permissions include Internet usage + and the scheme provided is an Internet scheme. You can override this algorithm with \a previewType property which can be one of the following: \list - \li \c LinkPreviewType.auto - default - \li \c LinkPreviewType.internetOnly - skips WebView check, recommended for internet links - \li \c LinkPreviewType.disable - skips all checks and disables preview, recommended for apps without Internet permission - \li \c LinkPreviewType.disable - skips all checks and enables preview - \endlist + \li \c LinkPreviewType.auto - default + \li \c LinkPreviewType.internetOnly - skips WebView and scheme check, recommended for internet links where scheme should not be checked + \li \c LinkPreviewType.schemeOnly - skips WebView and internet check + \li \c LinkPreviewType.internetAndScheme - skips WebView check, recommended for links where you can't fully know if scheme is http or https + \li \c LinkPreviewType.disable - skips all checks and disables preview, recommended for apps without Internet and WebVoew permissions + \li \c LinkPreviewType.enable - skips all checks and enables preview + + \endlist + + It is recommended to set a value different from auto to skip unnecessary checks for performance. \sa Qt::openUrlExternally */ From 905f43c0dea7f695d9109658af471df46c7f2fe0 Mon Sep 17 00:00:00 2001 From: roundedrectangle Date: Wed, 27 Nov 2024 20:01:34 +0300 Subject: [PATCH 15/15] Remove file:// scheme from Internet schemes --- Opal/LinkHandler/private/ExternalUrlPage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Opal/LinkHandler/private/ExternalUrlPage.qml b/Opal/LinkHandler/private/ExternalUrlPage.qml index 9de22f0..bec8dcc 100644 --- a/Opal/LinkHandler/private/ExternalUrlPage.qml +++ b/Opal/LinkHandler/private/ExternalUrlPage.qml @@ -71,7 +71,7 @@ Item{}", root, 'WebviewTester [inline]') switch (externalUrl.toString().slice(0, externalUrl.toString().indexOf(':'))) { case 'http': case 'https': - case 'file': + //case 'file': break default: return }