Commit 369155a3 authored by Weixuan Xiao's avatar Weixuan Xiao

Merge branch 'master' into macos-splash-screen

parents 8c4d1da7 8bcaf365
Pipeline #7680 passed with stage
in 7 minutes and 50 seconds
......@@ -22,3 +22,4 @@ KDEConnect.includes
.project
.settings/*
CMakeLists.txt.user
qt5_add_resources(kdeconnect_SRCS resources.qrc)
add_executable(kdeconnect main.cpp ${kdeconnect_SRCS})
target_link_libraries(kdeconnect Qt5::Quick Qt5::Widgets KF5::CoreAddons KF5::I18n)
add_executable(kdeconnect-app main.cpp ${kdeconnect_SRCS})
target_link_libraries(kdeconnect-app Qt5::Quick Qt5::Widgets KF5::CoreAddons KF5::I18n)
install(TARGETS kdeconnect ${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS kdeconnect-app ${INSTALL_TARGETS_DEFAULT_ARGS})
install(PROGRAMS org.kde.kdeconnect.app.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
......@@ -183,9 +183,14 @@ int main(int argc, char** argv)
parser.showHelp(1);
}
if (!blockOnReply<QStringList>(iface.devices(false, false)).contains(device)) {
QTextStream(stderr) << "Couldn't find device with id \"" << device << "\". To specify a device by name use -n <devicename>" << endl;
return 1;
}
if (parser.isSet(QStringLiteral("share"))) {
QStringList urls;
QUrl url = QUrl::fromUserInput(parser.value(QStringLiteral("share")), QDir::currentPath());
urls.append(url.toString());
......@@ -198,10 +203,10 @@ int main(int argc, char** argv)
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"),
QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrls"));
msg.setArguments(QVariantList() << QVariant(urls));
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
for (const QString& url : qAsConst(urls)) {
QTextStream(stdout) << i18n("Shared %1", url) << endl;
}
......@@ -265,8 +270,14 @@ 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"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/photo"), QStringLiteral("org.kde.kdeconnect.device.photo"), QStringLiteral("requestPhoto"));
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
if (parser.positionalArguments().size() == 1) {
const QString fileName = parser.positionalArguments()[0];
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;
}
} else if(parser.isSet(QStringLiteral("send-keys"))) {
QString seq = parser.value(QStringLiteral("send-keys"));
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/remotekeyboard"), QStringLiteral("org.kde.kdeconnect.device.remotekeyboard"), QStringLiteral("sendKeyPress"));
......
......@@ -56,7 +56,7 @@ void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource
m_connectionSource = connectionSource;
QString certString = KdeConnectConfig::instance()->getDeviceProperty(deviceId(), QStringLiteral("certificate"));
QString certString = KdeConnectConfig::instance().getDeviceProperty(deviceId(), QStringLiteral("certificate"));
DeviceLink::setPairStatus(certString.isEmpty()? PairStatus::NotPaired : PairStatus::Paired);
}
......@@ -89,9 +89,9 @@ bool LanDeviceLink::sendPacket(NetworkPacket& np)
if (!m_compositeUploadJob || !m_compositeUploadJob->isRunning()) {
m_compositeUploadJob = new CompositeUploadJob(deviceId(), true);
}
m_compositeUploadJob->addSubjob(new UploadJob(np));
if (!m_compositeUploadJob->isRunning()) {
m_compositeUploadJob->start();
}
......@@ -100,7 +100,7 @@ bool LanDeviceLink::sendPacket(NetworkPacket& np)
fireAndForgetJob->addSubjob(new UploadJob(np));
fireAndForgetJob->start();
}
return true;
} else {
int written = m_socketLineReader->write(np.serialize());
......@@ -177,9 +177,9 @@ void LanDeviceLink::setPairStatus(PairStatus status)
DeviceLink::setPairStatus(status);
if (status == Paired) {
Q_ASSERT(KdeConnectConfig::instance()->trustedDevices().contains(deviceId()));
Q_ASSERT(KdeConnectConfig::instance().trustedDevices().contains(deviceId()));
Q_ASSERT(!m_socketLineReader->peerCertificate().isNull());
KdeConnectConfig::instance()->setDeviceProperty(deviceId(), QStringLiteral("certificate"), QString::fromLatin1(m_socketLineReader->peerCertificate().toPem().data()));
KdeConnectConfig::instance().setDeviceProperty(deviceId(), QStringLiteral("certificate"), QString::fromLatin1(m_socketLineReader->peerCertificate().toPem().data()));
}
}
......
......@@ -212,7 +212,7 @@ void LanLinkProvider::udpBroadcastReceived()
continue;
}
if (receivedPacket->get<QString>(QStringLiteral("deviceId")) == KdeConnectConfig::instance()->deviceId()) {
if (receivedPacket->get<QString>(QStringLiteral("deviceId")) == KdeConnectConfig::instance().deviceId()) {
//qCDebug(KDECONNECT_CORE) << "Ignoring my own broadcast";
delete receivedPacket;
continue;
......@@ -281,7 +281,7 @@ void LanLinkProvider::tcpSocketConnected()
// if ssl supported
if (receivedPacket->get<int>(QStringLiteral("protocolVersion")) >= MIN_VERSION_WITH_SSL_SUPPORT) {
bool isDeviceTrusted = KdeConnectConfig::instance()->trustedDevices().contains(deviceId);
bool isDeviceTrusted = KdeConnectConfig::instance().trustedDevices().contains(deviceId);
configureSslSocket(socket, deviceId, isDeviceTrusted);
qCDebug(KDECONNECT_CORE) << "Starting server ssl (I'm the client TCP socket)";
......@@ -403,7 +403,7 @@ void LanLinkProvider::dataReceived()
if (np->get<int>(QStringLiteral("protocolVersion")) >= MIN_VERSION_WITH_SSL_SUPPORT) {
bool isDeviceTrusted = KdeConnectConfig::instance()->trustedDevices().contains(deviceId);
bool isDeviceTrusted = KdeConnectConfig::instance().trustedDevices().contains(deviceId);
configureSslSocket(socket, deviceId, isDeviceTrusted);
qCDebug(KDECONNECT_CORE) << "Starting client ssl (but I'm the server TCP socket)";
......@@ -453,12 +453,12 @@ void LanLinkProvider::configureSslSocket(QSslSocket* socket, const QString& devi
sslConfig.setCiphers(socketCiphers);
socket->setSslConfiguration(sslConfig);
socket->setLocalCertificate(KdeConnectConfig::instance()->certificate());
socket->setPrivateKey(KdeConnectConfig::instance()->privateKeyPath());
socket->setLocalCertificate(KdeConnectConfig::instance().certificate());
socket->setPrivateKey(KdeConnectConfig::instance().privateKeyPath());
socket->setPeerVerifyName(deviceId);
if (isDeviceTrusted) {
QString certString = KdeConnectConfig::instance()->getDeviceProperty(deviceId, QStringLiteral("certificate"), QString());
QString certString = KdeConnectConfig::instance().getDeviceProperty(deviceId, QStringLiteral("certificate"), QString());
socket->addCaCertificate(QSslCertificate(certString.toLatin1()));
socket->setPeerVerifyMode(QSslSocket::VerifyPeer);
} else {
......
......@@ -94,7 +94,7 @@ void Daemon::init()
}
//Read remembered paired devices
const QStringList& list = KdeConnectConfig::instance()->trustedDevices();
const QStringList& list = KdeConnectConfig::instance().trustedDevices();
for (const QString& id : list) {
addDevice(new Device(this, id));
}
......@@ -253,14 +253,14 @@ void Daemon::onDeviceStatusChanged()
void Daemon::setAnnouncedName(const QString& name)
{
qCDebug(KDECONNECT_CORE()) << "Announcing name";
KdeConnectConfig::instance()->setName(name);
KdeConnectConfig::instance().setName(name);
forceOnNetworkChange();
Q_EMIT announcedNameChanged(name);
}
QString Daemon::announcedName()
{
return KdeConnectConfig::instance()->name();
return KdeConnectConfig::instance().name();
}
QNetworkAccessManager* Daemon::networkAccessManager()
......@@ -324,5 +324,5 @@ Daemon::~Daemon()
QString Daemon::selfId() const
{
return KdeConnectConfig::instance()->deviceId();
return KdeConnectConfig::instance().deviceId();
}
......@@ -81,7 +81,7 @@ Device::Device(QObject* parent, const QString& id)
, d(new Device::DevicePrivate(id))
{
d->m_protocolVersion = NetworkPacket::s_protocolVersion;
KdeConnectConfig::DeviceInfo info = KdeConnectConfig::instance()->getTrustedDevice(d->m_deviceId);
KdeConnectConfig::DeviceInfo info = KdeConnectConfig::instance().getTrustedDevice(d->m_deviceId);
d->m_deviceName = info.deviceName;
d->m_deviceType = str2type(info.deviceType);
......@@ -216,7 +216,7 @@ void Device::reloadPlugins()
QString Device::pluginsConfigFile() const
{
return KdeConnectConfig::instance()->deviceConfigDir(id()).absoluteFilePath(QStringLiteral("config"));
return KdeConnectConfig::instance().deviceConfigDir(id()).absoluteFilePath(QStringLiteral("config"));
}
void Device::requestPair()
......@@ -241,14 +241,14 @@ void Device::unpair()
for (DeviceLink* dl : qAsConst(d->m_deviceLinks)) {
dl->userRequestsUnpair();
}
KdeConnectConfig::instance()->removeTrustedDevice(id());
KdeConnectConfig::instance().removeTrustedDevice(id());
Q_EMIT trustedChanged(false);
}
void Device::pairStatusChanged(DeviceLink::PairStatus status)
{
if (status == DeviceLink::NotPaired) {
KdeConnectConfig::instance()->removeTrustedDevice(id());
KdeConnectConfig::instance().removeTrustedDevice(id());
for (DeviceLink* dl : qAsConst(d->m_deviceLinks)) {
if (dl != sender()) {
......@@ -256,7 +256,7 @@ void Device::pairStatusChanged(DeviceLink::PairStatus status)
}
}
} else {
KdeConnectConfig::instance()->addTrustedDevice(id(), name(), type());
KdeConnectConfig::instance().addTrustedDevice(id(), name(), type());
}
reloadPlugins(); //Will load/unload plugins
......@@ -419,7 +419,7 @@ void Device::privateReceivedPacket(const NetworkPacket& np)
bool Device::isTrusted() const
{
return KdeConnectConfig::instance()->trustedDevices().contains(id());
return KdeConnectConfig::instance().trustedDevices().contains(id());
}
QStringList Device::availableLinks() const
......@@ -542,13 +542,13 @@ QString Device::encryptionInfo() const
QString result;
QCryptographicHash::Algorithm digestAlgorithm = QCryptographicHash::Algorithm::Sha1;
QString localSha1 = QString::fromLatin1(KdeConnectConfig::instance()->certificate().digest(digestAlgorithm).toHex());
QString localSha1 = QString::fromLatin1(KdeConnectConfig::instance().certificate().digest(digestAlgorithm).toHex());
for (int i = 2; i<localSha1.size(); i += 3) {
localSha1.insert(i, QStringLiteral(":")); // Improve readability
}
result += i18n("SHA1 fingerprint of your device certificate is: %1\n", localSha1);
std::string remotePem = KdeConnectConfig::instance()->getDeviceProperty(id(), QStringLiteral("certificate")).toStdString();
std::string remotePem = KdeConnectConfig::instance().getDeviceProperty(id(), QStringLiteral("certificate")).toStdString();
QSslCertificate remoteCertificate = QSslCertificate(QByteArray(remotePem.c_str(), (int)remotePem.size()));
QString remoteSha1 = QString::fromLatin1(remoteCertificate.digest(digestAlgorithm).toHex());
for (int i = 2; i < remoteSha1.size(); i += 3) {
......
......@@ -58,9 +58,9 @@ struct KdeConnectConfigPrivate {
#endif
};
KdeConnectConfig* KdeConnectConfig::instance()
KdeConnectConfig& KdeConnectConfig::instance()
{
static KdeConnectConfig* kcc = new KdeConnectConfig();
static KdeConnectConfig kcc;
return kcc;
}
......@@ -369,7 +369,7 @@ QString KdeConnectConfig::privateDBusAddress()
}
qCDebug(KDECONNECT_CORE) << "Private dbus address: " << addr;
d->m_privateDBusAddress = addr;
return addr;
......
......@@ -35,7 +35,7 @@ public:
QString deviceType;
};
static KdeConnectConfig* instance();
static KdeConnectConfig& instance();
/*
* Our own info
......
......@@ -37,7 +37,7 @@ struct KdeConnectPluginConfigPrivate
KdeConnectPluginConfig::KdeConnectPluginConfig(const QString& deviceId, const QString& pluginName)
: d(new KdeConnectPluginConfigPrivate())
{
d->m_configDir = KdeConnectConfig::instance()->pluginConfigDir(deviceId, pluginName);
d->m_configDir = KdeConnectConfig::instance().pluginConfigDir(deviceId, pluginName);
QDir().mkpath(d->m_configDir.path());
d->m_config = new QSettings(d->m_configDir.absoluteFilePath(QStringLiteral("config")), QSettings::IniFormat);
......
......@@ -57,14 +57,13 @@ NetworkPacket::NetworkPacket(const QString& type, const QVariantMap& body)
void NetworkPacket::createIdentityPacket(NetworkPacket* np)
{
KdeConnectConfig* config = KdeConnectConfig::instance();
np->m_id = QString::number(QDateTime::currentMSecsSinceEpoch());
np->m_type = PACKET_TYPE_IDENTITY;
np->m_payload = QSharedPointer<QIODevice>();
np->m_payloadSize = 0;
np->set(QStringLiteral("deviceId"), config->deviceId());
np->set(QStringLiteral("deviceName"), config->name());
np->set(QStringLiteral("deviceType"), config->deviceType());
np->set(QStringLiteral("deviceId"), KdeConnectConfig::instance().deviceId());
np->set(QStringLiteral("deviceName"), KdeConnectConfig::instance().name());
np->set(QStringLiteral("deviceType"), KdeConnectConfig::instance().deviceType());
np->set(QStringLiteral("protocolVersion"), NetworkPacket::s_protocolVersion);
np->set(QStringLiteral("incomingCapabilities"), PluginLoader::instance()->incomingCapabilities());
np->set(QStringLiteral("outgoingCapabilities"), PluginLoader::instance()->outgoingCapabilities());
......@@ -147,7 +146,6 @@ bool NetworkPacket::unserialize(const QByteArray& a, NetworkPacket* np)
auto variant = parser.toVariant().toMap();
qvariant2qobject(variant, np);
np->m_payloadSize = variant[QStringLiteral("payloadSize")].toInt(); //Will return 0 if was not present, which is ok
if (np->m_payloadSize == -1) {
np->m_payloadSize = np->get<int>(QStringLiteral("size"), -1);
}
......
......@@ -3,6 +3,7 @@ Type=Application
Exec=${KDE_INSTALL_FULL_LIBEXECDIR}/kdeconnectd
X-KDE-StartupNotify=false
X-KDE-autostart-phase=1
X-KDE-Wayland-Interfaces=org_kde_kwin_fake_input
X-GNOME-Autostart-enabled=true
OnlyShowIn=KDE;GNOME;Unity;XFCE;
NoDisplay=true
......
......@@ -18,7 +18,7 @@ Name[gl]=Enviar por KDE Connect
Name[it]=Invia tramite KDE Connect
Name[ko]=KDE Connect로 통해 보내기
Name[lt]=Siųsti per KDE Connect
Name[nl]=Via KDE Connect versturen
Name[nl]=Via KDE Connect verzenden
Name[nn]=Send via KDE Connect
Name[pl]=Wyślij przez KDE Connect
Name[pt]=Enviar pelo KDE Connect
......
......@@ -16,6 +16,7 @@ GenericName[pl]=Otwórz na podłączonym urządzeniu przez KDE Connect
GenericName[pt]=Abrir no dispositivo ligado com o KDE Connect
GenericName[pt_BR]=Abrir no dispositivo conectado via KDE Connect
GenericName[ru]=Открыть подключённое устройство через KDE Connect
GenericName[sk]=Otvoriť na pripojenom zariadení cez KDE Connect
GenericName[sv]=Visa på ansluten apparat via KDE-anslut
GenericName[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect
GenericName[x-test]=xxOpen on connected device via KDE Connectxx
......@@ -38,6 +39,7 @@ Name[pl]=Otwórz na podłączonym urządzeniu przez KDE Connect
Name[pt]=Abrir no dispositivo ligado com o KDE Connect
Name[pt_BR]=Abrir no dispositivo conectado via KDE Connect
Name[ru]=Открыть подключённое устройство через KDE Connect
Name[sk]=Otvoriť na pripojenom zariadení cez KDE Connect
Name[sv]=Visa på ansluten apparat via KDE-anslut
Name[uk]=Відкрити на з'єднаному пристрої за допомогою KDE Connect
Name[x-test]=xxOpen on connected device via KDE Connectxx
......@@ -60,6 +62,7 @@ Comment[pl]=Otwórz na podłączonym urządzeniu przez KDE Connect
Comment[pt]=Abrir num dispositivo ligado com o KDE Connect
Comment[pt_BR]=Abre no dispositivo conectado usando o KDE Connect
Comment[ru]=Открытие подключённого устройства через KDE Connect
Comment[sk]=Otvoriť na pripojenom zariadení cez KDE Connect
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
......
......@@ -24,15 +24,13 @@ if(NOT SAILFISHOS)
add_subdirectory(sms)
add_subdirectory(runcommand)
add_subdirectory(presenter)
add_subdirectory(screensaver-inhibit)
if(NOT WIN32)
add_subdirectory(screensaver-inhibit)
endif()
if(NOT WIN32 AND NOT APPLE)
if(NOT APPLE)
add_subdirectory(sftp)
endif()
if(KF5PulseAudioQt_FOUND)
if(KF5PulseAudioQt_FOUND OR WIN32)
add_subdirectory(pausemusic)
endif()
......
......@@ -114,8 +114,7 @@ bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np)
// Remove this file from the list of known files
QFileInfo fileInfo(vcardFile);
bool success = localVCards.removeOne(fileInfo);
Q_ASSERT(success); // We should have always been able to remove the existing file from our listing
localVCards.removeOne(fileInfo);
// Check if the vcard needs to be updated
if (!vcardFile.open(QIODevice::ReadOnly)) {
......
kdeconnect_add_plugin(kdeconnect_pausemusic JSON kdeconnect_pausemusic.json SOURCES pausemusicplugin.cpp)
if(WIN32)
set(kdeconnect_pausemusic_SRCS
pausemusicplugin-win.cpp
)
else()
set(kdeconnect_pausemusic_SRCS
pausemusicplugin.cpp
)
endif()
kdeconnect_add_plugin(kdeconnect_pausemusic JSON kdeconnect_pausemusic.json SOURCES ${kdeconnect_pausemusic_SRCS})
target_link_libraries(kdeconnect_pausemusic
kdeconnectcore
Qt5::Core
Qt5::DBus
KF5::PulseAudioQt
)
if (NOT WIN32)
target_link_libraries(kdeconnect_pausemusic
KF5::PulseAudioQt
)
endif()
#######################################
# Config
......
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
#include "pausemusicplugin-win.h"
#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(PauseMusicPlugin, "kdeconnect_pausemusic.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_PAUSEMUSIC, "kdeconnect.plugin.pausemusic")
PauseMusicPlugin::PauseMusicPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
CoInitialize(NULL);
deviceEnumerator = NULL;
CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_INPROC_SERVER, __uuidof(IMMDeviceEnumerator), (LPVOID *)&deviceEnumerator);
defaultDevice = NULL;
g_guidMyContext = GUID_NULL;
deviceEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &defaultDevice);
deviceEnumerator->Release();
deviceEnumerator = NULL;
endpointVolume = NULL;
defaultDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL, (LPVOID *)&endpointVolume);
defaultDevice->Release();
defaultDevice = NULL;
CoCreateGuid(&g_guidMyContext);
}
PauseMusicPlugin::~PauseMusicPlugin()
{
endpointVolume->Release();
CoUninitialize();
}
bool PauseMusicPlugin::receivePacket(const NetworkPacket& np)
{
bool pauseOnlyWhenTalking = config()->get(QStringLiteral("conditionTalking"), false);
if (pauseOnlyWhenTalking) {
if (np.get<QString>(QStringLiteral("event")) != QLatin1String("talking")) {
return true;
}
} else {
if (np.get<QString>(QStringLiteral("event")) != QLatin1String("ringing")
&& np.get<QString>(QStringLiteral("event")) != QLatin1String("talking")) {
return true;
}
}
bool pauseConditionFulfilled = !np.get<bool>(QStringLiteral("isCancel"));
bool pause = config()->get(QStringLiteral("actionPause"), false);
bool mute = config()->get(QStringLiteral("actionMute"), true);
if (pauseConditionFulfilled) {
if (mute) {
qCDebug(KDECONNECT_PLUGIN_PAUSEMUSIC) << "Muting music";
endpointVolume->SetMute(TRUE, &g_guidMyContext);
}
if (pause) {
// TODO PAUSING
}
} else {
if (mute) {
qCDebug(KDECONNECT_PLUGIN_PAUSEMUSIC) << "Unmuting system volume";
endpointVolume->SetMute(FALSE, &g_guidMyContext);
}
if (pause) {
// TODO UNPAUSING
}
}
return true;
}
#include "pausemusicplugin-win.moc"
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
#ifndef PAUSEMUSICPLUGINWIN_H
#define PAUSEMUSICPLUGINWIN_H
#include <QObject>
#include <QSet>
#include <QString>
#include <core/kdeconnectplugin.h>
#include <QLoggingCategory>
#include <mmdeviceapi.h>
#include <endpointvolume.h>
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_PAUSEMUSIC)
class PauseMusicPlugin
: public KdeConnectPlugin
{
Q_OBJECT
public:
explicit PauseMusicPlugin(QObject* parent, const QVariantList& args);
~PauseMusicPlugin();
bool receivePacket(const NetworkPacket& np) override;
void connected() override { }
private:
IMMDeviceEnumerator *deviceEnumerator;
IMMDevice *defaultDevice;
GUID g_guidMyContext;
IAudioEndpointVolume *endpointVolume;
};
#endif // PAUSEMUSICPLUGINWIN_H
\ No newline at end of file
......@@ -47,6 +47,7 @@
"Description[cs]": "Použijte mobilní zařízení k ukázání na položky na obrazovce",
"Description[de]": "Anzeige von Objekten auf dem Bildschirm mit Ihrem mobilen Gerät",
"Description[en_GB]": "Use your mobile device to point to things on the screen",
"Description[es]": "Use su dispositivo móvil para apuntar a elementos en pantalla",
"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",
......@@ -55,6 +56,7 @@
"Description[pl]": "Użyj swojego urządzenia przenośnego do wskazywania rzeczy na ekranie",
"Description[pt]": "Use o seu dispositivo móvel para apontar para coisas no ecrã",
"Description[pt_BR]": "Use o seu dispositivo móvel para apontar para elementos na tela",
"Description[sk]": "Použite vaše mobilné zariadenia na ukazovanie na veci na obrazovke",
"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",
......
if(APPLE)
set(kdeconnect_screensaver_inhibit_SRCS
screensaverinhibitplugin-macos.cpp
)
set(kdeconnect_screensaver_inhibit_SRCS
screensaverinhibitplugin-macos.cpp
)
elseif(WIN32)
set(kdeconnect_screensaver_inhibit_SRCS
screensaverinhibitplugin-win.cpp
)
else()
set(kdeconnect_screensaver_inhibit_SRCS
screensaverinhibitplugin.cpp
)
set(kdeconnect_screensaver_inhibit_SRCS
screensaverinhibitplugin.cpp
)
endif()
kdeconnect_add_plugin(kdeconnect_screensaver_inhibit JSON kdeconnect_screensaver_inhibit.json SOURCES ${kdeconnect_screensaver_inhibit_SRCS})
target_link_libraries(kdeconnect_screensaver_inhibit kdeconnectcore)
if(NOT APPLE)
target_link_libraries(kdeconnect_screensaver_inhibit
Qt5::DBus
KF5::I18n
)
if(NOT APPLE AND NOT WIN32)
target_link_libraries(kdeconnect_screensaver_inhibit
Qt5::DBus
KF5::I18n
)
endif()
/**
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
#include "screensaverinhibitplugin-win.h"
#include <KPluginFactory>
#include <QLoggingCategory>
#include <Windows.h>
K_PLUGIN_CLASS_WITH_JSON(ScreensaverInhibitPlugin, "kdeconnect_screensaver_inhibit.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SCREENSAVERINHIBIT, "kdeconnect.plugin.screensaverinhibit")
ScreensaverInhibitPlugin::ScreensaverInhibitPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
}
ScreensaverInhibitPlugin::~ScreensaverInhibitPlugin()
{
SetThreadExecutionState(ES_CONTINUOUS);
}
bool ScreensaverInhibitPlugin::receivePacket(const NetworkPacket& np)
{
Q_UNUSED(np);
return false;
}
#include "screensaverinhibitplugin-win.moc"
/**
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
#ifndef SCREENSAVERINHIBITPLUGIN_H
#define SCREENSAVERINHIBITPLUGIN_H
#include <QObject>
#include <core/kdeconnectplugin.h>
class Q_DECL_EXPORT ScreensaverInhibitPlugin
: public KdeConnectPlugin
{
Q_OBJECT
public:
explicit ScreensaverInhibitPlugin(QObject* pa