File indexing completed on 2025-02-09 07:11:24
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_ABSTRACTFILESYSTEMSYNCFROMREMOTEJOB_P_HPP 0010 #define KASTEN_ABSTRACTFILESYSTEMSYNCFROMREMOTEJOB_P_HPP 0011 0012 // library 0013 #include "abstractfilesystemsyncfromremotejob.hpp" 0014 #include <abstractsyncfromremotejob_p.hpp> 0015 // KF 0016 #include <QTemporaryFile> 0017 0018 namespace Kasten { 0019 0020 class AbstractModelFileSystemSynchronizer; 0021 0022 class AbstractFileSystemSyncFromRemoteJobPrivate : public AbstractSyncFromRemoteJobPrivate 0023 { 0024 public: 0025 AbstractFileSystemSyncFromRemoteJobPrivate(AbstractFileSystemSyncFromRemoteJob* parent, 0026 AbstractModelFileSystemSynchronizer* synchronizer); 0027 0028 ~AbstractFileSystemSyncFromRemoteJobPrivate() override; 0029 0030 public: // KJob API 0031 void start(); 0032 0033 public: 0034 AbstractModelFileSystemSynchronizer* synchronizer() const; 0035 QFile* file() const; 0036 0037 public: 0038 void completeRead(bool success); 0039 0040 public: // slots 0041 void syncFromRemote(); 0042 0043 protected: 0044 AbstractModelFileSystemSynchronizer* mSynchronizer; 0045 QString mWorkFilePath; 0046 QString mTempFilePath; 0047 QFile* mFile = nullptr; 0048 0049 private: 0050 Q_DECLARE_PUBLIC(AbstractFileSystemSyncFromRemoteJob) 0051 }; 0052 0053 inline AbstractFileSystemSyncFromRemoteJobPrivate::AbstractFileSystemSyncFromRemoteJobPrivate(AbstractFileSystemSyncFromRemoteJob* parent, 0054 AbstractModelFileSystemSynchronizer* synchronizer) 0055 : AbstractSyncFromRemoteJobPrivate(parent) 0056 , mSynchronizer(synchronizer) 0057 { 0058 } 0059 0060 inline AbstractFileSystemSyncFromRemoteJobPrivate::~AbstractFileSystemSyncFromRemoteJobPrivate() = default; 0061 0062 inline QFile* AbstractFileSystemSyncFromRemoteJobPrivate::file() const { return mFile; } 0063 // TODO: setup a notification system 0064 inline AbstractModelFileSystemSynchronizer* AbstractFileSystemSyncFromRemoteJobPrivate::synchronizer() const 0065 { 0066 return mSynchronizer; 0067 } 0068 0069 inline void AbstractFileSystemSyncFromRemoteJobPrivate::start() 0070 { 0071 Q_Q(AbstractFileSystemSyncFromRemoteJob); 0072 0073 QMetaObject::invokeMethod(q, "syncFromRemote", Qt::QueuedConnection); 0074 } 0075 0076 } 0077 0078 #endif