Compare commits

...

14 commits

Author SHA1 Message Date
Alexander Lohnau
6530274f75 plugins: Prefer using statements with baseclass over empty constructor
Those plugins re really simple and don't need any initialization logic.
With the using statement, we do not need to add a constructor and pass the parent/args to the baseclass
2023-07-28 16:19:31 +02:00
Alexander Lohnau
867c4ab6fc Remove unused default destructors
Overriding and defaulting them in the header doesn't make sense

For the dbus interfaces, we don't have any reasources to clean up or memory to be released. Meaning we can drop those lines too
2023-07-28 16:18:59 +02:00
Alexander Lohnau
7d685c94cc Discard unused params more elegantly
By commenting out the var nime, we get compile-time checks

Also, we can omit them for slots
2023-07-28 16:18:59 +02:00
Alexander Lohnau
e6a9bc29ab Enable Qt6 CI 2023-07-28 16:18:59 +02:00
Alexander Lohnau
c2eea29c91 KdeConnectKcm: Do not make generated UI class instance a ptr 2023-07-28 16:18:59 +02:00
Alexander Lohnau
43bc309f3d Remove trailing / for KPluginMetaData::findPlugins
This is not needed and pretty much all usages of this method don't do it too
2023-07-28 16:18:59 +02:00
Alexander Lohnau
09130d1ba0 ClipboardListener: Simplify initialization of singelton
We initialize the static field only when the method is called. Meaning we do not need to check and assign the value
2023-07-28 16:18:59 +02:00
Alexander Lohnau
336709f093 Do not make m_ui instance a ptr
By having it as a simple member variable, we do not need to take care of deleting it manually
2023-07-28 16:18:59 +02:00
Alexander Lohnau
02d97aabf4 Add explicit moc includes to cpp files
The rationale is explained in https://planet.kde.org/friedrich-kossebau-2023-06-28-include-also-moc-files-of-headers/

In case of KDEConnect, it impressively speeds up compilation. Before it
took 390 seconds on a clean build and with this change it took 330 seconds.
This is due to the mocs_compilation having to include the header files
and thus all their headers. Due to the lots of small plugins we have,
this means that the same headers must be compiled plenty of times.
When we include the moc files directly in the C++ file, they are already
available.
2023-07-28 16:07:34 +02:00
Alexander Lohnau
bd07b9b255 Also use method-scoped static in Windows SftpPlugin 2023-07-28 16:07:12 +02:00
Alexander Lohnau
8edd2a2e52 Use initializer list syntax where appropiate 2023-07-28 16:07:12 +02:00
Alexander Lohnau
e4c743a680 SftpPlugin: Do not use global static for variable
We only load it in one case anyway, meaning we can make it static in the method scope
2023-07-28 16:07:12 +02:00
Alexander Lohnau
eedbfe9b49 KDEConnectPluginConfig: Remove unneeded check for delete
Deleting a nullptr is a noop
2023-07-28 16:07:12 +02:00
Alexander Lohnau
aeb1d7f4cc Modernize plugin loading code
Use the new utility-methods and improve the logging.
2023-07-28 16:07:12 +02:00
154 changed files with 447 additions and 537 deletions

View file

@ -7,3 +7,6 @@ include:
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd-qt6.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows-qt6.yml

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: CC0-1.0
Dependencies:
- 'on': ['@all']
- 'on': ['Linux/Qt5', 'FreeBSD/Qt5', 'Windows/Qt5']
'require':
'frameworks/extra-cmake-modules': '@stable'
'frameworks/kcoreaddons': '@stable'
@ -21,13 +21,39 @@ Dependencies:
'frameworks/kpeople': '@stable'
'frameworks/kwindowsystem': '@stable'
'frameworks/qqc2-desktop-style': '@stable'
- 'on': ['Linux', 'FreeBSD']
- 'on': ['Linux/Qt5', 'FreeBSD/Qt5']
'require':
'frameworks/kpackage': '@stable'
'libraries/pulseaudio-qt': '@stable'
'libraries/plasma-wayland-protocols': '@stable'
- 'on': ['Linux']
- 'on': ['Linux/Qt5']
'require':
'frameworks/modemmanager-qt': '@stable'
- 'on': ['Linux/Qt6', 'FreeBSD/Qt6', 'Windows/Qt6']
'require':
'frameworks/extra-cmake-modules': '@latest-kf6'
'frameworks/kcoreaddons': '@latest-kf6'
'frameworks/kconfig': '@latest-kf6'
'frameworks/ki18n': '@latest-kf6'
'frameworks/kitemmodels': '@latest-kf6'
'frameworks/kcontacts': '@latest-kf6'
'frameworks/kirigami': '@latest-kf6'
'frameworks/kdbusaddons': '@latest-kf6'
'frameworks/knotifications': '@latest-kf6'
'frameworks/kiconthemes': '@latest-kf6'
'frameworks/kio': '@latest-kf6'
'frameworks/kcmutils': '@latest-kf6'
'frameworks/kservice': '@latest-kf6'
'frameworks/solid': '@latest-kf6'
'frameworks/kpeople': '@latest-kf6'
'frameworks/kwindowsystem': '@latest-kf6'
'frameworks/qqc2-desktop-style': '@latest-kf6'
- 'on': ['Linux/Qt6', 'FreeBSD/Qt6']
'require':
'frameworks/kpackage': '@latest-kf6'
'libraries/pulseaudio-qt': '@latest-kf6'
'libraries/plasma-wayland-protocols': '@latest-kf6'
- 'on': ['Linux/Qt6']
'require':
'frameworks/modemmanager-qt': '@latest-kf6'

View file

@ -36,9 +36,9 @@ int main(int argc, char **argv)
about.addAuthor(i18n("Aleix Pol Gonzalez"), QString(), QStringLiteral("aleixpol@kde.org"));
about.addAuthor(i18n("Albert Vaca Cintora"), QString(), QStringLiteral("albertvaka@gmail.com"));
QCommandLineParser parser;
parser.addOption(QCommandLineOption(QStringList(QStringLiteral("l")) << QStringLiteral("list-devices"), i18n("List all devices")));
parser.addOption(QCommandLineOption(QStringList{QStringLiteral("l"), QStringLiteral("list-devices")}, i18n("List all devices")));
parser.addOption(
QCommandLineOption(QStringList(QStringLiteral("a")) << QStringLiteral("list-available"), i18n("List available (paired and reachable) devices")));
QCommandLineOption(QStringList{QStringLiteral("a"), QStringLiteral("list-available")}, i18n("List available (paired and reachable) devices")));
parser.addOption(
QCommandLineOption(QStringLiteral("id-only"), i18n("Make --list-devices or --list-available print only the devices id, to ease scripting")));
parser.addOption(
@ -62,8 +62,8 @@ int main(int argc, char **argv)
parser.addOption(QCommandLineOption(QStringLiteral("attachment"),
i18n("File urls to send attachments with the message (can be passed multiple times)"),
i18n("file urls")));
parser.addOption(QCommandLineOption(QStringList(QStringLiteral("device")) << QStringLiteral("d"), i18n("Device ID"), QStringLiteral("dev")));
parser.addOption(QCommandLineOption(QStringList(QStringLiteral("name")) << QStringLiteral("n"), i18n("Device Name"), QStringLiteral("name")));
parser.addOption(QCommandLineOption(QStringList{QStringLiteral("device"), QStringLiteral("d")}, i18n("Device ID"), QStringLiteral("dev")));
parser.addOption(QCommandLineOption(QStringList{QStringLiteral("name"), QStringLiteral("n")}, i18n("Device Name"), QStringLiteral("name")));
parser.addOption(QCommandLineOption(QStringLiteral("encryption-info"), i18n("Get encryption info about said device")));
parser.addOption(QCommandLineOption(QStringLiteral("list-commands"), i18n("Lists remote commands and their ids")));
parser.addOption(QCommandLineOption(QStringLiteral("execute-command"), i18n("Executes a remote command by id"), QStringLiteral("id")));
@ -210,7 +210,7 @@ int main(int argc, char **argv)
QStringLiteral("org.kde.kdeconnect.device.share"),
QStringLiteral("shareUrls"));
msg.setArguments(QVariantList() << QVariant(urls));
msg.setArguments(QVariantList{QVariant(urls)});
blockOnReply(QDBusConnection::sessionBus().asyncCall(msg));
for (const QString &url : qAsConst(urls)) {
@ -221,7 +221,7 @@ int main(int argc, char **argv)
QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"),
QStringLiteral("org.kde.kdeconnect.device.share"),
QStringLiteral("shareText"));
msg.setArguments(QVariantList() << parser.value(QStringLiteral("share-text")));
msg.setArguments(QVariantList{parser.value(QStringLiteral("share-text"))});
blockOnReply(QDBusConnection::sessionBus().asyncCall(msg));
QTextStream(stdout) << i18n("Shared text: %1", parser.value(QStringLiteral("share-text"))) << Qt::endl;
} else if (parser.isSet(QStringLiteral("lock")) || parser.isSet(QStringLiteral("unlock"))) {
@ -280,7 +280,7 @@ int main(int argc, char **argv)
QStringLiteral("sendPing"));
if (parser.isSet(QStringLiteral("ping-msg"))) {
QString message = parser.value(QStringLiteral("ping-msg"));
msg.setArguments(QVariantList() << message);
msg.setArguments(QVariantList{message});
}
blockOnReply(QDBusConnection::sessionBus().asyncCall(msg));
} else if (parser.isSet(QStringLiteral("send-sms"))) {

View file

@ -64,3 +64,5 @@ void BluetoothDeviceLink::dataReceived()
Q_EMIT receivedPacket(packet);
}
}
#include "moc_bluetoothdevicelink.cpp"

View file

@ -23,3 +23,5 @@ QSharedPointer<QIODevice> BluetoothDownloadJob::payload() const
void BluetoothDownloadJob::start()
{
}
#include "moc_bluetoothdownloadjob.cpp"

View file

@ -304,3 +304,5 @@ void BluetoothLinkProvider::socketDisconnected(const QBluetoothAddress &peer, Mu
BluetoothLinkProvider::~BluetoothLinkProvider()
{
}
#include "moc_bluetoothlinkprovider.cpp"

View file

@ -64,3 +64,5 @@ void BluetoothUploadJob::closeConnection()
mData->close();
deleteLater();
}
#include "moc_bluetoothuploadjob.cpp"

View file

@ -452,3 +452,5 @@ void ConnectionMultiplexer::removeChannel(QBluetoothUuid channelId)
Q_EMIT channel->disconnected();
}
#include "moc_connectionmultiplexer.cpp"

View file

@ -99,3 +99,5 @@ bool MultiplexChannel::isSequential() const
{
return true;
}
#include "moc_multiplexchannel.cpp"

View file

@ -13,3 +13,5 @@ MultiplexChannelState::MultiplexChannelState()
, close_after_write{false}
{
}
#include "moc_multiplexchannelstate.cpp"

View file

@ -27,8 +27,6 @@ private:
MultiplexChannelState();
public:
~MultiplexChannelState() = default;
constexpr static int BUFFER_SIZE = 4096;
private:

View file

@ -15,3 +15,5 @@ DeviceLink::DeviceLink(const QString &deviceId, LinkProvider *parent)
parent->onLinkDestroyed(deviceId, this);
});
}
#include "moc_devicelink.cpp"

View file

@ -19,7 +19,6 @@ class DeviceLink : public QObject
Q_OBJECT
public:
DeviceLink(const QString &deviceId, LinkProvider *parent);
~DeviceLink() override = default;
QString deviceId() const
{

View file

@ -146,10 +146,8 @@ void CompositeUploadJob::socketDisconnected()
m_socket->close();
}
void CompositeUploadJob::socketError(QAbstractSocket::SocketError error)
void CompositeUploadJob::socketError()
{
Q_UNUSED(error);
// Do not close the socket because when android closes the socket (share is cancelled) closing the socket leads to a cyclic socketError and eventually a
// segv
setError(SocketError);
@ -158,10 +156,8 @@ void CompositeUploadJob::socketError(QAbstractSocket::SocketError error)
m_running = false;
}
void CompositeUploadJob::sslError(const QList<QSslError> &errors)
void CompositeUploadJob::sslError()
{
Q_UNUSED(errors);
m_socket->close();
setError(SslError);
emitResult();
@ -240,10 +236,8 @@ bool CompositeUploadJob::doKill()
return true;
}
void CompositeUploadJob::slotProcessedAmount(KJob *job, KJob::Unit unit, qulonglong amount)
void CompositeUploadJob::slotProcessedAmount(KJob * /*job*/, KJob::Unit unit, qulonglong amount)
{
Q_UNUSED(job);
m_currentJobSendPayloadSize = amount;
quint64 uploaded = m_totalSendPayloadSize + m_currentJobSendPayloadSize;
@ -289,3 +283,5 @@ void CompositeUploadJob::emitDescription(const QString &currentFileName)
setProcessedAmount(Files, m_currentJobNum);
setTotalAmount(Files, m_totalJobs);
}
#include "moc_compositeuploadjob.cpp"

View file

@ -55,8 +55,8 @@ private:
private Q_SLOTS:
void newConnection();
void socketDisconnected();
void socketError(QAbstractSocket::SocketError socketError);
void sslError(const QList<QSslError> &errors);
void socketError();
void sslError();
void encrypted();
void slotProcessedAmount(KJob *job, KJob::Unit unit, qulonglong amount);
void slotResult(KJob *job) override;

View file

@ -113,3 +113,5 @@ void LanDeviceLink::dataReceived()
Q_EMIT receivedPacket(packet);
}
}
#include "moc_landevicelink.cpp"

View file

@ -18,6 +18,10 @@
#include <mstcpip.h>
#endif
#if defined(Q_OS_WIN) || defined(Q_OS_FREEBSD)
#include <QNetworkInterface>
#endif
#include <QHostInfo>
#include <QMetaEnum>
#include <QNetworkProxy>
@ -626,3 +630,5 @@ void LanLinkProvider::addLink(QSslSocket *socket, const DeviceInfo &deviceInfo)
}
Q_EMIT onConnectionReceived(deviceLink);
}
#include "moc_lanlinkprovider.cpp"

View file

@ -118,3 +118,5 @@ void MdnsDiscovery::stopDiscovering()
m_serviceBrowser = nullptr;
}
}
#include "moc_mdnsdiscovery.cpp"

View file

@ -46,3 +46,5 @@ void Server::close()
QTcpServer::close();
Q_EMIT closed();
}
#include "moc_server.cpp"

View file

@ -19,7 +19,6 @@ class KDECONNECTCORE_EXPORT Server : public QTcpServer
public:
Server(QObject *parent = nullptr);
~Server() override = default;
QSslSocket *nextPendingConnection() override;
void close();

View file

@ -64,10 +64,8 @@ void UploadJob::uploadNextPacket()
}
}
void UploadJob::encryptedBytesWritten(qint64 bytes)
void UploadJob::encryptedBytesWritten(qint64 /*bytes*/)
{
Q_UNUSED(bytes);
if (m_socket->encryptedBytesToWrite() == 0) {
bytesUploaded += bytesUploading;
setProcessedAmount(Bytes, bytesUploaded);
@ -93,3 +91,5 @@ const NetworkPacket UploadJob::getNetworkPacket()
{
return m_networkPacket;
}
#include "moc_uploadjob.cpp"

View file

@ -35,3 +35,5 @@ void LinkProvider::suspend(bool suspend)
onStart();
}
}
#include "moc_linkprovider.cpp"

View file

@ -20,7 +20,6 @@ class KDECONNECTCORE_EXPORT LinkProvider : public QObject
public:
LinkProvider();
~LinkProvider() override = default;
virtual QString name() = 0;

View file

@ -35,3 +35,5 @@ DeviceInfo LoopbackDeviceLink::deviceInfo() const
{
return KdeConnectConfig::instance().deviceInfo();
}
#include "moc_loopbackdevicelink.cpp"

View file

@ -39,3 +39,5 @@ void LoopbackLinkProvider::onStop()
delete loopbackDeviceLink;
}
}
#include "moc_loopbacklinkprovider.cpp"

View file

@ -146,3 +146,5 @@ void PairingHandler::pairingDone()
m_pairState = PairState::Paired;
Q_EMIT pairingSuccessful();
}
#include "moc_pairinghandler.cpp"

View file

@ -20,7 +20,6 @@ public:
const static int pairingTimeoutMsec = 30 * 1000; // 30 seconds of timeout
PairingHandler(Device *parent, PairState initialState);
~PairingHandler() override = default;
void packetReceived(const NetworkPacket &np);

View file

@ -86,10 +86,8 @@ bool CompositeFileTransferJob::doKill()
return true;
}
void CompositeFileTransferJob::slotProcessedAmount(KJob *job, KJob::Unit unit, qulonglong amount)
void CompositeFileTransferJob::slotProcessedAmount(KJob * /*job*/, KJob::Unit unit, qulonglong amount)
{
Q_UNUSED(job);
m_currentJobSentPayloadSize = amount;
const auto totalSent = m_totalSentPayloadSize + m_currentJobSentPayloadSize;
@ -134,3 +132,5 @@ void CompositeFileTransferJob::slotResult(KJob *job)
emitResult();
}
}
#include "moc_compositefiletransferjob.cpp"

View file

@ -281,3 +281,5 @@ QString Daemon::selfId() const
{
return KdeConnectConfig::instance().deviceId();
}
#include "moc_daemon.cpp"

View file

@ -485,3 +485,5 @@ QString Device::pluginIconName(const QString &pluginName)
}
return QString();
}
#include "moc_device.cpp"

View file

@ -146,3 +146,5 @@ bool FileTransferJob::doKill()
return true;
}
#include "moc_filetransferjob.cpp"

View file

@ -12,7 +12,7 @@ struct KdeConnectPluginPrivate {
Device *m_device;
QString m_pluginName;
QSet<QString> m_outgoingCapabilties;
KdeConnectPluginConfig *m_config;
KdeConnectPluginConfig *m_config = nullptr;
QString iconName;
};
@ -20,13 +20,12 @@ KdeConnectPlugin::KdeConnectPlugin(QObject *parent, const QVariantList &args)
: QObject(parent)
, d(new KdeConnectPluginPrivate)
{
Q_ASSERT(args.length() == 4);
d->m_device = qvariant_cast<Device *>(args.at(0));
d->m_pluginName = args.at(1).toString();
const QStringList cap = args.at(2).toStringList();
d->m_outgoingCapabilties = QSet(cap.begin(), cap.end());
d->m_config = nullptr;
d->iconName = args.at(3).toString();
}
@ -41,9 +40,7 @@ KdeConnectPluginConfig *KdeConnectPlugin::config() const
KdeConnectPlugin::~KdeConnectPlugin()
{
if (d->m_config) {
delete d->m_config;
}
delete d->m_config;
}
const Device *KdeConnectPlugin::device()
@ -76,3 +73,5 @@ QString KdeConnectPlugin::iconName() const
{
return d->iconName;
}
#include "moc_kdeconnectplugin.cpp"

View file

@ -183,3 +183,5 @@ void KdeConnectPluginConfig::loadConfig()
SLOT(slotConfigChanged()));
Q_EMIT configChanged();
}
#include "moc_kdeconnectpluginconfig.cpp"

View file

@ -116,3 +116,5 @@ FileTransferJob *NetworkPacket::createPayloadTransferJob(const QUrl &destination
{
return new FileTransferJob(this, destination);
}
#include "moc_networkpacket.cpp"

View file

@ -51,3 +51,5 @@ NotificationServerInfo::Hints NotificationServerInfo::supportedHints()
{
return m_supportedHints;
}
#include "moc_notificationserverinfo.cpp"

View file

@ -39,3 +39,5 @@ void OpenConfig::openConfiguration(const QString &deviceId, const QString &plugi
m_currentToken = QString();
}
#include "moc_openconfig.cpp"

View file

@ -25,7 +25,7 @@ PluginLoader *PluginLoader::instance()
PluginLoader::PluginLoader()
{
const QVector<KPluginMetaData> data = KPluginMetaData::findPlugins(QStringLiteral("kdeconnect/"));
const QVector<KPluginMetaData> data = KPluginMetaData::findPlugins(QStringLiteral("kdeconnect"));
for (const KPluginMetaData &metadata : data) {
plugins[metadata.pluginId()] = metadata;
}
@ -48,32 +48,22 @@ KPluginMetaData PluginLoader::getPluginInfo(const QString &name) const
KdeConnectPlugin *PluginLoader::instantiatePluginForDevice(const QString &pluginName, Device *device) const
{
KdeConnectPlugin *ret = nullptr;
KPluginMetaData service = plugins.value(pluginName);
if (!service.isValid()) {
const KPluginMetaData data = plugins.value(pluginName);
if (!data.isValid()) {
qCDebug(KDECONNECT_CORE) << "Plugin unknown" << pluginName;
return ret;
return nullptr;
}
auto factoryResult = KPluginFactory::loadFactory(service);
if (!factoryResult) {
qCDebug(KDECONNECT_CORE) << "KPluginFactory could not load the plugin:" << service.pluginId() << factoryResult.errorString;
return ret;
const QStringList outgoingInterfaces = data.value(QStringLiteral("X-KdeConnect-OutgoingPacketType"), QStringList());
const QVariantList args{QVariant::fromValue<Device *>(device), pluginName, outgoingInterfaces, data.iconName()};
if (auto result = KPluginFactory::instantiatePlugin<KdeConnectPlugin>(data, device, args)) {
qCDebug(KDECONNECT_CORE) << "Loaded plugin:" << data.pluginId();
return result.plugin;
} else {
qCDebug(KDECONNECT_CORE) << "Error loading plugin" << result.errorText;
return nullptr;
}
const QStringList outgoingInterfaces = service.value(QStringLiteral("X-KdeConnect-OutgoingPacketType"), QStringList());
QVariant deviceVariant = QVariant::fromValue<Device *>(device);
ret = factoryResult.plugin->create<KdeConnectPlugin>(device, QVariantList() << deviceVariant << pluginName << outgoingInterfaces << service.iconName());
if (!ret) {
qCDebug(KDECONNECT_CORE) << "Error loading plugin";
return ret;
}
// qCDebug(KDECONNECT_CORE) << "Loaded plugin:" << service.pluginId();
return ret;
}
QStringList PluginLoader::incomingCapabilities() const

View file

@ -55,7 +55,7 @@ public:
notification->setText(
i18n("Pairing request from %1\nKey: %2...", device->name().toHtmlEscaped(), QString::fromUtf8(device->verificationKey().left(8))));
notification->setDefaultAction(i18n("Open"));
notification->setActions(QStringList() << i18n("Accept") << i18n("Reject") << i18n("View key"));
notification->setActions(QStringList{i18n("Accept"), i18n("Reject"), i18n("View key")});
connect(notification, &KNotification::action1Activated, device, &Device::acceptPairing);
connect(notification, &KNotification::action2Activated, device, &Device::cancelPairing);
QString deviceId = device->id();

View file

@ -131,3 +131,5 @@ void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine *engine, const cha
engine->rootContext()->setContextProperty(QStringLiteral("DBusResponseWaiter"), DBusResponseWaiter::instance());
}
#include "moc_kdeconnectdeclarativeplugin.cpp"

View file

@ -26,3 +26,5 @@ QObject *ObjectFactory::create(const QVariant &arg1, const QVariant &arg2)
return m_f2(arg1, arg2);
return nullptr;
}
#include "moc_objectfactory.cpp"

View file

@ -43,8 +43,6 @@ public:
{
}
~ObjectFactory() override = default;
Q_INVOKABLE QObject *create();
Q_INVOKABLE QObject *create(const QVariant &arg1);

View file

@ -71,3 +71,5 @@ bool PointerLockerQt::eventFilter(QObject *watched, QEvent *event)
return true;
}
#include "moc_pointerlocker.cpp"

View file

@ -211,4 +211,5 @@ void PointerLockerWayland::setWindow(QWindow *window)
}
}
#include "moc_pointerlockerwayland.cpp"
#include "pointerlockerwayland.moc"

View file

@ -114,3 +114,5 @@ const QDBusPendingCall *DBusResponseWaiter::extractPendingCall(QVariant &variant
return nullptr;
}
#include "moc_responsewaiter.cpp"

View file

@ -40,7 +40,6 @@ class DBusAsyncResponse : public QObject
public:
explicit DBusAsyncResponse(QObject *parent = nullptr);
~DBusAsyncResponse() override = default;
Q_INVOKABLE void setPendingCall(QVariant e);

View file

@ -83,9 +83,10 @@ void SendFileItemAction::sendFile()
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/share"),
QStringLiteral("org.kde.kdeconnect.device.share"),
QStringLiteral("shareUrl"));
msg.setArguments(QVariantList() << url.toString());
msg.setArguments(QVariantList{url.toString()});
QDBusConnection::sessionBus().asyncCall(msg);
}
}
#include "moc_sendfileitemaction.cpp"
#include "sendfileitemaction.moc"

View file

@ -162,3 +162,5 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface *device)
},
this);
}
#include "moc_deviceindicator.cpp"

View file

@ -28,10 +28,8 @@ void IndicatorHelper::iconPathHook()
{
}
int IndicatorHelper::daemonHook(QProcess &kdeconnectd)
int IndicatorHelper::daemonHook(QProcess & /*kdeconnectd*/)
{
Q_UNUSED(kdeconnectd);
return 0;
}

View file

@ -59,3 +59,5 @@ void BatteryAction::setCharging(bool charging)
m_charging = charging;
update();
}
#include "moc_battery_action.cpp"

View file

@ -81,3 +81,5 @@ void ConnectivityAction::setCellularNetworkType(QString cellularNetworkType)
m_cellularNetworkType = cellularNetworkType;
update();
}
#include "moc_connectivity_action.cpp"

View file

@ -135,3 +135,5 @@ void CommandsModel::addCommand(const QString &name, const QString &command)
endInsertRows();
saveCommands();
}
#include "moc_commandsmodel.cpp"

View file

@ -6,6 +6,8 @@
#include "dbusinterfaces.h"
#include <iostream>
QString DaemonDbusInterface::activatedService()
{
static const QString service = QStringLiteral("org.kde.kdeconnect");
@ -25,10 +27,6 @@ DaemonDbusInterface::DaemonDbusInterface(QObject *parent)
connect(this, &OrgKdeKdeconnectDaemonInterface::customDevicesChanged, this, &DaemonDbusInterface::customDevicesChangedProxy);
}
DaemonDbusInterface::~DaemonDbusInterface()
{
}
DeviceDbusInterface::DeviceDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id,
@ -41,10 +39,6 @@ DeviceDbusInterface::DeviceDbusInterface(const QString &id, QObject *parent)
connect(this, &OrgKdeKdeconnectDeviceInterface::nameChanged, this, &DeviceDbusInterface::nameChangedProxy);
}
DeviceDbusInterface::~DeviceDbusInterface()
{
}
QString DeviceDbusInterface::id() const
{
return m_id;
@ -68,8 +62,6 @@ BatteryDbusInterface::BatteryDbusInterface(const QString &id, QObject *parent)
connect(this, &OrgKdeKdeconnectDeviceBatteryInterface::refreshed, this, &BatteryDbusInterface::refreshedProxy);
}
BatteryDbusInterface::~BatteryDbusInterface() = default;
ConnectivityReportDbusInterface::ConnectivityReportDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceConnectivity_reportInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/connectivity_report"),
@ -79,8 +71,6 @@ ConnectivityReportDbusInterface::ConnectivityReportDbusInterface(const QString &
connect(this, &OrgKdeKdeconnectDeviceConnectivity_reportInterface::refreshed, this, &ConnectivityReportDbusInterface::refreshedProxy);
}
ConnectivityReportDbusInterface::~ConnectivityReportDbusInterface() = default;
DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/notifications"),
@ -89,10 +79,6 @@ DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString
{
}
DeviceNotificationsDbusInterface::~DeviceNotificationsDbusInterface()
{
}
NotificationDbusInterface::NotificationDbusInterface(const QString &deviceId, const QString &notificationId, QObject *parent)
: OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/notifications/")
@ -103,10 +89,6 @@ NotificationDbusInterface::NotificationDbusInterface(const QString &deviceId, co
{
}
NotificationDbusInterface::~NotificationDbusInterface()
{
}
DeviceConversationsDbusInterface::DeviceConversationsDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceConversationsInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId,
@ -115,10 +97,6 @@ DeviceConversationsDbusInterface::DeviceConversationsDbusInterface(const QString
{
}
DeviceConversationsDbusInterface::~DeviceConversationsDbusInterface()
{
}
SftpDbusInterface::SftpDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/sftp"),
@ -127,10 +105,6 @@ SftpDbusInterface::SftpDbusInterface(const QString &id, QObject *parent)
{
}
SftpDbusInterface::~SftpDbusInterface()
{
}
MprisDbusInterface::MprisDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/mprisremote"),
@ -140,10 +114,6 @@ MprisDbusInterface::MprisDbusInterface(const QString &id, QObject *parent)
connect(this, &OrgKdeKdeconnectDeviceMprisremoteInterface::propertiesChanged, this, &MprisDbusInterface::propertiesChangedProxy);
}
MprisDbusInterface::~MprisDbusInterface()
{
}
RemoteControlDbusInterface::RemoteControlDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/remotecontrol"),
@ -152,10 +122,6 @@ RemoteControlDbusInterface::RemoteControlDbusInterface(const QString &id, QObjec
{
}
RemoteControlDbusInterface::~RemoteControlDbusInterface()
{
}
LockDeviceDbusInterface::LockDeviceDbusInterface(const QString &id, QObject *parent)
: OrgKdeKdeconnectDeviceLockdeviceInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/lockdevice"),
@ -166,10 +132,6 @@ LockDeviceDbusInterface::LockDeviceDbusInterface(const QString &id, QObject *par
Q_ASSERT(isValid());
}
LockDeviceDbusInterface::~LockDeviceDbusInterface()
{
}
FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceFindmyphoneInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/findmyphone"),
@ -178,10 +140,6 @@ FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString &de
{
}
FindMyPhoneDeviceDbusInterface::~FindMyPhoneDeviceDbusInterface()
{
}
RemoteCommandsDbusInterface::RemoteCommandsDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceRemotecommandsInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotecommands"),
@ -190,8 +148,6 @@ RemoteCommandsDbusInterface::RemoteCommandsDbusInterface(const QString &deviceId
{
}
RemoteCommandsDbusInterface::~RemoteCommandsDbusInterface() = default;
RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceRemotekeyboardInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotekeyboard"),
@ -201,8 +157,6 @@ RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString &deviceId
connect(this, &OrgKdeKdeconnectDeviceRemotekeyboardInterface::remoteStateChanged, this, &RemoteKeyboardDbusInterface::remoteStateChanged);
}
RemoteKeyboardDbusInterface::~RemoteKeyboardDbusInterface() = default;
SmsDbusInterface::SmsDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceSmsInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sms"),
@ -211,8 +165,6 @@ SmsDbusInterface::SmsDbusInterface(const QString &deviceId, QObject *parent)
{
}
SmsDbusInterface::~SmsDbusInterface() = default;
ShareDbusInterface::ShareDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceShareInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/share"),
@ -221,8 +173,6 @@ ShareDbusInterface::ShareDbusInterface(const QString &deviceId, QObject *parent)
{
}
ShareDbusInterface::~ShareDbusInterface() = default;
PhotoDbusInterface::PhotoDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDevicePhotoInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/photo"),
@ -231,8 +181,6 @@ PhotoDbusInterface::PhotoDbusInterface(const QString &deviceId, QObject *parent)
{
}
PhotoDbusInterface::~PhotoDbusInterface() = default;
RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"),
@ -249,10 +197,6 @@ BigscreenDbusInterface::BigscreenDbusInterface(const QString &deviceId, QObject
{
}
BigscreenDbusInterface::~BigscreenDbusInterface()
{
}
VirtualmonitorDbusInterface::VirtualmonitorDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceVirtualmonitorInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/virtualmonitor"),
@ -261,11 +205,6 @@ VirtualmonitorDbusInterface::VirtualmonitorDbusInterface(const QString &deviceId
{
}
VirtualmonitorDbusInterface::~VirtualmonitorDbusInterface()
{
}
#include <iostream>
ClipboardDbusInterface::ClipboardDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceClipboardInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/clipboard"),
@ -275,6 +214,4 @@ ClipboardDbusInterface::ClipboardDbusInterface(const QString &deviceId, QObject
connect(this, &OrgKdeKdeconnectDeviceClipboardInterface::autoShareDisabledChanged, this, &ClipboardDbusInterface::autoShareDisabledChangedProxy);
}
ClipboardDbusInterface::~ClipboardDbusInterface()
{
}
#include "moc_dbusinterfaces.cpp"

View file

@ -41,7 +41,6 @@ class KDECONNECTINTERFACES_EXPORT DaemonDbusInterface : public OrgKdeKdeconnectD
Q_PROPERTY(QStringList customDevices READ customDevices WRITE setCustomDevices NOTIFY customDevicesChangedProxy)
public:
explicit DaemonDbusInterface(QObject *parent = nullptr);
~DaemonDbusInterface() override;
static QString activatedService();
@ -64,7 +63,6 @@ class KDECONNECTINTERFACES_EXPORT DeviceDbusInterface : public OrgKdeKdeconnectD
public:
explicit DeviceDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~DeviceDbusInterface() override;
Q_SCRIPTABLE QString id() const;
Q_SCRIPTABLE void pluginCall(const QString &plugin, const QString &method);
@ -85,7 +83,6 @@ class KDECONNECTINTERFACES_EXPORT BatteryDbusInterface : public OrgKdeKdeconnect
Q_PROPERTY(bool isCharging READ isCharging NOTIFY refreshedProxy)
public:
explicit BatteryDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~BatteryDbusInterface() override;
Q_SIGNALS:
void refreshedProxy(bool isCharging, int charge);
@ -98,7 +95,6 @@ class KDECONNECTINTERFACES_EXPORT ConnectivityReportDbusInterface : public OrgKd
Q_PROPERTY(int cellularNetworkStrength READ cellularNetworkStrength NOTIFY refreshedProxy)
public:
explicit ConnectivityReportDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~ConnectivityReportDbusInterface() override;
Q_SIGNALS:
void refreshedProxy(QString cellularNetworkType, int cellularNetworkStrength);
@ -109,7 +105,6 @@ class KDECONNECTINTERFACES_EXPORT DeviceNotificationsDbusInterface : public OrgK
Q_OBJECT
public:
explicit DeviceNotificationsDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~DeviceNotificationsDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT NotificationDbusInterface : public OrgKdeKdeconnectDeviceNotificationsNotificationInterface
@ -117,7 +112,6 @@ class KDECONNECTINTERFACES_EXPORT NotificationDbusInterface : public OrgKdeKdeco
Q_OBJECT
public:
NotificationDbusInterface(const QString &deviceId, const QString &notificationId, QObject *parent = nullptr);
~NotificationDbusInterface() override;
QString notificationId()
{
@ -133,7 +127,6 @@ class KDECONNECTINTERFACES_EXPORT DeviceConversationsDbusInterface : public OrgK
Q_OBJECT
public:
explicit DeviceConversationsDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~DeviceConversationsDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT SftpDbusInterface : public OrgKdeKdeconnectDeviceSftpInterface
@ -141,7 +134,6 @@ class KDECONNECTINTERFACES_EXPORT SftpDbusInterface : public OrgKdeKdeconnectDev
Q_OBJECT
public:
explicit SftpDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~SftpDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT MprisDbusInterface : public OrgKdeKdeconnectDeviceMprisremoteInterface
@ -160,7 +152,6 @@ class KDECONNECTINTERFACES_EXPORT MprisDbusInterface : public OrgKdeKdeconnectDe
Q_PROPERTY(bool canSeek READ canSeek NOTIFY propertiesChangedProxy)
public:
explicit MprisDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~MprisDbusInterface() override;
Q_SIGNALS:
void propertiesChangedProxy();
@ -171,7 +162,6 @@ class KDECONNECTINTERFACES_EXPORT RemoteControlDbusInterface : public OrgKdeKdec
Q_OBJECT
public:
explicit RemoteControlDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~RemoteControlDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT LockDeviceDbusInterface : public OrgKdeKdeconnectDeviceLockdeviceInterface
@ -180,7 +170,6 @@ class KDECONNECTINTERFACES_EXPORT LockDeviceDbusInterface : public OrgKdeKdeconn
Q_PROPERTY(bool isLocked READ isLocked WRITE setIsLocked NOTIFY lockedChangedProxy)
public:
explicit LockDeviceDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~LockDeviceDbusInterface() override;
Q_SIGNALS:
void lockedChangedProxy(bool isLocked);
@ -191,7 +180,6 @@ class KDECONNECTINTERFACES_EXPORT FindMyPhoneDeviceDbusInterface : public OrgKde
Q_OBJECT
public:
explicit FindMyPhoneDeviceDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~FindMyPhoneDeviceDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT RemoteCommandsDbusInterface : public OrgKdeKdeconnectDeviceRemotecommandsInterface
@ -201,7 +189,6 @@ class KDECONNECTINTERFACES_EXPORT RemoteCommandsDbusInterface : public OrgKdeKde
Q_PROPERTY(QString deviceId READ deviceId CONSTANT)
public:
explicit RemoteCommandsDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~RemoteCommandsDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT RemoteKeyboardDbusInterface : public OrgKdeKdeconnectDeviceRemotekeyboardInterface
@ -210,7 +197,6 @@ class KDECONNECTINTERFACES_EXPORT RemoteKeyboardDbusInterface : public OrgKdeKde
Q_PROPERTY(bool remoteState READ remoteState NOTIFY remoteStateChanged)
public:
explicit RemoteKeyboardDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~RemoteKeyboardDbusInterface() override;
Q_SIGNALS:
void remoteStateChanged(bool state);
};
@ -220,7 +206,6 @@ class KDECONNECTINTERFACES_EXPORT SmsDbusInterface : public OrgKdeKdeconnectDevi
Q_OBJECT
public:
explicit SmsDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~SmsDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT ShareDbusInterface : public OrgKdeKdeconnectDeviceShareInterface
@ -228,7 +213,6 @@ class KDECONNECTINTERFACES_EXPORT ShareDbusInterface : public OrgKdeKdeconnectDe
Q_OBJECT
public:
explicit ShareDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~ShareDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT PhotoDbusInterface : public OrgKdeKdeconnectDevicePhotoInterface
@ -236,7 +220,6 @@ class KDECONNECTINTERFACES_EXPORT PhotoDbusInterface : public OrgKdeKdeconnectDe
Q_OBJECT
public:
explicit PhotoDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~PhotoDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT RemoteSystemVolumeDbusInterface : public OrgKdeKdeconnectDeviceRemotesystemvolumeInterface
@ -246,7 +229,6 @@ class KDECONNECTINTERFACES_EXPORT RemoteSystemVolumeDbusInterface : public OrgKd
Q_PROPERTY(QString deviceId READ deviceId CONSTANT)
public:
explicit RemoteSystemVolumeDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~RemoteSystemVolumeDbusInterface() override = default;
};
class KDECONNECTINTERFACES_EXPORT BigscreenDbusInterface : public OrgKdeKdeconnectDeviceBigscreenInterface
@ -254,7 +236,6 @@ class KDECONNECTINTERFACES_EXPORT BigscreenDbusInterface : public OrgKdeKdeconne
Q_OBJECT
public:
explicit BigscreenDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~BigscreenDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT VirtualmonitorDbusInterface : public OrgKdeKdeconnectDeviceVirtualmonitorInterface
@ -262,7 +243,6 @@ class KDECONNECTINTERFACES_EXPORT VirtualmonitorDbusInterface : public OrgKdeKde
Q_OBJECT
public:
explicit VirtualmonitorDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~VirtualmonitorDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT ClipboardDbusInterface : public OrgKdeKdeconnectDeviceClipboardInterface
@ -271,7 +251,6 @@ class KDECONNECTINTERFACES_EXPORT ClipboardDbusInterface : public OrgKdeKdeconne
Q_PROPERTY(bool isAutoShareDisabled READ isAutoShareDisabled NOTIFY autoShareDisabledChangedProxy)
public:
explicit ClipboardDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~ClipboardDbusInterface() override;
Q_SIGNALS:
void autoShareDisabledChangedProxy(bool b);
};

View file

@ -94,9 +94,8 @@ void DevicesModel::deviceRemoved(const QString &id)
}
}
void DevicesModel::deviceUpdated(const QString &id, bool isVisible)
void DevicesModel::deviceUpdated(const QString &id)
{
Q_UNUSED(isVisible);
int row = rowForDevice(id);
if (row < 0) {
@ -179,17 +178,10 @@ void DevicesModel::receivedDeviceList(QDBusPendingCallWatcher *watcher)
void DevicesModel::appendDevice(DeviceDbusInterface *dev)
{
m_deviceList.append(dev);
connect(dev, &OrgKdeKdeconnectDeviceInterface::nameChanged, this, &DevicesModel::nameChanged);
}
void DevicesModel::nameChanged(const QString &newName)
{
Q_UNUSED(newName);
DeviceDbusInterface *device = static_cast<DeviceDbusInterface *>(sender());
Q_ASSERT(rowForDevice(device->id()) >= 0);
deviceUpdated(device->id(), true);
connect(dev, &OrgKdeKdeconnectDeviceInterface::nameChanged, this, [this, dev]() {
Q_ASSERT(rowForDevice(dev->id()) >= 0);
deviceUpdated(dev->id());
});
}
void DevicesModel::clearDevices()
@ -276,3 +268,5 @@ bool DevicesModel::passesFilter(DeviceDbusInterface *dev) const
return !((onlyReachable && !dev->isReachable()) || (onlyPaired && !dev->isPaired()));
}
#include "moc_devicesmodel.cpp"

View file

@ -61,10 +61,9 @@ public:
private Q_SLOTS:
void deviceAdded(const QString &id);
void deviceRemoved(const QString &id);
void deviceUpdated(const QString &id, bool isVisible);
void deviceUpdated(const QString &id);
void refreshDeviceList();
void receivedDeviceList(QDBusPendingCallWatcher *watcher);
void nameChanged(const QString &newName);
Q_SIGNALS:
void rowsChanged();

View file

@ -22,3 +22,5 @@ QString DevicesPluginFilterProxyModel::pluginFilter() const
{
return m_pluginFilter;
}
#include "moc_devicespluginfilterproxymodel.cpp"

View file

@ -44,3 +44,5 @@ bool DevicesSortProxyModel::filterAcceptsRow(int source_row, const QModelIndex &
// Possible to-do: Implement filter
return true;
}
#include "moc_devicessortproxymodel.cpp"

View file

@ -235,3 +235,5 @@ void NotificationsModel::notificationUpdated()
{
Q_EMIT dataChanged(index(0, 0), index(m_notificationList.size() - 1, 0));
}
#include "moc_notificationsmodel.cpp"

View file

@ -16,7 +16,7 @@ PluginModel::PluginModel(QObject *parent)
{
connect(this, &QAbstractItemModel::rowsInserted, this, &PluginModel::rowsChanged);
connect(this, &QAbstractItemModel::rowsRemoved, this, &PluginModel::rowsChanged);
m_plugins = KPluginMetaData::findPlugins(QStringLiteral("kdeconnect/"));
m_plugins = KPluginMetaData::findPlugins(QStringLiteral("kdeconnect"));
}
PluginModel::~PluginModel()
@ -117,3 +117,5 @@ QString PluginModel::deviceId()
{
return m_deviceId;
}
#include "moc_pluginmodel.cpp"

View file

@ -131,3 +131,5 @@ void RemoteCommandsModel::clearCommands()
endRemoveRows();
}
}
#include "moc_remotecommandsmodel.cpp"

View file

@ -174,3 +174,5 @@ int RemoteSinksModel::rowCount(const QModelIndex &parent) const
return m_sinkList.count();
}
#include "moc_remotesinksmodel.cpp"

View file

@ -19,13 +19,11 @@
#include "devicesmodel.h"
#include "devicessortproxymodel.h"
#include "kdeconnect-version.h"
#include "ui_kcm.h"
K_PLUGIN_CLASS_WITH_JSON(KdeConnectKcm, "kcm_kdeconnect.json")
KdeConnectKcm::KdeConnectKcm(QObject *parent, const QVariantList &args)
: KCModule(qobject_cast<QWidget *>(parent))
, kcmUi(new Ui::KdeConnectKcmUi())
, daemon(new DaemonDbusInterface(this))
, devicesModel(new DevicesModel(this))
, currentDevice(nullptr)
@ -35,48 +33,48 @@ KdeConnectKcm::KdeConnectKcm(QObject *parent, const QVariantList &args)
QApplication::setStyle(QStringLiteral("breeze"));
#endif
kcmUi->setupUi(widget());
kcmUi.setupUi(widget());
sortProxyModel = new DevicesSortProxyModel(devicesModel);
kcmUi->deviceList->setModel(sortProxyModel);
kcmUi.deviceList->setModel(sortProxyModel);
kcmUi->deviceInfo->setVisible(false);
kcmUi->progressBar->setVisible(false);
kcmUi->messages->setVisible(false);
kcmUi.deviceInfo->setVisible(false);
kcmUi.progressBar->setVisible(false);
kcmUi.messages->setVisible(false);
// Workaround: If we set this directly (or if we set it in the .ui file), the layout breaks
kcmUi->noDeviceLinks->setWordWrap(false);
kcmUi.noDeviceLinks->setWordWrap(false);
QTimer::singleShot(0, this, [this] {
kcmUi->noDeviceLinks->setWordWrap(true);
kcmUi.noDeviceLinks->setWordWrap(true);
});
setWhenAvailable(
daemon->announcedName(),
[this](const QString &announcedName) {
kcmUi->rename_label->setText(announcedName);
kcmUi->rename_edit->setText(announcedName);
kcmUi.rename_label->setText(announcedName);
kcmUi.rename_edit->setText(announcedName);
},
this);
connect(daemon, SIGNAL(announcedNameChanged(QString)), kcmUi->rename_edit, SLOT(setText(QString)));
connect(daemon, SIGNAL(announcedNameChanged(QString)), kcmUi->rename_label, SLOT(setText(QString)));
connect(daemon, SIGNAL(announcedNameChanged(QString)), kcmUi.rename_edit, SLOT(setText(QString)));
connect(daemon, SIGNAL(announcedNameChanged(QString)), kcmUi.rename_label, SLOT(setText(QString)));
setRenameMode(false);
setButtons(KCModule::Help | KCModule::NoAdditionalButton);
connect(devicesModel, &QAbstractItemModel::dataChanged, this, &KdeConnectKcm::resetSelection);
connect(kcmUi->deviceList->selectionModel(), &QItemSelectionModel::currentChanged, this, &KdeConnectKcm::deviceSelected);
connect(kcmUi->accept_button, &QAbstractButton::clicked, this, &KdeConnectKcm::acceptPairing);
connect(kcmUi->reject_button, &QAbstractButton::clicked, this, &KdeConnectKcm::cancelPairing);
connect(kcmUi->cancel_button, &QAbstractButton::clicked, this, &KdeConnectKcm::cancelPairing);
connect(kcmUi->pair_button, &QAbstractButton::clicked, this, &KdeConnectKcm::requestPairing);
connect(kcmUi->unpair_button, &QAbstractButton::clicked, this, &KdeConnectKcm::unpair);
connect(kcmUi->ping_button, &QAbstractButton::clicked, this, &KdeConnectKcm::sendPing);
connect(kcmUi->refresh_button, &QAbstractButton::clicked, this, &KdeConnectKcm::refresh);
connect(kcmUi->rename_edit, &QLineEdit::returnPressed, this, &KdeConnectKcm::renameDone);
connect(kcmUi->renameDone_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameDone);
connect(kcmUi->renameShow_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameShow);
connect(kcmUi->pluginSelector, &KPluginWidget::changed, this, &KdeConnectKcm::pluginsConfigChanged);
connect(kcmUi.deviceList->selectionModel(), &QItemSelectionModel::currentChanged, this, &KdeConnectKcm::deviceSelected);
connect(kcmUi.accept_button, &QAbstractButton::clicked, this, &KdeConnectKcm::acceptPairing);
connect(kcmUi.reject_button, &QAbstractButton::clicked, this, &KdeConnectKcm::cancelPairing);
connect(kcmUi.cancel_button, &QAbstractButton::clicked, this, &KdeConnectKcm::cancelPairing);
connect(kcmUi.pair_button, &QAbstractButton::clicked, this, &KdeConnectKcm::requestPairing);
connect(kcmUi.unpair_button, &QAbstractButton::clicked, this, &KdeConnectKcm::unpair);
connect(kcmUi.ping_button, &QAbstractButton::clicked, this, &KdeConnectKcm::sendPing);
connect(kcmUi.refresh_button, &QAbstractButton::clicked, this, &KdeConnectKcm::refresh);
connect(kcmUi.rename_edit, &QLineEdit::returnPressed, this, &KdeConnectKcm::renameDone);
connect(kcmUi.renameDone_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameDone);
connect(kcmUi.renameShow_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameShow);
connect(kcmUi.pluginSelector, &KPluginWidget::changed, this, &KdeConnectKcm::pluginsConfigChanged);
if (!args.isEmpty() && args.first().type() == QVariant::String) {
const QString input = args.first().toString();
@ -88,10 +86,10 @@ KdeConnectKcm::KdeConnectKcm(QObject *parent, const QVariantList &args)
auto row = devicesModel->rowForDevice(deviceId);
if (row >= 0) {
const QModelIndex idx = sortProxyModel->mapFromSource(devicesModel->index(row));
kcmUi->deviceList->selectionModel()->setCurrentIndex(idx, QItemSelectionModel::ClearAndSelect);
kcmUi.deviceList->selectionModel()->setCurrentIndex(idx, QItemSelectionModel::ClearAndSelect);
}
if (!pluginCM.isEmpty()) {
kcmUi->pluginSelector->showConfiguration(pluginCM);
kcmUi.pluginSelector->showConfiguration(pluginCM);
}
disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr);
});
@ -105,12 +103,12 @@ void KdeConnectKcm::renameShow()
void KdeConnectKcm::renameDone()
{
QString newName = kcmUi->rename_edit->text();
QString newName = kcmUi.rename_edit->text();
if (newName.isEmpty()) {
// Rollback changes
kcmUi->rename_edit->setText(kcmUi->rename_label->text());
kcmUi.rename_edit->setText(kcmUi.rename_label->text());
} else {
kcmUi->rename_label->setText(newName);
kcmUi.rename_label->setText(newName);
daemon->setAnnouncedName(newName);
}
setRenameMode(false);
@ -118,15 +116,14 @@ void KdeConnectKcm::renameDone()
void KdeConnectKcm::setRenameMode(bool b)
{
kcmUi->renameDone_button->setVisible(b);
kcmUi->rename_edit->setVisible(b);
kcmUi->renameShow_button->setVisible(!b);
kcmUi->rename_label->setVisible(!b);
kcmUi.renameDone_button->setVisible(b);
kcmUi.rename_edit->setVisible(b);
kcmUi.renameShow_button->setVisible(!b);
kcmUi.rename_label->setVisible(!b);
}
KdeConnectKcm::~KdeConnectKcm()
{
delete kcmUi;
}
void KdeConnectKcm::refresh()
@ -139,7 +136,7 @@ void KdeConnectKcm::resetSelection()
if (!currentDevice) {
return;
}
kcmUi->deviceList->selectionModel()->setCurrentIndex(sortProxyModel->mapFromSource(currentIndex), QItemSelectionModel::ClearAndSelect);
kcmUi.deviceList->selectionModel()->setCurrentIndex(sortProxyModel->mapFromSource(currentIndex), QItemSelectionModel::ClearAndSelect);
}
void KdeConnectKcm::deviceSelected(const QModelIndex &current)
@ -150,21 +147,21 @@ void KdeConnectKcm::deviceSelected(const QModelIndex &current)
if (!current.isValid()) {
currentDevice = nullptr;
kcmUi->deviceInfo->setVisible(false);
kcmUi.deviceInfo->setVisible(false);
return;
}
currentIndex = sortProxyModel->mapToSource(current);
currentDevice = devicesModel->getDevice(currentIndex.row());
kcmUi->noDevicePlaceholder->setVisible(false);
kcmUi.noDevicePlaceholder->setVisible(false);
bool valid = (currentDevice != nullptr && currentDevice->isValid());
kcmUi->deviceInfo->setVisible(valid);
kcmUi.deviceInfo->setVisible(valid);
if (!valid) {
return;
}
kcmUi->messages->setVisible(false);
kcmUi.messages->setVisible(false);
resetDeviceView();
connect(currentDevice, SIGNAL(pluginsChanged()), this, SLOT(resetCurrentDevice()));
@ -183,9 +180,9 @@ void KdeConnectKcm::resetCurrentDevice()
void KdeConnectKcm::resetDeviceView()
{
kcmUi->verificationKey->setText(i18n("Key: %1", QString::fromUtf8(currentDevice->verificationKey())));
kcmUi.verificationKey->setText(i18n("Key: %1", QString::fromUtf8(currentDevice->verificationKey())));
kcmUi->name_label->setText(currentDevice->name());
kcmUi.name_label->setText(currentDevice->name());
setWhenAvailable(
currentDevice->pairStateAsInt(),
[this](int pairStateAsInt) {
@ -193,7 +190,7 @@ void KdeConnectKcm::resetDeviceView()
},
this);
const QVector<KPluginMetaData> pluginInfo = KPluginMetaData::findPlugins(QStringLiteral("kdeconnect/"));
const QVector<KPluginMetaData> pluginInfo = KPluginMetaData::findPlugins(QStringLiteral("kdeconnect"));
QVector<KPluginMetaData> availablePluginInfo;
m_oldSupportedPluginNames = currentDevice->supportedPlugins();
@ -204,10 +201,10 @@ void KdeConnectKcm::resetDeviceView()
}
KSharedConfigPtr deviceConfig = KSharedConfig::openConfig(currentDevice->pluginsConfigFile());
kcmUi->pluginSelector->clear();
kcmUi->pluginSelector->setConfigurationArguments({currentDevice->id()});
kcmUi->pluginSelector->addPlugins(availablePluginInfo, i18n("Available plugins"));
kcmUi->pluginSelector->setConfig(deviceConfig->group("Plugins"));
kcmUi.pluginSelector->clear();
kcmUi.pluginSelector->setConfigurationArguments({currentDevice->id()});
kcmUi.pluginSelector->addPlugins(availablePluginInfo, i18n("Available plugins"));
kcmUi.pluginSelector->setConfig(deviceConfig->group("Plugins"));
}
void KdeConnectKcm::requestPairing()
@ -216,7 +213,7 @@ void KdeConnectKcm::requestPairing()
return;
}
kcmUi->messages->hide();
kcmUi.messages->hide();
currentDevice->requestPairing();
}
@ -253,32 +250,32 @@ void KdeConnectKcm::pairingFailed(const QString &error)
if (sender() != currentDevice)
return;
kcmUi->messages->setText(i18n("Error trying to pair: %1", error));
kcmUi->messages->animatedShow();
kcmUi.messages->setText(i18n("Error trying to pair: %1", error));
kcmUi.messages->animatedShow();
}
void KdeConnectKcm::setCurrentDevicePairState(int pairStateAsInt)
{
PairState state = (PairState)pairStateAsInt; // Hack because qdbus doesn't like enums
kcmUi->accept_button->setVisible(state == PairState::RequestedByPeer);
kcmUi->reject_button->setVisible(state == PairState::RequestedByPeer);
kcmUi->cancel_button->setVisible(state == PairState::Requested);
kcmUi->pair_button->setVisible(state == PairState::NotPaired);
kcmUi->unpair_button->setVisible(state == PairState::Paired);
kcmUi->progressBar->setVisible(state == PairState::Requested);
kcmUi->ping_button->setVisible(state == PairState::Paired);
kcmUi.accept_button->setVisible(state == PairState::RequestedByPeer);
kcmUi.reject_button->setVisible(state == PairState::RequestedByPeer);
kcmUi.cancel_button->setVisible(state == PairState::Requested);
kcmUi.pair_button->setVisible(state == PairState::NotPaired);
kcmUi.unpair_button->setVisible(state == PairState::Paired);
kcmUi.progressBar->setVisible(state == PairState::Requested);
kcmUi.ping_button->setVisible(state == PairState::Paired);
switch (state) {
case PairState::Paired:
kcmUi->status_label->setText(i18n("(paired)"));
kcmUi.status_label->setText(i18n("(paired)"));
break;
case PairState::NotPaired:
kcmUi->status_label->setText(i18n("(not paired)"));
kcmUi.status_label->setText(i18n("(not paired)"));
break;
case PairState::RequestedByPeer:
kcmUi->status_label->setText(i18n("(incoming pair request)"));
kcmUi.status_label->setText(i18n("(incoming pair request)"));
break;
case PairState::Requested:
kcmUi->status_label->setText(i18n("(pairing requested)"));
kcmUi.status_label->setText(i18n("(pairing requested)"));
break;
}
}
@ -291,7 +288,7 @@ void KdeConnectKcm::pluginsConfigChanged(bool changed)
if (!currentDevice)
return;
kcmUi->pluginSelector->save();
kcmUi.pluginSelector->save();
currentDevice->reloadPlugins();
}

View file

@ -4,13 +4,13 @@
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#ifndef KDECONNECTKCM_H
#define KDECONNECTKCM_H
#pragma once
#include <KCModule>
#include <QStandardItemModel>
#include <kconfigwidgets_version.h>
#include "ui_kcm.h"
#include <core/pairstate.h>
class QModelIndex;
@ -19,11 +19,6 @@ class DaemonDbusInterface;
class DevicesModel;
class DevicesSortProxyModel;
namespace Ui
{
class KdeConnectKcmUi;
}
class KdeConnectKcm : public KCModule
{
Q_OBJECT
@ -60,7 +55,7 @@ private Q_SLOTS:
private:
void resetDeviceView();
Ui::KdeConnectKcmUi *kcmUi;
Ui::KdeConnectKcmUi kcmUi;
DaemonDbusInterface *daemon;
DevicesModel *devicesModel;
DevicesSortProxyModel *sortProxyModel;
@ -71,5 +66,3 @@ private:
public Q_SLOTS:
void unpair();
};
#endif

View file

@ -43,3 +43,5 @@ QString KdeConnectPluginKcm::deviceId() const
{
return d->m_deviceId;
}
#include "moc_kdeconnectpluginkcm.cpp"

View file

@ -249,5 +249,5 @@ KIO::WorkerResult KioKdeconnect::get(const QUrl &url)
return KIO::WorkerResult::pass();
}
// needed for JSON file embedding
#include "kiokdeconnect.moc"
#include "moc_kiokdeconnect.cpp"

View file

@ -134,3 +134,4 @@ QString BatteryPlugin::dbusPath() const
}
#include "batteryplugin.moc"
#include "moc_batteryplugin.cpp"

View file

@ -20,11 +20,6 @@ K_PLUGIN_CLASS_WITH_JSON(BigscreenPlugin, "kdeconnect_bigscreen.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_BIGSCREEN, "kdeconnect.plugin.bigscreen")
BigscreenPlugin::BigscreenPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
bool BigscreenPlugin::receivePacket(const NetworkPacket &np)
{
QString message = np.get<QString>(QStringLiteral("content"));
@ -41,3 +36,4 @@ QString BigscreenPlugin::dbusPath() const
}
#include "bigscreenplugin.moc"
#include "moc_bigscreenplugin.cpp"

View file

@ -17,8 +17,7 @@ class BigscreenPlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.bigscreen")
public:
explicit BigscreenPlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
bool receivePacket(const NetworkPacket &np) override;
QString dbusPath() const override;

View file

@ -5,7 +5,6 @@
*/
#include "clipboard_config.h"
#include "ui_clipboard_config.h"
#include <KPluginFactory>
@ -13,30 +12,24 @@ K_PLUGIN_CLASS(ClipboardConfig)
ClipboardConfig::ClipboardConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: KdeConnectPluginKcm(parent, data, args)
, m_ui(new Ui::ClipboardConfigUi())
{
m_ui->setupUi(widget());
m_ui.setupUi(widget());
connect(m_ui->check_autoshare, &QCheckBox::toggled, this, &ClipboardConfig::autoShareChanged);
connect(m_ui->check_password, &QCheckBox::toggled, this, &ClipboardConfig::markAsChanged);
}
ClipboardConfig::~ClipboardConfig()
{
delete m_ui;
connect(m_ui.check_autoshare, &QCheckBox::toggled, this, &ClipboardConfig::autoShareChanged);
connect(m_ui.check_password, &QCheckBox::toggled, this, &ClipboardConfig::markAsChanged);
}
void ClipboardConfig::autoShareChanged()
{
m_ui->check_password->setEnabled(m_ui->check_autoshare->isChecked());
m_ui.check_password->setEnabled(m_ui.check_autoshare->isChecked());
markAsChanged();
}
void ClipboardConfig::defaults()
{
KCModule::defaults();
m_ui->check_autoshare->setChecked(true);
m_ui->check_password->setChecked(true);
m_ui.check_autoshare->setChecked(true);
m_ui.check_password->setChecked(true);
markAsChanged();
}
@ -46,16 +39,17 @@ void ClipboardConfig::load()
// "sendUnknown" is the legacy name for this setting
bool autoShare = config()->getBool(QStringLiteral("autoShare"), config()->getBool(QStringLiteral("sendUnknown"), true));
bool password = config()->getBool(QStringLiteral("sendPassword"), true);
m_ui->check_autoshare->setChecked(autoShare);
m_ui->check_password->setChecked(password);
m_ui.check_autoshare->setChecked(autoShare);
m_ui.check_password->setChecked(password);
autoShareChanged();
}
void ClipboardConfig::save()
{
config()->set(QStringLiteral("autoShare"), m_ui->check_autoshare->isChecked());
config()->set(QStringLiteral("sendPassword"), m_ui->check_password->isChecked());
config()->set(QStringLiteral("autoShare"), m_ui.check_autoshare->isChecked());
config()->set(QStringLiteral("sendPassword"), m_ui.check_password->isChecked());
KCModule::save();
}
#include "clipboard_config.moc"
#include "moc_clipboard_config.cpp"

View file

@ -7,18 +7,13 @@
#pragma once
#include "kcmplugin/kdeconnectpluginkcm.h"
namespace Ui
{
class ClipboardConfigUi;
}
#include "ui_clipboard_config.h"
class ClipboardConfig : public KdeConnectPluginKcm
{
Q_OBJECT
public:
ClipboardConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &);
~ClipboardConfig() override;
void save() override;
void load() override;
@ -26,5 +21,5 @@ public:
private:
void autoShareChanged();
Ui::ClipboardConfigUi *m_ui;
Ui::ClipboardConfigUi m_ui;
};

View file

@ -28,10 +28,7 @@ qint64 ClipboardListener::updateTimestamp()
ClipboardListener *ClipboardListener::instance()
{
static ClipboardListener *me = nullptr;
if (!me) {
me = new ClipboardListener();
}
static ClipboardListener *const me = new ClipboardListener();
return me;
}
@ -80,3 +77,5 @@ void ClipboardListener::setText(const QString &content)
mime->setText(content);
clipboard->setMimeData(mime, QClipboard::Clipboard);
}
#include "moc_clipboardlistener.cpp"

View file

@ -99,3 +99,4 @@ bool ClipboardPlugin::receivePacket(const NetworkPacket &np)
}
#include "clipboardplugin.moc"
#include "moc_clipboardplugin.cpp"

View file

@ -15,11 +15,6 @@
K_PLUGIN_CLASS_WITH_JSON(ConnectivityReportPlugin, "kdeconnect_connectivity_report.json")
ConnectivityReportPlugin::ConnectivityReportPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
QString ConnectivityReportPlugin::cellularNetworkType() const
{
return m_cellularNetworkType;
@ -59,3 +54,4 @@ QString ConnectivityReportPlugin::dbusPath() const
}
#include "connectivity_reportplugin.moc"
#include "moc_connectivity_reportplugin.cpp"

View file

@ -39,7 +39,7 @@ class ConnectivityReportPlugin : public KdeConnectPlugin
Q_PROPERTY(int cellularNetworkStrength READ cellularNetworkStrength NOTIFY refreshed)
public:
explicit ConnectivityReportPlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
bool receivePacket(const NetworkPacket &np) override;
QString dbusPath() const override;

View file

@ -194,3 +194,4 @@ QString ContactsPlugin::dbusPath() const
}
#include "contactsplugin.moc"
#include "moc_contactsplugin.cpp"

View file

@ -14,14 +14,8 @@
K_PLUGIN_CLASS_WITH_JSON(FindMyPhonePlugin, "kdeconnect_findmyphone.json")
FindMyPhonePlugin::FindMyPhonePlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
bool FindMyPhonePlugin::receivePacket(const NetworkPacket & /*np*/)
{
}
bool FindMyPhonePlugin::receivePacket(const NetworkPacket &np)
{
Q_UNUSED(np);
return false;
}
@ -37,3 +31,4 @@ QString FindMyPhonePlugin::dbusPath() const
}
#include "findmyphoneplugin.moc"
#include "moc_findmyphoneplugin.cpp"

View file

@ -18,7 +18,7 @@ class FindMyPhonePlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.findmyphone")
public:
explicit FindMyPhonePlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
Q_SCRIPTABLE void ring();

View file

@ -7,7 +7,6 @@
#include "findthisdevice_config.h"
#include "findthisdeviceplugin.h"
#include "ui_findthisdevice_config.h"
// KF
#include <KLocalizedString>
#include <KPluginFactory>
@ -23,33 +22,27 @@ K_PLUGIN_CLASS(FindThisDeviceConfig)
FindThisDeviceConfig::FindThisDeviceConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: KdeConnectPluginKcm(parent, data, args)
, m_ui(new Ui::FindThisDeviceConfigUi())
{
m_ui->setupUi(widget());
m_ui.setupUi(widget());
const QStringList soundDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("sounds"), QStandardPaths::LocateDirectory);
if (!soundDirs.isEmpty()) {
m_ui->soundFileRequester->setStartDir(QUrl::fromLocalFile(soundDirs.last()));
m_ui.soundFileRequester->setStartDir(QUrl::fromLocalFile(soundDirs.last()));
}
connect(m_ui->playSoundButton, &QToolButton::clicked, this, [this]() {
if (const QUrl soundUrl = m_ui->soundFileRequester->url(); soundUrl.isValid()) {
connect(m_ui.playSoundButton, &QToolButton::clicked, this, [this]() {
if (const QUrl soundUrl = m_ui.soundFileRequester->url(); soundUrl.isValid()) {
playSound(soundUrl);
}
});
connect(m_ui->soundFileRequester, &KUrlRequester::textChanged, this, &FindThisDeviceConfig::markAsChanged);
}
FindThisDeviceConfig::~FindThisDeviceConfig()
{
delete m_ui;
connect(m_ui.soundFileRequester, &KUrlRequester::textChanged, this, &FindThisDeviceConfig::markAsChanged);
}
void FindThisDeviceConfig::defaults()
{
KCModule::defaults();
m_ui->soundFileRequester->setText(defaultSound());
m_ui.soundFileRequester->setText(defaultSound());
markAsChanged();
}
@ -58,12 +51,12 @@ void FindThisDeviceConfig::load()
KCModule::load();
const QString ringTone = config()->getString(QStringLiteral("ringtone"), defaultSound());
m_ui->soundFileRequester->setText(ringTone);
m_ui.soundFileRequester->setText(ringTone);
}
void FindThisDeviceConfig::save()
{
config()->set(QStringLiteral("ringtone"), m_ui->soundFileRequester->text());
config()->set(QStringLiteral("ringtone"), m_ui.soundFileRequester->text());
KCModule::save();
}
@ -88,3 +81,4 @@ void FindThisDeviceConfig::playSound(const QUrl &soundUrl)
}
#include "findthisdevice_config.moc"
#include "moc_findthisdevice_config.cpp"

View file

@ -6,19 +6,14 @@
#pragma once
#include "ui_findthisdevice_config.h"
#include <kcmplugin/kdeconnectpluginkcm.h>
namespace Ui
{
class FindThisDeviceConfigUi;
}
class FindThisDeviceConfig : public KdeConnectPluginKcm
{
Q_OBJECT
public:
FindThisDeviceConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &);
~FindThisDeviceConfig() override;
void save() override;
void load() override;
@ -26,5 +21,5 @@ public:
private:
void playSound(const QUrl &soundUrl);
Ui::FindThisDeviceConfigUi *m_ui;
Ui::FindThisDeviceConfigUi m_ui;
};

View file

@ -26,15 +26,8 @@
K_PLUGIN_CLASS_WITH_JSON(FindThisDevicePlugin, "kdeconnect_findthisdevice.json")
FindThisDevicePlugin::FindThisDevicePlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
bool FindThisDevicePlugin::receivePacket(const NetworkPacket & /*np*/)
{
}
bool FindThisDevicePlugin::receivePacket(const NetworkPacket &np)
{
Q_UNUSED(np);
const QString soundFile = config()->getString(QStringLiteral("ringtone"), defaultSound());
const QUrl soundURL = QUrl::fromLocalFile(soundFile);
@ -94,3 +87,4 @@ QString FindThisDevicePlugin::dbusPath() const
}
#include "findthisdeviceplugin.moc"
#include "moc_findthisdeviceplugin.cpp"

View file

@ -27,7 +27,7 @@ class FindThisDevicePlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.findthisdevice")
public:
explicit FindThisDevicePlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
QString dbusPath() const override;
bool receivePacket(const NetworkPacket &np) override;

View file

@ -99,3 +99,4 @@ QString LockDevicePlugin::dbusPath() const
}
#include "lockdeviceplugin-win.moc"
#include "moc_lockdeviceplugin-win.cpp"

View file

@ -37,9 +37,7 @@ LockDevicePlugin::LockDevicePlugin(QObject *parent, const QVariantList &args)
connect(&m_propertiesInterface,
&OrgFreedesktopDBusPropertiesInterface::PropertiesChanged,
this,
[this](const QString &interface, const QVariantMap &properties, QStringList invalidatedProperties) {
Q_UNUSED(invalidatedProperties);
[this](const QString &interface, const QVariantMap &properties) {
if (interface != QLatin1String("org.freedesktop.login1.Session")) {
return;
}
@ -133,3 +131,4 @@ QString LockDevicePlugin::dbusPath() const
}
#include "lockdeviceplugin.moc"
#include "moc_lockdeviceplugin.cpp"

View file

@ -55,17 +55,12 @@ void MMTelephonyPlugin::onModemAdded(const QString &path)
});
}
void MMTelephonyPlugin::onModemRemoved(const QString &path)
{
Q_UNUSED(path);
}
void MMTelephonyPlugin::onCallAdded(ModemManager::Call::Ptr call)
{
qCDebug(KDECONNECT_PLUGIN_MMTELEPHONY) << "Call added" << call->number();
connect(call.get(), &ModemManager::Call::stateChanged, this, [=](MMCallState newState, MMCallState oldState, MMCallStateReason reason) {
onCallStateChanged(call.get(), newState, oldState, reason);
connect(call.get(), &ModemManager::Call::stateChanged, this, [=](MMCallState newState, MMCallState oldState) {
onCallStateChanged(call.get(), newState, oldState);
});
}
@ -94,9 +89,8 @@ QString MMTelephonyPlugin::stateName(MMCallState state)
return event;
}
void MMTelephonyPlugin::onCallStateChanged(ModemManager::Call *call, MMCallState newState, MMCallState oldState, MMCallStateReason reason)
void MMTelephonyPlugin::onCallStateChanged(ModemManager::Call *call, MMCallState newState, MMCallState oldState)
{
Q_UNUSED(reason);
auto event = stateName(newState);
qCDebug(KDECONNECT_PLUGIN_MMTELEPHONY) << "Call state changed" << call->uni() << event;
@ -133,3 +127,4 @@ void MMTelephonyPlugin::sendCancelMMTelephonyPacket(ModemManager::Call *call, co
}
#include "mmtelephonyplugin.moc"
#include "moc_mmtelephonyplugin.cpp"

View file

@ -35,7 +35,6 @@ class MMTelephonyPlugin : public KdeConnectPlugin
public:
explicit MMTelephonyPlugin(QObject *parent, const QVariantList &args);
~MMTelephonyPlugin() override = default;
bool receivePacket(const NetworkPacket &np) override;
@ -43,8 +42,7 @@ private:
void onCallAdded(ModemManager::Call::Ptr call);
void onCallRemoved(ModemManager::Call::Ptr call);
void onModemAdded(const QString &path);
void onModemRemoved(const QString &path);
void onCallStateChanged(ModemManager::Call *call, MMCallState newState, MMCallState oldState, MMCallStateReason reason);
void onCallStateChanged(ModemManager::Call *call, MMCallState newState, MMCallState oldState);
void sendMMTelephonyPacket(ModemManager::Call *call, const QString &state);
void sendCancelMMTelephonyPacket(ModemManager::Call *call, const QString &lastState);
static QString stateName(MMCallState state);

View file

@ -11,3 +11,5 @@ AbstractRemoteInput::AbstractRemoteInput(QObject *parent)
: QObject(parent)
{
}
#include "moc_abstractremoteinput.cpp"

View file

@ -223,3 +223,5 @@ bool MacOSRemoteInput::handlePacket(const NetworkPacket& np)
bool MacOSRemoteInput::hasKeyboardSupport() {
return true;
}
#include "moc_macosremoteinput.cpp"

View file

@ -71,4 +71,5 @@ void MousepadPlugin::connected()
sendPacket(np);
}
#include "moc_mousepadplugin.cpp"
#include "mousepadplugin.moc"

View file

@ -260,3 +260,5 @@ bool WaylandRemoteInput::handlePacket(const NetworkPacket &np)
}
return true;
}
#include "moc_waylandremoteinput.cpp"

View file

@ -247,3 +247,5 @@ bool WindowsRemoteInput::hasKeyboardSupport()
{
return true;
}
#include "moc_windowsremoteinput.cpp"

View file

@ -211,3 +211,5 @@ bool X11RemoteInput::hasKeyboardSupport()
{
return true;
}
#include "moc_x11remoteinput.cpp"

View file

@ -370,4 +370,5 @@ bool MprisControlPlugin::receivePacket(const NetworkPacket &np)
return true;
}
#include "moc_mpriscontrolplugin-win.cpp"
#include "mpriscontrolplugin-win.moc"

View file

@ -119,10 +119,8 @@ void MprisControlPlugin::seeked(qlonglong position)
sendPacket(np);
}
void MprisControlPlugin::propertiesChanged(const QString &propertyInterface, const QVariantMap &properties)
void MprisControlPlugin::propertiesChanged(const QString & /*propertyInterface*/, const QVariantMap &properties)
{
Q_UNUSED(propertyInterface);
OrgFreedesktopDBusPropertiesInterface *propertiesInterface = (OrgFreedesktopDBusPropertiesInterface *)sender();
const auto end = playerList.constEnd();
const auto it = std::find_if(playerList.constBegin(), end, [propertiesInterface](const MprisPlayer &player) {
@ -400,4 +398,5 @@ void MprisControlPlugin::mprisPlayerMetadataToNetworkPacket(NetworkPacket &np, c
np.set(QStringLiteral("url"), fileUrl);
}
#include "moc_mpriscontrolplugin.cpp"
#include "mpriscontrolplugin.moc"

View file

@ -190,3 +190,5 @@ QDBusConnection &MprisRemotePlayer::dbus()
{
return m_dbusConnection;
}
#include "moc_mprisremoteplayer.cpp"

View file

@ -58,3 +58,5 @@ QStringList MprisRemotePlayerMediaPlayer2::SupportedMimeTypes() const
{
return {};
}
#include "moc_mprisremoteplayermediaplayer2.cpp"

View file

@ -159,17 +159,14 @@ void MprisRemotePlayerMediaPlayer2Player::Seek(qlonglong Offset)
m_plugin->seek(Offset);
}
void MprisRemotePlayerMediaPlayer2Player::SetPosition(QDBusObjectPath TrackId, qlonglong Position)
void MprisRemotePlayerMediaPlayer2Player::SetPosition(QDBusObjectPath /*TrackId*/, qlonglong Position)
{
Q_UNUSED(TrackId)
m_plugin->setPlayer(m_parent->identity());
m_plugin->setPosition(Position / 1000);
}
void MprisRemotePlayerMediaPlayer2Player::OpenUri(QString Uri)
void MprisRemotePlayerMediaPlayer2Player::OpenUri(QString /*Uri*/)
{
Q_UNUSED(Uri)
}
void MprisRemotePlayerMediaPlayer2Player::controlsChanged()
@ -256,3 +253,5 @@ void MprisRemotePlayerMediaPlayer2Player::emitPropertiesChanged()
m_positionChanged = false;
m_volumeChanged = false;
}
#include "moc_mprisremoteplayermediaplayer2player.cpp"

View file

@ -16,11 +16,6 @@
K_PLUGIN_CLASS_WITH_JSON(MprisRemotePlugin, "kdeconnect_mprisremote.json")
MprisRemotePlugin::MprisRemotePlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
bool MprisRemotePlugin::receivePacket(const NetworkPacket &np)
{
if (np.type() != PACKET_TYPE_MPRIS)
@ -179,4 +174,5 @@ bool MprisRemotePlugin::canSeek() const
return player ? player->canSeek() : false;
}
#include "moc_mprisremoteplugin.cpp"
#include "mprisremoteplugin.moc"

View file

@ -31,7 +31,7 @@ class MprisRemotePlugin : public KdeConnectPlugin
Q_PROPERTY(bool canSeek READ canSeek NOTIFY propertiesChanged)
public:
explicit MprisRemotePlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
long position() const;
int volume() const;

View file

@ -193,3 +193,5 @@ void Notification::parseNetworkPacket(const NetworkPacket &np)
m_actions.append(value.toString());
}
}
#include "moc_notification.cpp"

View file

@ -11,9 +11,8 @@
#include <dbushelper.h>
#include <KPluginFactory>
#include <KStartupInfo>
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
#include <KStartupInfo>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QX11Info>
#else
@ -23,11 +22,6 @@
K_PLUGIN_CLASS_WITH_JSON(NotificationsPlugin, "kdeconnect_notifications.json")
NotificationsPlugin::NotificationsPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
void NotificationsPlugin::connected()
{
NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{QStringLiteral("request"), true}});
@ -198,4 +192,5 @@ QString NotificationsPlugin::dbusPath() const
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/notifications");
}
#include "moc_notificationsplugin.cpp"
#include "notificationsplugin.moc"

Some files were not shown because too many files have changed in this diff Show more