File indexing completed on 2025-01-05 05:23:50
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 "bytearrayrawfileconnectjob.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 ByteArrayRawFileConnectJob::ByteArrayRawFileConnectJob(ByteArrayRawFileSynchronizer* synchronizer, 0022 AbstractDocument* document, 0023 const QUrl& url, 0024 AbstractModelSynchronizer::ConnectOption option) 0025 : AbstractFileSystemConnectJob(synchronizer, document, url, option) 0026 { 0027 } 0028 0029 ByteArrayRawFileConnectJob::~ByteArrayRawFileConnectJob() = default; 0030 0031 void ByteArrayRawFileConnectJob::startConnectWithFile() 0032 { 0033 auto* byteArrayDocument = qobject_cast<ByteArrayDocument*>(document()); 0034 auto* writeThread = new ByteArrayRawFileWriteThread(this, byteArrayDocument, file()); 0035 writeThread->start(); 0036 while (!writeThread->wait(100)) { 0037 QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); 0038 } 0039 0040 qobject_cast<ByteArrayRawFileSynchronizer*>(synchronizer())->setDocument(byteArrayDocument); 0041 const bool success = writeThread->success(); 0042 delete writeThread; 0043 0044 // if( success ) 0045 // ExternalBookmarkStorage().writeBookmarks( byteArrayDocument, synchronizer()->url() ); 0046 0047 complete(success); 0048 } 0049 0050 } 0051 0052 #include "moc_bytearrayrawfileconnectjob.cpp"