File indexing completed on 2024-11-17 04:55:41

0001 /*
0002  *   SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #pragma once
0008 
0009 #include "PackageKitResource.h"
0010 
0011 class LocalFilePKResource : public PackageKitResource
0012 {
0013     Q_OBJECT
0014 public:
0015     LocalFilePKResource(QUrl path, PackageKitBackend *parent);
0016 
0017     QString name() const override;
0018     QString comment() override;
0019 
0020     quint64 size() override;
0021     QString origin() const override;
0022     void fetchDetails() override;
0023     bool canExecute() const override
0024     {
0025         return !m_exec.isEmpty();
0026     }
0027     void invokeApplication() const override;
0028     QString displayOrigin() const override
0029     {
0030         return origin();
0031     }
0032 
0033     void resolve(const PackageKit::Details &inDetails);
0034 
0035 private:
0036     AbstractResource::State m_state = AbstractResource::Broken;
0037     QUrl m_path;
0038     QString m_exec;
0039 };