Force usage of QStringLiteral and port remaining offenders
This commit is contained in:
parent
86b82677a1
commit
e601755644
67 changed files with 298 additions and 298 deletions
|
@ -34,7 +34,7 @@ else()
|
||||||
if(NOT WIN32 AND NOT APPLE)
|
if(NOT WIN32 AND NOT APPLE)
|
||||||
find_package(KF5PulseAudioQt REQUIRED)
|
find_package(KF5PulseAudioQt REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS)
|
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
|
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
|
||||||
|
|
|
@ -78,8 +78,8 @@ int main(int argc, char** argv)
|
||||||
//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"));
|
||||||
deviceAutocomplete.setHidden(true);
|
deviceAutocomplete.setHidden(true);
|
||||||
deviceAutocomplete.setDescription("Outputs all available devices id's with their name and paired status"); //Not visible, so no translation needed
|
deviceAutocomplete.setDescription(QStringLiteral("Outputs all available devices id's with their name and paired status")); //Not visible, so no translation needed
|
||||||
deviceAutocomplete.setValueName("shell");
|
deviceAutocomplete.setValueName(QStringLiteral("shell"));
|
||||||
parser.addOption(deviceAutocomplete);
|
parser.addOption(deviceAutocomplete);
|
||||||
about.setupCommandLine(&parser);
|
about.setupCommandLine(&parser);
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ int main(int argc, char** argv)
|
||||||
parser.process(app);
|
parser.process(app);
|
||||||
about.processCommandLine(&parser);
|
about.processCommandLine(&parser);
|
||||||
|
|
||||||
const QString id = "kdeconnect-cli-"+QString::number(QCoreApplication::applicationPid());
|
const QString id = QStringLiteral("kdeconnect-cli-") + QString::number(QCoreApplication::applicationPid());
|
||||||
DaemonDbusInterface iface;
|
DaemonDbusInterface iface;
|
||||||
|
|
||||||
if (parser.isSet(QStringLiteral("my-id"))) {
|
if (parser.isSet(QStringLiteral("my-id"))) {
|
||||||
|
@ -152,15 +152,15 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Description: "device name (paired/unpaired)"
|
//Description: "device name (paired/unpaired)"
|
||||||
QString description = deviceIface.name() + " " + statusInfo;
|
QString description = deviceIface.name() + QLatin1Char(' ') + statusInfo;
|
||||||
//Replace characters
|
//Replace characters
|
||||||
description.replace(QChar('\\'), QStringLiteral("\\\\"));
|
description.replace(QLatin1Char('\\'), QStringLiteral("\\\\"));
|
||||||
description.replace(QChar('['), QStringLiteral("\\["));
|
description.replace(QLatin1Char('['), QStringLiteral("\\["));
|
||||||
description.replace(QChar(']'), QStringLiteral("\\]"));
|
description.replace(QLatin1Char(']'), QStringLiteral("\\]"));
|
||||||
description.replace(QChar('\''), QStringLiteral("\\'"));
|
description.replace(QLatin1Char('\''), QStringLiteral("\\'"));
|
||||||
description.replace(QChar('\"'), QStringLiteral("\\\""));
|
description.replace(QLatin1Char('\"'), QStringLiteral("\\\""));
|
||||||
description.replace(QChar('\n'), QChar(' '));
|
description.replace(QLatin1Char('\n'), QLatin1Char(' '));
|
||||||
description.remove(QChar('\0'));
|
description.remove(QLatin1Char('\0'));
|
||||||
|
|
||||||
//Output id and description
|
//Output id and description
|
||||||
QTextStream(stdout) << id << '[' << description << ']' << endl;
|
QTextStream(stdout) << id << '[' << description << ']' << endl;
|
||||||
|
@ -196,7 +196,7 @@ int main(int argc, char** argv)
|
||||||
urls.append(url.toString());
|
urls.append(url.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/share",
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"),
|
||||||
QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrls"));
|
QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrls"));
|
||||||
|
|
||||||
msg.setArguments(QVariantList() << QVariant(urls));
|
msg.setArguments(QVariantList() << QVariant(urls));
|
||||||
|
@ -206,7 +206,7 @@ int main(int argc, char** argv)
|
||||||
QTextStream(stdout) << i18n("Shared %1", url) << endl;
|
QTextStream(stdout) << i18n("Shared %1", url) << endl;
|
||||||
}
|
}
|
||||||
} else if (parser.isSet(QStringLiteral("share-text"))) {
|
} else if (parser.isSet(QStringLiteral("share-text"))) {
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/share", QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareText"));
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareText"));
|
||||||
msg.setArguments(QVariantList() << parser.value(QStringLiteral("share-text")));
|
msg.setArguments(QVariantList() << parser.value(QStringLiteral("share-text")));
|
||||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||||
QTextStream(stdout) << i18n("Shared text: %1", parser.value(QStringLiteral("share-text"))) << endl;
|
QTextStream(stdout) << i18n("Shared text: %1", parser.value(QStringLiteral("share-text"))) << endl;
|
||||||
|
@ -246,7 +246,7 @@ int main(int argc, char** argv)
|
||||||
blockOnReply(dev.unpair());
|
blockOnReply(dev.unpair());
|
||||||
}
|
}
|
||||||
} else if(parser.isSet(QStringLiteral("ping")) || parser.isSet(QStringLiteral("ping-msg"))) {
|
} else if(parser.isSet(QStringLiteral("ping")) || parser.isSet(QStringLiteral("ping-msg"))) {
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/ping", QStringLiteral("org.kde.kdeconnect.device.ping"), QStringLiteral("sendPing"));
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/ping"), QStringLiteral("org.kde.kdeconnect.device.ping"), QStringLiteral("sendPing"));
|
||||||
if (parser.isSet(QStringLiteral("ping-msg"))) {
|
if (parser.isSet(QStringLiteral("ping-msg"))) {
|
||||||
QString message = parser.value(QStringLiteral("ping-msg"));
|
QString message = parser.value(QStringLiteral("ping-msg"));
|
||||||
msg.setArguments(QVariantList() << message);
|
msg.setArguments(QVariantList() << message);
|
||||||
|
@ -254,29 +254,29 @@ int main(int argc, char** argv)
|
||||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||||
} else if(parser.isSet(QStringLiteral("send-sms"))) {
|
} else if(parser.isSet(QStringLiteral("send-sms"))) {
|
||||||
if (parser.isSet(QStringLiteral("destination"))) {
|
if (parser.isSet(QStringLiteral("destination"))) {
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/sms", QStringLiteral("org.kde.kdeconnect.device.sms"), QStringLiteral("sendSms"));
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/sms"), QStringLiteral("org.kde.kdeconnect.device.sms"), QStringLiteral("sendSms"));
|
||||||
msg.setArguments({ parser.value("destination"), parser.value("send-sms") });
|
msg.setArguments({ parser.value(QStringLiteral("destination")), parser.value(QStringLiteral("send-sms"))});
|
||||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||||
} else {
|
} else {
|
||||||
QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination <phone number>");
|
QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination <phone number>");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if(parser.isSet(QStringLiteral("ring"))) {
|
} else if(parser.isSet(QStringLiteral("ring"))) {
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/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"))) {
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/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"));
|
||||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||||
} else if(parser.isSet("send-keys")) {
|
} else if(parser.isSet(QStringLiteral("send-keys"))) {
|
||||||
QString seq = parser.value("send-keys");
|
QString seq = parser.value(QStringLiteral("send-keys"));
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/remotekeyboard", "org.kde.kdeconnect.device.remotekeyboard", "sendKeyPress");
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/remotekeyboard"), QStringLiteral("org.kde.kdeconnect.device.remotekeyboard"), QStringLiteral("sendKeyPress"));
|
||||||
if (seq.trimmed() == QLatin1String("-")) {
|
if (seq.trimmed() == QLatin1String("-")) {
|
||||||
// from stdin
|
// from stdin
|
||||||
QFile in;
|
QFile in;
|
||||||
if(in.open(stdin,QIODevice::ReadOnly | QIODevice::Unbuffered)) {
|
if(in.open(stdin,QIODevice::ReadOnly | QIODevice::Unbuffered)) {
|
||||||
while (!in.atEnd()) {
|
while (!in.atEnd()) {
|
||||||
QByteArray line = in.readLine(); // sanitize to ASCII-codes > 31?
|
QByteArray line = in.readLine(); // sanitize to ASCII-codes > 31?
|
||||||
msg.setArguments({QString(line), -1, false, false, false});
|
msg.setArguments({QString::fromLatin1(line), -1, false, false, false});
|
||||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
|
|
|
@ -45,7 +45,7 @@ BluetoothDeviceLink::BluetoothDeviceLink(const QString& deviceId, LinkProvider*
|
||||||
|
|
||||||
QString BluetoothDeviceLink::name()
|
QString BluetoothDeviceLink::name()
|
||||||
{
|
{
|
||||||
return "BluetoothLink"; // Should be same in both android and kde version
|
return QStringLiteral("BluetoothLink"); // Should be same in both android and kde version
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BluetoothDeviceLink::sendPacket(NetworkPacket& np)
|
bool BluetoothDeviceLink::sendPacket(NetworkPacket& np)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
BluetoothDownloadJob::BluetoothDownloadJob(const QBluetoothAddress& remoteAddress, const QVariantMap& transferInfo, QObject* parent)
|
BluetoothDownloadJob::BluetoothDownloadJob(const QBluetoothAddress& remoteAddress, const QVariantMap& transferInfo, QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, mRemoteAddress(remoteAddress)
|
, mRemoteAddress(remoteAddress)
|
||||||
, mTransferUuid(QBluetoothUuid(transferInfo.value("uuid").toString()))
|
, mTransferUuid(QBluetoothUuid(transferInfo.value(QStringLiteral("uuid")).toString()))
|
||||||
, mSocket(new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol))
|
, mSocket(new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
BluetoothLinkProvider::BluetoothLinkProvider()
|
BluetoothLinkProvider::BluetoothLinkProvider()
|
||||||
{
|
{
|
||||||
mServiceUuid = QBluetoothUuid(QString("185f3df4-3268-4e3f-9fca-d4d5059915bd"));
|
mServiceUuid = QBluetoothUuid(QStringLiteral("185f3df4-3268-4e3f-9fca-d4d5059915bd"));
|
||||||
|
|
||||||
connectTimer = new QTimer(this);
|
connectTimer = new QTimer(this);
|
||||||
connectTimer->setInterval(30000);
|
connectTimer->setInterval(30000);
|
||||||
|
@ -61,7 +61,7 @@ void BluetoothLinkProvider::onStart()
|
||||||
mServiceDiscoveryAgent->start();
|
mServiceDiscoveryAgent->start();
|
||||||
|
|
||||||
connectTimer->start();
|
connectTimer->start();
|
||||||
mKdeconnectService = mBluetoothServer->listen(mServiceUuid, "KDE Connect");
|
mKdeconnectService = mBluetoothServer->listen(mServiceUuid, QStringLiteral("KDE Connect"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothLinkProvider::onStop()
|
void BluetoothLinkProvider::onStop()
|
||||||
|
@ -183,7 +183,7 @@ void BluetoothLinkProvider::clientIdentityReceived()
|
||||||
|
|
||||||
disconnect(socket, SIGNAL(readyRead()), this, SLOT(clientIdentityReceived()));
|
disconnect(socket, SIGNAL(readyRead()), this, SLOT(clientIdentityReceived()));
|
||||||
|
|
||||||
NetworkPacket receivedPacket("");
|
NetworkPacket receivedPacket;
|
||||||
bool success = NetworkPacket::unserialize(identityArray, &receivedPacket);
|
bool success = NetworkPacket::unserialize(identityArray, &receivedPacket);
|
||||||
|
|
||||||
if (!success || receivedPacket.type() != PACKET_TYPE_IDENTITY) {
|
if (!success || receivedPacket.type() != PACKET_TYPE_IDENTITY) {
|
||||||
|
@ -198,10 +198,10 @@ void BluetoothLinkProvider::clientIdentityReceived()
|
||||||
|
|
||||||
disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError()));
|
disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError()));
|
||||||
|
|
||||||
const QString& deviceId = receivedPacket.get<QString>("deviceId");
|
const QString& deviceId = receivedPacket.get<QString>(QStringLiteral("deviceId"));
|
||||||
BluetoothDeviceLink* deviceLink = new BluetoothDeviceLink(deviceId, this, socket);
|
BluetoothDeviceLink* deviceLink = new BluetoothDeviceLink(deviceId, this, socket);
|
||||||
|
|
||||||
NetworkPacket np2("");
|
NetworkPacket np2;
|
||||||
NetworkPacket::createIdentityPacket(&np2);
|
NetworkPacket::createIdentityPacket(&np2);
|
||||||
success = deviceLink->sendPacket(np2);
|
success = deviceLink->sendPacket(np2);
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ void BluetoothLinkProvider::serverNewConnection()
|
||||||
connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError()));
|
connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError()));
|
||||||
connect(socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
|
connect(socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
|
||||||
|
|
||||||
NetworkPacket np2("");
|
NetworkPacket np2;
|
||||||
NetworkPacket::createIdentityPacket(&np2);
|
NetworkPacket::createIdentityPacket(&np2);
|
||||||
socket->write(np2.serialize());
|
socket->write(np2.serialize());
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ void BluetoothLinkProvider::serverDataReceived()
|
||||||
disconnect(socket, SIGNAL(readyRead()), this, SLOT(serverDataReceived()));
|
disconnect(socket, SIGNAL(readyRead()), this, SLOT(serverDataReceived()));
|
||||||
disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError()));
|
disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError()));
|
||||||
|
|
||||||
NetworkPacket receivedPacket("");
|
NetworkPacket receivedPacket;
|
||||||
bool success = NetworkPacket::unserialize(identityArray, &receivedPacket);
|
bool success = NetworkPacket::unserialize(identityArray, &receivedPacket);
|
||||||
|
|
||||||
if (!success || receivedPacket.type() != PACKET_TYPE_IDENTITY) {
|
if (!success || receivedPacket.type() != PACKET_TYPE_IDENTITY) {
|
||||||
|
@ -289,7 +289,7 @@ void BluetoothLinkProvider::serverDataReceived()
|
||||||
|
|
||||||
qCDebug(KDECONNECT_CORE()) << "Received identity packet from" << socket->peerAddress();
|
qCDebug(KDECONNECT_CORE()) << "Received identity packet from" << socket->peerAddress();
|
||||||
|
|
||||||
const QString& deviceId = receivedPacket.get<QString>("deviceId");
|
const QString& deviceId = receivedPacket.get<QString>(QStringLiteral("deviceId"));
|
||||||
BluetoothDeviceLink* deviceLink = new BluetoothDeviceLink(deviceId, this, socket);
|
BluetoothDeviceLink* deviceLink = new BluetoothDeviceLink(deviceId, this, socket);
|
||||||
|
|
||||||
connect(deviceLink, SIGNAL(destroyed(QObject*)),
|
connect(deviceLink, SIGNAL(destroyed(QObject*)),
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
BluetoothLinkProvider();
|
BluetoothLinkProvider();
|
||||||
virtual ~BluetoothLinkProvider();
|
virtual ~BluetoothLinkProvider();
|
||||||
|
|
||||||
QString name() override { return "BluetoothLinkProvider"; }
|
QString name() override { return QStringLiteral("BluetoothLinkProvider"); }
|
||||||
int priority() override { return PRIORITY_MEDIUM; }
|
int priority() override { return PRIORITY_MEDIUM; }
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
|
@ -42,7 +42,7 @@ void BluetoothPairingHandler::packetReceived(const NetworkPacket& np)
|
||||||
|
|
||||||
m_pairingTimeout.stop();
|
m_pairingTimeout.stop();
|
||||||
|
|
||||||
bool wantsPair = np.get<bool>("pair");
|
bool wantsPair = np.get<bool>(QStringLiteral("pair"));
|
||||||
|
|
||||||
if (wantsPair) {
|
if (wantsPair) {
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ bool BluetoothPairingHandler::requestPairing()
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkPacket np(PACKET_TYPE_PAIR);
|
NetworkPacket np(PACKET_TYPE_PAIR);
|
||||||
np.set("pair", true);
|
np.set(QStringLiteral("pair"), true);
|
||||||
bool success;
|
bool success;
|
||||||
success = deviceLink()->sendPacket(np);
|
success = deviceLink()->sendPacket(np);
|
||||||
if (success) {
|
if (success) {
|
||||||
|
@ -106,7 +106,7 @@ bool BluetoothPairingHandler::acceptPairing()
|
||||||
qCDebug(KDECONNECT_CORE) << "User accepts pairing";
|
qCDebug(KDECONNECT_CORE) << "User accepts pairing";
|
||||||
m_pairingTimeout.stop(); // Just in case it is started
|
m_pairingTimeout.stop(); // Just in case it is started
|
||||||
NetworkPacket np(PACKET_TYPE_PAIR);
|
NetworkPacket np(PACKET_TYPE_PAIR);
|
||||||
np.set("pair", true);
|
np.set(QStringLiteral("pair"), true);
|
||||||
bool success = deviceLink()->sendPacket(np);
|
bool success = deviceLink()->sendPacket(np);
|
||||||
if (success) {
|
if (success) {
|
||||||
setInternalPairStatus(Paired);
|
setInternalPairStatus(Paired);
|
||||||
|
@ -118,14 +118,14 @@ void BluetoothPairingHandler::rejectPairing()
|
||||||
{
|
{
|
||||||
qCDebug(KDECONNECT_CORE) << "User rejects pairing";
|
qCDebug(KDECONNECT_CORE) << "User rejects pairing";
|
||||||
NetworkPacket np(PACKET_TYPE_PAIR);
|
NetworkPacket np(PACKET_TYPE_PAIR);
|
||||||
np.set("pair", false);
|
np.set(QStringLiteral("pair"), false);
|
||||||
deviceLink()->sendPacket(np);
|
deviceLink()->sendPacket(np);
|
||||||
setInternalPairStatus(NotPaired);
|
setInternalPairStatus(NotPaired);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothPairingHandler::unpair() {
|
void BluetoothPairingHandler::unpair() {
|
||||||
NetworkPacket np(PACKET_TYPE_PAIR);
|
NetworkPacket np(PACKET_TYPE_PAIR);
|
||||||
np.set("pair", false);
|
np.set(QStringLiteral("pair"), false);
|
||||||
deviceLink()->sendPacket(np);
|
deviceLink()->sendPacket(np);
|
||||||
setInternalPairStatus(NotPaired);
|
setInternalPairStatus(NotPaired);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ void BluetoothPairingHandler::unpair() {
|
||||||
void BluetoothPairingHandler::pairingTimeout()
|
void BluetoothPairingHandler::pairingTimeout()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_PAIR);
|
NetworkPacket np(PACKET_TYPE_PAIR);
|
||||||
np.set("pair", false);
|
np.set(QStringLiteral("pair"), false);
|
||||||
deviceLink()->sendPacket(np);
|
deviceLink()->sendPacket(np);
|
||||||
setInternalPairStatus(NotPaired); //Will emit the change as well
|
setInternalPairStatus(NotPaired); //Will emit the change as well
|
||||||
Q_EMIT pairingError(i18n("Timed out"));
|
Q_EMIT pairingError(i18n("Timed out"));
|
||||||
|
|
|
@ -38,14 +38,14 @@ BluetoothUploadJob::BluetoothUploadJob(const QSharedPointer<QIODevice>& data, co
|
||||||
QVariantMap BluetoothUploadJob::transferInfo() const
|
QVariantMap BluetoothUploadJob::transferInfo() const
|
||||||
{
|
{
|
||||||
QVariantMap ret;
|
QVariantMap ret;
|
||||||
ret["uuid"] = mTransferUuid.toString().mid(1, 36);
|
ret[QStringLiteral("uuid")] = mTransferUuid.toString().mid(1, 36);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothUploadJob::start()
|
void BluetoothUploadJob::start()
|
||||||
{
|
{
|
||||||
connect(mServer, &QBluetoothServer::newConnection, this, &BluetoothUploadJob::newConnection);
|
connect(mServer, &QBluetoothServer::newConnection, this, &BluetoothUploadJob::newConnection);
|
||||||
mServiceInfo = mServer->listen(mTransferUuid, "KDE Connect Transfer Job");
|
mServiceInfo = mServer->listen(mTransferUuid, QStringLiteral("KDE Connect Transfer Job"));
|
||||||
Q_ASSERT(mServiceInfo.isValid());
|
Q_ASSERT(mServiceInfo.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ void CompositeUploadJob::startNextSubJob()
|
||||||
//TODO: Create a copy of the networkpacket that can be re-injected if sending via lan fails?
|
//TODO: Create a copy of the networkpacket that can be re-injected if sending via lan fails?
|
||||||
NetworkPacket np = m_currentJob->getNetworkPacket();
|
NetworkPacket np = m_currentJob->getNetworkPacket();
|
||||||
np.setPayload(nullptr, np.payloadSize());
|
np.setPayload(nullptr, np.payloadSize());
|
||||||
np.setPayloadTransferInfo({{"port", m_port}});
|
np.setPayloadTransferInfo({{QStringLiteral("port"), m_port}});
|
||||||
np.set<int>(QStringLiteral("numberOfFiles"), m_totalJobs);
|
np.set<int>(QStringLiteral("numberOfFiles"), m_totalJobs);
|
||||||
np.set<quint64>(QStringLiteral("totalPayloadSize"), m_totalPayloadSize);
|
np.set<quint64>(QStringLiteral("totalPayloadSize"), m_totalPayloadSize);
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void CompositeUploadJob::slotResult(KJob *job) {
|
||||||
startNextSubJob();
|
startNextSubJob();
|
||||||
} else {
|
} else {
|
||||||
QPair<QString, QString> field2;
|
QPair<QString, QString> field2;
|
||||||
field2.first = QString("Files");
|
field2.first = QStringLiteral("Files");
|
||||||
field2.second = i18np("Sent 1 file", "Sent %1 files", m_totalJobs);
|
field2.second = i18np("Sent 1 file", "Sent %1 files", 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()),
|
||||||
{ QString(), QString() }, field2
|
{ QString(), QString() }, field2
|
||||||
|
|
|
@ -179,7 +179,7 @@ void LanDeviceLink::setPairStatus(PairStatus status)
|
||||||
if (status == Paired) {
|
if (status == Paired) {
|
||||||
Q_ASSERT(KdeConnectConfig::instance()->trustedDevices().contains(deviceId()));
|
Q_ASSERT(KdeConnectConfig::instance()->trustedDevices().contains(deviceId()));
|
||||||
Q_ASSERT(!m_socketLineReader->peerCertificate().isNull());
|
Q_ASSERT(!m_socketLineReader->peerCertificate().isNull());
|
||||||
KdeConnectConfig::instance()->setDeviceProperty(deviceId(), QStringLiteral("certificate"), m_socketLineReader->peerCertificate().toPem());
|
KdeConnectConfig::instance()->setDeviceProperty(deviceId(), QStringLiteral("certificate"), QString::fromLatin1(m_socketLineReader->peerCertificate().toPem().data()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ void LanLinkProvider::onStart()
|
||||||
if (!success) {
|
if (!success) {
|
||||||
QAbstractSocket::SocketError sockErr = m_udpSocket.error();
|
QAbstractSocket::SocketError sockErr = m_udpSocket.error();
|
||||||
// Refer to https://doc.qt.io/qt-5/qabstractsocket.html#SocketError-enum to decode socket error number
|
// Refer to https://doc.qt.io/qt-5/qabstractsocket.html#SocketError-enum to decode socket error number
|
||||||
QString errorMessage = QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(sockErr);
|
QString errorMessage = QString::fromLatin1(QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(sockErr));
|
||||||
qCritical(KDECONNECT_CORE)
|
qCritical(KDECONNECT_CORE)
|
||||||
<< QLatin1String("Failed to bind UDP socket on port")
|
<< QLatin1String("Failed to bind UDP socket on port")
|
||||||
<< m_udpListenPort
|
<< m_udpListenPort
|
||||||
|
|
|
@ -81,7 +81,7 @@ bool LanPairingHandler::requestPairing()
|
||||||
return acceptPairing();
|
return acceptPairing();
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", true}});
|
NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), true}});
|
||||||
const bool success = deviceLink()->sendPacket(np);
|
const bool success = deviceLink()->sendPacket(np);
|
||||||
if (success) {
|
if (success) {
|
||||||
setInternalPairStatus(Requested);
|
setInternalPairStatus(Requested);
|
||||||
|
@ -91,7 +91,7 @@ bool LanPairingHandler::requestPairing()
|
||||||
|
|
||||||
bool LanPairingHandler::acceptPairing()
|
bool LanPairingHandler::acceptPairing()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", true}});
|
NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), true}});
|
||||||
bool success = deviceLink()->sendPacket(np);
|
bool success = deviceLink()->sendPacket(np);
|
||||||
if (success) {
|
if (success) {
|
||||||
setInternalPairStatus(Paired);
|
setInternalPairStatus(Paired);
|
||||||
|
@ -101,20 +101,20 @@ bool LanPairingHandler::acceptPairing()
|
||||||
|
|
||||||
void LanPairingHandler::rejectPairing()
|
void LanPairingHandler::rejectPairing()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", false}});
|
NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), false}});
|
||||||
deviceLink()->sendPacket(np);
|
deviceLink()->sendPacket(np);
|
||||||
setInternalPairStatus(NotPaired);
|
setInternalPairStatus(NotPaired);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LanPairingHandler::unpair() {
|
void LanPairingHandler::unpair() {
|
||||||
NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", false}});
|
NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), false}});
|
||||||
deviceLink()->sendPacket(np);
|
deviceLink()->sendPacket(np);
|
||||||
setInternalPairStatus(NotPaired);
|
setInternalPairStatus(NotPaired);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LanPairingHandler::pairingTimeout()
|
void LanPairingHandler::pairingTimeout()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", false}});
|
NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), false}});
|
||||||
deviceLink()->sendPacket(np);
|
deviceLink()->sendPacket(np);
|
||||||
setInternalPairStatus(NotPaired); //Will emit the change as well
|
setInternalPairStatus(NotPaired); //Will emit the change as well
|
||||||
Q_EMIT pairingError(i18n("Timed out"));
|
Q_EMIT pairingError(i18n("Timed out"));
|
||||||
|
|
|
@ -38,7 +38,7 @@ void Server::incomingConnection(qintptr socketDescriptor) {
|
||||||
if (serverSocket->setSocketDescriptor(socketDescriptor)) {
|
if (serverSocket->setSocketDescriptor(socketDescriptor)) {
|
||||||
addPendingConnection(serverSocket);
|
addPendingConnection(serverSocket);
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "setSocketDescriptor failed " + serverSocket->errorString();
|
qWarning() << "setSocketDescriptor failed" << serverSocket->errorString();
|
||||||
delete serverSocket;
|
delete serverSocket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace DbusHelper {
|
||||||
|
|
||||||
void filterNonExportableCharacters(QString& s)
|
void filterNonExportableCharacters(QString& s)
|
||||||
{
|
{
|
||||||
static QRegExp regexp("[^A-Za-z0-9_]", Qt::CaseSensitive, QRegExp::Wildcard);
|
static QRegExp regexp(QStringLiteral("[^A-Za-z0-9_]"), Qt::CaseSensitive, QRegExp::Wildcard);
|
||||||
s.replace(regexp,QLatin1String("_"));
|
s.replace(regexp,QLatin1String("_"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -540,7 +540,7 @@ QString Device::encryptionInfo() const
|
||||||
|
|
||||||
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) {
|
for (int i = 2; i<localSha1.size(); i += 3) {
|
||||||
localSha1.insert(i, ':'); // Improve readability
|
localSha1.insert(i, QStringLiteral(":")); // Improve readability
|
||||||
}
|
}
|
||||||
result += i18n("SHA1 fingerprint of your device certificate is: %1\n", localSha1);
|
result += i18n("SHA1 fingerprint of your device certificate is: %1\n", localSha1);
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ QString Device::encryptionInfo() const
|
||||||
QSslCertificate remoteCertificate = QSslCertificate(QByteArray(remotePem.c_str(), (int)remotePem.size()));
|
QSslCertificate remoteCertificate = QSslCertificate(QByteArray(remotePem.c_str(), (int)remotePem.size()));
|
||||||
QString remoteSha1 = QString::fromLatin1(remoteCertificate.digest(digestAlgorithm).toHex());
|
QString remoteSha1 = QString::fromLatin1(remoteCertificate.digest(digestAlgorithm).toHex());
|
||||||
for (int i = 2; i < remoteSha1.size(); i += 3) {
|
for (int i = 2; i < remoteSha1.size(); i += 3) {
|
||||||
remoteSha1.insert(i, ':'); // Improve readability
|
remoteSha1.insert(i, QStringLiteral(":")); // Improve readability
|
||||||
}
|
}
|
||||||
result += i18n("SHA1 fingerprint of remote device certificate is: %1\n", remoteSha1);
|
result += i18n("SHA1 fingerprint of remote device certificate is: %1\n", remoteSha1);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString dbusPath() const { return "/modules/kdeconnect/devices/"+id(); }
|
QString dbusPath() const { return QStringLiteral("/modules/kdeconnect/devices/") + id(); }
|
||||||
QString type() const;
|
QString type() const;
|
||||||
QString iconName() const;
|
QString iconName() const;
|
||||||
QString statusIconName() const;
|
QString statusIconName() const;
|
||||||
|
|
|
@ -88,11 +88,11 @@ QString KdeConnectConfig::name()
|
||||||
{
|
{
|
||||||
QString username;
|
QString username;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
username = qgetenv("USERNAME");
|
username = QString::fromLatin1(qgetenv("USERNAME"));
|
||||||
#else
|
#else
|
||||||
username = qgetenv("USER");
|
username = QString::fromLatin1(qgetenv("USER"));
|
||||||
#endif
|
#endif
|
||||||
QString defaultName = username + '@' + QHostInfo::localHostName();
|
QString defaultName = username + QStringLiteral("@") + QHostInfo::localHostName();
|
||||||
QString name = d->m_config->value(QStringLiteral("name"), defaultName).toString();
|
QString name = d->m_config->value(QStringLiteral("name"), defaultName).toString();
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ void KdeConnectConfig::loadPrivateKey()
|
||||||
bool needsToGenerateKey = false;
|
bool needsToGenerateKey = false;
|
||||||
if (privKey.exists() && privKey.open(QIODevice::ReadOnly)) {
|
if (privKey.exists() && privKey.open(QIODevice::ReadOnly)) {
|
||||||
QCA::ConvertResult result;
|
QCA::ConvertResult result;
|
||||||
d->m_privateKey = QCA::PrivateKey::fromPEM(privKey.readAll(), QCA::SecureArray(), &result);
|
d->m_privateKey = QCA::PrivateKey::fromPEM(QString::fromLatin1(privKey.readAll()), QCA::SecureArray(), &result);
|
||||||
if (result != QCA::ConvertResult::ConvertGood) {
|
if (result != QCA::ConvertResult::ConvertGood) {
|
||||||
qCWarning(KDECONNECT_CORE) << "Private key from" << keyPath << "is not valid";
|
qCWarning(KDECONNECT_CORE) << "Private key from" << keyPath << "is not valid";
|
||||||
needsToGenerateKey = true;
|
needsToGenerateKey = true;
|
||||||
|
|
|
@ -42,8 +42,8 @@ KdeConnectPluginConfig::KdeConnectPluginConfig(const QString& deviceId, const QS
|
||||||
|
|
||||||
d->m_config = new QSettings(d->m_configDir.absoluteFilePath(QStringLiteral("config")), QSettings::IniFormat);
|
d->m_config = new QSettings(d->m_configDir.absoluteFilePath(QStringLiteral("config")), QSettings::IniFormat);
|
||||||
|
|
||||||
d->m_signal = QDBusMessage::createSignal("/kdeconnect/"+deviceId+"/"+pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"));
|
d->m_signal = QDBusMessage::createSignal(QStringLiteral("/kdeconnect/") + deviceId + QStringLiteral("/") + pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"));
|
||||||
DbusHelper::sessionBus().connect(QLatin1String(""), "/kdeconnect/"+deviceId+"/"+pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"), this, SLOT(slotConfigChanged()));
|
DbusHelper::sessionBus().connect(QLatin1String(""), QStringLiteral("/kdeconnect/") + deviceId + QStringLiteral("/") + pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"), this, SLOT(slotConfigChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
KdeConnectPluginConfig::~KdeConnectPluginConfig()
|
KdeConnectPluginConfig::~KdeConnectPluginConfig()
|
||||||
|
|
|
@ -46,7 +46,7 @@ QVariant DBusResponseWaiter::waitForReply(QVariant variant) const
|
||||||
if (call->isError())
|
if (call->isError())
|
||||||
{
|
{
|
||||||
qWarning() << "error:" << call->error();
|
qWarning() << "error:" << call->error();
|
||||||
return QVariant("error");
|
return QVariant(QStringLiteral("error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusMessage reply = call->reply();
|
QDBusMessage reply = call->reply();
|
||||||
|
|
|
@ -92,7 +92,7 @@ void SendFileItemAction::sendFile()
|
||||||
const QList<QUrl> urls = sender()->property("urls").value<QList<QUrl>>();
|
const QList<QUrl> urls = sender()->property("urls").value<QList<QUrl>>();
|
||||||
QString id = sender()->property("id").toString();
|
QString id = sender()->property("id").toString();
|
||||||
for (const QUrl& url : urls) {
|
for (const QUrl& url : urls) {
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+id+"/share", QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl"));
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl"));
|
||||||
msg.setArguments(QVariantList() << url.toString());
|
msg.setArguments(QVariantList() << url.toString());
|
||||||
DbusHelper::sessionBus().call(msg);
|
DbusHelper::sessionBus().call(msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
||||||
, m_device(device)
|
, m_device(device)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
setIcon(QIcon(QStandardPaths::locate(QStandardPaths::AppDataLocation, "icons/hicolor/scalable/status/"+device->iconName()+".svg")));
|
setIcon(QIcon(QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("icons/hicolor/scalable/status/") + device->iconName() + QStringLiteral(".svg"))));
|
||||||
#else
|
#else
|
||||||
setIcon(QIcon::fromTheme(device->iconName()));
|
setIcon(QIcon::fromTheme(device->iconName()));
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,7 +79,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
||||||
|
|
||||||
auto battery = new BatteryAction(device);
|
auto battery = new BatteryAction(device);
|
||||||
addAction(battery);
|
addAction(battery);
|
||||||
setWhenAvailable(device->hasPlugin("kdeconnect_battery"),
|
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_battery")),
|
||||||
[battery](bool available) { battery->setVisible(available); }
|
[battery](bool available) { battery->setVisible(available); }
|
||||||
, this);
|
, this);
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
||||||
sftpIface->startBrowsing();
|
sftpIface->startBrowsing();
|
||||||
sftpIface->deleteLater();
|
sftpIface->deleteLater();
|
||||||
});
|
});
|
||||||
setWhenAvailable(device->hasPlugin("kdeconnect_sftp"), [browse](bool available) { browse->setVisible(available); }, this);
|
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_sftp")), [browse](bool available) { browse->setVisible(available); }, this);
|
||||||
|
|
||||||
auto findDevice = addAction(QIcon::fromTheme(QStringLiteral("irc-voice")), i18n("Ring device"));
|
auto findDevice = addAction(QIcon::fromTheme(QStringLiteral("irc-voice")), i18n("Ring device"));
|
||||||
connect(findDevice, &QAction::triggered, device, [device](){
|
connect(findDevice, &QAction::triggered, device, [device](){
|
||||||
|
@ -97,7 +97,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
||||||
iface->ring();
|
iface->ring();
|
||||||
iface->deleteLater();
|
iface->deleteLater();
|
||||||
});
|
});
|
||||||
setWhenAvailable(device->hasPlugin("kdeconnect_findmyphone"), [findDevice](bool available) { findDevice->setVisible(available); }, this);
|
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_findmyphone")), [findDevice](bool available) { findDevice->setVisible(available); }, this);
|
||||||
|
|
||||||
auto sendFile = addAction(QIcon::fromTheme(QStringLiteral("document-share")), i18n("Send file"));
|
auto sendFile = addAction(QIcon::fromTheme(QStringLiteral("document-share")), i18n("Send file"));
|
||||||
connect(sendFile, &QAction::triggered, device, [device, this](){
|
connect(sendFile, &QAction::triggered, device, [device, this](){
|
||||||
|
@ -105,11 +105,11 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
||||||
if (url.isEmpty())
|
if (url.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device->id()+"/share", QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl"));
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device->id() + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl"));
|
||||||
msg.setArguments(QVariantList() << url.toString());
|
msg.setArguments(QVariantList() << url.toString());
|
||||||
DbusHelper::sessionBus().call(msg);
|
DbusHelper::sessionBus().call(msg);
|
||||||
});
|
});
|
||||||
setWhenAvailable(device->hasPlugin("kdeconnect_share"), [sendFile](bool available) { sendFile->setVisible(available); }, this);
|
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_share")), [sendFile](bool available) { sendFile->setVisible(available); }, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "deviceindicator.moc"
|
#include "deviceindicator.moc"
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
KAboutData about("kdeconnect-indicator",
|
KAboutData about(QStringLiteral("kdeconnect-indicator"),
|
||||||
i18n("KDE Connect Indicator"),
|
i18n("KDE Connect Indicator"),
|
||||||
QStringLiteral(KDECONNECT_VERSION_STRING),
|
QStringLiteral(KDECONNECT_VERSION_STRING),
|
||||||
i18n("KDE Connect Indicator tool"),
|
i18n("KDE Connect Indicator tool"),
|
||||||
|
@ -55,7 +55,7 @@ int main(int argc, char** argv)
|
||||||
KAboutData::setApplicationData(about);
|
KAboutData::setApplicationData(about);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QProcess::startDetached("kdeconnectd.exe");
|
QProcess::startDetached(QStringLiteral("kdeconnectd.exe"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
@ -81,7 +81,7 @@ int main(int argc, char** argv)
|
||||||
auto configure = menu->addAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure..."));
|
auto configure = menu->addAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure..."));
|
||||||
QObject::connect(configure, &QAction::triggered, configure, [](){
|
QObject::connect(configure, &QAction::triggered, configure, [](){
|
||||||
KCMultiDialog* dialog = new KCMultiDialog;
|
KCMultiDialog* dialog = new KCMultiDialog;
|
||||||
dialog->addModule("kcm_kdeconnect");
|
dialog->addModule(QStringLiteral("kcm_kdeconnect"));
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->show();
|
dialog->show();
|
||||||
});
|
});
|
||||||
|
@ -129,7 +129,7 @@ int main(int argc, char** argv)
|
||||||
#else
|
#else
|
||||||
KStatusNotifierItem systray;
|
KStatusNotifierItem systray;
|
||||||
systray.setIconByName(QStringLiteral("kdeconnectindicatordark"));
|
systray.setIconByName(QStringLiteral("kdeconnectindicatordark"));
|
||||||
systray.setToolTip(QStringLiteral("kdeconnect"), "KDE Connect", "KDE Connect");
|
systray.setToolTip(QStringLiteral("kdeconnect"), QStringLiteral("KDE Connect"), QStringLiteral("KDE Connect"));
|
||||||
systray.setCategory(KStatusNotifierItem::Communications);
|
systray.setCategory(KStatusNotifierItem::Communications);
|
||||||
systray.setStatus(KStatusNotifierItem::Passive);
|
systray.setStatus(KStatusNotifierItem::Passive);
|
||||||
systray.setStandardActionsEnabled(false);
|
systray.setStandardActionsEnabled(false);
|
||||||
|
|
|
@ -24,14 +24,14 @@
|
||||||
|
|
||||||
|
|
||||||
ConversationMessage::ConversationMessage(const QVariantMap& args)
|
ConversationMessage::ConversationMessage(const QVariantMap& args)
|
||||||
: m_eventField(args["event"].toInt()),
|
: m_eventField(args[QStringLiteral("event")].toInt()),
|
||||||
m_body(args["body"].toString()),
|
m_body(args[QStringLiteral("body")].toString()),
|
||||||
m_address(args["address"].toString()),
|
m_address(args[QStringLiteral("address")].toString()),
|
||||||
m_date(args["date"].toLongLong()),
|
m_date(args[QStringLiteral("date")].toLongLong()),
|
||||||
m_type(args["type"].toInt()),
|
m_type(args[QStringLiteral("type")].toInt()),
|
||||||
m_read(args["read"].toInt()),
|
m_read(args[QStringLiteral("read")].toInt()),
|
||||||
m_threadID(args["thread_id"].toLongLong()),
|
m_threadID(args[QStringLiteral("thread_id")].toLongLong()),
|
||||||
m_uID(args["_id"].toInt())
|
m_uID(args[QStringLiteral("_id")].toInt())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,14 +81,14 @@ ConversationMessage& ConversationMessage::operator=(const ConversationMessage& o
|
||||||
QVariantMap ConversationMessage::toVariant() const
|
QVariantMap ConversationMessage::toVariant() const
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
{"event", m_eventField},
|
{QStringLiteral("event"), m_eventField},
|
||||||
{"body", m_body},
|
{QStringLiteral("body"), m_body},
|
||||||
{"address", m_address},
|
{QStringLiteral("address"), m_address},
|
||||||
{"date", m_date},
|
{QStringLiteral("date"), m_date},
|
||||||
{"type", m_type},
|
{QStringLiteral("type"), m_type},
|
||||||
{"read", m_read},
|
{QStringLiteral("read"), m_read},
|
||||||
{"thread_id", m_threadID},
|
{QStringLiteral("thread_id"), m_threadID},
|
||||||
{"_id", m_uID},
|
{QStringLiteral("_id"), m_uID},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ DaemonDbusInterface::~DaemonDbusInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceDbusInterface::DeviceDbusInterface(const QString& id, QObject* parent)
|
DeviceDbusInterface::DeviceDbusInterface(const QString& id, QObject* parent)
|
||||||
: OrgKdeKdeconnectDeviceInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, DbusHelper::sessionBus(), parent)
|
: OrgKdeKdeconnectDeviceInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DbusHelper::sessionBus(), parent)
|
||||||
, m_id(id)
|
, m_id(id)
|
||||||
{
|
{
|
||||||
connect(this, &OrgKdeKdeconnectDeviceInterface::trustedChanged, this, &DeviceDbusInterface::trustedChangedProxy);
|
connect(this, &OrgKdeKdeconnectDeviceInterface::trustedChanged, this, &DeviceDbusInterface::trustedChangedProxy);
|
||||||
|
@ -63,12 +63,12 @@ QString DeviceDbusInterface::id() const
|
||||||
|
|
||||||
void DeviceDbusInterface::pluginCall(const QString& plugin, const QString& method)
|
void DeviceDbusInterface::pluginCall(const QString& plugin, const QString& method)
|
||||||
{
|
{
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+id()+'/'+plugin, "org.kde.kdeconnect.device."+plugin, method);
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") +id() + QStringLiteral("/") + plugin, QStringLiteral("org.kde.kdeconnect.device.") + plugin, method);
|
||||||
DbusHelper::sessionBus().asyncCall(msg);
|
DbusHelper::sessionBus().asyncCall(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceBatteryDbusInterface::DeviceBatteryDbusInterface(const QString& id, QObject* parent)
|
DeviceBatteryDbusInterface::DeviceBatteryDbusInterface(const QString& id, QObject* parent)
|
||||||
: OrgKdeKdeconnectDeviceBatteryInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, DbusHelper::sessionBus(), parent)
|
: OrgKdeKdeconnectDeviceBatteryInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ DeviceBatteryDbusInterface::~DeviceBatteryDbusInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString& id, QObject* parent)
|
DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString& id, QObject* parent)
|
||||||
: OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, DbusHelper::sessionBus(), parent)
|
: OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ DeviceNotificationsDbusInterface::~DeviceNotificationsDbusInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationDbusInterface::NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent)
|
NotificationDbusInterface::NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent)
|
||||||
: OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+deviceId+"/notifications/"+notificationId, DbusHelper::sessionBus(), parent)
|
: OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/notifications/") + notificationId, DbusHelper::sessionBus(), parent)
|
||||||
, id(notificationId)
|
, id(notificationId)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ NotificationDbusInterface::~NotificationDbusInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceConversationsDbusInterface::DeviceConversationsDbusInterface(const QString& deviceId, QObject* parent)
|
DeviceConversationsDbusInterface::DeviceConversationsDbusInterface(const QString& deviceId, QObject* parent)
|
||||||
: OrgKdeKdeconnectDeviceConversationsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+deviceId, DbusHelper::sessionBus(), parent)
|
: OrgKdeKdeconnectDeviceConversationsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId, DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ DeviceConversationsDbusInterface::~DeviceConversationsDbusInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
SftpDbusInterface::SftpDbusInterface(const QString& id, QObject* parent)
|
SftpDbusInterface::SftpDbusInterface(const QString& id, QObject* parent)
|
||||||
: OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/sftp", DbusHelper::sessionBus(), parent)
|
: OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/sftp"), DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ SftpDbusInterface::~SftpDbusInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
MprisDbusInterface::MprisDbusInterface(const QString& id, QObject* parent)
|
MprisDbusInterface::MprisDbusInterface(const QString& id, QObject* parent)
|
||||||
: OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/mprisremote", DbusHelper::sessionBus(), parent)
|
: OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/mprisremote"), DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
connect(this, &OrgKdeKdeconnectDeviceMprisremoteInterface::propertiesChanged, this, &MprisDbusInterface::propertiesChangedProxy);
|
connect(this, &OrgKdeKdeconnectDeviceMprisremoteInterface::propertiesChanged, this, &MprisDbusInterface::propertiesChangedProxy);
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ MprisDbusInterface::~MprisDbusInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteControlDbusInterface::RemoteControlDbusInterface(const QString& id, QObject* parent)
|
RemoteControlDbusInterface::RemoteControlDbusInterface(const QString& id, QObject* parent)
|
||||||
: OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/remotecontrol", DbusHelper::sessionBus(), parent)
|
: OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/remotecontrol"), DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ RemoteControlDbusInterface::~RemoteControlDbusInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
LockDeviceDbusInterface::LockDeviceDbusInterface(const QString& id, QObject* parent)
|
LockDeviceDbusInterface::LockDeviceDbusInterface(const QString& id, QObject* parent)
|
||||||
: OrgKdeKdeconnectDeviceLockdeviceInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/lockdevice", DbusHelper::sessionBus(), parent)
|
: OrgKdeKdeconnectDeviceLockdeviceInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/lockdevice"), DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
connect(this, &OrgKdeKdeconnectDeviceLockdeviceInterface::lockedChanged, this, &LockDeviceDbusInterface::lockedChangedProxy);
|
connect(this, &OrgKdeKdeconnectDeviceLockdeviceInterface::lockedChanged, this, &LockDeviceDbusInterface::lockedChangedProxy);
|
||||||
Q_ASSERT(isValid());
|
Q_ASSERT(isValid());
|
||||||
|
@ -154,7 +154,7 @@ LockDeviceDbusInterface::~LockDeviceDbusInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString& deviceId, QObject* parent):
|
FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString& deviceId, QObject* parent):
|
||||||
OrgKdeKdeconnectDeviceFindmyphoneInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/findmyphone", DbusHelper::sessionBus(), parent)
|
OrgKdeKdeconnectDeviceFindmyphoneInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/findmyphone"), DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,14 +163,14 @@ FindMyPhoneDeviceDbusInterface::~FindMyPhoneDeviceDbusInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteCommandsDbusInterface::RemoteCommandsDbusInterface(const QString& deviceId, QObject* parent):
|
RemoteCommandsDbusInterface::RemoteCommandsDbusInterface(const QString& deviceId, QObject* parent):
|
||||||
OrgKdeKdeconnectDeviceRemotecommandsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/remotecommands", DbusHelper::sessionBus(), parent)
|
OrgKdeKdeconnectDeviceRemotecommandsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotecommands"), DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteCommandsDbusInterface::~RemoteCommandsDbusInterface() = default;
|
RemoteCommandsDbusInterface::~RemoteCommandsDbusInterface() = default;
|
||||||
|
|
||||||
RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId, QObject* parent):
|
RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId, QObject* parent):
|
||||||
OrgKdeKdeconnectDeviceRemotekeyboardInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/remotekeyboard", DbusHelper::sessionBus(), parent)
|
OrgKdeKdeconnectDeviceRemotekeyboardInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotekeyboard"), DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
connect(this, &OrgKdeKdeconnectDeviceRemotekeyboardInterface::remoteStateChanged, this, &RemoteKeyboardDbusInterface::remoteStateChanged);
|
connect(this, &OrgKdeKdeconnectDeviceRemotekeyboardInterface::remoteStateChanged, this, &RemoteKeyboardDbusInterface::remoteStateChanged);
|
||||||
}
|
}
|
||||||
|
@ -178,20 +178,20 @@ RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId
|
||||||
RemoteKeyboardDbusInterface::~RemoteKeyboardDbusInterface() = default;
|
RemoteKeyboardDbusInterface::~RemoteKeyboardDbusInterface() = default;
|
||||||
|
|
||||||
SmsDbusInterface::SmsDbusInterface(const QString& deviceId, QObject* parent):
|
SmsDbusInterface::SmsDbusInterface(const QString& deviceId, QObject* parent):
|
||||||
OrgKdeKdeconnectDeviceSmsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/sms", DbusHelper::sessionBus(), parent)
|
OrgKdeKdeconnectDeviceSmsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sms"), DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SmsDbusInterface::~SmsDbusInterface() = default;
|
SmsDbusInterface::~SmsDbusInterface() = default;
|
||||||
|
|
||||||
ShareDbusInterface::ShareDbusInterface(const QString& deviceId, QObject* parent):
|
ShareDbusInterface::ShareDbusInterface(const QString& deviceId, QObject* parent):
|
||||||
OrgKdeKdeconnectDeviceShareInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/share", DbusHelper::sessionBus(), parent)
|
OrgKdeKdeconnectDeviceShareInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/share"), DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ShareDbusInterface::~ShareDbusInterface() = default;
|
ShareDbusInterface::~ShareDbusInterface() = default;
|
||||||
|
|
||||||
RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString& deviceId, QObject* parent):
|
RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString& deviceId, QObject* parent):
|
||||||
OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/remotesystemvolume", DbusHelper::sessionBus(), parent)
|
OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"), DbusHelper::sessionBus(), parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
KAboutData about("kdeconnect-settings",
|
KAboutData about(QStringLiteral("kdeconnect-settings"),
|
||||||
i18n("KDE Connect Settings"),
|
i18n("KDE Connect Settings"),
|
||||||
QStringLiteral(KDECONNECT_VERSION_STRING),
|
QStringLiteral(KDECONNECT_VERSION_STRING),
|
||||||
i18n("KDE Connect Settings"),
|
i18n("KDE Connect Settings"),
|
||||||
|
@ -37,7 +37,7 @@ int main(int argc, char** argv)
|
||||||
KAboutData::setApplicationData(about);
|
KAboutData::setApplicationData(about);
|
||||||
|
|
||||||
KCMultiDialog* dialog = new KCMultiDialog;
|
KCMultiDialog* dialog = new KCMultiDialog;
|
||||||
dialog->addModule("kcm_kdeconnect");
|
dialog->addModule(QStringLiteral("kcm_kdeconnect"));
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->show();
|
dialog->show();
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ void KioKdeconnect::listAllDevices()
|
||||||
|
|
||||||
if (!interface.hasPlugin(QStringLiteral("kdeconnect_sftp"))) continue;
|
if (!interface.hasPlugin(QStringLiteral("kdeconnect_sftp"))) continue;
|
||||||
|
|
||||||
const QString path = QStringLiteral("kdeconnect://").append(deviceId).append("/");
|
const QString path = QStringLiteral("kdeconnect://").append(deviceId).append(QStringLiteral("/"));
|
||||||
const QString name = interface.name();
|
const QString name = interface.name();
|
||||||
const QString icon = QStringLiteral("kdeconnect");
|
const QString icon = QStringLiteral("kdeconnect");
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ BatteryPlugin::BatteryPlugin(QObject* parent, const QVariantList& args)
|
||||||
|
|
||||||
void BatteryPlugin::connected()
|
void BatteryPlugin::connected()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_BATTERY_REQUEST, {{"request",true}});
|
NetworkPacket np(PACKET_TYPE_BATTERY_REQUEST, {{QStringLiteral("request"),true}});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ ClipboardPlugin::ClipboardPlugin(QObject* parent, const QVariantList& args)
|
||||||
|
|
||||||
void ClipboardPlugin::propagateClipboard(const QString& content)
|
void ClipboardPlugin::propagateClipboard(const QString& content)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_CLIPBOARD, {{"content", content}});
|
NetworkPacket np(PACKET_TYPE_CLIPBOARD, {{QStringLiteral("content"), content}});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_CONTACTS, "kdeconnect.plugin.contacts")
|
||||||
ContactsPlugin::ContactsPlugin(QObject* parent, const QVariantList& args) :
|
ContactsPlugin::ContactsPlugin(QObject* parent, const QVariantList& args) :
|
||||||
KdeConnectPlugin(parent, args)
|
KdeConnectPlugin(parent, args)
|
||||||
{
|
{
|
||||||
vcardsPath = QString(*vcardsLocation).append("/kdeconnect-").append(device()->id());
|
vcardsPath = QString(*vcardsLocation).append(QStringLiteral("/kdeconnect-").append(device()->id()));
|
||||||
|
|
||||||
// Register custom types with dbus
|
// Register custom types with dbus
|
||||||
qRegisterMetaType<uID>("uID");
|
qRegisterMetaType<uID>("uID");
|
||||||
|
@ -85,7 +85,7 @@ void ContactsPlugin::synchronizeRemoteWithLocal()
|
||||||
|
|
||||||
bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np)
|
bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np)
|
||||||
{
|
{
|
||||||
if (!np.has("uids")) {
|
if (!np.has(QStringLiteral("uids"))) {
|
||||||
qCDebug(KDECONNECT_PLUGIN_CONTACTS) << "handleResponseUIDsTimestamps:"
|
qCDebug(KDECONNECT_PLUGIN_CONTACTS) << "handleResponseUIDsTimestamps:"
|
||||||
<< "Malformed packet does not have uids key";
|
<< "Malformed packet does not have uids key";
|
||||||
return false;
|
return false;
|
||||||
|
@ -95,9 +95,9 @@ bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np)
|
||||||
|
|
||||||
// Get a list of all file info in this directory
|
// Get a list of all file info in this directory
|
||||||
// Clean out IDs returned from the remote. Anything leftover should be deleted
|
// Clean out IDs returned from the remote. Anything leftover should be deleted
|
||||||
QFileInfoList localVCards = vcardsDir.entryInfoList( { "*.vcard", "*.vcf" });
|
QFileInfoList localVCards = vcardsDir.entryInfoList({QStringLiteral("*.vcard"), QStringLiteral("*.vcf")});
|
||||||
|
|
||||||
const QStringList& uIDs = np.get<QStringList>("uids");
|
const QStringList& uIDs = np.get<QStringList>(QStringLiteral("uids"));
|
||||||
|
|
||||||
// Check local storage for the contacts:
|
// Check local storage for the contacts:
|
||||||
// If the contact is not found in local storage, request its vcard be sent
|
// If the contact is not found in local storage, request its vcard be sent
|
||||||
|
@ -130,7 +130,7 @@ bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np)
|
||||||
while (!fileReadStream.atEnd()) {
|
while (!fileReadStream.atEnd()) {
|
||||||
fileReadStream >> line;
|
fileReadStream >> line;
|
||||||
// TODO: Check that the saved ID is the same as the one we were expecting. This requires parsing the VCard
|
// TODO: Check that the saved ID is the same as the one we were expecting. This requires parsing the VCard
|
||||||
if (!line.startsWith("X-KDECONNECT-TIMESTAMP:")) {
|
if (!line.startsWith(QStringLiteral("X-KDECONNECT-TIMESTAMP:"))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QStringList parts = line.split(QLatin1Char(':'));
|
QStringList parts = line.split(QLatin1Char(':'));
|
||||||
|
@ -158,14 +158,14 @@ bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np)
|
||||||
|
|
||||||
bool ContactsPlugin::handleResponseVCards(const NetworkPacket& np)
|
bool ContactsPlugin::handleResponseVCards(const NetworkPacket& np)
|
||||||
{
|
{
|
||||||
if (!np.has("uids")) {
|
if (!np.has(QStringLiteral("uids"))) {
|
||||||
qCDebug(KDECONNECT_PLUGIN_CONTACTS)
|
qCDebug(KDECONNECT_PLUGIN_CONTACTS)
|
||||||
<< "handleResponseVCards:" << "Malformed packet does not have uids key";
|
<< "handleResponseVCards:" << "Malformed packet does not have uids key";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir vcardsDir(vcardsPath);
|
QDir vcardsDir(vcardsPath);
|
||||||
const QStringList& uIDs = np.get<QStringList>("uids");
|
const QStringList& uIDs = np.get<QStringList>(QStringLiteral("uids"));
|
||||||
|
|
||||||
// Loop over all IDs, extract the VCard from the packet and write the file
|
// Loop over all IDs, extract the VCard from the packet and write the file
|
||||||
for (const auto& ID : uIDs) {
|
for (const auto& ID : uIDs) {
|
||||||
|
@ -200,14 +200,14 @@ bool ContactsPlugin::sendRequestWithIDs(const QString& packetType, const uIDList
|
||||||
{
|
{
|
||||||
NetworkPacket np(packetType);
|
NetworkPacket np(packetType);
|
||||||
|
|
||||||
np.set<uIDList_t>("uids", uIDs);
|
np.set<uIDList_t>(QStringLiteral("uids"), uIDs);
|
||||||
bool success = sendPacket(np);
|
bool success = sendPacket(np);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ContactsPlugin::dbusPath() const
|
QString ContactsPlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/contacts";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/contacts");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "contactsplugin.moc"
|
#include "contactsplugin.moc"
|
||||||
|
|
|
@ -74,7 +74,7 @@ class QObject;
|
||||||
*/
|
*/
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(
|
Q_GLOBAL_STATIC_WITH_ARGS(
|
||||||
QString, vcardsLocation,
|
QString, vcardsLocation,
|
||||||
(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + ("/kpeoplevcard")))
|
(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QString::fromLatin1("/kpeoplevcard")))
|
||||||
|
|
||||||
#define VCARD_EXTENSION QStringLiteral(".vcf")
|
#define VCARD_EXTENSION QStringLiteral(".vcf")
|
||||||
#define METADATA_EXTENSION QStringLiteral(".meta")
|
#define METADATA_EXTENSION QStringLiteral(".meta")
|
||||||
|
|
|
@ -50,7 +50,7 @@ void FindMyPhonePlugin::ring()
|
||||||
|
|
||||||
QString FindMyPhonePlugin::dbusPath() const
|
QString FindMyPhonePlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/findmyphone";
|
return QString::fromLatin1("/modules/kdeconnect/devices/") + device()->id() + QString::fromLatin1("/findmyphone");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "findmyphoneplugin.moc"
|
#include "findmyphoneplugin.moc"
|
||||||
|
|
|
@ -123,7 +123,7 @@ bool FindThisDevicePlugin::receivePacket(const NetworkPacket& np)
|
||||||
|
|
||||||
QString FindThisDevicePlugin::dbusPath() const
|
QString FindThisDevicePlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/findthisdevice";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/findthisdevice");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "findthisdeviceplugin.moc"
|
#include "findthisdeviceplugin.moc"
|
||||||
|
|
|
@ -52,7 +52,7 @@ bool LockDevicePlugin::isLocked() const
|
||||||
}
|
}
|
||||||
void LockDevicePlugin::setLocked(bool locked)
|
void LockDevicePlugin::setLocked(bool locked)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{"setLocked", locked}});
|
NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{QStringLiteral("setLocked"), locked}});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ bool LockDevicePlugin::receivePacket(const NetworkPacket & np)
|
||||||
sendState = true;
|
sendState = true;
|
||||||
}
|
}
|
||||||
if (sendState) {
|
if (sendState) {
|
||||||
NetworkPacket np(PACKET_TYPE_LOCK, QVariantMap {{"isLocked", QVariant::fromValue<bool>(iface()->GetActive())}});
|
NetworkPacket np(PACKET_TYPE_LOCK, QVariantMap {{QStringLiteral("isLocked"), QVariant::fromValue<bool>(iface()->GetActive())}});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,13 +91,13 @@ OrgFreedesktopScreenSaverInterface* LockDevicePlugin::iface()
|
||||||
|
|
||||||
void LockDevicePlugin::connected()
|
void LockDevicePlugin::connected()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{"requestLocked", QVariant()}});
|
NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{QStringLiteral("requestLocked"), QVariant()}});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LockDevicePlugin::dbusPath() const
|
QString LockDevicePlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/lockdevice";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/lockdevice");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "lockdeviceplugin.moc"
|
#include "lockdeviceplugin.moc"
|
||||||
|
|
|
@ -24,6 +24,6 @@ class MprisControlPlugin
|
||||||
void connected() override {}
|
void connected() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString playername = "Media Player";
|
const QString playername = PLAYERNAME;
|
||||||
};
|
};
|
||||||
#endif //MPRISCONTROLPLUGINWIN_H
|
#endif //MPRISCONTROLPLUGINWIN_H
|
|
@ -128,8 +128,8 @@ void MprisControlPlugin::seeked(qlonglong position){
|
||||||
const QString& playerName = it.key();
|
const QString& playerName = it.key();
|
||||||
|
|
||||||
NetworkPacket np(PACKET_TYPE_MPRIS, {
|
NetworkPacket np(PACKET_TYPE_MPRIS, {
|
||||||
{"pos", position/1000}, //Send milis instead of nanos
|
{QStringLiteral("pos"), position/1000}, //Send milis instead of nanos
|
||||||
{"player", playerName}
|
{QStringLiteral("player"), playerName}
|
||||||
});
|
});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ bool MprisControlPlugin::sendAlbumArt(const NetworkPacket& np)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Only support sending local files
|
//Only support sending local files
|
||||||
if (playerAlbumArtUrl.scheme() != "file") {
|
if (playerAlbumArtUrl.scheme() != QStringLiteral("file")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ void MprisControlPlugin::mprisPlayerMetadataToNetworkPacket(NetworkPacket& np, c
|
||||||
QString albumArtUrl = nowPlayingMap[QStringLiteral("mpris:artUrl")].toString();
|
QString albumArtUrl = nowPlayingMap[QStringLiteral("mpris:artUrl")].toString();
|
||||||
QString nowPlaying = title;
|
QString nowPlaying = title;
|
||||||
if (!artist.isEmpty()) {
|
if (!artist.isEmpty()) {
|
||||||
nowPlaying = artist + " - " + title;
|
nowPlaying = artist + QStringLiteral(" - ") + title;
|
||||||
}
|
}
|
||||||
np.set(QStringLiteral("title"), title);
|
np.set(QStringLiteral("title"), title);
|
||||||
np.set(QStringLiteral("artist"), artist);
|
np.set(QStringLiteral("artist"), artist);
|
||||||
|
|
|
@ -84,30 +84,30 @@ long MprisRemotePlugin::position() const
|
||||||
|
|
||||||
QString MprisRemotePlugin::dbusPath() const
|
QString MprisRemotePlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/mprisremote";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/mprisremote");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MprisRemotePlugin::requestPlayerStatus(const QString& player)
|
void MprisRemotePlugin::requestPlayerStatus(const QString& player)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
||||||
{"player", player},
|
{QStringLiteral("player"), player},
|
||||||
{"requestNowPlaying", true},
|
{QStringLiteral("requestNowPlaying"), true},
|
||||||
{"requestVolume", true}}
|
{QStringLiteral("requestVolume"), true}}
|
||||||
);
|
);
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MprisRemotePlugin::requestPlayerList()
|
void MprisRemotePlugin::requestPlayerList()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {{"requestPlayerList", true}});
|
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {{QStringLiteral("requestPlayerList"), true}});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MprisRemotePlugin::sendAction(const QString& action)
|
void MprisRemotePlugin::sendAction(const QString& action)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
||||||
{"player", m_currentPlayer},
|
{QStringLiteral("player"), m_currentPlayer},
|
||||||
{"action", action}
|
{QStringLiteral("action"), action}
|
||||||
});
|
});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
@ -115,16 +115,16 @@ void MprisRemotePlugin::sendAction(const QString& action)
|
||||||
void MprisRemotePlugin::seek(int offset) const
|
void MprisRemotePlugin::seek(int offset) const
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
||||||
{"player", m_currentPlayer},
|
{QStringLiteral("player"), m_currentPlayer},
|
||||||
{"Seek", offset}});
|
{QStringLiteral("Seek"), offset}});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MprisRemotePlugin::setVolume(int volume)
|
void MprisRemotePlugin::setVolume(int volume)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
||||||
{"player", m_currentPlayer},
|
{QStringLiteral("player"), m_currentPlayer},
|
||||||
{"setVolume",volume}
|
{QStringLiteral("setVolume"), volume}
|
||||||
});
|
});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
@ -132,8 +132,8 @@ void MprisRemotePlugin::setVolume(int volume)
|
||||||
void MprisRemotePlugin::setPosition(int position)
|
void MprisRemotePlugin::setPosition(int position)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
||||||
{"player", m_currentPlayer},
|
{QStringLiteral("player"), m_currentPlayer},
|
||||||
{"SetPosition", position}
|
{QStringLiteral("SetPosition"), position}
|
||||||
});
|
});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,9 @@ Notification::Notification(const NetworkPacket& np, const Device* device, QObjec
|
||||||
//Make a own directory for each user so noone can see each others icons
|
//Make a own directory for each user so noone can see each others icons
|
||||||
QString username;
|
QString username;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
username = qgetenv("USERNAME");
|
username = QString::fromLatin1(qgetenv("USERNAME"));
|
||||||
#else
|
#else
|
||||||
username = qgetenv("USER");
|
username = QString::fromLatin1(qgetenv("USER"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_imagesDir = QDir::temp().absoluteFilePath(QStringLiteral("kdeconnect_") + username);
|
m_imagesDir = QDir::temp().absoluteFilePath(QStringLiteral("kdeconnect_") + username);
|
||||||
|
@ -122,7 +122,7 @@ void Notification::createKNotification(const NetworkPacket& np)
|
||||||
} else if (m_text.isEmpty()) {
|
} else if (m_text.isEmpty()) {
|
||||||
m_notification->setText(escapedTitle);
|
m_notification->setText(escapedTitle);
|
||||||
} else {
|
} else {
|
||||||
m_notification->setText(escapedTitle + ": " + escapedText);
|
m_notification->setText(escapedTitle + QStringLiteral(": ") + escapedText);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if KNOTIFICATIONS_VERSION >= QT_VERSION_CHECK(5, 57, 0)
|
#if KNOTIFICATIONS_VERSION >= QT_VERSION_CHECK(5, 57, 0)
|
||||||
|
|
|
@ -118,7 +118,7 @@ void NotificationsDbusInterface::addNotification(Notification* noti)
|
||||||
m_notifications[publicId] = noti;
|
m_notifications[publicId] = noti;
|
||||||
m_internalIdToPublicId[internalId] = publicId;
|
m_internalIdToPublicId[internalId] = publicId;
|
||||||
|
|
||||||
DbusHelper::sessionBus().registerObject(m_device->dbusPath()+"/notifications/"+publicId, noti, QDBusConnection::ExportScriptableContents);
|
DbusHelper::sessionBus().registerObject(m_device->dbusPath() + QStringLiteral("/notifications/") + publicId, noti, QDBusConnection::ExportScriptableContents);
|
||||||
Q_EMIT notificationPosted(publicId);
|
Q_EMIT notificationPosted(publicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ void NotificationsDbusInterface::sendReply(const QString& replyId, const QString
|
||||||
void NotificationsDbusInterface::sendAction(const QString& key, const QString& action)
|
void NotificationsDbusInterface::sendAction(const QString& key, const QString& action)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_NOTIFICATION_ACTION);
|
NetworkPacket np(PACKET_TYPE_NOTIFICATION_ACTION);
|
||||||
np.set<QString>("key", key);
|
np.set<QString>(QStringLiteral("key"), key);
|
||||||
np.set<QString>("action", action);
|
np.set<QString>(QStringLiteral("action"), action);
|
||||||
m_plugin->sendPacket(np);
|
m_plugin->sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ NotificationsPlugin::NotificationsPlugin(QObject* parent, const QVariantList& ar
|
||||||
|
|
||||||
void NotificationsPlugin::connected()
|
void NotificationsPlugin::connected()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{"request", true}});
|
NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{QStringLiteral("request"), true}});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ SendReplyDialog::SendReplyDialog(const QString& originalMessage, const QString&
|
||||||
, m_ui(new Ui::SendReplyDialog)
|
, m_ui(new Ui::SendReplyDialog)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->textView->setText(topicName + ": \n" + originalMessage);
|
m_ui->textView->setText(topicName + QStringLiteral(": \n") + originalMessage);
|
||||||
|
|
||||||
auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok);
|
auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
button->setText(i18n("Send"));
|
button->setText(i18n("Send"));
|
||||||
|
|
|
@ -65,7 +65,7 @@ void PhotoPlugin::requestPhoto(const QString& fileName)
|
||||||
|
|
||||||
QString PhotoPlugin::dbusPath() const
|
QString PhotoPlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/photo";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/photo");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "photoplugin.moc"
|
#include "photoplugin.moc"
|
||||||
|
|
|
@ -71,7 +71,7 @@ void PingPlugin::sendPing(const QString& customMessage)
|
||||||
|
|
||||||
QString PingPlugin::dbusPath() const
|
QString PingPlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/ping";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/ping");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "pingplugin.moc"
|
#include "pingplugin.moc"
|
||||||
|
|
|
@ -55,13 +55,13 @@ bool RemoteCommandsPlugin::receivePacket(const NetworkPacket& np)
|
||||||
|
|
||||||
void RemoteCommandsPlugin::connected()
|
void RemoteCommandsPlugin::connected()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{"requestCommandList", true}});
|
NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{QStringLiteral("requestCommandList"), true}});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteCommandsPlugin::dbusPath() const
|
QString RemoteCommandsPlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/remotecommands";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotecommands");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteCommandsPlugin::setCommands(const QByteArray& cmds)
|
void RemoteCommandsPlugin::setCommands(const QByteArray& cmds)
|
||||||
|
@ -74,13 +74,13 @@ void RemoteCommandsPlugin::setCommands(const QByteArray& cmds)
|
||||||
|
|
||||||
void RemoteCommandsPlugin::triggerCommand(const QString& key)
|
void RemoteCommandsPlugin::triggerCommand(const QString& key)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{ "key", key }});
|
NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{QStringLiteral("key"), key }});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteCommandsPlugin::editCommands()
|
void RemoteCommandsPlugin::editCommands()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{ "setup", true }});
|
NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{QStringLiteral("setup"), true }});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ RemoteControlPlugin::~RemoteControlPlugin()
|
||||||
void RemoteControlPlugin::moveCursor(const QPoint &p)
|
void RemoteControlPlugin::moveCursor(const QPoint &p)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {
|
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {
|
||||||
{"dx", p.x()},
|
{QStringLiteral("dx"), p.x()},
|
||||||
{"dy", p.y()}
|
{QStringLiteral("dy"), p.y()}
|
||||||
});
|
});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ void RemoteControlPlugin::sendCommand(const QString &name, bool val)
|
||||||
|
|
||||||
QString RemoteControlPlugin::dbusPath() const
|
QString RemoteControlPlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/remotecontrol";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotecontrol");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "remotecontrolplugin.moc"
|
#include "remotecontrolplugin.moc"
|
||||||
|
|
|
@ -79,22 +79,22 @@ RemoteKeyboardPlugin::~RemoteKeyboardPlugin()
|
||||||
bool RemoteKeyboardPlugin::receivePacket(const NetworkPacket& np)
|
bool RemoteKeyboardPlugin::receivePacket(const NetworkPacket& np)
|
||||||
{
|
{
|
||||||
if (np.type() == PACKET_TYPE_MOUSEPAD_ECHO) {
|
if (np.type() == PACKET_TYPE_MOUSEPAD_ECHO) {
|
||||||
if (!np.has("isAck") || !np.has("key")) {
|
if (!np.has(QStringLiteral("isAck")) || !np.has(QStringLiteral("key"))) {
|
||||||
qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Invalid packet of type"
|
qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Invalid packet of type"
|
||||||
<< PACKET_TYPE_MOUSEPAD_ECHO;
|
<< PACKET_TYPE_MOUSEPAD_ECHO;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Received keypress" << np;
|
// qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Received keypress" << np;
|
||||||
Q_EMIT keyPressReceived(np.get<QString>("key"),
|
Q_EMIT keyPressReceived(np.get<QString>(QStringLiteral("key")),
|
||||||
np.get<int>("specialKey", 0),
|
np.get<int>(QStringLiteral("specialKey"), 0),
|
||||||
np.get<int>("shift", false),
|
np.get<int>(QStringLiteral("shift"), false),
|
||||||
np.get<int>("ctrl", false),
|
np.get<int>(QStringLiteral("ctrl"), false),
|
||||||
np.get<int>("alt", false));
|
np.get<int>(QStringLiteral("alt"), 0));
|
||||||
return true;
|
return true;
|
||||||
} else if (np.type() == PACKET_TYPE_MOUSEPAD_KEYBOARDSTATE) {
|
} else if (np.type() == PACKET_TYPE_MOUSEPAD_KEYBOARDSTATE) {
|
||||||
// qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Received keyboardstate" << np;
|
// qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Received keyboardstate" << np;
|
||||||
if (m_remoteState != np.get<bool>("state")) {
|
if (m_remoteState != np.get<bool>(QStringLiteral("state"))) {
|
||||||
m_remoteState = np.get<bool>("state");
|
m_remoteState = np.get<bool>(QStringLiteral("state"));
|
||||||
Q_EMIT remoteStateChanged(m_remoteState);
|
Q_EMIT remoteStateChanged(m_remoteState);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -107,23 +107,23 @@ void RemoteKeyboardPlugin::sendKeyPress(const QString& key, int specialKey,
|
||||||
bool alt, bool sendAck) const
|
bool alt, bool sendAck) const
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {
|
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {
|
||||||
{"key", key},
|
{QStringLiteral("key"), key},
|
||||||
{"specialKey", specialKey},
|
{QStringLiteral("specialKey"), specialKey},
|
||||||
{"shift", shift},
|
{QStringLiteral("shift"), shift},
|
||||||
{"ctrl", ctrl},
|
{QStringLiteral("ctrl"), ctrl},
|
||||||
{"alt", alt},
|
{QStringLiteral("alt"), alt},
|
||||||
{"sendAck", sendAck}
|
{QStringLiteral("sendAck"), sendAck}
|
||||||
});
|
});
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteKeyboardPlugin::sendQKeyEvent(const QVariantMap& keyEvent, bool sendAck) const
|
void RemoteKeyboardPlugin::sendQKeyEvent(const QVariantMap& keyEvent, bool sendAck) const
|
||||||
{
|
{
|
||||||
if (!keyEvent.contains("key"))
|
if (!keyEvent.contains(QStringLiteral("key")))
|
||||||
return;
|
return;
|
||||||
int k = translateQtKey(keyEvent.value("key").toInt());
|
int k = translateQtKey(keyEvent.value(QStringLiteral("key")).toInt());
|
||||||
int modifiers = keyEvent.value("modifiers").toInt();
|
int modifiers = keyEvent.value(QStringLiteral("modifiers")).toInt();
|
||||||
sendKeyPress(keyEvent.value("text").toString(), k,
|
sendKeyPress(keyEvent.value(QStringLiteral("text")).toString(), k,
|
||||||
modifiers & Qt::ShiftModifier,
|
modifiers & Qt::ShiftModifier,
|
||||||
modifiers & Qt::ControlModifier,
|
modifiers & Qt::ControlModifier,
|
||||||
modifiers & Qt::AltModifier,
|
modifiers & Qt::AltModifier,
|
||||||
|
@ -141,7 +141,7 @@ void RemoteKeyboardPlugin::connected()
|
||||||
|
|
||||||
QString RemoteKeyboardPlugin::dbusPath() const
|
QString RemoteKeyboardPlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/remotekeyboard";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotekeyboard");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ QByteArray RemoteSystemVolumePlugin::sinks()
|
||||||
|
|
||||||
QString RemoteSystemVolumePlugin::dbusPath() const
|
QString RemoteSystemVolumePlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/remotesystemvolume";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotesystemvolume");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "remotesystemvolumeplugin.moc"
|
#include "remotesystemvolumeplugin.moc"
|
||||||
|
|
|
@ -79,7 +79,7 @@ bool RunCommandPlugin::receivePacket(const NetworkPacket& np)
|
||||||
qCInfo(KDECONNECT_PLUGIN_RUNCOMMAND) << "Running:" << COMMAND << ARGS << commandJson[QStringLiteral("command")].toString();
|
qCInfo(KDECONNECT_PLUGIN_RUNCOMMAND) << "Running:" << COMMAND << ARGS << commandJson[QStringLiteral("command")].toString();
|
||||||
QProcess::startDetached(QStringLiteral(COMMAND), QStringList()<< QStringLiteral(ARGS) << commandJson[QStringLiteral("command")].toString());
|
QProcess::startDetached(QStringLiteral(COMMAND), QStringList()<< QStringLiteral(ARGS) << commandJson[QStringLiteral("command")].toString());
|
||||||
return true;
|
return true;
|
||||||
} else if (np.has("setup")) {
|
} else if (np.has(QStringLiteral("setup"))) {
|
||||||
QProcess::startDetached(QStringLiteral("kcmshell5"), {QStringLiteral("kdeconnect"), QStringLiteral("--args"), QString(device()->id() + QStringLiteral(":kdeconnect_runcommand")) });
|
QProcess::startDetached(QStringLiteral("kcmshell5"), {QStringLiteral("kdeconnect"), QStringLiteral("--args"), QString(device()->id() + QStringLiteral(":kdeconnect_runcommand")) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ void RunCommandPlugin::connected()
|
||||||
void RunCommandPlugin::sendConfig()
|
void RunCommandPlugin::sendConfig()
|
||||||
{
|
{
|
||||||
QString commands = config()->get<QString>(QStringLiteral("commands"),QStringLiteral("{}"));
|
QString commands = config()->get<QString>(QStringLiteral("commands"),QStringLiteral("{}"));
|
||||||
NetworkPacket np(PACKET_TYPE_RUNCOMMAND, {{"commandList", commands}});
|
NetworkPacket np(PACKET_TYPE_RUNCOMMAND, {{QStringLiteral("commandList"), commands}});
|
||||||
|
|
||||||
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0)
|
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0)
|
||||||
np.set<bool>(QStringLiteral("canAddCommand"), true);
|
np.set<bool>(QStringLiteral("canAddCommand"), true);
|
||||||
|
|
|
@ -44,7 +44,7 @@ ScreensaverInhibitPlugin::ScreensaverInhibitPlugin(QObject* parent, const QVaria
|
||||||
|
|
||||||
QDBusMessage reply = inhibitInterface.call(INHIBIT_METHOD, QStringLiteral("org.kde.kdeconnect.daemon"), i18n("Phone is connected"));
|
QDBusMessage reply = inhibitInterface.call(INHIBIT_METHOD, QStringLiteral("org.kde.kdeconnect.daemon"), i18n("Phone is connected"));
|
||||||
|
|
||||||
if (reply.errorMessage() != nullptr) {
|
if (!reply.errorMessage().isEmpty()) {
|
||||||
qCDebug(KDECONNECT_PLUGIN_SCREENSAVERINHIBIT) << "Unable to inhibit the screensaver: " << reply.errorMessage();
|
qCDebug(KDECONNECT_PLUGIN_SCREENSAVERINHIBIT) << "Unable to inhibit the screensaver: " << reply.errorMessage();
|
||||||
inhibitCookie = 0;
|
inhibitCookie = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -65,7 +65,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin)
|
||||||
QDBusInterface iface(QStringLiteral("org.freedesktop.DBus"), QStringLiteral("/org/freedesktop/DBus"),
|
QDBusInterface iface(QStringLiteral("org.freedesktop.DBus"), QStringLiteral("/org/freedesktop/DBus"),
|
||||||
QStringLiteral("org.freedesktop.DBus"));
|
QStringLiteral("org.freedesktop.DBus"));
|
||||||
iface.call(QStringLiteral("AddMatch"),
|
iface.call(QStringLiteral("AddMatch"),
|
||||||
"interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'");
|
QStringLiteral("interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'"));
|
||||||
|
|
||||||
setTranslatedAppName();
|
setTranslatedAppName();
|
||||||
loadApplications();
|
loadApplications();
|
||||||
|
@ -79,7 +79,7 @@ NotificationsListener::~NotificationsListener()
|
||||||
QDBusInterface iface(QStringLiteral("org.freedesktop.DBus"), QStringLiteral("/org/freedesktop/DBus"),
|
QDBusInterface iface(QStringLiteral("org.freedesktop.DBus"), QStringLiteral("/org/freedesktop/DBus"),
|
||||||
QStringLiteral("org.freedesktop.DBus"));
|
QStringLiteral("org.freedesktop.DBus"));
|
||||||
QDBusMessage res = iface.call(QStringLiteral("RemoveMatch"),
|
QDBusMessage res = iface.call(QStringLiteral("RemoveMatch"),
|
||||||
"interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'");
|
QStringLiteral("interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'"));
|
||||||
DbusHelper::sessionBus().unregisterObject(QStringLiteral("/org/freedesktop/Notifications"));
|
DbusHelper::sessionBus().unregisterObject(QStringLiteral("/org/freedesktop/Notifications"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ QSharedPointer<QIODevice> NotificationsListener::iconForIconName(const QString&
|
||||||
// try falling back to hicolor theme:
|
// try falling back to hicolor theme:
|
||||||
KIconTheme hicolor(QStringLiteral("hicolor"));
|
KIconTheme hicolor(QStringLiteral("hicolor"));
|
||||||
if (hicolor.isValid()) {
|
if (hicolor.isValid()) {
|
||||||
iconPath = hicolor.iconPath(iconName + ".png", size, KIconLoader::MatchBest);
|
iconPath = hicolor.iconPath(iconName + QStringLiteral(".png"), size, KIconLoader::MatchBest);
|
||||||
//qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Found non-png icon in default theme trying fallback to hicolor:" << iconPath;
|
//qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Found non-png icon in default theme trying fallback to hicolor:" << iconPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,10 +242,10 @@ uint NotificationsListener::Notify(const QString& appName, uint replacesId,
|
||||||
|
|
||||||
//qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Sending notification from" << appName << ":" <<ticker << "; appIcon=" << appIcon;
|
//qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Sending notification from" << appName << ":" <<ticker << "; appIcon=" << appIcon;
|
||||||
NetworkPacket np(PACKET_TYPE_NOTIFICATION, {
|
NetworkPacket np(PACKET_TYPE_NOTIFICATION, {
|
||||||
{"id", QString::number(replacesId > 0 ? replacesId : ++id)},
|
{QStringLiteral("id"), QString::number(replacesId > 0 ? replacesId : ++id)},
|
||||||
{"appName", appName},
|
{QStringLiteral("appName"), appName},
|
||||||
{"ticker", ticker},
|
{QStringLiteral("ticker"), ticker},
|
||||||
{"isClearable", timeout == 0}
|
{QStringLiteral("isClearable"), timeout == 0}
|
||||||
}); // KNotifications are persistent if
|
}); // KNotifications are persistent if
|
||||||
// timeout == 0, for other notifications
|
// timeout == 0, for other notifications
|
||||||
// clearability is pointless
|
// clearability is pointless
|
||||||
|
|
|
@ -83,8 +83,8 @@ void Mounter::onPackageReceived(const NetworkPacket& np)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (np.has("errorMessage")) {
|
if (np.has(QStringLiteral("errorMessage"))) {
|
||||||
Q_EMIT failed(np.get<QString>("errorMessage", ""));
|
Q_EMIT failed(np.get<QString>(QStringLiteral("errorMessage")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ void Mounter::onPackageReceived(const NetworkPacket& np)
|
||||||
const QString program = QStringLiteral("sshfs");
|
const QString program = QStringLiteral("sshfs");
|
||||||
|
|
||||||
QString path;
|
QString path;
|
||||||
if (np.has(QStringLiteral("multiPaths"))) path = '/';
|
if (np.has(QStringLiteral("multiPaths"))) path = QStringLiteral("/");
|
||||||
else path = np.get<QString>(QStringLiteral("path"));
|
else path = np.get<QString>(QStringLiteral("path"));
|
||||||
|
|
||||||
QHostAddress addr = m_sftp->device()->getLocalIpAddress();
|
QHostAddress addr = m_sftp->device()->getLocalIpAddress();
|
||||||
|
@ -136,7 +136,7 @@ void Mounter::onPackageReceived(const NetworkPacket& np)
|
||||||
<< QStringLiteral("-s") // This fixes a bug where file chunks are sent out of order and get corrupted on reception
|
<< QStringLiteral("-s") // This fixes a bug where file chunks are sent out of order and get corrupted on reception
|
||||||
<< QStringLiteral("-f")
|
<< QStringLiteral("-f")
|
||||||
<< QStringLiteral("-F") << QStringLiteral("/dev/null") //Do not use ~/.ssh/config
|
<< QStringLiteral("-F") << QStringLiteral("/dev/null") //Do not use ~/.ssh/config
|
||||||
<< QStringLiteral("-o") << "IdentityFile=" + KdeConnectConfig::instance()->privateKeyPath()
|
<< QStringLiteral("-o") << QStringLiteral("IdentityFile=") + KdeConnectConfig::instance()->privateKeyPath()
|
||||||
<< QStringLiteral("-o") << QStringLiteral("StrictHostKeyChecking=no") //Do not ask for confirmation because it is not a known host
|
<< QStringLiteral("-o") << QStringLiteral("StrictHostKeyChecking=no") //Do not ask for confirmation because it is not a known host
|
||||||
<< QStringLiteral("-o") << QStringLiteral("UserKnownHostsFile=/dev/null") //Prevent storing as a known host
|
<< QStringLiteral("-o") << QStringLiteral("UserKnownHostsFile=/dev/null") //Prevent storing as a known host
|
||||||
<< QStringLiteral("-o") << QStringLiteral("HostKeyAlgorithms=+ssh-dss") //https://bugs.kde.org/show_bug.cgi?id=351725
|
<< QStringLiteral("-o") << QStringLiteral("HostKeyAlgorithms=+ssh-dss") //https://bugs.kde.org/show_bug.cgi?id=351725
|
||||||
|
@ -218,7 +218,7 @@ void Mounter::onMountTimeout()
|
||||||
|
|
||||||
void Mounter::start()
|
void Mounter::start()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_SFTP_REQUEST, {{"startBrowsing", true}});
|
NetworkPacket np(PACKET_TYPE_SFTP_REQUEST, {{QStringLiteral("startBrowsing"), true}});
|
||||||
m_sftp->sendPacket(np);
|
m_sftp->sendPacket(np);
|
||||||
|
|
||||||
m_connectTimer.start();
|
m_connectTimer.start();
|
||||||
|
|
|
@ -68,14 +68,14 @@ void SftpPlugin::addToDolphin()
|
||||||
{
|
{
|
||||||
removeFromDolphin();
|
removeFromDolphin();
|
||||||
|
|
||||||
QUrl kioUrl("kdeconnect://"+deviceId+"/");
|
QUrl kioUrl(QStringLiteral("kdeconnect://") + deviceId + QStringLiteral("/"));
|
||||||
d->m_placesModel.addPlace(device()->name(), kioUrl, QStringLiteral("kdeconnect"));
|
d->m_placesModel.addPlace(device()->name(), kioUrl, QStringLiteral("kdeconnect"));
|
||||||
qCDebug(KDECONNECT_PLUGIN_SFTP) << "add to dolphin";
|
qCDebug(KDECONNECT_PLUGIN_SFTP) << "add to dolphin";
|
||||||
}
|
}
|
||||||
|
|
||||||
void SftpPlugin::removeFromDolphin()
|
void SftpPlugin::removeFromDolphin()
|
||||||
{
|
{
|
||||||
QUrl kioUrl("kdeconnect://"+deviceId+"/");
|
QUrl kioUrl(QStringLiteral("kdeconnect://") + deviceId + QStringLiteral("/"));
|
||||||
QModelIndex index = d->m_placesModel.closestItem(kioUrl);
|
QModelIndex index = d->m_placesModel.closestItem(kioUrl);
|
||||||
while (index.row() != -1) {
|
while (index.row() != -1) {
|
||||||
d->m_placesModel.removePlace(index);
|
d->m_placesModel.removePlace(index);
|
||||||
|
@ -129,14 +129,14 @@ bool SftpPlugin::startBrowsing()
|
||||||
{
|
{
|
||||||
if (mountAndWait()) {
|
if (mountAndWait()) {
|
||||||
//return new KRun(QUrl::fromLocalFile(mountPoint()), 0);
|
//return new KRun(QUrl::fromLocalFile(mountPoint()), 0);
|
||||||
return new KRun(QUrl("kdeconnect://"+deviceId), nullptr);
|
return new KRun(QUrl(QStringLiteral("kdeconnect://") + deviceId), nullptr);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SftpPlugin::receivePacket(const NetworkPacket& np)
|
bool SftpPlugin::receivePacket(const NetworkPacket& np)
|
||||||
{
|
{
|
||||||
if (!(fields_c - np.body().keys().toSet()).isEmpty() && !np.has("errorMessage")) {
|
if (!(fields_c - np.body().keys().toSet()).isEmpty() && !np.has(QStringLiteral("errorMessage"))) {
|
||||||
// packet is invalid
|
// packet is invalid
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ bool SftpPlugin::receivePacket(const NetworkPacket& np)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
remoteDirectories.insert(mountPoint(), i18n("All files"));
|
remoteDirectories.insert(mountPoint(), i18n("All files"));
|
||||||
remoteDirectories.insert(mountPoint() + "/DCIM/Camera", i18n("Camera pictures"));
|
remoteDirectories.insert(mountPoint() + QStringLiteral("/DCIM/Camera"), i18n("Camera pictures"));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
|
|
||||||
bool receivePacket(const NetworkPacket& np) override;
|
bool receivePacket(const NetworkPacket& np) override;
|
||||||
void connected() override {}
|
void connected() override {}
|
||||||
QString dbusPath() const override { return "/modules/kdeconnect/devices/" + deviceId + "/sftp"; }
|
QString dbusPath() const override { return QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sftp"); }
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void packetReceived(const NetworkPacket& np);
|
void packetReceived(const NetworkPacket& np);
|
||||||
|
|
|
@ -69,9 +69,9 @@ QUrl SharePlugin::getFileDestination(const QString filename) const
|
||||||
{
|
{
|
||||||
const QUrl dir = destinationDir().adjusted(QUrl::StripTrailingSlash);
|
const QUrl dir = destinationDir().adjusted(QUrl::StripTrailingSlash);
|
||||||
QUrl destination(dir);
|
QUrl destination(dir);
|
||||||
destination.setPath(dir.path() + '/' + filename, QUrl::DecodedMode);
|
destination.setPath(dir.path() + QStringLiteral("/") + filename, QUrl::DecodedMode);
|
||||||
if (destination.isLocalFile() && QFile::exists(destination.toLocalFile())) {
|
if (destination.isLocalFile() && QFile::exists(destination.toLocalFile())) {
|
||||||
destination.setPath(dir.path() + '/' + KIO::suggestName(dir, filename), QUrl::DecodedMode);
|
destination.setPath(dir.path() + QStringLiteral("/") + KIO::suggestName(dir, filename), QUrl::DecodedMode);
|
||||||
}
|
}
|
||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ bool SharePlugin::receivePacket(const NetworkPacket& np)
|
||||||
}
|
}
|
||||||
|
|
||||||
FileTransferJob* job = np.createPayloadTransferJob(destination);
|
FileTransferJob* job = np.createPayloadTransferJob(destination);
|
||||||
job->setOriginName(device()->name() + ": " + filename);
|
job->setOriginName(device()->name() + QStringLiteral(": ") + filename);
|
||||||
connect(job, &KJob::result, this, [this, dateModified] (KJob* job) -> void { finished(job, dateModified); });
|
connect(job, &KJob::result, this, [this, dateModified] (KJob* job) -> void { finished(job, dateModified); });
|
||||||
m_compositeJob->addSubjob(job);
|
m_compositeJob->addSubjob(job);
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ bool SharePlugin::receivePacket(const NetworkPacket& np)
|
||||||
if (defaultApp == QLatin1String("org.kde.kate") || defaultApp == QLatin1String("org.kde.kwrite")) {
|
if (defaultApp == QLatin1String("org.kde.kate") || defaultApp == QLatin1String("org.kde.kwrite")) {
|
||||||
QProcess* proc = new QProcess();
|
QProcess* proc = new QProcess();
|
||||||
connect(proc, SIGNAL(finished(int)), proc, SLOT(deleteLater()));
|
connect(proc, SIGNAL(finished(int)), proc, SLOT(deleteLater()));
|
||||||
proc->start(defaultApp.section('.', 2,2), QStringList(QStringLiteral("--stdin")));
|
proc->start(defaultApp.section(QStringLiteral("."), 2,2), QStringList(QStringLiteral("--stdin")));
|
||||||
proc->write(text.toUtf8());
|
proc->write(text.toUtf8());
|
||||||
proc->closeWriteChannel();
|
proc->closeWriteChannel();
|
||||||
} else {
|
} else {
|
||||||
|
@ -232,7 +232,7 @@ void SharePlugin::openFile(const QUrl& url)
|
||||||
|
|
||||||
QString SharePlugin::dbusPath() const
|
QString SharePlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/share";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/share");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "shareplugin.moc"
|
#include "shareplugin.moc"
|
||||||
|
|
|
@ -61,9 +61,9 @@ bool SmsPlugin::receivePacket(const NetworkPacket& np)
|
||||||
void SmsPlugin::sendSms(const QString& phoneNumber, const QString& messageBody)
|
void SmsPlugin::sendSms(const QString& phoneNumber, const QString& messageBody)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_SMS_REQUEST, {
|
NetworkPacket np(PACKET_TYPE_SMS_REQUEST, {
|
||||||
{"sendSms", true},
|
{QStringLiteral("sendSms"), true},
|
||||||
{"phoneNumber", phoneNumber},
|
{QStringLiteral("phoneNumber"), phoneNumber},
|
||||||
{"messageBody", messageBody}
|
{QStringLiteral("messageBody"), messageBody}
|
||||||
});
|
});
|
||||||
qCDebug(KDECONNECT_PLUGIN_SMS) << "Dispatching SMS send request to remote";
|
qCDebug(KDECONNECT_PLUGIN_SMS) << "Dispatching SMS send request to remote";
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
|
@ -79,7 +79,7 @@ void SmsPlugin::requestAllConversations()
|
||||||
void SmsPlugin::requestConversation (const qint64& conversationID) const
|
void SmsPlugin::requestConversation (const qint64& conversationID) const
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_SMS_REQUEST_CONVERSATION);
|
NetworkPacket np(PACKET_TYPE_SMS_REQUEST_CONVERSATION);
|
||||||
np.set("threadID", conversationID);
|
np.set(QStringLiteral("threadID"), conversationID);
|
||||||
|
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ void SmsPlugin::forwardToTelepathy(const ConversationMessage& message)
|
||||||
|
|
||||||
bool SmsPlugin::handleBatchMessages(const NetworkPacket& np)
|
bool SmsPlugin::handleBatchMessages(const NetworkPacket& np)
|
||||||
{
|
{
|
||||||
const auto messages = np.get<QVariantList>("messages");
|
const auto messages = np.get<QVariantList>(QStringLiteral("messages"));
|
||||||
QList<ConversationMessage> messagesList;
|
QList<ConversationMessage> messagesList;
|
||||||
messagesList.reserve(messages.count());
|
messagesList.reserve(messages.count());
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ bool SmsPlugin::handleBatchMessages(const NetworkPacket& np)
|
||||||
|
|
||||||
QString SmsPlugin::dbusPath() const
|
QString SmsPlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/sms";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/sms");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "smsplugin.moc"
|
#include "smsplugin.moc"
|
||||||
|
|
|
@ -93,11 +93,11 @@ void SystemvolumePlugin::sendSinkList() {
|
||||||
});
|
});
|
||||||
|
|
||||||
QJsonObject sinkObject {
|
QJsonObject sinkObject {
|
||||||
{"name", sink->name()},
|
{QStringLiteral("name"), sink->name()},
|
||||||
{"muted", sink->isMuted()},
|
{QStringLiteral("muted"), sink->isMuted()},
|
||||||
{"description", sink->description()},
|
{QStringLiteral("description"), sink->description()},
|
||||||
{"volume", sink->volume()},
|
{QStringLiteral("volume"), sink->volume()},
|
||||||
{"maxVolume", PulseAudioQt::normalVolume()}
|
{QStringLiteral("maxVolume"), PulseAudioQt::normalVolume()}
|
||||||
};
|
};
|
||||||
|
|
||||||
array.append(sinkObject);
|
array.append(sinkObject);
|
||||||
|
|
|
@ -270,8 +270,8 @@ bool SystemvolumePlugin::sendSinkList()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QJsonObject sinkObject;
|
QJsonObject sinkObject;
|
||||||
sinkObject.insert("name", name);
|
sinkObject.insert(QStringLiteral("name"), name);
|
||||||
sinkObject.insert("description", desc);
|
sinkObject.insert(QStringLiteral("description"), desc);
|
||||||
|
|
||||||
hr = device->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, (void **)&endpoint);
|
hr = device->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, (void **)&endpoint);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
|
@ -285,9 +285,9 @@ bool SystemvolumePlugin::sendSinkList()
|
||||||
endpoint->GetMasterVolumeLevelScalar(&volume);
|
endpoint->GetMasterVolumeLevelScalar(&volume);
|
||||||
endpoint->GetMute(&muted);
|
endpoint->GetMute(&muted);
|
||||||
|
|
||||||
sinkObject.insert("muted", (bool)muted);
|
sinkObject.insert(QStringLiteral("muted"), (bool)muted);
|
||||||
sinkObject.insert("volume", (qint64)(volume * 100));
|
sinkObject.insert(QStringLiteral("volume"), (qint64)(volume * 100));
|
||||||
sinkObject.insert("maxVolume", (qint64)100);
|
sinkObject.insert(QStringLiteral("maxVolume"), (qint64)100);
|
||||||
|
|
||||||
// Register Callback
|
// Register Callback
|
||||||
callback = new CAudioEndpointVolumeCallback(*this, name);
|
callback = new CAudioEndpointVolumeCallback(*this, name);
|
||||||
|
|
|
@ -122,13 +122,13 @@ bool TelephonyPlugin::receivePacket(const NetworkPacket& np)
|
||||||
|
|
||||||
void TelephonyPlugin::sendMutePacket()
|
void TelephonyPlugin::sendMutePacket()
|
||||||
{
|
{
|
||||||
NetworkPacket packet(PACKET_TYPE_TELEPHONY_REQUEST_MUTE, {{"action", "mute"}});
|
NetworkPacket packet(PACKET_TYPE_TELEPHONY_REQUEST_MUTE, {{QStringLiteral("action"), QStringLiteral("mute")}});
|
||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TelephonyPlugin::dbusPath() const
|
QString TelephonyPlugin::dbusPath() const
|
||||||
{
|
{
|
||||||
return "/modules/kdeconnect/devices/" + device()->id() + "/telephony";
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/telephony");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "telephonyplugin.moc"
|
#include "telephonyplugin.moc"
|
||||||
|
|
|
@ -51,7 +51,7 @@ void RemoteCommandsRunner::match(Plasma::RunnerContext &context)
|
||||||
|
|
||||||
DeviceDbusInterface deviceInterface(deviceId, this);
|
DeviceDbusInterface deviceInterface(deviceId, this);
|
||||||
|
|
||||||
if(!deviceInterface.hasPlugin("kdeconnect_remotecommands")) {
|
if(!deviceInterface.hasPlugin(QStringLiteral("kdeconnect_remotecommands"))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,9 +71,9 @@ void RemoteCommandsRunner::match(Plasma::RunnerContext &context)
|
||||||
match.setType(Plasma::QueryMatch::PossibleMatch);
|
match.setType(Plasma::QueryMatch::PossibleMatch);
|
||||||
match.setId(it.key());
|
match.setId(it.key());
|
||||||
match.setIconName(QStringLiteral("kdeconnect"));
|
match.setIconName(QStringLiteral("kdeconnect"));
|
||||||
match.setText(deviceName + ": " + commandName);
|
match.setText(deviceName + QStringLiteral(": ") + commandName);
|
||||||
match.setSubtext(cont.value(QStringLiteral("command")).toString());
|
match.setSubtext(cont.value(QStringLiteral("command")).toString());
|
||||||
match.setData(deviceId + "$" + it.key());
|
match.setData(deviceId + QStringLiteral("$") + it.key());
|
||||||
context.addMatch(match);
|
context.addMatch(match);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,9 +83,9 @@ void RemoteCommandsRunner::match(Plasma::RunnerContext &context)
|
||||||
|
|
||||||
void RemoteCommandsRunner::run(const Plasma::RunnerContext &/*context*/, const Plasma::QueryMatch &match)
|
void RemoteCommandsRunner::run(const Plasma::RunnerContext &/*context*/, const Plasma::QueryMatch &match)
|
||||||
{
|
{
|
||||||
RemoteCommandsDbusInterface remoteCommandsInterface(match.data().toString().split("$")[0], this);
|
RemoteCommandsDbusInterface remoteCommandsInterface(match.data().toString().split(QStringLiteral("$"))[0], this);
|
||||||
|
|
||||||
remoteCommandsInterface.triggerCommand(match.data().toString().split("$")[1]);
|
remoteCommandsInterface.triggerCommand(match.data().toString().split(QStringLiteral("$"))[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "remotecommandsrunner.moc"
|
#include "remotecommandsrunner.moc"
|
||||||
|
|
|
@ -35,10 +35,10 @@
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
KAboutData aboutData("org.kde.kdeconnect.sms", i18n("SMS Instant Messaging"), QStringLiteral(KDECONNECT_VERSION_STRING), i18n("KDE Connect SMS"), KAboutLicense::GPL, i18n("(c) 2018, Aleix Pol Gonzalez"));
|
KAboutData aboutData(QStringLiteral("org.kde.kdeconnect.sms"), i18n("SMS Instant Messaging"), QStringLiteral(KDECONNECT_VERSION_STRING), i18n("KDE Connect SMS"), KAboutLicense::GPL, i18n("(c) 2018, Aleix Pol Gonzalez"));
|
||||||
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), {}, "aleixpol@kde.org");
|
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), {}, QStringLiteral("aleixpol@kde.org"));
|
||||||
aboutData.addAuthor(i18n("Nicolas Fella"), {}, "nicolas.fella@gmx.de");
|
aboutData.addAuthor(i18n("Nicolas Fella"), {}, QStringLiteral("nicolas.fella@gmx.de"));
|
||||||
aboutData.addAuthor(i18n("Simon Redman"), {}, "simon@ergotech.com");
|
aboutData.addAuthor(i18n("Simon Redman"), {}, QStringLiteral("simon@ergotech.com"));
|
||||||
KAboutData::setApplicationData(aboutData);
|
KAboutData::setApplicationData(aboutData);
|
||||||
|
|
||||||
QString initialMessage;
|
QString initialMessage;
|
||||||
|
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||||||
engine.rootContext()->setContextProperty(QStringLiteral("_initialMessage"), QVariant(initialMessage));
|
engine.rootContext()->setContextProperty(QStringLiteral("_initialMessage"), QVariant(initialMessage));
|
||||||
engine.load(QUrl("qrc:/qml/main.qml"));
|
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ bool SmsHelper::isShortCode(const QString& phoneNumber, const SmsHelper::Country
|
||||||
if (phoneNumber.length() <= 6) {
|
if (phoneNumber.length() <= 6) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (country == CountryCode::Australia && phoneNumber.length() == 8 && phoneNumber.startsWith("19")) {
|
if (country == CountryCode::Australia && phoneNumber.length() == 8 && phoneNumber.startsWith(QStringLiteral("19"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (country == CountryCode::CzechRepublic && phoneNumber.length() <= 9) {
|
if (country == CountryCode::CzechRepublic && phoneNumber.length() <= 9) {
|
||||||
|
@ -86,10 +86,10 @@ SmsHelper::CountryCode SmsHelper::determineCountryCode(const QString& canonicalN
|
||||||
// This is going to fall apart if someone has not entered a country code into their contact book
|
// This is going to fall apart if someone has not entered a country code into their contact book
|
||||||
// or if Android decides it can't be bothered to report the country code, but probably we will
|
// or if Android decides it can't be bothered to report the country code, but probably we will
|
||||||
// be fine anyway
|
// be fine anyway
|
||||||
if (canonicalNumber.startsWith("41")) {
|
if (canonicalNumber.startsWith(QStringLiteral("41"))) {
|
||||||
return CountryCode::Australia;
|
return CountryCode::Australia;
|
||||||
}
|
}
|
||||||
if (canonicalNumber.startsWith("420")) {
|
if (canonicalNumber.startsWith(QStringLiteral("420"))) {
|
||||||
return CountryCode::CzechRepublic;
|
return CountryCode::CzechRepublic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,12 +101,12 @@ SmsHelper::CountryCode SmsHelper::determineCountryCode(const QString& canonicalN
|
||||||
QString SmsHelper::canonicalizePhoneNumber(const QString& phoneNumber)
|
QString SmsHelper::canonicalizePhoneNumber(const QString& phoneNumber)
|
||||||
{
|
{
|
||||||
QString toReturn(phoneNumber);
|
QString toReturn(phoneNumber);
|
||||||
toReturn = toReturn.remove(' ');
|
toReturn = toReturn.remove(QStringLiteral(" "));
|
||||||
toReturn = toReturn.remove('-');
|
toReturn = toReturn.remove(QStringLiteral("-"));
|
||||||
toReturn = toReturn.remove('(');
|
toReturn = toReturn.remove(QStringLiteral("("));
|
||||||
toReturn = toReturn.remove(')');
|
toReturn = toReturn.remove(QStringLiteral(")"));
|
||||||
toReturn = toReturn.remove('+');
|
toReturn = toReturn.remove(QStringLiteral("+"));
|
||||||
toReturn = toReturn.remove(QRegularExpression("^0*")); // Strip leading zeroes
|
toReturn = toReturn.remove(QRegularExpression(QStringLiteral("^0*"))); // Strip leading zeroes
|
||||||
|
|
||||||
if (toReturn.length() == 0) {
|
if (toReturn.length() == 0) {
|
||||||
// If we have stripped away everything, assume this is a special number (and already canonicalized)
|
// If we have stripped away everything, assume this is a special number (and already canonicalized)
|
||||||
|
|
|
@ -52,8 +52,8 @@ void KdeConnectConfigTest::addTrustedDevice()
|
||||||
{
|
{
|
||||||
kcc->addTrustedDevice(QStringLiteral("testdevice"), QStringLiteral("Test Device"), QStringLiteral("phone"));
|
kcc->addTrustedDevice(QStringLiteral("testdevice"), QStringLiteral("Test Device"), QStringLiteral("phone"));
|
||||||
KdeConnectConfig::DeviceInfo devInfo = kcc->getTrustedDevice(QStringLiteral("testdevice"));
|
KdeConnectConfig::DeviceInfo devInfo = kcc->getTrustedDevice(QStringLiteral("testdevice"));
|
||||||
QCOMPARE(devInfo.deviceName, QString("Test Device"));
|
QCOMPARE(devInfo.deviceName, QStringLiteral("Test Device"));
|
||||||
QCOMPARE(devInfo.deviceType, QString("phone"));
|
QCOMPARE(devInfo.deviceType, QStringLiteral("phone"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -85,8 +85,8 @@ void KdeConnectConfigTest::removeTrustedDevice()
|
||||||
{
|
{
|
||||||
kcc->removeTrustedDevice(QStringLiteral("testdevice"));
|
kcc->removeTrustedDevice(QStringLiteral("testdevice"));
|
||||||
KdeConnectConfig::DeviceInfo devInfo = kcc->getTrustedDevice(QStringLiteral("testdevice"));
|
KdeConnectConfig::DeviceInfo devInfo = kcc->getTrustedDevice(QStringLiteral("testdevice"));
|
||||||
QCOMPARE(devInfo.deviceName, QString("unnamed"));
|
QCOMPARE(devInfo.deviceName, QStringLiteral("unnamed"));
|
||||||
QCOMPARE(devInfo.deviceType, QString("unknown"));
|
QCOMPARE(devInfo.deviceType, QStringLiteral("unknown"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_GUILESS_MAIN(KdeConnectConfigTest)
|
QTEST_GUILESS_MAIN(KdeConnectConfigTest)
|
||||||
|
|
|
@ -398,11 +398,11 @@ void LanLinkProviderTest::testIdentityPacket(QByteArray& identityPacket)
|
||||||
QJsonObject jsonObject = jsonDocument.object();
|
QJsonObject jsonObject = jsonDocument.object();
|
||||||
QJsonObject body = jsonObject.value(QStringLiteral("body")).toObject();
|
QJsonObject body = jsonObject.value(QStringLiteral("body")).toObject();
|
||||||
|
|
||||||
QCOMPARE(jsonObject.value("type").toString(), QString("kdeconnect.identity"));
|
QCOMPARE(jsonObject.value(QStringLiteral("type")).toString(), QStringLiteral("kdeconnect.identity"));
|
||||||
QVERIFY2(body.contains("deviceName"), "Device name not found in identity packet");
|
QVERIFY2(body.contains(QStringLiteral("deviceName")), "Device name not found in identity packet");
|
||||||
QVERIFY2(body.contains("deviceId"), "Device id not found in identity packet");
|
QVERIFY2(body.contains(QStringLiteral("deviceId")), "Device id not found in identity packet");
|
||||||
QVERIFY2(body.contains("protocolVersion"), "Protocol version not found in identity packet");
|
QVERIFY2(body.contains(QStringLiteral("protocolVersion")), "Protocol version not found in identity packet");
|
||||||
QVERIFY2(body.contains("deviceType"), "Device type not found in identity packet");
|
QVERIFY2(body.contains(QStringLiteral("deviceType")), "Device type not found in identity packet");
|
||||||
}
|
}
|
||||||
|
|
||||||
QSslCertificate LanLinkProviderTest::generateCertificate(QString& commonName, QCA::PrivateKey& privateKey)
|
QSslCertificate LanLinkProviderTest::generateCertificate(QString& commonName, QCA::PrivateKey& privateKey)
|
||||||
|
@ -448,7 +448,7 @@ void LanLinkProviderTest::socketBindErrorFail(const QUdpSocket& socket)
|
||||||
QAbstractSocket::SocketError sockErr = socket.error();
|
QAbstractSocket::SocketError sockErr = socket.error();
|
||||||
// Refer to https://doc.qt.io/qt-5/qabstractsocket.html#SocketError-enum to decode socket error number
|
// Refer to https://doc.qt.io/qt-5/qabstractsocket.html#SocketError-enum to decode socket error number
|
||||||
QString errorMessage = QLatin1String("Failed to bind UDP socket with error ");
|
QString errorMessage = QLatin1String("Failed to bind UDP socket with error ");
|
||||||
errorMessage = errorMessage + QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(sockErr);
|
errorMessage = errorMessage + QString::fromLatin1(QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(sockErr));
|
||||||
QFAIL(errorMessage.toLocal8Bit().data());
|
QFAIL(errorMessage.toLocal8Bit().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,16 +35,16 @@ void NetworkPacketTests::networkPacketTest()
|
||||||
{
|
{
|
||||||
NetworkPacket np(QStringLiteral("com.test"));
|
NetworkPacket np(QStringLiteral("com.test"));
|
||||||
|
|
||||||
np.set(QStringLiteral("hello"),"hola");
|
np.set(QStringLiteral("hello"), QStringLiteral("hola"));
|
||||||
QCOMPARE( (np.get<QString>("hello","bye")) , QString("hola") );
|
QCOMPARE( (np.get<QString>(QStringLiteral("hello"), QStringLiteral("bye"))) , QStringLiteral("hola") );
|
||||||
|
|
||||||
np.set(QStringLiteral("hello"),"");
|
np.set(QStringLiteral("hello"), QString());
|
||||||
QCOMPARE( (np.get<QString>("hello","bye")) , QString("") );
|
QCOMPARE((np.get<QString>(QStringLiteral("hello"), QStringLiteral("bye"))) , QString());
|
||||||
|
|
||||||
np.body().remove(QStringLiteral("hello"));
|
np.body().remove(QStringLiteral("hello"));
|
||||||
QCOMPARE( (np.get<QString>("hello","bye")) , QString("bye") );
|
QCOMPARE((np.get<QString>(QStringLiteral("hello"), QStringLiteral("bye"))) , QStringLiteral("bye"));
|
||||||
|
|
||||||
np.set(QStringLiteral("foo"), "bar");
|
np.set(QStringLiteral("foo"), QStringLiteral("bar"));
|
||||||
QByteArray ba = np.serialize();
|
QByteArray ba = np.serialize();
|
||||||
//qDebug() << "Serialized packet:" << ba;
|
//qDebug() << "Serialized packet:" << ba;
|
||||||
NetworkPacket np2(QLatin1String(""));
|
NetworkPacket np2(QLatin1String(""));
|
||||||
|
@ -57,10 +57,10 @@ void NetworkPacketTests::networkPacketTest()
|
||||||
QByteArray json("{\"id\":\"123\",\"type\":\"test\",\"body\":{\"testing\":true}}");
|
QByteArray json("{\"id\":\"123\",\"type\":\"test\",\"body\":{\"testing\":true}}");
|
||||||
//qDebug() << json;
|
//qDebug() << json;
|
||||||
NetworkPacket::unserialize(json,&np2);
|
NetworkPacket::unserialize(json,&np2);
|
||||||
QCOMPARE( np2.id(), QString("123") );
|
QCOMPARE( np2.id(), QStringLiteral("123") );
|
||||||
QCOMPARE( (np2.get<bool>("testing")), true );
|
QCOMPARE( (np2.get<bool>(QStringLiteral("testing"))), true );
|
||||||
QCOMPARE( (np2.get<bool>("not_testing")), false );
|
QCOMPARE( (np2.get<bool>(QStringLiteral("not_testing"))), false );
|
||||||
QCOMPARE( (np2.get<bool>("not_testing",true)), true );
|
QCOMPARE( (np2.get<bool>(QStringLiteral("not_testing"),true)), true );
|
||||||
|
|
||||||
//NetworkPacket::unserialize("this is not json",&np2);
|
//NetworkPacket::unserialize("this is not json",&np2);
|
||||||
//QtTest::ignoreMessage(QtSystemMsg, "json_parser - syntax error found, forcing abort, Line 1 Column 0");
|
//QtTest::ignoreMessage(QtSystemMsg, "json_parser - syntax error found, forcing abort, Line 1 Column 0");
|
||||||
|
@ -73,7 +73,7 @@ void NetworkPacketTests::networkPacketIdentityTest()
|
||||||
NetworkPacket np(QLatin1String(""));
|
NetworkPacket np(QLatin1String(""));
|
||||||
NetworkPacket::createIdentityPacket(&np);
|
NetworkPacket::createIdentityPacket(&np);
|
||||||
|
|
||||||
QCOMPARE( np.get<int>("protocolVersion", -1) , NetworkPacket::s_protocolVersion );
|
QCOMPARE( np.get<int>(QStringLiteral("protocolVersion"), -1) , NetworkPacket::s_protocolVersion );
|
||||||
QCOMPARE( np.type() , PACKET_TYPE_IDENTITY );
|
QCOMPARE( np.type() , PACKET_TYPE_IDENTITY );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,12 +75,12 @@ class PluginLoadTest : public QObject
|
||||||
QVERIFY(d->isReachable());
|
QVERIFY(d->isReachable());
|
||||||
|
|
||||||
d->setPluginEnabled(QStringLiteral("kdeconnect_mousepad"), false);
|
d->setPluginEnabled(QStringLiteral("kdeconnect_mousepad"), false);
|
||||||
QCOMPARE(d->isPluginEnabled("kdeconnect_mousepad"), false);
|
QCOMPARE(d->isPluginEnabled(QStringLiteral("kdeconnect_mousepad")), false);
|
||||||
QVERIFY(d->supportedPlugins().contains("kdeconnect_remotecontrol"));
|
QVERIFY(d->supportedPlugins().contains(QStringLiteral("kdeconnect_remotecontrol")));
|
||||||
|
|
||||||
d->setPluginEnabled(QStringLiteral("kdeconnect_mousepad"), true);
|
d->setPluginEnabled(QStringLiteral("kdeconnect_mousepad"), true);
|
||||||
QCOMPARE(d->isPluginEnabled("kdeconnect_mousepad"), true);
|
QCOMPARE(d->isPluginEnabled(QStringLiteral("kdeconnect_mousepad")), true);
|
||||||
QVERIFY(d->supportedPlugins().contains("kdeconnect_remotecontrol"));
|
QVERIFY(d->supportedPlugins().contains(QStringLiteral("kdeconnect_remotecontrol")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -98,7 +98,7 @@ class TestSendFile : public QObject
|
||||||
void testSslJobs()
|
void testSslJobs()
|
||||||
{
|
{
|
||||||
const QString aFile = QFINDTESTDATA("sendfiletest.cpp");
|
const QString aFile = QFINDTESTDATA("sendfiletest.cpp");
|
||||||
const QString destFile = QDir::tempPath() + "/kdeconnect-test-sentfile";
|
const QString destFile = QDir::tempPath() + QStringLiteral("/kdeconnect-test-sentfile");
|
||||||
QFile(destFile).remove();
|
QFile(destFile).remove();
|
||||||
|
|
||||||
const QString deviceId = KdeConnectConfig::instance()->deviceId()
|
const QString deviceId = KdeConnectConfig::instance()->deviceId()
|
||||||
|
|
|
@ -137,9 +137,9 @@ void TestNotificationListener::testNotify()
|
||||||
QCOMPARE(proxiedNotifications, d->getSentPackets());
|
QCOMPARE(proxiedNotifications, d->getSentPackets());
|
||||||
plugin = new TestNotificationsPlugin(this,
|
plugin = new TestNotificationsPlugin(this,
|
||||||
QVariantList({ QVariant::fromValue<Device*>(d),
|
QVariantList({ QVariant::fromValue<Device*>(d),
|
||||||
"notifications_plugin",
|
QStringLiteral("notifications_plugin"),
|
||||||
{"kdeconnect.notification"},
|
{QStringLiteral("kdeconnect.notification")},
|
||||||
"preferences-desktop-notification"}));
|
QStringLiteral("preferences-desktop-notification")}));
|
||||||
QVERIFY(plugin->getNotificationsListener());
|
QVERIFY(plugin->getNotificationsListener());
|
||||||
delete plugin->getNotificationsListener();
|
delete plugin->getNotificationsListener();
|
||||||
|
|
||||||
|
@ -153,9 +153,9 @@ void TestNotificationListener::testNotify()
|
||||||
plugin->config()->set(QStringLiteral("generalPersistent"), false);
|
plugin->config()->set(QStringLiteral("generalPersistent"), false);
|
||||||
plugin->config()->set(QStringLiteral("generalIncludeBody"), true);
|
plugin->config()->set(QStringLiteral("generalIncludeBody"), true);
|
||||||
plugin->config()->set(QStringLiteral("generalUrgency"), 0);
|
plugin->config()->set(QStringLiteral("generalUrgency"), 0);
|
||||||
QCOMPARE(plugin->config()->get<bool>("generalPersistent"), false);
|
QCOMPARE(plugin->config()->get<bool>(QStringLiteral("generalPersistent")), false);
|
||||||
QCOMPARE(plugin->config()->get<bool>("generalIncludeBody"), true);
|
QCOMPARE(plugin->config()->get<bool>(QStringLiteral("generalIncludeBody")), true);
|
||||||
QCOMPARE(plugin->config()->get<bool>("generalUrgency"), false);
|
QCOMPARE(plugin->config()->get<bool>(QStringLiteral("generalUrgency")), false);
|
||||||
|
|
||||||
// applications are modified directly:
|
// applications are modified directly:
|
||||||
listener->getApplications().clear();
|
listener->getApplications().clear();
|
||||||
|
@ -179,10 +179,10 @@ void TestNotificationListener::testNotify()
|
||||||
// ... have triggered sending a packet
|
// ... have triggered sending a packet
|
||||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||||
// ... with our properties,
|
// ... with our properties,
|
||||||
QCOMPARE(d->getLastPacket()->get<uint>("id"), replacesId);
|
QCOMPARE(d->getLastPacket()->get<uint>(QStringLiteral("id")), replacesId);
|
||||||
QCOMPARE(d->getLastPacket()->get<QString>("appName"), appName);
|
QCOMPARE(d->getLastPacket()->get<QString>(QStringLiteral("appName")), appName);
|
||||||
QCOMPARE(d->getLastPacket()->get<QString>("ticker"), summary + ": " + body);
|
QCOMPARE(d->getLastPacket()->get<QString>(QStringLiteral("ticker")), summary + QStringLiteral(": ") + body);
|
||||||
QCOMPARE(d->getLastPacket()->get<bool>("isClearable"), true);
|
QCOMPARE(d->getLastPacket()->get<bool>(QStringLiteral("isClearable")), true);
|
||||||
QCOMPARE(d->getLastPacket()->hasPayload(), false);
|
QCOMPARE(d->getLastPacket()->hasPayload(), false);
|
||||||
|
|
||||||
// ... and create a new application internally that is initialized correctly:
|
// ... and create a new application internally that is initialized correctly:
|
||||||
|
@ -200,13 +200,13 @@ void TestNotificationListener::testNotify()
|
||||||
QString icon2(QStringLiteral("some-icon2"));
|
QString icon2(QStringLiteral("some-icon2"));
|
||||||
QString summary2(QStringLiteral("some-summary2"));
|
QString summary2(QStringLiteral("some-summary2"));
|
||||||
|
|
||||||
retId = listener->Notify(appName2, replacesId+1, icon2, summary2, body2, {}, {{"urgency", 2}}, 10);
|
retId = listener->Notify(appName2, replacesId+1, icon2, summary2, body2, {}, {{QStringLiteral("urgency"), 2}}, 10);
|
||||||
QCOMPARE(retId, replacesId+1);
|
QCOMPARE(retId, replacesId+1);
|
||||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||||
QCOMPARE(d->getLastPacket()->get<uint>("id"), replacesId+1);
|
QCOMPARE(d->getLastPacket()->get<uint>(QStringLiteral("id")), replacesId+1);
|
||||||
QCOMPARE(d->getLastPacket()->get<QString>("appName"), appName2);
|
QCOMPARE(d->getLastPacket()->get<QString>(QStringLiteral("appName")), appName2);
|
||||||
QCOMPARE(d->getLastPacket()->get<QString>("ticker"), summary2 + ": " + body2);
|
QCOMPARE(d->getLastPacket()->get<QString>(QStringLiteral("ticker")), summary2 + QStringLiteral(": ") + body2);
|
||||||
QCOMPARE(d->getLastPacket()->get<bool>("isClearable"), false); // timeout != 0
|
QCOMPARE(d->getLastPacket()->get<bool>(QStringLiteral("isClearable")), false); // timeout != 0
|
||||||
QCOMPARE(d->getLastPacket()->hasPayload(), false);
|
QCOMPARE(d->getLastPacket()->hasPayload(), false);
|
||||||
QCOMPARE(listener->getApplications().count(), 2);
|
QCOMPARE(listener->getApplications().count(), 2);
|
||||||
QVERIFY(listener->getApplications().contains(appName2));
|
QVERIFY(listener->getApplications().contains(appName2));
|
||||||
|
@ -228,15 +228,15 @@ void TestNotificationListener::testNotify()
|
||||||
|
|
||||||
// if min-urgency is set, lower urgency levels are not synced:
|
// if min-urgency is set, lower urgency levels are not synced:
|
||||||
plugin->config()->set(QStringLiteral("generalUrgency"), 1);
|
plugin->config()->set(QStringLiteral("generalUrgency"), 1);
|
||||||
retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{"urgency", 0}}, 0);
|
retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{QStringLiteral("urgency"), 0}}, 0);
|
||||||
QCOMPARE(retId, 0U);
|
QCOMPARE(retId, 0U);
|
||||||
QCOMPARE(proxiedNotifications, d->getSentPackets());
|
QCOMPARE(proxiedNotifications, d->getSentPackets());
|
||||||
// equal urgency is
|
// equal urgency is
|
||||||
retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{"urgency", 1}}, 0);
|
retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{QStringLiteral("urgency"), 1}}, 0);
|
||||||
QCOMPARE(retId, replacesId);
|
QCOMPARE(retId, replacesId);
|
||||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||||
// higher urgency as well
|
// higher urgency as well
|
||||||
retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{"urgency", 2}}, 0);
|
retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{QStringLiteral("urgency"), 2}}, 0);
|
||||||
QCOMPARE(retId, replacesId);
|
QCOMPARE(retId, replacesId);
|
||||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||||
plugin->config()->set(QStringLiteral("generalUrgency"), 0);
|
plugin->config()->set(QStringLiteral("generalUrgency"), 0);
|
||||||
|
@ -245,7 +245,7 @@ void TestNotificationListener::testNotify()
|
||||||
QVERIFY(listener->getApplications().contains(appName));
|
QVERIFY(listener->getApplications().contains(appName));
|
||||||
listener->getApplications()[appName].active = false;
|
listener->getApplications()[appName].active = false;
|
||||||
QVERIFY(!listener->getApplications()[appName].active);
|
QVERIFY(!listener->getApplications()[appName].active);
|
||||||
retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{"urgency", 0}}, 0);
|
retId = listener->Notify(appName, replacesId, icon, summary, body, {}, {{QStringLiteral("urgency"), 0}}, 0);
|
||||||
QCOMPARE(retId, 0U);
|
QCOMPARE(retId, 0U);
|
||||||
QCOMPARE(proxiedNotifications, d->getSentPackets());
|
QCOMPARE(proxiedNotifications, d->getSentPackets());
|
||||||
// others are still:
|
// others are still:
|
||||||
|
@ -289,7 +289,7 @@ void TestNotificationListener::testNotify()
|
||||||
QCOMPARE(retId, replacesId);
|
QCOMPARE(retId, replacesId);
|
||||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||||
// without body, also ticker value is different:
|
// without body, also ticker value is different:
|
||||||
QCOMPARE(d->getLastPacket()->get<QString>("ticker"), summary);
|
QCOMPARE(d->getLastPacket()->get<QString>(QStringLiteral("ticker")), summary);
|
||||||
retId = listener->Notify(appName, replacesId, icon, summary, QStringLiteral("body foobaz"), {}, {{}}, 0);
|
retId = listener->Notify(appName, replacesId, icon, summary, QStringLiteral("body foobaz"), {}, {{}}, 0);
|
||||||
QCOMPARE(retId, replacesId);
|
QCOMPARE(retId, replacesId);
|
||||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||||
|
@ -331,7 +331,7 @@ void TestNotificationListener::testNotify()
|
||||||
QVERIFY(d->getLastPacket()->hasPayload());
|
QVERIFY(d->getLastPacket()->hasPayload());
|
||||||
QCOMPARE(d->getLastPacket()->payloadSize(), fi.size());
|
QCOMPARE(d->getLastPacket()->payloadSize(), fi.size());
|
||||||
// extensions other than png are not accepted:
|
// extensions other than png are not accepted:
|
||||||
retId = listener->Notify(appName, replacesId, iconName + ".svg", summary, body, {}, {{}}, 0);
|
retId = listener->Notify(appName, replacesId, iconName + QStringLiteral(".svg"), summary, body, {}, {{}}, 0);
|
||||||
QCOMPARE(retId, replacesId);
|
QCOMPARE(retId, replacesId);
|
||||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||||
QVERIFY(!d->getLastPacket()->hasPayload());
|
QVERIFY(!d->getLastPacket()->hasPayload());
|
||||||
|
@ -348,7 +348,7 @@ void TestNotificationListener::testNotify()
|
||||||
|
|
||||||
// image-path in hints
|
// image-path in hints
|
||||||
if (iconPaths.size() > 0) {
|
if (iconPaths.size() > 0) {
|
||||||
retId = listener->Notify(appName, replacesId, iconPaths.size() > 1 ? iconPaths[1] : icon, summary, body, {}, {{"image-path", iconPaths[0]}}, 0);
|
retId = listener->Notify(appName, replacesId, iconPaths.size() > 1 ? iconPaths[1] : icon, summary, body, {}, {{QStringLiteral("image-path"), iconPaths[0]}}, 0);
|
||||||
QCOMPARE(retId, replacesId);
|
QCOMPARE(retId, replacesId);
|
||||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||||
QVERIFY(d->getLastPacket()->hasPayload());
|
QVERIFY(d->getLastPacket()->hasPayload());
|
||||||
|
@ -359,7 +359,7 @@ void TestNotificationListener::testNotify()
|
||||||
|
|
||||||
// image_path in hints
|
// image_path in hints
|
||||||
if (iconPaths.size() > 0) {
|
if (iconPaths.size() > 0) {
|
||||||
retId = listener->Notify(appName, replacesId, iconPaths.size() > 1 ? iconPaths[1] : icon, summary, body, {}, {{"image_path", iconPaths[0]}}, 0);
|
retId = listener->Notify(appName, replacesId, iconPaths.size() > 1 ? iconPaths[1] : icon, summary, body, {}, {{QStringLiteral("image_path"), iconPaths[0]}}, 0);
|
||||||
QCOMPARE(retId, replacesId);
|
QCOMPARE(retId, replacesId);
|
||||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||||
QVERIFY(d->getLastPacket()->hasPayload());
|
QVERIFY(d->getLastPacket()->hasPayload());
|
||||||
|
@ -379,9 +379,9 @@ void TestNotificationListener::testNotify()
|
||||||
0x11, 0x12, 0x13, 0x14,
|
0x11, 0x12, 0x13, 0x14,
|
||||||
0x21, 0x22, 0x23, 0x24,
|
0x21, 0x22, 0x23, 0x24,
|
||||||
0x31, 0x32, 0x33, 0x34 };
|
0x31, 0x32, 0x33, 0x34 };
|
||||||
QVariantMap imageData = {{"width", width}, {"height", height}, {"rowStride", rowStride},
|
QVariantMap imageData = {{QStringLiteral("width"), width}, {QStringLiteral("height"), height}, {QStringLiteral("rowStride"), rowStride},
|
||||||
{"bitsPerSample", bitsPerSample}, {"channels", channels},
|
{QStringLiteral("bitsPerSample"), bitsPerSample}, {QStringLiteral("channels"), channels},
|
||||||
{"hasAlpha", hasAlpha}, {"imageData", QByteArray(rawData, sizeof(rawData))}};
|
{QStringLiteral("hasAlpha"), hasAlpha}, {QStringLiteral("imageData"), QByteArray(rawData, sizeof(rawData))}};
|
||||||
QVariantMap hints;
|
QVariantMap hints;
|
||||||
#define COMPARE_PIXEL(x, y) \
|
#define COMPARE_PIXEL(x, y) \
|
||||||
QCOMPARE(qRed(image.pixel(x,y)), (int)rawData[x*4 + y*rowStride + 0]); \
|
QCOMPARE(qRed(image.pixel(x,y)), (int)rawData[x*4 + y*rowStride + 0]); \
|
||||||
|
|
|
@ -117,7 +117,7 @@ int main(int argc, char** argv)
|
||||||
const QString device = proxyModel.index(currentDeviceIndex, 0).data(DevicesModel::IdModelRole).toString();
|
const QString device = proxyModel.index(currentDeviceIndex, 0).data(DevicesModel::IdModelRole).toString();
|
||||||
const QString action = open && url.isLocalFile() ? QStringLiteral("openFile") : QStringLiteral("shareUrl");
|
const QString action = open && url.isLocalFile() ? QStringLiteral("openFile") : QStringLiteral("shareUrl");
|
||||||
|
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+device+"/share", QStringLiteral("org.kde.kdeconnect.device.share"), action);
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), action);
|
||||||
msg.setArguments({ url.toString() });
|
msg.setArguments({ url.toString() });
|
||||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue