Commit 36b08274 authored by Weixuan Xiao's avatar Weixuan Xiao

Merge branch 'master' into macos-splash-screen

parents a1c2c5a6 3ba783d8
Pipeline #10530 passed with stage
in 20 minutes and 2 seconds
......@@ -41,19 +41,33 @@ if (SAILFISHOS)
include_directories(${QCA2_INCLUDEDIR})
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
else()
set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Kirigami2)
set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Kirigami2 People)
set(KF5_OPTIONAL_COMPONENTS DocTools)
set_package_properties(KF5Kirigami2 PROPERTIES
DESCRIPTION "QtQuick plugins to build user interfaces based on KDE UX guidelines"
PURPOSE "Required for KDE Connect's QML-based GUI applications"
URL "https://www.kde.org/products/kirigami/"
TYPE RUNTIME
)
if(UNIX AND NOT APPLE)
set(KF5_OPTIONAL_COMPONENTS ${KF5_OPTIONAL_COMPONENTS} Runner)
endif()
find_package(Qca-qt5 ${QCA_MIN_VERSION} REQUIRED)
if(NOT WIN32 AND NOT APPLE)
find_package(KF5PulseAudioQt)
endif()
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII)
find_package(Qca-qt5 ${QCA_MIN_VERSION} REQUIRED)
find_package(KF5PeopleVCard)
set_package_properties(KF5PeopleVCard PROPERTIES
PURPOSE "Read vcards from the file system"
URL "https://phabricator.kde.org/source/kpeoplevcard/"
TYPE RUNTIME
)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII -DHAVE_KIO)
endif()
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Quick Network)
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})
......@@ -63,31 +77,12 @@ if (NOT ZSH_AUTOCOMPLETE_DIR)
set(ZSH_AUTOCOMPLETE_DIR "${CMAKE_INSTALL_PREFIX}/share/zsh/site-functions")
endif()
find_package(Qt5Multimedia)
set_package_properties(KF5Kirigami2 PROPERTIES
DESCRIPTION "QtQuick plugins to build user interfaces based on KDE UX guidelines"
PURPOSE "Required for KDE Connect's QML-based GUI applications"
URL "https://www.kde.org/products/kirigami/"
TYPE RUNTIME
)
option(PRIVATE_DBUS_ENABLED "Use private dbus session for kdeconnect" OFF)
if(PRIVATE_DBUS_ENABLED OR APPLE)
add_compile_definitions(USE_PRIVATE_DBUS)
endif()
add_subdirectory(core)
if(NOT SAILFISHOS)
add_subdirectory(kcm)
add_subdirectory(kcmplugin)
add_subdirectory(daemon)
if(NOT WIN32)
add_subdirectory(kio)
add_subdirectory(plasmoid)
endif()
endif()
add_subdirectory(core)
add_subdirectory(icon)
add_subdirectory(interfaces)
add_subdirectory(data)
......@@ -95,37 +90,35 @@ add_subdirectory(plugins)
add_subdirectory(cli)
add_subdirectory(declarativeplugin)
if(KF5Runner_FOUND)
add_subdirectory(runners)
endif()
if (NOT SAILFISHOS)
if(NOT SAILFISHOS)
add_subdirectory(kcm)
add_subdirectory(kcmplugin)
add_subdirectory(daemon)
add_subdirectory(app)
add_subdirectory(indicator)
add_subdirectory(urlhandler)
add_subdirectory(nautilus-extension)
add_subdirectory(fileitemactionplugin)
else()
add_subdirectory(sfos)
endif()
add_subdirectory(smsapp)
find_package(KF5Kirigami2)
find_package(KF5People REQUIRED)
find_package(KF5PeopleVCard)
set_package_properties(KF5PeopleVCard PROPERTIES
PURPOSE "Read vcards from the file system"
URL "https://phabricator.kde.org/source/kpeoplevcard/"
TYPE RUNTIME
)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
add_subdirectory(smsapp)
if(NOT WIN32)
add_subdirectory(kio)
add_subdirectory(plasmoid)
endif()
if(KF5DocTools_FOUND)
add_subdirectory(doc)
endif()
if(KF5Runner_FOUND)
add_subdirectory(runners)
endif()
if(BUILD_TESTING AND NOT SAILFISHOS)
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)
......@@ -82,6 +82,7 @@ Kirigami.Page
delegate: Kirigami.BasicListItem {
label: name
icon: iconName
highlighted: false
iconColor: "transparent"
visible: loaded
onClicked: onClick()
......@@ -173,7 +174,7 @@ Kirigami.Page
Button {
text: i18n("Reject")
icon.name:"dialog-cancel"
icon.name:"dialog-cancel"
onClicked: deviceView.currentDevice.rejectPairing()
}
}
......
......@@ -68,6 +68,7 @@ Kirigami.ScrollablePage
icon: iconName
iconColor: "transparent"
label: display + "\n" + toolTip
highlighted: false
onClicked: {
pageStack.push(
deviceComp,
......
......@@ -31,25 +31,15 @@ Kirigami.ApplicationWindow
width: 900
height: 500
Component {
id: findDevicesComp
FindDevicesPage {}
}
Component {
id: deviceComp
DevicePage {}
}
Kirigami.Action {
id: findDevicesAction
text: i18n ("Find devices...")
text: i18n("Find devices...")
iconName: "list-add"
checked: pageStack.currentItem && pageStack.currentItem.objectName == "FindDevices"
onTriggered: {
root.pageStack.clear()
root.pageStack.push(findDevicesComp);
root.pageStack.push(Qt.resolvedUrl("FindDevicesPage.qml"));
}
}
......@@ -59,45 +49,44 @@ Kirigami.ApplicationWindow
modal: !root.wideScreen
handleVisible: !root.wideScreen
topContent: Kirigami.AbstractApplicationHeader {
RowLayout {
width: parent.width
DBusProperty {
id: announcedNameProperty
object: DaemonDbusInterface
read: "announcedName"
defaultValue: ""
}
topContent: RowLayout {
width: parent.width
DBusProperty {
id: announcedNameProperty
object: DaemonDbusInterface
read: "announcedName"
defaultValue: ""
}
TextField {
id: nameField
visible: false
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.smallSpacing
text: announcedNameProperty.value
onAccepted: {
DaemonDbusInterface.setAnnouncedName(text)
text = Qt.binding(function() {return announcedNameProperty.value})
}
TextField {
id: nameField
visible: false
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.smallSpacing
text: announcedNameProperty.value
onAccepted: {
DaemonDbusInterface.setAnnouncedName(text)
text = Qt.binding(function() {return announcedNameProperty.value})
}
}
Label {
text: announcedNameProperty.value
visible: !nameField.visible
Layout.fillWidth: true
font.pointSize: 18
Layout.leftMargin: Kirigami.Units.smallSpacing
}
Label {
text: announcedNameProperty.value
visible: !nameField.visible
Layout.fillWidth: true
font.pointSize: 18
Layout.leftMargin: Kirigami.Units.smallSpacing
}
Button {
icon.name: nameField.visible ? "dialog-ok-apply" : "entry-edit"
onClicked: {
nameField.visible = !nameField.visible
nameField.accepted()
}
Button {
icon.name: nameField.visible ? "dialog-ok-apply" : "entry-edit"
onClicked: {
nameField.visible = !nameField.visible
nameField.accepted()
}
}
}
property var objects: [findDevicesAction]
Instantiator {
model: DevicesSortProxyModel {
......@@ -112,7 +101,7 @@ Kirigami.ApplicationWindow
onTriggered: {
root.pageStack.clear()
root.pageStack.push(
deviceComp,
Qt.resolvedUrl("DevicePage.qml"),
{currentDevice: device}
);
}
......@@ -137,5 +126,5 @@ Kirigami.ApplicationWindow
id: contextDrawer
}
pageStack.initialPage: findDevicesComp
pageStack.initialPage: Qt.resolvedUrl("FindDevicesPage.qml")
}
......@@ -49,7 +49,6 @@ target_link_libraries(kdeconnectcore
PUBLIC
Qt5::Network
KF5::CoreAddons
KF5::KIOCore
qca-qt5
PRIVATE
Qt5::DBus
......@@ -57,6 +56,10 @@ PRIVATE
KF5::ConfigCore
)
if(${KF5KIO_FOUND})
target_link_libraries(kdeconnectcore PUBLIC KF5::KIOCore)
endif()
if (BLUETOOTH_ENABLED)
target_compile_definitions(kdeconnectcore PRIVATE -DKDECONNECT_BLUETOOTH)
target_link_libraries(kdeconnectcore PRIVATE Qt5::Bluetooth)
......
......@@ -21,13 +21,16 @@
#include "compositeuploadjob.h"
#include <core_debug.h>
#include <KLocalizedString>
#include <kio/global.h>
#include <KJobTrackerInterface>
#include "lanlinkprovider.h"
#include <daemon.h>
#include "plugins/share/shareplugin.h"
CompositeUploadJob::CompositeUploadJob(const QString& deviceId, bool displayNotification)
#ifdef HAVE_KIO
#include <kio/global.h>
#endif
CompositeUploadJob::CompositeUploadJob(const QString& deviceId, bool displayNotification)
: KCompositeJob()
, m_server(new Server(this))
, m_socket(nullptr)
......@@ -44,9 +47,9 @@ CompositeUploadJob::CompositeUploadJob(const QString& deviceId, bool displayNoti
, m_updatePacketPending(false)
{
setCapabilities(Killable);
if (displayNotification) {
KIO::getJobTracker()->registerJob(this);
Daemon::instance()->jobTracker()->registerJob(this);
}
}
......@@ -283,13 +286,13 @@ void CompositeUploadJob::slotResult(KJob *job) {
void CompositeUploadJob::emitDescription(const QString& currentFileName) {
QPair<QString, QString> field2;
if (m_totalJobs > 1) {
field2.first = i18n("Progress");
field2.second = i18n("Sending file %1 of %2", m_currentJobNum, m_totalJobs);
}
Q_EMIT description(this, i18n("Sending to %1", Daemon::instance()->getDevice(this->m_deviceId)->name()),
Q_EMIT description(this, i18n("Sending to %1", Daemon::instance()->getDevice(this->m_deviceId)->name()),
{ i18n("File"), currentFileName }, field2
);
}
......@@ -21,7 +21,6 @@
#include "compositefiletransferjob.h"
#include <core_debug.h>
#include <KLocalizedString>
#include <kio/global.h>
#include <KJobTrackerInterface>
#include <daemon.h>
#include "filetransferjob.h"
......
......@@ -32,6 +32,7 @@ class NetworkPacket;
class DeviceLink;
class Device;
class QNetworkAccessManager;
class KJobTrackerInterface;
class KDECONNECTCORE_EXPORT Daemon
: public QObject
......@@ -53,6 +54,7 @@ public:
virtual void reportError(const QString& title, const QString& description) = 0;
virtual void quit() = 0;
virtual QNetworkAccessManager* networkAccessManager();
virtual KJobTrackerInterface* jobTracker() = 0;
Device* getDevice(const QString& deviceId);
......
......@@ -85,6 +85,11 @@ public:
return m_nam;
}
KJobTrackerInterface* jobTracker() override
{
return KIO::getJobTracker();
}
Q_SCRIPTABLE void sendSimpleNotification(const QString &eventId, const QString &title, const QString &text, const QString &iconName) override
{
KNotification* notification = new KNotification(eventId); //KNotification::Persistent
......
......@@ -138,6 +138,10 @@
<provides>
<binary>kdeconnectd</binary>
<binary>kdeconnect-cli</binary>
<binary>kdeconnect-app</binary>
<binary>kdeconnect-indicator</binary>
<binary>kdeconnect-settings</binary>
<binary>kdeconnect-sms</binary>
</provides>
<categories>
<category>Network</category>
......
......@@ -60,9 +60,9 @@ QHash<int, QByteArray> NotificationsModel::roleNames() const
{
//Role names for QML
QHash<int, QByteArray> names = QAbstractItemModel::roleNames();
names.insert(DbusInterfaceRole, "dbusInterface");
names.insert(AppNameModelRole, "appName");
names.insert(IdModelRole, "notificationId");
names.insert(DbusInterfaceRole, "dbusInterface");
names.insert(AppNameModelRole, "appName");
names.insert(IdModelRole, "notificationId");
names.insert(DismissableModelRole, "dismissable");
names.insert(RepliableModelRole, "repliable");
names.insert(IconPathModelRole, "appIcon");
......
......@@ -72,95 +72,108 @@ PlasmaComponents.ListItem
RowLayout
{
width: parent.width
Battery {
id: battery
device: root.device
}
PlasmaComponents.Label {
id: deviceName
elide: Text.ElideRight
text: (battery.available && battery.charge > -1) ? i18n("%1 (%2)", display, battery.displayString) : display
Layout.fillWidth: true
textFormat: Text.PlainText
}
//Share
PlasmaComponents.Button
{
FileDialog {
id: fileDialog
title: i18n("Please choose a file")
folder: shortcuts.home
selectMultiple: true
}
id: shareFile
iconSource: "document-share"
visible: share.available
tooltip: i18n("Share file")
PlasmaComponents3.ToolButton {
id: overflowMenu
Layout.alignment: Qt.AlignRight
icon.name: "overflow-menu"
Layout.maximumHeight: deviceName.height * 2
onClicked: {
fileDialog.open()
fileDialog.fileUrls.forEach(function (url) {
share.plugin.shareUrl(url)
})
menu.popup(overflowMenu, 0, overflowMenu.height)
}
}
//Find my phone
PlasmaComponents.Button
{
FindMyPhone {
id: findmyphone
device: root.device
}
Menu {
id: menu
//Share
MenuItem
{
FileDialog {
id: fileDialog
title: i18n("Please choose a file")
folder: shortcuts.home
selectMultiple: true
}
id: ring
iconSource: "irc-voice"
visible: findmyphone.available
tooltip: i18n("Ring my phone")
id: shareFile
icon.name: "document-share"
visible: share.available
text: i18n("Share file")
onClicked: {
fileDialog.open()
fileDialog.fileUrls.forEach(function (url) {
share.plugin.shareUrl(url)
})
}
}
onClicked: {
findmyphone.ring()
}
}
//Find my phone
MenuItem
{
FindMyPhone {
id: findmyphone
device: root.device
}
//SFTP
PlasmaComponents.Button
{
Sftp {
id: sftp
device: root.device
}
id: ring
icon.name: "irc-voice"
visible: findmyphone.available
text: i18n("Ring my phone")
id: browse
iconSource: "document-open-folder"
visible: sftp.available
tooltip: i18n("Browse this device")
onClicked: {
findmyphone.ring()
}
}
onClicked: {
sftp.browse()
}
}
//SFTP
MenuItem
{
Sftp {
id: sftp
device: root.device
}
//SMS
PlasmaComponents.Button
{
SMS {
id: sms
device: root.device
}
id: browse
icon.name: "document-open-folder"
visible: sftp.available
text: i18n("Browse this device")
onClicked: {
sftp.browse()
}
}
iconSource: "message-new"
visible: sms.available
tooltip: i18n("SMS Messages")
//SMS
MenuItem
{
SMS {
id: sms
device: root.device
}
onClicked: {
sms.plugin.launchApp()
icon.name: "message-new"
visible: sms.available
text: i18n("SMS Messages")
onClicked: {
sms.plugin.launchApp()
}
}
}
}
height: browse.height
width: parent.width
}
//RemoteKeyboard
......@@ -294,24 +307,5 @@ PlasmaComponents.ListItem
id: share
device: root.device
}
PlasmaComponents.Label {
text: i18n("Share text")
}
PlasmaComponents3.TextArea {
id: shareText
width: parent.width
}
PlasmaComponents.Button
{
id: submitTextButton
anchors.right: shareText.right
iconSource: "document-send"
onClicked: {
share.plugin.shareText(shareText.getText(0, shareText.length))
shareText.clear()
}
}
//NOTE: More information could be displayed here
}
}
......@@ -134,8 +134,8 @@ bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np)
QStringList parts = line.split(QLatin1Char(':'));
QString timestamp = parts[1];
qint32 remoteTimestamp = np.get<qint32>(ID);
qint32 localTimestamp = timestamp.toInt();
qint64 remoteTimestamp = np.get<qint64>(ID);
qint64 localTimestamp = timestamp.toLongLong();
if (!(localTimestamp == remoteTimestamp)) {
uIDsToUpdate.push_back(ID);
......
......@@ -48,7 +48,7 @@ Comment[bg]=Уведомления от устройствата ви
Comment[bs]=Notifikacija sa Vašeg uređaja
Comment[ca]=Notificacions dels vostres dispositius
Comment[ca@valencia]=Notificacions dels vostres dispositius
Comment[cs]=Oznamování z vašich zařízení
Comment[cs]=Upozornění z vašich zařízení
Comment[da]=Bekendtgørelser fra dine enheder
Comment[de]=Benachrichtigungen von Ihren Geräten
Comment[el]=Ειδοποιήσεις από τις συσκευές σας
......@@ -598,7 +598,7 @@ Name[ast]=Avisu xenéricu
Name[bg]=Общо уведомление
Name[ca]=Notificació genèrica
Name[ca@valencia]=Notificació genèrica
Name[cs]=Obecná hláše
Name[cs]=Obecná upozorně
Name[da]=Generisk bekendtgørelse
Name[de]=Allgemeine Benachrichtigung
Name[el]=Γενική ειδοποίηση
......
......@@ -88,7 +88,7 @@
"Name[ast]": "Receición d'avisos",
"Name[ca@valencia]": "Recepció de les notificacions",
"Name[ca]": "Recepció de les notificacions",
"Name[cs]": "Přijímat oznámení",
"Name[cs]": "Přijímat upozornění",
"Name[da]": "Modtag bekendtgørelser",
"Name[de]": "Benachrichtigungen empfangen",
"Name[el]": "Λήψη ειδοποιήσεων",
......
......@@ -62,6 +62,7 @@
"Description[sv]": "Använd mobilen för att peka på saker på skärmen",
"Description[uk]": "Використання мобільного пристрою для керування об'єктами на екрані",
"Description[x-test]": "xxUse your mobile device to point to things on the screenxx",
"Description[zh_CN]": "使用您的移动设备在屏幕上指点",
"EnabledByDefault": true,
"Icon": "view-presentation",
"Id": "kdeconnect_presenter",
......
......@@ -94,7 +94,7 @@ Kirigami.ScrollablePage
actions: [
Kirigami.Action {
iconName: "dialog-cancel"
text: "Cancel"
text: i18n("Cancel")
onTriggered: initialMessage = ""
}
]
......
......@@ -11,13 +11,16 @@ include_directories(
set(kdeconnect_libraries
kdeconnectcore
KF5::I18n
KF5::KIOWidgets
Qt5::DBus
Qt5::Network
Qt5::Test
qca-qt5
)
if(${KF5KIO_FOUND})
list(APPEND kdeconnect_libraries KF5::KIOWidgets)
endif()
set(kdeconnect_sms_libraries
kdeconnectsmshelper
Qt5::Test
......
......@@ -24,12 +24,22 @@
#include <core/daemon.h>
#include <core/backends/pairinghandler.h>
#include <QCoreApplication>
#include <KJobTrackerInterface>
#ifdef HAVE_KIO
#include <KIO/AccessManager>
#else
#include <QNetworkAccessManager>
#endif
class TestDaemon : public Daemon
{
public:
TestDaemon(QObject* parent = nullptr)
: Daemon(parent, true)
, m_nam(nullptr)
, m_jobTrackerInterface(nullptr)
{
// Necessary to force the event loop to run because the test harness seems to behave differently
// and we need the QTimer::SingleShot in Daemon's constructor to fire
......@@ -52,7 +62,11 @@ public:
QNetworkAccessManager* networkAccessManager() override
{
if (!m_nam) {
#ifdef HAVE_KIO
m_nam = new KIO::AccessManager(this);
#else
m_nam = new QNetworkAccessManager(this);
#endif
}
return m_nam;
}
......@@ -66,8 +80,17 @@ public:
qDebug() << "quit was called";
}
KJobTrackerInterface* jobTracker() override
{
if (!m_jobTrackerInterface) {
m_jobTrackerInterface = new KJobTrackerInterface();
}
return m_jobTrackerInterface;
}
private:
QNetworkAccessManager* m_nam;
KJobTrackerInterface* m_jobTrackerInterface;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment