File indexing completed on 2025-03-09 05:20:51

0001 /*
0002     This file is part of the Kasten Framework, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2008-2009, 2011 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_ABSTRACTFILESYSTEMEXPORTJOB_P_HPP
0010 #define KASTEN_ABSTRACTFILESYSTEMEXPORTJOB_P_HPP
0011 
0012 // lib
0013 #include "abstractfilesystemexportjob.hpp"
0014 #include <abstractexportjob_p.hpp>
0015 // Qt
0016 #include <QUrl>
0017 
0018 namespace Kasten {
0019 
0020 class AbstractFileSystemExportJobPrivate : public AbstractExportJobPrivate
0021 {
0022 public:
0023     AbstractFileSystemExportJobPrivate(AbstractFileSystemExportJob* parent,
0024                                        AbstractModel* model, const AbstractModelSelection* selection, const QUrl& url);
0025 
0026     ~AbstractFileSystemExportJobPrivate() override;
0027 
0028 public: // KJob API
0029     virtual void start();
0030 
0031 public:
0032     void completeExport(bool success);
0033 
0034 public:
0035     AbstractModel* model() const;
0036     const AbstractModelSelection* selection() const;
0037     QFile* file() const;
0038 
0039 public: // slot
0040     void exportToFile();
0041 
0042 protected:
0043     AbstractModel* const mModel;
0044     const AbstractModelSelection* const mSelection;
0045     const QUrl mUrl;
0046     QFile* mFile = nullptr;
0047     QString mWorkFilePath;
0048 
0049 private:
0050     Q_DECLARE_PUBLIC(AbstractFileSystemExportJob)
0051 };
0052 
0053 inline AbstractFileSystemExportJobPrivate::AbstractFileSystemExportJobPrivate(AbstractFileSystemExportJob* parent,
0054                                                                               AbstractModel* model, const AbstractModelSelection* selection,
0055                                                                               const QUrl& url)
0056     : AbstractExportJobPrivate(parent)
0057     , mModel(model)
0058     , mSelection(selection)
0059     , mUrl(url)
0060 {}
0061 
0062 inline AbstractFileSystemExportJobPrivate::~AbstractFileSystemExportJobPrivate() = default;
0063 
0064 inline AbstractModel* AbstractFileSystemExportJobPrivate::model()                    const { return mModel; }
0065 inline const AbstractModelSelection* AbstractFileSystemExportJobPrivate::selection() const { return mSelection; }
0066 inline QFile* AbstractFileSystemExportJobPrivate::file()                             const { return mFile; }
0067 
0068 inline void AbstractFileSystemExportJobPrivate::start()
0069 {
0070     Q_Q(AbstractFileSystemExportJob);
0071 
0072     QMetaObject::invokeMethod(q, "exportToFile", Qt::QueuedConnection);
0073 }
0074 
0075 }
0076 
0077 #endif