Sailfish Share API and Sailfish WebView

This has been fixed with the SailfishOS-4.4.0.58 emulator.

4 Likes

Perhaps it’s just me (usually it is), but I’ve noticed that no YAML is present in a new project, pretty sure they were always present. Using latest SDK 3.10.4 on Windows 10 64bit. Guess I’ll have to manually add the missing YAML file.

I’ve followed the docs, I am still unable to get imports for web stuff to be recognised. Ultimately, why is there no YAML file in my new project…and looking at new and old projects, most are lacking a YAML file. I guess I should make that last remark as a new post.

It’s not just you, YAML files were indeed dropped a while ago. Instead of adding YAML file yourself, you should add the build time dependencies to the RPM spec file as BuildRequires.

I did just that @vige regarding “BuildRequires” but I am still unable to add necessary import statements for WebView stuff.

So what am I missing from .pro file and spec.file ?

my .PRO file;

TARGET = harbour-qml-colors

PKGCONFIG += qt5embedwidget

CONFIG += sailfishapp

SOURCES += src/harbour-qml-colors.cpp

DISTFILES += qml/harbour-qml-colors.qml \
    qml/cover/CoverPage.qml \
    qml/pages/FirstPage.qml \
    qml/pages/SecondPage.qml \
    rpm/harbour-qml-colors.changes.in \
    rpm/harbour-qml-colors.changes.run.in \
    rpm/harbour-qml-colors.spec \
    harbour-qml-colors.desktop

SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172

and my .SPEC file;

Name:       harbour-qml-colors

Summary:    My Sailfish OS Application
Version:    0.1
Release:    1
License:    LICENSE
URL:        http://example.org/
Source0:    %{name}-%{version}.tar.bz2
Requires:   sailfishsilica-qt5 >= 0.10.9
BuildRequires:  pkgconfig(sailfishapp) >= 1.0.2
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Qml)
BuildRequires:  pkgconfig(Qt5Quick)
BuildRequires:  desktop-file-utils
BuildRequires:  pkgconfig(qt5embedwidget)

%description
Short description of my Sailfish OS Application


%prep
%setup -q -n %{name}-%{version}

%build

%qmake5 

%make_build


%install
%qmake5_install


desktop-file-install --delete-original         --dir %{buildroot}%{_datadir}/applications                %{buildroot}%{_datadir}/applications/*.desktop

%files
%defattr(-,root,root,-)
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png

This looks fine compared with the settings in my app Ielig:Web.

When you add this 2 lines to your qml:

import Sailfish.WebView 1.0
import Sailfish.WebEngine 1.0

QT Creator creates 2 messages ("QML-modul not found…). Thats not a problem. Enter your code and build your app and the app will work on your phone. As I remember the Sailfish emulator can’t run apps with the Sailfish WebEngine.

Happy hacking

2 Likes