Perform initialization in initialization list
Fixes variable is assigned in constructor body. Consider performing initialization in initialization list. (CWE-398)
This commit is contained in:
parent
25232b681f
commit
29f56dcc29
5 changed files with 7 additions and 9 deletions
|
@ -13,14 +13,13 @@
|
||||||
#include <QBluetoothServiceInfo>
|
#include <QBluetoothServiceInfo>
|
||||||
|
|
||||||
BluetoothLinkProvider::BluetoothLinkProvider()
|
BluetoothLinkProvider::BluetoothLinkProvider()
|
||||||
|
: mServiceUuid(QBluetoothUuid(QStringLiteral("185f3df4-3268-4e3f-9fca-d4d5059915bd")))
|
||||||
|
, mServiceDiscoveryAgent(new QBluetoothServiceDiscoveryAgent(this))
|
||||||
|
, connectTimer(new QTimer(this))
|
||||||
{
|
{
|
||||||
mServiceUuid = QBluetoothUuid(QStringLiteral("185f3df4-3268-4e3f-9fca-d4d5059915bd"));
|
|
||||||
|
|
||||||
connectTimer = new QTimer(this);
|
|
||||||
connectTimer->setInterval(30000);
|
connectTimer->setInterval(30000);
|
||||||
connectTimer->setSingleShot(false);
|
connectTimer->setSingleShot(false);
|
||||||
|
|
||||||
mServiceDiscoveryAgent = new QBluetoothServiceDiscoveryAgent(this);
|
|
||||||
mServiceDiscoveryAgent->setUuidFilter(mServiceUuid);
|
mServiceDiscoveryAgent->setUuidFilter(mServiceUuid);
|
||||||
connect(connectTimer, &QTimer::timeout, this, [this]() {
|
connect(connectTimer, &QTimer::timeout, this, [this]() {
|
||||||
mServiceDiscoveryAgent->start();
|
mServiceDiscoveryAgent->start();
|
||||||
|
|
|
@ -22,9 +22,8 @@ K_PLUGIN_CLASS_WITH_JSON(ContactsPlugin, "kdeconnect_contacts.json")
|
||||||
|
|
||||||
ContactsPlugin::ContactsPlugin(QObject *parent, const QVariantList &args)
|
ContactsPlugin::ContactsPlugin(QObject *parent, const QVariantList &args)
|
||||||
: KdeConnectPlugin(parent, args)
|
: KdeConnectPlugin(parent, args)
|
||||||
|
, vcardsPath(QString(*vcardsLocation).append(QStringLiteral("/kdeconnect-").append(device()->id())))
|
||||||
{
|
{
|
||||||
vcardsPath = QString(*vcardsLocation).append(QStringLiteral("/kdeconnect-").append(device()->id()));
|
|
||||||
|
|
||||||
// Register custom types with dbus
|
// Register custom types with dbus
|
||||||
qRegisterMetaType<uID>("uID");
|
qRegisterMetaType<uID>("uID");
|
||||||
qDBusRegisterMetaType<uID>();
|
qDBusRegisterMetaType<uID>();
|
||||||
|
|
|
@ -24,8 +24,8 @@ K_PLUGIN_CLASS_WITH_JSON(MprisControlPlugin, "kdeconnect_mpriscontrol.json")
|
||||||
|
|
||||||
MprisControlPlugin::MprisControlPlugin(QObject *parent, const QVariantList &args)
|
MprisControlPlugin::MprisControlPlugin(QObject *parent, const QVariantList &args)
|
||||||
: KdeConnectPlugin(parent, args)
|
: KdeConnectPlugin(parent, args)
|
||||||
|
, sessionManager(GlobalSystemMediaTransportControlsSessionManager::RequestAsync().get())
|
||||||
{
|
{
|
||||||
sessionManager = GlobalSystemMediaTransportControlsSessionManager::RequestAsync().get();
|
|
||||||
sessionManager->SessionsChanged([this](GlobalSystemMediaTransportControlsSessionManager, SessionsChangedEventArgs) {
|
sessionManager->SessionsChanged([this](GlobalSystemMediaTransportControlsSessionManager, SessionsChangedEventArgs) {
|
||||||
this->updatePlayerList();
|
this->updatePlayerList();
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,8 +21,8 @@ K_PLUGIN_CLASS_WITH_JSON(SftpPlugin, "kdeconnect_sftp.json")
|
||||||
|
|
||||||
SftpPlugin::SftpPlugin(QObject *parent, const QVariantList &args)
|
SftpPlugin::SftpPlugin(QObject *parent, const QVariantList &args)
|
||||||
: KdeConnectPlugin(parent, args)
|
: KdeConnectPlugin(parent, args)
|
||||||
|
, deviceId(device()->id())
|
||||||
{
|
{
|
||||||
deviceId = device()->id();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SftpPlugin::~SftpPlugin()
|
SftpPlugin::~SftpPlugin()
|
||||||
|
|
|
@ -40,8 +40,8 @@ struct SftpPlugin::Pimpl {
|
||||||
SftpPlugin::SftpPlugin(QObject *parent, const QVariantList &args)
|
SftpPlugin::SftpPlugin(QObject *parent, const QVariantList &args)
|
||||||
: KdeConnectPlugin(parent, args)
|
: KdeConnectPlugin(parent, args)
|
||||||
, d(new Pimpl())
|
, d(new Pimpl())
|
||||||
|
, deviceId(device()->id())
|
||||||
{
|
{
|
||||||
deviceId = device()->id();
|
|
||||||
addToDolphin();
|
addToDolphin();
|
||||||
qCDebug(KDECONNECT_PLUGIN_SFTP) << "Created device:" << device()->name();
|
qCDebug(KDECONNECT_PLUGIN_SFTP) << "Created device:" << device()->name();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue