Update old-style connect/disconnect where possible

This commit is contained in:
Albert Vaca Cintora 2023-08-08 22:51:30 +02:00
parent a467247f08
commit 5cc2043c35
7 changed files with 24 additions and 24 deletions

View file

@ -39,7 +39,7 @@ void BluetoothLinkProvider::onStart()
mBluetoothServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this); mBluetoothServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this);
mBluetoothServer->setSecurityFlags(QBluetooth::Security::Encryption | QBluetooth::Security::Secure); mBluetoothServer->setSecurityFlags(QBluetooth::Security::Encryption | QBluetooth::Security::Secure);
connect(mBluetoothServer, SIGNAL(newConnection()), this, SLOT(serverNewConnection())); connect(mBluetoothServer, &QBluetoothServer::newConnection, this, &BluetoothLinkProvider::serverNewConnection);
mServiceDiscoveryAgent->start(); mServiceDiscoveryAgent->start();
@ -73,9 +73,9 @@ void BluetoothLinkProvider::connectError()
qCWarning(KDECONNECT_CORE) << "Couldn't connect to socket:" << socket->errorString(); qCWarning(KDECONNECT_CORE) << "Couldn't connect to socket:" << socket->errorString();
disconnect(socket, SIGNAL(connected()), this, SLOT(clientConnected())); disconnect(socket, &QBluetoothSocket::connected, this, nullptr);
disconnect(socket, SIGNAL(readyRead()), this, SLOT(serverDataReceived())); disconnect(socket, &QBluetoothSocket::readyRead, this, nullptr);
disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError())); disconnect(socket, QOverload<QBluetoothSocket::SocketError>::of(&QBluetoothSocket::error), this, nullptr);
mSockets.remove(socket->peerAddress()); mSockets.remove(socket->peerAddress());
socket->deleteLater(); socket->deleteLater();
@ -105,7 +105,7 @@ void BluetoothLinkProvider::serviceDiscovered(const QBluetoothServiceInfo &old_i
clientConnected(deleteableSocket); clientConnected(deleteableSocket);
}); });
}); });
connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError())); connect(socket, QOverload<QBluetoothSocket::SocketError>::of(&QBluetoothSocket::error), this, &BluetoothLinkProvider::connectError);
socket->connectToService(info); socket->connectToService(info);
@ -180,7 +180,7 @@ void BluetoothLinkProvider::clientIdentityReceived(const QBluetoothAddress &peer
qCDebug(KDECONNECT_CORE) << "Received identity packet from" << peer; qCDebug(KDECONNECT_CORE) << "Received identity packet from" << peer;
// TODO? // TODO?
// disconnect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(connectError())); // disconnect(socket, &QAbstractSocket::error, this, &BluetoothLinkProvider::connectError);
QSslCertificate receivedCertificate(receivedPacket.get<QString>(QStringLiteral("certificate")).toLatin1()); QSslCertificate receivedCertificate(receivedPacket.get<QString>(QStringLiteral("certificate")).toLatin1());
DeviceInfo deviceInfo = deviceInfo.FromIdentityPacketAndCert(receivedPacket, receivedCertificate); DeviceInfo deviceInfo = deviceInfo.FromIdentityPacketAndCert(receivedPacket, receivedCertificate);

View file

@ -24,7 +24,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface *device)
{ {
setIcon(QIcon::fromTheme(device->iconName())); setIcon(QIcon::fromTheme(device->iconName()));
connect(device, SIGNAL(nameChanged(QString)), this, SLOT(setText(QString))); connect(device, &DeviceDbusInterface::nameChanged, this, &DeviceIndicator::setText);
// Battery status // Battery status
auto battery = new BatteryAction(device); auto battery = new BatteryAction(device);

View file

@ -27,7 +27,7 @@ DevicesModel::DevicesModel(QObject *parent)
connect(this, &QAbstractItemModel::rowsRemoved, this, &DevicesModel::rowsChanged); connect(this, &QAbstractItemModel::rowsRemoved, this, &DevicesModel::rowsChanged);
connect(this, &QAbstractItemModel::rowsInserted, this, &DevicesModel::rowsChanged); connect(this, &QAbstractItemModel::rowsInserted, this, &DevicesModel::rowsChanged);
connect(m_dbusInterface, SIGNAL(deviceAdded(QString)), this, SLOT(deviceAdded(QString))); connect(m_dbusInterface, &OrgKdeKdeconnectDaemonInterface::deviceAdded, this, &DevicesModel::deviceAdded);
connect(m_dbusInterface, &OrgKdeKdeconnectDaemonInterface::deviceVisibilityChanged, this, &DevicesModel::deviceUpdated); connect(m_dbusInterface, &OrgKdeKdeconnectDaemonInterface::deviceVisibilityChanged, this, &DevicesModel::deviceUpdated);
connect(m_dbusInterface, &OrgKdeKdeconnectDaemonInterface::deviceRemoved, this, &DevicesModel::deviceRemoved); connect(m_dbusInterface, &OrgKdeKdeconnectDaemonInterface::deviceRemoved, this, &DevicesModel::deviceRemoved);

View file

@ -56,8 +56,8 @@ KdeConnectKcm::KdeConnectKcm(QObject *parent, const QVariantList &args)
kcmUi.rename_edit->setText(announcedName); kcmUi.rename_edit->setText(announcedName);
}, },
this); this);
connect(daemon, SIGNAL(announcedNameChanged(QString)), kcmUi.rename_edit, SLOT(setText(QString))); connect(daemon, &DaemonDbusInterface::announcedNameChanged, kcmUi.rename_edit, &QLineEdit::setText);
connect(daemon, SIGNAL(announcedNameChanged(QString)), kcmUi.rename_label, SLOT(setText(QString))); connect(daemon, &DaemonDbusInterface::announcedNameChanged, kcmUi.rename_label, &QLabel::setText);
setRenameMode(false); setRenameMode(false);
setButtons(KCModule::Help | KCModule::NoAdditionalButton); setButtons(KCModule::Help | KCModule::NoAdditionalButton);
@ -164,8 +164,8 @@ void KdeConnectKcm::deviceSelected(const QModelIndex &current)
kcmUi.messages->setVisible(false); kcmUi.messages->setVisible(false);
resetDeviceView(); resetDeviceView();
connect(currentDevice, SIGNAL(pluginsChanged()), this, SLOT(resetCurrentDevice())); connect(currentDevice, &DeviceDbusInterface::pluginsChanged, this, &KdeConnectKcm::resetCurrentDevice);
connect(currentDevice, SIGNAL(pairingFailed(QString)), this, SLOT(pairingFailed(QString))); connect(currentDevice, &DeviceDbusInterface::pairingFailed, this, &KdeConnectKcm::pairingFailed);
connect(currentDevice, &DeviceDbusInterface::pairStateChanged, this, &KdeConnectKcm::setCurrentDevicePairState); connect(currentDevice, &DeviceDbusInterface::pairStateChanged, this, &KdeConnectKcm::setCurrentDevicePairState);
} }

View file

@ -121,7 +121,7 @@ void SmsPlugin::forwardToTelepathy(const ConversationMessage &message)
return; return;
qCDebug(KDECONNECT_PLUGIN_SMS) << "Passing a text message to the telepathy interface"; qCDebug(KDECONNECT_PLUGIN_SMS) << "Passing a text message to the telepathy interface";
connect(&m_telepathyInterface, SIGNAL(messageReceived(QString, QString)), SLOT(sendSms(QString, QString)), Qt::UniqueConnection); connect(&m_telepathyInterface, SIGNAL(messageReceived(QString, QString)), this, SLOT(sendSms(QString, QString)), Qt::UniqueConnection);
const QString messageBody = message.body(); const QString messageBody = message.body();
const QString contactName; // TODO: When telepathy support is improved, look up the contact with KPeople const QString contactName; // TODO: When telepathy support is improved, look up the contact with KPeople
const QString phoneNumber = message.addresses()[0].address(); const QString phoneNumber = message.addresses()[0].address();

View file

@ -56,8 +56,8 @@ void ConversationListModel::setDeviceId(const QString &deviceId)
qCDebug(KDECONNECT_SMS_CONVERSATIONS_LIST_MODEL) << "setDeviceId" << deviceId << "of" << this; qCDebug(KDECONNECT_SMS_CONVERSATIONS_LIST_MODEL) << "setDeviceId" << deviceId << "of" << this;
if (m_conversationsInterface) { if (m_conversationsInterface) {
disconnect(m_conversationsInterface, SIGNAL(conversationCreated(QDBusVariant)), this, SLOT(handleCreatedConversation(QDBusVariant))); disconnect(m_conversationsInterface, &DeviceConversationsDbusInterface::conversationCreated, this, &ConversationListModel::handleCreatedConversation);
disconnect(m_conversationsInterface, SIGNAL(conversationUpdated(QDBusVariant)), this, SLOT(handleConversationUpdated(QDBusVariant))); disconnect(m_conversationsInterface, &DeviceConversationsDbusInterface::conversationUpdated, this, &ConversationListModel::handleConversationUpdated);
delete m_conversationsInterface; delete m_conversationsInterface;
m_conversationsInterface = nullptr; m_conversationsInterface = nullptr;
} }
@ -73,8 +73,8 @@ void ConversationListModel::setDeviceId(const QString &deviceId)
Q_EMIT deviceIdChanged(); Q_EMIT deviceIdChanged();
m_conversationsInterface = new DeviceConversationsDbusInterface(deviceId, this); m_conversationsInterface = new DeviceConversationsDbusInterface(deviceId, this);
connect(m_conversationsInterface, SIGNAL(conversationCreated(QDBusVariant)), this, SLOT(handleCreatedConversation(QDBusVariant))); connect(m_conversationsInterface, &DeviceConversationsDbusInterface::conversationCreated, this, &ConversationListModel::handleCreatedConversation);
connect(m_conversationsInterface, SIGNAL(conversationUpdated(QDBusVariant)), this, SLOT(handleConversationUpdated(QDBusVariant))); connect(m_conversationsInterface, &DeviceConversationsDbusInterface::conversationUpdated, this, &ConversationListModel::handleConversationUpdated);
refresh(); refresh();
} }

View file

@ -61,20 +61,20 @@ void ConversationModel::setDeviceId(const QString &deviceId)
qCDebug(KDECONNECT_SMS_CONVERSATION_MODEL) << "setDeviceId" qCDebug(KDECONNECT_SMS_CONVERSATION_MODEL) << "setDeviceId"
<< "of" << this; << "of" << this;
if (m_conversationsInterface) { if (m_conversationsInterface) {
disconnect(m_conversationsInterface, SIGNAL(conversationUpdated(QDBusVariant)), this, SLOT(handleConversationUpdate(QDBusVariant))); disconnect(m_conversationsInterface, &DeviceConversationsDbusInterface::conversationUpdated, this, &ConversationModel::handleConversationUpdate);
disconnect(m_conversationsInterface, SIGNAL(conversationLoaded(qint64, quint64)), this, SLOT(handleConversationLoaded(qint64))); disconnect(m_conversationsInterface, &DeviceConversationsDbusInterface::conversationLoaded, this, &ConversationModel::handleConversationLoaded);
disconnect(m_conversationsInterface, SIGNAL(conversationCreated(QDBusVariant)), this, SLOT(handleConversationCreated(QDBusVariant))); disconnect(m_conversationsInterface, &DeviceConversationsDbusInterface::conversationCreated, this, &ConversationModel::handleConversationCreated);
delete m_conversationsInterface; delete m_conversationsInterface;
} }
m_deviceId = deviceId; m_deviceId = deviceId;
m_conversationsInterface = new DeviceConversationsDbusInterface(deviceId, this); m_conversationsInterface = new DeviceConversationsDbusInterface(deviceId, this);
connect(m_conversationsInterface, SIGNAL(conversationUpdated(QDBusVariant)), this, SLOT(handleConversationUpdate(QDBusVariant))); connect(m_conversationsInterface, &DeviceConversationsDbusInterface::conversationUpdated, this, &ConversationModel::handleConversationUpdate);
connect(m_conversationsInterface, SIGNAL(conversationLoaded(qint64, quint64)), this, SLOT(handleConversationLoaded(qint64))); connect(m_conversationsInterface, &DeviceConversationsDbusInterface::conversationLoaded, this, &ConversationModel::handleConversationLoaded);
connect(m_conversationsInterface, SIGNAL(conversationCreated(QDBusVariant)), this, SLOT(handleConversationCreated(QDBusVariant))); connect(m_conversationsInterface, &DeviceConversationsDbusInterface::conversationCreated, this, &ConversationModel::handleConversationCreated);
connect(m_conversationsInterface, SIGNAL(attachmentReceived(QString, QString)), this, SIGNAL(filePathReceived(QString, QString))); connect(m_conversationsInterface, &DeviceConversationsDbusInterface::attachmentReceived, this, &ConversationModel::filePathReceived);
QQmlApplicationEngine *engine = qobject_cast<QQmlApplicationEngine *>(QQmlEngine::contextForObject(this)->engine()); QQmlApplicationEngine *engine = qobject_cast<QQmlApplicationEngine *>(QQmlEngine::contextForObject(this)->engine());
m_thumbnailsProvider = dynamic_cast<ThumbnailsProvider *>(engine->imageProvider(QStringLiteral("thumbnailsProvider"))); m_thumbnailsProvider = dynamic_cast<ThumbnailsProvider *>(engine->imageProvider(QStringLiteral("thumbnailsProvider")));