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]=Поєднайте усі ваші пристрої ...@@ -119,7 +119,7 @@ Comment[uk]=Поєднайте усі ваші пристрої
Comment[x-test]=xxMake all your devices onexx Comment[x-test]=xxMake all your devices onexx
Comment[zh_CN]=连接您所有设备 Comment[zh_CN]=连接您所有设备
Comment[zh_TW]=讓您的裝置內容全面同步 Comment[zh_TW]=讓您的裝置內容全面同步
Exec=kdeconnect Exec=kdeconnect-app
Icon=kdeconnect Icon=kdeconnect
Type=Application Type=Application
Terminal=false Terminal=false
......
...@@ -73,7 +73,7 @@ int main(int argc, char** argv) ...@@ -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(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(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("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 //Hidden because it's an implementation detail
QCommandLineOption deviceAutocomplete(QStringLiteral("shell-device-autocompletion")); QCommandLineOption deviceAutocomplete(QStringLiteral("shell-device-autocompletion"));
...@@ -165,6 +165,9 @@ int main(int argc, char** argv) ...@@ -165,6 +165,9 @@ int main(int argc, char** argv)
//Output id and description //Output id and description
QTextStream(stdout) << id << '[' << description << ']' << endl; 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"))) { } else if(parser.isSet(QStringLiteral("refresh"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect"), QStringLiteral("org.kde.kdeconnect.daemon"), QStringLiteral("forceOnNetworkChange")); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect"), QStringLiteral("org.kde.kdeconnect.daemon"), QStringLiteral("forceOnNetworkChange"));
blockOnReply(DBusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
...@@ -270,13 +273,13 @@ int main(int argc, char** argv) ...@@ -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")); 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)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else if(parser.isSet(QStringLiteral("photo"))) { } else if(parser.isSet(QStringLiteral("photo"))) {
if (parser.positionalArguments().size() == 1) { const QString fileName = parser.value(QStringLiteral("photo"));
const QString fileName = parser.positionalArguments()[0]; 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")); 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}); msg.setArguments({fileName});
blockOnReply(DBusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else { } 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"))) { } else if(parser.isSet(QStringLiteral("send-keys"))) {
QString seq = parser.value(QStringLiteral("send-keys")); QString seq = parser.value(QStringLiteral("send-keys"));
......
#compdef kdeconnect-cli #compdef kdeconnect-cli
_kdeconnect_device-ids() { _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 \ #See http://zsh.sourceforge.net/Doc/Release/Completion-System.html#index-_005farguments for autocomplete documentation
'(-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]' \ #The --desktopfile option is not included, since it rarely makes sense to use
'--id-only[make --list-devices or --list-available print only the devices id, to ease scripting]' \ #The --shell-device-autocompletion option is not included, since it's not even in the help (and only required for scripts like these)
'--refresh[search for devices in the network and re-establish connections]' \ local blockoperations="(operation sms)"
'(--pair --unpair)--pair[request pairing with the specified device]' \ _arguments -s \
'--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]" \
'(-)'{-h,--help}'[display usage information]' \ '(-)'{-h,--help}'[display usage information]' \
'(-)'{-v,--version}'[display version information]' \ + '(global)' \
'(-)--author[show author information and exit]' \ $blockoperations{-l,--list-devices}'[list all devices]' \
'(-)--license[show license information and exit]' \ $blockoperations{-a,--list-available}'[list available (paired and reachable) devices]' \
'--desktopfile[specify base file name of the desktop entry for this application]:file' $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) ...@@ -63,7 +63,7 @@ void filterNonExportableCharacters(QString& s)
QDBusConnection sessionBus() QDBusConnection sessionBus()
{ {
#ifdef USE_PRIVATE_DBUS #ifdef USE_PRIVATE_DBUS
return QDBusConnection::connectToBus(KdeConnectConfig::instance()->privateDBusAddress(), return QDBusConnection::connectToBus(KdeConnectConfig::instance().privateDBusAddress(),
QStringLiteral(KDECONNECT_PRIVATE_DBUS_NAME)); QStringLiteral(KDECONNECT_PRIVATE_DBUS_NAME));
#else #else
return QDBusConnection::sessionBus(); return QDBusConnection::sessionBus();
...@@ -121,13 +121,13 @@ void DBusInstancePrivate::launchDBusDaemon() ...@@ -121,13 +121,13 @@ void DBusInstancePrivate::launchDBusDaemon()
QStringLiteral("--address=") + QStringLiteral(KDECONNECT_PRIVATE_DBUS_ADDR) QStringLiteral("--address=") + QStringLiteral(KDECONNECT_PRIVATE_DBUS_ADDR)
}); });
m_dbusProcess->setWorkingDirectory(QCoreApplication::applicationDirPath()); m_dbusProcess->setWorkingDirectory(QCoreApplication::applicationDirPath());
m_dbusProcess->setStandardOutputFile(KdeConnectConfig::instance()->privateDBusAddressPath()); m_dbusProcess->setStandardOutputFile(KdeConnectConfig::instance().privateDBusAddressPath());
m_dbusProcess->setStandardErrorFile(QProcess::nullDevice()); m_dbusProcess->setStandardErrorFile(QProcess::nullDevice());
m_dbusProcess->start(); m_dbusProcess->start();
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
// Set launchctl env // Set launchctl env
QString privateDBusAddress = KdeConnectConfig::instance()->privateDBusAddress(); QString privateDBusAddress = KdeConnectConfig::instance().privateDBusAddress();
QRegularExpressionMatch path; QRegularExpressionMatch path;
if (privateDBusAddress.contains(QRegularExpression( if (privateDBusAddress.contains(QRegularExpression(
QStringLiteral("path=(?<path>/tmp/dbus-[A-Za-z0-9]+)") QStringLiteral("path=(?<path>/tmp/dbus-[A-Za-z0-9]+)")
...@@ -157,7 +157,7 @@ void DBusInstancePrivate::closeDBusDaemon() ...@@ -157,7 +157,7 @@ void DBusInstancePrivate::closeDBusDaemon()
delete m_dbusProcess; delete m_dbusProcess;
m_dbusProcess = nullptr; m_dbusProcess = nullptr;
QFile privateDBusAddressFile(KdeConnectConfig::instance()->privateDBusAddressPath()); QFile privateDBusAddressFile(KdeConnectConfig::instance().privateDBusAddressPath());
if (privateDBusAddressFile.exists()) privateDBusAddressFile.resize(0); if (privateDBusAddressFile.exists()) privateDBusAddressFile.resize(0);
......
...@@ -62,6 +62,7 @@ public: ...@@ -62,6 +62,7 @@ public:
KNotification* notification = new KNotification(QStringLiteral("pairingRequest")); KNotification* notification = new KNotification(QStringLiteral("pairingRequest"));
notification->setIconName(QStringLiteral("dialog-information")); notification->setIconName(QStringLiteral("dialog-information"));
notification->setComponentName(QStringLiteral("kdeconnect")); notification->setComponentName(QStringLiteral("kdeconnect"));
notification->setTitle(QStringLiteral("KDE Connect"));
notification->setText(i18n("Pairing request from %1", device->name().toHtmlEscaped())); notification->setText(i18n("Pairing request from %1", device->name().toHtmlEscaped()));
notification->setActions(QStringList() << i18n("Accept") << i18n("Reject")); notification->setActions(QStringList() << i18n("Accept") << i18n("Reject"));
// notification->setTimeout(PairingHandler::pairingTimeoutMsec()); // notification->setTimeout(PairingHandler::pairingTimeoutMsec());
......
...@@ -29,4 +29,4 @@ Name[sv]=Skicka via KDE-anslut ...@@ -29,4 +29,4 @@ Name[sv]=Skicka via KDE-anslut
Name[uk]=Надіслати за допомогою KDE Connect Name[uk]=Надіслати за допомогою KDE Connect
Name[x-test]=xxSend via KDE Connectxx Name[x-test]=xxSend via KDE Connectxx
Name[zh_CN]=通过 KDE Connect 发送 Name[zh_CN]=通过 KDE Connect 发送
Name[zh_TW]=使用 KDE Connect 傳送 Name[zh_TW]=使用 KDE 連線傳送
...@@ -35,11 +35,12 @@ ...@@ -35,11 +35,12 @@
<name xml:lang="sr-ijekavian">КДЕ‑конекција</name> <name xml:lang="sr-ijekavian">КДЕ‑конекција</name>
<name xml:lang="sr-ijekavianlatin">KDE‑konekcija</name> <name xml:lang="sr-ijekavianlatin">KDE‑konekcija</name>
<name xml:lang="sv">KDE-anslut</name> <name xml:lang="sv">KDE-anslut</name>
<name xml:lang="tg">Пайвасти KDE</name>
<name xml:lang="tr">KDE Connect</name> <name xml:lang="tr">KDE Connect</name>
<name xml:lang="uk">KDE Connect</name> <name xml:lang="uk">KDE Connect</name>
<name xml:lang="x-test">xxKDE Connectxx</name> <name xml:lang="x-test">xxKDE Connectxx</name>
<name xml:lang="zh-CN">KDE Connect</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>Seamless connection of your devices</summary>
<summary xml:lang="ar">اتّصال سلس بين أجهزتك</summary> <summary xml:lang="ar">اتّصال سلس بين أجهزتك</summary>
<summary xml:lang="ca">Connexió transparent amb els vostres dispositius</summary> <summary xml:lang="ca">Connexió transparent amb els vostres dispositius</summary>
...@@ -72,6 +73,7 @@ ...@@ -72,6 +73,7 @@
<summary xml:lang="sr-ijekavian">Једноставно повезивање ваших уређаја</summary> <summary xml:lang="sr-ijekavian">Једноставно повезивање ваших уређаја</summary>
<summary xml:lang="sr-ijekavianlatin">Jednostavno povezivanje vaših uređaja</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="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="tr">Aygıtlarınızı sorunsuz bağlayın</summary>
<summary xml:lang="uk">Безшовне з’єднання для усіх ваших пристроїв</summary> <summary xml:lang="uk">Безшовне з’єднання для усіх ваших пристроїв</summary>
<summary xml:lang="x-test">xxSeamless connection of your devicesxx</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 ...@@ -21,7 +21,7 @@ GenericName[sv]=Visa på ansluten apparat via KDE-anslut
GenericName[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect GenericName[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect
GenericName[x-test]=xxOpen on connected device via KDE Connectxx GenericName[x-test]=xxOpen on connected device via KDE Connectxx
GenericName[zh_CN]=通过 KDE Connect 在已连接的设备上打开 GenericName[zh_CN]=通过 KDE Connect 在已连接的设备上打开
GenericName[zh_TW]=使用 KDE Connect 於連線裝置中開啟 GenericName[zh_TW]=使用 KDE 連線於連線裝置中開啟
Name=Open on connected device via KDE Connect Name=Open on connected device via KDE Connect
Name[ca]=Obre al dispositiu connectat a través del 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 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 ...@@ -44,7 +44,7 @@ Name[sv]=Visa på ansluten apparat via KDE-anslut
Name[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect Name[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect
Name[x-test]=xxOpen on connected device via KDE Connectxx Name[x-test]=xxOpen on connected device via KDE Connectxx
Name[zh_CN]=通过 KDE Connect 在已连接的设备上打开 Name[zh_CN]=通过 KDE Connect 在已连接的设备上打开
Name[zh_TW]=使用 KDE Connect 於連線裝置中開啟 Name[zh_TW]=使用 KDE 連線於連線裝置中開啟
Comment=Open on a connected device using KDE Connect Comment=Open on a connected device using KDE Connect
Comment[ca]=Obre a un dispositiu connectat usant el 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 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 ...@@ -67,7 +67,7 @@ Comment[sv]=Visa på en ansluten apparat med användning av KDE-anslut
Comment[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect Comment[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect
Comment[x-test]=xxOpen on a connected device using KDE Connectxx Comment[x-test]=xxOpen on a connected device using KDE Connectxx
Comment[zh_CN]=通过 KDE Connect 在已连接的设备上打开 Comment[zh_CN]=通过 KDE Connect 在已连接的设备上打开
Comment[zh_TW]=使用 KDE Connect 於連線裝置中開啟 Comment[zh_TW]=使用 KDE 連線於連線裝置中開啟
MimeType=*/*; MimeType=*/*;
Exec=kdeconnect-handler --open %U Exec=kdeconnect-handler --open %U
Icon=kdeconnect Icon=kdeconnect
......
...@@ -25,7 +25,7 @@ Name[sv]=Skicka fil via KDE:s anslutningstjänst ...@@ -25,7 +25,7 @@ Name[sv]=Skicka fil via KDE:s anslutningstjänst
Name[uk]=Надіслати файл за допомогою служби KDE Connect Name[uk]=Надіслати файл за допомогою служби KDE Connect
Name[x-test]=xxSend file via KDE Connect servicexx Name[x-test]=xxSend file via KDE Connect servicexx
Name[zh_CN]=通过 KDE Connect 服务发送文件 Name[zh_CN]=通过 KDE Connect 服务发送文件
Name[zh_TW]=使用 KDE Connect 服務傳送檔案 Name[zh_TW]=使用 KDE 連線服務傳送檔案
X-KDE-Library=kdeconnectfileitemaction X-KDE-Library=kdeconnectfileitemaction
X-KDE-Submenu=Connect X-KDE-Submenu=Connect
X-KDE-Submenu[ar]=اتّصل,اتصل X-KDE-Submenu[ar]=اتّصل,اتصل
......
...@@ -162,8 +162,12 @@ int main(int argc, char** argv) ...@@ -162,8 +162,12 @@ int main(int argc, char** argv)
QStringLiteral("/MainApplication"), QStringLiteral("/MainApplication"),
QStringLiteral("org.qtproject.Qt.QCoreApplication"), QStringLiteral("org.qtproject.Qt.QCoreApplication"),
QStringLiteral("quit")); QStringLiteral("quit"));
DBusHelper::sessionBus().call(message); DBusHelper::sessionBus().call(message, QDBus::NoBlock); // Close our daemon
QCoreApplication::quit(); // Close this application message = QDBusMessage::createMethodCall(qApp->applicationName(),
QStringLiteral("/MainApplication"),
QStringLiteral("org.qtproject.Qt.QCoreApplication"),
QStringLiteral("quit"));
DBusHelper::sessionBus().call(message, QDBus::NoBlock); // Close our indicator
}); });
#endif #endif
}; };
......
...@@ -3,7 +3,7 @@ Name=KDE Connect Indicator ...@@ -3,7 +3,7 @@ Name=KDE Connect Indicator
Name[ast]=Indicador de KDE Connnect Name[ast]=Indicador de KDE Connnect
Name[ca]=Indicador del KDE Connect Name[ca]=Indicador del KDE Connect
Name[ca@valencia]=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[da]=KDE Connect-indikator
Name[de]=KDE-Connect-Anzeige Name[de]=KDE-Connect-Anzeige
Name[el]=Εφαρμογή ένδειξης KDE Connect Name[el]=Εφαρμογή ένδειξης KDE Connect
...@@ -23,7 +23,7 @@ Name[pl]=Wskaźnik KDE Connect ...@@ -23,7 +23,7 @@ Name[pl]=Wskaźnik KDE Connect
Name[pt]=Indicador do KDE Connect Name[pt]=Indicador do KDE Connect
Name[pt_BR]=Indicador do KDE Connect Name[pt_BR]=Indicador do KDE Connect
Name[ru]=Индикатор KDE Connect Name[ru]=Индикатор KDE Connect
Name[sk]=Ukozaovateľ KDE Connect Name[sk]=Ukazovateľ KDE Connect
Name[sr]=КДЕ‑конекцијин показатељ Name[sr]=КДЕ‑конекцијин показатељ
Name[sr@ijekavian]=КДЕ‑конекцијин показатељ Name[sr@ijekavian]=КДЕ‑конекцијин показатељ
Name[sr@ijekavianlatin]=KDE‑konekcijin pokazatelj Name[sr@ijekavianlatin]=KDE‑konekcijin pokazatelj
......
[Desktop Entry] [Desktop Entry]
Exec=kcmshell5 kcm_kdeconnect Exec=kcmshell5 kcm_kdeconnect
Icon=kdeconnect Icon=preferences-kde-connect
Type=Service Type=Service
X-KDE-ServiceTypes=KCModule X-KDE-ServiceTypes=KCModule
......
...@@ -24,16 +24,20 @@ import org.kde.plasma.components 2.0 as PlasmaComponents ...@@ -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.plasma.extras 2.0 as PlasmaExtras
import org.kde.kdeconnect 1.0 as KdeConnect import org.kde.kdeconnect 1.0 as KdeConnect
import QtQuick.Layouts 1.9 import QtQuick.Layouts 1.9
import org.kde.kquickcontrolsaddons 2.0
Item { Item {
id: kdeconnect id: kdeconnect
property alias devicesModel: devicesView.model property alias devicesModel: devicesView.model
KdeConnect.DevicesModel {
id: allDevicesModel
}
ColumnLayout { ColumnLayout {
spacing: 5 spacing: 5
visible: devicesView.count == 0 visible: devicesView.count == 0
width: parent.width anchors.fill: parent
height: parent.height
PlasmaExtras.Heading { PlasmaExtras.Heading {
id: heading id: heading
...@@ -49,6 +53,9 @@ Item { ...@@ -49,6 +53,9 @@ Item {
PlasmaComponents.Label { PlasmaComponents.Label {
Layout.fillWidth: true 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!") text: i18n("Install KDE Connect on your Android device to integrate it with Plasma!")
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
...@@ -56,19 +63,37 @@ Item { ...@@ -56,19 +63,37 @@ Item {
} }
PlasmaComponents.Button { PlasmaComponents.Button {
Layout.leftMargin: units.largeSpacing
Layout.rightMargin: units.largeSpacing
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
visible: allDevicesModel.count == 0
text: i18n("Install from Google Play") text: i18n("Install from Google Play")
onClicked: Qt.openUrlExternally("https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp") onClicked: Qt.openUrlExternally("https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp")
} }
PlasmaComponents.Button { PlasmaComponents.Button {
Layout.leftMargin: units.largeSpacing
Layout.rightMargin: units.largeSpacing
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
visible: allDevicesModel.count == 0
text: i18n("Install from F-Droid") text: i18n("Install from F-Droid")
onClicked: Qt.openUrlExternally("https://f-droid.org/en/packages/org.kde.kdeconnect_tp/") 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 { Item {
Layout.fillHeight: true Layout.fillHeight: true
} }
......
...@@ -42,7 +42,7 @@ Item ...@@ -42,7 +42,7 @@ Item
Binding { Binding {
target: plasmoid target: plasmoid
property: "status" 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 { Plasmoid.fullRepresentation: FullRepresentation {
......
...@@ -63,6 +63,7 @@ Comment[he]=הראה התראות מההתקן שלך באמצעות KDE Connect ...@@ -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[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[id]=Tampilkan notifikasi dari perangkatmu menggunakan KDE Connect
Comment[it]=Mostra le notifiche dei tuoi dispositivi tramite KDE Connect Comment[it]=Mostra le notifiche dei tuoi dispositivi tramite KDE Connect
Comment[ja]=KDE Connect であなたのデバイスの通知を表示
Comment[ko]=KDE Connect로 장치에 표시된 알림 보기 Comment[ko]=KDE Connect로 장치에 표시된 알림 보기
Comment[lt]=Rodyti pranešimus iš jūsų įrenginių naudojant KDE Connect Comment[lt]=Rodyti pranešimus iš jūsų įrenginių naudojant KDE Connect
Comment[nl]=Meldingen van uw apparaten met KDE Connect tonen Comment[nl]=Meldingen van uw apparaten met KDE Connect tonen
......
...@@ -34,7 +34,7 @@ if(NOT SAILFISHOS) ...@@ -34,7 +34,7 @@ if(NOT SAILFISHOS)
add_subdirectory(pausemusic) add_subdirectory(pausemusic)
endif() endif()
if(Qt5Multimedia_FOUND AND KF5PulseAudioQt_FOUND) if(Qt5Multimedia_FOUND AND (KF5PulseAudioQt_FOUND OR WIN32))
add_subdirectory(findthisdevice) add_subdirectory(findthisdevice)
endif() endif()
......
...@@ -88,25 +88,9 @@ void FindThisDeviceConfig::save() ...@@ -88,25 +88,9 @@ void FindThisDeviceConfig::save()
void FindThisDeviceConfig::playSound() void FindThisDeviceConfig::playSound()
{ {
const QString soundFilename = m_ui->soundFileRequester->text(); const QString soundFile = m_ui->soundFileRequester->text();
QUrl soundURL; QUrl soundURL = QUrl(soundFile);
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();
}
QMediaPlayer* player = new QMediaPlayer; QMediaPlayer* player = new QMediaPlayer;
player->setAudioRole(QAudio::Role(QAudio::NotificationRole)); player->setAudioRole(QAudio::Role(QAudio::NotificationRole));
player->setMedia(soundURL); player->setMedia(soundURL);
......
/** /**
* Copyright 2018 Friedrich W. H. Kossebau <kossebau@kde.org> * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -27,17 +28,13 @@ ...@@ -27,17 +28,13 @@
#include <PulseAudioQt/Context> #include <PulseAudioQt/Context>
#include <PulseAudioQt/Sink> #include <PulseAudioQt/Sink>
#endif #endif
// Qt // Qt
#include <QDBusConnection> #include <QDBusConnection>
#include <QStandardPaths>
#include <QFile>
#include <QUrl>
#include <QMediaPlayer> #include <QMediaPlayer>
K_PLUGIN_CLASS_WITH_JSON(FindThisDevicePlugin, "kdeconnect_findthisdevice.json") 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) FindThisDevicePlugin::FindThisDevicePlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args) : KdeConnectPlugin(parent, args)
{ {
...@@ -45,48 +42,14 @@ FindThisDevicePlugin::FindThisDevicePlugin(QObject* parent, const QVariantList& ...@@ -45,48 +42,14 @@ FindThisDevicePlugin::FindThisDevicePlugin(QObject* parent, const QVariantList&
FindThisDevicePlugin::~FindThisDevicePlugin() = default; FindThisDevicePlugin::~FindThisDevicePlugin() = default;
void FindThisDevicePlugin::connected()
{
}
bool FindThisDevicePlugin::receivePacket(const NetworkPacket& np) bool FindThisDevicePlugin::receivePacket(const NetworkPacket& np)
{ {
Q_UNUSED(np); Q_UNUSED(np);
const QString soundFile = config()->get<QString>(QStringLiteral("ringtone"), defaultSound());
const QString soundFilename = config()->get<QString>(QStringLiteral("ringtone"), defaultSound()); const QUrl soundURL = QUrl(soundFile);
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
if (soundURL.isEmpty()) { 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; return true;
} }
...@@ -94,27 +57,25 @@ bool FindThisDevicePlugin::receivePacket(const NetworkPacket& np) ...@@ -94,27 +57,25 @@ bool FindThisDevicePlugin::receivePacket(const NetworkPacket& np)
player->setAudioRole(QAudio::Role(QAudio::NotificationRole)); player->setAudioRole(QAudio::Role(QAudio::NotificationRole));
player->setMedia(soundURL); player->setMedia(soundURL);
player->setVolume(100); player->setVolume(100);
player->play();
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
const auto sinks = PulseAudioQt::Context::instance()->sinks(); const auto sinks = PulseAudioQt::Context::instance()->sinks();
QVector<PulseAudioQt::Sink*> mutedSinks; QVector<PulseAudioQt::Sink*> mutedSinks;
for (auto sink : sinks) { for (auto sink : sinks) {
if (sink->isMuted()) { if (sink->isMuted()) {
sink->setMuted(false); sink->setMuted(false);
mutedSinks.append(sink); mutedSinks.append(sink);
} }
} }
connect(player, &QMediaPlayer::stateChanged, this, [player, mutedSinks]{ connect(player, &QMediaPlayer::stateChanged, this, [player, mutedSinks]{
player->deleteLater();
for (auto sink : qAsConst(mutedSinks)) { for (auto sink : qAsConst(mutedSinks)) {
sink->setMuted(true); sink->setMuted(true);
} }
}); });
#endif #endif
player->play();
connect(player, &QMediaPlayer::stateChanged, player, &QObject::deleteLater);
// TODO: ensure to use built-in loudspeakers // TODO: ensure to use built-in loudspeakers
return true; return true;
......
/** /**
* Copyright 2018 Friedrich W. H. Kossebau <kossebau@kde.org> * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -22,20 +23,25 @@ ...@@ -22,20 +23,25 @@
#define FINDTHISDEVICEPLUGIN_H