Commit f985e367 authored by Richard Liebscher's avatar Richard Liebscher Committed by Nicolas Fella

Make build for SailfishConnect possible

parent 71ec233f
Pipeline #11724 failed with stage
in 23 minutes and 5 seconds
......@@ -3,14 +3,13 @@ cmake_minimum_required(VERSION 3.0)
project(kdeconnect)
if (SAILFISHOS)
set(KF5_MIN_VERSION "5.31.0")
set(KF5_MIN_VERSION "5.36.0")
set(QT_MIN_VERSION "5.6.0")
set(QCA_MIN_VERSION "2.0.0")
else()
set(KF5_MIN_VERSION "5.64.0")
set(QT_MIN_VERSION "5.10.0")
set(QCA_MIN_VERSION "2.1.0")
endif()
set(QCA_MIN_VERSION "2.1.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
......@@ -32,15 +31,16 @@ ecm_setup_version(1.4.0
)
if (SAILFISHOS)
find_package(PkgConfig)
set(KF5_REQUIRED_COMPONENTS I18n DBusAddons CoreAddons IconThemes Config)
set(KF5_REQUIRED_COMPONENTS I18n CoreAddons Config)
set(KF5_OPTIONAL_COMPONENTS)
pkg_search_module(SFOS REQUIRED sailfishapp)
pkg_check_modules(QCA2 qca2-qt5>=${QCA_MIN_VERSION} REQUIRED)
set(Qca_LIBRARY CONAN_PKG::Qca-qt5)
add_definitions(-DSAILFISHOS)
include_directories(${QCA2_INCLUDEDIR})
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
else()
find_package(Qca-qt5 ${QCA_MIN_VERSION} REQUIRED)
set(Qca_LIBRARY qca-qt5)
set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Kirigami2 People)
set(KF5_OPTIONAL_COMPONENTS DocTools)
......@@ -54,7 +54,6 @@ else()
if(UNIX AND NOT APPLE)
find_package(KF5PulseAudioQt)
endif()
find_package(Qca-qt5 ${QCA_MIN_VERSION} REQUIRED)
find_package(KF5PeopleVCard)
set_package_properties(KF5PeopleVCard PROPERTIES
......@@ -63,13 +62,15 @@ else()
TYPE RUNTIME
)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII -DHAVE_KIO)
add_definitions(-DHAVE_KIO)
endif()
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Quick Network Multimedia)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus Quick Network Multimedia)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS ${KF5_REQUIRED_COMPONENTS})
if (KF5_OPTIONAL_COMPONENTS)
find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS})
find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS})
endif()
if (NOT ZSH_AUTOCOMPLETE_DIR)
......@@ -82,14 +83,15 @@ if(PRIVATE_DBUS_ENABLED OR APPLE)
endif()
add_subdirectory(core)
add_subdirectory(icon)
add_subdirectory(interfaces)
add_subdirectory(data)
add_subdirectory(plugins)
add_subdirectory(cli)
add_subdirectory(declarativeplugin)
if(NOT SAILFISHOS)
if (NOT SAILFISHOS)
add_subdirectory(icon)
add_subdirectory(interfaces)
add_subdirectory(data)
add_subdirectory(plugins)
add_subdirectory(cli)
add_subdirectory(declarativeplugin)
add_subdirectory(kcm)
add_subdirectory(kcmplugin)
add_subdirectory(daemon)
......@@ -99,21 +101,19 @@ if(NOT SAILFISHOS)
add_subdirectory(nautilus-extension)
add_subdirectory(fileitemactionplugin)
add_subdirectory(smsapp)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
if(NOT WIN32)
add_subdirectory(kio)
add_subdirectory(plasmoid)
endif()
endif()
if(KF5DocTools_FOUND)
add_subdirectory(doc)
endif()
if(KF5DocTools_FOUND)
add_subdirectory(doc)
endif()
else()
add_subdirectory(sfos)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -43,13 +43,13 @@ set(kdeconnectcore_SRCS
add_library(kdeconnectcore ${kdeconnectcore_SRCS})
target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
target_link_libraries(kdeconnectcore
PUBLIC
Qt5::Network
KF5::CoreAddons
qca-qt5
${Qca_LIBRARY}
PRIVATE
Qt5::DBus
KF5::I18n
......
......@@ -25,6 +25,7 @@
#include "lanlinkprovider.h"
#include <daemon.h>
#include "plugins/share/shareplugin.h"
#include "qtcompat_p.h"
#ifdef HAVE_KIO
#include <kio/global.h>
......@@ -107,13 +108,21 @@ void CompositeUploadJob::startNextSubJob()
m_currentJobSendPayloadSize = 0;
emitDescription(m_currentJob->getNetworkPacket().get<QString>(QStringLiteral("filename")));
#ifdef SAILFISHOS
connect(m_currentJob, SIGNAL(processedAmount(KJob*,KJob::Unit,qulonglong)), this, SLOT(slotProcessedAmount(KJob*,KJob::Unit,qulonglong)));
#else
connect(m_currentJob, QOverload<KJob*,KJob::Unit,qulonglong>::of(&UploadJob::processedAmount), this, &CompositeUploadJob::slotProcessedAmount);
#endif
//Already done by KCompositeJob
//connect(m_currentJob, &KJob::result, this, &CompositeUploadJob::slotResult);
//TODO: Create a copy of the networkpacket that can be re-injected if sending via lan fails?
NetworkPacket np = m_currentJob->getNetworkPacket();
#if QT_VERSION < QT_VERSION_CHECK(5,8,0)
np.setPayload({}, np.payloadSize());
#else
np.setPayload(nullptr, np.payloadSize());
#endif
np.setPayloadTransferInfo({{QStringLiteral("port"), m_port}});
np.set<int>(QStringLiteral("numberOfFiles"), m_totalJobs);
np.set<quint64>(QStringLiteral("totalPayloadSize"), m_totalPayloadSize);
......
......@@ -42,6 +42,7 @@
#include "landevicelink.h"
#include "lanpairinghandler.h"
#include "kdeconnectconfig.h"
#include "qtcompat_p.h"
#define MIN_VERSION_WITH_SSL_SUPPORT 6
......@@ -370,7 +371,12 @@ void LanLinkProvider::newConnection()
void LanLinkProvider::dataReceived()
{
QSslSocket* socket = qobject_cast<QSslSocket*>(sender());
#if QT_VERSION < QT_VERSION_CHECK(5,7,0)
if (!socket->canReadLine())
return;
#else
socket->startTransaction();
#endif
const QByteArray data = socket->readLine();
......@@ -379,12 +385,19 @@ void LanLinkProvider::dataReceived()
NetworkPacket* np = new NetworkPacket(QLatin1String(""));
bool success = NetworkPacket::unserialize(data, np);
#if QT_VERSION < QT_VERSION_CHECK(5,7,0)
if (!success) {
delete np;
return;
}
#else
if (!success) {
delete np;
socket->rollbackTransaction();
return;
}
socket->commitTransaction();
#endif
if (np->type() != PACKET_TYPE_IDENTITY) {
qCWarning(KDECONNECT_CORE) << "LanLinkProvider/newConnection: Expected identity, received " << np->type();
......
......@@ -57,7 +57,11 @@ void CompositeFileTransferJob::startNextSubJob()
m_currentJobSendPayloadSize = 0;
emitDescription(m_currentJob->destination().toString());
m_currentJob->start();
#ifdef SAILFISHOS
connect(m_currentJob, SIGNAL(processedAmount(KJob*,KJob::Unit,qulonglong)), this, SLOT(slotProcessedAmount(KJob*,KJob::Unit,qulonglong)));
#else
connect(m_currentJob, QOverload<KJob*,KJob::Unit,qulonglong>::of(&FileTransferJob::processedAmount), this, &CompositeFileTransferJob::slotProcessedAmount);
#endif
}
bool CompositeFileTransferJob::addSubjob(KJob* job)
......
......@@ -40,6 +40,42 @@ template <typename T>
void qAsConst(const T &&) Q_DECL_EQ_DELETE;
#endif
#if QT_VERSION < QT_VERSION_CHECK(5,7,0)
template<typename...Args>
struct QNonConstOverload
{
template<typename R, typename T>
static constexpr auto of(R (T::*func)(Args...)) noexcept -> decltype(func)
{
return func;
}
};
template<typename...Args>
struct QConstOverload
{
template<typename R, typename T>
static constexpr auto of(R (T::*func)(Args...) const) noexcept -> decltype(func)
{
return func;
}
};
template<typename...Args>
struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...>
{
using QConstOverload<Args...>::of;
using QNonConstOverload<Args...>::of;
template<typename R>
static constexpr auto of(R (*func)(Args...)) noexcept -> decltype(func)
{
return func;
}
};
#endif
// compat for Q_FALLTHROUGH
#if QT_VERSION < QT_VERSION_CHECK(5,8,0)
......
......@@ -32,6 +32,7 @@
#include <KLocalizedString>
#include <KJobTrackerInterface>
#include <KPluginFactory>
#include <KIO/Job>
#include <KIO/MkpathJob>
#include <KMimeTypeTrader>
......
......@@ -23,8 +23,6 @@
#include <QPointer>
#include <KIO/Job>
#include <core/kdeconnectplugin.h>
#include <core/compositefiletransferjob.h>
......
find_package(Qt5 5.2 REQUIRED COMPONENTS DBus)
pkg_check_modules(NNQT5 REQUIRED nemonotifications-qt5)
include_directories(${NNQT5_INCLUDE_DIRS})
pkg_check_modules(KEEPALIVE REQUIRED keepalive)
include_directories(${KEEPALIVE_INCLUDE_DIRS})
set(kdeconnectsfos_SRCS
kdeconnect-sfos.cpp
)
add_executable(kdeconnect-sfos ${kdeconnectsfos_SRCS})
target_link_libraries(kdeconnect-sfos Qt5::Quick sailfishapp)
install(TARGETS kdeconnect-sfos ${INSTALL_TARGETS_DEFAULT_ARGS})
install(PROGRAMS kdeconnect-sfos.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
INSTALL( DIRECTORY qml DESTINATION ${SHARE_INSTALL_PREFIX}/kdeconnect-sfos/ )
#Daemon
add_executable(kdeconnectd sailfishdaemon.cpp)
target_link_libraries(kdeconnectd kdeconnectcore KF5::DBusAddons ${NNQT5_LIBRARIES} KF5::I18n ${KEEPALIVE_LIBRARIES})
configure_file(kdeconnectd.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectd.desktop)
configure_file(org.kde.kdeconnect.service.in ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kdeconnect.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectd.desktop DESTINATION ${AUTOSTART_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kdeconnect.service DESTINATION ${DBUS_SERVICES_INSTALL_DIR})
install(TARGETS kdeconnectd DESTINATION ${LIBEXEC_INSTALL_DIR})
/*
Copyright (C) 2013 Jolla Ltd.
Contact: Thomas Perl <thomas.perl@jollamobile.com>
All rights reserved.
You may use this file under the terms of BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Jolla Ltd nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef QT_QML_DEBUG
#include <QtQuick>
#endif
#include <sailfishapp/sailfishapp.h>
#include <QGuiApplication>
#include <QQuickView>
int main(int argc, char *argv[])
{
// SailfishApp::main() will display "qml/kdeconnect-sfos.qml", if you need more
// control over initialization, you can use:
//
// - SailfishApp::application(int, char *[]) to get the QGuiApplication *
// - SailfishApp::createView() to get a new QQuickView * instance
// - SailfishApp::pathTo(QString) to get a QUrl to a resource file
// - SailfishApp::pathToMainQml() to get a QUrl to the main QML file
//
// To display the view, call "show()" (will show fullscreen on device).
//return SailfishApp::main(argc, argv);
QGuiApplication *app = SailfishApp::application(argc, argv);
QScopedPointer<QQuickView> view(SailfishApp::createView());
view->setSource(SailfishApp::pathTo("qml/kdeconnect-sfos.qml"));
view->showFullScreen();
return app->exec();
}
[Desktop Entry]
Type=Application
X-Nemo-Application-Type=generic
Icon=kdeconnect
Exec=kdeconnect-sfos
Name=KDE Connect
Name[ar]=كدي المتّصل
Name[ast]=KDE Connect
Name[bg]=KDE Connect
Name[bs]=Konekcija KDE
Name[ca]=KDE Connect
Name[ca@valencia]=KDE Connect
Name[cs]=KDE Connect
Name[da]=KDE Connect
Name[de]=KDE-Connect
Name[el]=KDE Connect
Name[en_GB]=KDE Connect
Name[es]=KDE Connect
Name[et]=KDE Connect
Name[eu]=KDE Connect
Name[fi]=KDE Connect
Name[fr]=KDE Connect
Name[gl]=KDE Connect
Name[he]=KDE Connect
Name[hu]=KDE Connect
Name[id]=KDE Connect
Name[it]=KDE Connect
Name[ko]=KDE Connect
Name[lt]=KDE Connect
Name[nl]=KDE Connect
Name[nn]=KDE Connect
Name[pl]=KDE Connect
Name[pt]=KDE Connect
Name[pt_BR]=KDE Connect
Name[ro]=KDE Connect
Name[ru]=KDE Connect
Name[sk]=KDE Connect
Name[sr]=КДЕ‑конекција
Name[sr@ijekavian]=КДЕ‑конекција
Name[sr@ijekavianlatin]=KDE‑konekcija
Name[sr@latin]=KDE‑konekcija
Name[sv]=KDE-anslut
Name[tr]=KDE Connect
Name[uk]=З’єднання KDE
Name[x-test]=xxKDE Connectxx
Name[zh_CN]=KDE Connect
Name[zh_TW]=KDE 連線
# translation example:
# your app name in German locale (de)
#
# Remember to comment out the following line, if you do not want to use
# a different app name in German locale (de).
#Name[de]=kdeconnect-sfos
[Desktop Entry]
Type=Application
Exec=${KDE_INSTALL_FULL_LIBEXECDIR}/kdeconnectd
X-KDE-StartupNotify=false
X-KDE-autostart-phase=1
X-GNOME-Autostart-enabled=true
OnlyShowIn=KDE;GNOME;Unity;XFCE;
NoDisplay=true
Name=KDEConnect daemon
Name[ar]=عفريت KDEConnect
Name[ast]=Degorriu KDEConnect
Name[bg]=Услуга KDE Connect
Name[ca]=Dimoni del KDEConnect
Name[ca@valencia]=Dimoni del KDEConnect
Name[cs]=Démon KDE Connect
Name[da]=KDEConnect-dæmon
Name[de]=KDE-Connect-Dienst
Name[el]=Δαίμονας του KDEConnect
Name[en_GB]=KDEConnect daemon
Name[es]=Demonio de KDE Connect
Name[et]=KDEConnecti deemon
Name[eu]=KDEConnect daimona
Name[fi]=KDEConnect-taustapalvelu
Name[fr]=Démon KDE Connect
Name[gl]=Servizo de KDE Connect
Name[he]=דמון KDEConnect
Name[hu]=KDEConnect szolgáltatás
Name[id]=Daemon KDEConnect
Name[it]=Demone KDE Connect
Name[ko]=KDE 연결 데몬
Name[lt]=KDEConnect tarnyba
Name[nl]=KDEConnect-daemon
Name[nn]=KDEConnect-teneste
Name[pl]=Usługa KDEConnect
Name[pt]=Serviço do KDE Connect
Name[pt_BR]=Serviço do KDE Connect
Name[ru]=Служба KDE Connect
Name[sk]=KDEConnect démon
Name[sr]=КДЕ‑конекцијин демон
Name[sr@ijekavian]=КДЕ‑конекцијин демон
Name[sr@ijekavianlatin]=KDE‑konekcijin demon
Name[sr@latin]=KDE‑konekcijin demon
Name[sv]=Demon för KDE-anslut
Name[tr]=KDEConnect süreci
Name[uk]=Фонова служба KDEConnect
Name[x-test]=xxKDEConnect daemonxx
Name[zh_CN]=KDEConnect 守护进程
Name[zh_TW]=KDE 連線守護程式
[D-BUS Service]
Name=org.kde.kdeconnect
Exec=@KDE_INSTALL_FULL_LIBEXECDIR@/kdeconnectd
/*
Copyright (C) 2013 Jolla Ltd.
Contact: Thomas Perl <thomas.perl@jollamobile.com>
All rights reserved.
You may use this file under the terms of BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Jolla Ltd nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import org.kde.kdeconnect 1.0
CoverBackground {
Label {
id: label
anchors.top: parent.top
anchors.topMargin: Theme.paddingMedium
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("KDE Connect")
}
SilicaListView {
id: devices
anchors.top: label.bottom
anchors.margins: Theme.paddingSmall
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
visible: count > 0
model: DevicesSortProxyModel {
sourceModel: DevicesModel { displayFilter: DevicesModel.Reachable | DevicesModel.Paired }
}
width: parent.width
spacing: Theme.paddingLarge
delegate: ListItem {
width: ListView.view.width
height: Theme.itemSizeMedium
Label { text: display }
}
}
Label {
text: qsTr("No paired \ndevices in range")
anchors.centerIn: parent
visible: devices.count == 0
}
}
/*
Copyright (C) 2013 Jolla Ltd.
Contact: Thomas Perl <thomas.perl@jollamobile.com>
All rights reserved.
You may use this file under the terms of BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Jolla Ltd nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"
ApplicationWindow
{
initialPage: Component { FirstPage { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations
Keys.onPressed: {
if (event.key == Qt.Key_Back) {
console.log("back");
pageStack.pop();
}
}
}
/*
Copyright (C) 2013 Jolla Ltd.
Contact: Thomas Perl <thomas.perl@jollamobile.com>
All rights reserved.
You may use this file under the terms of BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Jolla Ltd nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import org.kde.kdeconnect 1.0
Page {
id: deviceView
property QtObject currentDevice
// The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.Portrait
Column {
id: column
anchors.fill: parent
spacing: Theme.paddingMedium
PageHeader {
title: currentDevice.name
}
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: "Device is " + (currentDevice.isTrusted ? "trusted" : "not trusted")
}
Button {
id: text
anchors.horizontalCenter: parent.horizontalCenter
text: currentDevice.isTrusted ? "Un-Pair" : "Pair"
onClicked: {
if (currentDevice.isTrusted) {
currentDevice.unpair()
} else {
currentDevice.requestPair()
}
}
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
visible: currentDevice.isTrusted
text: qsTr("Ping")
onClicked: {
currentDevice.pluginCall("ping", "sendPing");
}
}
PluginItem {
anchors.horizontalCenter: parent.horizontalCenter
text: ("Multimedia control")
interfaceFactory: MprisDbusInterfaceFactory
component: "mpris.qml"
pluginName: "mprisremote"
}
PluginItem {
anchors.horizontalCenter: parent.horizontalCenter
text: ("Remote input")
interfaceFactory: RemoteControlDbusInterfaceFactory
component: "mousepad.qml"
pluginName: "remotecontrol"
}
PluginItem {
anchors.horizontalCenter: parent.horizontalCenter
readonly property var lockIface: LockDeviceDbusInterfaceFactory.create(deviceView.currentDevice.id())
pluginName: "lockdevice"
text: lockIface.isLocked ? ("Unlock") : ("Lock")
onClicked: {
lockIface.isLocked = !lockIface.isLocked;
}
}
}
}
/*
Copyright (C) 2013 Jolla Ltd.
Contact: Thomas Perl <thomas.perl@jollamobile.com>
All rights reserved.
You may use this file under the terms of BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Jolla Ltd nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0