Solid

winstorageaccess.cpp
1/*
2 SPDX-FileCopyrightText: 2013 Patrick von Reth <vonreth@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "winstorageaccess.h"
8#include "winblock.h"
9#include "winstoragedrive.h"
10
11using namespace Solid::Backends::Win;
12
13WinStorageAccess::WinStorageAccess(WinDevice *device)
14 : WinInterface(device)
15{
16}
17
18WinStorageAccess::~WinStorageAccess()
19{
20}
21
22bool WinStorageAccess::isAccessible() const
23{
24 return true;
25}
26
27QString WinStorageAccess::filePath() const
28{
29 return WinBlock::driveLetterFromUdi(m_device->udi()).append(QStringLiteral("/"));
30}
31
32bool WinStorageAccess::isIgnored() const
33{
34 return false;
35}
36
37bool WinStorageAccess::isEncrypted() const
38{
39 // TODO: implementation left for Win developer
40 return false;
41}
42
43bool WinStorageAccess::setup()
44{
45 return true;
46}
47
48bool WinStorageAccess::teardown()
49{
50 // only allow eject if we are an usb stick
51 // else we get "The request could not be performed because of an I/O device error. 1117"
52 if (m_device->queryDeviceInterface(Solid::DeviceInterface::StorageVolume) && WinStorageDrive(m_device).driveType() == Solid::StorageDrive::MemoryStick) {
53 WinDeviceManager::deviceAction(WinBlock::driveLetterFromUdi(m_device->udi()), IOCTL_STORAGE_EJECT_MEDIA);
54 }
55 return true;
56}
57
58#include "moc_winstorageaccess.cpp"
QString & append(QChar ch)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.