File indexing completed on 2024-05-05 17:43:12
0001 /* 0002 * SPDX-FileCopyrightText: 2017 Ivan Cukic <ivan.cukic (at) kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef PLASMAVAULT_KDED_ENGINE_BACKENDS_FUSE_BACKEND_P_H 0008 #define PLASMAVAULT_KDED_ENGINE_BACKENDS_FUSE_BACKEND_P_H 0009 0010 #include "backend_p.h" 0011 0012 #include <QProcess> 0013 0014 namespace PlasmaVault 0015 { 0016 class FuseBackend : public Backend 0017 { 0018 public: 0019 FuseBackend(); 0020 ~FuseBackend() override; 0021 0022 bool isOpened(const MountPoint &mountPoint) const override; 0023 0024 FutureResult<> initialize(const QString &name, const Device &device, const MountPoint &mountPoint, const Vault::Payload &payload) override; 0025 0026 FutureResult<> import(const QString &name, const Device &device, const MountPoint &mountPoint, const Vault::Payload &payload) override; 0027 0028 FutureResult<> open(const Device &device, const MountPoint &mountPoint, const Vault::Payload &payload) override; 0029 0030 FutureResult<> close(const Device &device, const MountPoint &mountPoint) override; 0031 0032 FutureResult<> dismantle(const Device &device, const MountPoint &mountPoint, const Vault::Payload &payload) override; 0033 0034 protected: 0035 virtual FutureResult<> mount(const Device &device, const MountPoint &mountPoint, const Vault::Payload &payload) = 0; 0036 0037 QProcess *process(const QString &command, const QStringList &args, const QHash<QString, QString> &environment) const; 0038 0039 QFuture<QPair<bool, QString>> checkVersion(QProcess *process, const std::tuple<int, int, int> &requiredVersion) const; 0040 0041 QProcess *fusermount(const QStringList &arguments = QStringList()) const; 0042 0043 static Result<> hasProcessFinishedSuccessfully(QProcess *process); 0044 0045 // dolphin has a tendency to create a .directory file, which would 0046 // disable our ability to mount there. 0047 // Check the contents of the dir (should be empty) and if the only item 0048 // there is the dot-directroy, delete it. 0049 static void removeDotDirectory(const MountPoint &mountPoint); 0050 }; 0051 0052 } // namespace PlasmaVault 0053 0054 #endif // include guard