MCPcopy Create free account
hub / github.com/LANDrop/LANDrop / createNextFile

Method createNextFile

LANDrop/filetransferreceiver.cpp:140–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void FileTransferReceiver::createNextFile()
141{
142 while (!transferQ.empty()) {
143 FileMetadata &curFile = transferQ.first();
144 QString filename = downloadPath + QDir::separator() + curFile.filename;
145 if (writingFile) {
146 writingFile->deleteLater();
147 writingFile = nullptr;
148 }
149 writingFile = new QFile(filename, this);
150 if (!writingFile->open(QIODevice::WriteOnly)) {
151 emit errorOccurred(tr("Unable to open file %1.").arg(filename));
152 return;
153 }
154 if (curFile.size > 0) {
155 emit printMessage(tr("Receiving file %1...").arg(curFile.filename));
156 break;
157 }
158 transferQ.pop_front();
159 }
160 if (transferQ.empty()) {
161 if (writingFile) {
162 writingFile->deleteLater();
163 writingFile = nullptr;
164 }
165 state = FINISHED;
166 QDesktopServices::openUrl(QUrl::fromLocalFile(downloadPath));
167 emit printMessage(tr("Done!"));
168 socket->disconnectFromHost();
169 QTimer::singleShot(5000, this, &FileTransferSession::ended);
170 }
171}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected