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)
|
||||
find_package(KF5PulseAudioQt REQUIRED)
|
||||
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()
|
||||
|
||||
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
|
||||
QCommandLineOption deviceAutocomplete(QStringLiteral("shell-device-autocompletion"));
|
||||
deviceAutocomplete.setHidden(true);
|
||||
deviceAutocomplete.setDescription("Outputs all available devices id's with their name and paired status"); //Not visible, so no translation needed
|
||||
deviceAutocomplete.setValueName("shell");
|
||||
deviceAutocomplete.setDescription(QStringLiteral("Outputs all available devices id's with their name and paired status")); //Not visible, so no translation needed
|
||||
deviceAutocomplete.setValueName(QStringLiteral("shell"));
|
||||
parser.addOption(deviceAutocomplete);
|
||||
about.setupCommandLine(&parser);
|
||||
|
||||
|
@ -87,7 +87,7 @@ int main(int argc, char** argv)
|
|||
parser.process(app);
|
||||
about.processCommandLine(&parser);
|
||||
|
||||
const QString id = "kdeconnect-cli-"+QString::number(QCoreApplication::applicationPid());
|
||||
const QString id = QStringLiteral("kdeconnect-cli-") + QString::number(QCoreApplication::applicationPid());
|
||||
DaemonDbusInterface iface;
|
||||
|
||||
if (parser.isSet(QStringLiteral("my-id"))) {
|
||||
|
@ -152,15 +152,15 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
//Description: "device name (paired/unpaired)"
|
||||
QString description = deviceIface.name() + " " + statusInfo;
|
||||
QString description = deviceIface.name() + QLatin1Char(' ') + statusInfo;
|
||||
//Replace characters
|
||||
description.replace(QChar('\\'), QStringLiteral("\\\\"));
|
||||
description.replace(QChar('['), QStringLiteral("\\["));
|
||||
description.replace(QChar(']'), QStringLiteral("\\]"));
|
||||
description.replace(QChar('\''), QStringLiteral("\\'"));
|
||||
description.replace(QChar('\"'), QStringLiteral("\\\""));
|
||||
description.replace(QChar('\n'), QChar(' '));
|
||||
description.remove(QChar('\0'));
|
||||
description.replace(QLatin1Char('\\'), QStringLiteral("\\\\"));
|
||||
description.replace(QLatin1Char('['), QStringLiteral("\\["));
|
||||
description.replace(QLatin1Char(']'), QStringLiteral("\\]"));
|
||||
description.replace(QLatin1Char('\''), QStringLiteral("\\'"));
|
||||
description.replace(QLatin1Char('\"'), QStringLiteral("\\\""));
|
||||
description.replace(QLatin1Char('\n'), QLatin1Char(' '));
|
||||
description.remove(QLatin1Char('\0'));
|
||||
|
||||
//Output id and description
|
||||
QTextStream(stdout) << id << '[' << description << ']' << endl;
|
||||
|
@ -196,7 +196,7 @@ int main(int argc, char** argv)
|
|||
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"));
|
||||
|
||||
msg.setArguments(QVariantList() << QVariant(urls));
|
||||
|
@ -206,7 +206,7 @@ int main(int argc, char** argv)
|
|||
QTextStream(stdout) << i18n("Shared %1", url) << endl;
|
||||
}
|
||||
} 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")));
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
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());
|
||||
}
|
||||
} 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"))) {
|
||||
QString message = parser.value(QStringLiteral("ping-msg"));
|
||||
msg.setArguments(QVariantList() << message);
|
||||
|
@ -254,29 +254,29 @@ int main(int argc, char** argv)
|
|||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
} else if(parser.isSet(QStringLiteral("send-sms"))) {
|
||||
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"));
|
||||
msg.setArguments({ parser.value("destination"), parser.value("send-sms") });
|
||||
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(QStringLiteral("destination")), parser.value(QStringLiteral("send-sms"))});
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
} else {
|
||||
QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination <phone number>");
|
||||
return 1;
|
||||
}
|
||||
} 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));
|
||||
} 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));
|
||||
} else if(parser.isSet("send-keys")) {
|
||||
QString seq = parser.value("send-keys");
|
||||
QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/remotekeyboard", "org.kde.kdeconnect.device.remotekeyboard", "sendKeyPress");
|
||||
} else if(parser.isSet(QStringLiteral("send-keys"))) {
|
||||
QString seq = parser.value(QStringLiteral("send-keys"));
|
||||
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/remotekeyboard"), QStringLiteral("org.kde.kdeconnect.device.remotekeyboard"), QStringLiteral("sendKeyPress"));
|
||||
if (seq.trimmed() == QLatin1String("-")) {
|
||||
// from stdin
|
||||
QFile in;
|
||||
if(in.open(stdin,QIODevice::ReadOnly | QIODevice::Unbuffered)) {
|
||||
while (!in.atEnd()) {
|
||||
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));
|
||||
}
|
||||
in.close();
|
||||
|
|
|
@ -45,7 +45,7 @@ BluetoothDeviceLink::BluetoothDeviceLink(const QString& deviceId, LinkProvider*
|
|||
|
||||
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)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
BluetoothDownloadJob::BluetoothDownloadJob(const QBluetoothAddress& remoteAddress, const QVariantMap& transferInfo, QObject* parent)
|
||||
: QObject(parent)
|
||||
, mRemoteAddress(remoteAddress)
|
||||
, mTransferUuid(QBluetoothUuid(transferInfo.value("uuid").toString()))
|
||||
, mTransferUuid(QBluetoothUuid(transferInfo.value(QStringLiteral("uuid")).toString()))
|
||||
, mSocket(new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
BluetoothLinkProvider::BluetoothLinkProvider()
|
||||
{
|
||||
mServiceUuid = QBluetoothUuid(QString("185f3df4-3268-4e3f-9fca-d4d5059915bd"));
|
||||
mServiceUuid = QBluetoothUuid(QStringLiteral("185f3df4-3268-4e3f-9fca-d4d5059915bd"));
|
||||
|
||||
connectTimer = new QTimer(this);
|
||||
connectTimer->setInterval(30000);
|
||||
|
@ -61,7 +61,7 @@ void BluetoothLinkProvider::onStart()
|
|||
mServiceDiscoveryAgent->start();
|
||||
|
||||
connectTimer->start();
|
||||
mKdeconnectService = mBluetoothServer->listen(mServiceUuid, "KDE Connect");
|
||||
mKdeconnectService = mBluetoothServer->listen(mServiceUuid, QStringLiteral("KDE Connect"));
|
||||
}
|
||||
|
||||
void BluetoothLinkProvider::onStop()
|
||||
|
@ -183,7 +183,7 @@ void BluetoothLinkProvider::clientIdentityReceived()
|
|||
|
||||
disconnect(socket, SIGNAL(readyRead()), this, SLOT(clientIdentityReceived()));
|
||||
|
||||
NetworkPacket receivedPacket("");
|
||||
NetworkPacket receivedPacket;
|
||||
bool success = NetworkPacket::unserialize(identityArray, &receivedPacket);
|
||||
|
||||
if (!success || receivedPacket.type() != PACKET_TYPE_IDENTITY) {
|
||||
|
@ -198,10 +198,10 @@ void BluetoothLinkProvider::clientIdentityReceived()
|
|||
|
||||
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);
|
||||
|
||||
NetworkPacket np2("");
|
||||
NetworkPacket np2;
|
||||
NetworkPacket::createIdentityPacket(&np2);
|
||||
success = deviceLink->sendPacket(np2);
|
||||
|
||||
|
@ -243,7 +243,7 @@ void BluetoothLinkProvider::serverNewConnection()
|
|||
connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError()));
|
||||
connect(socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
|
||||
|
||||
NetworkPacket np2("");
|
||||
NetworkPacket np2;
|
||||
NetworkPacket::createIdentityPacket(&np2);
|
||||
socket->write(np2.serialize());
|
||||
|
||||
|
@ -276,7 +276,7 @@ void BluetoothLinkProvider::serverDataReceived()
|
|||
disconnect(socket, SIGNAL(readyRead()), this, SLOT(serverDataReceived()));
|
||||
disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError()));
|
||||
|
||||
NetworkPacket receivedPacket("");
|
||||
NetworkPacket receivedPacket;
|
||||
bool success = NetworkPacket::unserialize(identityArray, &receivedPacket);
|
||||
|
||||
if (!success || receivedPacket.type() != PACKET_TYPE_IDENTITY) {
|
||||
|
@ -289,7 +289,7 @@ void BluetoothLinkProvider::serverDataReceived()
|
|||
|
||||
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);
|
||||
|
||||
connect(deviceLink, SIGNAL(destroyed(QObject*)),
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
BluetoothLinkProvider();
|
||||
virtual ~BluetoothLinkProvider();
|
||||
|
||||
QString name() override { return "BluetoothLinkProvider"; }
|
||||
QString name() override { return QStringLiteral("BluetoothLinkProvider"); }
|
||||
int priority() override { return PRIORITY_MEDIUM; }
|
||||
|
||||
public Q_SLOTS:
|
||||
|
|
|
@ -42,7 +42,7 @@ void BluetoothPairingHandler::packetReceived(const NetworkPacket& np)
|
|||
|
||||
m_pairingTimeout.stop();
|
||||
|
||||
bool wantsPair = np.get<bool>("pair");
|
||||
bool wantsPair = np.get<bool>(QStringLiteral("pair"));
|
||||
|
||||
if (wantsPair) {
|
||||
|
||||
|
@ -91,7 +91,7 @@ bool BluetoothPairingHandler::requestPairing()
|
|||
}
|
||||
|
||||
NetworkPacket np(PACKET_TYPE_PAIR);
|
||||
np.set("pair", true);
|
||||
np.set(QStringLiteral("pair"), true);
|
||||
bool success;
|
||||
success = deviceLink()->sendPacket(np);
|
||||
if (success) {
|
||||
|
@ -106,7 +106,7 @@ bool BluetoothPairingHandler::acceptPairing()
|
|||
qCDebug(KDECONNECT_CORE) << "User accepts pairing";
|
||||
m_pairingTimeout.stop(); // Just in case it is started
|
||||
NetworkPacket np(PACKET_TYPE_PAIR);
|
||||
np.set("pair", true);
|
||||
np.set(QStringLiteral("pair"), true);
|
||||
bool success = deviceLink()->sendPacket(np);
|
||||
if (success) {
|
||||
setInternalPairStatus(Paired);
|
||||
|
@ -118,14 +118,14 @@ void BluetoothPairingHandler::rejectPairing()
|
|||
{
|
||||
qCDebug(KDECONNECT_CORE) << "User rejects pairing";
|
||||
NetworkPacket np(PACKET_TYPE_PAIR);
|
||||
np.set("pair", false);
|
||||
np.set(QStringLiteral("pair"), false);
|
||||
deviceLink()->sendPacket(np);
|
||||
setInternalPairStatus(NotPaired);
|
||||
}
|
||||
|
||||
void BluetoothPairingHandler::unpair() {
|
||||
NetworkPacket np(PACKET_TYPE_PAIR);
|
||||
np.set("pair", false);
|
||||
np.set(QStringLiteral("pair"), false);
|
||||
deviceLink()->sendPacket(np);
|
||||
setInternalPairStatus(NotPaired);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ void BluetoothPairingHandler::unpair() {
|
|||
void BluetoothPairingHandler::pairingTimeout()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_PAIR);
|
||||
np.set("pair", false);
|
||||
np.set(QStringLiteral("pair"), false);
|
||||
deviceLink()->sendPacket(np);
|
||||
setInternalPairStatus(NotPaired); //Will emit the change as well
|
||||
Q_EMIT pairingError(i18n("Timed out"));
|
||||
|
|
|
@ -38,14 +38,14 @@ BluetoothUploadJob::BluetoothUploadJob(const QSharedPointer<QIODevice>& data, co
|
|||
QVariantMap BluetoothUploadJob::transferInfo() const
|
||||
{
|
||||
QVariantMap ret;
|
||||
ret["uuid"] = mTransferUuid.toString().mid(1, 36);
|
||||
ret[QStringLiteral("uuid")] = mTransferUuid.toString().mid(1, 36);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void BluetoothUploadJob::start()
|
||||
{
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ void CompositeUploadJob::startNextSubJob()
|
|||
//TODO: Create a copy of the networkpacket that can be re-injected if sending via lan fails?
|
||||
NetworkPacket np = m_currentJob->getNetworkPacket();
|
||||
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<quint64>(QStringLiteral("totalPayloadSize"), m_totalPayloadSize);
|
||||
|
||||
|
@ -272,7 +272,7 @@ void CompositeUploadJob::slotResult(KJob *job) {
|
|||
startNextSubJob();
|
||||
} else {
|
||||
QPair<QString, QString> field2;
|
||||
field2.first = QString("Files");
|
||||
field2.first = QStringLiteral("Files");
|
||||
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()),
|
||||
{ QString(), QString() }, field2
|
||||
|
|
|
@ -179,7 +179,7 @@ void LanDeviceLink::setPairStatus(PairStatus status)
|
|||
if (status == Paired) {
|
||||
Q_ASSERT(KdeConnectConfig::instance()->trustedDevices().contains(deviceId()));
|
||||
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) {
|
||||
QAbstractSocket::SocketError sockErr = m_udpSocket.error();
|
||||
// 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)
|
||||
<< QLatin1String("Failed to bind UDP socket on port")
|
||||
<< m_udpListenPort
|
||||
|
|
|
@ -81,7 +81,7 @@ bool LanPairingHandler::requestPairing()
|
|||
return acceptPairing();
|
||||
}
|
||||
|
||||
NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", true}});
|
||||
NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), true}});
|
||||
const bool success = deviceLink()->sendPacket(np);
|
||||
if (success) {
|
||||
setInternalPairStatus(Requested);
|
||||
|
@ -91,7 +91,7 @@ bool LanPairingHandler::requestPairing()
|
|||
|
||||
bool LanPairingHandler::acceptPairing()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", true}});
|
||||
NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), true}});
|
||||
bool success = deviceLink()->sendPacket(np);
|
||||
if (success) {
|
||||
setInternalPairStatus(Paired);
|
||||
|
@ -101,20 +101,20 @@ bool LanPairingHandler::acceptPairing()
|
|||
|
||||
void LanPairingHandler::rejectPairing()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", false}});
|
||||
NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), false}});
|
||||
deviceLink()->sendPacket(np);
|
||||
setInternalPairStatus(NotPaired);
|
||||
}
|
||||
|
||||
void LanPairingHandler::unpair() {
|
||||
NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", false}});
|
||||
NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), false}});
|
||||
deviceLink()->sendPacket(np);
|
||||
setInternalPairStatus(NotPaired);
|
||||
}
|
||||
|
||||
void LanPairingHandler::pairingTimeout()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_PAIR, {{"pair", false}});
|
||||
NetworkPacket np(PACKET_TYPE_PAIR, {{QStringLiteral("pair"), false}});
|
||||
deviceLink()->sendPacket(np);
|
||||
setInternalPairStatus(NotPaired); //Will emit the change as well
|
||||
Q_EMIT pairingError(i18n("Timed out"));
|
||||
|
|
|
@ -38,7 +38,7 @@ void Server::incomingConnection(qintptr socketDescriptor) {
|
|||
if (serverSocket->setSocketDescriptor(socketDescriptor)) {
|
||||
addPendingConnection(serverSocket);
|
||||
} else {
|
||||
qWarning() << "setSocketDescriptor failed " + serverSocket->errorString();
|
||||
qWarning() << "setSocketDescriptor failed" << serverSocket->errorString();
|
||||
delete serverSocket;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace DbusHelper {
|
|||
|
||||
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("_"));
|
||||
}
|
||||
|
||||
|
|
|
@ -540,7 +540,7 @@ QString Device::encryptionInfo() const
|
|||
|
||||
QString localSha1 = QString::fromLatin1(KdeConnectConfig::instance()->certificate().digest(digestAlgorithm).toHex());
|
||||
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);
|
||||
|
||||
|
@ -548,7 +548,7 @@ QString Device::encryptionInfo() const
|
|||
QSslCertificate remoteCertificate = QSslCertificate(QByteArray(remotePem.c_str(), (int)remotePem.size()));
|
||||
QString remoteSha1 = QString::fromLatin1(remoteCertificate.digest(digestAlgorithm).toHex());
|
||||
for (int i = 2; i < remoteSha1.size(); i += 3) {
|
||||
remoteSha1.insert(i, ':'); // Improve readability
|
||||
remoteSha1.insert(i, QStringLiteral(":")); // Improve readability
|
||||
}
|
||||
result += i18n("SHA1 fingerprint of remote device certificate is: %1\n", remoteSha1);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
|
||||
QString id() 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 iconName() const;
|
||||
QString statusIconName() const;
|
||||
|
|
|
@ -88,11 +88,11 @@ QString KdeConnectConfig::name()
|
|||
{
|
||||
QString username;
|
||||
#ifdef Q_OS_WIN
|
||||
username = qgetenv("USERNAME");
|
||||
username = QString::fromLatin1(qgetenv("USERNAME"));
|
||||
#else
|
||||
username = qgetenv("USER");
|
||||
username = QString::fromLatin1(qgetenv("USER"));
|
||||
#endif
|
||||
QString defaultName = username + '@' + QHostInfo::localHostName();
|
||||
QString defaultName = username + QStringLiteral("@") + QHostInfo::localHostName();
|
||||
QString name = d->m_config->value(QStringLiteral("name"), defaultName).toString();
|
||||
return name;
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ void KdeConnectConfig::loadPrivateKey()
|
|||
bool needsToGenerateKey = false;
|
||||
if (privKey.exists() && privKey.open(QIODevice::ReadOnly)) {
|
||||
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) {
|
||||
qCWarning(KDECONNECT_CORE) << "Private key from" << keyPath << "is not valid";
|
||||
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_signal = QDBusMessage::createSignal("/kdeconnect/"+deviceId+"/"+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()));
|
||||
d->m_signal = QDBusMessage::createSignal(QStringLiteral("/kdeconnect/") + deviceId + QStringLiteral("/") + pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"));
|
||||
DbusHelper::sessionBus().connect(QLatin1String(""), QStringLiteral("/kdeconnect/") + deviceId + QStringLiteral("/") + pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"), this, SLOT(slotConfigChanged()));
|
||||
}
|
||||
|
||||
KdeConnectPluginConfig::~KdeConnectPluginConfig()
|
||||
|
|
|
@ -46,7 +46,7 @@ QVariant DBusResponseWaiter::waitForReply(QVariant variant) const
|
|||
if (call->isError())
|
||||
{
|
||||
qWarning() << "error:" << call->error();
|
||||
return QVariant("error");
|
||||
return QVariant(QStringLiteral("error"));
|
||||
}
|
||||
|
||||
QDBusMessage reply = call->reply();
|
||||
|
|
|
@ -92,7 +92,7 @@ void SendFileItemAction::sendFile()
|
|||
const QList<QUrl> urls = sender()->property("urls").value<QList<QUrl>>();
|
||||
QString id = sender()->property("id").toString();
|
||||
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());
|
||||
DbusHelper::sessionBus().call(msg);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
|||
, m_device(device)
|
||||
{
|
||||
#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
|
||||
setIcon(QIcon::fromTheme(device->iconName()));
|
||||
#endif
|
||||
|
@ -79,7 +79,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
|||
|
||||
auto battery = new BatteryAction(device);
|
||||
addAction(battery);
|
||||
setWhenAvailable(device->hasPlugin("kdeconnect_battery"),
|
||||
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_battery")),
|
||||
[battery](bool available) { battery->setVisible(available); }
|
||||
, this);
|
||||
|
||||
|
@ -89,7 +89,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
|||
sftpIface->startBrowsing();
|
||||
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"));
|
||||
connect(findDevice, &QAction::triggered, device, [device](){
|
||||
|
@ -97,7 +97,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
|||
iface->ring();
|
||||
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"));
|
||||
connect(sendFile, &QAction::triggered, device, [device, this](){
|
||||
|
@ -105,11 +105,11 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
|||
if (url.isEmpty())
|
||||
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());
|
||||
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"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
int main(int argc, char** argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
KAboutData about("kdeconnect-indicator",
|
||||
KAboutData about(QStringLiteral("kdeconnect-indicator"),
|
||||
i18n("KDE Connect Indicator"),
|
||||
QStringLiteral(KDECONNECT_VERSION_STRING),
|
||||
i18n("KDE Connect Indicator tool"),
|
||||
|
@ -55,7 +55,7 @@ int main(int argc, char** argv)
|
|||
KAboutData::setApplicationData(about);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
QProcess::startDetached("kdeconnectd.exe");
|
||||
QProcess::startDetached(QStringLiteral("kdeconnectd.exe"));
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
@ -81,7 +81,7 @@ int main(int argc, char** argv)
|
|||
auto configure = menu->addAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure..."));
|
||||
QObject::connect(configure, &QAction::triggered, configure, [](){
|
||||
KCMultiDialog* dialog = new KCMultiDialog;
|
||||
dialog->addModule("kcm_kdeconnect");
|
||||
dialog->addModule(QStringLiteral("kcm_kdeconnect"));
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->show();
|
||||
});
|
||||
|
@ -129,7 +129,7 @@ int main(int argc, char** argv)
|
|||
#else
|
||||
KStatusNotifierItem systray;
|
||||
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.setStatus(KStatusNotifierItem::Passive);
|
||||
systray.setStandardActionsEnabled(false);
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
|
||||
ConversationMessage::ConversationMessage(const QVariantMap& args)
|
||||
: m_eventField(args["event"].toInt()),
|
||||
m_body(args["body"].toString()),
|
||||
m_address(args["address"].toString()),
|
||||
m_date(args["date"].toLongLong()),
|
||||
m_type(args["type"].toInt()),
|
||||
m_read(args["read"].toInt()),
|
||||
m_threadID(args["thread_id"].toLongLong()),
|
||||
m_uID(args["_id"].toInt())
|
||||
: m_eventField(args[QStringLiteral("event")].toInt()),
|
||||
m_body(args[QStringLiteral("body")].toString()),
|
||||
m_address(args[QStringLiteral("address")].toString()),
|
||||
m_date(args[QStringLiteral("date")].toLongLong()),
|
||||
m_type(args[QStringLiteral("type")].toInt()),
|
||||
m_read(args[QStringLiteral("read")].toInt()),
|
||||
m_threadID(args[QStringLiteral("thread_id")].toLongLong()),
|
||||
m_uID(args[QStringLiteral("_id")].toInt())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -81,14 +81,14 @@ ConversationMessage& ConversationMessage::operator=(const ConversationMessage& o
|
|||
QVariantMap ConversationMessage::toVariant() const
|
||||
{
|
||||
return {
|
||||
{"event", m_eventField},
|
||||
{"body", m_body},
|
||||
{"address", m_address},
|
||||
{"date", m_date},
|
||||
{"type", m_type},
|
||||
{"read", m_read},
|
||||
{"thread_id", m_threadID},
|
||||
{"_id", m_uID},
|
||||
{QStringLiteral("event"), m_eventField},
|
||||
{QStringLiteral("body"), m_body},
|
||||
{QStringLiteral("address"), m_address},
|
||||
{QStringLiteral("date"), m_date},
|
||||
{QStringLiteral("type"), m_type},
|
||||
{QStringLiteral("read"), m_read},
|
||||
{QStringLiteral("thread_id"), m_threadID},
|
||||
{QStringLiteral("_id"), m_uID},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ DaemonDbusInterface::~DaemonDbusInterface()
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
connect(this, &OrgKdeKdeconnectDeviceInterface::trustedChanged, this, &DeviceDbusInterface::trustedChangedProxy);
|
||||
|
@ -63,12 +63,12 @@ QString DeviceDbusInterface::id() const
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
: 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)
|
||||
: 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)
|
||||
{
|
||||
|
||||
|
@ -102,7 +102,7 @@ NotificationDbusInterface::~NotificationDbusInterface()
|
|||
}
|
||||
|
||||
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)
|
||||
: 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)
|
||||
: 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);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ MprisDbusInterface::~MprisDbusInterface()
|
|||
}
|
||||
|
||||
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)
|
||||
: 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);
|
||||
Q_ASSERT(isValid());
|
||||
|
@ -154,7 +154,7 @@ LockDeviceDbusInterface::~LockDeviceDbusInterface()
|
|||
}
|
||||
|
||||
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):
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -178,20 +178,20 @@ RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId
|
|||
RemoteKeyboardDbusInterface::~RemoteKeyboardDbusInterface() = default;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
KAboutData about("kdeconnect-settings",
|
||||
KAboutData about(QStringLiteral("kdeconnect-settings"),
|
||||
i18n("KDE Connect Settings"),
|
||||
QStringLiteral(KDECONNECT_VERSION_STRING),
|
||||
i18n("KDE Connect Settings"),
|
||||
|
@ -37,7 +37,7 @@ int main(int argc, char** argv)
|
|||
KAboutData::setApplicationData(about);
|
||||
|
||||
KCMultiDialog* dialog = new KCMultiDialog;
|
||||
dialog->addModule("kcm_kdeconnect");
|
||||
dialog->addModule(QStringLiteral("kcm_kdeconnect"));
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->show();
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ void KioKdeconnect::listAllDevices()
|
|||
|
||||
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 icon = QStringLiteral("kdeconnect");
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ BatteryPlugin::BatteryPlugin(QObject* parent, const QVariantList& args)
|
|||
|
||||
void BatteryPlugin::connected()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_BATTERY_REQUEST, {{"request",true}});
|
||||
NetworkPacket np(PACKET_TYPE_BATTERY_REQUEST, {{QStringLiteral("request"),true}});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ ClipboardPlugin::ClipboardPlugin(QObject* parent, const QVariantList& args)
|
|||
|
||||
void ClipboardPlugin::propagateClipboard(const QString& content)
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_CLIPBOARD, {{"content", content}});
|
||||
NetworkPacket np(PACKET_TYPE_CLIPBOARD, {{QStringLiteral("content"), content}});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_CONTACTS, "kdeconnect.plugin.contacts")
|
|||
ContactsPlugin::ContactsPlugin(QObject* parent, const QVariantList& 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
|
||||
qRegisterMetaType<uID>("uID");
|
||||
|
@ -85,7 +85,7 @@ void ContactsPlugin::synchronizeRemoteWithLocal()
|
|||
|
||||
bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np)
|
||||
{
|
||||
if (!np.has("uids")) {
|
||||
if (!np.has(QStringLiteral("uids"))) {
|
||||
qCDebug(KDECONNECT_PLUGIN_CONTACTS) << "handleResponseUIDsTimestamps:"
|
||||
<< "Malformed packet does not have uids key";
|
||||
return false;
|
||||
|
@ -95,9 +95,9 @@ bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np)
|
|||
|
||||
// Get a list of all file info in this directory
|
||||
// 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:
|
||||
// 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()) {
|
||||
fileReadStream >> line;
|
||||
// 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;
|
||||
}
|
||||
QStringList parts = line.split(QLatin1Char(':'));
|
||||
|
@ -158,14 +158,14 @@ bool ContactsPlugin::handleResponseUIDsTimestamps(const NetworkPacket& np)
|
|||
|
||||
bool ContactsPlugin::handleResponseVCards(const NetworkPacket& np)
|
||||
{
|
||||
if (!np.has("uids")) {
|
||||
if (!np.has(QStringLiteral("uids"))) {
|
||||
qCDebug(KDECONNECT_PLUGIN_CONTACTS)
|
||||
<< "handleResponseVCards:" << "Malformed packet does not have uids key";
|
||||
return false;
|
||||
}
|
||||
|
||||
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
|
||||
for (const auto& ID : uIDs) {
|
||||
|
@ -200,14 +200,14 @@ bool ContactsPlugin::sendRequestWithIDs(const QString& packetType, const uIDList
|
|||
{
|
||||
NetworkPacket np(packetType);
|
||||
|
||||
np.set<uIDList_t>("uids", uIDs);
|
||||
np.set<uIDList_t>(QStringLiteral("uids"), uIDs);
|
||||
bool success = sendPacket(np);
|
||||
return success;
|
||||
}
|
||||
|
||||
QString ContactsPlugin::dbusPath() const
|
||||
{
|
||||
return "/modules/kdeconnect/devices/" + device()->id() + "/contacts";
|
||||
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/contacts");
|
||||
}
|
||||
|
||||
#include "contactsplugin.moc"
|
||||
|
|
|
@ -74,7 +74,7 @@ class QObject;
|
|||
*/
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(
|
||||
QString, vcardsLocation,
|
||||
(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + ("/kpeoplevcard")))
|
||||
(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QString::fromLatin1("/kpeoplevcard")))
|
||||
|
||||
#define VCARD_EXTENSION QStringLiteral(".vcf")
|
||||
#define METADATA_EXTENSION QStringLiteral(".meta")
|
||||
|
|
|
@ -50,7 +50,7 @@ void FindMyPhonePlugin::ring()
|
|||
|
||||
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"
|
||||
|
|
|
@ -123,7 +123,7 @@ bool FindThisDevicePlugin::receivePacket(const NetworkPacket& np)
|
|||
|
||||
QString FindThisDevicePlugin::dbusPath() const
|
||||
{
|
||||
return "/modules/kdeconnect/devices/" + device()->id() + "/findthisdevice";
|
||||
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/findthisdevice");
|
||||
}
|
||||
|
||||
#include "findthisdeviceplugin.moc"
|
||||
|
|
|
@ -52,7 +52,7 @@ bool LockDevicePlugin::isLocked() const
|
|||
}
|
||||
void LockDevicePlugin::setLocked(bool locked)
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{"setLocked", locked}});
|
||||
NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{QStringLiteral("setLocked"), locked}});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ bool LockDevicePlugin::receivePacket(const NetworkPacket & np)
|
|||
sendState = true;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,13 @@ OrgFreedesktopScreenSaverInterface* LockDevicePlugin::iface()
|
|||
|
||||
void LockDevicePlugin::connected()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{"requestLocked", QVariant()}});
|
||||
NetworkPacket np(PACKET_TYPE_LOCK_REQUEST, {{QStringLiteral("requestLocked"), QVariant()}});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
QString LockDevicePlugin::dbusPath() const
|
||||
{
|
||||
return "/modules/kdeconnect/devices/" + device()->id() + "/lockdevice";
|
||||
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/lockdevice");
|
||||
}
|
||||
|
||||
#include "lockdeviceplugin.moc"
|
||||
|
|
|
@ -24,6 +24,6 @@ class MprisControlPlugin
|
|||
void connected() override {}
|
||||
|
||||
private:
|
||||
const QString playername = "Media Player";
|
||||
const QString playername = PLAYERNAME;
|
||||
};
|
||||
#endif //MPRISCONTROLPLUGINWIN_H
|
|
@ -128,8 +128,8 @@ void MprisControlPlugin::seeked(qlonglong position){
|
|||
const QString& playerName = it.key();
|
||||
|
||||
NetworkPacket np(PACKET_TYPE_MPRIS, {
|
||||
{"pos", position/1000}, //Send milis instead of nanos
|
||||
{"player", playerName}
|
||||
{QStringLiteral("pos"), position/1000}, //Send milis instead of nanos
|
||||
{QStringLiteral("player"), playerName}
|
||||
});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ bool MprisControlPlugin::sendAlbumArt(const NetworkPacket& np)
|
|||
}
|
||||
|
||||
//Only support sending local files
|
||||
if (playerAlbumArtUrl.scheme() != "file") {
|
||||
if (playerAlbumArtUrl.scheme() != QStringLiteral("file")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ void MprisControlPlugin::mprisPlayerMetadataToNetworkPacket(NetworkPacket& np, c
|
|||
QString albumArtUrl = nowPlayingMap[QStringLiteral("mpris:artUrl")].toString();
|
||||
QString nowPlaying = title;
|
||||
if (!artist.isEmpty()) {
|
||||
nowPlaying = artist + " - " + title;
|
||||
nowPlaying = artist + QStringLiteral(" - ") + title;
|
||||
}
|
||||
np.set(QStringLiteral("title"), title);
|
||||
np.set(QStringLiteral("artist"), artist);
|
||||
|
|
|
@ -84,30 +84,30 @@ long MprisRemotePlugin::position() 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)
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
||||
{"player", player},
|
||||
{"requestNowPlaying", true},
|
||||
{"requestVolume", true}}
|
||||
{QStringLiteral("player"), player},
|
||||
{QStringLiteral("requestNowPlaying"), true},
|
||||
{QStringLiteral("requestVolume"), true}}
|
||||
);
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
void MprisRemotePlugin::requestPlayerList()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {{"requestPlayerList", true}});
|
||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {{QStringLiteral("requestPlayerList"), true}});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
void MprisRemotePlugin::sendAction(const QString& action)
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
||||
{"player", m_currentPlayer},
|
||||
{"action", action}
|
||||
{QStringLiteral("player"), m_currentPlayer},
|
||||
{QStringLiteral("action"), action}
|
||||
});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
@ -115,16 +115,16 @@ void MprisRemotePlugin::sendAction(const QString& action)
|
|||
void MprisRemotePlugin::seek(int offset) const
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
||||
{"player", m_currentPlayer},
|
||||
{"Seek", offset}});
|
||||
{QStringLiteral("player"), m_currentPlayer},
|
||||
{QStringLiteral("Seek"), offset}});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
void MprisRemotePlugin::setVolume(int volume)
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
||||
{"player", m_currentPlayer},
|
||||
{"setVolume",volume}
|
||||
{QStringLiteral("player"), m_currentPlayer},
|
||||
{QStringLiteral("setVolume"), volume}
|
||||
});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
@ -132,8 +132,8 @@ void MprisRemotePlugin::setVolume(int volume)
|
|||
void MprisRemotePlugin::setPosition(int position)
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, {
|
||||
{"player", m_currentPlayer},
|
||||
{"SetPosition", position}
|
||||
{QStringLiteral("player"), m_currentPlayer},
|
||||
{QStringLiteral("SetPosition"), position}
|
||||
});
|
||||
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
|
||||
QString username;
|
||||
#ifdef Q_OS_WIN
|
||||
username = qgetenv("USERNAME");
|
||||
username = QString::fromLatin1(qgetenv("USERNAME"));
|
||||
#else
|
||||
username = qgetenv("USER");
|
||||
username = QString::fromLatin1(qgetenv("USER"));
|
||||
#endif
|
||||
|
||||
m_imagesDir = QDir::temp().absoluteFilePath(QStringLiteral("kdeconnect_") + username);
|
||||
|
@ -122,7 +122,7 @@ void Notification::createKNotification(const NetworkPacket& np)
|
|||
} else if (m_text.isEmpty()) {
|
||||
m_notification->setText(escapedTitle);
|
||||
} else {
|
||||
m_notification->setText(escapedTitle + ": " + escapedText);
|
||||
m_notification->setText(escapedTitle + QStringLiteral(": ") + escapedText);
|
||||
}
|
||||
|
||||
#if KNOTIFICATIONS_VERSION >= QT_VERSION_CHECK(5, 57, 0)
|
||||
|
|
|
@ -118,7 +118,7 @@ void NotificationsDbusInterface::addNotification(Notification* noti)
|
|||
m_notifications[publicId] = noti;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,8 @@ void NotificationsDbusInterface::sendReply(const QString& replyId, const QString
|
|||
void NotificationsDbusInterface::sendAction(const QString& key, const QString& action)
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_NOTIFICATION_ACTION);
|
||||
np.set<QString>("key", key);
|
||||
np.set<QString>("action", action);
|
||||
np.set<QString>(QStringLiteral("key"), key);
|
||||
np.set<QString>(QStringLiteral("action"), action);
|
||||
m_plugin->sendPacket(np);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ NotificationsPlugin::NotificationsPlugin(QObject* parent, const QVariantList& ar
|
|||
|
||||
void NotificationsPlugin::connected()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{"request", true}});
|
||||
NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{QStringLiteral("request"), true}});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ SendReplyDialog::SendReplyDialog(const QString& originalMessage, const QString&
|
|||
, m_ui(new Ui::SendReplyDialog)
|
||||
{
|
||||
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);
|
||||
button->setText(i18n("Send"));
|
||||
|
|
|
@ -65,7 +65,7 @@ void PhotoPlugin::requestPhoto(const QString& fileName)
|
|||
|
||||
QString PhotoPlugin::dbusPath() const
|
||||
{
|
||||
return "/modules/kdeconnect/devices/" + device()->id() + "/photo";
|
||||
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/photo");
|
||||
}
|
||||
|
||||
#include "photoplugin.moc"
|
||||
|
|
|
@ -71,7 +71,7 @@ void PingPlugin::sendPing(const QString& customMessage)
|
|||
|
||||
QString PingPlugin::dbusPath() const
|
||||
{
|
||||
return "/modules/kdeconnect/devices/" + device()->id() + "/ping";
|
||||
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/ping");
|
||||
}
|
||||
|
||||
#include "pingplugin.moc"
|
||||
|
|
|
@ -55,13 +55,13 @@ bool RemoteCommandsPlugin::receivePacket(const NetworkPacket& np)
|
|||
|
||||
void RemoteCommandsPlugin::connected()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{"requestCommandList", true}});
|
||||
NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{QStringLiteral("requestCommandList"), true}});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -74,13 +74,13 @@ void RemoteCommandsPlugin::setCommands(const QByteArray& cmds)
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
void RemoteCommandsPlugin::editCommands()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{ "setup", true }});
|
||||
NetworkPacket np(PACKET_TYPE_RUNCOMMAND_REQUEST, {{QStringLiteral("setup"), true }});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ RemoteControlPlugin::~RemoteControlPlugin()
|
|||
void RemoteControlPlugin::moveCursor(const QPoint &p)
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {
|
||||
{"dx", p.x()},
|
||||
{"dy", p.y()}
|
||||
{QStringLiteral("dx"), p.x()},
|
||||
{QStringLiteral("dy"), p.y()}
|
||||
});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ void RemoteControlPlugin::sendCommand(const QString &name, bool val)
|
|||
|
||||
QString RemoteControlPlugin::dbusPath() const
|
||||
{
|
||||
return "/modules/kdeconnect/devices/" + device()->id() + "/remotecontrol";
|
||||
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotecontrol");
|
||||
}
|
||||
|
||||
#include "remotecontrolplugin.moc"
|
||||
|
|
|
@ -79,22 +79,22 @@ RemoteKeyboardPlugin::~RemoteKeyboardPlugin()
|
|||
bool RemoteKeyboardPlugin::receivePacket(const NetworkPacket& np)
|
||||
{
|
||||
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"
|
||||
<< PACKET_TYPE_MOUSEPAD_ECHO;
|
||||
return false;
|
||||
}
|
||||
// qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Received keypress" << np;
|
||||
Q_EMIT keyPressReceived(np.get<QString>("key"),
|
||||
np.get<int>("specialKey", 0),
|
||||
np.get<int>("shift", false),
|
||||
np.get<int>("ctrl", false),
|
||||
np.get<int>("alt", false));
|
||||
Q_EMIT keyPressReceived(np.get<QString>(QStringLiteral("key")),
|
||||
np.get<int>(QStringLiteral("specialKey"), 0),
|
||||
np.get<int>(QStringLiteral("shift"), false),
|
||||
np.get<int>(QStringLiteral("ctrl"), false),
|
||||
np.get<int>(QStringLiteral("alt"), 0));
|
||||
return true;
|
||||
} else if (np.type() == PACKET_TYPE_MOUSEPAD_KEYBOARDSTATE) {
|
||||
// qCWarning(KDECONNECT_PLUGIN_REMOTEKEYBOARD) << "Received keyboardstate" << np;
|
||||
if (m_remoteState != np.get<bool>("state")) {
|
||||
m_remoteState = np.get<bool>("state");
|
||||
if (m_remoteState != np.get<bool>(QStringLiteral("state"))) {
|
||||
m_remoteState = np.get<bool>(QStringLiteral("state"));
|
||||
Q_EMIT remoteStateChanged(m_remoteState);
|
||||
}
|
||||
return true;
|
||||
|
@ -107,23 +107,23 @@ void RemoteKeyboardPlugin::sendKeyPress(const QString& key, int specialKey,
|
|||
bool alt, bool sendAck) const
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {
|
||||
{"key", key},
|
||||
{"specialKey", specialKey},
|
||||
{"shift", shift},
|
||||
{"ctrl", ctrl},
|
||||
{"alt", alt},
|
||||
{"sendAck", sendAck}
|
||||
{QStringLiteral("key"), key},
|
||||
{QStringLiteral("specialKey"), specialKey},
|
||||
{QStringLiteral("shift"), shift},
|
||||
{QStringLiteral("ctrl"), ctrl},
|
||||
{QStringLiteral("alt"), alt},
|
||||
{QStringLiteral("sendAck"), sendAck}
|
||||
});
|
||||
sendPacket(np);
|
||||
}
|
||||
|
||||
void RemoteKeyboardPlugin::sendQKeyEvent(const QVariantMap& keyEvent, bool sendAck) const
|
||||
{
|
||||
if (!keyEvent.contains("key"))
|
||||
if (!keyEvent.contains(QStringLiteral("key")))
|
||||
return;
|
||||
int k = translateQtKey(keyEvent.value("key").toInt());
|
||||
int modifiers = keyEvent.value("modifiers").toInt();
|
||||
sendKeyPress(keyEvent.value("text").toString(), k,
|
||||
int k = translateQtKey(keyEvent.value(QStringLiteral("key")).toInt());
|
||||
int modifiers = keyEvent.value(QStringLiteral("modifiers")).toInt();
|
||||
sendKeyPress(keyEvent.value(QStringLiteral("text")).toString(), k,
|
||||
modifiers & Qt::ShiftModifier,
|
||||
modifiers & Qt::ControlModifier,
|
||||
modifiers & Qt::AltModifier,
|
||||
|
@ -141,7 +141,7 @@ void RemoteKeyboardPlugin::connected()
|
|||
|
||||
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
|
||||
{
|
||||
return "/modules/kdeconnect/devices/" + device()->id() + "/remotesystemvolume";
|
||||
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotesystemvolume");
|
||||
}
|
||||
|
||||
#include "remotesystemvolumeplugin.moc"
|
||||
|
|
|
@ -79,7 +79,7 @@ bool RunCommandPlugin::receivePacket(const NetworkPacket& np)
|
|||
qCInfo(KDECONNECT_PLUGIN_RUNCOMMAND) << "Running:" << COMMAND << ARGS << commandJson[QStringLiteral("command")].toString();
|
||||
QProcess::startDetached(QStringLiteral(COMMAND), QStringList()<< QStringLiteral(ARGS) << commandJson[QStringLiteral("command")].toString());
|
||||
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")) });
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ void RunCommandPlugin::connected()
|
|||
void RunCommandPlugin::sendConfig()
|
||||
{
|
||||
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)
|
||||
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"));
|
||||
|
||||
if (reply.errorMessage() != nullptr) {
|
||||
if (!reply.errorMessage().isEmpty()) {
|
||||
qCDebug(KDECONNECT_PLUGIN_SCREENSAVERINHIBIT) << "Unable to inhibit the screensaver: " << reply.errorMessage();
|
||||
inhibitCookie = 0;
|
||||
} else {
|
||||
|
|
|
@ -65,7 +65,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin)
|
|||
QDBusInterface iface(QStringLiteral("org.freedesktop.DBus"), QStringLiteral("/org/freedesktop/DBus"),
|
||||
QStringLiteral("org.freedesktop.DBus"));
|
||||
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();
|
||||
loadApplications();
|
||||
|
@ -79,7 +79,7 @@ NotificationsListener::~NotificationsListener()
|
|||
QDBusInterface iface(QStringLiteral("org.freedesktop.DBus"), QStringLiteral("/org/freedesktop/DBus"),
|
||||
QStringLiteral("org.freedesktop.DBus"));
|
||||
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"));
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ QSharedPointer<QIODevice> NotificationsListener::iconForIconName(const QString&
|
|||
// try falling back to hicolor theme:
|
||||
KIconTheme hicolor(QStringLiteral("hicolor"));
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -242,10 +242,10 @@ uint NotificationsListener::Notify(const QString& appName, uint replacesId,
|
|||
|
||||
//qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Sending notification from" << appName << ":" <<ticker << "; appIcon=" << appIcon;
|
||||
NetworkPacket np(PACKET_TYPE_NOTIFICATION, {
|
||||
{"id", QString::number(replacesId > 0 ? replacesId : ++id)},
|
||||
{"appName", appName},
|
||||
{"ticker", ticker},
|
||||
{"isClearable", timeout == 0}
|
||||
{QStringLiteral("id"), QString::number(replacesId > 0 ? replacesId : ++id)},
|
||||
{QStringLiteral("appName"), appName},
|
||||
{QStringLiteral("ticker"), ticker},
|
||||
{QStringLiteral("isClearable"), timeout == 0}
|
||||
}); // KNotifications are persistent if
|
||||
// timeout == 0, for other notifications
|
||||
// clearability is pointless
|
||||
|
|
|
@ -83,8 +83,8 @@ void Mounter::onPackageReceived(const NetworkPacket& np)
|
|||
return;
|
||||
}
|
||||
|
||||
if (np.has("errorMessage")) {
|
||||
Q_EMIT failed(np.get<QString>("errorMessage", ""));
|
||||
if (np.has(QStringLiteral("errorMessage"))) {
|
||||
Q_EMIT failed(np.get<QString>(QStringLiteral("errorMessage")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ void Mounter::onPackageReceived(const NetworkPacket& np)
|
|||
const QString program = QStringLiteral("sshfs");
|
||||
|
||||
QString path;
|
||||
if (np.has(QStringLiteral("multiPaths"))) path = '/';
|
||||
if (np.has(QStringLiteral("multiPaths"))) path = QStringLiteral("/");
|
||||
else path = np.get<QString>(QStringLiteral("path"));
|
||||
|
||||
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("-f")
|
||||
<< 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("UserKnownHostsFile=/dev/null") //Prevent storing as a known host
|
||||
<< 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()
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_SFTP_REQUEST, {{"startBrowsing", true}});
|
||||
NetworkPacket np(PACKET_TYPE_SFTP_REQUEST, {{QStringLiteral("startBrowsing"), true}});
|
||||
m_sftp->sendPacket(np);
|
||||
|
||||
m_connectTimer.start();
|
||||
|
|
|
@ -68,14 +68,14 @@ void SftpPlugin::addToDolphin()
|
|||
{
|
||||
removeFromDolphin();
|
||||
|
||||
QUrl kioUrl("kdeconnect://"+deviceId+"/");
|
||||
QUrl kioUrl(QStringLiteral("kdeconnect://") + deviceId + QStringLiteral("/"));
|
||||
d->m_placesModel.addPlace(device()->name(), kioUrl, QStringLiteral("kdeconnect"));
|
||||
qCDebug(KDECONNECT_PLUGIN_SFTP) << "add to dolphin";
|
||||
}
|
||||
|
||||
void SftpPlugin::removeFromDolphin()
|
||||
{
|
||||
QUrl kioUrl("kdeconnect://"+deviceId+"/");
|
||||
QUrl kioUrl(QStringLiteral("kdeconnect://") + deviceId + QStringLiteral("/"));
|
||||
QModelIndex index = d->m_placesModel.closestItem(kioUrl);
|
||||
while (index.row() != -1) {
|
||||
d->m_placesModel.removePlace(index);
|
||||
|
@ -129,14 +129,14 @@ bool SftpPlugin::startBrowsing()
|
|||
{
|
||||
if (mountAndWait()) {
|
||||
//return new KRun(QUrl::fromLocalFile(mountPoint()), 0);
|
||||
return new KRun(QUrl("kdeconnect://"+deviceId), nullptr);
|
||||
return new KRun(QUrl(QStringLiteral("kdeconnect://") + deviceId), nullptr);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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
|
||||
return false;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ bool SftpPlugin::receivePacket(const NetworkPacket& np)
|
|||
}
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
bool receivePacket(const NetworkPacket& np) 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:
|
||||
void packetReceived(const NetworkPacket& np);
|
||||
|
|
|
@ -69,9 +69,9 @@ QUrl SharePlugin::getFileDestination(const QString filename) const
|
|||
{
|
||||
const QUrl dir = destinationDir().adjusted(QUrl::StripTrailingSlash);
|
||||
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())) {
|
||||
destination.setPath(dir.path() + '/' + KIO::suggestName(dir, filename), QUrl::DecodedMode);
|
||||
destination.setPath(dir.path() + QStringLiteral("/") + KIO::suggestName(dir, filename), QUrl::DecodedMode);
|
||||
}
|
||||
return destination;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ bool SharePlugin::receivePacket(const NetworkPacket& np)
|
|||
}
|
||||
|
||||
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); });
|
||||
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")) {
|
||||
QProcess* proc = new QProcess();
|
||||
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->closeWriteChannel();
|
||||
} else {
|
||||
|
@ -232,7 +232,7 @@ void SharePlugin::openFile(const QUrl& url)
|
|||
|
||||
QString SharePlugin::dbusPath() const
|
||||
{
|
||||
return "/modules/kdeconnect/devices/" + device()->id() + "/share";
|
||||
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/share");
|
||||
}
|
||||
|
||||
#include "shareplugin.moc"
|
||||
|
|
|
@ -61,9 +61,9 @@ bool SmsPlugin::receivePacket(const NetworkPacket& np)
|
|||
void SmsPlugin::sendSms(const QString& phoneNumber, const QString& messageBody)
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_SMS_REQUEST, {
|
||||
{"sendSms", true},
|
||||
{"phoneNumber", phoneNumber},
|
||||
{"messageBody", messageBody}
|
||||
{QStringLiteral("sendSms"), true},
|
||||
{QStringLiteral("phoneNumber"), phoneNumber},
|
||||
{QStringLiteral("messageBody"), messageBody}
|
||||
});
|
||||
qCDebug(KDECONNECT_PLUGIN_SMS) << "Dispatching SMS send request to remote";
|
||||
sendPacket(np);
|
||||
|
@ -79,7 +79,7 @@ void SmsPlugin::requestAllConversations()
|
|||
void SmsPlugin::requestConversation (const qint64& conversationID) const
|
||||
{
|
||||
NetworkPacket np(PACKET_TYPE_SMS_REQUEST_CONVERSATION);
|
||||
np.set("threadID", conversationID);
|
||||
np.set(QStringLiteral("threadID"), conversationID);
|
||||
|
||||
sendPacket(np);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ void SmsPlugin::forwardToTelepathy(const ConversationMessage& message)
|
|||
|
||||
bool SmsPlugin::handleBatchMessages(const NetworkPacket& np)
|
||||
{
|
||||
const auto messages = np.get<QVariantList>("messages");
|
||||
const auto messages = np.get<QVariantList>(QStringLiteral("messages"));
|
||||
QList<ConversationMessage> messagesList;
|
||||
messagesList.reserve(messages.count());
|
||||
|
||||
|
@ -119,7 +119,7 @@ bool SmsPlugin::handleBatchMessages(const NetworkPacket& np)
|
|||
|
||||
QString SmsPlugin::dbusPath() const
|
||||
{
|
||||
return "/modules/kdeconnect/devices/" + device()->id() + "/sms";
|
||||
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/sms");
|
||||
}
|
||||
|
||||
#include "smsplugin.moc"
|
||||
|
|
|
@ -93,11 +93,11 @@ void SystemvolumePlugin::sendSinkList() {
|
|||
});
|
||||
|
||||
QJsonObject sinkObject {
|
||||
{"name", sink->name()},
|
||||
{"muted", sink->isMuted()},
|
||||
{"description", sink->description()},
|
||||
{"volume", sink->volume()},
|
||||
{"maxVolume", PulseAudioQt::normalVolume()}
|
||||
{QStringLiteral("name"), sink->name()},
|
||||
{QStringLiteral("muted"), sink->isMuted()},
|
||||
{QStringLiteral("description"), sink->description()},
|
||||
{QStringLiteral("volume"), sink->volume()},
|
||||
{QStringLiteral("maxVolume"), PulseAudioQt::normalVolume()}
|
||||
};
|
||||
|
||||
array.append(sinkObject);
|
||||
|
|
|
@ -270,8 +270,8 @@ bool SystemvolumePlugin::sendSinkList()
|
|||
#endif
|
||||
|
||||
QJsonObject sinkObject;
|
||||
sinkObject.insert("name", name);
|
||||
sinkObject.insert("description", desc);
|
||||
sinkObject.insert(QStringLiteral("name"), name);
|
||||
sinkObject.insert(QStringLiteral("description"), desc);
|
||||
|
||||
hr = device->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, (void **)&endpoint);
|
||||
if (hr != S_OK)
|
||||
|
@ -285,9 +285,9 @@ bool SystemvolumePlugin::sendSinkList()
|
|||
endpoint->GetMasterVolumeLevelScalar(&volume);
|
||||
endpoint->GetMute(&muted);
|
||||
|
||||
sinkObject.insert("muted", (bool)muted);
|
||||
sinkObject.insert("volume", (qint64)(volume * 100));
|
||||
sinkObject.insert("maxVolume", (qint64)100);
|
||||
sinkObject.insert(QStringLiteral("muted"), (bool)muted);
|
||||
sinkObject.insert(QStringLiteral("volume"), (qint64)(volume * 100));
|
||||
sinkObject.insert(QStringLiteral("maxVolume"), (qint64)100);
|
||||
|
||||
// Register Callback
|
||||
callback = new CAudioEndpointVolumeCallback(*this, name);
|
||||
|
|
|
@ -122,13 +122,13 @@ bool TelephonyPlugin::receivePacket(const NetworkPacket& np)
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
QString TelephonyPlugin::dbusPath() const
|
||||
{
|
||||
return "/modules/kdeconnect/devices/" + device()->id() + "/telephony";
|
||||
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/telephony");
|
||||
}
|
||||
|
||||
#include "telephonyplugin.moc"
|
||||
|
|
|
@ -51,7 +51,7 @@ void RemoteCommandsRunner::match(Plasma::RunnerContext &context)
|
|||
|
||||
DeviceDbusInterface deviceInterface(deviceId, this);
|
||||
|
||||
if(!deviceInterface.hasPlugin("kdeconnect_remotecommands")) {
|
||||
if(!deviceInterface.hasPlugin(QStringLiteral("kdeconnect_remotecommands"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -71,9 +71,9 @@ void RemoteCommandsRunner::match(Plasma::RunnerContext &context)
|
|||
match.setType(Plasma::QueryMatch::PossibleMatch);
|
||||
match.setId(it.key());
|
||||
match.setIconName(QStringLiteral("kdeconnect"));
|
||||
match.setText(deviceName + ": " + commandName);
|
||||
match.setText(deviceName + QStringLiteral(": ") + commandName);
|
||||
match.setSubtext(cont.value(QStringLiteral("command")).toString());
|
||||
match.setData(deviceId + "$" + it.key());
|
||||
match.setData(deviceId + QStringLiteral("$") + it.key());
|
||||
context.addMatch(match);
|
||||
}
|
||||
}
|
||||
|
@ -83,9 +83,9 @@ void RemoteCommandsRunner::match(Plasma::RunnerContext &context)
|
|||
|
||||
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"
|
||||
|
|
|
@ -35,10 +35,10 @@
|
|||
int main(int argc, char *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"));
|
||||
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), {}, "aleixpol@kde.org");
|
||||
aboutData.addAuthor(i18n("Nicolas Fella"), {}, "nicolas.fella@gmx.de");
|
||||
aboutData.addAuthor(i18n("Simon Redman"), {}, "simon@ergotech.com");
|
||||
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"), {}, QStringLiteral("aleixpol@kde.org"));
|
||||
aboutData.addAuthor(i18n("Nicolas Fella"), {}, QStringLiteral("nicolas.fella@gmx.de"));
|
||||
aboutData.addAuthor(i18n("Simon Redman"), {}, QStringLiteral("simon@ergotech.com"));
|
||||
KAboutData::setApplicationData(aboutData);
|
||||
|
||||
QString initialMessage;
|
||||
|
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
|
|||
QQmlApplicationEngine engine;
|
||||
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ bool SmsHelper::isShortCode(const QString& phoneNumber, const SmsHelper::Country
|
|||
if (phoneNumber.length() <= 6) {
|
||||
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;
|
||||
}
|
||||
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
|
||||
// or if Android decides it can't be bothered to report the country code, but probably we will
|
||||
// be fine anyway
|
||||
if (canonicalNumber.startsWith("41")) {
|
||||
if (canonicalNumber.startsWith(QStringLiteral("41"))) {
|
||||
return CountryCode::Australia;
|
||||
}
|
||||
if (canonicalNumber.startsWith("420")) {
|
||||
if (canonicalNumber.startsWith(QStringLiteral("420"))) {
|
||||
return CountryCode::CzechRepublic;
|
||||
}
|
||||
|
||||
|
@ -101,12 +101,12 @@ SmsHelper::CountryCode SmsHelper::determineCountryCode(const QString& canonicalN
|
|||
QString SmsHelper::canonicalizePhoneNumber(const QString& phoneNumber)
|
||||
{
|
||||
QString toReturn(phoneNumber);
|
||||
toReturn = toReturn.remove(' ');
|
||||
toReturn = toReturn.remove('-');
|
||||
toReturn = toReturn.remove('(');
|
||||
toReturn = toReturn.remove(')');
|
||||
toReturn = toReturn.remove('+');
|
||||
toReturn = toReturn.remove(QRegularExpression("^0*")); // Strip leading zeroes
|
||||
toReturn = toReturn.remove(QStringLiteral(" "));
|
||||
toReturn = toReturn.remove(QStringLiteral("-"));
|
||||
toReturn = toReturn.remove(QStringLiteral("("));
|
||||
toReturn = toReturn.remove(QStringLiteral(")"));
|
||||
toReturn = toReturn.remove(QStringLiteral("+"));
|
||||
toReturn = toReturn.remove(QRegularExpression(QStringLiteral("^0*"))); // Strip leading zeroes
|
||||
|
||||
if (toReturn.length() == 0) {
|
||||
// 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"));
|
||||
KdeConnectConfig::DeviceInfo devInfo = kcc->getTrustedDevice(QStringLiteral("testdevice"));
|
||||
QCOMPARE(devInfo.deviceName, QString("Test Device"));
|
||||
QCOMPARE(devInfo.deviceType, QString("phone"));
|
||||
QCOMPARE(devInfo.deviceName, QStringLiteral("Test Device"));
|
||||
QCOMPARE(devInfo.deviceType, QStringLiteral("phone"));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -85,8 +85,8 @@ void KdeConnectConfigTest::removeTrustedDevice()
|
|||
{
|
||||
kcc->removeTrustedDevice(QStringLiteral("testdevice"));
|
||||
KdeConnectConfig::DeviceInfo devInfo = kcc->getTrustedDevice(QStringLiteral("testdevice"));
|
||||
QCOMPARE(devInfo.deviceName, QString("unnamed"));
|
||||
QCOMPARE(devInfo.deviceType, QString("unknown"));
|
||||
QCOMPARE(devInfo.deviceName, QStringLiteral("unnamed"));
|
||||
QCOMPARE(devInfo.deviceType, QStringLiteral("unknown"));
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(KdeConnectConfigTest)
|
||||
|
|
|
@ -398,11 +398,11 @@ void LanLinkProviderTest::testIdentityPacket(QByteArray& identityPacket)
|
|||
QJsonObject jsonObject = jsonDocument.object();
|
||||
QJsonObject body = jsonObject.value(QStringLiteral("body")).toObject();
|
||||
|
||||
QCOMPARE(jsonObject.value("type").toString(), QString("kdeconnect.identity"));
|
||||
QVERIFY2(body.contains("deviceName"), "Device name not found in identity packet");
|
||||
QVERIFY2(body.contains("deviceId"), "Device id not found in identity packet");
|
||||
QVERIFY2(body.contains("protocolVersion"), "Protocol version not found in identity packet");
|
||||
QVERIFY2(body.contains("deviceType"), "Device type not found in identity packet");
|
||||
QCOMPARE(jsonObject.value(QStringLiteral("type")).toString(), QStringLiteral("kdeconnect.identity"));
|
||||
QVERIFY2(body.contains(QStringLiteral("deviceName")), "Device name not found in identity packet");
|
||||
QVERIFY2(body.contains(QStringLiteral("deviceId")), "Device id not found in identity packet");
|
||||
QVERIFY2(body.contains(QStringLiteral("protocolVersion")), "Protocol version 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)
|
||||
|
@ -448,7 +448,7 @@ void LanLinkProviderTest::socketBindErrorFail(const QUdpSocket& socket)
|
|||
QAbstractSocket::SocketError sockErr = socket.error();
|
||||
// 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 ");
|
||||
errorMessage = errorMessage + QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(sockErr);
|
||||
errorMessage = errorMessage + QString::fromLatin1(QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(sockErr));
|
||||
QFAIL(errorMessage.toLocal8Bit().data());
|
||||
}
|
||||
|
||||
|
|
|
@ -35,16 +35,16 @@ void NetworkPacketTests::networkPacketTest()
|
|||
{
|
||||
NetworkPacket np(QStringLiteral("com.test"));
|
||||
|
||||
np.set(QStringLiteral("hello"),"hola");
|
||||
QCOMPARE( (np.get<QString>("hello","bye")) , QString("hola") );
|
||||
np.set(QStringLiteral("hello"), QStringLiteral("hola"));
|
||||
QCOMPARE( (np.get<QString>(QStringLiteral("hello"), QStringLiteral("bye"))) , QStringLiteral("hola") );
|
||||
|
||||
np.set(QStringLiteral("hello"),"");
|
||||
QCOMPARE( (np.get<QString>("hello","bye")) , QString("") );
|
||||
np.set(QStringLiteral("hello"), QString());
|
||||
QCOMPARE((np.get<QString>(QStringLiteral("hello"), QStringLiteral("bye"))) , QString());
|
||||
|
||||
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();
|
||||
//qDebug() << "Serialized packet:" << ba;
|
||||
NetworkPacket np2(QLatin1String(""));
|
||||
|
@ -57,10 +57,10 @@ void NetworkPacketTests::networkPacketTest()
|
|||
QByteArray json("{\"id\":\"123\",\"type\":\"test\",\"body\":{\"testing\":true}}");
|
||||
//qDebug() << json;
|
||||
NetworkPacket::unserialize(json,&np2);
|
||||
QCOMPARE( np2.id(), QString("123") );
|
||||
QCOMPARE( (np2.get<bool>("testing")), true );
|
||||
QCOMPARE( (np2.get<bool>("not_testing")), false );
|
||||
QCOMPARE( (np2.get<bool>("not_testing",true)), true );
|
||||
QCOMPARE( np2.id(), QStringLiteral("123") );
|
||||
QCOMPARE( (np2.get<bool>(QStringLiteral("testing"))), true );
|
||||
QCOMPARE( (np2.get<bool>(QStringLiteral("not_testing"))), false );
|
||||
QCOMPARE( (np2.get<bool>(QStringLiteral("not_testing"),true)), true );
|
||||
|
||||
//NetworkPacket::unserialize("this is not json",&np2);
|
||||
//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::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 );
|
||||
|
||||
}
|
||||
|
|
|
@ -75,12 +75,12 @@ class PluginLoadTest : public QObject
|
|||
QVERIFY(d->isReachable());
|
||||
|
||||
d->setPluginEnabled(QStringLiteral("kdeconnect_mousepad"), false);
|
||||
QCOMPARE(d->isPluginEnabled("kdeconnect_mousepad"), false);
|
||||
QVERIFY(d->supportedPlugins().contains("kdeconnect_remotecontrol"));
|
||||
QCOMPARE(d->isPluginEnabled(QStringLiteral("kdeconnect_mousepad")), false);
|
||||
QVERIFY(d->supportedPlugins().contains(QStringLiteral("kdeconnect_remotecontrol")));
|
||||
|
||||
d->setPluginEnabled(QStringLiteral("kdeconnect_mousepad"), true);
|
||||
QCOMPARE(d->isPluginEnabled("kdeconnect_mousepad"), true);
|
||||
QVERIFY(d->supportedPlugins().contains("kdeconnect_remotecontrol"));
|
||||
QCOMPARE(d->isPluginEnabled(QStringLiteral("kdeconnect_mousepad")), true);
|
||||
QVERIFY(d->supportedPlugins().contains(QStringLiteral("kdeconnect_remotecontrol")));
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -98,7 +98,7 @@ class TestSendFile : public QObject
|
|||
void testSslJobs()
|
||||
{
|
||||
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();
|
||||
|
||||
const QString deviceId = KdeConnectConfig::instance()->deviceId()
|
||||
|
|
|
@ -137,9 +137,9 @@ void TestNotificationListener::testNotify()
|
|||
QCOMPARE(proxiedNotifications, d->getSentPackets());
|
||||
plugin = new TestNotificationsPlugin(this,
|
||||
QVariantList({ QVariant::fromValue<Device*>(d),
|
||||
"notifications_plugin",
|
||||
{"kdeconnect.notification"},
|
||||
"preferences-desktop-notification"}));
|
||||
QStringLiteral("notifications_plugin"),
|
||||
{QStringLiteral("kdeconnect.notification")},
|
||||
QStringLiteral("preferences-desktop-notification")}));
|
||||
QVERIFY(plugin->getNotificationsListener());
|
||||
delete plugin->getNotificationsListener();
|
||||
|
||||
|
@ -153,9 +153,9 @@ void TestNotificationListener::testNotify()
|
|||
plugin->config()->set(QStringLiteral("generalPersistent"), false);
|
||||
plugin->config()->set(QStringLiteral("generalIncludeBody"), true);
|
||||
plugin->config()->set(QStringLiteral("generalUrgency"), 0);
|
||||
QCOMPARE(plugin->config()->get<bool>("generalPersistent"), false);
|
||||
QCOMPARE(plugin->config()->get<bool>("generalIncludeBody"), true);
|
||||
QCOMPARE(plugin->config()->get<bool>("generalUrgency"), false);
|
||||
QCOMPARE(plugin->config()->get<bool>(QStringLiteral("generalPersistent")), false);
|
||||
QCOMPARE(plugin->config()->get<bool>(QStringLiteral("generalIncludeBody")), true);
|
||||
QCOMPARE(plugin->config()->get<bool>(QStringLiteral("generalUrgency")), false);
|
||||
|
||||
// applications are modified directly:
|
||||
listener->getApplications().clear();
|
||||
|
@ -179,10 +179,10 @@ void TestNotificationListener::testNotify()
|
|||
// ... have triggered sending a packet
|
||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||
// ... with our properties,
|
||||
QCOMPARE(d->getLastPacket()->get<uint>("id"), replacesId);
|
||||
QCOMPARE(d->getLastPacket()->get<QString>("appName"), appName);
|
||||
QCOMPARE(d->getLastPacket()->get<QString>("ticker"), summary + ": " + body);
|
||||
QCOMPARE(d->getLastPacket()->get<bool>("isClearable"), true);
|
||||
QCOMPARE(d->getLastPacket()->get<uint>(QStringLiteral("id")), replacesId);
|
||||
QCOMPARE(d->getLastPacket()->get<QString>(QStringLiteral("appName")), appName);
|
||||
QCOMPARE(d->getLastPacket()->get<QString>(QStringLiteral("ticker")), summary + QStringLiteral(": ") + body);
|
||||
QCOMPARE(d->getLastPacket()->get<bool>(QStringLiteral("isClearable")), true);
|
||||
QCOMPARE(d->getLastPacket()->hasPayload(), false);
|
||||
|
||||
// ... and create a new application internally that is initialized correctly:
|
||||
|
@ -200,13 +200,13 @@ void TestNotificationListener::testNotify()
|
|||
QString icon2(QStringLiteral("some-icon2"));
|
||||
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(++proxiedNotifications, d->getSentPackets());
|
||||
QCOMPARE(d->getLastPacket()->get<uint>("id"), replacesId+1);
|
||||
QCOMPARE(d->getLastPacket()->get<QString>("appName"), appName2);
|
||||
QCOMPARE(d->getLastPacket()->get<QString>("ticker"), summary2 + ": " + body2);
|
||||
QCOMPARE(d->getLastPacket()->get<bool>("isClearable"), false); // timeout != 0
|
||||
QCOMPARE(d->getLastPacket()->get<uint>(QStringLiteral("id")), replacesId+1);
|
||||
QCOMPARE(d->getLastPacket()->get<QString>(QStringLiteral("appName")), appName2);
|
||||
QCOMPARE(d->getLastPacket()->get<QString>(QStringLiteral("ticker")), summary2 + QStringLiteral(": ") + body2);
|
||||
QCOMPARE(d->getLastPacket()->get<bool>(QStringLiteral("isClearable")), false); // timeout != 0
|
||||
QCOMPARE(d->getLastPacket()->hasPayload(), false);
|
||||
QCOMPARE(listener->getApplications().count(), 2);
|
||||
QVERIFY(listener->getApplications().contains(appName2));
|
||||
|
@ -228,15 +228,15 @@ void TestNotificationListener::testNotify()
|
|||
|
||||
// if min-urgency is set, lower urgency levels are not synced:
|
||||
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(proxiedNotifications, d->getSentPackets());
|
||||
// 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(++proxiedNotifications, d->getSentPackets());
|
||||
// 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(++proxiedNotifications, d->getSentPackets());
|
||||
plugin->config()->set(QStringLiteral("generalUrgency"), 0);
|
||||
|
@ -245,7 +245,7 @@ void TestNotificationListener::testNotify()
|
|||
QVERIFY(listener->getApplications().contains(appName));
|
||||
listener->getApplications()[appName].active = false;
|
||||
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(proxiedNotifications, d->getSentPackets());
|
||||
// others are still:
|
||||
|
@ -289,7 +289,7 @@ void TestNotificationListener::testNotify()
|
|||
QCOMPARE(retId, replacesId);
|
||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||
// 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);
|
||||
QCOMPARE(retId, replacesId);
|
||||
QCOMPARE(++proxiedNotifications, d->getSentPackets());
|
||||
|
@ -331,7 +331,7 @@ void TestNotificationListener::testNotify()
|
|||
QVERIFY(d->getLastPacket()->hasPayload());
|
||||
QCOMPARE(d->getLastPacket()->payloadSize(), fi.size());
|
||||
// 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(++proxiedNotifications, d->getSentPackets());
|
||||
QVERIFY(!d->getLastPacket()->hasPayload());
|
||||
|
@ -348,7 +348,7 @@ void TestNotificationListener::testNotify()
|
|||
|
||||
// image-path in hints
|
||||
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(++proxiedNotifications, d->getSentPackets());
|
||||
QVERIFY(d->getLastPacket()->hasPayload());
|
||||
|
@ -359,7 +359,7 @@ void TestNotificationListener::testNotify()
|
|||
|
||||
// image_path in hints
|
||||
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(++proxiedNotifications, d->getSentPackets());
|
||||
QVERIFY(d->getLastPacket()->hasPayload());
|
||||
|
@ -379,9 +379,9 @@ void TestNotificationListener::testNotify()
|
|||
0x11, 0x12, 0x13, 0x14,
|
||||
0x21, 0x22, 0x23, 0x24,
|
||||
0x31, 0x32, 0x33, 0x34 };
|
||||
QVariantMap imageData = {{"width", width}, {"height", height}, {"rowStride", rowStride},
|
||||
{"bitsPerSample", bitsPerSample}, {"channels", channels},
|
||||
{"hasAlpha", hasAlpha}, {"imageData", QByteArray(rawData, sizeof(rawData))}};
|
||||
QVariantMap imageData = {{QStringLiteral("width"), width}, {QStringLiteral("height"), height}, {QStringLiteral("rowStride"), rowStride},
|
||||
{QStringLiteral("bitsPerSample"), bitsPerSample}, {QStringLiteral("channels"), channels},
|
||||
{QStringLiteral("hasAlpha"), hasAlpha}, {QStringLiteral("imageData"), QByteArray(rawData, sizeof(rawData))}};
|
||||
QVariantMap hints;
|
||||
#define COMPARE_PIXEL(x, y) \
|
||||
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 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() });
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue