File indexing completed on 2024-11-24 04:55:02

0001 /*
0002  *   SPDX-FileCopyrightText: 2013 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 <QPointer>
0010 #include <Transaction/Transaction.h>
0011 #include <resources/AbstractResource.h>
0012 
0013 class SnapResource;
0014 class QSnapdRequest;
0015 class QSnapdClient;
0016 
0017 class SnapTransaction : public Transaction
0018 {
0019     Q_OBJECT
0020 public:
0021     SnapTransaction(QSnapdClient *client, SnapResource *app, Role role, AbstractResource::State newState);
0022 
0023     void cancel() override;
0024     void proceed() override;
0025 
0026 private Q_SLOTS:
0027     void finishTransaction();
0028 
0029 private:
0030     void setRequest(QSnapdRequest *req);
0031     void progressed();
0032 
0033     QSnapdClient *const m_client;
0034     SnapResource *const m_app;
0035     QScopedPointer<QSnapdRequest> m_request;
0036     const AbstractResource::State m_newState;
0037 };