Skip to content

Commit 720f59e

Browse files
committed
Use current version of KDE Connect
1 parent b9c64b2 commit 720f59e

25 files changed

+51
-81
lines changed

.gitmodules

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
url = https://github.com/google/googletest
44
[submodule "kdeconnect/kdeconnect"]
55
path = kdeconnect-kde
6-
url = https://invent.kde.org/richardliebscher/kdeconnect-kde.git
6+
url = https://invent.kde.org/richardliebscher/kdeconnect-sfos.git
7+
branch = sailfishconnect

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0)
1+
cmake_minimum_required(VERSION 3.16)
22
cmake_policy(SET CMP0071 NEW)
33
project(SailfishConnect VERSION 0.7.0 LANGUAGES C CXX)
44

app/qml/pages/DevicePage.qml

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Page {
123123

124124
Button {
125125
text: i18n("Reject")
126-
onClicked: _device.rejectPairing()
126+
onClicked: _device.cancelPairing()
127127
}
128128
}
129129

@@ -160,7 +160,7 @@ Page {
160160

161161
text: i18n("Connect")
162162
onClicked: {
163-
_device.requestPair()
163+
_device.requestPairing()
164164
}
165165
}
166166

app/qml/pages/TouchpadPage.qml

+7-7
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ Page {
153153
onClicked: {
154154
if (!wasMoved && plugin !== null) {
155155
if (!holding) {
156-
plugin.sendCommand("singleclick", true)
156+
plugin.sendCommand({"singleclick": true})
157157
} else {
158-
plugin.sendCommand("singlerelease", true)
158+
plugin.sendCommand({"singlerelease": true})
159159
holding = false
160160
}
161161
}
@@ -164,17 +164,17 @@ Page {
164164
onDoubleClicked: {
165165
if (!wasMoved && plugin !== null) {
166166
if (!holding) {
167-
plugin.sendCommand("doubleclick", true)
167+
plugin.sendCommand({"doubleclick": true})
168168
} else {
169-
plugin.sendCommand("singlerelease", true)
169+
plugin.sendCommand({"singlerelease": true})
170170
holding = false
171171
}
172172
}
173173
}
174174

175175
onPressAndHold: {
176176
if (!wasMoved && plugin !== null) {
177-
plugin.sendCommand("singlehold", true)
177+
plugin.sendCommand({"singlehold": true})
178178
holding = true
179179
}
180180
}
@@ -204,7 +204,7 @@ Page {
204204
spacing: Theme.paddingSmall
205205

206206
Button {
207-
onClicked: plugin.sendCommand("singleclick", true)
207+
onClicked: plugin.sendCommand({"singleclick": true})
208208
preferredWidth: Theme.buttonWidthExtraSmall
209209
width: parent.btnWidth
210210
}
@@ -216,7 +216,7 @@ Page {
216216
}
217217

218218
Button {
219-
onClicked: plugin.sendCommand("rightclick", true)
219+
onClicked: plugin.sendCommand({"rightclick": true})
220220
preferredWidth: Theme.buttonWidthExtraSmall
221221
width: parent.btnWidth
222222
}

app/src/appdaemon.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void AppDaemon::askPairingConfirmation(Device *device)
6464
notification->setBody(i18n("Pending pairing request ..."));
6565
notification->setPreviewSummary(device->name());
6666
notification->setPreviewBody(i18n("Pairing request"));
67-
notification->setExpireTimeout(PairingHandler::pairingTimeoutMsec());
67+
notification->setExpireTimeout(PairingHandler::pairingTimeoutMsec);
6868
notification->setRemoteActions(
6969
{ UI::openDevicePageDbusAction(device->id()) });
7070

@@ -161,7 +161,7 @@ void AppDaemon::onWakeUp()
161161
void AppDaemon::onDeviceAdded(const QString &deviceId)
162162
{
163163
auto device = this->getDevice(deviceId);
164-
connect(device, &Device::pairingError, this,
164+
connect(device, &Device::pairingFailed, this,
165165
[this, deviceId](const QString& err) {
166166
onPairingError(deviceId, err);
167167
});

app/src/dbus/kdeconnect.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class RemoteControlApi : public RemoteControlDbusInterface {
4646
checkForDbusError(RemoteControlDbusInterface::moveCursor(p));
4747
}
4848

49-
Q_SCRIPTABLE void sendCommand(const QString &name, bool val) {
50-
checkForDbusError(RemoteControlDbusInterface::sendCommand(name, val));
49+
Q_SCRIPTABLE void sendCommand(const QVariantMap &body) {
50+
checkForDbusError(RemoteControlDbusInterface::sendCommand(body));
5151
}
5252

5353
Q_SCRIPTABLE void scroll(int x, int y) {
@@ -140,16 +140,16 @@ class DeviceApi : public DeviceDbusInterface {
140140
checkForDbusError(DeviceDbusInterface::unpair());
141141
}
142142

143-
Q_SCRIPTABLE void requestPair() {
144-
checkForDbusError(DeviceDbusInterface::requestPair());
143+
Q_SCRIPTABLE void requestPairing() {
144+
checkForDbusError(DeviceDbusInterface::requestPairing());
145145
}
146146

147147
Q_SCRIPTABLE void acceptPairing() {
148148
checkForDbusError(DeviceDbusInterface::acceptPairing());
149149
}
150150

151-
Q_SCRIPTABLE void rejectPairing() {
152-
checkForDbusError(DeviceDbusInterface::rejectPairing());
151+
Q_SCRIPTABLE void cancelPairing() {
152+
checkForDbusError(DeviceDbusInterface::cancelPairing());
153153
}
154154

155155
Q_SCRIPTABLE QString encryptionInfo() {

app/src/models/devicelistmodel.cpp

+8-20
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ DeviceListModel::DeviceListModel(QObject *parent)
5050
{
5151
m_daemon = Daemon::instance();
5252

53-
m_id = QString("DeviceListModel{0x%1}").arg(
54-
reinterpret_cast<std::uintptr_t>(this), 0, 16);
55-
m_daemon->acquireDiscoveryMode(m_id);
5653
m_devices = m_daemon->devicesList();
5754

5855
connect(m_daemon, &Daemon::deviceAdded,
@@ -65,10 +62,7 @@ DeviceListModel::DeviceListModel(QObject *parent)
6562
}
6663
}
6764

68-
DeviceListModel::~DeviceListModel()
69-
{
70-
m_daemon->releaseDiscoveryMode(m_id);
71-
}
65+
DeviceListModel::~DeviceListModel() = default;
7266

7367
int DeviceListModel::rowCount(const QModelIndex &parent) const
7468
{
@@ -90,19 +84,19 @@ QVariant DeviceListModel::data(const QModelIndex &index, int role) const
9084
case IdRole:
9185
return device->id();
9286
case IconUrlRole:
93-
return deviceTypeToIcon(device->type());
87+
return deviceTypeToIcon(device->type().toString());
9488
case SectionRole:
95-
return device->isTrusted()
89+
return device->isPaired()
9690
? (device->isReachable() ? Connected : Trusted)
9791
: (device->isReachable() ? Near : Nothing);
9892
case TrustedRole:
99-
return device->isTrusted();
93+
return device->isPaired();
10094
case ReachableRole:
10195
return device->isReachable();
10296
case HasPairingRequestsRole:
103-
return device->hasPairingRequests();
97+
return device->isPairRequestedByPeer();
10498
case WaitsForPairingRole:
105-
return device->waitsForPairing();
99+
return device->isPairRequested();
106100
}
107101

108102
return QVariant();
@@ -183,18 +177,12 @@ void DeviceListModel::connectDevice(Device *device)
183177
connect(device, &Device::nameChanged, this, [=]{
184178
deviceDataChanged(device, {Qt::DisplayRole, NameRole});
185179
});
186-
connect(device, &Device::trustedChanged, this, [=]{
187-
deviceDataChanged(device, {TrustedRole});
180+
connect(device, &Device::pairStateChanged, this, [=]{
181+
deviceDataChanged(device, {TrustedRole, HasPairingRequestsRole, WaitsForPairingRole});
188182
});
189183
connect(device, &Device::reachableChanged, this, [=]{
190184
deviceDataChanged(device, {ReachableRole});
191185
});
192-
connect(device, &Device::hasPairingRequestsChanged, this, [=]{
193-
deviceDataChanged(device, {HasPairingRequestsRole});
194-
});
195-
connect(device, &Device::waitsForPairingChanged, this, [=]{
196-
deviceDataChanged(device, {WaitsForPairingRole});
197-
});
198186
connect(device, &Device::destroyed, this, [=]{
199187
//qCCritical(logger) << "device destroyed with id" << device->id();
200188
deviceRemoved(device);

conanfile.txt

-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
[tool_requires]
2-
extra-cmake-modules/5.68.0@r1tschy/stable
3-
41
[requires]
52
KF5CoreAddons/5.36.0@r1tschy/stable
63
KF5I18n/5.36.0@r1tschy/stable
74
KF5Config/5.36.0@r1tschy/stable
8-
Qca-qt5/2.2.1@r1tschy/stable
95
libssh/0.9.5@r1tschy/stable
106

117
[options]
128
KF5CoreAddons/*:shared=False
139
KF5I18n/*:shared=False
1410
KF5Config/*:shared=False
1511

16-
Qca-qt5/*:shared=False
17-
1812
[imports]
1913
lib, *.so.* -> ./deps/lib
2014

kdeconnect-kde

Submodule kdeconnect-kde updated from 6e713be to 48bf646

plugins/batteryreport/batteryreportplugin.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,11 @@ BatteryReportPlugin::BatteryReportPlugin(QObject* parent, const QVariantList& ar
181181
this, &BatteryReportPlugin::sendStatus);
182182
}
183183

184-
bool BatteryReportPlugin::receivePacket(const NetworkPacket &np)
184+
void BatteryReportPlugin::receivePacket(const NetworkPacket &np)
185185
{
186186
if (np.get<bool>(QStringLiteral("request"))) {
187187
sendStatus();
188188
}
189-
190-
return true;
191189
}
192190

193191
void BatteryReportPlugin::connected()
@@ -211,4 +209,4 @@ void BatteryReportPlugin::sendStatus()
211209
sendPacket(packet);
212210
}
213211

214-
#include "batteryreportplugin.moc"
212+
#include "batteryreportplugin.moc"

plugins/batteryreport/batteryreportplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class BatteryReportPlugin : public KdeConnectPlugin
3838

3939
BatteryReportPlugin(QObject* parent, const QVariantList& args);
4040

41-
bool receivePacket(const NetworkPacket &np) override;
41+
void receivePacket(const NetworkPacket &np) override;
4242
void connected() override;
4343

4444
private:

plugins/sf_clipboard/clipboardplugin.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ClipboardPlugin::ClipboardPlugin(QObject* parent, const QVariantList& args)
3434
, m_clipboard(QGuiApplication::clipboard())
3535
{}
3636

37-
bool ClipboardPlugin::receivePacket(const NetworkPacket &np)
37+
void ClipboardPlugin::receivePacket(const NetworkPacket &np)
3838
{
3939
QString content = np.get<QString>(QStringLiteral("content"));
4040
if (np.type() == PACKET_TYPE_CLIPBOARD) {
@@ -49,8 +49,6 @@ bool ClipboardPlugin::receivePacket(const NetworkPacket &np)
4949
m_clipboard->setText(content);
5050
}
5151
}
52-
53-
return true;
5452
}
5553

5654
void ClipboardPlugin::pushClipboard()

plugins/sf_clipboard/clipboardplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ClipboardPlugin : public KdeConnectPlugin
3636
QString dbusPath() const override;
3737

3838
void connected() override {}
39-
bool receivePacket(const NetworkPacket &np) override;
39+
void receivePacket(const NetworkPacket &np) override;
4040
Q_SCRIPTABLE void pushClipboard();
4141

4242
private:

plugins/sf_mprisremote/mprisremoteplugin.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ MprisRemotePlugin::MprisRemotePlugin(QObject* parent, const QVariantList& args)
190190
this, &MprisRemotePlugin::askForAlbumArt);
191191
}
192192

193-
bool MprisRemotePlugin::receivePacket(const NetworkPacket& np)
193+
void MprisRemotePlugin::receivePacket(const NetworkPacket& np)
194194
{
195195
if (np.get<bool>("transferringAlbumArt", false)) {
196196
m_cache->endFetching(np.get<QString>("albumArtUrl"), np.payload(), np.payloadSize());
197-
return true;
197+
return;
198198
}
199199

200200
m_supportAlbumArtPayload = np.get<bool>(
@@ -238,8 +238,6 @@ bool MprisRemotePlugin::receivePacket(const NetworkPacket& np)
238238
emit playerRemoved(removedPlayer);
239239
}
240240
}
241-
242-
return true;
243241
}
244242

245243
void MprisRemotePlugin::askForAlbumArt(

plugins/sf_mprisremote/mprisremoteplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class MprisRemotePlugin : public KdeConnectPlugin
129129
explicit MprisRemotePlugin(QObject* parent, const QVariantList& args);
130130

131131
void connected() override { }
132-
bool receivePacket(const NetworkPacket& np) override;
132+
void receivePacket(const NetworkPacket& np) override;
133133

134134
Q_SCRIPTABLE void sendCommand(
135135
const QString& player, const QString& method, const QString& value);

plugins/sf_sendnotifications/sendnotificationsplugin.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ SendNotificationsPlugin::SendNotificationsPlugin(QObject* parent, const QVariant
2929
, m_listener(new NotificationsListener(this))
3030
{ }
3131

32-
bool SendNotificationsPlugin::receivePacket(const NetworkPacket&)
32+
void SendNotificationsPlugin::receivePacket(const NetworkPacket&)
3333
{
3434
// impl. request for existing notifications
35-
return false;
3635
}
3736

3837
#include "sendnotificationsplugin.moc"

plugins/sf_sendnotifications/sendnotificationsplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class SendNotificationsPlugin : public KdeConnectPlugin
3232
SendNotificationsPlugin(QObject* parent, const QVariantList& args);
3333

3434
void connected() override { }
35-
bool receivePacket(const NetworkPacket &np) override;
35+
void receivePacket(const NetworkPacket &np) override;
3636

3737
private:
3838
NotificationsListener* m_listener;

plugins/sf_share/shareplugin.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ QString SharePlugin::incomingPath() const
8383
}
8484
}
8585

86-
bool SharePlugin::receivePacket(const NetworkPacket& np)
86+
void SharePlugin::receivePacket(const NetworkPacket& np)
8787
{
8888
if (np.hasPayload()) {
8989
const QString filename = escapeForFilePath(np.get<QString>(
@@ -112,7 +112,7 @@ bool SharePlugin::receivePacket(const NetworkPacket& np)
112112
qCWarning(logger)
113113
<< "Share failed: failed to create temporary text file"
114114
<< tmpFile.fileName();
115-
return true;
115+
return;
116116
}
117117

118118
tmpFile.write(text.toUtf8());
@@ -129,8 +129,6 @@ bool SharePlugin::receivePacket(const NetworkPacket& np)
129129
} else {
130130
qCWarning(logger) << "Empty share received";
131131
}
132-
133-
return true;
134132
}
135133

136134
void SharePlugin::shareUrl(const QUrl& url, bool open)

plugins/sf_share/shareplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class SharePlugin : public KdeConnectPlugin
3232
QString incomingPath() const;
3333

3434
void connected() override { }
35-
bool receivePacket(const NetworkPacket &np) override;
35+
void receivePacket(const NetworkPacket &np) override;
3636

3737
Q_SCRIPTABLE void shareUrl(const QString& url) { shareUrl(QUrl(url), false); }
3838
Q_SCRIPTABLE void shareUrls(const QStringList& urls);

plugins/sftpserver/sftpserverplugin.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static const QString PACKET_TYPE_SFTP = QStringLiteral("kdeconnect.sftp");
3030
static const QString PACKET_TYPE_SFTP_REQUEST = QStringLiteral("kdeconnect.sftp.request");
3131

3232

33-
bool SftpServerPlugin::receivePacket(const NetworkPacket& np)
33+
void SftpServerPlugin::receivePacket(const NetworkPacket& np)
3434
{
3535
if (np.type() == PACKET_TYPE_SFTP_REQUEST) {
3636
if (np.get<bool>("startBrowsing")) {
@@ -40,10 +40,7 @@ bool SftpServerPlugin::receivePacket(const NetworkPacket& np)
4040
NetworkPacket resultNp(PACKET_TYPE_SFTP);
4141

4242
sendPacket(resultNp);
43-
return true;
4443
}
45-
46-
return false;
4744
}
4845

4946
#include "sftpserverplugin.moc"

plugins/sftpserver/sftpserverplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ class SftpServerPlugin : public KdeConnectPlugin
2626
using KdeConnectPlugin::KdeConnectPlugin;
2727

2828
void connected() override {}
29-
bool receivePacket(const NetworkPacket &np) override;
29+
void receivePacket(const NetworkPacket &np) override;
3030
};

0 commit comments

Comments
 (0)