From a1340c804251415765f755c1efa6e611903aeccc Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sat, 26 Nov 2016 15:12:38 +0100 Subject: [PATCH] Fixed old style connects with clazy --- core/backends/lan/landevicelink.cpp | 6 +-- core/backends/lan/lanlinkprovider.cpp | 36 +++++++++--------- core/backends/lan/socketlinereader.cpp | 4 +- core/backends/lan/uploadjob.cpp | 8 ++-- core/daemon.cpp | 4 +- core/device.cpp | 8 ++-- fileitemactionplugin/sendfileitemaction.cpp | 2 +- interfaces/devicesmodel.cpp | 22 +++++------ interfaces/devicessortproxymodel.cpp | 2 +- interfaces/notificationsmodel.cpp | 32 ++++++++-------- kcm/kcm.cpp | 38 +++++++++---------- plasmoid/declarativeplugin/responsewaiter.cpp | 8 ++-- plugins/mpriscontrol/mpriscontrolplugin.cpp | 4 +- plugins/runcommand/runcommandplugin.cpp | 2 +- .../notificationslistener.cpp | 2 +- .../sendnotifications_config.cpp | 2 +- plugins/sftp/mounter.cpp | 16 ++++---- plugins/sftp/sftpplugin.cpp | 6 +-- plugins/share/shareplugin.cpp | 2 +- plugins/telephony/sendsmsdialog.cpp | 2 +- plugins/telephony/telephonyplugin.cpp | 2 +- tests/testsocketlinereader.cpp | 6 +-- tests/testsslsocketlinereader.cpp | 20 +++++----- 23 files changed, 117 insertions(+), 117 deletions(-) diff --git a/core/backends/lan/landevicelink.cpp b/core/backends/lan/landevicelink.cpp index 716ef6e02..0105d26c4 100644 --- a/core/backends/lan/landevicelink.cpp +++ b/core/backends/lan/landevicelink.cpp @@ -39,14 +39,14 @@ LanDeviceLink::LanDeviceLink(const QString& deviceId, LinkProvider* parent, QSsl void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource) { if (mSocketLineReader) { - disconnect(mSocketLineReader->mSocket, SIGNAL(disconnected()), this, SLOT(deleteLater())); + disconnect(mSocketLineReader->mSocket, &QAbstractSocket::disconnected, this, &QObject::deleteLater); delete mSocketLineReader; } mSocketLineReader = new SocketLineReader(socket, this); - connect(socket, SIGNAL(disconnected()), this, SLOT(deleteLater())); - connect(mSocketLineReader, SIGNAL(readyRead()), this, SLOT(dataReceived())); + connect(socket, &QAbstractSocket::disconnected, this, &QObject::deleteLater); + connect(mSocketLineReader, &SocketLineReader::readyRead, this, &LanDeviceLink::dataReceived); //We take ownership of the socket. //When the link provider destroys us, diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp index be050ef8f..5bc987803 100644 --- a/core/backends/lan/lanlinkprovider.cpp +++ b/core/backends/lan/lanlinkprovider.cpp @@ -50,12 +50,12 @@ LanLinkProvider::LanLinkProvider(bool testMode) combineBroadcastsTimer.setInterval(0); // increase this if waiting a single event-loop iteration is not enough combineBroadcastsTimer.setSingleShot(true); - connect(&combineBroadcastsTimer, SIGNAL(timeout()), this, SLOT(broadcastToNetwork())); + connect(&combineBroadcastsTimer, &QTimer::timeout, this, &LanLinkProvider::broadcastToNetwork); - connect(&mUdpSocket, SIGNAL(readyRead()), this, SLOT(newUdpConnection())); + connect(&mUdpSocket, &QIODevice::readyRead, this, &LanLinkProvider::newUdpConnection); mServer = new Server(this); - connect(mServer,SIGNAL(newConnection()),this, SLOT(newConnection())); + connect(mServer,&QTcpServer::newConnection,this, &LanLinkProvider::newConnection); //Detect when a network interface changes status, so we announce ourelves in the new network QNetworkConfigurationManager* networkManager = new QNetworkConfigurationManager(this); @@ -196,7 +196,7 @@ void LanLinkProvider::newUdpConnection() //udpBroadcastReceived QSslSocket* socket = new QSslSocket(this); receivedIdentityPackages[socket].np = receivedPackage; receivedIdentityPackages[socket].sender = sender; - connect(socket, SIGNAL(connected()), this, SLOT(connected())); + connect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::connected); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError())); socket->connectToHost(sender, tcpPort); } @@ -206,7 +206,7 @@ void LanLinkProvider::connectError() { QSslSocket* socket = qobject_cast(sender()); if (!socket) return; - disconnect(socket, SIGNAL(connected()), this, SLOT(connected())); + disconnect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::connected); disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError())); qCDebug(KDECONNECT_CORE) << "Fallback (1), try reverse connection (send udp packet)" << socket->errorString(); @@ -228,13 +228,13 @@ void LanLinkProvider::connected() QSslSocket* socket = qobject_cast(sender()); if (!socket) return; - disconnect(socket, SIGNAL(connected()), this, SLOT(connected())); + disconnect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::connected); disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError())); configureSocket(socket); // If socket disconnects due to any reason after connection, link on ssl faliure - connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater())); + connect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater); NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np; const QString& deviceId = receivedPackage->get("deviceId"); @@ -258,7 +258,7 @@ void LanLinkProvider::connected() qCDebug(KDECONNECT_CORE) << "Starting server ssl (I'm the client TCP socket)"; - connect(socket, SIGNAL(encrypted()), this, SLOT(encrypted())); + connect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted); if (isDeviceTrusted) { connect(socket, SIGNAL(sslErrors(QList)), this, SLOT(sslErrors(QList))); @@ -289,7 +289,7 @@ void LanLinkProvider::encrypted() QSslSocket* socket = qobject_cast(sender()); if (!socket) return; - disconnect(socket, SIGNAL(encrypted()), this, SLOT(encrypted())); + disconnect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted); disconnect(socket, SIGNAL(sslErrors(QList)), this, SLOT(sslErrors(QList))); Q_ASSERT(socket->mode() != QSslSocket::UnencryptedMode); @@ -309,7 +309,7 @@ void LanLinkProvider::sslErrors(const QList& errors) QSslSocket* socket = qobject_cast(sender()); if (!socket) return; - disconnect(socket, SIGNAL(encrypted()), this, SLOT(encrypted())); + disconnect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted); disconnect(socket, SIGNAL(sslErrors(QList)), this, SLOT(sslErrors(QList))); Q_FOREACH (const QSslError &error, errors) { @@ -347,10 +347,10 @@ void LanLinkProvider::newConnection() //This socket is still managed by us (and child of the QTcpServer), if //it disconnects before we manage to pass it to a LanDeviceLink, it's //our responsibility to delete it. We do so with this connection. - connect(socket, SIGNAL(disconnected()), - socket, SLOT(deleteLater())); - connect(socket, SIGNAL(readyRead()), - this, SLOT(dataReceived())); + connect(socket, &QAbstractSocket::disconnected, + socket, &QObject::deleteLater); + connect(socket, &QIODevice::readyRead, + this, &LanLinkProvider::dataReceived); } } @@ -385,7 +385,7 @@ void LanLinkProvider::dataReceived() //qCDebug(KDECONNECT_CORE) << "Handshaking done (i'm the new device)"; //This socket will now be owned by the LanDeviceLink or we don't want more data to be received, forget about it - disconnect(socket, SIGNAL(readyRead()), this, SLOT(dataReceived())); + disconnect(socket, &QIODevice::readyRead, this, &LanLinkProvider::dataReceived); if (np->get("protocolVersion") >= MIN_VERSION_WITH_SSL_SUPPORT) { @@ -394,7 +394,7 @@ void LanLinkProvider::dataReceived() qCDebug(KDECONNECT_CORE) << "Starting client ssl (but I'm the server TCP socket)"; - connect(socket, SIGNAL(encrypted()), this, SLOT(encrypted())); + connect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted); if (isDeviceTrusted) { connect(socket, SIGNAL(sslErrors(QList)), this, SLOT(sslErrors(QList))); @@ -489,7 +489,7 @@ void LanLinkProvider::configureSocket(QSslSocket* socket) { void LanLinkProvider::addLink(const QString& deviceId, QSslSocket* socket, NetworkPackage* receivedPackage, LanDeviceLink::ConnectionStarted connectionOrigin) { // Socket disconnection will now be handled by LanDeviceLink - disconnect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater())); + disconnect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater); LanDeviceLink* deviceLink; //Do we have a link for this device already? @@ -500,7 +500,7 @@ void LanLinkProvider::addLink(const QString& deviceId, QSslSocket* socket, Netwo deviceLink->reset(socket, connectionOrigin); } else { deviceLink = new LanDeviceLink(deviceId, this, socket, connectionOrigin); - connect(deviceLink, SIGNAL(destroyed(QObject*)), this, SLOT(deviceLinkDestroyed(QObject*))); + connect(deviceLink, &QObject::destroyed, this, &LanLinkProvider::deviceLinkDestroyed); mLinks[deviceId] = deviceLink; if (mPairingHandlers.contains(deviceId)) { //We shouldn't have a pairinghandler if we didn't have a link. diff --git a/core/backends/lan/socketlinereader.cpp b/core/backends/lan/socketlinereader.cpp index ef3c454fe..78b935863 100644 --- a/core/backends/lan/socketlinereader.cpp +++ b/core/backends/lan/socketlinereader.cpp @@ -25,8 +25,8 @@ SocketLineReader::SocketLineReader(QSslSocket* socket, QObject* parent) : QObject(parent) , mSocket(socket) { - connect(mSocket, SIGNAL(readyRead()), - this, SLOT(dataReceived())); + connect(mSocket, &QIODevice::readyRead, + this, &SocketLineReader::dataReceived); } void SocketLineReader::dataReceived() diff --git a/core/backends/lan/uploadjob.cpp b/core/backends/lan/uploadjob.cpp index 9cdf702ec..6f1c4baf9 100644 --- a/core/backends/lan/uploadjob.cpp +++ b/core/backends/lan/uploadjob.cpp @@ -34,8 +34,8 @@ UploadJob::UploadJob(const QSharedPointer& source, const QString& dev , mPort(0) , mDeviceId(deviceId) // We will use this info if link is on ssl, to send encrypted payload { - connect(mInput.data(), SIGNAL(readyRead()), this, SLOT(startUploading())); - connect(mInput.data(), SIGNAL(aboutToClose()), this, SLOT(aboutToClose())); + connect(mInput.data(), &QIODevice::readyRead, this, &UploadJob::startUploading); + connect(mInput.data(), &QIODevice::aboutToClose, this, &UploadJob::aboutToClose); } void UploadJob::start() @@ -52,7 +52,7 @@ void UploadJob::start() return; } } - connect(mServer, SIGNAL(newConnection()), this, SLOT(newConnection())); + connect(mServer, &QTcpServer::newConnection, this, &UploadJob::newConnection); } void UploadJob::newConnection() @@ -64,7 +64,7 @@ void UploadJob::newConnection() Server* server = qobject_cast(sender()); // FIXME : It is called again when payload sending is finished. Unsolved mystery :( - disconnect(mServer, SIGNAL(newConnection()), this, SLOT(newConnection())); + disconnect(mServer, &QTcpServer::newConnection, this, &UploadJob::newConnection); mSocket = server->nextPendingConnection(); mSocket->setParent(this); diff --git a/core/daemon.cpp b/core/daemon.cpp index b8323e6c3..1d96be153 100644 --- a/core/daemon.cpp +++ b/core/daemon.cpp @@ -79,8 +79,8 @@ Daemon::Daemon(QObject *parent, bool testMode) //Listen to new devices Q_FOREACH (LinkProvider* a, d->mLinkProviders) { - connect(a, SIGNAL(onConnectionReceived(NetworkPackage,DeviceLink*)), - this, SLOT(onNewDeviceLink(NetworkPackage,DeviceLink*))); + connect(a, &LinkProvider::onConnectionReceived, + this, &Daemon::onNewDeviceLink); a->onStart(); } diff --git a/core/device.cpp b/core/device.cpp index 5dd42a190..ece5ff254 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -211,8 +211,8 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link) qCWarning(KDECONNECT_CORE) << m_deviceName << "- warning, device uses a different protocol version" << m_protocolVersion << "expected" << NetworkPackage::ProtocolVersion; } - connect(link, SIGNAL(destroyed(QObject*)), - this, SLOT(linkDestroyed(QObject*))); + connect(link, &QObject::destroyed, + this, &Device::linkDestroyed); m_deviceLinks.append(link); @@ -224,8 +224,8 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link) //the old one before this is called), so we do not have to worry about destroying old links. //-- Actually, we should not destroy them or the provider will store an invalid ref! - connect(link, SIGNAL(receivedPackage(NetworkPackage)), - this, SLOT(privateReceivedPackage(NetworkPackage))); + connect(link, &DeviceLink::receivedPackage, + this, &Device::privateReceivedPackage); qSort(m_deviceLinks.begin(), m_deviceLinks.end(), lessThan); diff --git a/fileitemactionplugin/sendfileitemaction.cpp b/fileitemactionplugin/sendfileitemaction.cpp index aff479c22..13bd47310 100644 --- a/fileitemactionplugin/sendfileitemaction.cpp +++ b/fileitemactionplugin/sendfileitemaction.cpp @@ -67,7 +67,7 @@ QList SendFileItemAction::actions(const KFileItemListProperties& fileI action->setProperty("id", id); action->setProperty("urls", QVariant::fromValue(fileItemInfos.urlList())); action->setProperty("parentWidget", QVariant::fromValue(parentWidget)); - connect(action, SIGNAL(triggered(bool)), this, SLOT(sendFile())); + connect(action, &QAction::triggered, this, &SendFileItemAction::sendFile); actions += action; } diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp index 318efa031..4c08bda76 100644 --- a/interfaces/devicesmodel.cpp +++ b/interfaces/devicesmodel.cpp @@ -46,17 +46,17 @@ DevicesModel::DevicesModel(QObject *parent) //new ModelTest(this, this); - connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SIGNAL(rowsChanged())); - connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SIGNAL(rowsChanged())); + connect(this, &QAbstractItemModel::rowsRemoved, + this, &DevicesModel::rowsChanged); + connect(this, &QAbstractItemModel::rowsInserted, + this, &DevicesModel::rowsChanged); connect(m_dbusInterface, SIGNAL(deviceAdded(QString)), this, SLOT(deviceAdded(QString))); - connect(m_dbusInterface, SIGNAL(deviceVisibilityChanged(QString,bool)), - this, SLOT(deviceUpdated(QString,bool))); - connect(m_dbusInterface, SIGNAL(deviceRemoved(QString)), - this, SLOT(deviceRemoved(QString))); + connect(m_dbusInterface, &OrgKdeKdeconnectDaemonInterface::deviceVisibilityChanged, + this, &DevicesModel::deviceUpdated); + connect(m_dbusInterface, &OrgKdeKdeconnectDaemonInterface::deviceRemoved, + this, &DevicesModel::deviceRemoved); QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); @@ -182,8 +182,8 @@ void DevicesModel::refreshDeviceList() QDBusPendingReply pendingDeviceIds = m_dbusInterface->devices(onlyReachable, onlyPaired); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingDeviceIds, this); - QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(receivedDeviceList(QDBusPendingCallWatcher*))); + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, + this, &DevicesModel::receivedDeviceList); } void DevicesModel::receivedDeviceList(QDBusPendingCallWatcher* watcher) @@ -212,7 +212,7 @@ void DevicesModel::receivedDeviceList(QDBusPendingCallWatcher* watcher) void DevicesModel::appendDevice(DeviceDbusInterface* dev) { m_deviceList.append(dev); - connect(dev, SIGNAL(nameChanged(QString)), SLOT(nameChanged(QString))); + connect(dev, &OrgKdeKdeconnectDeviceInterface::nameChanged, this, &DevicesModel::nameChanged); } void DevicesModel::nameChanged(const QString& newName) diff --git a/interfaces/devicessortproxymodel.cpp b/interfaces/devicessortproxymodel.cpp index cff163c04..979e751f1 100644 --- a/interfaces/devicessortproxymodel.cpp +++ b/interfaces/devicessortproxymodel.cpp @@ -34,7 +34,7 @@ void DevicesSortProxyModel::setSourceModel(QAbstractItemModel *devicesModel) QSortFilterProxyModel::setSourceModel(devicesModel); if (devicesModel) { setSortRole(DevicesModel::StatusModelRole); - connect(devicesModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(sourceDataChanged())); + connect(devicesModel, &QAbstractItemModel::dataChanged, this, &DevicesSortProxyModel::sourceDataChanged); } sort(0); } diff --git a/interfaces/notificationsmodel.cpp b/interfaces/notificationsmodel.cpp index 472b45871..42a77feb1 100644 --- a/interfaces/notificationsmodel.cpp +++ b/interfaces/notificationsmodel.cpp @@ -36,15 +36,15 @@ NotificationsModel::NotificationsModel(QObject* parent) //new ModelTest(this, this); - connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SIGNAL(rowsChanged())); - connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SIGNAL(rowsChanged())); + connect(this, &QAbstractItemModel::rowsInserted, + this, &NotificationsModel::rowsChanged); + connect(this, &QAbstractItemModel::rowsRemoved, + this, &NotificationsModel::rowsChanged); - connect(this, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SIGNAL(anyDismissableChanged())); - connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SIGNAL(anyDismissableChanged())); + connect(this, &QAbstractItemModel::dataChanged, + this, &NotificationsModel::anyDismissableChanged); + connect(this, &QAbstractItemModel::rowsInserted, + this, &NotificationsModel::anyDismissableChanged); QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); @@ -82,12 +82,12 @@ void NotificationsModel::setDeviceId(const QString& deviceId) m_dbusInterface = new DeviceNotificationsDbusInterface(deviceId, this); - connect(m_dbusInterface, SIGNAL(notificationPosted(QString)), - this, SLOT(notificationAdded(QString))); - connect(m_dbusInterface, SIGNAL(notificationRemoved(QString)), - this, SLOT(notificationRemoved(QString))); - connect(m_dbusInterface, SIGNAL(allNotificationsRemoved()), - this, SLOT(clearNotifications())); + connect(m_dbusInterface, &OrgKdeKdeconnectDeviceNotificationsInterface::notificationPosted, + this, &NotificationsModel::notificationAdded); + connect(m_dbusInterface, &OrgKdeKdeconnectDeviceNotificationsInterface::notificationRemoved, + this, &NotificationsModel::notificationRemoved); + connect(m_dbusInterface, &OrgKdeKdeconnectDeviceNotificationsInterface::allNotificationsRemoved, + this, &NotificationsModel::clearNotifications); refreshNotificationList(); @@ -132,8 +132,8 @@ void NotificationsModel::refreshNotificationList() QDBusPendingReply pendingNotificationIds = m_dbusInterface->activeNotifications(); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingNotificationIds, this); - QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(receivedNotifications(QDBusPendingCallWatcher*))); + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, + this, &NotificationsModel::receivedNotifications); } void NotificationsModel::receivedNotifications(QDBusPendingCallWatcher* watcher) diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp index 3e4b731e8..8baf4058e 100644 --- a/kcm/kcm.cpp +++ b/kcm/kcm.cpp @@ -91,24 +91,24 @@ KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList&) setButtons(KCModule::Help | KCModule::NoAdditionalButton); - connect(devicesModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(resetSelection())); - connect(kcmUi->deviceList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(deviceSelected(QModelIndex))); - connect(kcmUi->pair_button, SIGNAL(clicked()), - this, SLOT(requestPair())); - connect(kcmUi->unpair_button, SIGNAL(clicked()), - this, SLOT(unpair())); - connect(kcmUi->ping_button, SIGNAL(clicked()), - this, SLOT(sendPing())); - connect(kcmUi->refresh_button,SIGNAL(clicked()), - this, SLOT(refresh())); - connect(kcmUi->rename_edit,SIGNAL(returnPressed()), - this, SLOT(renameDone())); - connect(kcmUi->renameDone_button,SIGNAL(clicked()), - this, SLOT(renameDone())); - connect(kcmUi->renameShow_button,SIGNAL(clicked()), - this, SLOT(renameShow())); + connect(devicesModel, &QAbstractItemModel::dataChanged, + this, &KdeConnectKcm::resetSelection); + connect(kcmUi->deviceList->selectionModel(), &QItemSelectionModel::currentChanged, + this, &KdeConnectKcm::deviceSelected); + connect(kcmUi->pair_button, &QAbstractButton::clicked, + this, &KdeConnectKcm::requestPair); + 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); daemon->acquireDiscoveryMode(createId()); } @@ -234,7 +234,7 @@ void KdeConnectKcm::resetDeviceView() KSharedConfigPtr deviceConfig = KSharedConfig::openConfig(currentDevice->pluginsConfigFile()); kcmUi->pluginSelector->addPlugins(availablePluginInfo, KPluginSelector::ReadConfigFile, i18n("Available plugins"), QString(), deviceConfig); - connect(kcmUi->pluginSelector, SIGNAL(changed(bool)), this, SLOT(pluginsConfigChanged())); + connect(kcmUi->pluginSelector, &KPluginSelector::changed, this, &KdeConnectKcm::pluginsConfigChanged); } diff --git a/plasmoid/declarativeplugin/responsewaiter.cpp b/plasmoid/declarativeplugin/responsewaiter.cpp index 11a30e335..76cdc5111 100644 --- a/plasmoid/declarativeplugin/responsewaiter.cpp +++ b/plasmoid/declarativeplugin/responsewaiter.cpp @@ -62,7 +62,7 @@ DBusAsyncResponse::DBusAsyncResponse(QObject* parent) { m_timeout.setSingleShot(true); m_timeout.setInterval(15000); - connect(&m_timeout, SIGNAL(timeout()), this, SLOT(onTimeout())); + connect(&m_timeout, &QTimer::timeout, this, &DBusAsyncResponse::onTimeout); } @@ -72,9 +72,9 @@ void DBusAsyncResponse::setPendingCall(QVariant variant) { QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(*call); watcher->setProperty("pengingCallVariant", variant); - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(onCallFinished(QDBusPendingCallWatcher*))); - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), watcher, SLOT(deleteLater())); - connect(&m_timeout, SIGNAL(timeout()), watcher, SLOT(deleteLater())); + connect(watcher, &QDBusPendingCallWatcher::finished, this, &DBusAsyncResponse::onCallFinished); + connect(watcher, &QDBusPendingCallWatcher::finished, watcher, &QObject::deleteLater); + connect(&m_timeout, &QTimer::timeout, watcher, &QObject::deleteLater); m_timeout.start(); } } diff --git a/plugins/mpriscontrol/mpriscontrolplugin.cpp b/plugins/mpriscontrol/mpriscontrolplugin.cpp index ce3ca3254..e8828339e 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin.cpp +++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp @@ -90,10 +90,10 @@ void MprisControlPlugin::addPlayer(const QString& service) sendPlayerList(); OrgFreedesktopDBusPropertiesInterface* freedesktopInterface = new OrgFreedesktopDBusPropertiesInterface(service, "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus(), this); - connect(freedesktopInterface, SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)), this, SLOT(propertiesChanged(QString,QVariantMap))); + connect(freedesktopInterface, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, this, &MprisControlPlugin::propertiesChanged); OrgMprisMediaPlayer2PlayerInterface* mprisInterface0 = new OrgMprisMediaPlayer2PlayerInterface(service, "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus()); - connect(mprisInterface0, SIGNAL(Seeked(qlonglong)), this, SLOT(seeked(qlonglong))); + connect(mprisInterface0, &OrgMprisMediaPlayer2PlayerInterface::Seeked, this, &MprisControlPlugin::seeked); } void MprisControlPlugin::seeked(qlonglong position){ diff --git a/plugins/runcommand/runcommandplugin.cpp b/plugins/runcommand/runcommandplugin.cpp index 9af464aba..93a2845dd 100644 --- a/plugins/runcommand/runcommandplugin.cpp +++ b/plugins/runcommand/runcommandplugin.cpp @@ -42,7 +42,7 @@ Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_RUNCOMMAND, "kdeconnect.plugin.runcommand") RunCommandPlugin::RunCommandPlugin(QObject* parent, const QVariantList& args) : KdeConnectPlugin(parent, args) { - connect(config(), SIGNAL(configChanged()), this, SLOT(configChanged())); + connect(config(), &KdeConnectPluginConfig::configChanged, this, &RunCommandPlugin::configChanged); } RunCommandPlugin::~RunCommandPlugin() diff --git a/plugins/sendnotifications/notificationslistener.cpp b/plugins/sendnotifications/notificationslistener.cpp index c8608ac3b..2522ee48c 100644 --- a/plugins/sendnotifications/notificationslistener.cpp +++ b/plugins/sendnotifications/notificationslistener.cpp @@ -67,7 +67,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin) setTranslatedAppName(); loadApplications(); - connect(mPlugin->config(), SIGNAL(configChanged()), this, SLOT(loadApplications())); + connect(mPlugin->config(), &KdeConnectPluginConfig::configChanged, this, &NotificationsListener::loadApplications); } NotificationsListener::~NotificationsListener() diff --git a/plugins/sendnotifications/sendnotifications_config.cpp b/plugins/sendnotifications/sendnotifications_config.cpp index 59a42dfe6..93d62cc57 100644 --- a/plugins/sendnotifications/sendnotifications_config.cpp +++ b/plugins/sendnotifications/sendnotifications_config.cpp @@ -55,7 +55,7 @@ SendNotificationsConfig::SendNotificationsConfig(QWidget *parent, const QVariant connect(appModel, SIGNAL(applicationsChanged()), this, SLOT(changed())); - connect(config(), SIGNAL(configChanged()), this, SLOT(loadApplications())); + connect(config(), &KdeConnectPluginConfig::configChanged, this, &SendNotificationsConfig::loadApplications); } SendNotificationsConfig::~SendNotificationsConfig() diff --git a/plugins/sftp/mounter.cpp b/plugins/sftp/mounter.cpp index ec289e8f0..a7cb53fcc 100644 --- a/plugins/sftp/mounter.cpp +++ b/plugins/sftp/mounter.cpp @@ -37,17 +37,17 @@ Mounter::Mounter(SftpPlugin* sftp) , m_started(false) { - connect(m_sftp, SIGNAL(packageReceived(NetworkPackage)), this, SLOT(onPakcageReceived(NetworkPackage))); + connect(m_sftp, &SftpPlugin::packageReceived, this, &Mounter::onPakcageReceived); - connect(&m_connectTimer, SIGNAL(timeout()), this, SLOT(onMountTimeout())); + connect(&m_connectTimer, &QTimer::timeout, this, &Mounter::onMountTimeout); - connect(this, SIGNAL(mounted()), &m_connectTimer, SLOT(stop())); - connect(this, SIGNAL(failed(QString)), &m_connectTimer, SLOT(stop())); + connect(this, &Mounter::mounted, &m_connectTimer, &QTimer::stop); + connect(this, &Mounter::failed, &m_connectTimer, &QTimer::stop); m_connectTimer.setInterval(10000); m_connectTimer.setSingleShot(true); - QTimer::singleShot(0, this, SLOT(start())); + QTimer::singleShot(0, this, &Mounter::start); qCDebug(KDECONNECT_PLUGIN_SFTP) << "Created mounter"; } @@ -68,8 +68,8 @@ bool Mounter::wait() qCDebug(KDECONNECT_PLUGIN_SFTP) << "Starting loop to wait for mount"; MountLoop loop; - connect(this, SIGNAL(mounted()), &loop, SLOT(successed())); - connect(this, SIGNAL(failed(QString)), &loop, SLOT(failed())); + connect(this, &Mounter::mounted, &loop, &MountLoop::successed); + connect(this, &Mounter::failed, &loop, &MountLoop::failed); return loop.exec(); } @@ -101,7 +101,7 @@ void Mounter::onPakcageReceived(const NetworkPackage& np) m_proc = new KProcess(this); m_proc->setOutputChannelMode(KProcess::MergedChannels); - connect(m_proc, SIGNAL(started()), SLOT(onStarted())); + connect(m_proc, &QProcess::started, this, &Mounter::onStarted); connect(m_proc, SIGNAL(error(QProcess::ProcessError)), SLOT(onError(QProcess::ProcessError))); connect(m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(onFinished(int,QProcess::ExitStatus))); diff --git a/plugins/sftp/sftpplugin.cpp b/plugins/sftp/sftpplugin.cpp index fd29ae35a..fe2581f1b 100644 --- a/plugins/sftp/sftpplugin.cpp +++ b/plugins/sftp/sftpplugin.cpp @@ -95,9 +95,9 @@ void SftpPlugin::mount() } m_d->mounter = new Mounter(this); - connect(m_d->mounter, SIGNAL(mounted()), this, SLOT(onMounted())); - connect(m_d->mounter, SIGNAL(unmounted()), this, SLOT(onUnmounted())); - connect(m_d->mounter, SIGNAL(failed(QString)), this, SLOT(onFailed(QString))); + connect(m_d->mounter, &Mounter::mounted, this, &SftpPlugin::onMounted); + connect(m_d->mounter, &Mounter::unmounted, this, &SftpPlugin::onUnmounted); + connect(m_d->mounter, &Mounter::failed, this, &SftpPlugin::onFailed); } void SftpPlugin::unmount() diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp index cc75e6361..3bf1fa61e 100644 --- a/plugins/share/shareplugin.cpp +++ b/plugins/share/shareplugin.cpp @@ -98,7 +98,7 @@ bool SharePlugin::receivePackage(const NetworkPackage& np) FileTransferJob* job = np.createPayloadTransferJob(destination); job->setOriginName(device()->name() + ": " + filename); - connect(job, SIGNAL(result(KJob*)), this, SLOT(finished(KJob*))); + connect(job, &KJob::result, this, &SharePlugin::finished); KIO::getJobTracker()->registerJob(job); job->start(); } else if (np.has("text")) { diff --git a/plugins/telephony/sendsmsdialog.cpp b/plugins/telephony/sendsmsdialog.cpp index abf2fba0d..136131f23 100644 --- a/plugins/telephony/sendsmsdialog.cpp +++ b/plugins/telephony/sendsmsdialog.cpp @@ -42,7 +42,7 @@ SendSmsDialog::SendSmsDialog(const QString& originalMessage, const QString& phon layout->addWidget(mTextEdit); QPushButton* sendButton = new QPushButton(i18n("Send"), this); - connect(sendButton, SIGNAL(clicked(bool)), SLOT(sendButtonClicked())); + connect(sendButton, &QAbstractButton::clicked, this, &SendSmsDialog::sendButtonClicked); layout->addWidget(sendButton); setLayout(layout); diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp index 0d67be254..9f31381c1 100644 --- a/plugins/telephony/telephonyplugin.cpp +++ b/plugins/telephony/telephonyplugin.cpp @@ -157,7 +157,7 @@ void TelephonyPlugin::showSendSmsDialog() QString contactName = sender()->property("contactName").toString(); QString originalMessage = sender()->property("originalMessage").toString(); SendSmsDialog* dialog = new SendSmsDialog(originalMessage, phoneNumber, contactName); - connect(dialog, SIGNAL(sendSms(QString,QString)), this, SLOT(sendSms(QString,QString))); + connect(dialog, &SendSmsDialog::sendSms, this, &TelephonyPlugin::sendSms); dialog->show(); } diff --git a/tests/testsocketlinereader.cpp b/tests/testsocketlinereader.cpp index 25c5f4182..02612a81e 100644 --- a/tests/testsocketlinereader.cpp +++ b/tests/testsocketlinereader.cpp @@ -52,11 +52,11 @@ void TestSocketLineReader::initTestCase() mTimer.setInterval(4000);//For second is more enough to send some data via local socket mTimer.setSingleShot(true); - connect(&mTimer, SIGNAL(timeout()), &mLoop, SLOT(quit())); + connect(&mTimer, &QTimer::timeout, &mLoop, &QEventLoop::quit); mConn = new QSslSocket(this); mConn->connectToHost(QHostAddress::LocalHost, 8694); - connect(mConn, SIGNAL(connected()), &mLoop, SLOT(quit())); + connect(mConn, &QAbstractSocket::connected, &mLoop, &QEventLoop::quit); mTimer.start(); mLoop.exec(); @@ -83,7 +83,7 @@ void TestSocketLineReader::socketLineReader() QVERIFY2(sock != nullptr, "Could not open a connection to the client"); mReader = new SocketLineReader(sock, this); - connect(mReader, SIGNAL(readyRead()), SLOT(newPackage())); + connect(mReader, &SocketLineReader::readyRead, this, &TestSocketLineReader::newPackage); mTimer.start(); mLoop.exec(); diff --git a/tests/testsslsocketlinereader.cpp b/tests/testsslsocketlinereader.cpp index 64599a860..d62a3a59a 100644 --- a/tests/testsslsocketlinereader.cpp +++ b/tests/testsslsocketlinereader.cpp @@ -70,7 +70,7 @@ void TestSslSocketLineReader::initTestCase() mTimer.setInterval(10 * 1000);//Ten second is more enough for this test, just used this so that to break mLoop if stuck mTimer.setSingleShot(true); - connect(&mTimer, SIGNAL(timeout()), &mLoop, SLOT(quit())); + connect(&mTimer, &QTimer::timeout, &mLoop, &QEventLoop::quit); mTimer.start(); } @@ -79,7 +79,7 @@ void TestSslSocketLineReader::init() { mClientSocket = new QSslSocket(this); mClientSocket->connectToHost(QHostAddress::LocalHost, PORT); - connect(mClientSocket, SIGNAL(connected()), &mLoop, SLOT(quit())); + connect(mClientSocket, &QAbstractSocket::connected, &mLoop, &QEventLoop::quit); mLoop.exec(); @@ -123,7 +123,7 @@ void TestSslSocketLineReader::testTrustedDevice() mClientSocket->setPeerVerifyMode(QSslSocket::VerifyPeer); mClientSocket->addCaCertificate(serverSocket->localCertificate()); - connect(mClientSocket, SIGNAL(encrypted()), &mLoop, SLOT(quit())); + connect(mClientSocket, &QSslSocket::encrypted, &mLoop, &QEventLoop::quit); serverSocket->startServerEncryption(); mClientSocket->startClientEncryption(); mLoop.exec(); @@ -146,7 +146,7 @@ void TestSslSocketLineReader::testTrustedDevice() mPackages.clear(); mReader = new SocketLineReader(serverSocket, this); - connect(mReader, SIGNAL(readyRead()), this,SLOT(newPackage())); + connect(mReader, &SocketLineReader::readyRead, this,&TestSslSocketLineReader::newPackage); mLoop.exec(); /* remove the empty line before compare */ @@ -183,7 +183,7 @@ void TestSslSocketLineReader::testUntrustedDevice() mClientSocket->setPeerVerifyName("Test Server"); mClientSocket->setPeerVerifyMode(QSslSocket::QueryPeer); - connect(mClientSocket, SIGNAL(encrypted()), &mLoop, SLOT(quit())); + connect(mClientSocket, &QSslSocket::encrypted, &mLoop, &QEventLoop::quit); serverSocket->startServerEncryption(); mClientSocket->startClientEncryption(); mLoop.exec(); @@ -205,7 +205,7 @@ void TestSslSocketLineReader::testUntrustedDevice() mPackages.clear(); mReader = new SocketLineReader(serverSocket, this); - connect(mReader, SIGNAL(readyRead()), SLOT(newPackage())); + connect(mReader, &SocketLineReader::readyRead, this, &TestSslSocketLineReader::newPackage); mLoop.exec(); /* remove the empty line before compare */ @@ -241,10 +241,10 @@ void TestSslSocketLineReader::testTrustedDeviceWithWrongCertificate() mClientSocket->setPeerVerifyName("Test Server"); mClientSocket->setPeerVerifyMode(QSslSocket::VerifyPeer); - connect(serverSocket, SIGNAL(encrypted()), &mLoop, SLOT(quit())); // Encrypted signal should never be emitted - connect(mClientSocket, SIGNAL(encrypted()), &mLoop, SLOT(quit())); // Encrypted signal should never be emitted - connect(serverSocket, SIGNAL(disconnected()), &mLoop, SLOT(quit())); - connect(mClientSocket, SIGNAL(disconnected()), &mLoop, SLOT(quit())); + connect(serverSocket, &QSslSocket::encrypted, &mLoop, &QEventLoop::quit); // Encrypted signal should never be emitted + connect(mClientSocket, &QSslSocket::encrypted, &mLoop, &QEventLoop::quit); // Encrypted signal should never be emitted + connect(serverSocket, &QAbstractSocket::disconnected, &mLoop, &QEventLoop::quit); + connect(mClientSocket, &QAbstractSocket::disconnected, &mLoop, &QEventLoop::quit); serverSocket->startServerEncryption(); mClientSocket->startClientEncryption();