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
<a href="url">title</a> 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, share or preview an external link instead of immediately opening it in the default web browser. This module provides a way to do that.
Simply define a QML label and set its link handler to the one provided by this module.
import QtQuick 2.0
import Sailfish.Silica 1.0
import Opal.LinkHandler 1.0
Label {
text: 'This is my text, and <a href="https://example.org">this is my link</a>.'
color: Theme.highlightColor
linkColor: Theme.primaryColor // important, as the default color is plain blue
onLinkActivated: LinkHandler.openOrCopyUrl(link)
}
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:
[X-Sailjail]
Permissions=Internet;WebView
See here for a list of all Sailjail permissions.
| 1. | 2. |
|---|---|
![]() |
![]() |
You do not need to clone this repository if you only intend to use the module in another project. Simply download the latest release bundle.
Follow the main documentation for installing Opal modules here.
See doc/gallery.qml for an example. Copy the file to get
started.
Extensive documentation is included in the release bundle and can be added to QtCreator via Extras → Settings → Help → Documentation → Add.
To use packaged translations in your project, follow the main documentation for using Opal modules here.
You can also contribute translations. If an app uses Opal modules, consider updating its translations at the source (i.e. here), so that all Opal users can benefit from it. Translations are managed using Weblate.
Please prefer Weblate over pull requests (which are still welcome, of course). If you just found a minor problem, you can also leave a comment in the forum or open an issue.
Please include the following details:
- the language you were using
- where you found the error
- the incorrect text
- the correct translation
See the Qt documentation for details on how to translate date formats to your local format.
Copyright (C) Mirian Margiani
Program: opal-linkhandler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

