Commit a1c2c5a6 authored by Weixuan Xiao's avatar Weixuan Xiao

Merge branch 'master' into macos-splash-screen

parents bcb4134a 58dca312
Pipeline #8469 passed with stage
in 7 minutes and 58 seconds
Please report any issues to [bugs.kde.org](https://bugs.kde.org/enter_bug.cgi?product=kdeconnect)
\ No newline at end of file
......@@ -119,7 +119,7 @@ Comment[uk]=Поєднайте усі ваші пристрої
Comment[x-test]=xxMake all your devices onexx
Comment[zh_CN]=连接您所有设备
Comment[zh_TW]=讓您的裝置內容全面同步
Exec=kdeconnect
Exec=kdeconnect-app
Icon=kdeconnect
Type=Application
Terminal=false
......
......@@ -73,7 +73,7 @@ int main(int argc, char** argv)
parser.addOption(QCommandLineOption(QStringLiteral("execute-command"), i18n("Executes a remote command by id"), QStringLiteral("id")));
parser.addOption(QCommandLineOption(QStringList{QStringLiteral("k"), QStringLiteral("send-keys")}, i18n("Sends keys to a said device"), QStringLiteral("key")));
parser.addOption(QCommandLineOption(QStringLiteral("my-id"), i18n("Display this device's id and exit")));
parser.addOption(QCommandLineOption(QStringLiteral("photo"), i18n("Open the connected device's camera and transfer the photo")));
parser.addOption(QCommandLineOption(QStringLiteral("photo"), i18n("Open the connected device's camera and transfer the photo"), QStringLiteral("path")));
//Hidden because it's an implementation detail
QCommandLineOption deviceAutocomplete(QStringLiteral("shell-device-autocompletion"));
......@@ -165,6 +165,9 @@ int main(int argc, char** argv)
//Output id and description
QTextStream(stdout) << id << '[' << description << ']' << endl;
}
//Exit with 1 if we didn't find a device
return int(!devices.isEmpty());
} else if(parser.isSet(QStringLiteral("refresh"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect"), QStringLiteral("org.kde.kdeconnect.daemon"), QStringLiteral("forceOnNetworkChange"));
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
......@@ -270,13 +273,13 @@ int main(int argc, char** argv)
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/findmyphone"), QStringLiteral("org.kde.kdeconnect.device.findmyphone"), QStringLiteral("ring"));
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else if(parser.isSet(QStringLiteral("photo"))) {
if (parser.positionalArguments().size() == 1) {
const QString fileName = parser.positionalArguments()[0];
const QString fileName = parser.value(QStringLiteral("photo"));
if (!fileName.isEmpty()) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/photo"), QStringLiteral("org.kde.kdeconnect.device.photo"), QStringLiteral("requestPhoto"));
msg.setArguments({fileName});
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else {
QTextStream(stderr) << i18n("Please give exactly 1 file name") << endl;
QTextStream(stderr) << i18n("Please specify a filename for the photo") << endl;
}
} else if(parser.isSet(QStringLiteral("send-keys"))) {
QString seq = parser.value(QStringLiteral("send-keys"));
......
#compdef kdeconnect-cli
_kdeconnect_device-ids() {
_values "KDE Connect device id" "${(f)$(kdeconnect-cli --shell-device-autocompletion=zsh 2>/dev/null)}"
local devices=''
devices="$(kdeconnect-cli --shell-device-autocompletion=zsh 2>/dev/null)"
if [[ $? -eq 0 ]]; then
_values "KDE Connect device id" "${(f)devices}"
else
_message -r "No KDE Connect devices reachable."
fi
}
_arguments \
'(-l --list-devices -a --list-available)'{-l,--list-devices}'[list all devices]' \
'(-l --list-devices -a --list-available)'{-a,--list-available}'[list available (paired and reachable) devices]' \
'--id-only[make --list-devices or --list-available print only the devices id, to ease scripting]' \
'--refresh[search for devices in the network and re-establish connections]' \
'(--pair --unpair)--pair[request pairing with the specified device]' \
'--ring[find the device by ringing it.]' \
'(--pair --unpair)--unpair[stop pairing to the specified device]' \
'(--ping --ping-msg)--ping[send a ping to the device]' \
'(--ping --ping-msg)--ping-msg[send a ping to the device with the specified message]:message' \
'--share[share a file to the device]:file:_files' \
'--list-notifications[display the notifications on the device]' \
'--lock[lock the specified device]' \
'--send-sms[send an SMS. Requires --destination]:message' \
'--destination[specify phone number to send the SMS to]:phone number' \
'(-d --device -n --name)'{-d,--device}'[specify device ID]:id:_kdeconnect_device-ids' \
'(-d --device -n --name)'{-n,--name}'[specify device name]:name' \
'--encryption-info[get encryption info about the device]' \
'--list-commands[list remote commands and their ids]' \
'--execute-command[execute a remote command]:command id' \
'(-k --send-keys)'{-k,--send-keys}'[send keys to the specified device]' \
"--my-id[display this device's id]" \
"--photo[open the connected device's camera and transfer the photo]" \
#See http://zsh.sourceforge.net/Doc/Release/Completion-System.html#index-_005farguments for autocomplete documentation
#
#The --desktopfile option is not included, since it rarely makes sense to use
#The --shell-device-autocompletion option is not included, since it's not even in the help (and only required for scripts like these)
local blockoperations="(operation sms)"
_arguments -s \
'(-)'{-h,--help}'[display usage information]' \
'(-)'{-v,--version}'[display version information]' \
'(-)--author[show author information and exit]' \
'(-)--license[show license information and exit]' \
'--desktopfile[specify base file name of the desktop entry for this application]:file'
+ '(global)' \
$blockoperations{-l,--list-devices}'[list all devices]' \
$blockoperations{-a,--list-available}'[list available (paired and reachable) devices]' \
$blockoperations'--refresh[search for devices in the network and re-establish connections]' \
{-d=,--device=}'[specify device ID]:id:_kdeconnect_device-ids' \
{-n=,--name=}'[specify device name]:name' \
$blockoperations''{-v,--version}'[display version information]' \
$blockoperations'--author[show author information and exit]' \
$blockoperations'--license[show license information and exit]' \
$blockoperations"--my-id[display this device's id]" \
+ '(operation)' \
$blockoperations'--pair[request pairing with the specified device]' \
$blockoperations'--ring[find the device by ringing it.]' \
$blockoperations'--unpair[stop pairing to the specified device]' \
$blockoperations'--ping[send a ping to the device]' \
$blockoperations'--ping-msg=[send a ping to the device with the specified message]:message' \
$blockoperations'--share=[share a file to the device]:file:_files' \
$blockoperations'--list-notifications[display the notifications on the device]' \
$blockoperations'--lock[lock the specified device]' \
$blockoperations'--encryption-info[get encryption info about the device]' \
$blockoperations'--list-commands[list remote commands and their ids]' \
$blockoperations'--execute-command=[execute a remote command]:command id' \
$blockoperations{-k=,--send-keys=}'[send keyboard input to the specified device]:keyboard input' \
$blockoperations"--photo=[open the connected device's camera and transfer the photo]:file:_files" \
+ 'sms' \
'(operation)--send-sms=[send an SMS]:message:' \
'(operation)--destination=[specify phone number to send the SMS to]:phone number:'
......@@ -63,7 +63,7 @@ void filterNonExportableCharacters(QString& s)
QDBusConnection sessionBus()
{
#ifdef USE_PRIVATE_DBUS
return QDBusConnection::connectToBus(KdeConnectConfig::instance()->privateDBusAddress(),
return QDBusConnection::connectToBus(KdeConnectConfig::instance().privateDBusAddress(),
QStringLiteral(KDECONNECT_PRIVATE_DBUS_NAME));
#else
return QDBusConnection::sessionBus();
......@@ -121,13 +121,13 @@ void DBusInstancePrivate::launchDBusDaemon()
QStringLiteral("--address=") + QStringLiteral(KDECONNECT_PRIVATE_DBUS_ADDR)
});
m_dbusProcess->setWorkingDirectory(QCoreApplication::applicationDirPath());
m_dbusProcess->setStandardOutputFile(KdeConnectConfig::instance()->privateDBusAddressPath());
m_dbusProcess->setStandardOutputFile(KdeConnectConfig::instance().privateDBusAddressPath());
m_dbusProcess->setStandardErrorFile(QProcess::nullDevice());
m_dbusProcess->start();
#ifdef Q_OS_MAC
// Set launchctl env
QString privateDBusAddress = KdeConnectConfig::instance()->privateDBusAddress();
QString privateDBusAddress = KdeConnectConfig::instance().privateDBusAddress();
QRegularExpressionMatch path;
if (privateDBusAddress.contains(QRegularExpression(
QStringLiteral("path=(?<path>/tmp/dbus-[A-Za-z0-9]+)")
......@@ -157,7 +157,7 @@ void DBusInstancePrivate::closeDBusDaemon()
delete m_dbusProcess;
m_dbusProcess = nullptr;
QFile privateDBusAddressFile(KdeConnectConfig::instance()->privateDBusAddressPath());
QFile privateDBusAddressFile(KdeConnectConfig::instance().privateDBusAddressPath());
if (privateDBusAddressFile.exists()) privateDBusAddressFile.resize(0);
......
......@@ -62,6 +62,7 @@ public:
KNotification* notification = new KNotification(QStringLiteral("pairingRequest"));
notification->setIconName(QStringLiteral("dialog-information"));
notification->setComponentName(QStringLiteral("kdeconnect"));
notification->setTitle(QStringLiteral("KDE Connect"));
notification->setText(i18n("Pairing request from %1", device->name().toHtmlEscaped()));
notification->setActions(QStringList() << i18n("Accept") << i18n("Reject"));
// notification->setTimeout(PairingHandler::pairingTimeoutMsec());
......
......@@ -29,4 +29,4 @@ Name[sv]=Skicka via KDE-anslut
Name[uk]=Надіслати за допомогою KDE Connect
Name[x-test]=xxSend via KDE Connectxx
Name[zh_CN]=通过 KDE Connect 发送
Name[zh_TW]=使用 KDE Connect 傳送
Name[zh_TW]=使用 KDE 連線傳送
......@@ -35,11 +35,12 @@
<name xml:lang="sr-ijekavian">КДЕ‑конекција</name>
<name xml:lang="sr-ijekavianlatin">KDE‑konekcija</name>
<name xml:lang="sv">KDE-anslut</name>
<name xml:lang="tg">Пайвасти KDE</name>
<name xml:lang="tr">KDE Connect</name>
<name xml:lang="uk">KDE Connect</name>
<name xml:lang="x-test">xxKDE Connectxx</name>
<name xml:lang="zh-CN">KDE Connect</name>
<name xml:lang="zh-TW">KDE Connect</name>
<name xml:lang="zh-TW">KDE 連線</name>
<summary>Seamless connection of your devices</summary>
<summary xml:lang="ar">اتّصال سلس بين أجهزتك</summary>
<summary xml:lang="ca">Connexió transparent amb els vostres dispositius</summary>
......@@ -72,6 +73,7 @@
<summary xml:lang="sr-ijekavian">Једноставно повезивање ваших уређаја</summary>
<summary xml:lang="sr-ijekavianlatin">Jednostavno povezivanje vaših uređaja</summary>
<summary xml:lang="sv">Sömlös anslutning av dina apparater</summary>
<summary xml:lang="tg">Пайвастшавии бесим бо дастгоҳҳои шумо</summary>
<summary xml:lang="tr">Aygıtlarınızı sorunsuz bağlayın</summary>
<summary xml:lang="uk">Безшовне з’єднання для усіх ваших пристроїв</summary>
<summary xml:lang="x-test">xxSeamless connection of your devicesxx</summary>
......
......@@ -21,7 +21,7 @@ GenericName[sv]=Visa på ansluten apparat via KDE-anslut
GenericName[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect
GenericName[x-test]=xxOpen on connected device via KDE Connectxx
GenericName[zh_CN]=通过 KDE Connect 在已连接的设备上打开
GenericName[zh_TW]=使用 KDE Connect 於連線裝置中開啟
GenericName[zh_TW]=使用 KDE 連線於連線裝置中開啟
Name=Open on connected device via KDE Connect
Name[ca]=Obre al dispositiu connectat a través del KDE Connect
Name[cs]=Otevřít na připojeném zařízení přes KDE Connect
......@@ -44,7 +44,7 @@ Name[sv]=Visa på ansluten apparat via KDE-anslut
Name[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect
Name[x-test]=xxOpen on connected device via KDE Connectxx
Name[zh_CN]=通过 KDE Connect 在已连接的设备上打开
Name[zh_TW]=使用 KDE Connect 於連線裝置中開啟
Name[zh_TW]=使用 KDE 連線於連線裝置中開啟
Comment=Open on a connected device using KDE Connect
Comment[ca]=Obre a un dispositiu connectat usant el KDE Connect
Comment[cs]=Otevřít na připojeném zařízení pomocí KDE Connect
......@@ -67,7 +67,7 @@ Comment[sv]=Visa på en ansluten apparat med användning av KDE-anslut
Comment[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect
Comment[x-test]=xxOpen on a connected device using KDE Connectxx
Comment[zh_CN]=通过 KDE Connect 在已连接的设备上打开
Comment[zh_TW]=使用 KDE Connect 於連線裝置中開啟
Comment[zh_TW]=使用 KDE 連線於連線裝置中開啟
MimeType=*/*;
Exec=kdeconnect-handler --open %U
Icon=kdeconnect
......
......@@ -25,7 +25,7 @@ Name[sv]=Skicka fil via KDE:s anslutningstjänst
Name[uk]=Надіслати файл за допомогою служби KDE Connect
Name[x-test]=xxSend file via KDE Connect servicexx
Name[zh_CN]=通过 KDE Connect 服务发送文件
Name[zh_TW]=使用 KDE Connect 服務傳送檔案
Name[zh_TW]=使用 KDE 連線服務傳送檔案
X-KDE-Library=kdeconnectfileitemaction
X-KDE-Submenu=Connect
X-KDE-Submenu[ar]=اتّصل,اتصل
......
......@@ -162,8 +162,12 @@ int main(int argc, char** argv)
QStringLiteral("/MainApplication"),
QStringLiteral("org.qtproject.Qt.QCoreApplication"),
QStringLiteral("quit"));
DBusHelper::sessionBus().call(message);
QCoreApplication::quit(); // Close this application
DBusHelper::sessionBus().call(message, QDBus::NoBlock); // Close our daemon
message = QDBusMessage::createMethodCall(qApp->applicationName(),
QStringLiteral("/MainApplication"),
QStringLiteral("org.qtproject.Qt.QCoreApplication"),
QStringLiteral("quit"));
DBusHelper::sessionBus().call(message, QDBus::NoBlock); // Close our indicator
});
#endif
};
......
......@@ -3,7 +3,7 @@ Name=KDE Connect Indicator
Name[ast]=Indicador de KDE Connnect
Name[ca]=Indicador del KDE Connect
Name[ca@valencia]=Indicador del KDE Connect
Name[cs]=Indikátor KDE Connect
Name[cs]=Ukazatel KDE Connect
Name[da]=KDE Connect-indikator
Name[de]=KDE-Connect-Anzeige
Name[el]=Εφαρμογή ένδειξης KDE Connect
......@@ -23,7 +23,7 @@ Name[pl]=Wskaźnik KDE Connect
Name[pt]=Indicador do KDE Connect
Name[pt_BR]=Indicador do KDE Connect
Name[ru]=Индикатор KDE Connect
Name[sk]=Ukozaovateľ KDE Connect
Name[sk]=Ukazovateľ KDE Connect
Name[sr]=КДЕ‑конекцијин показатељ
Name[sr@ijekavian]=КДЕ‑конекцијин показатељ
Name[sr@ijekavianlatin]=KDE‑konekcijin pokazatelj
......
[Desktop Entry]
Exec=kcmshell5 kcm_kdeconnect
Icon=kdeconnect
Icon=preferences-kde-connect
Type=Service
X-KDE-ServiceTypes=KCModule
......
......@@ -24,16 +24,20 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kdeconnect 1.0 as KdeConnect
import QtQuick.Layouts 1.9
import org.kde.kquickcontrolsaddons 2.0
Item {
id: kdeconnect
property alias devicesModel: devicesView.model
KdeConnect.DevicesModel {
id: allDevicesModel
}
ColumnLayout {
spacing: 5
visible: devicesView.count == 0
width: parent.width
height: parent.height
anchors.fill: parent
PlasmaExtras.Heading {
id: heading
......@@ -49,6 +53,9 @@ Item {
PlasmaComponents.Label {
Layout.fillWidth: true
Layout.bottomMargin: units.largeSpacing
visible: allDevicesModel.count == 0
text: i18n("Install KDE Connect on your Android device to integrate it with Plasma!")
horizontalAlignment: Text.AlignHCenter
......@@ -56,19 +63,37 @@ Item {
}
PlasmaComponents.Button {
Layout.leftMargin: units.largeSpacing
Layout.rightMargin: units.largeSpacing
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
visible: allDevicesModel.count == 0
text: i18n("Install from Google Play")
onClicked: Qt.openUrlExternally("https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp")
}
PlasmaComponents.Button {
Layout.leftMargin: units.largeSpacing
Layout.rightMargin: units.largeSpacing
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
visible: allDevicesModel.count == 0
text: i18n("Install from F-Droid")
onClicked: Qt.openUrlExternally("https://f-droid.org/en/packages/org.kde.kdeconnect_tp/")
}
PlasmaComponents.Button {
Layout.leftMargin: units.largeSpacing
Layout.rightMargin: units.largeSpacing
Layout.topMargin: units.largeSpacing
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
text: i18n("KDE Connect Settings...")
onClicked: KCMShell.open("kcm_kdeconnect")
visible: KCMShell.authorize("kcm_kdeconnect.desktop").length > 0
}
Item {
Layout.fillHeight: true
}
......
......@@ -42,7 +42,7 @@ Item
Binding {
target: plasmoid
property: "status"
value: (connectDeviceModel.count > 0) ? PlasmaCore.Types.ActiveStatus : ((pairedDeviceModel.count > 0) ? PlasmaCore.Types.HiddenStatus : PlasmaCore.Types.PassiveStatus)
value: (connectDeviceModel.count > 0) ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus
}
Plasmoid.fullRepresentation: FullRepresentation {
......
......@@ -63,6 +63,7 @@ Comment[he]=הראה התראות מההתקן שלך באמצעות KDE Connect
Comment[hu]=Az eszközökről származó értesítések megjelenítése a KDE csatlakozás használatával
Comment[id]=Tampilkan notifikasi dari perangkatmu menggunakan KDE Connect
Comment[it]=Mostra le notifiche dei tuoi dispositivi tramite KDE Connect
Comment[ja]=KDE Connect であなたのデバイスの通知を表示
Comment[ko]=KDE Connect로 장치에 표시된 알림 보기
Comment[lt]=Rodyti pranešimus iš jūsų įrenginių naudojant KDE Connect
Comment[nl]=Meldingen van uw apparaten met KDE Connect tonen
......
......@@ -34,7 +34,7 @@ if(NOT SAILFISHOS)
add_subdirectory(pausemusic)
endif()
if(Qt5Multimedia_FOUND AND KF5PulseAudioQt_FOUND)
if(Qt5Multimedia_FOUND AND (KF5PulseAudioQt_FOUND OR WIN32))
add_subdirectory(findthisdevice)
endif()
......
......@@ -88,25 +88,9 @@ void FindThisDeviceConfig::save()
void FindThisDeviceConfig::playSound()
{
const QString soundFilename = m_ui->soundFileRequester->text();
QUrl soundURL;
const auto dataLocations = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
for (const QString &dataLocation : dataLocations) {
soundURL = QUrl::fromUserInput(soundFilename,
dataLocation + QStringLiteral("/sounds"),
QUrl::AssumeLocalFile);
if (soundURL.isLocalFile()) {
if (QFile::exists(soundURL.toLocalFile())) {
break;
}
} else {
if (soundURL.isValid()) {
break;
}
}
soundURL.clear();
}
const QString soundFile = m_ui->soundFileRequester->text();
QUrl soundURL = QUrl(soundFile);
QMediaPlayer* player = new QMediaPlayer;
player->setAudioRole(QAudio::Role(QAudio::NotificationRole));
player->setMedia(soundURL);
......
/**
* Copyright 2018 Friedrich W. H. Kossebau <kossebau@kde.org>
* Copyright 2019 Piyush Aggarwal <piyushaggarwal002@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -27,17 +28,13 @@
#include <PulseAudioQt/Context>
#include <PulseAudioQt/Sink>
#endif
// Qt
#include <QDBusConnection>
#include <QStandardPaths>
#include <QFile>
#include <QUrl>
#include <QMediaPlayer>
K_PLUGIN_CLASS_WITH_JSON(FindThisDevicePlugin, "kdeconnect_findthisdevice.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_FINDTHISDEVICE, "kdeconnect.plugin.findthisdevice")
FindThisDevicePlugin::FindThisDevicePlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
......@@ -45,48 +42,14 @@ FindThisDevicePlugin::FindThisDevicePlugin(QObject* parent, const QVariantList&
FindThisDevicePlugin::~FindThisDevicePlugin() = default;
void FindThisDevicePlugin::connected()
{
}
bool FindThisDevicePlugin::receivePacket(const NetworkPacket& np)
{
Q_UNUSED(np);
const QString soundFilename = config()->get<QString>(QStringLiteral("ringtone"), defaultSound());
QUrl soundURL;
#ifdef Q_OS_WIN
QString winDirPath = qEnvironmentVariable("WINDIR") + QStringLiteral("/media");
if (!winDirPath.isEmpty()) {
soundURL = QUrl::fromUserInput(soundFilename,
winDirPath,
QUrl::AssumeLocalFile);
}
else {
qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Not playing sounds, system doesn't know WINDIR : " << soundFilename;
}
#else
const auto dataLocations = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
for (const QString &dataLocation : dataLocations) {
soundURL = QUrl::fromUserInput(soundFilename,
dataLocation + QStringLiteral("/sounds"),
QUrl::AssumeLocalFile);
if (soundURL.isLocalFile()) {
if (QFile::exists(soundURL.toLocalFile())) {
break;
}
} else {
if (soundURL.isValid()) {
break;
}
}
soundURL.clear();
}
#endif
const QString soundFile = config()->get<QString>(QStringLiteral("ringtone"), defaultSound());
const QUrl soundURL = QUrl(soundFile);
if (soundURL.isEmpty()) {
qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Not playing sounds, could not find ring tone" << soundFilename;
qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Not playing sound, no valid ring tone specified.";
return true;
}
......@@ -94,27 +57,25 @@ bool FindThisDevicePlugin::receivePacket(const NetworkPacket& np)
player->setAudioRole(QAudio::Role(QAudio::NotificationRole));
player->setMedia(soundURL);
player->setVolume(100);
player->play();
#ifndef Q_OS_WIN
const auto sinks = PulseAudioQt::Context::instance()->sinks();
QVector<PulseAudioQt::Sink*> mutedSinks;
for (auto sink : sinks) {
if (sink->isMuted()) {
sink->setMuted(false);
mutedSinks.append(sink);
}
}
connect(player, &QMediaPlayer::stateChanged, this, [player, mutedSinks]{
player->deleteLater();
for (auto sink : qAsConst(mutedSinks)) {
sink->setMuted(true);
}
});
#endif
player->play();
connect(player, &QMediaPlayer::stateChanged, player, &QObject::deleteLater);
// TODO: ensure to use built-in loudspeakers
return true;
......
/**
* Copyright 2018 Friedrich W. H. Kossebau <kossebau@kde.org>
* Copyright 2019 Piyush Aggarwal <piyushaggarwal002@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -22,20 +23,25 @@
#define FINDTHISDEVICEPLUGIN_H
#include <core/kdeconnectplugin.h>
#ifdef Q_OS_WIN
#include <Windows.h>
#define INFO_BUFFER_SIZE 32767
#else
#include <QStandardPaths>
#include <QFile>
#include <QUrl>
#endif
// Qt
#include <QLoggingCategory>
#define PACKET_TYPE_FINDMYPHONE_REQUEST QStringLiteral("kdeconnect.findmyphone.request")
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_FINDTHISDEVICE)
inline QString defaultSound(){
#ifdef Q_OS_WIN
return QStringLiteral("Ring01.wav");
#else
return QStringLiteral("Oxygen-Im-Phone-Ring.ogg");
#endif
}
static const QLoggingCategory &KDECONNECT_PLUGIN_FINDTHISDEVICE()
{
static const QLoggingCategory category("kdeconnect.plugin.findthisdevice");
return category;
}
class FindThisDevicePlugin
: public KdeConnectPlugin
......@@ -47,9 +53,43 @@ public:
explicit FindThisDevicePlugin(QObject* parent, const QVariantList& args);
~FindThisDevicePlugin() override;
void connected() override {};
QString dbusPath() const override;
void connected() override;
bool receivePacket(const NetworkPacket& np) override;
};
inline QString defaultSound()
{
QString dirPath;
QUrl soundURL;
#ifdef Q_OS_WIN
wchar_t infoBuf[INFO_BUFFER_SIZE];
if(!GetWindowsDirectory(infoBuf, INFO_BUFFER_SIZE)) {
qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Error with getting the Windows Directory.";
} else {
dirPath = QString::fromStdWString(infoBuf) + QStringLiteral("/media");
if (!dirPath.isEmpty()) {
soundURL = QUrl::fromUserInput(QStringLiteral("Ring01.wav"),
dirPath,
QUrl::AssumeLocalFile);
}
}
#else
const QStringList dataLocations = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
for (const QString &dataLocation : dataLocations) {
dirPath = dataLocation + QStringLiteral("/sounds");
soundURL = QUrl::fromUserInput(QStringLiteral("Oxygen-Im-Phone-Ring.ogg"),
dirPath,
QUrl::AssumeLocalFile);
if ((soundURL.isLocalFile() && QFile::exists(soundURL.toLocalFile())) || soundURL.isValid()) {
break;
}
}
#endif
if (soundURL.isEmpty()) {
qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Could not find default ring tone.";
}
return soundURL.toString();
}
#endif //FINDTHISDEVICEPLUGIN_H
......@@ -239,7 +239,7 @@ Comment[pt]=Alguém está a ligar-lhe
Comment[pt_BR]=Alguém está chamando você
Comment[ro]=Cineva vă apelează
Comment[ru]=Вам кто-то звонит
Comment[sk]=Niekto vám volá
Comment[sk]=Niekto Vám volá
Comment[sr]=Неко вас зове
Comment[sr@ijekavian]=Неко вас зове
Comment[sr@ijekavianlatin]=Neko vas zove
......@@ -464,6 +464,7 @@ Name[zh_CN]=电池电量低
Name[zh_TW]=電池低電量
Comment=Your battery is in low state
Comment[ar]=بطّاريّتك في الحالة الضعيفة
Comment[ast]=La batería tien poca carga
Comment[bg]=Батерията ви е с нисък заряд
Comment[bs]=Vaša baterija je gotovo prazna
Comment[ca]=La bateria està baixa
......@@ -633,6 +634,7 @@ Name[zh_CN]=一般通知
Name[zh_TW]=通用通知
Comment=Notification received
Comment[ar]=استُلم إخطار
Comment[ast]=Recibióse un avisu
Comment[bg]=Уведомлението е прието
Comment[bs]=Primjeno obavještenje
Comment[ca]=Notificació rebuda
......@@ -677,6 +679,7 @@ Action=Popup
[Event/transferReceived]
Name=File Transfer
Name[ar]=نقل الملفّات
Name[ast]=Tresferencia de ficheros
Name[bg]=Прехвърляне на файл
Name[ca]=Transferència de fitxers
Name[ca@valencia]=Transferència de fitxers
......
......@@ -81,6 +81,7 @@
"Name[pt_BR]": "Foto",
"Name[sk]": "Fotka",
"Name[sv]": "Foto",
"Name[tg]": "Сурат",
"Name[uk]": "Фото",
"Name[x-test]": "xxPhotoxx",
"Name[zh_CN]": "照片",
......
......@@ -118,6 +118,7 @@
"Name[sr@latin]": "Ping",
"Name[sr]": "Пинг",
"Name[sv]": "Pinga",
"Name[tg]": "Садо додан",
"Name[tr]": "Ping",
"Name[uk]": "Луна-імпульс",
"Name[x-test]": "xxPingxx",
......
......@@ -51,6 +51,8 @@
"Description[fr]": "Utilisez votre appareil mobile pour montrer des choses à l'écran",
"Description[gl]": "Use o seu dispositivo móbil para apuntar a cousas na pantalla",
"Description[it]": "Usa il tuo dispositivo mobile per indicare gli oggetti sullo schermo",
"Description[ko]": "모바일 장치로 화면의 항목 가리키기",
"Description[lt]": "Naudoti savo mobilųjį įrenginį, siekiant nurodyti į dalykus ekrane",
"Description[nl]": "Uw mobiele apparaat gebruiken om naar dingen op het scherm te wijzen",
"Description[nn]": "Bruk mobiltelefonen til å peika på ting på skjermen",
"Description[pl]": "Użyj swojego urządzenia przenośnego do wskazywania rzeczy na ekranie",
......
......@@ -159,6 +159,7 @@
"Name[sr@latin]": "Izvrši naredbe",
"Name[sr]": "Изврши наредбе",
"Name[sv]": "Kör kommandon",
"Name[tg]": "Иҷро кардани фармонҳо",
"Name[tr]": "Komut çalıştır",
"Name[uk]": "Виконання команд",
"Name[x-test]": "xxRun commandsxx",
......
......@@ -7,6 +7,7 @@ X-KDE-ParentComponents=kdeconnect_runcommand
Name=Run Command plugin settings
Name[ar]=إعدادات ملحقة تشغيل الأوامر
Name[ast]=Axustes del comandu Execución de comandos
Name[ca]=Ajustaments del connector Executa ordres
Name[ca@valencia]=Ajustaments del connector Executa ordres
Name[cs]=Nastavení modulu Spustit příkaz
......
......@@ -87,6 +87,7 @@
"Name[pt_BR]": "SMS",
"Name[sk]": "SMS",
"Name[sv]": "SMS",
"Name[tg]": "СМС",
"Name[uk]": "SMS",
"Name[x-test]": "xxSMSxx",
"Name[zh_CN]": "短信",
......
......@@ -18,7 +18,7 @@ Name[pl]=Znajdywanie mojego urządzenia
Name[pt]= Procurar o meu dispositivo
Name[pt_BR]= Localizar meu dispositivo
Name[ru]= Найти устройство
Name[sk]=Nájsť moje zariadenie
Name[sk]= Nájsť moje zariadenie
Name[sv]=Hitta min apparat
Name[uk]=Знайти пристрій
Name[x-test]=xx Find my devicexx
......
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