Solid

fstabnetworkshare.cpp
1/*
2 SPDX-FileCopyrightText: 2011 Mario Bensi <mbensi@ipsquad.net>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "fstabnetworkshare.h"
8#include "fstabhandling.h"
9#include <solid/devices/backends/fstab/fstabdevice.h>
10
11using namespace Solid::Backends::Fstab;
12
13FstabNetworkShare::FstabNetworkShare(Solid::Backends::Fstab::FstabDevice *device)
14 : QObject(device)
15 , m_fstabDevice(device)
16{
17 QString url;
18 if (m_fstabDevice->device().startsWith("//")) {
19 QString fsType = FstabHandling::fstype(m_fstabDevice->device());
20 if (fsType == "cifs") {
21 m_type = Solid::NetworkShare::Cifs;
22 } else if (fsType == "smb3") {
23 m_type = Solid::NetworkShare::Smb3;
24 }
25 url = "smb:";
26 url += m_fstabDevice->device();
27 } else if (m_fstabDevice->device().contains(":/")) {
28 m_type = Solid::NetworkShare::Nfs;
29 url = "nfs://";
30 url += m_fstabDevice->vendor() + "/";
31 url += m_fstabDevice->product();
32 } else {
33 m_type = Solid::NetworkShare::Unknown;
34 }
35 m_url = QUrl(url);
36}
37
38FstabNetworkShare::~FstabNetworkShare()
39{
40}
41
42Solid::NetworkShare::ShareType FstabNetworkShare::type() const
43{
44 return m_type;
45}
46
47QUrl FstabNetworkShare::url() const
48{
49 return m_url;
50}
51
52const Solid::Backends::Fstab::FstabDevice *FstabNetworkShare::fstabDevice() const
53{
54 return m_fstabDevice;
55}
56
57#include "moc_fstabnetworkshare.cpp"
ShareType
This enum type defines the type of networkShare device can be.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.