Changeset View
Changeset View
Standalone View
Standalone View
src/solid/devices/backends/iokit/iokitdeviceinterface.cpp
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | Copyright 2009 Harald Fernengel <harry@kdevelop.org> | 2 | Copyright 2009 Harald Fernengel <harry@kdevelop.org> | ||
3 | Copyright 2017 René J.V. Bertin <rjvbertin@gmail.com> | ||||
3 | 4 | | |||
4 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public | ||
6 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either | ||
7 | version 2.1 of the License, or (at your option) version 3, or any | 8 | version 2.1 of the License, or (at your option) version 3, or any | ||
8 | later version accepted by the membership of KDE e.V. (or its | 9 | later version accepted by the membership of KDE e.V. (or its | ||
9 | successor approved by the membership of KDE e.V.), which shall | 10 | successor approved by the membership of KDE e.V.), which shall | ||
10 | act as a proxy defined in Section 6 of version 3 of the license. | 11 | act as a proxy defined in Section 6 of version 3 of the license. | ||
11 | 12 | | |||
12 | This library is distributed in the hope that it will be useful, | 13 | This library is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Lesser General Public License for more details. | 16 | Lesser General Public License for more details. | ||
16 | 17 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 18 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 19 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 20 | */ | ||
20 | 21 | | |||
21 | #include "iokitdeviceinterface.h" | 22 | #include "iokitdeviceinterface.h" | ||
22 | 23 | | |||
23 | using namespace Solid::Backends::IOKit; | 24 | using namespace Solid::Backends::IOKit; | ||
24 | 25 | | |||
25 | DeviceInterface::DeviceInterface(IOKitDevice *device) | 26 | DeviceInterface::DeviceInterface(IOKitDevice *device) | ||
26 | : QObject(device), m_device(device) | 27 | : QObject(device) | ||
28 | , m_device(device) | ||||
29 | , m_deviceCopy(nullptr) | ||||
27 | { | 30 | { | ||
28 | } | 31 | } | ||
29 | 32 | | |||
33 | DeviceInterface::DeviceInterface(const IOKitDevice *device) | ||||
34 | : QObject(device->parent()), m_deviceCopy(new IOKitDevice(*device)) | ||||
35 | { | ||||
36 | m_device = m_deviceCopy; | ||||
37 | } | ||||
38 | | ||||
30 | DeviceInterface::~DeviceInterface() | 39 | DeviceInterface::~DeviceInterface() | ||
31 | { | 40 | { | ||
41 | if (m_deviceCopy) { | ||||
42 | delete m_deviceCopy; | ||||
43 | m_deviceCopy = nullptr; | ||||
44 | } | ||||
32 | } | 45 | } | ||
33 | 46 | |