From ee7a16d9179e5151b318707ca8412eedf1fcff40 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Wed, 11 Dec 2019 15:58:40 +0100 Subject: [PATCH] Unfuckup --- CMakeLists.txt | 60 ++++----- core/CMakeLists.txt | 4 +- core/backends/lan/compositeuploadjob.cpp | 9 -- core/backends/lan/lanlinkprovider.cpp | 13 -- core/compositefiletransferjob.cpp | 4 - core/qtcompat_p.h | 36 ----- plugins/share/shareplugin.cpp | 1 - plugins/share/shareplugin.h | 2 + sfos/CMakeLists.txt | 29 ++++ sfos/kdeconnect-sfos.cpp | 60 +++++++++ sfos/kdeconnect-sfos.desktop | 53 ++++++++ sfos/kdeconnectd.desktop.cmake | 49 +++++++ sfos/org.kde.kdeconnect.service.in | 3 + sfos/qml/cover/CoverPage.qml | 74 +++++++++++ sfos/qml/kdeconnect-sfos.qml | 48 +++++++ sfos/qml/pages/DevicePage.qml | 105 +++++++++++++++ sfos/qml/pages/FindDevices.qml | 86 ++++++++++++ sfos/qml/pages/FirstPage.qml | 61 +++++++++ sfos/qml/pages/PluginItem.qml | 47 +++++++ sfos/qml/pages/mousepad.qml | 104 +++++++++++++++ sfos/qml/pages/mpris.qml | 138 +++++++++++++++++++ sfos/rpm/kdeconnect-sfos.changes.in | 18 +++ sfos/rpm/kdeconnect-sfos.changes.run.in | 25 ++++ sfos/rpm/kdeconnect-sfos.spec | 86 ++++++++++++ sfos/sailfishdaemon.cpp | 161 +++++++++++++++++++++++ tests/CMakeLists.txt | 27 ++-- tests/pluginloadtest.cpp | 4 +- tests/sendfiletest.cpp | 4 +- tests/testsocketlinereader.cpp | 1 - tests/testsslsocketlinereader.cpp | 1 - 30 files changed, 1199 insertions(+), 114 deletions(-) create mode 100644 sfos/CMakeLists.txt create mode 100644 sfos/kdeconnect-sfos.cpp create mode 100644 sfos/kdeconnect-sfos.desktop create mode 100644 sfos/kdeconnectd.desktop.cmake create mode 100644 sfos/org.kde.kdeconnect.service.in create mode 100644 sfos/qml/cover/CoverPage.qml create mode 100644 sfos/qml/kdeconnect-sfos.qml create mode 100644 sfos/qml/pages/DevicePage.qml create mode 100644 sfos/qml/pages/FindDevices.qml create mode 100644 sfos/qml/pages/FirstPage.qml create mode 100644 sfos/qml/pages/PluginItem.qml create mode 100644 sfos/qml/pages/mousepad.qml create mode 100644 sfos/qml/pages/mpris.qml create mode 100644 sfos/rpm/kdeconnect-sfos.changes.in create mode 100644 sfos/rpm/kdeconnect-sfos.changes.run.in create mode 100644 sfos/rpm/kdeconnect-sfos.spec create mode 100644 sfos/sailfishdaemon.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 51662bac1..0d86fe828 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,13 +3,14 @@ cmake_minimum_required(VERSION 3.0) project(kdeconnect) if (SAILFISHOS) - set(KF5_MIN_VERSION "5.36.0") + set(KF5_MIN_VERSION "5.31.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) @@ -31,16 +32,15 @@ ecm_setup_version(1.4.0 ) if (SAILFISHOS) - set(KF5_REQUIRED_COMPONENTS I18n CoreAddons Config) + find_package(PkgConfig) + set(KF5_REQUIRED_COMPONENTS I18n DBusAddons CoreAddons IconThemes Config) set(KF5_OPTIONAL_COMPONENTS) - - set(Qca_LIBRARY CONAN_PKG::Qca-qt5) - + pkg_search_module(SFOS REQUIRED sailfishapp) + pkg_check_modules(QCA2 qca2-qt5>=${QCA_MIN_VERSION} REQUIRED) 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,6 +54,7 @@ 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 @@ -62,15 +63,13 @@ else() TYPE RUNTIME ) - add_definitions(-DHAVE_KIO) + add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII -DHAVE_KIO) endif() -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(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS 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) @@ -83,15 +82,14 @@ 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) - add_subdirectory(icon) - add_subdirectory(interfaces) - add_subdirectory(data) - add_subdirectory(plugins) - add_subdirectory(cli) - add_subdirectory(declarativeplugin) - +if(NOT SAILFISHOS) add_subdirectory(kcm) add_subdirectory(kcmplugin) add_subdirectory(daemon) @@ -101,19 +99,21 @@ 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(BUILD_TESTING) - add_subdirectory(tests) + if(KF5DocTools_FOUND) + add_subdirectory(doc) + endif() +else() + add_subdirectory(sfos) endif() feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 40fc61c56..b5e08601b 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -43,13 +43,13 @@ set(kdeconnectcore_SRCS add_library(kdeconnectcore ${kdeconnectcore_SRCS}) -target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}) +target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) target_link_libraries(kdeconnectcore PUBLIC Qt5::Network KF5::CoreAddons - ${Qca_LIBRARY} + qca-qt5 PRIVATE Qt5::DBus KF5::I18n diff --git a/core/backends/lan/compositeuploadjob.cpp b/core/backends/lan/compositeuploadjob.cpp index a854673a0..fc93812ea 100644 --- a/core/backends/lan/compositeuploadjob.cpp +++ b/core/backends/lan/compositeuploadjob.cpp @@ -25,7 +25,6 @@ #include "lanlinkprovider.h" #include #include "plugins/share/shareplugin.h" -#include "qtcompat_p.h" #ifdef HAVE_KIO #include @@ -108,21 +107,13 @@ void CompositeUploadJob::startNextSubJob() m_currentJobSendPayloadSize = 0; emitDescription(m_currentJob->getNetworkPacket().get(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::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(QStringLiteral("numberOfFiles"), m_totalJobs); np.set(QStringLiteral("totalPayloadSize"), m_totalPayloadSize); diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp index 0c200a4f2..6cdb33d7e 100644 --- a/core/backends/lan/lanlinkprovider.cpp +++ b/core/backends/lan/lanlinkprovider.cpp @@ -42,7 +42,6 @@ #include "landevicelink.h" #include "lanpairinghandler.h" #include "kdeconnectconfig.h" -#include "qtcompat_p.h" #define MIN_VERSION_WITH_SSL_SUPPORT 6 @@ -371,12 +370,7 @@ void LanLinkProvider::newConnection() void LanLinkProvider::dataReceived() { QSslSocket* socket = qobject_cast(sender()); -#if QT_VERSION < QT_VERSION_CHECK(5,7,0) - if (!socket->canReadLine()) - return; -#else socket->startTransaction(); -#endif const QByteArray data = socket->readLine(); @@ -385,19 +379,12 @@ 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(); diff --git a/core/compositefiletransferjob.cpp b/core/compositefiletransferjob.cpp index 1be143218..6ed9dac8e 100644 --- a/core/compositefiletransferjob.cpp +++ b/core/compositefiletransferjob.cpp @@ -57,11 +57,7 @@ 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::of(&FileTransferJob::processedAmount), this, &CompositeFileTransferJob::slotProcessedAmount); -#endif } bool CompositeFileTransferJob::addSubjob(KJob* job) diff --git a/core/qtcompat_p.h b/core/qtcompat_p.h index 306de5e0f..c71bbcefd 100644 --- a/core/qtcompat_p.h +++ b/core/qtcompat_p.h @@ -40,42 +40,6 @@ template void qAsConst(const T &&) Q_DECL_EQ_DELETE; #endif - -#if QT_VERSION < QT_VERSION_CHECK(5,7,0) -template -struct QNonConstOverload -{ - template - static constexpr auto of(R (T::*func)(Args...)) noexcept -> decltype(func) - { - return func; - } -}; - -template -struct QConstOverload -{ - template - static constexpr auto of(R (T::*func)(Args...) const) noexcept -> decltype(func) - { - return func; - } -}; - -template -struct QOverload : QConstOverload, QNonConstOverload -{ - using QConstOverload::of; - using QNonConstOverload::of; - - template - 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) diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp index dd67a7669..d42b563d4 100644 --- a/plugins/share/shareplugin.cpp +++ b/plugins/share/shareplugin.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include diff --git a/plugins/share/shareplugin.h b/plugins/share/shareplugin.h index edb5af73a..e542a992d 100644 --- a/plugins/share/shareplugin.h +++ b/plugins/share/shareplugin.h @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/sfos/CMakeLists.txt b/sfos/CMakeLists.txt new file mode 100644 index 000000000..242ea43f5 --- /dev/null +++ b/sfos/CMakeLists.txt @@ -0,0 +1,29 @@ +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}) diff --git a/sfos/kdeconnect-sfos.cpp b/sfos/kdeconnect-sfos.cpp new file mode 100644 index 000000000..5e4e9de0b --- /dev/null +++ b/sfos/kdeconnect-sfos.cpp @@ -0,0 +1,60 @@ +/* + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl + 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 +#endif + +#include +#include +#include + +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 view(SailfishApp::createView()); + + view->setSource(SailfishApp::pathTo("qml/kdeconnect-sfos.qml")); + view->showFullScreen(); + + return app->exec(); +} + diff --git a/sfos/kdeconnect-sfos.desktop b/sfos/kdeconnect-sfos.desktop new file mode 100644 index 000000000..9a451b83c --- /dev/null +++ b/sfos/kdeconnect-sfos.desktop @@ -0,0 +1,53 @@ +[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 diff --git a/sfos/kdeconnectd.desktop.cmake b/sfos/kdeconnectd.desktop.cmake new file mode 100644 index 000000000..056f5f091 --- /dev/null +++ b/sfos/kdeconnectd.desktop.cmake @@ -0,0 +1,49 @@ +[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 連線守護程式 diff --git a/sfos/org.kde.kdeconnect.service.in b/sfos/org.kde.kdeconnect.service.in new file mode 100644 index 000000000..4f747186d --- /dev/null +++ b/sfos/org.kde.kdeconnect.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.kde.kdeconnect +Exec=@KDE_INSTALL_FULL_LIBEXECDIR@/kdeconnectd diff --git a/sfos/qml/cover/CoverPage.qml b/sfos/qml/cover/CoverPage.qml new file mode 100644 index 000000000..a252225fa --- /dev/null +++ b/sfos/qml/cover/CoverPage.qml @@ -0,0 +1,74 @@ +/* + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl + 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 + } + +} + diff --git a/sfos/qml/kdeconnect-sfos.qml b/sfos/qml/kdeconnect-sfos.qml new file mode 100644 index 000000000..b8a1cf7c9 --- /dev/null +++ b/sfos/qml/kdeconnect-sfos.qml @@ -0,0 +1,48 @@ +/* + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl + 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(); + } + } +} + diff --git a/sfos/qml/pages/DevicePage.qml b/sfos/qml/pages/DevicePage.qml new file mode 100644 index 000000000..4e5d4c984 --- /dev/null +++ b/sfos/qml/pages/DevicePage.qml @@ -0,0 +1,105 @@ +/* + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl + 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; + } + } + } +} + + diff --git a/sfos/qml/pages/FindDevices.qml b/sfos/qml/pages/FindDevices.qml new file mode 100644 index 000000000..eeddb7790 --- /dev/null +++ b/sfos/qml/pages/FindDevices.qml @@ -0,0 +1,86 @@ +/* + Copyright (C) 2013 Jolla Ltd. + Contact: Thomas Perl + 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: page + + // The effective value will be restricted by ApplicationWindow.allowedOrientations + allowedOrientations: Orientation.Portrait + + // To enable PullDownMenu, place our content in a SilicaFlickable + SilicaListView { + anchors.fill: parent + + header: PageHeader { + title: qsTr("Devices") + } + + PullDownMenu { + MenuItem { + text: qsTr("Refresh") + onClicked: { + DaemonDbusInterface.forceOnNetworkChange(); + } + } + } + + // Place our content in a Column. The PageHeader is always placed at the top + // of the page, followed by our content. + + id: devices + model: DevicesModel { + id: devicesModel + } + + width: page.width + spacing: Theme.paddingLarge + + + delegate: ListItem { + width: ListView.view.width + height: Theme.itemSizeMedium + + Label { text: display + "\n" + toolTip } + + onClicked: { + var devicePage = pageStack.push(Qt.resolvedUrl("DevicePage.qml"), + {currentDevice: device} + ); + } + + + } + } +} + diff --git a/sfos/qml/pages/FirstPage.qml b/sfos/qml/pages/FirstPage.qml new file mode 100644 index 000000000..fb0624e09 --- /dev/null +++ b/sfos/qml/pages/FirstPage.qml @@ -0,0 +1,61 @@ +/* +Copyright (C) 2013 Jolla Ltd. +Contact: Thomas Perl +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 +import Nemo.Notifications 1.0 + +Page { + allowedOrientations: Orientation.Portrait + + SilicaFlickable { + anchors.fill: parent + contentHeight: column.height + + // PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView + PullDownMenu { + MenuItem { + text: qsTr("Find Devices") + onClicked: pageStack.push(Qt.resolvedUrl("FindDevices.qml")) + } + } + + Column { + id: column + width: parent.width + spacing: 20 + + PageHeader { title: "KDE Connect" } + + } + } +} + diff --git a/sfos/qml/pages/PluginItem.qml b/sfos/qml/pages/PluginItem.qml new file mode 100644 index 000000000..ee27b1706 --- /dev/null +++ b/sfos/qml/pages/PluginItem.qml @@ -0,0 +1,47 @@ +/* + * Copyright 2015 Aleix Pol Gonzalez + * + * 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 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * 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 . + */ + +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import org.kde.kdeconnect 1.0 + +Button +{ + property alias pluginName: checker.pluginName + property var interfaceFactory + property string component + + readonly property var checker: PluginChecker { + id: checker + device: deviceView.currentDevice + } + visible: checker.available + onClicked: { + if (component === "") + return; + + var obj = interfaceFactory.create(deviceView.currentDevice.id()); + var page = pageStack.push( + component, + { pluginInterface: obj } + ); + obj.parent = page + } +} diff --git a/sfos/qml/pages/mousepad.qml b/sfos/qml/pages/mousepad.qml new file mode 100644 index 000000000..c072f4447 --- /dev/null +++ b/sfos/qml/pages/mousepad.qml @@ -0,0 +1,104 @@ +/* + * Copyright 2015 Aleix Pol Gonzalez + * + * 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 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * 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 . + */ + +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import org.kde.kdeconnect 1.0 + +Page +{ + id: mousepad + property QtObject pluginInterface + backNavigation: false + + Column + { + anchors.fill: parent + PageHeader { + id: header + title: "Remote Control" + } + MouseArea { + id: area + width: parent.width + height: parent.height - buttons.height - header.height - 20 + property var lastPos: Qt.point(-1, -1) + + //onClicked: mousepad.pluginInterface.sendCommand("singleclick", true); + + onPositionChanged: { + if (lastPos.x > -1) { + //console.log("move", mouse.x, mouse.y, lastPos) + var delta = Qt.point(mouse.x-lastPos.x, mouse.y-lastPos.y); + + pluginInterface.moveCursor(delta); + } + lastPos = Qt.point(mouse.x, mouse.y); + } + onReleased: { + lastPos = Qt.point(-1, -1) + } + } + Row { + id: buttons + height: childrenRect.height + width: parent.width + + Button { + width: parent.width / 3 + text: "Single" + onClicked: mousepad.pluginInterface.sendCommand("singleclick", true); + } + Button { + width: parent.width / 3 + text: "Middle" + onClicked: mousepad.pluginInterface.sendCommand("middleclick", true); + } + Button { + width: parent.width / 3 + text: "Right" + onClicked: mousepad.pluginInterface.sendCommand("rightclick", true); + } + } + } + + function myPop() { + pageStack._pageStackIndicator._backPageIndicator().data[0].clicked.disconnect(myPop) + pageStack.pop() + } + + onStatusChanged: { + if (status == PageStatus.Active) { + pageStack._createPageIndicator() + pageStack._pageStackIndicator.clickablePageIndicators = true + pageStack._pageStackIndicator._backPageIndicator().backNavigation = true + pageStack._pageStackIndicator._backPageIndicator().data[0].clicked.connect(myPop) + } else if (status == PageStatus.Deactivating) { + pageStack._pageStackIndicator.clickablePageIndicators = Qt.binding(function() { + return pageStack.currentPage ? pageStack.currentPage._clickablePageIndicators : true + }) + pageStack._pageStackIndicator._backPageIndicator().backNavigation = Qt.binding(function() { + return pageStack._currentContainer && pageStack._currentContainer.page + && pageStack._currentContainer.page.backNavigation && pageStack._currentContainer.pageStackIndex !== 0 + }) + } +} + +} diff --git a/sfos/qml/pages/mpris.qml b/sfos/qml/pages/mpris.qml new file mode 100644 index 000000000..edfabd3bc --- /dev/null +++ b/sfos/qml/pages/mpris.qml @@ -0,0 +1,138 @@ +/* + * Copyright 2015 Aleix Pol Gonzalez + * + * 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 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * 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 . + */ + +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import QtQuick.Layouts 1.0 +import org.kde.kdeconnect 1.0 + +Page +{ + id: root + property QtObject pluginInterface + + Label { + id: noPlayersText + text: "No players available" + anchors.centerIn: parent + visible: pluginInterface.playerList.length == 0 + } + ColumnLayout + { + anchors.fill: parent + anchors.margins: Theme.paddingMedium + PageHeader { title: "Multimedia Controls" } + visible: !noPlayersText.visible + + ComboBox { + label: "Player" + Layout.fillWidth: true + onCurrentIndexChanged: root.pluginInterface.player = value + + menu: ContextMenu { + Repeater { + model: root.pluginInterface.playerList + MenuItem { text: modelData } + } + } + } + + Label { + id: nowPlaying + Layout.fillWidth: true + text: root.pluginInterface.nowPlaying + visible: root.pluginInterface.title.length == 0 + wrapMode: Text.Wrap + } + Label { + Layout.fillWidth: true + text: root.pluginInterface.title + visible: !nowPlaying.visible + wrapMode: Text.Wrap + } + Label { + Layout.fillWidth: true + text: root.pluginInterface.artist + visible: !nowPlaying.visible && !artistAlbum.visible && root.pluginInterface.artist.length > 0 + wrapMode: Text.Wrap + } + Label { + Layout.fillWidth: true + text: root.pluginInterface.album + visible: !nowPlaying.visible && !artistAlbum.visible && root.pluginInterface.album.length > 0 + wrapMode: Text.Wrap + } + Label { + id: artistAlbum + Layout.fillWidth: true + text: "%1 - %2", root.pluginInterface.artist, root.pluginInterface.album + visible: !nowPlaying.visible && root.pluginInterface.album.length > 0 && root.pluginInterface.artist.length > 0 + wrapMode: Text.Wrap + } + + RowLayout { + Layout.fillWidth: true + height: childrenRect.height + IconButton { + id: btnPrev + Layout.fillWidth: true + icon.source: "image://theme/icon-m-previous" + onClicked: root.pluginInterface.sendAction("Previous") + } + IconButton { + id: btnPlay + Layout.fillWidth: true + icon.source: root.pluginInterface.isPlaying ? "image://theme/icon-m-pause" : "image://theme/icon-m-play" + onClicked: root.pluginInterface.sendAction("PlayPause"); + } + IconButton { + id: btnNext + Layout.fillWidth: true + icon.source: "image://theme/icon-m-next" + onClicked: root.pluginInterface.sendAction("Next") + } + } + + Slider { + id: sldVolume + label: "Volume" + maximumValue: 100 + Layout.fillWidth: true + //value: root.pluginInterface.volume + onValueChanged: { + root.pluginInterface.volume = value; + } + } + + Item { height: parent.height } + } + + + Connections { + target: root.pluginInterface + onPropertiesChanged: { + sldVolume.value = root.pluginInterface.volume; + } + } + + Component.onCompleted: { + pluginInterface.requestPlayerList(); + } +} diff --git a/sfos/rpm/kdeconnect-sfos.changes.in b/sfos/rpm/kdeconnect-sfos.changes.in new file mode 100644 index 000000000..60e402b1f --- /dev/null +++ b/sfos/rpm/kdeconnect-sfos.changes.in @@ -0,0 +1,18 @@ +# Rename this file as kdeconnect-sfos.changes to include changelog +# entries in your RPM file. +# +# Add new changelog entries following the format below. +# Add newest entries to the top of the list. +# Separate entries from eachother with a blank line. +# +# Alternatively, if your changelog is automatically generated (e.g. with +# the git-change-log command provided with Sailfish OS SDK), create a +# kdeconnect-sfos.changes.run script to let mb2 run the required commands for you. + +# * date Author's Name version-release +# - Summary of changes + +* Sun Apr 13 2014 Jack Tar 0.0.1-1 +- Scrubbed the deck +- Hoisted the sails + diff --git a/sfos/rpm/kdeconnect-sfos.changes.run.in b/sfos/rpm/kdeconnect-sfos.changes.run.in new file mode 100644 index 000000000..90c6facdb --- /dev/null +++ b/sfos/rpm/kdeconnect-sfos.changes.run.in @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Rename this file as kdeconnect-sfos.changes.run to let mb2 automatically +# generate changelog from well formatted Git commit messages and tag +# annotations. + +git-change-log + +# Here are some basic examples how to change from the default behavior. Run +# git-change-log --help inside the Sailfish OS SDK chroot or build engine to +# learn all the options git-change-log accepts. + +# Use a subset of tags +#git-change-log --tags refs/tags/my-prefix/* + +# Group entries by minor revision, suppress headlines for patch-level revisions +#git-change-log --dense '/[0-9]\+\.[0-9\+$' + +# Trim very old changes +#git-change-log --since 2014-04-01 +#echo '[ Some changelog entries trimmed for brevity ]' + +# Use the subjects (first lines) of tag annotations when no entry would be +# included for a revision otherwise +#git-change-log --auto-add-annotations diff --git a/sfos/rpm/kdeconnect-sfos.spec b/sfos/rpm/kdeconnect-sfos.spec new file mode 100644 index 000000000..c8d7f902b --- /dev/null +++ b/sfos/rpm/kdeconnect-sfos.spec @@ -0,0 +1,86 @@ +# +# Do NOT Edit the Auto-generated Part! +# Generated by: spectacle version 0.27 +# + +Name: kdeconnect-sfos + +# >> macros +# << macros + +Summary: KDEConnect client for Sailfish +Version: 1.3.1 +Release: 1 +Group: Qt/Qt +License: LICENSE +URL: https://community.kde.org/KDEConnect +Source0: %{name}-%{version}.tar.bz2 +Requires: sailfishsilica-qt5 >= 0.10.9 +Requires: qt5-qtquickcontrols-layouts +BuildRequires: pkgconfig(sailfishapp) >= 1.0.2 +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5Qml) +BuildRequires: pkgconfig(Qt5Quick) +BuildRequires: pkgconfig(nemonotifications-qt5) +BuildRequires: pkgconfig(qca2-qt5) >= 2.0.0 +BuildRequires: desktop-file-utils +BuildRequires: cmake >= 3.0 +BuildRequires: extra-cmake-modules >= 5.31.0 +BuildRequires: kcoreaddons-devel >= 5.31.0 +BuildRequires: kdbusaddons-devel >= 5.31.0 +BuildRequires: ki18n-devel >= 5.31.0 +BuildRequires: kconfig-devel >= 5.31.0 +BuildRequires: kiconthemes-devel >= 5.31.0 +BuildRequires: pkgconfig(keepalive) + +%description +KDE Connect provides several features to integrate your phone and your computer + + +%prep +%setup -q + +# >> setup +# << setup + +%build +# >> build pre +# << build pre +mkdir -p build +cd build +%cmake .. -DSAILFISHOS=YES +make %{?jobs:-j%jobs} + +# >> build post +# << build post + +%install +rm -rf %{buildroot} +# >> install pre +# << install pre +pushd build +%make_install +popd + + +# >> install post +# << install post + +desktop-file-install --delete-original \ + --dir %{buildroot}%{_datadir}/applications \ + %{buildroot}%{_datadir}/applications/*.desktop + +%files +%defattr(-,root,root,-) +%{_bindir} +%{_libdir} +%{_datadir}/%{name} +%{_datadir}/applications/%{name}.desktop +/etc/xdg/autostart/kdeconnectd.desktop +/usr/share/dbus-1/services/org.kde.kdeconnect.service +/usr/share/knotifications5/kdeconnect.notifyrc +/usr/share/kservicetypes5/kdeconnect_plugin.desktop +#%{_datadir}/icons/hicolor/*/apps/%{name}.png +/usr/share/icons/ +# >> files +# << files diff --git a/sfos/sailfishdaemon.cpp b/sfos/sailfishdaemon.cpp new file mode 100644 index 000000000..1541fdd73 --- /dev/null +++ b/sfos/sailfishdaemon.cpp @@ -0,0 +1,161 @@ +/** + * Copyright 2018 Adam Pigg + * + * 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 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * 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 . + */ + +#include +#include + +#include +#include + +#include "core/daemon.h" +#include "core/device.h" +#include "core/backends/pairinghandler.h" +#include "kdeconnect-version.h" + +#include +#include +#include +#include + +class SailfishDaemon : public Daemon +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.daemon") +public: + SailfishDaemon(QObject* parent = nullptr) + : Daemon(parent) + , m_background(new BackgroundActivity()) + { + connect(m_background, &BackgroundActivity::running, + [=]( ) { qDebug() << "Received wakeup"; + m_background->wait(BackgroundActivity::ThirtySeconds); + } ); + m_background->wait(BackgroundActivity::ThirtySeconds); + } + + void askPairingConfirmation(Device* device) override + { + qDebug() << "Pairing request from " << device->name().toHtmlEscaped(); + + Notification *notification = new Notification(this); + + notification->setAppName(QCoreApplication::applicationName()); + notification->setPreviewSummary(i18n("Pairing request from %1", device->name().toHtmlEscaped())); + notification->setPreviewBody(i18n("Click here to pair")); + notification->setIcon("icon-s-sync"); + notification->setExpireTimeout(10000); + + connect(notification, &Notification::closed, + [=]( uint reason ) { + qDebug() << "Notification closed" << reason; + if (reason == 2) { //clicked + device->acceptPairing(); + } else { + device->rejectPairing(); + } + }); + + notification->publish(); + } + + void reportError(const QString & title, const QString & description) override + { + qDebug() << "Error: " << title << ":" << description; + } + + QNetworkAccessManager* networkAccessManager() override + { + if (!m_nam) { + m_nam = new QNetworkAccessManager(this); + } + return m_nam; + } + + void sendSimpleNotification(const QString &eventId, const QString &title, const QString &text, const QString &iconName) override + { + Q_UNUSED(eventId); + Notification *notification = new Notification(this); + + notification->setAppName(QCoreApplication::applicationName()); + notification->setPreviewSummary(title); + notification->setPreviewBody(text); + notification->setIcon(iconName); + notification->publish(); + } + + +private: + QNetworkAccessManager* m_nam = nullptr; + BackgroundActivity *m_background = nullptr; + +}; + + +void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) +{ + QByteArray localMsg = msg.toLocal8Bit(); + + QString txt; + QString typ; + + switch (type) { + case QtDebugMsg: + typ = "Debug"; + break; + case QtInfoMsg: + typ = "Info"; + break; + case QtWarningMsg: + typ = "Warning"; + break; + case QtCriticalMsg: + typ = "Critical"; + break; + case QtFatalMsg: + break; + } + + txt = QString("%1 %2: %3 (%4:%5, %6)").arg(QDateTime::currentDateTime().toString("yyyyMMdd:HHmmss")).arg(typ).arg(localMsg.constData()).arg(context.file).arg(context.line).arg(context.function); + + QFile outFile("/home/nemo/kdeconnectd.log"); + outFile.open(QIODevice::WriteOnly | QIODevice::Append); + QTextStream ts(&outFile); + ts << txt << endl; +} + +int main(int argc, char* argv[]) +{ + qInstallMessageHandler(myMessageOutput); // Install the handler + QCoreApplication app(argc, argv); + + app.setApplicationName(QStringLiteral("kdeconnectd")); + app.setApplicationVersion(QStringLiteral(KDECONNECT_VERSION_STRING)); + app.setOrganizationDomain(QStringLiteral("kde.org")); + + KDBusService dbusService(KDBusService::Unique); + + Daemon* daemon = new SailfishDaemon; + + QObject::connect(daemon, SIGNAL(destroyed(QObject*)), &app, SLOT(quit())); + + return app.exec(); +} + +#include "sailfishdaemon.moc" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6bfce2a2f..a879f6182 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,9 +3,9 @@ find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Test) include_directories( ${KDEConnectCore_BINARY_DIR} ${CMAKE_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/.. - ${CMAKE_CURRENT_BINARY_DIR}/../plugins/sendnotifications/ - ${CMAKE_CURRENT_BINARY_DIR}/../smsapp/ + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/plugins/sendnotifications/ + ${CMAKE_BINARY_DIR}/smsapp/ ) set(kdeconnect_libraries @@ -14,7 +14,7 @@ set(kdeconnect_libraries Qt5::DBus Qt5::Network Qt5::Test - ${Qca_LIBRARY} + qca-qt5 ) if(${KF5KIO_FOUND}) @@ -34,17 +34,14 @@ ecm_add_test(testsslsocketlinereader.cpp TEST_NAME testsslsocketlinereader LINK_ ecm_add_test(kdeconnectconfigtest.cpp TEST_NAME kdeconnectconfigtest LINK_LIBRARIES ${kdeconnect_libraries}) ecm_add_test(lanlinkprovidertest.cpp TEST_NAME lanlinkprovidertest LINK_LIBRARIES ${kdeconnect_libraries}) ecm_add_test(devicetest.cpp TEST_NAME devicetest LINK_LIBRARIES ${kdeconnect_libraries}) - -if (NOT SAILFISHOS) - ecm_add_test(testnotificationlistener.cpp - testdevice.cpp - ../plugins/sendnotifications/sendnotificationsplugin.cpp - ../plugins/sendnotifications/notificationslistener.cpp - ../plugins/sendnotifications/notifyingapplication.cpp - TEST_NAME testnotificationlistener - LINK_LIBRARIES ${kdeconnect_libraries} Qt5::DBus KF5::Notifications KF5::IconThemes) - ecm_add_test(testsmshelper.cpp LINK_LIBRARIES ${kdeconnect_sms_libraries}) -endif() +ecm_add_test(testnotificationlistener.cpp + testdevice.cpp + ../plugins/sendnotifications/sendnotificationsplugin.cpp + ../plugins/sendnotifications/notificationslistener.cpp + ../plugins/sendnotifications/notifyingapplication.cpp + TEST_NAME testnotificationlistener + LINK_LIBRARIES ${kdeconnect_libraries} Qt5::DBus KF5::Notifications KF5::IconThemes) +ecm_add_test(testsmshelper.cpp LINK_LIBRARIES ${kdeconnect_sms_libraries}) if(PRIVATE_DBUS_ENABLED) ecm_add_test(testprivatedbus.cpp LINK_LIBRARIES ${kdeconnect_libraries}) endif() diff --git a/tests/pluginloadtest.cpp b/tests/pluginloadtest.cpp index 7a56369ca..864d6abd4 100644 --- a/tests/pluginloadtest.cpp +++ b/tests/pluginloadtest.cpp @@ -19,13 +19,15 @@ */ #include -#include +#include #include #include #include #include #include +#include + #include "core/daemon.h" #include "core/device.h" #include "core/kdeconnectplugin.h" diff --git a/tests/sendfiletest.cpp b/tests/sendfiletest.cpp index d7668255c..f16c143d0 100644 --- a/tests/sendfiletest.cpp +++ b/tests/sendfiletest.cpp @@ -22,13 +22,15 @@ #include #include #include -#include +#include #include #include #include #include #include +#include + #include "core/daemon.h" #include "core/device.h" #include "core/kdeconnectplugin.h" diff --git a/tests/testsocketlinereader.cpp b/tests/testsocketlinereader.cpp index 755845569..09ae12d7b 100644 --- a/tests/testsocketlinereader.cpp +++ b/tests/testsocketlinereader.cpp @@ -18,7 +18,6 @@ #include "../core/backends/lan/socketlinereader.h" #include "../core/backends/lan/server.h" -#include "../core/qtcompat_p.h" #include #include diff --git a/tests/testsslsocketlinereader.cpp b/tests/testsslsocketlinereader.cpp index a9d4e9a5d..8ae8ac6d4 100644 --- a/tests/testsslsocketlinereader.cpp +++ b/tests/testsslsocketlinereader.cpp @@ -20,7 +20,6 @@ #include "../core/backends/lan/server.h" #include "../core/backends/lan/socketlinereader.h" -#include "../core/qtcompat_p.h" #include #include