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(QLatin1String("//"))) {
19 QString fsType = FstabHandling::fstype(m_fstabDevice->device());
20 if (fsType == QLatin1String("cifs")) {
21 m_type = Solid::NetworkShare::Cifs;
22 } else if (fsType == QLatin1String("smb3")) {
23 m_type = Solid::NetworkShare::Smb3;
24 }
25 url = QStringLiteral("smb:%1").arg(m_fstabDevice->device());
26 } else if (m_fstabDevice->device().contains(QLatin1String(":/"))) {
27 m_type = Solid::NetworkShare::Nfs;
28 url = QStringLiteral("nfs://%1/%2").arg(m_fstabDevice->vendor(), m_fstabDevice->product());
29 } else {
30 m_type = Solid::NetworkShare::Unknown;
31 }
32 m_url = QUrl(url);
33}
34
35FstabNetworkShare::~FstabNetworkShare()
36{
37}
38
39Solid::NetworkShare::ShareType FstabNetworkShare::type() const
40{
41 return m_type;
42}
43
44QUrl FstabNetworkShare::url() const
45{
46 return m_url;
47}
48
49const Solid::Backends::Fstab::FstabDevice *FstabNetworkShare::fstabDevice() const
50{
51 return m_fstabDevice;
52}
53
54#include "moc_fstabnetworkshare.cpp"
ShareType
This enum type defines the type of networkShare device can be.
QString arg(Args &&... args) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:47:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.