File indexing completed on 2025-01-19 05:20:17

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2008-2009 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 #include "bytearrayrawfilewritejob.hpp"
0010 
0011 // lib
0012 // #include "externalbookmarkstorage.hpp"
0013 #include "bytearrayrawfilesynchronizer.hpp"
0014 #include "bytearrayrawfilewritethread.hpp"
0015 #include "bytearraydocument.hpp"
0016 // Qt
0017 #include <QCoreApplication>
0018 
0019 namespace Kasten {
0020 
0021 ByteArrayRawFileWriteJob::ByteArrayRawFileWriteJob(ByteArrayRawFileSynchronizer* synchronizer)
0022     : AbstractFileSystemSyncToRemoteJob(synchronizer)
0023 {}
0024 
0025 ByteArrayRawFileWriteJob::~ByteArrayRawFileWriteJob() = default;
0026 
0027 void ByteArrayRawFileWriteJob::startWriteToFile()
0028 {
0029     auto* document = qobject_cast<ByteArrayDocument*>(synchronizer()->document());
0030     auto* writeThread = new ByteArrayRawFileWriteThread(this, document, file());
0031     writeThread->start();
0032     while (!writeThread->wait(100)) {
0033         QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
0034     }
0035 
0036     const bool success = writeThread->success();
0037     delete writeThread;
0038 
0039 //     if( success )
0040 //         ExternalBookmarkStorage().writeBookmarks( document, synchronizer()->url() );
0041 
0042     completeWrite(success);
0043 }
0044 
0045 }
0046 
0047 #include "moc_bytearrayrawfilewritejob.cpp"